/*
 * Ribat al-Masjid — super-admin portal theme.
 * Standalone (no AdminLTE / Bootstrap). Tokens mirror the Android app's
 * ui/theme/Color.kt so the portal and the app read as one product.
 */

:root {
    --primary: #0b7a5c;
    --primary-dark: #075c45;
    --primary-deep: #0b4f3e;
    --primary-soft: #e2f3ec;
    --brand-bg: #0b3d35;
    --sidebar: #0c3a2d;
    --sidebar-active: #1b5a47;
    --sidebar-text: #c3dfd3;
    --sidebar-muted: #8fbcaa;
    --mint: #a7e3cc;
    --gold: #f5b23d;

    --ink: #0f172a;
    --ink-2: #344054;
    --muted: #475467;
    --muted-2: #667085;
    --line: #eaecf0;
    --line-2: #f2f4f7;
    --field: #d0d5dd;
    --canvas: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;

    --ok-bg: #ecfdf3;   --ok: #067647;
    --warn-bg: #fffaeb; --warn: #b54708;
    --bad-bg: #fef3f2;  --bad: #b42318;
    --bad-line: #fda29b;

    /* Prayer tints (Android FajrTint/FajrInk etc.) */
    --fajr-bg: #e9edff;    --fajr: #3341a8;
    --jumuah-bg: #fff3d1;  --jumuah: #8a5a00;
    --asr-bg: #ffe9dc;     --asr: #a8461a;
    --maghrib-bg: #ffe4ea; --maghrib: #a8304f;
    --isha-bg: #ece8fb;    --isha: #4b3a9c;

    /* Chart series (validated categorical order) */
    --s1: #0b7a5c; --s2: #c97a10; --s3: #3b6fd4; --s4: #c2477a;

    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-arabic: 'Amiri', 'Traditional Arabic', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--canvas);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.2px; }
