/* naql · التصميم المعتمد: نهاري (اقتراح ١: كحلي + عنبري) وليلي (اقتراح ٤)، بخط Cairo */

@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url(/fonts/cairo-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url(/fonts/cairo-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url(/fonts/cairo-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 800; font-display: swap; src: url(/fonts/cairo-arabic-800-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url(/fonts/cairo-latin-400-normal.woff2) format('woff2'); 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+2212,U+FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url(/fonts/cairo-latin-600-normal.woff2) format('woff2'); 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+2212,U+FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url(/fonts/cairo-latin-700-normal.woff2) format('woff2'); 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+2212,U+FEFF; }
@font-face { font-family: 'Cairo'; font-weight: 800; font-display: swap; src: url(/fonts/cairo-latin-800-normal.woff2) format('woff2'); 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+2212,U+FEFF; }

/* ---------- الألوان ---------- */
:root, :root[data-theme="day"] {
  color-scheme: light;
  --bg:#eef1f5; --surface:#ffffff; --surface2:#f5f7fa; --ink:#15212d; --muted:#5d6b7a; --line:#dce2e9;
  --accent:#c97a12; --on-accent:#1d1303; --nav-bg:#10202f; --nav-ink:#b9c6d3; --nav-active:#f0b048; --nav-hl:rgba(240,176,72,.12);
  --ok:#1d8656; --warn:#b8740b; --bad:#c2412d; --info:#2d6cb5; --draft:#6b7785;
  --r:10px; --br:8px; --ir:8px; --bh:40px; --card-sh:0 1px 2px rgba(16,32,47,.06); --overlay:rgba(16,32,47,.5);
  --top-bg:#ffffff; --brand-ink:#ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    color-scheme: dark;
    --bg:#111418; --surface:#1a1e24; --surface2:#21262e; --ink:#e6eaef; --muted:#8d97a3; --line:#2c333d;
    --accent:#f39a3d; --on-accent:#1a1006; --nav-bg:#0c0f12; --nav-ink:#97a1ad; --nav-active:#f39a3d; --nav-hl:rgba(243,154,61,.1);
    --ok:#43c38a; --warn:#e7b44b; --bad:#ef6b5b; --info:#6ea9ec; --draft:#8d97a3; --card-sh:none; --overlay:rgba(0,0,0,.6);
    --top-bg:#111418;
  }
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg:#111418; --surface:#1a1e24; --surface2:#21262e; --ink:#e6eaef; --muted:#8d97a3; --line:#2c333d;
  --accent:#f39a3d; --on-accent:#1a1006; --nav-bg:#0c0f12; --nav-ink:#97a1ad; --nav-active:#f39a3d; --nav-hl:rgba(243,154,61,.1);
  --ok:#43c38a; --warn:#e7b44b; --bad:#ef6b5b; --info:#6ea9ec; --draft:#8d97a3; --card-sh:none; --overlay:rgba(0,0,0,.6);
  --top-bg:#111418;
}

/* ---------- الأساس ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.6 'Cairo', system-ui, sans-serif; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3 { margin: 0; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: left; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- الهيكل ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.nav { background: var(--nav-bg); color: var(--nav-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.logo { width: 36px; height: 36px; border-radius: var(--br); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; overflow: hidden; font-weight: 800; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.brand b { display: block; font-size: 15px; color: var(--brand-ink); line-height: 1.3; }
.brand small { font-size: 11.5px; opacity: .75; }
.navsec { font-size: 11px; font-weight: 600; opacity: .65; padding: 12px 10px 4px; }
.nl { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--br); font-size: 14px; font-weight: 600; color: inherit; text-decoration: none; background: none; border: 0; width: 100%; text-align: start; cursor: pointer; }
.nl:hover { background: var(--nav-hl); }
.nl[aria-current="page"] { background: var(--nav-hl); color: var(--nav-active); font-weight: 700; }
.nl .bdg { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--br); background: var(--nav-hl); }
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); color: var(--ink); font-weight: 700; font-size: 13px; flex: none; }
.me b { display: block; font-size: 13px; color: var(--brand-ink); line-height: 1.3; }
.me small { font-size: 11.5px; opacity: .75; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 24px 14px; background: var(--top-bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 20px; }
.content { padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 16px; max-width: 1280px; width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.tb-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.tabbar { display: none; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="day"]) .tabbar { background: var(--nav-bg); } }
:root[data-theme="night"] .tabbar { background: var(--nav-bg); }

.sheet { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-end; z-index: 40; }
.sheet .pan { background: var(--surface); width: 100%; border-radius: 22px 22px 0 0; padding: 10px 16px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 2px; max-height: 85dvh; overflow: auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet .nl { color: var(--ink); padding: 13px 10px; }
.sheet .nl[aria-current="page"] { color: var(--accent); }
.sheet .me { margin-top: 10px; }
.sheet .me b { color: var(--ink); }

/* بطاقة الصافي */
.bal { background: var(--bal-bg); color: var(--bal-ink); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; border: var(--card-bd, 1px solid var(--line)); }
.bal .lbl { font-size: 13px; color: var(--bal-muted); font-weight: 500; }
.bal .big { font-size: 36px; font-weight: 800; color: var(--bal-num); line-height: 1.1; font-variant-numeric: tabular-nums; }
.bal .big small { font-size: 16px; font-weight: 600; margin-inline-start: 4px; }
.bal .eq { font-size: 12.5px; color: var(--bal-muted); }
.bal .trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border-top: 1px solid color-mix(in srgb, var(--bal-ink) 15%, transparent); padding-top: 14px; }
.bal .trio small { display: block; font-size: 12px; color: var(--bal-muted); }
.bal .trio b { font-size: 15px; font-variant-numeric: tabular-nums; }
.btn.big { height: 54px; font-size: 16px; width: 100%; }

/* ---------- مكوّنات ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--card-sh); padding: 16px; min-width: 0; }
.card > h3, .sect { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card > h3 .more { margin-inline-start: auto; font-size: 12.5px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--card-sh); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); min-height: 1.3em; }
.kpi.hot { border-color: var(--accent); }
.kpi.hot b { color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.sp { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--bh); padding: 0 16px; border-radius: var(--br); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.pri { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.pri:hover { filter: brightness(1.06); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn.block { width: 100%; height: 48px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--on-accent); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.f .hint { font-size: 12px; color: var(--muted); }
.inp { height: 44px; width: 100%; border: 1px solid var(--line); border-radius: var(--ir); background: var(--surface); padding: 0 12px; font-weight: 500; font-size: 15px; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 14px 19px, 19px 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 12px; padding-inline-start: 32px; }
.inp:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); border-color: var(--accent); }
.inp[readonly] { background: var(--surface2); }
.inp.sm { height: 34px; font-size: 13.5px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.pill.ok { --c: var(--ok); } .pill.warn { --c: var(--warn); } .pill.bad { --c: var(--bad); } .pill.info { --c: var(--info); } .pill.draft { --c: var(--draft); } .pill.acc { --c: var(--accent); }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--c, var(--info)) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--info)) 30%, transparent); font-size: 13.5px; line-height: 1.7; }
.note.warn { --c: var(--warn); } .note.bad { --c: var(--bad); } .note.ok { --c: var(--ok); } .note.draft { --c: var(--draft); }
.note .ic { color: var(--c, var(--info)); margin-top: 3px; }
.note b { display: block; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-child { border-top: 0; }
.item .t { font-weight: 700; }
.item .s { font-size: 12.5px; color: var(--muted); }
.item .acts { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-top: 1px solid var(--line); vertical-align: top; }
.tbl thead th { background: var(--surface2); color: var(--muted); font-size: 12px; font-weight: 600; border-top: 0; white-space: nowrap; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl tr.off td { opacity: .55; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.tabs button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface2), var(--line), var(--surface2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* مفتاح تبديل */
.toggle { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; flex: none; cursor: pointer; border: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset .15s; }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { inset-inline-start: 21px; }
.toggle[disabled] { opacity: .5; cursor: not-allowed; }

/* مصفوفة الصلاحيات */
.ck { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--surface); color: transparent; cursor: pointer; padding: 0; }
.ck[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- نوافذ ---------- */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 14px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: var(--overlay); }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.dlg-h { padding: 16px 18px 8px; display: flex; align-items: center; gap: 10px; }
.dlg-h h2 { font-size: 17px; flex: 1; }
.dlg-b { padding: 8px 18px 12px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-f { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); }
.secret { font-size: 40px; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: var(--r); background: var(--surface2); direction: ltr; user-select: all; word-break: break-all; }
.toasts { position: fixed; inset-inline: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 10px; font-weight: 600; max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- الدخول ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-brand .logo { width: 64px; height: 64px; border-radius: 16px; font-size: 26px; }
.auth-brand h1 { font-size: 22px; }
.pw { position: relative; }
.pw .inp { padding-inline-end: 64px; }
.pw button { position: absolute; inset-block: 0; inset-inline-end: 6px; background: none; border: 0; color: var(--muted); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 0 8px; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 1.2em; }

/* ---------- الجدول الزمني والتدقيق ---------- */
.code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; direction: ltr; unicode-bidi: plaintext; text-align: left; word-break: break-all; white-space: pre-wrap; background: var(--surface2); border-radius: 6px; padding: 8px 10px; }

