﻿/* Order Portal - Light Industrial v2 */

.portal-body,
.dyj-order-portal-embed {
    --bg: #f5f7fa;
    --panel: rgba(255,255,255,.82);
    --ink: #172033;
    --muted: #6b7280;
    --line: #d9dee8;
    --accent: #2563eb;
    --accent-dim: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.06);

    --portal-bg: var(--bg);
    --portal-panel: white;
    --portal-ink: var(--ink);
    --portal-muted: var(--muted);
    --portal-line: var(--line);
    --portal-accent: var(--accent);
    --portal-accent-dim: var(--accent-dim);
    --portal-success: var(--success);
    --portal-warning: var(--warning);
    --portal-danger: var(--danger);
    --portal-radius: var(--radius);
    --portal-shadow: var(--shadow);

    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Shell */
.portal-shell {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px;
}

.portal-shell[data-wide="true"] {
    max-width: min(calc(100% - 48px), 1480px);
}

.portal-body.portal-authenticated .portal-shell, .dyj-order-portal-embed.portal-authenticated .portal-shell {
    max-width: min(calc(100% - 48px), 1480px);
    padding: 24px;
}
@media (max-width: 768px) {
    .portal-body.portal-authenticated .portal-shell, .dyj-order-portal-embed.portal-authenticated .portal-shell { max-width: calc(100% - 24px); padding: 12px; }
    .portal-shell[data-wide="true"] { max-width: calc(100% - 24px); padding: 12px; }
}

