@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/ibm-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/ibm-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/ibm-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/ibm-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Fraunces";
    src: url("../fonts/fraunces-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}

:root {
    --ink: #1a241e;
    --muted: #5d6a62;
    --paper: #efe6d6;
    --paper-2: #f6f1e6;
    --card: #fffdf8;
    --line: #e4d8c4;
    --sidebar: #121a16;
    --sidebar-2: #1c2822;
    --brass: #c8922a;
    --brass-2: #f3e2b8;
    --green: #1d6b45;
    --green-soft: #e7f5ee;
    --red: #8f2d2d;
    --red-soft: #fdeeee;
    --amber: #8a5a00;
    --amber-soft: #fff3d8;
    --blue: #1e4f86;
    --blue-soft: #e8f1fb;
    --shadow: 0 18px 40px rgba(26, 36, 30, 0.06);
    --radius: 18px;
    --font: "Outfit", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
    --display: "Fraunces", "IBM Plex Sans Arabic", Georgia, serif;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(200, 146, 42, 0.16), transparent 50%),
        var(--paper);
    min-height: 100vh;
}
body, button, input, select, textarea { font-family: inherit; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font-size: 1rem; }

.shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: linear-gradient(180deg, var(--sidebar), #0c1210 140%);
    color: #f4efe4;
    padding: 22px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    padding-inline: 8px;
}
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--brass);
    color: #1a1408;
    display: grid;
    place-items: center;
    flex: none;
}
.brand strong {
    display: block;
    font-family: var(--display);
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    font-weight: 600;
}
.brand small { color: #c9c1b2; display: block; margin-top: 2px; }
.side-nav { overflow: auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.side-nav p {
    margin: 0 8px 6px;
    color: #9aa396;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #e7e1d4;
    padding: 9px 10px;
    border-radius: 12px;
}
.side-nav a.active, .side-nav a:hover { background: var(--sidebar-2); color: white; }
.side-nav a.active { box-shadow: inset 3px 0 0 var(--brass); }
[dir="rtl"] .side-nav a.active { box-shadow: inset -3px 0 0 var(--brass); }
.side-foot {
    margin-top: auto;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
}
.side-foot strong { display: block; }
.side-foot span { color: #c9c1b2; font-size: 0.85rem; }
.logout-btn {
    margin-top: 10px;
    background: transparent;
    color: #f3e2b8;
    border: 1px solid rgba(243, 226, 184, 0.35);
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
}

.main { min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(239, 230, 214, 0.9);
    backdrop-filter: blur(10px);
}
.topbar form { margin: 0; }
.icon-btn, .lang-link, .branch-select, .control, .btn {
    border-radius: 12px;
}
.icon-btn {
    display: none;
    border: 1px solid var(--line);
    background: var(--card);
    width: 42px;
    height: 42px;
    cursor: pointer;
}
.branch-select, .control, .btn, .lang-link {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
}
.branch-select, .control {
    padding: 10px 12px;
    min-height: 44px;
}
.branch-select { max-width: 280px; }
.top-meta { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    text-decoration: none;
    font-size: 0.92rem;
}
.pill b { font-variant-numeric: tabular-nums; }
.lang-link { text-decoration: none; padding: 8px 10px; font-weight: 600; }
.lang-link.on { background: var(--ink); color: white; border-color: var(--ink); }
.content { padding: 6px 22px 40px; }

.page-head, .split, .filters, .stat-row, .dash-grid, .two, .form-grid, .lane-switch, .suggest, .cam-picks, .summary-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.page-head { justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.page-head h1, .login-story h1, .result h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; margin: 0; }
.page-head h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.kicker { margin: 0 0 6px; color: var(--brass); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }
.lead { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.stat {
    flex: 1 1 160px;
    min-width: 150px;
}
.stat span, .muted { color: var(--muted); }
.stat strong, .metric {
    display: block;
    margin-top: 6px;
    font-size: 1.7rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}
.stat em { font-style: normal; color: var(--muted); font-size: 0.85rem; }

.dash-grid { align-items: stretch; }
.dash-grid > * { flex: 1 1 320px; }
.meter { height: 14px; background: #efe6d4; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--brass)); }
[dir="rtl"] .meter span { background: linear-gradient(270deg, var(--green), var(--brass)); }
.branch-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; margin-top: 12px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.bar i { display: block; width: 100%; border-radius: 8px 8px 3px 3px; background: var(--ink); min-height: 4px; font-style: normal; }
.bar span { font-size: 0.75rem; color: var(--muted); }
.split-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: #efe6d4; margin: 10px 0; }
.split-bar .sub { background: var(--green); }
.split-bar .vis { background: var(--brass); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    min-height: 44px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 650;
    background: var(--ink);
    color: #f6f1e6;
    border-color: var(--ink);
}
.btn.secondary { background: transparent; color: var(--ink); }
.btn.danger { background: var(--red); border-color: var(--red); color: white; }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.filters { margin-bottom: 12px; align-items: end; }
.filters .control { min-width: 140px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #f3ecdf;
    color: var(--ink);
    white-space: nowrap;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }

.plate {
    display: inline-grid;
    min-width: 118px;
    background: white;
    border: 1px solid #d9d1c2;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(26, 36, 30, 0.06);
    line-height: 1;
}
.plate-top {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 8px 3px;
    color: white;
    background: #222;
}
.plate-dubai .plate-top { background: #111; }
.plate-abu_dhabi .plate-top { background: #9d1c2d; }
.plate-sharjah .plate-top { background: #0e6a3a; }
.plate-ajman .plate-top { background: #1d4e89; }
.plate-ras_al_khaima .plate-top { background: #7a1f3d; }
.plate-um_al_quwain .plate-top { background: #0f6b52; }
.plate-fujairah .plate-top { background: #8a5a00; }
.plate-other .plate-top { background: #555; }
.plate-num { padding: 7px 8px 8px; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; }
.plate-num b { margin-inline-end: 6px; }
.plate.lg .plate-num { font-size: 1.8rem; padding: 12px; }
.plate.lg .plate-top { font-size: 0.75rem; padding: 6px 12px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: min(100%, 220px); flex: 1; }
.field-label { font-weight: 650; }
.field-label i { color: var(--red); font-style: normal; }
.field small { color: var(--muted); }
.field-error { color: var(--red); font-size: 0.88rem; }
.form-grid { align-items: start; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
textarea.control { min-height: 90px; resize: vertical; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label, .choice { display: flex; gap: 8px; align-items: center; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.pick {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px;
    background: white;
}
.pick:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.flash { padding: 12px 14px; border-radius: 14px; background: var(--green-soft); color: var(--green); margin-bottom: 12px; }
.errors { padding: 12px 14px; border-radius: 14px; background: var(--red-soft); color: var(--red); margin-bottom: 12px; }

.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-family: var(--display); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 12px; }
.pager a, .pager span { text-decoration: none; padding: 6px 10px; border-radius: 999px; background: var(--paper-2); }

.result { border-inline-start: 6px solid var(--green); }
.result.warn { border-inline-start-color: var(--brass); }
.result.danger { border-inline-start-color: var(--red); }
.result.info { border-inline-start-color: var(--blue); }

.lane-switch button, .suggest button, .chip {
    border: 1px solid var(--line);
    background: white;
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 650;
}
.lane-switch button.on, .chip.on { background: var(--ink); color: white; border-color: var(--ink); }
.suggest button small { display: block; font-weight: 500; color: var(--muted); }
.cam-picks label { flex: 1 1 180px; }

.login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}
.login-story {
    padding: clamp(28px, 6vw, 72px);
    color: #f6f1e6;
    background:
        linear-gradient(160deg, rgba(18, 26, 22, 0.2), rgba(18, 26, 22, 0.72)),
        radial-gradient(600px 280px at 20% 20%, rgba(200, 146, 42, 0.45), transparent 60%),
        #121a16;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.login-story h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.02; max-width: 12ch; }
.login-story .lead { color: #e5dccb; font-size: 1.05rem; }
.login-points { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.login-points li { padding-inline-start: 14px; border-inline-start: 2px solid var(--brass); }
.login-panel { padding: clamp(22px, 4vw, 48px); display: flex; flex-direction: column; justify-content: center; }
.demo-grid { display: grid; gap: 8px; margin-top: 18px; }
.demo-grid button {
    text-align: start;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
}
.demo-grid strong { display: block; }
.demo-grid span { color: var(--muted); font-size: 0.88rem; }
.langs { display: flex; gap: 8px; margin-bottom: 18px; }

.tabbar, .scrim { display: none; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.86rem; word-break: break-all; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.print-page { max-width: 820px; margin: 0 auto; padding: 28px 18px 48px; }
.invoice-top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.invoice-top h1 { font-family: var(--display); margin: 0; }
.invoice table td { border-bottom: 1px solid var(--line); }
.watermark {
    display: inline-block;
    border: 2px solid var(--red);
    color: var(--red);
    font-weight: 800;
    letter-spacing: 0.14em;
    padding: 4px 8px;
    transform: rotate(-8deg);
}

@media (max-width: 960px) {
    .shell { display: block; }
    .sidebar {
        position: fixed;
        z-index: 40;
        inset-block: 0;
        inset-inline-start: 0;
        width: min(86vw, 320px);
        transform: translateX(-110%);
        transition: transform 0.2s ease;
        height: 100vh;
    }
    [dir="rtl"] .sidebar { transform: translateX(110%); }
    .sidebar.open { transform: none; }
    .scrim.show { display: block; position: fixed; inset: 0; background: rgba(18, 22, 18, 0.45); z-index: 30; }
    .icon-btn { display: inline-grid; place-items: center; }
    .content { padding: 8px 14px 96px; }
    .topbar { flex-wrap: wrap; row-gap: 8px; padding-inline: 14px; }
    .topbar > form { flex: 1 1 180px; min-width: 0; }
    .branch-select { max-width: none; width: 100%; }
    .top-meta { flex-wrap: wrap; justify-content: flex-end; }
    .tabbar {
        display: flex;
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        background: #fffdf8;
        border-top: 1px solid var(--line);
        z-index: 25;
        justify-content: space-between;
        padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    }
    .tabbar a {
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.2;
        color: var(--muted);
        text-align: center;
        flex: 1 1 0;
        min-width: 0;
        padding: 0 2px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .tabbar a.active { color: var(--ink); }
    .login { grid-template-columns: 1fr; }
    .login-story { min-height: auto; padding-bottom: 28px; }
    .login-story h1 { max-width: none; font-size: 2.3rem; }
    table.stack thead { display: none; }
    table.stack tr { display: block; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 6px 8px; background: white; }
    table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 7px 4px; }
    table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 650; }
}

@media print {
    .no-print { display: none !important; }
    body { background: white; }
    .print-page { padding: 0; }
}
