/* ================================================================== */
/*  Scanner PWA v2 – Dark theme from mockup-final                     */
/* ================================================================== */

:root {
    --bg: #101114;
    --bg-card: #191b20;
    --bg-input: rgba(255,255,255,0.03);
    --bg-hover: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.04);
    --border-light: rgba(255,255,255,0.06);
    --text: #f0f0f2;
    --text-muted: #9ca3af;
    --text-dim: #4e515a;
    --text-sub: #6b7280;
    --accent: #5b5fc7;
    --accent2: #3f83f8;
    --accent-light: #7c8cf8;
    --primary: #7c8cf8;
    --primary-dark: #5b5fc7;
    --success: #22c55e;
    --success-bg: rgba(34,197,94,0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(234,179,8,0.08);
    --danger: #ef4444;
    --danger-bg: rgba(239,68,68,0.08);
    --info: #60a5fa;
    --info-bg: rgba(59,130,246,0.08);
    --purple: #a855f7;
    --purple-bg: rgba(168,85,247,0.08);
    --radius: 14px;
    --radius-sm: 10px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: #cdd0d6;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}
body {
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------------------------ */
/*  Sync status bar                                                   */
/* ------------------------------------------------------------------ */
.sync-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; font-size: 12px; font-weight: 600;
    flex-shrink: 0; position: relative;
    overflow: hidden;
    max-height: 40px; opacity: 1;
    transition: max-height 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease, padding 0.3s ease;
}
.sync-bar.hidden { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; pointer-events: none; }
.sync-bar.leaving { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease; }

.sync-bar.offline { background: linear-gradient(90deg, #92400e, #b45309); color: #fef3c7; }
.sync-bar.syncing { background: linear-gradient(90deg, #1e3a5f, #1d4ed8); color: #bfdbfe; }
.sync-bar.synced  { background: linear-gradient(90deg, #065f46, #059669); color: #d1fae5; }
.sync-bar.error   { background: linear-gradient(90deg, #7f1d1d, #dc2626); color: #fecaca; cursor: pointer; }

.sync-bar-icon { font-size: 14px; flex-shrink: 0; }
.sync-bar-text { flex: 1; }
.sync-bar-count {
    padding: 3px 10px; border-radius: 10px;
    background: rgba(255,255,255,0.15); font-weight: 700; font-size: 11px;
}
.sync-bar-progress {
    position: absolute; bottom: 0; left: 0; height: 2px;
    background: rgba(255,255,255,0.3); border-radius: 0 2px 0 0;
    transition: width 0.4s;
}

/* ------------------------------------------------------------------ */
/*  Header                                                            */
/* ------------------------------------------------------------------ */
.app-header {
    display: flex; align-items: center;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    height: 52px; flex-shrink: 0;
}
.header-left {
    display: flex; align-items: center; gap: 10px;
}
.header-center {
    flex: 1; display: flex; justify-content: center;
}
.header-right {
    display: flex; align-items: center; gap: 8px;
}
.header-clock {
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 13px; font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 1px;
    opacity: 0.7;
}
.header-logo {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px;
}
.header-title {
    font-size: 16px; font-weight: 700; color: #eee;
}
.header-version {
    font-size: 10px; font-weight: 500; color: var(--text-dim);
    margin-left: 4px; align-self: flex-end; padding-bottom: 2px;
}
.user-badge {
    font-size: 12px; color: var(--text-dim); font-weight: 500;
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    color: #71717a; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.btn-icon:active { background: var(--bg-hover); }

/* ------------------------------------------------------------------ */
/*  Tab content                                                       */
/* ------------------------------------------------------------------ */
.tab-content {
    flex: 1; overflow-y: auto;
    padding: 10px 12px 16px;
    padding-bottom: calc(74px + var(--safe-bottom));
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ */
/*  Bottom tab bar                                                    */
/* ------------------------------------------------------------------ */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; background: #141519;
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    height: calc(58px + var(--safe-bottom));
    z-index: 900;
}
.tab-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    background: none; border: none;
    color: #2e3038; font-size: 9px; font-weight: 600; cursor: pointer;
}
.tab-btn i { font-size: 18px; }
.tab-btn.active { color: var(--accent-light); }
.tab-btn:active { color: var(--accent); }

/* ------------------------------------------------------------------ */
/*  Cards – base                                                      */
/* ------------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
    transition: transform 0.12s;
}
.card:active { transform: scale(0.985); }

/* Status bar on top of card */
.card-status-bar {
    padding: 6px 14px;
    display: flex; align-items: center; justify-content: space-between;
}
.card-status-bar.transit   { background: var(--info-bg); }
.card-status-bar.checked   { background: var(--warning-bg); }
.card-status-bar.approved  { background: var(--success-bg); }
.card-status-bar.waiting   { background: var(--purple-bg); }
.card-status-bar.dispatched { background: rgba(255,255,255,0.03); }

.csb-left {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.csb-left .dot { width: 6px; height: 6px; border-radius: 50%; }
.transit .csb-left  { color: #60a5fa; }  .transit .dot  { background: #3b82f6; }
.checked .csb-left  { color: #facc15; }  .checked .dot  { background: #eab308; }
.approved .csb-left { color: #4ade80; }  .approved .dot { background: #22c55e; }
.waiting .csb-left  { color: #c084fc; }  .waiting .dot  { background: #a855f7; }
.dispatched .csb-left { color: #52525b; } .dispatched .dot { background: #52525b; }
.card-status-bar.cancelled { background: var(--danger-bg); }
.cancelled .csb-left { color: #f87171; } .cancelled .dot { background: #ef4444; }

/* Blocked status — red alert */
.card-status-bar.blocked { background: rgba(239, 68, 68, 0.12); border-left: 3px solid #ef4444; }
.blocked .csb-left { color: #f87171; font-weight: 700; }
.blocked .dot { background: #ef4444; animation: pulse-red 1.5s ease-in-out infinite; }
@keyframes pulse-red {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}
.card-blocked { border: 1px solid rgba(239, 68, 68, 0.3); }
.blocked-alert {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #f87171; font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.blocked-alert i { font-size: 13px; color: #ef4444; }

/* Compliance-warn status — red warning but still actionable */
.card-status-bar.compliance-warn { background: rgba(239, 68, 68, 0.10); border-left: 3px solid #ef4444; }
.compliance-warn .csb-left { color: #f87171; font-weight: 700; }
.compliance-warn .dot { background: #ef4444; }
.card-compliance-warn { border: 1px solid rgba(239, 68, 68, 0.25); }
.compliance-warn-alert {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 4px;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.3px;
    background: rgba(239, 68, 68, 0.12); color: #ef4444;
    margin-right: 6px; white-space: nowrap;
}
.compliance-warn-alert i { font-size: 10px; }

/* Waiting status — spinning dot */
.waiting .dot {
    animation: spin 1.2s linear infinite;
    border: 2px solid #a855f7;
    border-top-color: transparent;
    background: none !important;
    width: 10px; height: 10px;
    border-radius: 50%;
}

/* Order toggle (header-center) */
.order-toggle {
    display: inline-flex; background: rgba(255,255,255,0.04);
    border-radius: 8px; border: 1px solid var(--border-light);
    overflow: hidden;
}
.order-toggle-btn {
    padding: 5px 14px; font-size: 11px; font-weight: 600;
    color: var(--text-dim); background: none; border: none;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
    display: flex; align-items: center; gap: 4px;
}
.order-toggle-btn.active {
    background: rgba(124,140,248,0.12); color: var(--accent-light);
}
.order-toggle-btn i { font-size: 10px; }

.csb-right {
    font-size: 11px; font-weight: 600; color: var(--info);
    display: flex; align-items: center; gap: 5px;
}
.csb-right i { font-size: 11px; }

/* Card content area */
.card-content { padding: 10px 14px 12px; }
.card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 12px 14px 8px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 11px; color: var(--text-dim); font-weight: 500; margin-top: 2px; }
.card-meta {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
    font-size: 11px; color: var(--text-sub); font-weight: 500;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }
.card-meta i { font-size: 11px; color: var(--text-dim); }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Row layouts within cards */
.row-head {
    display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
}
.card-ref { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.card-customer {
    font-size: 11px; font-weight: 500; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Product data row */
.row-data {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.prod-name { font-size: 13px; font-weight: 600; color: #e0e1e4; white-space: nowrap; }
.prod-brand { font-size: 11px; font-weight: 500; color: var(--text-sub); white-space: nowrap; }
.prod-sep { color: #2a2c33; font-size: 9px; }
.type-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 5px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
    text-transform: uppercase; white-space: nowrap;
}
.type-badge.pallet  { background: rgba(124,140,248,0.1); color: #818cf8; }
.type-badge.package { background: rgba(245,158,11,0.1); color: #fbbf24; }
.type-badge .tb-qty { font-weight: 800; font-size: 12px; }
.box-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; border-radius: 5px;
    background: rgba(255,255,255,0.04);
    font-size: 10px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.box-badge i { font-size: 9px; color: var(--text-dim); }
.box-badge .bb-qty { font-weight: 800; font-size: 12px; color: #d4d4d8; }
.row-spacer { flex: 1; min-width: 4px; }
.eta-compact {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 500; color: var(--text-dim); white-space: nowrap;
}
.eta-compact i { font-size: 12px; color: #3a3c43; }
.eta-compact .eta-date { font-weight: 700; color: #e0e1e4; font-size: 14px; }
.eta-compact .eta-time { color: var(--text-sub); font-size: 13px; }

/* ------------------------------------------------------------------ */
/*  Order card redesign                                               */
/* ------------------------------------------------------------------ */
.order-card {
    background: var(--bg-card); border-radius: var(--radius);
    margin-bottom: 10px; overflow: hidden;
}
.order-card-top {
    padding: 12px 14px 8px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px;
}
.oc-head-left { flex: 1; min-width: 0; }
.oc-head-row {
    display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
    line-height: 1.2;
}
.oc-head-row + .oc-head-row { margin-top: 3px; }
.oc-id { font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.oc-customer { font-size: 16px; font-weight: 700; color: #e0e1e4; }
.oc-ref { font-size: 14px; font-weight: 700; color: var(--accent-light); letter-spacing: -0.2px; }
.oc-sender {
    font-size: 14px; font-weight: 700; color: #c084fc;
    display: inline-flex; align-items: center; gap: 4px;
}
.oc-sender i { font-size: 10px; opacity: 0.7; }
.oc-id-sep { color: var(--text-dim); font-size: 12px; }
.oc-client { font-size: 11px; color: var(--text-dim); font-weight: 500; margin-left: 8px; }

.oc-head-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.oc-meta {
    display: flex; align-items: center; gap: 6px; line-height: 1;
}
.oc-meta-lbl {
    font-size: 9.5px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.oc-meta-val {
    font-size: 12px; font-weight: 700; color: #e0e1e4;
}
.oc-prio-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 5px;
    font-size: 10px; font-weight: 800; letter-spacing: 0.4px;
    text-transform: uppercase;
}
.oc-prio-chip i { font-size: 9px; }
.oc-prio-chip-low { background: rgba(96,165,250,0.12); color: #93c5fd; }
.oc-prio-chip-medium { background: rgba(245,158,11,0.12); color: #fcd34d; }
.oc-prio-chip-high { background: rgba(239,68,68,0.14); color: #fca5a5; }

/* Subtle left border tint per priority */
.order-card.oc-prio-high   { border-left: 3px solid #ef4444; }
.order-card.oc-prio-medium { border-left: 3px solid #f59e0b; }
.order-card.oc-prio-low    { border-left: 3px solid #60a5fa; }

/* Arrivals card — position label chip */
.card-pos-label {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px; border-radius: 5px;
    background: rgba(255,255,255,0.04);
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.3px; white-space: nowrap;
}
.card-pos-label i { font-size: 9px; color: var(--text-dim); }
.order-card-row {
    padding: 0 14px 10px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.oc-stat {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 6px;
    background: rgba(255,255,255,0.03);
    font-size: 12px; font-weight: 600; color: #d4d4d8;
}
.oc-stat i { font-size: 11px; color: var(--text-dim); }
.oc-stat .oc-val { font-weight: 700; color: #e0e1e4; }
.oc-date {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; font-weight: 500; color: var(--text-dim);
}
.oc-date i { font-size: 11px; color: #3a3c43; }
.oc-date .oc-dval { font-weight: 700; color: #d4d4d8; }
.order-card-actions {
    padding: 0 14px 12px;
    display: flex; gap: 8px; align-items: center;
}

/* ------------------------------------------------------------------ */
/*  Badges / Status chips                                             */
/* ------------------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 6px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.1); color: #4ade80; }
.badge-warning { background: rgba(245,158,11,0.1); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,0.1); color: #f87171; }
.badge-info    { background: rgba(99,102,241,0.1); color: #818cf8; }
.badge-neutral { background: rgba(255,255,255,0.05); color: var(--text-sub); }

/* ------------------------------------------------------------------ */
/*  Buttons                                                           */
/* ------------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 12px; font-weight: 600;
    border: none; cursor: pointer;
    transition: transform 0.1s; white-space: nowrap;
    background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
}
.btn-success {
    background: linear-gradient(135deg, #059669, #10b981); color: #fff;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-amber {
    background: linear-gradient(135deg, #d97706, #f59e0b); color: #000;
}
.btn-outline {
    background: transparent; border: 1px solid var(--border-light); color: var(--text-muted);
}
.btn-outline:active { background: var(--bg-hover); }
.btn.btn-green { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; border-radius: 12px; }
.btn-icon-only { padding: 10px; }
.btn-pick {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-sm); border: none;
    font-family: inherit; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: transform 0.1s;
    background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
}
.btn-pick:active { transform: scale(0.96); }

/* ------------------------------------------------------------------ */
/*  Inputs                                                            */
/* ------------------------------------------------------------------ */
.input-group { margin-bottom: 16px; }
.input-group label {
    display: block; font-size: 11px; font-weight: 600;
    color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 6px;
}
.input-row { display: flex; gap: 8px; }
input[type="text"], input[type="search"], input[type="number"], select {
    width: 100%; padding: 11px 14px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: inherit; font-size: 14px; outline: none;
    transition: border-color 0.15s;
}
input:focus, select:focus { border-color: rgba(124,140,248,0.3); }
input::placeholder { color: #3a3c43; }
input.input-success, input.input-ok { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.04); }
input.input-error   { border-color: var(--danger); background: var(--danger-bg); }

/* ------------------------------------------------------------------ */
/*  Scan field                                                        */
/* ------------------------------------------------------------------ */
.scan-field { display: flex; gap: 8px; }
.scan-field input { flex: 1; padding: 11px 14px; }
.scan-field input.input-ok { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.04); }
.scan-field button {
    width: 46px; height: 46px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; color: #fff; font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.scan-field button:active { opacity: 0.85; }

/* ------------------------------------------------------------------ */
/*  Photo capture                                                     */
/* ------------------------------------------------------------------ */
.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px; margin-top: 8px;
}
.photo-thumb {
    position: relative; aspect-ratio: 1; border-radius: var(--radius-sm);
    overflow: hidden; border: 1px solid var(--border-light); cursor: pointer;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .photo-remove {
    position: absolute; top: 4px; right: 4px;
    background: rgba(0,0,0,0.7); color: #fff; border: none;
    border-radius: 50%; width: 24px; height: 24px; font-size: 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-capture-btn {
    aspect-ratio: 1; border: 2px dashed var(--border-light);
    border-radius: var(--radius-sm); background: var(--bg-input);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 4px;
    color: var(--text-dim); font-size: 12px; cursor: pointer;
    transition: border-color 0.15s;
}
.photo-capture-btn:active { border-color: var(--accent-light); }
.photo-capture-btn i { font-size: 24px; }

/* ------------------------------------------------------------------ */
/*  Photo viewer fullscreen                                           */
/* ------------------------------------------------------------------ */
.photo-viewer {
    position: fixed; inset: 0; background: rgba(0,0,0,0.95);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.photo-viewer.hidden { display: none; }
.photo-viewer img { max-width: 95%; max-height: 90vh; object-fit: contain; }
.photo-viewer-close {
    position: absolute; top: 16px; right: 16px;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    font-size: 24px; width: 44px; height: 44px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------------ */
/*  Barcode scanner modal                                             */
/* ------------------------------------------------------------------ */
.barcode-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9);
    z-index: 1500; display: flex; align-items: flex-start;
    justify-content: center; padding-top: 40px;
}
.barcode-modal.hidden { display: none; }
.barcode-modal-inner { width: 100%; max-width: 400px; padding: 16px; }
.barcode-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; color: #fff; font-weight: 700; font-size: 16px;
}
#barcode-reader { width: 100%; border-radius: var(--radius); overflow: hidden; }
#barcode-reader video { width: 100% !important; }
.barcode-manual { display: flex; gap: 8px; margin-top: 12px; }
.barcode-manual input { flex: 1; }

/* ------------------------------------------------------------------ */
/*  Table                                                             */
/* ------------------------------------------------------------------ */
.pwa-table {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.pwa-table th {
    text-align: left; padding: 7px 6px;
    background: var(--bg); color: var(--text-dim);
    font-weight: 600; text-transform: uppercase;
    font-size: 9px; letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.pwa-table td {
    padding: 6px; border-bottom: 1px solid var(--border);
    color: #d4d4d8; font-size: 12px; vertical-align: middle;
}
.pwa-table tr:last-child td { border-bottom: none; }
.pwa-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.pwa-table .check-icon { color: var(--success); }

/* ------------------------------------------------------------------ */
/*  Check-in sections                                                 */
/* ------------------------------------------------------------------ */
.ci-section {
    background: var(--bg-card); border-radius: 12px;
    padding: 14px; margin-bottom: 12px;
    border: 1px solid var(--border);
}
.ci-section-title {
    font-weight: 700; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--accent-light); margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
}
.ci-section-title i { font-size: 12px; }
.ci-section-title .req-tag {
    color: #f87171; font-size: 9px; font-weight: 600; margin-left: auto;
}

/* MRN status chip */
.mrn-chip {
    display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; margin-left: 8px; vertical-align: middle; letter-spacing: 0.3px;
}
.mrn-orange { background: rgba(251,146,60,0.18); color: #fb923c; }
.mrn-green  { background: rgba(74,222,128,0.18); color: #4ade80; }

/* Shipment info grid */
.ci-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.ci-info-item label {
    display: block; font-size: 9px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.ci-info-val { font-size: 13px; font-weight: 600; color: #d4d4d8; margin-top: 1px; }

/* Packing list table */
.pl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.pl-table th:nth-child(1) { width: 22px; }   /* # */
.pl-table th:nth-child(2) { width: 28%; }    /* Product */
.pl-table th:nth-child(3) { width: 18%; }    /* Brand */
.pl-table th:nth-child(4) { width: 14%; }    /* Size */
.pl-table th:nth-child(5) { width: 14%; }    /* Origin */
.pl-table th:nth-child(6) { width: 54px; }   /* Boxes */
.pl-table th:nth-child(7) { width: 52px; }   /* Type */
.pl-table th:nth-child(8) { width: 54px; }   /* GW */
.pl-table th:nth-child(9) { width: 28px; }   /* Action */
.pl-table th {
    background: var(--bg); color: var(--text-dim); padding: 7px 2px; text-align: left;
    font-weight: 600; text-transform: uppercase; font-size: 9px;
    letter-spacing: 0.3px; position: sticky; top: 0; white-space: nowrap;
}
.pl-table td { padding: 3px 1px; border-bottom: 1px solid var(--border); }
.pl-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.pl-table input, .pl-table select {
    background: transparent; border: 1px solid transparent; color: #d4d4d8;
    padding: 4px 2px; border-radius: 5px; font-size: 12px; font-family: inherit;
    width: 100%; outline: none;
}
.pl-table td input, .pl-table td select { overflow: hidden; text-overflow: ellipsis; }
.pl-table input[type="number"] { -moz-appearance: textfield; }
.pl-table input[type="number"]::-webkit-inner-spin-button,
.pl-table input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pl-table input:focus, .pl-table select:focus {
    border-color: rgba(124,140,248,0.3); background: rgba(124,140,248,0.04);
    overflow: visible; text-overflow: clip;
}
.pl-table select { color: var(--text-muted); appearance: none; cursor: pointer; }
.pl-table .changed { border-color: #f59e0b !important; background: rgba(245,158,11,0.06) !important; }
.pl-table tr.not-arrived td { opacity: 0.35; text-decoration: line-through; }
.pl-table tr.not-arrived td:last-child { opacity: 1; text-decoration: none; }
.pl-table .row-num { color: #3a3c43; font-weight: 600; font-size: 11px; text-align: center; }

.na-btn {
    background: none; border: 1px solid var(--border-light); color: var(--text-dim);
    border-radius: 6px; width: 26px; height: 26px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; transition: all 0.15s; padding: 0;
}
.na-btn:hover { border-color: #f87171; color: #f87171; }
.na-btn.flagged { background: rgba(248,113,113,0.12); border-color: #f87171; color: #f87171; }

/* PL actions bar */
.pl-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pl-actions-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pl-add-row {
    background: rgba(124,140,248,0.08); border: 1px solid rgba(124,140,248,0.2);
    color: var(--accent-light); padding: 7px 12px; border-radius: 8px; cursor: pointer;
    font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px;
    font-family: inherit;
}
.pl-remark-btn {
    background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.2);
    color: #f97316; padding: 7px 12px; border-radius: 8px; cursor: pointer;
    font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px;
    font-family: inherit;
}
.pl-row-count { font-size: 10px; color: #3a3c43; font-weight: 500; }

/* Confirm chip / toggle */
.confirm-chip {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.02); border: 1px solid var(--border-light);
    border-radius: 8px; padding: 5px 10px;
}
.confirm-label { font-size: 11px; color: var(--text-sub); white-space: nowrap; }
.toggle {
    width: 44px; height: 24px; border-radius: 12px;
    background: #2a2c33; position: relative; cursor: pointer;
    border: none; transition: background 0.2s;
}
.toggle::after {
    content: ''; position: absolute; left: 3px; top: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #71717a; transition: all 0.2s;
}
.toggle.on { background: #059669; }
.toggle.on::after { left: 23px; background: #fff; }

.remark-area {
    width: 100%; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-light); border-radius: 8px;
    color: #d4d4d8; padding: 10px; font-size: 13px; font-family: inherit;
    resize: vertical; min-height: 54px; margin-top: 8px; outline: none;
}
.remark-area:focus { border-color: rgba(249,115,22,0.3); }

/* Upload zones */
.upload-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-zone {
    border: 2px dashed var(--border-light); border-radius: var(--radius-sm);
    padding: 18px 10px; text-align: center; cursor: pointer;
    transition: border-color 0.2s;
}
.upload-zone:hover { border-color: rgba(124,140,248,0.3); background: rgba(124,140,248,0.02); }
.upload-zone i { font-size: 20px; color: #3a3c43; display: block; margin-bottom: 6px; }
.upload-zone .uz-label { font-size: 12px; color: var(--text-sub); font-weight: 500; }
.upload-zone .uz-req { color: #f87171; font-size: 10px; font-weight: 600; }
.upload-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.upload-thumb {
    width: 48px; height: 48px; border-radius: 6px; overflow: hidden;
    border: 1px solid var(--border-light); background: #222;
    display: flex; align-items: center; justify-content: center;
}
.upload-thumb i { font-size: 18px; color: #f87171; }

/* Discharge button */
.discharge-fab {
    width: 100%; margin-top: 12px;
    background: #2a2c33; color: var(--text-dim); border: none; border-radius: var(--radius);
    padding: 14px 20px; font-size: 15px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.25s; font-family: inherit;
}
.discharge-fab.ready {
    background: linear-gradient(135deg, #059669, #10b981); color: #fff;
    box-shadow: 0 4px 24px rgba(16,185,129,0.3);
}

/* ------------------------------------------------------------------ */
/*  Picking view                                                      */
/* ------------------------------------------------------------------ */
.pick-progress-bar {
    height: 6px; background: #2a2c33; border-radius: 3px;
    overflow: hidden; margin: 10px 0 4px;
}
.pick-progress-bar .bar {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, #22c55e, #7c3aed);
    transition: width 0.3s;
}
.pick-progress-text { font-size: 11px; color: var(--text-dim); text-align: center; margin-bottom: 12px; }

.current-pick {
    background: var(--bg-card); border: 2px solid #7c3aed;
    border-radius: 16px; padding: 16px; margin-bottom: 12px;
}
.current-pick.location-missing {
    border-color: rgba(251,191,36,0.55);
}
.pick-location { text-align: center; margin-bottom: 12px; }
.pick-loc-label {
    font-size: 9px; color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.8px; font-weight: 600;
}
.pick-loc-value {
    font-size: 36px; font-weight: 800; color: #7c3aed;
    font-family: 'Inter', monospace; letter-spacing: -1px;
}
.pick-product-box {
    background: var(--bg-input); border-radius: var(--radius-sm);
    padding: 16px 18px; text-align: center; margin-bottom: 12px;
}
.pick-product-name {
    font-size: 26px; font-weight: 900; color: #f4f4f5;
    line-height: 1.22; overflow-wrap: anywhere;
}
.pick-product-detail {
    font-size: 17px; color: var(--text-sub); margin-top: 8px;
    line-height: 1.35; overflow-wrap: anywhere;
}
.pick-barcode-box {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.3);
    border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
}
.pick-barcode-box.missing {
    background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.18);
}
.pick-barcode-meta { min-width: 0; }
.pick-barcode-meta span {
    display: block; font-size: 9px; color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 700;
}
.pick-barcode-meta strong {
    display: block; color: #e9d5ff; font-size: 17px; line-height: 1.2;
    font-family: 'JetBrains Mono', 'Consolas', monospace; overflow-wrap: anywhere;
}
.pick-barcode-box.missing .pick-barcode-meta strong { color: #fca5a5; }
.pick-barcode-use {
    width: 38px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.06);
    color: #ddd6fe; cursor: pointer; flex-shrink: 0;
}
.pick-qty-row { display: flex; justify-content: center; gap: 14px; }
.pick-qty-box {
    background: var(--bg-input); border-radius: var(--radius-sm);
    padding: 10px 20px; text-align: center;
}
.pq-label {
    font-size: 9px; color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}
.pq-val { font-size: 28px; font-weight: 800; color: #e0e1e4; line-height: 1.1; }
.pick-qty-box.pick .pq-val { color: #4ade80; }

.pick-scan {
    background: var(--bg-card); border-radius: 12px; padding: 12px;
    margin-bottom: 12px; border: 1px solid var(--border);
}
.pick-scan label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.pick-scan-row { display: flex; gap: 8px; }
.pick-scan-row input {
    flex: 1; padding: 12px 14px;
    background: var(--bg-input); border: 2px solid var(--border-light);
    border-radius: var(--radius-sm); color: #d4d4d8;
    font-family: inherit; font-size: 14px; font-weight: 600; outline: none;
}
.pick-scan-row input:focus { border-color: rgba(124,58,237,0.4); }
.scan-confirm {
    width: 50px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #059669, #22c55e);
    border: none; color: #fff; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.pick-action-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.pick-action-btn {
    padding: 11px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 6px; font-family: inherit;
}
.pick-action-btn.skip {
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); color: var(--text-sub);
}
.pick-action-btn.problem {
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15); color: #f87171;
}

.pick-list-section {
    background: var(--bg-card); border-radius: 12px; overflow: hidden;
    border: 1px solid var(--border);
}
.pick-list-head {
    padding: 10px 14px; background: rgba(255,255,255,0.02);
    display: flex; justify-content: space-between;
    font-size: 11px; font-weight: 600; color: var(--text-dim);
}
.pick-list-row {
    padding: 14px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.pick-list-row:last-child { border-bottom: none; }
.pick-check {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(255,255,255,0.03); border: 2px solid #2a2c33;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; flex-shrink: 0;
}
.pick-list-row.done .pick-check { background: #22c55e; border-color: #22c55e; color: #fff; }
.pick-list-row.current .pick-check { border-color: #7c3aed; color: #7c3aed; }
.pick-list-info { flex: 1; min-width: 0; }
.pick-list-loc { font-size: 16px; font-weight: 800; color: #d4d4d8; }
.pick-list-prod { font-size: 14px; color: var(--text-sub); margin-top: 3px; line-height: 1.25; }
.pick-list-barcode {
    margin-top: 4px; font-size: 13px; color: #a78bfa;
    font-family: 'JetBrains Mono', 'Consolas', monospace; overflow-wrap: anywhere;
}
.pick-list-qty { font-size: 16px; font-weight: 800; color: #e0e1e4; flex-shrink: 0; }

/* ------------------------------------------------------------------ */
/*  Toast notifications                                               */
/* ------------------------------------------------------------------ */
.toast-container {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 14px 0; pointer-events: none; gap: 8px;
}
.toast {
    width: 100%; max-width: 420px;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    font-size: 13px; font-weight: 600; line-height: 1.3;
    pointer-events: auto; cursor: pointer;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    transform: translateY(-120%); opacity: 0;
    animation: toastIn 0.35s cubic-bezier(0.22,1,0.36,1) forwards;
    position: relative; overflow: hidden;
}
.toast.leaving { animation: toastOut 0.28s cubic-bezier(0.55,0,1,0.45) forwards; }
@keyframes toastIn  { to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-120%); opacity: 0; } }

.toast-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; margin-bottom: 1px; }
.toast-msg { font-size: 12px; font-weight: 500; opacity: 0.75; }
.toast-close {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(255,255,255,0.06); border: none;
    color: rgba(255,255,255,0.3); font-size: 12px;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; transition: all 0.15s;
}
.toast-close:hover, .toast-close:active { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.6); }
.toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    border-radius: 0 0 14px 14px;
    animation: toastTimer linear forwards;
}
@keyframes toastTimer { from { width: 100%; } to { width: 0%; } }

.toast.toast-success { background: linear-gradient(135deg, rgba(5,150,105,0.94), rgba(16,185,129,0.9)); color: #fff; }
.toast.toast-success .toast-icon { background: rgba(255,255,255,0.15); color: #fff; }
.toast.toast-success .toast-progress { background: rgba(255,255,255,0.3); }

.toast.toast-error { background: linear-gradient(135deg, rgba(185,28,28,0.94), rgba(220,38,38,0.9)); color: #fff; }
.toast.toast-error .toast-icon { background: rgba(255,255,255,0.15); color: #fff; }
.toast.toast-error .toast-progress { background: rgba(255,255,255,0.3); }

.toast.toast-warning { background: linear-gradient(135deg, rgba(146,64,14,0.95), rgba(180,83,9,0.92)); color: #fff; }
.toast.toast-warning .toast-icon { background: rgba(255,255,255,0.15); color: #fff; }
.toast.toast-warning .toast-progress { background: rgba(255,255,255,0.3); }

.toast.toast-info { background: linear-gradient(135deg, rgba(55,65,81,0.95), rgba(75,85,99,0.92)); color: #fff; }
.toast.toast-info .toast-icon { background: rgba(99,102,241,0.2); color: #818cf8; }
.toast.toast-info .toast-progress { background: rgba(99,102,241,0.4); }

.toast.toast-loading {
    background: linear-gradient(135deg, rgba(30,32,40,0.96), rgba(40,43,55,0.94));
    border: 1px solid rgba(99,102,241,0.15); color: #e4e4e7;
}
.toast.toast-loading .toast-icon { background: rgba(99,102,241,0.1); color: #818cf8; }
.toast-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(99,102,241,0.2); border-top-color: #818cf8;
    border-radius: 50%; animation: spin 0.7s linear infinite;
}

.toast.toast-undo {
    background: linear-gradient(135deg, rgba(30,32,40,0.96), rgba(40,43,55,0.94));
    border: 1px solid rgba(255,255,255,0.06); color: #e4e4e7;
}
.toast.toast-undo .toast-icon { background: rgba(245,158,11,0.12); color: #fbbf24; }
.toast-undo-btn {
    padding: 6px 14px; border-radius: 8px;
    background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.25);
    color: #818cf8; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit; flex-shrink: 0; transition: all 0.15s;
}
.toast-undo-btn:active { background: rgba(99,102,241,0.25); }

/* ------------------------------------------------------------------ */
/*  Loading / empty states                                            */
/* ------------------------------------------------------------------ */
.loading-spinner { display: flex; justify-content: center; padding: 40px 0; }
.loading-spinner::after {
    content: ''; width: 32px; height: 32px;
    border: 3px solid #2a2c33; border-top-color: var(--accent-light);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-dim); }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 14px; }

.last-updated { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ------------------------------------------------------------------ */
/*  Section headers                                                   */
/* ------------------------------------------------------------------ */
.section-title {
    font-size: 10px; font-weight: 600; color: #3a3c43;
    text-transform: uppercase; letter-spacing: 0.8px;
    padding: 6px 2px 10px;
}

/* ------------------------------------------------------------------ */
/*  Workflow steps                                                    */
/* ------------------------------------------------------------------ */
.workflow-step {
    padding: 14px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px;
}
.workflow-step-title {
    font-size: 14px; font-weight: 700; margin-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}
.workflow-step-title .step-num {
    width: 24px; height: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

/* ------------------------------------------------------------------ */
/*  Flash animations                                                  */
/* ------------------------------------------------------------------ */
.flash-success { animation: flash-green 0.6s ease; }
@keyframes flash-green {
    0%   { background: var(--bg-card); }
    30%  { background: rgba(34,197,94,0.06); }
    100% { background: var(--bg-card); }
}
.flash-error { animation: flash-red 0.6s ease; }
@keyframes flash-red {
    0%   { background: var(--bg-card); }
    30%  { background: rgba(239,68,68,0.06); }
    100% { background: var(--bg-card); }
}

/* ------------------------------------------------------------------ */
/*  Detail view / back navigation                                     */
/* ------------------------------------------------------------------ */
.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.btn-back {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    color: var(--text-muted); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.btn-back:active { background: var(--bg-hover); }

/* ------------------------------------------------------------------ */
/*  Scrollable table wrapper                                          */
/* ------------------------------------------------------------------ */
.table-scroll {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: 0 -12px; padding: 0 12px;
}

/* ------------------------------------------------------------------ */
/*  Dispatch photo sections                                           */
/* ------------------------------------------------------------------ */
.dispatch-photo-section {
    background: var(--bg-card); border-radius: 12px; padding: 14px;
    margin-bottom: 12px; border: 1px solid var(--border);
}
.photo-capture-grid { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ */
/*  Doc grid                                                          */
/* ------------------------------------------------------------------ */
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.doc-thumb {
    aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border-light); background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb i { font-size: 24px; color: #3a3c43; }
.doc-label {
    font-size: 10px; color: var(--text-dim); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px; margin: 12px 0 6px;
}

/* ------------------------------------------------------------------ */
/*  Sub-view header (check-in, picking, dispatch, docs detail)        */
/* ------------------------------------------------------------------ */
.checkin-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: #141519;
    border-bottom: 1px solid var(--border);
}
.back-btn {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    color: var(--text-muted); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.back-btn:active { background: var(--bg-hover); }
.checkin-title { font-size: 15px; font-weight: 700; color: var(--text); }
.checkin-sub { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* Full-height scroll area for sub-views (no bottom tab bar) */
.scroll-full {
    padding: 10px 12px 24px;
}

/* ------------------------------------------------------------------ */
/*  Scan steps (change-location view)                                 */
/* ------------------------------------------------------------------ */
.scan-step {
    background: var(--bg-card); border-radius: 12px;
    padding: 16px; margin-bottom: 12px;
    border: 1px solid var(--border);
}
.scan-step-title {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.scan-step-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(124,140,248,0.1); color: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.scan-step-label { font-size: 14px; font-weight: 600; color: #d4d4d8; }

.scan-step.step-done {
    border-color: rgba(34,197,94,0.2); background: rgba(34,197,94,0.04);
}
.scan-step.step-done .scan-step-num.done {
    background: var(--success); color: #fff;
}
.scan-step.step-disabled {
    opacity: 0.4; pointer-events: none;
}
.scan-confirmed {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(34,197,94,0.08); border-radius: 8px; padding: 10px 12px;
}
.scan-confirmed-val {
    font-size: 15px; font-weight: 700; color: var(--success); letter-spacing: 0.3px;
}
.btn-clear-step {
    width: 28px; height: 28px; border-radius: 6px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--border-light);
    color: var(--text-dim); font-size: 11px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.scan-step select {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    color: var(--text); font-size: 14px; font-family: inherit;
    outline: none; cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.scan-step select:focus {
    border-color: rgba(124,140,248,0.4); background-color: rgba(124,140,248,0.04);
}

/* Scan log entries */
.scan-log-entry {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 6px;
    border: 1px solid var(--border);
}
.scan-log-left { display: flex; align-items: center; gap: 8px; }
.scan-log-left i { font-size: 14px; }
.scan-log-text { font-size: 12px; font-weight: 500; color: #d4d4d8; }
.scan-log-text span { color: var(--accent-light); font-weight: 600; }
.scan-log-time { font-size: 10px; color: #3a3c43; }

/* ------------------------------------------------------------------ */
/*  Search bar (documentation)                                        */
/* ------------------------------------------------------------------ */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; }
.search-bar button {
    width: 46px; height: 46px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; color: #fff; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------------ */
/*  Discharge hint + packing list warning                             */
/* ------------------------------------------------------------------ */
.discharge-hint {
    font-size: 11px; color: #fbbf24; text-align: center;
    pointer-events: none; opacity: 0; transition: opacity 0.3s;
    margin-top: 8px;
}
.discharge-hint.visible { opacity: 1; }

.pl-warning {
    background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.15);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
    font-size: 11px; color: #fbbf24;
    display: flex; align-items: center; gap: 8px;
}
.pl-warning i { font-size: 13px; flex-shrink: 0; }

/* ------------------------------------------------------------------ */
/*  Pick table (dispatch / order items)                               */
/* ------------------------------------------------------------------ */
.pick-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pick-table th {
    background: var(--bg); color: var(--text-dim); padding: 7px 6px; text-align: left;
    font-weight: 600; text-transform: uppercase; font-size: 9px; letter-spacing: 0.3px;
}
.pick-table td {
    padding: 6px; border-bottom: 1px solid var(--border);
    color: #d4d4d8; font-size: 12px;
}
.pick-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.pick-table-sub { margin-top: 2px; font-size: 11px; color: var(--text-dim); }
.pick-table-barcode {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    color: #a78bfa !important;
    overflow-wrap: anywhere;
}
.check-icon { color: var(--success); }

/* ------------------------------------------------------------------ */
/*  Utility                                                           */
/* ------------------------------------------------------------------ */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-sm     { font-size: 13px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ------------------------------------------------------------------ */
/*  Search tab — stock pallet search                                  */
/* ------------------------------------------------------------------ */
.search-group { margin-bottom: 16px; }
.search-group-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 12px; margin-bottom: 4px;
    background: var(--bg-card); border-radius: 10px;
    border: 1px solid var(--border);
}
.sgh-left { flex: 1; min-width: 0; }
.sgh-ref { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sgh-meta { display: flex; gap: 10px; margin-top: 3px; font-size: 11px; color: var(--text-muted); }
.sgh-meta i { margin-right: 3px; font-size: 10px; opacity: 0.6; }
.sgh-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-left: 10px; flex-shrink: 0; }
.sgh-count { font-size: 12px; font-weight: 700; color: var(--accent-light); }
.sgh-weight { font-size: 10px; color: var(--text-dim); }

.search-suggestions {
    margin: -6px 0 12px;
    display: grid;
    gap: 6px;
}
.search-suggestion {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.search-suggestion:active { background: var(--bg-hover); }
.ss-main { min-width: 0; }
.ss-file {
    display: block; font-size: 15px; line-height: 1.2;
    font-weight: 800; color: #e5e7eb;
}
.ss-client {
    display: block; margin-top: 2px; font-size: 12px;
    color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ss-count {
    flex-shrink: 0; display: grid; justify-items: end; gap: 1px;
    color: var(--text-dim);
}
.ss-count strong { font-size: 18px; line-height: 1; color: #4ade80; }
.ss-count span { font-size: 10px; text-transform: uppercase; font-weight: 700; }
.ss-count em { font-style: normal; font-size: 10px; }
.search-suggestion-empty {
    padding: 10px 12px; border-radius: 9px;
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim); text-align: center;
}

.search-pallet {
    background: var(--bg-card); border-radius: 8px; margin-bottom: 3px;
    padding: 10px 12px; cursor: pointer; transition: background 0.15s;
    border-left: 3px solid transparent;
}
.search-pallet:active { background: var(--bg-hover); }
.search-pallet.expanded { border-left-color: var(--accent); background: rgba(99,102,241,0.04); }

.sp-row { display: flex; align-items: center; gap: 10px; }
.sp-main { flex: 1; min-width: 0; }
.sp-id { font-size: 12px; font-weight: 700; color: var(--text); }
.sp-product { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-sep { opacity: 0.4; margin: 0 1px; }

.sp-info { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.sp-location { font-size: 11px; font-weight: 700; color: var(--accent-light); }
.sp-location i { margin-right: 3px; font-size: 9px; }
.sp-stats { display: flex; gap: 8px; font-size: 10px; color: var(--text-dim); }
.sp-status { margin-top: 1px; }
.sp-chevron { margin-left: 4px; font-size: 10px; color: var(--text-dim); }

/* Timeline inside expanded pallet */
.sp-timeline {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
    padding-left: 4px;
}
.tl-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 6px 0; position: relative;
}
.tl-item:not(:last-child)::after {
    content: ''; position: absolute; left: 11px; top: 26px; bottom: -6px;
    width: 1px; background: var(--border);
}
.tl-dot {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(99,102,241,0.12); color: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; flex-shrink: 0; position: relative; z-index: 1;
}
.tl-checkin .tl-dot { background: rgba(34,197,94,0.15); color: #22c55e; }
.tl-content { flex: 1; min-width: 0; }
.tl-action { font-size: 11.5px; font-weight: 600; color: var(--text); }
.tl-loc { font-size: 10.5px; color: var(--accent-light); display: block; margin-top: 1px; }
.tl-loc i { font-size: 8px; }
.tl-date { font-size: 10px; color: var(--text-dim); margin-top: 1px; }

/* ------------------------------------------------------------------ */
/*  Notification Center (WMS)                                         */
/* ------------------------------------------------------------------ */
.pwa-notif-bell { position: relative; }
.pwa-notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 8px;
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; border: 2px solid var(--bg);
}

.pwa-notif-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 99;
}
.pwa-notif-backdrop.is-visible { opacity: 1; pointer-events: auto; }

.pwa-notif-panel {
    position: fixed; top: 0; right: 0;
    width: min(380px, 92vw);
    height: 100vh; height: 100dvh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0,0,0,0.4);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
    z-index: 100;
    display: flex; flex-direction: column;
}
.pwa-notif-panel.is-open { transform: translateX(0); }

.pwa-notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 14px; font-weight: 700; color: var(--text);
    flex-shrink: 0;
}
.pwa-notif-head i { color: var(--accent-light); margin-right: 6px; }
.pwa-notif-close {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 4px 8px;
}

.pwa-notif-body {
    flex: 1; overflow-y: auto;
    padding: 8px 10px;
    -webkit-overflow-scrolling: touch;
}
.pwa-notif-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; color: var(--text-dim);
    font-size: 13px;
}
.pwa-notif-empty i { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }

.pwa-notif-card {
    display: flex; gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    transition: background 0.15s;
}
.pwa-notif-card.is-unread {
    background: linear-gradient(180deg, rgba(124,140,248,0.05), var(--bg-card));
    border-color: rgba(124,140,248,0.15);
}
.pwa-notif-card.is-action.pwa-notif-high {
    border-color: rgba(245,158,11,0.3);
    background: linear-gradient(180deg, rgba(245,158,11,0.05), var(--bg-card));
}

.pwa-notif-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(124,140,248,0.1); color: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.pwa-notif-high .pwa-notif-icon { background: var(--warning-bg); color: var(--warning); }
.pwa-notif-low .pwa-notif-icon { background: var(--info-bg); color: var(--info); }

.pwa-notif-content { flex: 1; min-width: 0; }
.pwa-notif-title {
    font-size: 13px; font-weight: 700; color: var(--text);
    margin-bottom: 2px; line-height: 1.3;
}
.pwa-notif-msg {
    font-size: 11.5px; color: var(--text-muted); line-height: 1.4;
    word-break: break-word;
}
.pwa-notif-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px;
}
.pwa-notif-time { font-size: 10px; color: var(--text-dim); }
.pwa-notif-mark {
    background: transparent; border: 1px solid var(--border-light);
    color: var(--accent-light); font-size: 10px; font-weight: 600;
    padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.pwa-notif-mark:active { background: var(--bg-hover); }