/* تعديلات صغيرة */
a.kpi { text-decoration: none; color: inherit; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.skel.w1 { width: 90%; } .skel.w2 { width: 70%; } .skel.w3 { width: 50%; }
.month-pick { width: 180px; }
input[type=file].inp { padding: 8px 10px; }
.card > .row:not(:first-child), .card > .grid2 + .row { margin-top: 12px; }

.dev-credit { text-align: center; margin: 18px 0 6px; font-size: .8rem; color: var(--muted, #6b7280); }
.dev-credit a { color: inherit; text-decoration: none; font-weight: 600; }
.skel.boot { height: 44px; margin-top: 18px; }

/* ---- النقلات (الدفعة 2) — تنسيق مؤقت يُصقل في المرحلة الأخيرة ---- */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cols.master { grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); }
@media (max-width: 820px) { .cols, .cols.master { grid-template-columns: 1fr; } }
.row.between { justify-content: space-between; align-items: center; }
.ta-end { text-align: end; }
.s { font-size: .82rem; }
.est { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); }
.cap { display: flex; gap: 12px; align-items: center; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.mphoto { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); }
.mphoto-big { text-align: center; }
.mphoto-wrap { min-height: 120px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted, #6b7280); }
.kv dd { margin: 0; font-weight: 600; }
button.item.rowbtn { width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
button.item.rowbtn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ألوان بطاقة الصافي */
:root, :root[data-theme="day"] { --bal-bg: #10202f; --bal-ink: #e8eef4; --bal-num: #f0b048; --bal-muted: #93a4b5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="day"]) { --bal-bg: #1a1e24; --bal-ink: #e6eaef; --bal-num: #f39a3d; --bal-muted: #8d97a3; } }
:root[data-theme="night"] { --bal-bg: #1a1e24; --bal-ink: #e6eaef; --bal-num: #f39a3d; --bal-muted: #8d97a3; }

/* ---------- الهاتف: شريط تبويب سفلي بدل القائمة الجانبية ---------- */
@media (max-width: 860px) {
  .app { display: block; }
  .nav { display: none; }
  .topbar { padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; gap: 8px; background: var(--nav-bg); color: #fff; border-bottom-color: transparent; }
  .topbar h1 { font-size: 18px; }
  .topbar .chip { display: none; }
  .topbar .av { background: var(--nav-hl); color: #fff; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi b { font-size: 18px; }
  .content { padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px)); gap: 14px; }
  .tabbar { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(10px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; align-items: flex-end; }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 14px; text-decoration: none; background: none; border: 0; cursor: pointer; min-width: 0; white-space: nowrap; }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab.center .cc { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; margin-top: -26px; box-shadow: 0 6px 14px -6px var(--accent); }
  .tab.center { color: var(--ink); }
}

/* ---- لوحة المتابعة والكشوف ---- */
ul.plain { margin: 6px 0 0; padding-inline-start: 18px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 6px; }
.vbars i { flex: 1; min-width: 3px; background: color-mix(in srgb, var(--accent) 55%, var(--surface2)); border-radius: 3px 3px 0 0; display: block; }
.vbars i.today { background: var(--accent); }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hb { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.hb .tr { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.hb .tr i { display: block; height: 100%; background: var(--accent); }
.paper h2 { font-size: 20px; }
@media print {
  .nav, .topbar, .tabbar, .noprint, .sheet, .toast { display: none !important; }
  .app, .content { display: block !important; padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .paper { border: 0 !important; box-shadow: none !important; }
  .bal { background: #fff !important; color: #000 !important; border: 2px solid #000 !important; }
  .bal .big, .bal .lbl, .bal .eq, .bal .trio small { color: #000 !important; }
}