/* Login */
.portal-login-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; min-height: 40vh; }
@media (max-width: 720px) { .portal-login-layout { grid-template-columns: 1fr; } }
.portal-login-intro h2 { font-size: 28px; font-weight: 700; margin: 0 0 .5rem; }
.portal-login-intro .portal-hint { font-size: 14px; margin-bottom: 1.5rem; }
.portal-login-features { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.portal-login-features li { padding: .35rem 0; font-size: 13px; color: var(--muted); }
.portal-login-features li::before { content: "\2713 "; color: var(--success); margin-right: .5rem; font-weight: 700; }
.portal-body.portal-authenticated .portal-login-layout, .dyj-order-portal-embed.portal-authenticated .portal-login-layout { display: none; }
.portal-login-card { max-width: 360px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.portal-login-card h3 { margin: 0 0 .5rem; font-size: 16px; }

/* Header */
.portal-header {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--panel); backdrop-filter: blur(12px);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: .6rem 1.25rem; margin-bottom: 1.25rem;
}
.portal-header h1 { margin: 0; font-size: 17px; font-weight: 600; }
.portal-eyebrow { margin: 0 0 1px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

/* Buttons */
.portal-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .4rem .9rem; border: none; border-radius: var(--radius);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background .15s, opacity .15s;
    width: auto; white-space: nowrap;
}
.portal-btn-primary { background: var(--accent); color: #fff; }
.portal-btn-primary:hover { background: var(--accent-dim); }
.portal-btn-secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.portal-btn-secondary:hover { background: #f9fafb; }
.portal-btn-ghost { background: none; color: var(--ink); border: 1px solid transparent; }
.portal-btn-ghost:hover { background: #f9fafb; border-color: var(--line); }
.portal-btn-danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.portal-btn-danger:hover { background: #fef2f2; }
.portal-btn-sm { padding: .25rem .6rem; font-size: 12px; }
.portal-btn-block { width: 100%; }
.portal-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Badge */
.portal-badge {
    display: inline-block; padding: 0 .4rem; border-radius: 3px;
    font-size: 11px; font-weight: 500; line-height: 1.6;
}
.portal-badge.active { background: #dcfce7; color: var(--success); }
.portal-badge.status-active, .portal-badge.status-open { background: #dbeafe; color: var(--accent); }
.portal-badge.status-completed { background: #dcfce7; color: var(--success); }
.portal-badge.status-on_hold { background: #fef9c3; color: var(--warning); }
.portal-badge.status-disabled { background: #fef2f2; color: var(--danger); }
.portal-badge.status-cancelled { background: #f3f4f6; color: var(--muted); }

/* Tabs */
.portal-tabs, .portal-sales-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto;
}
.portal-tabs button, .portal-sales-tabs button {
    padding: .5rem 1rem; border: none; background: none;
    font: inherit; font-size: 13px; cursor: pointer; color: var(--muted);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.portal-tabs button.active, .portal-sales-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.portal-tabs button:hover, .portal-sales-tabs button:hover { color: var(--accent); }

.portal-admin-tabs {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 3px; display: inline-flex; gap: 2px; margin-bottom: 1rem;
}
.portal-admin-tabs button {
    padding: .4rem .85rem; border: none; background: none;
    font: inherit; font-size: 13px; cursor: pointer; color: var(--muted);
    border-radius: 4px; white-space: nowrap;
}
.portal-admin-tabs button.active { background: var(--accent); color: #fff; }
.portal-admin-tabs button:hover:not(.active) { background: #f3f4f6; }

/* Table */
.portal-table-wrap { overflow-x: auto; }
.portal-table, .portal-admin-table {
    width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px; table-layout: fixed;
}
.portal-table th, .portal-admin-table th {
    text-align: left; padding: .5rem .75rem; background: #f8fafc;
    border-bottom: 2px solid var(--line); font-weight: 600; font-size: 12px;
    color: var(--muted); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.portal-table td, .portal-admin-table td {
    padding: .4rem .75rem; border-bottom: 1px solid #f0f0f0; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.portal-table tbody tr:hover, .portal-admin-table tbody tr:hover { background: #f9fafb; }
.portal-table tbody tr[onclick], .portal-admin-table tbody tr[onclick] { cursor: pointer; }

/* Panel */
.portal-panel {
    background: white; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.portal-panel h3 { font-size: 15px; margin: 0 0 .75rem; }
.portal-panel-narrow { max-width: 500px; }
.portal-panel-compact { max-width: 440px; }

/* Cards */
.portal-dashboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.portal-order-card {
    background: white; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; cursor: pointer; transition: box-shadow .15s;
}
.portal-order-card:hover { box-shadow: var(--shadow); }
.portal-order-card.has-updates { border-color: var(--accent); }
.portal-order-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.portal-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; }
.portal-card-meta, .portal-order-meta { display: flex; flex-wrap: wrap; gap: .75rem; font-size: 12px; color: var(--muted); }

/* Stage summary & progress */
.portal-stage-summary {
    padding: .6rem .75rem; background: #f8fafc; border-radius: var(--radius);
    margin-bottom: .75rem; display: flex; justify-content: space-between; align-items: center;
}
.portal-stage-summary span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.portal-stage-summary strong { font-size: 13px; color: var(--accent); }
.portal-progress-track { height: 4px; background: var(--line); border-radius: 2px; margin-bottom: .5rem; overflow: hidden; }
.portal-progress-track span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }
.portal-progress-fill { width: var(--progress, 0%); }
.portal-progress-10 { --progress: 10%; }
.portal-progress-22 { --progress: 22%; }
.portal-progress-38 { --progress: 38%; }
.portal-progress-40 { --progress: 40%; }
.portal-progress-55 { --progress: 55%; }
.portal-progress-70 { --progress: 70%; }
.portal-progress-82 { --progress: 82%; }
.portal-progress-92 { --progress: 92%; }
.portal-progress-100 { --progress: 100%; }

/* Stepper */
.portal-stepper { display: flex; justify-content: space-between; padding: .75rem 0; margin: .5rem 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.portal-stepper-step { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.portal-stepper-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.portal-stepper-step.active .portal-stepper-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.portal-stepper-step.done .portal-stepper-dot { background: var(--success); }
.portal-stepper-step small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.portal-stepper-step.active small { color: var(--ink); font-weight: 600; }

/* Timeline */
.portal-timeline { position: relative; padding-left: 24px; }
.portal-timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.portal-timeline-item { position: relative; margin-bottom: 1rem; }
.portal-timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid white; }
.portal-timeline-content strong { display: block; font-size: 13px; }
.portal-timeline-content small { font-size: 11px; color: var(--muted); }
.portal-timeline-content p { font-size: 13px; margin: .25rem 0 0; }

/* Media */
.portal-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.portal-media-item { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.portal-media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portal-media-preview {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
}

.portal-media-meta {
    display: block;
    padding: .25rem .5rem;
    font-size: 11px;
    color: var(--muted);
}
.portal-media-item small { display: none; }
.portal-media-skeleton { padding: .5rem; }
.portal-media-error {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
}

/* Messages */
.portal-messages { display: flex; flex-direction: column; gap: .5rem; }
.portal-msg { padding: .75rem; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.portal-msg-reply { margin-left: 2rem; background: #f8fafc; }
.portal-msg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.portal-msg-head strong { font-size: 13px; }
.portal-msg-head small { font-size: 12px; color: var(--muted); }
.portal-msg p { font-size: 13px; margin: .25rem 0 0; }
.portal-msg-form { margin-top: .5rem; }
.portal-msg-form textarea {
    width: 100%; padding: .5rem; border: 1px solid var(--line);
    border-radius: var(--radius); font: inherit; font-size: 13px; box-sizing: border-box; resize: vertical;
}

/* Form */
.portal-field { margin-bottom: .75rem; }
.portal-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: .25rem; }
.portal-field input, .portal-field select, .portal-field textarea {
    width: 100%; padding: .45rem .6rem; border: 1px solid var(--line);
    border-radius: var(--radius); font: inherit; font-size: 13px; box-sizing: border-box;
}
.portal-field input:focus, .portal-field select:focus, .portal-field textarea:focus { outline: none; border-color: var(--accent); }
.portal-error { color: var(--danger); font-size: 13px; margin: .5rem 0; }
.portal-hint, .portal-footnote { color: var(--muted); font-size: 13px; }

/* Empty state */
.portal-empty { padding: 3rem 1rem; text-align: center; color: var(--muted); font-size: 13px; }
.portal-empty-state {
    background: white; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 2.5rem 2rem; text-align: center;
}
.portal-empty-state-icon { font-size: 32px; margin-bottom: .5rem; }
.portal-empty-state h3 { font-size: 15px; margin: 0 0 .25rem; }
.portal-empty-state p { font-size: 13px; color: var(--muted); margin: 0 0 1rem; }
.portal-cta-row { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }

/* Admin */
.portal-admin-content { min-height: 300px; }
.portal-admin-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.portal-admin-kpi-grid-spaced { margin-bottom: 1rem; }
.portal-admin-kpi {
    background: white; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; text-align: center;
}
.portal-admin-kpi strong { display: block; font-size: 28px; font-weight: 700; color: var(--accent); }
.portal-admin-kpi span { font-size: 12px; color: var(--muted); }
.portal-admin-kpi small { display: block; margin-top: .25rem; font-size: 11px; color: var(--muted); }
.portal-admin-overview-grid {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    gap: 1rem; margin-top: 1rem; align-items: start;
}
.portal-admin-overview-main, .portal-admin-overview-side { min-width: 0; }
.portal-command-bar {
    display: flex; align-items: center; gap: .75rem; padding-bottom: .75rem;
    margin-bottom: .75rem; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.portal-command-bar h3 { margin: 0; font-size: 15px; }
.portal-command-bar span { font-size: 12px; color: var(--muted); flex: 1; }
.portal-admin-detail-layout {
    display: grid; grid-template-columns: 1fr auto; gap: 1rem;
    background: white; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 1rem;
}

/* Detail grid */
.portal-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .portal-detail-grid { grid-template-columns: 1fr; } }
.portal-action-rail { display: flex; flex-direction: column; gap: .5rem; }
.portal-section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 1.25rem 0 .5rem; }

/* Role header */
.portal-role-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: 1.25rem;
}
.portal-role-header h2 { margin: 0; font-size: 20px; font-weight: 600; }

.portal-header-main { display: flex; align-items: center; gap: .75rem; min-width: 0; }

.portal-header-main > div { min-width: 0; display: grid; gap: 3px; }

.portal-header-main > div > b { display: block; font-size: 14px; font-weight: 500; color: var(--muted); }

.portal-header-main > div > span { display: block; font-size: 13px; color: var(--muted); }

.portal-back-button { flex-shrink: 0; }
.portal-header-actions { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.portal-sync-label {
    display: inline-flex; align-items: center; gap: .25rem;
    color: var(--muted); font-size: 12px; margin-right: .25rem; white-space: nowrap;
    flex: 0 0 auto;
}
.portal-sync-label .portal-sync-dot { flex: 0 0 auto; }

/* Note card */
.portal-note-card {
    background: #f8fafc; border-left: 3px solid var(--accent);
    padding: .75rem; margin-bottom: 1rem; color: var(--muted); font-size: 13px;
}
.portal-note-card-clickable { cursor: pointer; }
.portal-list-refresh-banner {
    cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.portal-message-refresh-banner { cursor: pointer; }

/* Sales actions */
.portal-sales-actions {
    display: grid; gap: .75rem; margin-bottom: 1rem;
}
.portal-sales-actions h4 { margin: .5rem 0; font-size: 13px; }
.portal-action-card {
    background: #f8fafc; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem;
}
.portal-action-card h4 { margin-top: 0; }

/* Picker */
.portal-picker-option {
    width: 100%; display: block; text-align: left; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: .65rem .75rem; margin-top: .4rem; cursor: pointer; font: inherit;
}
.portal-picker-option:hover { border-color: var(--accent); background: #f8fbff; }
.portal-picker-option strong { display: block; font-size: 13px; }
.portal-picker-option span { display: block; margin-top: .15rem; font-size: 12px; color: var(--muted); }
.portal-picker-selected {
    display: flex; align-items: center; gap: .5rem;
    border: 1px solid var(--accent); background: #eff6ff;
    border-radius: var(--radius); padding: .55rem .65rem; margin-top: .5rem;
}
.portal-picker-selected strong { font-size: 13px; }
.portal-picker-selected span { font-size: 12px; color: var(--muted); flex: 1; }
.portal-picker-selected button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }

/* Toast */
.portal-toast-region { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; max-width: 360px; }
@media (max-width: 640px) { .portal-toast-region { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; align-items: center; } }
.portal-toast {
    background: white; border: 1px solid var(--line); border-radius: var(--radius);
    padding: .75rem 1rem; box-shadow: 0 2px 12px rgba(0,0,0,.08); font-size: 13px;
    transition: opacity .2s, transform .2s;
}
.portal-toast.is-entering { opacity: 0; transform: translateY(8px); }
.portal-toast.is-leaving { opacity: 0; transform: translateY(8px); }
.portal-toast.is-clickable { cursor: pointer; }
.portal-toast-title { font-weight: 600; margin-bottom: .15rem; }
.portal-toast-count { font-size: 11px; color: var(--muted); }

/* Live badge */
.portal-live-badge { display: inline-block; background: var(--accent); color: #fff; border-radius: 100px; padding: 0 .35rem; font-size: 10px; font-weight: 600; line-height: 1.5; vertical-align: middle; margin-left: .25rem; }

/* Sync */
.portal-sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: .25rem; }
.portal-sync-connecting { background: #f59e0b; }
.portal-sync-live { background: var(--success); }
.portal-sync-reconnecting { background: #f59e0b; animation: portal-pulse 1s infinite; }
.portal-sync-stale { background: #f59e0b; }
.portal-sync-offline { background: var(--danger); }
.portal-sync-resyncing { background: var(--accent); }
@keyframes portal-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
@media (prefers-reduced-motion: reduce) { .portal-sync-reconnecting { animation: none; } }

.portal-sync-strip { padding: .3rem 1rem; text-align: center; font-size: 12px; border-bottom: 1px solid var(--line); display: none; }
.portal-sync-strip.visible { display: block; }
.portal-sync-stale-strip { background: #fef9c3; color: #92400e; }
.portal-sync-offline-strip { background: #fef2f2; color: var(--danger); }
.portal-sync-resyncing-strip { background: #eff6ff; color: var(--accent); }
.portal-sync-reconnecting-strip { background: #fefce8; color: #a16207; }

/* API status */
.portal-api-status { font-size: 11px; padding: .15rem .5rem; border-radius: 3px; }

/* Misc */
.portal-order-title { margin: 0; font-size: 18px; font-weight: 650; }
.portal-order-title small { color: var(--muted); font-size: 13px; font-weight: 400; }
.portal-muted { color: var(--muted); font-size: 12px; }
.portal-error-state { border-color: var(--danger); }
.portal-error-state h3 { color: var(--danger); }
.portal-btn-auto { width: auto; }
.portal-hidden, [hidden] { display: none !important; }
.portal-stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.portal-stack-md { display: flex; flex-direction: column; gap: 1rem; }
.portal-inline-note { margin: 0 0 1rem; color: var(--muted); font-size: 13px; }
.portal-inline-note-danger { color: var(--danger); }
.portal-panel-spaced { margin-bottom: 1rem; }
.portal-action-button { align-self: flex-start; }
.portal-nav-spacer { flex: 1; }
.portal-order-meta-spaced { margin-top: .5rem; }
.portal-section-title-spaced { margin-top: 1rem; }
.portal-timeline-message { margin-top: .25rem; color: var(--muted); font-size: 13px; }
.portal-msg-send { margin-top: .25rem; }
.portal-cta-row-left { justify-content: flex-start; margin-top: .75rem; }
.portal-table-empty { text-align: center; color: var(--muted); padding: 2rem 1rem !important; }
.portal-disclosure, .portal-disclosure-col { width: 34px; text-align: right !important; color: var(--muted); }
.portal-skeleton-table { padding: .5rem; }
.portal-skeleton-card { pointer-events: none; }
.portal-breadcrumb-separator { color: var(--muted); }

/* Skeleton */
.portal-skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: portal-shimmer 1.5s infinite; border-radius: var(--radius); }
@keyframes portal-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .portal-skeleton { animation: none; background: #eef2f7; } }
.portal-skeleton-row { height: 36px; margin-bottom: 4px; }
.portal-skeleton-title { height: 20px; width: 60%; margin-bottom: 8px; }
.portal-skeleton-text { height: 14px; width: 40%; margin-bottom: 6px; }
.portal-skeleton-img { height: 140px; width: 100%; }

/* Responsive */
@media (max-width: 640px) {
    .portal-dashboard { grid-template-columns: 1fr; }
    .portal-media-grid { grid-template-columns: repeat(2, 1fr); }
    .portal-admin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .portal-role-header { align-items: flex-start; }
    .portal-header-main, .portal-header-actions { width: 100%; }
    .portal-header-actions { justify-content: flex-start; }
}

@media (max-width: 980px) {
    .portal-admin-overview-grid { grid-template-columns: 1fr; }
    .portal-form-row { grid-template-columns: 1fr; }
}
.portal-clickable { cursor: pointer; }
.portal-watermark-layer { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.portal-watermark-item { position: absolute; transform: rotate(-45deg); font-size: 14px; color: #000; opacity: 0.06; white-space: nowrap; font-family: monospace; }
.portal-stage-shipping-row { margin-top: .5rem; }
.portal-stage-select,
.portal-stage-input {
    width: 100%;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    font: inherit;
}
.portal-stage-input { padding: .35rem; }
.portal-stage-select { padding: .35rem; }
.portal-input-full { width: 100%; padding: .35rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; box-sizing: border-box; }
.portal-input-mini { width: 92px; padding: .35rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; box-sizing: border-box; }
.portal-check { display: inline-flex; align-items: center; gap: .35rem; font-size: 12px; color: var(--muted); }

.portal-stage-control { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .5rem; }
.portal-stage-option { padding: .35rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); transition: all .15s; }
.portal-stage-option:hover { border-color: var(--accent); color: var(--accent); }
.portal-stage-option.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.portal-stage-option.portal-stage-done { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.portal-stage-option.portal-stage-current { border-color: var(--accent); color: var(--accent); font-weight: 600; box-shadow: 0 0 0 2px rgba(37,99,235,.08); }
.portal-stage-option.portal-stage-future { background: #fff; color: var(--muted); }
.portal-stage-option.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: none; }
.portal-stage-confirm { background: #f0f7ff; border: 1px solid var(--accent); border-radius: var(--radius); padding: .65rem .85rem; margin-top: .5rem; display: flex; align-items: center; gap: .5rem; }
.portal-stage-confirm p { margin: 0; font-size: 13px; flex: 1; }
.portal-stage-confirm span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.portal-stage-confirm strong { display: block; color: var(--ink); font-size: 13px; }
.portal-stage-meta {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: white; margin-bottom: .6rem;
}
.portal-stage-meta span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.portal-stage-meta strong { color: var(--accent); font-size: 13px; }
.portal-form-inline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.portal-table-row-clickable { cursor: pointer; }
.portal-table-row-clickable:hover { background: #f9fafb; }
.portal-dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 800px) { .portal-dashboard-row { grid-template-columns: 1fr; } }

.portal-media-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.portal-media-open img { width: 100%; height: 140px; object-fit: cover; display: block; }
.portal-lightbox { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 32px; background: rgba(10,16,24,.82); backdrop-filter: blur(18px); }
.portal-lightbox figure { max-width: min(1120px,94vw); max-height: 92vh; margin: 0; }
.portal-lightbox img { max-width: 100%; max-height: 84vh; object-fit: contain; border-radius: 8px; background: #f6f8fb; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.portal-lightbox figcaption { margin-top: 10px; color: white; text-align: center; font-size: 13px; }
.portal-lightbox-close { position: fixed; top: 22px; right: 24px; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.12); color: white; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
.portal-lightbox-open { overflow: hidden; }

.portal-status-normal { background: #dcfce7; color: #166534; }
.portal-status-delayed { background: #fee2e2; color: #991b1b; }
.portal-status-complaint { background: #fef3c7; color: #92400e; }
.portal-status-on_hold { background: #dbeafe; color: #1e40af; }
.portal-status-cancelled { background: #f3f4f6; color: #4b5563; }
.portal-search-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.portal-search-bar input { flex: 1; min-width: 180px; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; }
.portal-search-bar select { padding: .4rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; background: white; }
.portal-complaint-btn { margin-top: .5rem; }

.portal-order-card-large { padding: 1rem 1.25rem; }
.portal-card-topline { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.portal-order-no { font-family: monospace; font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.portal-card-main { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.portal-card-main h3 { font-size: 15px; margin: 0; flex: 1; }
.portal-card-customer { font-size: 12px; color: var(--muted); }
.portal-card-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1rem; font-size: 12px; color: var(--muted); }
.portal-card-meta-grid span:nth-child(odd) { color: var(--muted); }
.portal-card-meta-grid span:nth-child(even) { color: var(--ink); }

.portal-upload-status { margin-top: .5rem; font-size: 12px; }
.portal-upload-status span { display: block; margin-bottom: .25rem; color: var(--muted); }
.portal-upload-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: .25rem 0; }
.portal-upload-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .2s; width: 0; }

.portal-attachment-group { margin-bottom: 1rem; }
.portal-attachment-group-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: .8rem 0 .5rem; padding: .35rem .55rem; background: #f8fafc; border-radius: var(--radius); }
.portal-video-preview { width: 100%; max-height: 220px; display: block; background: #0f172a; }
.portal-attachment-link { display: block; padding: 1.25rem .75rem; text-align: center; text-decoration: none; color: var(--ink); }
