@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-sans-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-sans-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-sans-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-arabic-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-arabic-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: "Najd";
    src: url("/fonts/plex-arabic-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
    --ink: #1c1915;
    --muted: #6d6458;
    --line: #e3d9c8;
    --paper: #f6f1e7;
    --card: #fffdf8;
    --green: #0f3d32;
    --green-2: #1d6b56;
    --gold: #b8893d;
    --danger: #8d2f2f;
    --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
    --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Najd", "IBM Plex Sans", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-size: 15px;
    line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar);
    background: var(--green);
    color: #f4efe4;
    display: flex;
    flex-direction: column;
    z-index: 20;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 18px 16px 12px;
}
.mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f4efe4;
    color: var(--green);
    display: grid;
    place-items: center;
    font-weight: 600;
    flex: none;
}
.brand strong { display: block; font-size: 15px; letter-spacing: 0; }
.brand span { display: block; color: #d7c7a4; font-size: 12px; }
.nav {
    overflow: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav a {
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    color: #efe7d8;
    font-size: 14px;
}
.nav a:hover, .nav a.active { background: rgba(255, 253, 248, 0.12); }
.side-foot { padding: 12px 16px 16px; color: #d7c7a4; font-size: 12px; }

.shell { margin-inline-start: var(--sidebar); min-height: 100vh; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 241, 231, 0.92);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .who { display: flex; flex-direction: column; }
.topbar .who small, .muted { color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 22px; max-width: 1180px; }

.nav-toggle { display: none; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 18px; margin: 0 0 10px; font-weight: 600; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 68ch; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi, .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.kpi { padding: 14px 16px; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi strong { display: block; font-size: 22px; margin-top: 4px; font-weight: 600; }
.card { padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }

.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.02em; }
.num, td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    background: #efe7d8;
    color: #3d3428;
    white-space: nowrap;
}
.st-posted, .st-approved, .st-paid, .st-pass, .st-completed, .st-reconciled, .st-active, .st-available { background: #e5f2ec; color: #0f3d32; }
.st-pending, .st-pending_approval, .st-partial, .st-quarantine, .st-draft, .st-open { background: #f8efd8; color: #6d4e12; }
.st-rejected, .st-fail, .st-overdue, .st-blocked { background: #f8e4e1; color: var(--danger); }

.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid var(--green);
    background: var(--green);
    color: #f6f1e7;
    text-decoration: none;
    padding: 8px 14px;
    cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--green); }
.btn.danger { background: transparent; color: var(--danger); border-color: #e4c2bc; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
}
textarea { min-height: 74px; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.line { display: grid; grid-template-columns: 2fr 1fr 1fr 0.7fr 0.7fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.flash.ok { background: #e5f2ec; }
.flash.bad { background: #f8e4e1; }
.errors { color: var(--danger); margin: 0 0 12px; padding-inline-start: 18px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars div { flex: 1; background: #d7ebe3; border-radius: 8px 8px 2px 2px; min-height: 4px; position: relative; }
.bars span { position: absolute; inset-inline: 0; top: -18px; text-align: center; font-size: 10px; color: var(--muted); }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.login-story { background: var(--green); color: #f6f1e7; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-story h1 { font-size: 42px; max-width: 14ch; }
.login-panel { padding: 48px 36px; display: flex; flex-direction: column; justify-content: center; }
.account-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.account-picks button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.note { font-size: 13px; color: var(--muted); }

.invoice { max-width: 860px; margin: 0 auto; background: white; border: 1px solid var(--line); padding: 28px; }
.invoice-top { display: flex; justify-content: space-between; gap: 16px; }
.qr { width: 140px; height: 140px; }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 16px; }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .shell { margin: 0; }
    .content { padding: 0; max-width: none; }
    body { background: white; }
    .invoice { border: 0; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-105%); transition: transform 0.2s ease; }
    [dir="rtl"] .sidebar { transform: translateX(105%); }
    body.nav-open .sidebar { transform: none; }
    .shell { margin-inline-start: 0; }
    .nav-toggle { display: inline-flex; }
    .kpis, .grid-2, .grid-3, .fields, .login-wrap { grid-template-columns: 1fr; }
    .line { grid-template-columns: 1fr 1fr; }
    .login-story { padding: 28px; }
    .login-story h1 { font-size: 32px; }
    .content { padding: 16px; }
}
