/* ═══════════════════════════════════════════════════════════════════════════
   Ahtab Delivery System V5 — Design System
   Inherits V3 visual identity + Admin panel extensions
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Theme Variables ──────────────────────────────────────────────────────── */
:root {
    --bg:       #0a0a0a;
    --bg2:      #111111;
    --bg3:      #161616;
    --bg4:      #1a1a1a;
    --border:   #1e1e1e;
    --border2:  #2a2a2a;
    --text:     #f5f5f5;
    --text2:    #cccccc;
    --text3:    #888888;
    --text4:    #444444;
    --sidebar:  #0e0e0e;
    --grid-line: rgba(255,255,255,0.025);
    --logo-filter: invert(1);
    --green:    #22c55e;
    --red:      #ef4444;
    --amber:    #f59e0b;
    --blue:     #60a5fa;
    --purple:   #a78bfa;
}
html.light {
    --bg:       #f4f4f5;
    --bg2:      #ffffff;
    --bg3:      #e4e4e7;
    --bg4:      #d4d4d8;
    --border:   #e4e4e7;
    --border2:  #d4d4d8;
    --text:     #09090b;
    --text2:    #3f3f46;
    --text3:    #71717a;
    --text4:    #a1a1aa;
    --sidebar:  #fafafa;
    --grid-line: rgba(0,0,0,0.05);
    --logo-filter: none;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html{scroll-behavior:smooth;}
body{
    font-family:'IBM Plex Sans Arabic',sans-serif;
    background:var(--bg);
    min-height:100vh;
    color:var(--text);
    transition:background .2s,color .2s;
    overflow-x:hidden;
}

/* ── Grid Background ─────────────────────────────────────────────────────── */
.grid-bg{
    position:fixed;inset:0;
    background-image:linear-gradient(var(--grid-line) 1px,transparent 1px),
                     linear-gradient(90deg,var(--grid-line) 1px,transparent 1px);
    background-size:40px 40px;
    pointer-events:none;z-index:0;
}

/* ── App Loader ──────────────────────────────────────────────────────────── */
.app-loader{
    display:flex;align-items:center;justify-content:center;
    min-height:100vh;
}
.spinner-lg{
    width:32px;height:32px;
    border:3px solid var(--border2);
    border-top-color:var(--text3);
    border-radius:50%;
    animation:spin .7s linear infinite;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar{
    background:var(--sidebar);
    border-left:1px solid var(--border);
    min-height:100vh;width:260px;
    position:fixed;right:0;top:0;z-index:30;
    display:flex;flex-direction:column;
    transition:background .2s;
}
.main-content{
    margin-right:260px;min-height:100vh;
    position:relative;z-index:1;
    padding:24px 32px;
}
.sidebar-logo{
    height:32px;width:auto;
    filter:var(--logo-filter);
}
.user-chip{
    display:flex;align-items:center;gap:12px;
    margin-bottom:28px;padding:12px;
    border-radius:12px;
    background:rgba(127,127,127,.06);
    border:1px solid var(--border);
}
.avatar-ring{
    padding:3px;
    background:linear-gradient(135deg,#333,#666,#333);
    border-radius:50%;flex-shrink:0;
}
.avatar-inner{
    background:var(--bg4);border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    overflow:hidden;
}
.nav-list{display:flex;flex-direction:column;gap:4px;}
.nav-item{
    display:flex;align-items:center;gap:10px;
    padding:10px 16px;border-radius:10px;
    color:var(--text3);font-size:.875rem;
    cursor:pointer;transition:all .15s;
    text-decoration:none;
}
.nav-item:hover{background:var(--bg3);color:var(--text2);}
.nav-item.active{background:var(--bg4);color:var(--text);}
.nav-item.active .nav-dot{background:var(--text);}
.nav-dot{
    width:6px;height:6px;border-radius:50%;
    background:var(--border2);flex-shrink:0;
}
.nav-badge{
    margin-right:auto;
    background:var(--bg3);border:1px solid var(--border);
    color:var(--text3);font-size:.65rem;
    padding:1px 7px;border-radius:999px;
    font-family:monospace;min-width:18px;text-align:center;
}
.divider{height:1px;background:var(--border);}

/* ── Mobile Header + Sidebar ─────────────────────────────────────────────── */
.mob-header{
    display:none;position:fixed;top:0;right:0;left:0;z-index:40;
    height:56px;background:var(--sidebar);
    border-bottom:1px solid var(--border);
    align-items:center;justify-content:space-between;
    padding:0 16px;gap:10px;
}
.mob-logo{height:24px;width:auto;filter:var(--logo-filter);}
.mob-menu-btn,.mob-close-btn{
    background:var(--bg4);border:1px solid var(--border2);
    color:var(--text3);width:36px;height:36px;
    border-radius:8px;cursor:pointer;
    display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.mob-overlay{
    display:none;position:fixed;inset:0;
    background:rgba(0,0,0,.55);z-index:36;
}
.mob-overlay.open{display:block;}

@media(max-width:768px){
    .sidebar{transform:translateX(100%);transition:transform .25s ease;z-index:50!important;}
    .sidebar.open{transform:translateX(0);}
    .main-content{margin-right:0;padding-top:72px!important;}
    .mob-header{display:flex;}
}

/* ── Theme Toggle ────────────────────────────────────────────────────────── */
.theme-toggle{
    background:var(--bg4);border:1px solid var(--border2);
    color:var(--text3);width:34px;height:34px;
    border-radius:8px;cursor:pointer;
    display:inline-flex;align-items:center;justify-content:center;
    transition:all .15s;flex-shrink:0;
}
.theme-toggle:hover{background:var(--bg3);color:var(--text);}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card{background:var(--bg2);border:1px solid var(--border);}
.order-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;overflow:hidden;
    transition:border-color .2s;
}
.order-card:hover{border-color:var(--border2);}

/* ── Info Grid ───────────────────────────────────────────────────────────── */
.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:0;}
.info-cell{padding:12px 16px;border-bottom:1px solid var(--border);color:var(--text2);}
.info-cell.full{grid-column:1/-1;}
.info-cell:nth-child(odd):not(.full){border-left:1px solid var(--border);}
@media(max-width:480px){
    .info-grid{grid-template-columns:1fr;}
    .info-cell:nth-child(odd):not(.full){border-left:none;}
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.action-btn{
    display:inline-flex;align-items:center;gap:6px;
    padding:8px 14px;border-radius:10px;
    font-size:.78rem;font-weight:500;
    border:1px solid;cursor:pointer;
    transition:all .15s;text-decoration:none;
    white-space:nowrap;background:none;
    font-family:inherit;
}
.btn-call{background:#051a0f;border-color:#0f3d20;color:#22c55e;}
.btn-call:hover{background:#0a2e18;}
.btn-copy{background:var(--bg3);border-color:var(--border2);color:var(--text3);}
.btn-copy:hover{background:var(--bg4);color:var(--text);}
.btn-sms{background:#0a1628;border-color:#1e3a5f;color:#60a5fa;}
.btn-sms:hover{background:#0d1f38;}
.btn-wa{background:#052a14;border:1px solid #0d5a2a;color:#25d366;}
.btn-wa:hover{background:#0a3d1e;}
.btn-wide{width:100%;justify-content:center;padding:11px;border-radius:10px;font-size:.85rem;}
.btn-items{background:var(--bg4);border-color:var(--border2);color:var(--text2);}
.btn-items:hover{color:var(--text);}
.btn-actions{background:#2a1e00;border-color:#7a5a00;color:#d97706;}
.btn-actions:hover{background:#3a2a00;}
.btn-refresh{
    background:var(--bg4);border:1px solid var(--border2);
    color:var(--text3);padding:8px 16px;
    border-radius:10px;font-size:.8rem;
    cursor:pointer;display:inline-flex;
    align-items:center;gap:6px;
    transition:all .15s;text-decoration:none;
    font-family:inherit;
}
.btn-refresh:hover{background:var(--bg3);color:var(--text);border-color:var(--border2);}
.btn-submit{
    background:var(--text);color:var(--bg);
    font-weight:600;font-size:.85rem;
    padding:11px 24px;border-radius:10px;
    border:none;cursor:pointer;
    transition:all .2s;
    display:inline-flex;align-items:center;gap:6px;
    font-family:inherit;
}
.btn-submit:hover{opacity:.9;box-shadow:0 4px 16px rgba(0,0,0,.2);}
.btn-submit:disabled{opacity:.4;cursor:not-allowed;}

/* ── Light mode button overrides ─────────────────────────────────────────── */
html.light .btn-call{background:#dcfce7;border-color:#86efac;color:#15803d;}
html.light .btn-call:hover{background:#bbf7d0;}
html.light .btn-sms{background:#dbeafe;border-color:#93c5fd;color:#1d4ed8;}
html.light .btn-sms:hover{background:#bfdbfe;}
html.light .btn-actions{background:#fef9c3;border-color:#fde047;color:#92400e;}
html.light .btn-actions:hover{background:#fef08a;}
html.light .btn-wa{background:#dcfce7;border-color:#86efac;color:#15803d;}
html.light .btn-wa:hover{background:#bbf7d0;}

/* ── Filter Pills ────────────────────────────────────────────────────────── */
.filter-bar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px;}
.filter-pill{
    background:var(--bg4);border:1px solid var(--border);
    color:var(--text3);font-size:.75rem;font-weight:500;
    padding:6px 14px;border-radius:999px;
    cursor:pointer;transition:all .15s;font-family:inherit;
}
.filter-pill.active{background:var(--text);color:var(--bg);border-color:var(--text);}
.filter-pill:hover:not(.active){background:var(--bg3);color:var(--text2);}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-input{
    background:var(--bg);border:1px solid var(--border2);
    color:var(--text);border-radius:10px;
    padding:10px 14px;font-size:.85rem;
    width:100%;outline:none;
    transition:border-color .2s;
    font-family:inherit;
}
.form-input:focus{border-color:var(--text4);}
.form-input::placeholder{color:var(--text4);}

/* ── Status chips ────────────────────────────────────────────────────────── */
.status-chip{
    display:inline-flex;align-items:center;gap:6px;
    padding:8px 16px;border-radius:10px;
    font-size:.82rem;font-weight:500;
    border:1px solid;cursor:pointer;
    transition:all .2s;font-family:inherit;
}
.chip-postpone{background:#1a1200;border-color:#3d2e00;color:#f59e0b;}
.chip-postpone:hover,.chip-postpone.selected{background:#2a1e00;border-color:#f59e0b;}
.chip-cancel{background:#1a0505;border-color:#3d1010;color:#ef4444;}
.chip-cancel:hover,.chip-cancel.selected{background:#2a0808;border-color:#ef4444;}
html.light .chip-postpone{background:#fef9c3;border-color:#fde047;color:#92400e;}
html.light .chip-postpone:hover,html.light .chip-postpone.selected{background:#fef08a;border-color:#f59e0b;}
html.light .chip-cancel{background:#fef2f2;border-color:#fecaca;color:#991b1b;}
html.light .chip-cancel:hover,html.light .chip-cancel.selected{background:#fee2e2;border-color:#ef4444;}

/* ── Collapse panels ────────────────────────────────────────────────────── */
.collapse-panel{display:none;}
.collapse-panel.open{display:block;}
.items-panel{background:var(--bg);border-top:1px solid var(--border);}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.items-table{width:100%;border-collapse:collapse;font-size:.8rem;}
.items-table th{
    color:var(--text3);font-weight:500;
    padding:10px 14px;border-bottom:1px solid var(--border);
    text-align:right;
}
.items-table td{
    color:var(--text2);padding:10px 14px;
    border-bottom:1px solid var(--border);
}
.items-table tr:last-child td{border-bottom:none;}
.items-table tr:hover td{background:var(--bg3);}

/* ── Manifest table ──────────────────────────────────────────────────────── */
.manifest-table{width:100%;border-collapse:collapse;}
.manifest-table thead tr{background:var(--bg3);}
.manifest-table th{
    color:var(--text3);font-weight:600;font-size:.78rem;
    padding:12px 16px;text-align:right;
    border-bottom:2px solid var(--border2);white-space:nowrap;
}
.manifest-table td{
    color:var(--text2);font-size:.85rem;
    padding:12px 16px;border-bottom:1px solid var(--border);
    vertical-align:top;
}
.manifest-table tbody tr:hover td{background:var(--bg3);}
.manifest-table tbody tr:last-child td{border-bottom:none;}
.prod-name{color:var(--text);font-weight:500;line-height:1.4;}
.prod-code{color:var(--text4);font-size:.72rem;font-family:monospace;margin-top:2px;}
.qty-badge{
    display:inline-flex;align-items:center;gap:5px;
    background:var(--bg4);border:1px solid var(--border2);
    color:var(--text);font-weight:700;font-size:.88rem;
    padding:4px 12px;border-radius:8px;
    font-family:monospace;white-space:nowrap;margin:2px;
}
.qty-unit{font-weight:400;font-size:.78rem;color:var(--text3);}

/* ── Invoice key ─────────────────────────────────────────────────────────── */
.invoice-key{
    font-size:.68rem;color:var(--text4);
    font-family:monospace;word-break:break-all;
}

/* ── Receipt rows ────────────────────────────────────────────────────────── */
.receipt-row{
    display:flex;justify-content:space-between;
    align-items:center;padding:7px 0;
    border-bottom:1px solid var(--border);
}
.receipt-row:last-child{border-bottom:none;}

/* ── Badge pill ──────────────────────────────────────────────────────────── */
.badge-pill{
    background:var(--bg4);border:1px solid var(--border2);
    color:var(--text3);font-size:.7rem;
    padding:2px 8px;border-radius:999px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast{
    position:fixed;bottom:24px;left:50%;
    transform:translateX(-50%) translateY(20px);
    background:var(--bg2);border:1px solid var(--border2);
    color:var(--text);padding:12px 24px;
    border-radius:12px;font-size:.85rem;
    z-index:9999;opacity:0;transition:all .3s;
    pointer-events:none;white-space:nowrap;
    font-family:'IBM Plex Sans Arabic',sans-serif;
}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
#toast.success{border-color:#0f3d20;color:#22c55e;background:#051a0f;}
#toast.error{border-color:#3d1010;color:#ef4444;background:#1a0505;}
html.light #toast.success{border-color:#86efac;color:#15803d;background:#dcfce7;}
html.light #toast.error{border-color:#fecaca;color:#991b1b;background:#fef2f2;}

/* ── Spinners ────────────────────────────────────────────────────────────── */
.spinner{
    width:14px;height:14px;
    border:2px solid rgba(0,0,0,.15);
    border-top-color:#0a0a0a;
    border-radius:50%;
    animation:spin .7s linear infinite;
    display:none;
}
.spinner-green{border-color:rgba(34,197,94,.2);border-top-color:#22c55e;}
@keyframes spin{to{transform:rotate(360deg);}}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp{
    from{opacity:0;transform:translateY(16px);}
    to{opacity:1;transform:translateY(0);}
}
.animate-in{animation:fadeSlideUp .5s ease forwards;}
.d1{animation-delay:.05s;opacity:0;}
.d2{animation-delay:.1s;opacity:0;}
.order-card{opacity:0;animation:fadeSlideUp .45s ease forwards;}
@keyframes pulse-dot{0%,100%{opacity:1;}50%{opacity:.4;}}

/* ── Pickup-specific ─────────────────────────────────────────────────────── */
.pickup-check{
    appearance:none;-webkit-appearance:none;
    width:22px;height:22px;min-width:22px;
    border:2px solid var(--border2);
    border-radius:6px;background:var(--bg);
    cursor:pointer;position:relative;
    transition:all .2s;flex-shrink:0;
}
.pickup-check:hover{border-color:#22c55e44;background:#22c55e0a;}
.pickup-check:checked{background:#22c55e;border-color:#22c55e;}
.pickup-check:checked::after{
    content:'';position:absolute;
    top:3px;left:5px;
    width:6px;height:10px;
    border:2px solid #0a0a0a;
    border-top:none;border-left:none;
    transform:rotate(45deg);
}
.order-card.selected{border-color:#22c55e55!important;box-shadow:0 0 0 1px #22c55e22;}

.btn-pickup-single{
    width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
    padding:11px;border-radius:10px;
    background:#051a0f;border:1px solid #0f3d20;color:#22c55e;
    font-size:.85rem;font-weight:600;
    cursor:pointer;font-family:inherit;transition:all .15s;margin-top:10px;
}
.btn-pickup-single:hover{background:#0a2e18;border-color:#22c55e88;}
.btn-pickup-single:disabled{opacity:.4;cursor:not-allowed;}
html.light .btn-pickup-single{background:#dcfce7;border-color:#86efac;color:#15803d;}
html.light .btn-pickup-single:hover{background:#bbf7d0;}

.select-all-row{
    display:flex;align-items:center;gap:10px;
    padding:10px 14px;background:var(--bg2);
    border:1px solid var(--border);border-radius:12px;
    margin-bottom:16px;cursor:pointer;
}
.select-all-row label{cursor:pointer;font-size:.875rem;color:var(--text2);user-select:none;}

/* ── Batch bar ───────────────────────────────────────────────────────────── */
#batch-bar{
    position:fixed;bottom:0;left:0;right:0;z-index:100;
    background:var(--bg2);border-top:1px solid #22c55e44;
    padding:14px 24px;display:none;
    align-items:center;justify-content:space-between;
    gap:14px;flex-wrap:wrap;
    box-shadow:0 -8px 32px rgba(0,0,0,.4);
}
#batch-bar.visible{display:flex;}
.btn-batch-pickup{
    background:#22c55e;color:#0a0a0a;
    font-weight:700;font-size:.9rem;
    padding:12px 28px;border-radius:12px;
    border:none;cursor:pointer;
    display:inline-flex;align-items:center;gap:8px;
    font-family:inherit;transition:all .2s;white-space:nowrap;
}
.btn-batch-pickup:hover{background:#16a34a;box-shadow:0 4px 16px #22c55e44;}
.btn-batch-pickup:disabled{opacity:.4;cursor:not-allowed;}
.btn-batch-cancel{
    background:var(--bg4);color:var(--text3);
    border:1px solid var(--border2);
    padding:11px 20px;border-radius:12px;
    font-size:.85rem;font-family:inherit;
    cursor:pointer;transition:all .15s;
}
.btn-batch-cancel:hover{background:var(--bg3);color:var(--text);}

/* ── Settlement-specific ─────────────────────────────────────────────────── */
.balance-card{background:var(--bg2);border:1px solid var(--border);border-radius:20px;overflow:hidden;}
.balance-banner{
    background:linear-gradient(135deg,#0a0a0a 0%,#161616 50%,#0e0e0e 100%);
    border-bottom:1px solid var(--border);
    padding:32px 28px;position:relative;overflow:hidden;
}
html.light .balance-banner{
    background:linear-gradient(135deg,#f0f0f0 0%,#e8e8e8 50%,#f4f4f5 100%);
}
.balance-banner::before{
    content:'';position:absolute;
    width:300px;height:300px;border-radius:50%;
    background:radial-gradient(circle,rgba(34,197,94,.08) 0%,transparent 70%);
    top:-80px;left:-60px;pointer-events:none;
}
.balance-amount{
    font-size:3rem;font-weight:700;
    font-family:monospace;color:#22c55e;
    line-height:1;margin-bottom:6px;
}
.balance-amount.negative{color:#ef4444;}
.balance-amount.zero{color:var(--text3);}
.balance-label{color:var(--text3);font-size:.85rem;}
.account-row{
    display:flex;align-items:center;justify-content:space-between;
    padding:14px 28px;border-bottom:1px solid var(--border);
}
.account-row:last-child{border-bottom:none;}

.settle-section{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;padding:24px;margin-top:20px;
}
.btn-autofill{
    background:#0a1628;border:1px solid #1e3a5f;color:#60a5fa;
    padding:11px 16px;border-radius:10px;
    font-size:.82rem;font-weight:500;cursor:pointer;
    display:flex;align-items:center;gap:6px;
    white-space:nowrap;font-family:inherit;transition:background .15s;
}
.btn-autofill:hover{background:#0d1f38;}
html.light .btn-autofill{background:#dbeafe;border-color:#93c5fd;color:#1d4ed8;}
html.light .btn-autofill:hover{background:#bfdbfe;}

.btn-settle{
    background:#f5f5f5;color:#0a0a0a;
    font-weight:700;font-size:.9rem;
    padding:12px 28px;border-radius:12px;
    border:1px solid transparent;cursor:pointer;
    display:inline-flex;align-items:center;gap:8px;
    font-family:inherit;transition:all .2s;white-space:nowrap;
}
.btn-settle:hover:not(:disabled){
    background:#fff;box-shadow:0 6px 20px rgba(0,0,0,.15);
    transform:translateY(-1px);
}

.fee-checkbox{
    appearance:none;-webkit-appearance:none;
    width:20px;height:20px;min-width:20px;
    border:1.5px solid var(--border2);border-radius:6px;
    background:var(--bg);cursor:pointer;position:relative;
    transition:all .2s;
}
.fee-checkbox:checked{background:#f59e0b;border-color:#f59e0b;}
.fee-checkbox:checked::after{
    content:'';position:absolute;
    width:5px;height:9px;
    border:2px solid #0a0a0a;
    border-top:none;border-left:none;
    transform:rotate(45deg);
}
.fee-input-wrap{display:none;margin-top:12px;animation:fadeSlideUp .2s ease forwards;}
.fee-input-wrap.show{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.profile-hero{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:20px;padding:24px 28px;
    margin-bottom:28px;display:flex;
    align-items:center;gap:18px;flex-wrap:wrap;
}
.nav-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:14px;margin-bottom:28px;
}
.nav-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;padding:20px;
    text-decoration:none;display:flex;
    flex-direction:column;gap:16px;
    transition:border-color .15s,transform .15s,box-shadow .15s;
    position:relative;overflow:hidden;cursor:pointer;
}
.nav-card:hover{
    border-color:var(--border2);
    transform:translateY(-2px);
    box-shadow:0 8px 28px rgba(0,0,0,.2);
}
html.light .nav-card:hover{box-shadow:0 8px 28px rgba(0,0,0,.08);}
.nav-card:active{transform:translateY(0);box-shadow:none;}
.nav-card-icon{
    width:46px;height:46px;border-radius:13px;
    display:flex;align-items:center;justify-content:center;
}
.nav-card-title{color:var(--text);font-size:.95rem;font-weight:600;margin-bottom:4px;}
.nav-card-desc{color:var(--text4);font-size:.78rem;line-height:1.55;}
.nav-card-arrow{
    position:absolute;top:18px;left:18px;
    color:var(--border2);transition:color .15s,left .12s;
}
.nav-card:hover .nav-card-arrow{color:var(--text3);left:14px;}

.info-row{
    display:flex;align-items:center;justify-content:space-between;
    padding:13px 0;border-bottom:1px solid var(--border);
}
.info-row:last-child{border-bottom:none;}
.info-label{
    display:flex;align-items:center;gap:9px;
    color:var(--text3);font-size:.85rem;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-wrapper{
    display:flex;align-items:center;justify-content:center;
    min-height:100vh;padding:16px;position:relative;z-index:1;
}
.login-glow{
    position:fixed;width:700px;height:700px;border-radius:50%;
    background:radial-gradient(circle,rgba(255,255,255,.035) 0%,transparent 65%);
    top:50%;left:50%;transform:translate(-50%,-50%);
    pointer-events:none;z-index:0;
}
.login-card{
    position:relative;z-index:1;
    background:#111;border:1px solid #222;
    border-radius:24px;padding:40px 36px;
    max-width:420px;width:100%;
    box-shadow:0 0 0 1px rgba(255,255,255,.03),0 32px 64px rgba(0,0,0,.8);
}
.login-logo{
    height:40px;width:auto;filter:invert(1);
    margin:0 auto 24px;display:block;
}
.login-input{
    background:#0a0a0a;border:1px solid #2a2a2a;
    color:#f5f5f5;transition:all .2s;outline:none;
    width:100%;border-radius:12px;
    padding:12px 16px 12px 16px;padding-right:44px;font-size:.9rem;
    font-family:'IBM Plex Sans Arabic',sans-serif;
}
html.light .login-card{background:#fff;border-color:#e4e4e7;box-shadow:0 32px 64px rgba(0,0,0,.1);}
html.light .login-input{background:#f4f4f5;border-color:#d4d4d8;color:#09090b;}
html.light .login-input::placeholder{color:#a1a1aa;}
html.light .login-glow{background:radial-gradient(circle,rgba(0,0,0,.04) 0%,transparent 65%);}
html.light .login-logo{filter:none;}
.login-input:focus{border-color:#555;box-shadow:0 0 0 3px rgba(255,255,255,.04);}
.login-input::placeholder{color:#444;}
.btn-login{
    display:flex;align-items:center;justify-content:center;gap:10px;
    background:#f5f5f5;color:#0a0a0a;
    font-weight:700;font-size:1rem;
    padding:14px;width:100%;border-radius:14px;
    text-decoration:none;border:none;
    cursor:pointer;transition:all .2s;
    font-family:'IBM Plex Sans Arabic',sans-serif;
}
.btn-login:hover{
    background:#fff;transform:translateY(-1px);
    box-shadow:0 8px 24px rgba(255,255,255,.12);
}
.btn-login:active{transform:translateY(0);}
.btn-login:disabled{opacity:.5;cursor:not-allowed;transform:none;}

.custom-check{
    appearance:none;width:18px;height:18px;
    border:1.5px solid #333;border-radius:4px;
    background:#0a0a0a;cursor:pointer;
    position:relative;flex-shrink:0;transition:all .2s;
}
.custom-check:checked{background:#f5f5f5;border-color:#f5f5f5;}
.custom-check:checked::after{
    content:'';position:absolute;
    top:2px;left:4px;width:5px;height:9px;
    border:2px solid #0a0a0a;
    border-top:none;border-left:none;
    transform:rotate(45deg);
}
.login-error{
    background:rgba(127,29,29,.25);
    border:1px solid rgba(127,29,29,.4);
    color:#f87171;font-size:.85rem;
    border-radius:12px;padding:12px 16px;
    margin-bottom:20px;display:flex;
    align-items:center;gap:8px;
}

@keyframes shake{
    0%,100%{transform:translateX(0);}
    20%{transform:translateX(-8px);}
    40%{transform:translateX(8px);}
    60%{transform:translateX(-5px);}
    80%{transform:translateX(5px);}
}
.shake{animation:shake .4s ease;}

@keyframes fadeUp{
    from{opacity:0;transform:translateY(24px);}
    to{opacity:1;transform:translateY(0);}
}
.a1{animation:fadeUp .6s ease .05s both;}
.a2{animation:fadeUp .6s ease .15s both;}
.a3{animation:fadeUp .6s ease .25s both;}
.a4{animation:fadeUp .6s ease .35s both;}
.a5{animation:fadeUp .6s ease .45s both;}

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar{
    display:flex;align-items:center;gap:8px;
    background:var(--bg2);border:1px solid var(--border);
    border-radius:12px;padding:8px 14px;
    margin-bottom:16px;transition:border-color .2s;
}
.search-bar:focus-within{border-color:var(--border2);}
.search-input{
    flex:1;background:none;border:none;outline:none;
    color:var(--text);font-size:.85rem;
    font-family:'IBM Plex Sans Arabic',sans-serif;
}
.search-input::placeholder{color:var(--text4);}
.search-icon{color:var(--text4);flex-shrink:0;}

/* ── Offline banner ──────────────────────────────────────────────────────── */
.offline-banner{
    position:fixed;top:0;left:0;right:0;z-index:9998;
    background:#7f1d1d;color:#fca5a5;
    text-align:center;padding:8px;font-size:.82rem;
    font-weight:500;display:none;
}
.offline-banner.show{display:block;}

/* ── Summary cards ───────────────────────────────────────────────────────── */
.summary-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:14px;padding:18px 20px;
}
.summary-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
    gap:12px;margin-bottom:24px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;padding:56px 24px;text-align:center;
}

/* ── Error state ─────────────────────────────────────────────────────────── */
.error-state{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;padding:24px;
    display:flex;align-items:flex-start;gap:12px;
}

/* ── Loading skeleton ────────────────────────────────────────────────────── */
@keyframes shimmer{
    0%{background-position:-400px 0;}
    100%{background-position:400px 0;}
}
.skeleton{
    background:linear-gradient(90deg,var(--bg3) 25%,var(--bg4) 50%,var(--bg3) 75%);
    background-size:800px 100%;
    animation:shimmer 1.5s infinite;
    border-radius:8px;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden{display:none!important;}
.flex{display:flex;}
.flex-col{flex-direction:column;}
.items-center{align-items:center;}
.justify-between{justify-content:space-between;}
.gap-8{gap:8px;}
.gap-10{gap:10px;}
.gap-12{gap:12px;}
.gap-14{gap:14px;}
.gap-16{gap:16px;}
.flex-wrap{flex-wrap:wrap;}
.flex-1{flex:1;}
.min-w-0{min-width:0;}
.w-full{width:100%;}
.text-center{text-align:center;}
.font-mono{font-family:monospace;}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print{
    html, body, #app, .main-content, #print-content {
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    .sidebar, .mob-header, .no-print, #batch-bar, .mob-overlay, .grid-bg, #toast {
        display: none !important;
    }
    .main-content { margin-right: 0 !important; padding: 0 !important; }
    
    #print-content { 
        border: none !important; 
        padding: 0 !important; 
        margin: 0 !important; 
        box-shadow: none !important; 
    }
    #print-content * { 
        color: #000000 !important;
        border-color: #cccccc !important;
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
    }
    #print-content img {
        filter: none !important;
    }
    table th {
        background: #f0f0f0 !important;
        background-color: #f0f0f0 !important;
        color: #000000 !important;
    }
    table tr:nth-child(even) td {
        background: #fafafa !important;
        background-color: #fafafa !important;
    }
    table th, table td {
        border-bottom: 1px solid #ddd !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   V5 Admin Extensions
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Admin Data Table ────────────────────────────────────────────────────── */
.data-table{width:100%;border-collapse:collapse;font-size:.85rem;}
.data-table th{
    color:var(--text3);font-weight:600;font-size:.78rem;
    padding:12px 16px;text-align:right;
    border-bottom:2px solid var(--border2);white-space:nowrap;
    background:var(--bg3);
}
.data-table td{
    color:var(--text2);padding:12px 16px;
    border-bottom:1px solid var(--border);vertical-align:middle;
}
.data-table tbody tr:hover td{background:var(--bg3);}
.data-table tbody tr:last-child td{border-bottom:none;}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:28px;}
.stat-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;padding:20px;position:relative;overflow:hidden;
}
.stat-value{font-size:2rem;font-weight:700;font-family:monospace;line-height:1.1;margin-bottom:4px;}
.stat-label{color:var(--text3);font-size:.82rem;}
.stat-icon{position:absolute;top:16px;left:16px;color:var(--text4);opacity:.4;}

/* ── Modal / Dialog ──────────────────────────────────────────────────────── */
.modal-overlay{
    position:fixed;inset:0;background:rgba(0,0,0,.65);
    z-index:200;display:flex;align-items:center;justify-content:center;
    padding:20px;animation:fadeIn .2s ease;
}
.modal-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:20px;padding:28px;max-width:540px;width:100%;
    max-height:85vh;overflow-y:auto;animation:fadeSlideUp .3s ease;
}
.modal-title{color:var(--text);font-size:1.1rem;font-weight:600;margin-bottom:20px;display:flex;align-items:center;gap:10px;}
.modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:24px;}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

/* ── Form Groups ─────────────────────────────────────────────────────────── */
.form-group{margin-bottom:16px;}
.form-label{color:var(--text3);font-size:.78rem;font-weight:500;display:block;margin-bottom:6px;}
.form-row{display:flex;gap:12px;flex-wrap:wrap;}
.form-row > *{flex:1;min-width:200px;}
.form-select{
    background:var(--bg);border:1px solid var(--border2);
    color:var(--text);border-radius:10px;padding:10px 14px;
    font-size:.85rem;width:100%;outline:none;font-family:inherit;
    appearance:none;-webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat:no-repeat;background-position:left 14px center;
}
.form-textarea{
    background:var(--bg);border:1px solid var(--border2);
    color:var(--text);border-radius:10px;padding:10px 14px;
    font-size:.85rem;width:100%;outline:none;font-family:inherit;
    resize:vertical;min-height:80px;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs{display:flex;gap:0;border-bottom:2px solid var(--border);margin-bottom:24px;}
.tab{
    padding:10px 20px;color:var(--text3);font-size:.85rem;font-weight:500;
    cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;
    transition:all .15s;font-family:inherit;background:none;border-top:none;border-left:none;border-right:none;
}
.tab:hover{color:var(--text2);}
.tab.active{color:var(--text);border-bottom-color:var(--text);}

/* ── Chip/Tag ────────────────────────────────────────────────────────────── */
.tag{
    display:inline-flex;align-items:center;gap:4px;
    padding:3px 10px;border-radius:8px;font-size:.72rem;font-weight:500;
    border:1px solid;
}

/* ── Color Swatch ────────────────────────────────────────────────────────── */
.color-dot{width:14px;height:14px;border-radius:4px;display:inline-block;border:1px solid rgba(255,255,255,.15);flex-shrink:0;}

/* ── Password Generator Button ───────────────────────────────────────────── */
.btn-generate{
    background:#120a28;border:1px solid #2e1e5f;color:#a78bfa;
    padding:8px 14px;border-radius:10px;font-size:.78rem;font-weight:500;
    cursor:pointer;display:inline-flex;align-items:center;gap:6px;
    white-space:nowrap;font-family:inherit;transition:background .15s;
}
.btn-generate:hover{background:#1a0f3a;}
html.light .btn-generate{background:#ede9fe;border-color:#c4b5fd;color:#6d28d9;}

/* ── Action Icon Buttons ─────────────────────────────────────────────────── */
.btn-icon{
    background:var(--bg4);border:1px solid var(--border2);color:var(--text3);
    width:32px;height:32px;border-radius:8px;cursor:pointer;
    display:inline-flex;align-items:center;justify-content:center;
    transition:all .15s;flex-shrink:0;
}
.btn-icon:hover{background:var(--bg3);color:var(--text);}
.btn-icon.danger:hover{background:#1a0505;border-color:#3d1010;color:#ef4444;}
html.light .btn-icon.danger:hover{background:#fef2f2;border-color:#fecaca;color:#991b1b;}

/* ── Badge Count ─────────────────────────────────────────────────────────── */
.badge-count{
    display:inline-flex;align-items:center;justify-content:center;
    min-width:22px;height:22px;padding:0 6px;border-radius:999px;
    font-size:.7rem;font-weight:700;font-family:monospace;
}

/* ── Checkbox styled ─────────────────────────────────────────────────────── */
.check-box{
    appearance:none;-webkit-appearance:none;
    width:20px;height:20px;min-width:20px;
    border:2px solid var(--border2);border-radius:6px;
    background:var(--bg);cursor:pointer;position:relative;
    transition:all .2s;flex-shrink:0;
}
.check-box:checked{background:#22c55e;border-color:#22c55e;}
.check-box:checked::after{
    content:'';position:absolute;top:3px;left:5px;
    width:6px;height:10px;border:2px solid #0a0a0a;
    border-top:none;border-left:none;transform:rotate(45deg);
}

/* ── QR container ────────────────────────────────────────────────────────── */
.qr-container{
    background:white;border-radius:12px;padding:16px;
    display:inline-flex;align-items:center;justify-content:center;
}

/* ── Payment method pills ────────────────────────────────────────────────── */
.pay-pill{
    display:inline-flex;align-items:center;gap:6px;
    padding:10px 18px;border-radius:12px;font-size:.85rem;font-weight:500;
    border:2px solid var(--border2);cursor:pointer;transition:all .2s;
    font-family:inherit;background:var(--bg3);color:var(--text3);
}
.pay-pill.selected{border-color:#22c55e;background:#051a0f;color:#22c55e;}
html.light .pay-pill.selected{border-color:#16a34a;background:#dcfce7;color:#15803d;}

/* ── Deliver / Postpone / Cancel Buttons ─────────────────────────────────── */
.btn-deliver{background:#051a0f;border-color:#0f3d20;color:#22c55e;}
.btn-deliver:hover{background:#0a2e18;}
.btn-postpone{background:#1a1200;border-color:#3d2e00;color:#f59e0b;}
.btn-postpone:hover{background:#2a1e00;}
.btn-cancel{background:#1a0505;border-color:#3d1010;color:#ef4444;}
.btn-cancel:hover{background:#2a0808;}
html.light .btn-deliver{background:#dcfce7;border-color:#86efac;color:#15803d;}
html.light .btn-deliver:hover{background:#bbf7d0;}
html.light .btn-postpone{background:#fef9c3;border-color:#fde047;color:#92400e;}
html.light .btn-postpone:hover{background:#fef08a;}
html.light .btn-cancel{background:#fef2f2;border-color:#fecaca;color:#991b1b;}
html.light .btn-cancel:hover{background:#fee2e2;}

/* ── Chat / Activity Log ─────────────────────────────────────────────────── */
.chat-log{
    display:flex;flex-direction:column;gap:10px;
    max-height:400px;overflow-y:auto;padding:12px;
    background:var(--bg);border:1px solid var(--border);
    border-radius:12px;margin-bottom:12px;
}
.chat-bubble{
    padding:10px 14px;border-radius:12px;max-width:85%;
    font-size:.82rem;line-height:1.5;position:relative;
}
.chat-bubble.admin{
    background:#120a28;border:1px solid #2e1e5f;color:#c4b5fd;
    align-self:flex-start;border-bottom-right-radius:4px;
}
.chat-bubble.driver{
    background:#0a1628;border:1px solid #1e3a5f;color:#93c5fd;
    align-self:flex-end;border-bottom-left-radius:4px;
}
html.light .chat-bubble.admin{background:#ede9fe;border-color:#c4b5fd;color:#4c1d95;}
html.light .chat-bubble.driver{background:#dbeafe;border-color:#93c5fd;color:#1e3a5f;}
.chat-meta{font-size:.68rem;color:var(--text4);margin-top:4px;}
.chat-input-row{display:flex;gap:8px;align-items:flex-end;}
.chat-input-row .form-input{flex:1;}
.chat-input-row button{flex-shrink:0;}

/* ── Bank info card ──────────────────────────────────────────────────────── */
.bank-info-card{
    background:var(--bg3);border:1px solid var(--border);
    border-radius:10px;padding:12px 14px;margin-top:12px;
    font-size:.8rem;
}
.bank-info-card p{margin-bottom:4px;color:var(--text2);}
.bank-info-card span{font-family:monospace;color:var(--text);font-weight:500;}

/* ── Remember me ─────────────────────────────────────────────────────────── */
.remember-row{
    display:flex;align-items:center;gap:8px;
    margin-bottom:20px;cursor:pointer;
}
.remember-row label{color:var(--text3);font-size:.82rem;cursor:pointer;user-select:none;}
html.light .remember-row label{color:#71717a;}

/* ── Deliver No Pay button ───────────────────────────────────────────────── */
.btn-deliver-no-pay{
    border-color:#a78bfa !important;
    color:#a78bfa !important;
    background:#a78bfa18 !important;
}
.btn-deliver-no-pay:hover{
    background:#a78bfa33 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTE: filter-bar, filter-pill, stat-grid, stat-card, balance-card,
   balance-banner, balance-amount, settle-section, btn-settle, receipt-row,
   btn-call, btn-sms, btn-wa, and @media print are defined above in the
   core design system. Do not re-declare them here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   Light Mode — Checkbox & Button Overrides
   ═══════════════════════════════════════════════════════════════════════════ */
html.light .pickup-check:checked::after{border-color:#fff;}
html.light .fee-checkbox:checked::after{border-color:#fff;}
html.light .custom-check:checked::after{border-color:#0a0a0a;}
html.light .check-box:checked::after{border-color:#fff;}

html.light .btn-deliver-no-pay{border-color:#7c3aed!important;color:#7c3aed!important;background:#ede9fe!important;}
html.light .btn-deliver-no-pay:hover{background:#ddd6fe!important;}
html.light .nav-card-icon{border-color:var(--border2)!important;}
html.light .btn-call:hover{background:#dcfce7;}
html.light .btn-sms:hover{background:#dbeafe;}
html.light .btn-wa:hover{background:#dcfce7;}
html.light .btn-copy:hover{background:#f4f4f5;}
html.light .sidebar-logo{filter:invert(1);}

/* ═══════════════════════════════════════════════════════════════════════════
   Driver Order Cards — Mobile-First Redesign
   ═══════════════════════════════════════════════════════════════════════════ */
.driver-card{
    background:var(--bg2);border:1px solid var(--border);
    border-radius:16px;overflow:hidden;
    transition:border-color .2s,box-shadow .2s;
    opacity:0;animation:fadeSlideUp .45s ease forwards;
}
.driver-card:hover{border-color:var(--border2);box-shadow:0 4px 20px rgba(0,0,0,.08);}
.driver-card-header{
    padding:14px 16px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;
    border-bottom:1px solid var(--border);
}
.driver-card-body{padding:16px;}
.driver-card-customer{font-size:1.05rem;font-weight:600;color:var(--text);margin-bottom:6px;line-height:1.4;}
.driver-card-address{display:flex;align-items:flex-start;gap:6px;color:var(--text3);font-size:.82rem;margin-bottom:12px;line-height:1.5;}
.driver-card-address svg{flex-shrink:0;margin-top:2px;}
.driver-card-meta{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;}
.driver-card-meta-item{display:flex;align-items:center;gap:5px;font-size:.78rem;color:var(--text3);background:var(--bg3);border:1px solid var(--border);padding:4px 10px;border-radius:8px;}
.driver-card-meta-item svg{color:var(--text4);}
.driver-card-meta-item strong{color:var(--text);font-family:monospace;}
.driver-card-phone{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:12px 0;margin-bottom:8px;border-top:1px solid var(--border);border-bottom:1px solid var(--border);}
.driver-card-actions{display:flex;gap:8px;flex-wrap:wrap;padding-top:8px;}
.driver-card-actions .action-btn{flex:1;min-width:0;justify-content:center;text-align:center;}
.driver-card-notes{margin-top:10px;padding:10px 14px;background:var(--bg3);border:1px solid var(--border);border-radius:10px;}
.driver-card-notes p{font-size:.82rem;color:var(--text3);line-height:1.5;}
.driver-card-notes strong{color:var(--text2);font-size:.72rem;display:block;margin-bottom:4px;}
.driver-card-footer{display:flex;gap:8px;padding:0 16px 16px;flex-wrap:wrap;}
.driver-card-footer .action-btn{flex:1;justify-content:center;min-width:0;}
.btn-notes{background:var(--bg4);border-color:var(--border2);color:var(--text2);}
.btn-notes:hover{color:var(--text);background:var(--bg3);}
html.light .btn-notes{background:#e4e4e7;border-color:#d4d4d8;color:#3f3f46;}
html.light .driver-card:hover{box-shadow:0 4px 20px rgba(0,0,0,.06);}

/* Notes Modal Chat */
.note-bubble{padding:10px 14px;border-radius:12px;margin-bottom:8px;max-width:90%;}
.note-bubble.admin{background:#7c3aed18;border:1px solid #7c3aed33;margin-right:auto;}
.note-bubble.driver{background:var(--bg3);border:1px solid var(--border);margin-left:auto;}
.note-bubble .note-author{font-size:.68rem;color:var(--text4);margin-bottom:3px;font-weight:600;}
.note-bubble .note-text{font-size:.82rem;color:var(--text2);line-height:1.5;}
.note-bubble .note-time{font-size:.65rem;color:var(--text4);margin-top:4px;text-align:left;}
html.light .note-bubble.admin{background:#ede9fe;border-color:#c4b5fd;}
html.light .note-bubble.driver{background:#f4f4f5;border-color:#e4e4e7;}

/* Split payment toggle */
.split-toggle{display:flex;border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-bottom:14px;}
.split-toggle button{flex:1;padding:10px;font-size:.82rem;background:transparent;border:none;color:var(--text3);cursor:pointer;transition:all .2s;}
.split-toggle button.active{background:var(--bg4);color:var(--text);font-weight:600;}

@media(max-width:480px){
    .driver-card-header{padding:12px 14px;}
    .driver-card-body{padding:14px;}
    .driver-card-customer{font-size:.95rem;}
    .driver-card-actions .action-btn{font-size:.72rem;padding:7px 10px;}
    .driver-card-footer .action-btn{font-size:.72rem;padding:7px 10px;}
    .driver-card-phone .action-btn{font-size:.72rem;padding:6px 8px;}
}