p { margin: 0; }
code { font-size: 12px; color: var(--muted-2); background: var(--line-2); padding: 1px 6px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(11, 122, 92, .35); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
[dir="rtl"], .arabic { font-family: var(--font-arabic); }

/* ---------- Shell ---------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 256px; flex: none; background: var(--sidebar); color: var(--sidebar-text);
    display: flex; flex-direction: column; gap: 22px; padding: 20px 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-bg); box-shadow: inset 0 0 0 1px #2a6b58; flex: none; }
.brand strong { display: block; font-size: 15px; font-weight: 800; }
.brand small { display: block; font-size: 12px; color: var(--mint); }
.nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { padding: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-link {
    display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px;
    border-radius: 10px; color: var(--sidebar-text); font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; font-weight: 700; }
.nav-link span { flex: 1; }
.nav-badge { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #2b1d02; font-size: 12px; font-weight: 700; text-align: center; }
.sidebar-note { display: flex; gap: 10px; border-radius: 12px; background: #124a3a; padding: 12px 14px; font-size: 13px; }
.sidebar-note strong { color: #fff; display: block; }
.sidebar-note span { color: #b5d6c9; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #1d5847; margin-top: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex: none; font-weight: 700; }
.sidebar-user strong { color: #fff; font-size: 14px; display: block; }
.sidebar-user small { color: #9cc7b6; font-size: 12px; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: #b5d6c9; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sidebar-user button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px; padding: 14px 32px;
    background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { display: none; }
.global-search { flex: 1 1 280px; max-width: 480px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; background: var(--surface-2); color: var(--muted-2); }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; font-weight: 600; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn .dot { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; border: 2px solid #fff; box-sizing: content-box; }

.content { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 1480px; }

/* ---------- Page header ---------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.crumbs { font-size: 13px; color: var(--muted-2); margin-bottom: 6px; }
.crumbs a { color: var(--muted-2); }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.page-head h1 { font-size: 26px; line-height: 34px; font-weight: 800; letter-spacing: -0.4px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { margin-top: 6px; font-size: 14px; color: var(--muted); max-width: 760px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Buttons -------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--field);
    background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

/* ---------- Cards ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px; }
.card-head h2, .card h2 { font-size: 16px; font-weight: 700; }
.card-head p, .card .hint { margin-top: 4px; font-size: 13px; color: var(--muted); }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.card-title-icon { display: flex; align-items: center; gap: 10px; }
.tint { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tint-primary { background: var(--primary-soft); color: var(--primary-dark); }
.tint-fajr { background: var(--fajr-bg); color: var(--fajr); }
.tint-jumuah { background: var(--jumuah-bg); color: var(--jumuah); }
.tint-asr { background: var(--asr-bg); color: var(--asr); }
.tint-maghrib { background: var(--maghrib-bg); color: var(--maghrib); }
.tint-isha { background: var(--isha-bg); color: var(--isha); }
.tint-ok { background: var(--ok-bg); color: var(--ok); }
.tint-warn { background: var(--warn-bg); color: var(--warn); }
.tint-bad { background: var(--bad-bg); color: var(--bad); }
.tint-neutral { background: var(--line-2); color: var(--ink-2); }

/* ---------- Grids ---------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .primary-col { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split > .side-col { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.pre { white-space: pre-wrap; }

/* ---------- KPI tiles ------------------------------------------------ */
.kpi { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 28px; line-height: 32px; font-weight: 800; letter-spacing: -0.5px; }
.kpi-sub { font-size: 12px; color: var(--muted-2); }
.kpi svg.spark { width: 100%; height: 28px; }
.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.delta-up { background: var(--ok-bg); color: var(--ok); }
.delta-down { background: var(--bad-bg); color: var(--bad); }
.delta-flat { background: var(--line-2); color: var(--muted); }

/* ---------- Badges / pills ------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge .icon { width: 14px; height: 14px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-gold { background: var(--jumuah-bg); color: var(--jumuah); }
.badge-fajr { background: var(--fajr-bg); color: var(--fajr); }
.badge-isha { background: var(--isha-bg); color: var(--isha); }
.badge-maghrib { background: var(--maghrib-bg); color: var(--maghrib); }
.badge-asr { background: var(--asr-bg); color: var(--asr); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Tabs / chips / segmented -------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; color: var(--muted); font-weight: 600; box-shadow: inset 0 -2px 0 transparent; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.count { padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--line-2); color: var(--muted); }
.tab.is-active .count { background: var(--primary-soft); color: var(--primary-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--field); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.chip:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .icon { width: 18px; height: 18px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.segmented a, .segmented button { min-width: 56px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 0; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); background: transparent; cursor: pointer; }
.segmented a:hover { text-decoration: none; background: var(--surface-2); }
.segmented .is-active, .segmented .is-active:hover { background: var(--primary); color: #fff; }

/* ---------- Toolbar & forms ----------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; }
.search-field { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; color: var(--muted-2); background: var(--surface); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-weight: 400; color: var(--muted-2); font-size: 12px; }
.input, .select, .textarea {
    width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px;
    background: var(--surface); font-size: 14px; font-weight: 400; color: var(--ink);
}
.select { padding: 0 10px; }
.textarea { height: auto; padding: 10px 12px; line-height: 22px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,122,92,.15); }
.input-sm, .select-sm { height: 40px; }
.textarea.arabic { font-size: 26px; line-height: 1.8; color: var(--brand-bg); text-align: right; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 16px; }
.is-invalid { border-color: var(--bad) !important; }
.error-text { color: var(--bad); font-size: 12px; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Switch (checkbox styled as a toggle) */
.switch { position: relative; display: inline-flex; flex: none; width: 48px; height: 28px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--field); transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(16,24,40,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid rgba(11,122,92,.35); outline-offset: 2px; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--line-2); }
.setting-row:first-child { border-top: 0; }
.setting-row .label { flex: 1 1 320px; }
.setting-row .label strong { display: block; font-size: 14px; }
.setting-row .label p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Radio cards */
.radio-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-card { flex: 1 1 160px; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card .icon { color: var(--primary); }
.radio-card:has(input:checked) { border-color: var(--primary); background: #f0f9f5; }
.radio-card:has(input:focus-visible) { outline: 3px solid rgba(11,122,92,.35); }

/* ---------- Tables --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 10px 12px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table th.right { text-align: right; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tr:hover td { background: #fcfcfd; }
.table tr.is-selected td { background: #f0f9f5; }
.table .name { font-weight: 700; color: var(--ink); }
.table .name:hover { color: var(--primary); }
.table .meta { color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.cell-main { display: flex; align-items: center; gap: 12px; }
.table-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Lists ---------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--line-2); color: var(--ink); }
.list-row:first-child { border-top: 0; }
a.list-row:hover { text-decoration: none; background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 2px 0; }
.kv span { color: var(--muted); }
dl.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; font-size: 13px; }
dl.details dt { color: var(--muted-2); }
dl.details dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
dl.details .span-all { grid-column: 1 / -1; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.timeline li { display: flex; gap: 12px; font-size: 13px; }
.timeline .dot { margin-top: 6px; }

/* ---------- Progress & bars ------------------------------------------ */
.bar-track { height: 10px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.bar-track.thin { height: 8px; }
.seg-bar { display: flex; gap: 2px; height: 14px; }
.seg-bar > div { border-radius: 0; }
.seg-bar > div:first-child { border-radius: 4px 0 0 4px; }
.seg-bar > div:last-child { border-radius: 0 4px 4px 0; }
.hbar { display: grid; grid-template-columns: 96px 1fr 56px; align-items: center; gap: 10px; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 3px; width: 14px; border-radius: 2px; vertical-align: 3px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed #98a2b3; border-radius: 0; vertical-align: 3px; }

/* ---------- Charts --------------------------------------------------- */
.chart { position: relative; }
.chart-body { display: flex; gap: 10px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 240px; font-size: 11px; color: var(--muted-2); text-align: right; width: 40px; flex: none; }
.chart-y span { line-height: 0; }
.chart-plot { position: relative; flex: 1; min-width: 0; height: 240px; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid div { border-top: 1px solid var(--line-2); }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-x { display: flex; justify-content: space-between; margin: 8px 0 0 50px; font-size: 11px; color: var(--muted-2); }
.chart-hit { position: absolute; inset: 0; display: flex; }
.chart-hit div { flex: 1; height: 100%; }
.chart-cross { position: absolute; top: 0; bottom: 0; border-left: 1px solid #98a2b3; pointer-events: none; display: none; }
.chart-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--primary); pointer-events: none; display: none; }
.tooltip { position: absolute; z-index: 5; top: 8px; min-width: 160px; background: #101828; color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 12px; pointer-events: none; box-shadow: 0 8px 24px rgba(16,24,40,.18); display: none; white-space: nowrap; }
.tooltip strong { display: block; margin-bottom: 4px; }
.tooltip .kv span { color: #d0d5dd; }
.tooltip .kv { color: #fff; font-size: 12px; }
.vbars { position: relative; display: flex; align-items: flex-end; gap: 10px; height: 180px; border-bottom: 1px solid var(--line); }
.vbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.vbar .val { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.vbar .fill { width: 100%; max-width: 44px; border-radius: 4px 4px 0 0; background: var(--primary); min-height: 2px; }
.vbar:hover .fill { background: var(--primary-dark); }
.vbars-x { display: flex; gap: 10px; margin-top: 8px; }
.vbars-x span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.insight { font-size: 13px; color: var(--ink-2); background: #fdf6e7; border-radius: 10px; padding: 10px 12px; }
.insight strong { color: #7a4a06; }
.insight.green { background: #f0f9f5; }
.insight.green strong { color: var(--primary-dark); }
.stat-inline { display: flex; flex-wrap: wrap; gap: 28px; }
.stat-inline .lbl { font-size: 12px; color: var(--muted-2); }
.stat-inline .num { font-size: 20px; font-weight: 800; }

/* ---------- Moderation cards ---------------------------------------- */
.mod-item { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.mod-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.mod-meta .age { margin-left: auto; color: var(--muted-2); }
.mod-item h3 { font-size: 15px; font-weight: 700; }
.mod-item .body { font-size: 14px; line-height: 21px; color: var(--muted); }
.mod-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mod-actions .info { flex: 1 1 200px; font-size: 12px; color: var(--muted-2); }
details.reject { position: relative; }
details.reject summary { list-style: none; }
details.reject summary::-webkit-details-marker { display: none; }
details.reject .pop { position: absolute; right: 0; top: 46px; z-index: 10; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.14); display: flex; flex-direction: column; gap: 8px; }

/* ---------- Flash / alerts / empty ----------------------------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-bad { background: var(--maghrib-bg); color: var(--maghrib); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert ul { margin: 0; padding-left: 18px; }
.alert .close { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .tint { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 10px; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Pagination ----------------------------------------------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--field); background: #fff; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.pager a:hover { text-decoration: none; background: var(--surface-2); }
.pager .is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .is-disabled { opacity: .45; }

/* ---------- Misc components ------------------------------------------ */
.map-box { height: 140px; background: var(--primary-soft); position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.map-box svg.grid-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-box .pin { position: absolute; left: 50%; top: 30px; transform: translateX(-50%); width: 44px; height: 44px; fill: var(--primary); stroke: #fff; stroke-width: 1; }
.map-box .coords { position: absolute; right: 10px; bottom: 10px; font-size: 11px; font-weight: 700; background: #fff; color: var(--ink-2); padding: 3px 8px; border-radius: 6px; }
.times { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; text-align: center; }
.times > div { border-radius: 10px; padding: 10px 4px; }
.times .n { font-size: 12px; font-weight: 600; }
.times .v { font-size: 14px; font-weight: 800; margin-top: 2px; color: var(--ink); }
.arabic-box { margin: 0; padding: 18px; border-radius: 12px; background: #f6faf8; font-family: var(--font-arabic); font-size: 28px; line-height: 1.9; color: var(--brand-bg); text-align: right; white-space: pre-wrap; }
.phone { width: 100%; max-width: 340px; align-self: center; border-radius: 28px; border: 8px solid #0f172a; background: var(--canvas); overflow: hidden; }
.phone-bar { background: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.phone-card { margin: 14px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist .row { font-size: 13px; align-items: flex-start; }
.checklist .row > span:nth-child(2) { flex: 1; min-width: 0; padding-top: 2px; }
.checklist .row .xs { max-width: 45%; text-align: right; padding-top: 3px; }
.checklist .tick { width: 22px; height: 22px; border-radius: 6px; }
.checklist .tick .icon { width: 14px; height: 14px; }
.save-bar { position: sticky; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: #101828; color: #fff; box-shadow: 0 12px 32px rgba(16,24,40,.24); }
.save-bar span { flex: 1; }
.save-bar .btn { height: 40px; }
.save-bar .btn-ghost { color: #fff; border-color: #475467; }
.save-bar .btn-gold { background: var(--gold); border-color: var(--gold); color: #2b1d02; }

/* ---------- Login ---------------------------------------------------- */
.login { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-brand { flex: 1 1 420px; background: var(--brand-bg); color: #e6f5ef; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-brand .ayah { font-family: var(--font-arabic); font-size: 34px; line-height: 1.7; color: #fff; text-align: right; margin: 0 0 16px; }
.login-brand .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 480px; }
.login-brand .stats strong { display: block; font-size: 22px; font-weight: 800; color: #fff; }
.login-brand .stats span { font-size: 12px; color: var(--mint); }
.login-form { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-form form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.with-icon { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px; border: 1px solid var(--field); border-radius: 12px; background: #fff; color: var(--muted-2); }
.with-icon:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,122,92,.15); }
.with-icon input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 15px; background: transparent; color: var(--ink); height: 100%; }
.with-icon button { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---------- Responsive ----------------------------------------------- */
@media (max-width: 1100px) {
    .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
    .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; visibility: hidden; }
    .app.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
    .topbar .menu-btn { display: inline-flex; }
    .topbar { padding: 12px 16px; }
    .content { padding: 20px 16px 48px; }
    .topbar-pill { display: none; }
}
@media (max-width: 640px) {
    .login-brand { padding: 32px 24px; }
    .page-head h1 { font-size: 22px; }
    dl.details { grid-template-columns: minmax(0, 1fr); }
    .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; }
    .kpi-value { font-size: 22px; }
    .kpi-label .tint { display: none; }
    .global-search { flex-basis: 120px; }
}

/* ---------- Services (per-service pages) -------------------------------- */
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 4px 0 8px 23px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.14); }
.nav-sub-title { padding: 8px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-sub a { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13px; color: var(--sidebar-text); opacity: .86; }
.nav-sub a:hover { background: rgba(255,255,255,.06); color: #fff; opacity: 1; text-decoration: none; }
.nav-sub a.is-active { background: rgba(255,255,255,.1); color: #fff; font-weight: 700; opacity: 1; }
.svc-head { display: flex; align-items: center; gap: 14px; }
.svc-logo { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.svc-logo .icon { width: 26px; height: 26px; }
.svc-nav { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 18px; border-bottom: 1px solid var(--line); }
.svc-nav-group { display: flex; align-items: center; gap: 2px; }
.svc-nav-label { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted-2); padding-right: 6px; }
.svc-nav-group + .svc-nav-group { padding-left: 18px; border-left: 1px solid var(--line-2); }
.svc-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.svc-card:hover { text-decoration: none; box-shadow: 0 8px 24px rgba(16,24,40,.08); }
.svc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.source-card { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.svc-nav .tab { padding: 0 12px; }
@media (max-width: 720px) { .svc-nav { flex-wrap: nowrap; overflow-x: auto; } .svc-nav-group { flex: none; } }
