/* ============================================================
   SchoolERP — premium design system
   Indigo SaaS theme matching the product mockups.
   ============================================================ */

:root {
    --primary: #5b5fef;
    --primary-dark: #4a3fe0;
    --primary-light: #ececfd;
    --primary-soft: #f3f3ff;

    --sidebar-bg: #0d1437;
    --sidebar-bg-2: #0a1030;
    --sidebar-active: #5b5fef;
    --sidebar-text: #a3aed0;

    --bg: #f4f7fe;
    --card: #ffffff;
    --border: #e6edf5;
    --border-soft: #eef2f9;

    --text: #1b2559;
    --text-muted: #8f9bba;

    --green: #05cd99;
    --green-soft: #e6faf5;
    --red: #ee5d50;
    --red-soft: #fdeceb;
    --amber: #ffb547;
    --amber-soft: #fff6e6;
    --blue: #4318ff;
    --blue-soft: #ece9ff;
    --teal: #2bc4c4;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    --shadow-sm: 0 6px 18px rgba(112, 144, 176, 0.10);
    --sidebar-w: 260px;
    --topbar-h: 78px;

    --surface-2: #fbfcfe;
    --track: #eef1f6;
    --teal-soft: #e3f8f8;
    --font: 'Cairo', 'Segoe UI', 'Inter', 'Tahoma', system-ui, -apple-system, sans-serif;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1020;
    --card: #141b2e;
    --surface-2: #0f1626;
    --border: #28324c;
    --border-soft: #1e2740;

    --text: #e6e9f5;
    --text-muted: #8b94b4;

    --track: #26304a;
    --primary-light: #29234f;
    --primary-soft: #1d2442;
    --green-soft: #103226;
    --red-soft: #3a1a18;
    --amber-soft: #3a2e12;
    --blue-soft: #181d3e;
    --teal-soft: #0e3232;

    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    background: var(--bg); color: var(--text);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 700; }
p { margin: 0; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0;
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .25s ease;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 18px; }
.sidebar__logo {
    width: 42px; height: 42px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
    background: linear-gradient(135deg, #ffd86b, #f7b733);
    display: grid; place-items: center; color: #0d1437; font-weight: 800; font-size: 18px;
    box-shadow: 0 6px 16px rgba(247, 183, 51, .35);
}
.sidebar__logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar__title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar__subtitle { color: var(--sidebar-text); font-size: 11px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }

.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px; margin: 3px 0; border-radius: 12px;
    color: var(--sidebar-text); font-weight: 500; font-size: 13.5px;
    cursor: pointer; transition: all .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.45); }
.nav-item .nav-icon { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav-item .nav-chevron { margin-inline-start: auto; opacity: .5; }

/* Sidebar group headers: a clickable row that collapses/expands its section. */
.nav-section__label {
    width: 100%; background: none; border: 0; font-family: inherit;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 14px 14px 6px; margin-top: 2px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--sidebar-text); opacity: .5; white-space: nowrap;
    cursor: pointer; user-select: none; transition: opacity .15s ease;
}
.nav-section__label:hover { opacity: .92; }
.sidebar__nav > .nav-section__label:first-child { padding-top: 4px; }
/* Arabic is cursive — letter-spacing would split the joined glyphs, so drop it in RTL. */
[dir="rtl"] .nav-section__label { letter-spacing: normal; text-transform: none; }
.nav-section__chev { width: 13px; height: 13px; flex: none; opacity: .7; transition: transform .2s ease; }
.nav-section__label.is-open .nav-section__chev { transform: rotate(180deg); }

/* ---------- Menu Designer board ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.menu-col { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.menu-col__head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 4px 6px 9px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-muted);
}
[dir="rtl"] .menu-col__head { letter-spacing: normal; text-transform: none; }
.menu-col__tools { display: flex; gap: 2px; }
.menu-zone { min-height: 46px; display: flex; flex-direction: column; gap: 6px; border-radius: 10px; }
.menu-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
    background: var(--bg); border: 1px solid var(--border); cursor: grab; font-size: 13.5px;
    color: var(--text); user-select: none;
}
.menu-item:hover { border-color: var(--primary); }
.menu-item.is-hidden { opacity: .5; }
.menu-item__grip { color: var(--text-muted); display: inline-flex; }
.menu-item__icon { width: 20px; height: 20px; display: inline-flex; align-items: center; color: var(--text-muted); flex: none; }
.menu-item__label { flex: 1; min-width: 0; }
.menu-iconbtn { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 3px; border-radius: 6px; display: inline-flex; line-height: 0; }
.menu-iconbtn:hover:not(:disabled) { background: var(--card); color: var(--text); }
.menu-iconbtn:disabled { opacity: .3; cursor: default; }

/* ---------- Print Designer: live preview ---------- */
.print-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .print-grid { grid-template-columns: 1fr; } }
.pp-wrap { position: sticky; top: 90px; }
.pp-page {
    background: #fff; color: #1b2559; border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 10px 30px rgba(20,30,80,.10); padding: 22px; position: relative; overflow: hidden;
    width: 100%; min-height: 440px;
}
.pp-page.landscape { min-height: 300px; }
.pp-wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; font-weight: 800; transform: rotate(-30deg); pointer-events: none; }
.pp-bg-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 55%; max-width: 220px; object-fit: contain; pointer-events: none; }
.pp-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid; padding-bottom: 8px; margin-bottom: 14px; position: relative; z-index: 1; }
.pp-logo { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.pp-logo--ph { width: 46px; height: 46px; border-radius: 8px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: 13px; }
.pp-name { font-size: 16px; font-weight: 700; }
.pp-sub { font-size: 11px; color: #6b7390; }
.pp-body { position: relative; z-index: 1; }
.pp-body h4 { font-size: 13px; margin: 0 0 8px; }
.pp-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.pp-table th, .pp-table td { border: 1px solid #e0e4ee; padding: 4px 6px; text-align: start; }
.pp-table th { background: #f4f7fe; }
.pp-foot { border-top: 1px solid #d7dcea; margin-top: 16px; padding-top: 7px; position: relative; z-index: 1; }
.pp-sign { display: flex; gap: 18px; margin: 18px 4px 10px; }
.pp-sign__cell { flex: 1; text-align: center; }
.pp-sign__line { border-top: 1px solid #333; margin-bottom: 4px; }
.pp-sign__cell span { font-size: 10px; }
.pp-foot-row { display: flex; justify-content: space-between; gap: 8px; font-size: 9.5px; color: #6b7390; }

/* ---------- Global print (driven by the Print Designer template) ---------- */
.print-only { display: none; }

@media print {
    .sidebar, .nav-backdrop, .topbar, .help-card, .sidebar__footer, #blazor-error-ui, .no-print { display: none !important; }
    /* Hide interactive chrome (buttons, toolbars, pagination, overlays) so any screen prints clean. */
    button:not(.keep-print), .icon-btn, .mud-button-root, .mud-icon-button, .mud-fab,
    .mud-table-pagination, .mud-table-toolbar, .mud-toolbar, .mud-tabs-toolbar,
    .mud-snackbar, .mud-overlay, .mud-popover { display: none !important; }
    .app-shell { display: block !important; }
    .main { margin: 0 !important; display: block !important; }
    html, body, .app-shell, .main, .content { background: #fff !important; }
    .content { padding: 0 !important; }
    .print-only { display: block !important; }
    /* Unclip scrollable areas so every loaded row prints, not just what's on screen. */
    .content, .table-card, .mud-table-container, .mud-table, .table-responsive { max-height: none !important; overflow: visible !important; }

    .print-header {
        display: flex !important; align-items: center; gap: 14px; background: #fff;
        border-bottom: 2px solid var(--print-accent, #5b5fef); padding-bottom: 8px; margin-bottom: 16px;
    }
    /* Fixed variant: the letterhead/footer sit in the reserved page margins and repeat every page. */
    .print-header.print-fixed, .print-footer.print-fixed {
        position: fixed; left: 0; right: 0; margin: 0 !important; background: #fff; z-index: 5;
    }
    .print-header.print-fixed { top: 0; }
    .print-footer.print-fixed { bottom: 0; border-top: 1px solid #cfd4e0; margin-top: 0 !important; }
    .print-logo { max-height: 42px; max-width: 120px; object-fit: contain; }
    .print-bg-logo {
        display: block !important; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
        width: 60%; max-width: 380px; object-fit: contain; pointer-events: none; z-index: 0;
    }
    .print-h-name { font-size: 18px; font-weight: 700; color: #111; }
    .print-h-sub { font-size: 11.5px; color: #555; }

    .print-footer { display: block !important; border-top: 1px solid #cfd4e0; margin-top: 20px; padding-top: 8px; }
    .print-foot-row { display: flex; justify-content: space-between; gap: 12px; font-size: 10.5px; color: #666; }
    .print-sign { display: flex; gap: 32px; margin: 28px 6px 14px; }
    .print-sign__cell { flex: 1; text-align: center; }
    .print-sign__line { border-top: 1px solid #333; margin-bottom: 5px; }
    .print-sign__cell span { font-size: 11px; color: #333; }

    .print-watermark {
        display: flex !important; position: fixed; inset: 0; align-items: center; justify-content: center;
        font-size: 96px; font-weight: 800; letter-spacing: 4px; transform: rotate(-32deg);
        color: var(--print-accent, #5b5fef); pointer-events: none; z-index: 0;
    }

    .card, .table-card, .mud-paper, .mud-card { box-shadow: none !important; border: 1px solid #e0e4ee !important; }
    .table th, .table td, table th, table td { border: 1px solid #e0e4ee !important; }
    /* Repeat table headers on every page; keep rows, cards and images from splitting across pages. */
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr, img, .card, .report-card, .stat, .kpi-card, .mud-card { break-inside: avoid; }
    h1, h2, h3, h4 { break-after: avoid; }
    a[href]::after { content: "" !important; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    /* Single-voucher print: AppPrint.voucher() lifts #voucher-print to <body> and flags it here,
       so everything else is hidden and only the voucher prints (one clean page). */
    body.printing-voucher > *:not(#voucher-print) { display: none !important; }
    body.printing-voucher #voucher-print { display: block !important; }
}

.sidebar__footer { padding: 14px 18px 22px; }

/* ---------- Printable voucher — redesigned ---------- */
.vp { display: none; }
.vp {
    color: #111; background: #fff; direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    max-width: 200mm; margin: 0 auto; overflow: hidden;
}

/* accent colour bands top + bottom */
.vp-band { height: 8px; }
.vp-band.accent-in       { background: linear-gradient(90deg, #0a7d34, #16a34a); }
.vp-band.accent-out      { background: linear-gradient(90deg, #c0392b, #e05252); }
.vp-band.accent-transfer { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.vp-band.accent-closing  { background: linear-gradient(90deg, #0e7490, #0891b2); }

/* header: logo+company left | badge right */
.vp-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px 12px; border-bottom: 1.5px solid #e0e0e0;
}
.vp-company { display: flex; align-items: center; gap: 12px; }
.vp-logo { max-height: 54px; max-width: 160px; object-fit: contain; }
.vp-company-name { font-size: 22px; font-weight: 800; color: #111; }
.vp-company-sub  { font-size: 11.5px; color: #6b7280; margin-top: 2px; }

.vp-badge-wrap { text-align: center; }
.vp-type-badge {
    display: inline-block; font-size: 18px; font-weight: 800;
    padding: 6px 26px; border-radius: 50px; color: #fff; letter-spacing: .5px;
}
.vp-type-badge.accent-in       { background: linear-gradient(135deg, #0a7d34, #16a34a); }
.vp-type-badge.accent-out      { background: linear-gradient(135deg, #c0392b, #e05252); }
.vp-type-badge.accent-transfer { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.vp-type-badge.accent-closing  { background: linear-gradient(135deg, #0e7490, #0891b2); }
.vp-num { margin-top: 6px; font-size: 13px; font-weight: 700; color: #444; letter-spacing: .5px; }

/* info grid */
.vp-info-grid { padding: 0 18px; margin: 14px 0 6px; }
.vp-info-row  { display: flex; gap: 0; border-bottom: 1px solid #e8eaf0; }
.vp-info-cell {
    flex: 1; display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; padding: 9px 12px; border-inline-end: 1px solid #e8eaf0; font-size: 13.5px;
}
.vp-info-cell:last-child { border-inline-end: none; }
.vp-info-wide { flex: 2; }
.vp-label { color: #6b7280; font-weight: 600; white-space: nowrap; }
.vp-value  { font-weight: 700; color: #111; text-align: start; }

/* amount block */
.vp-amounts { padding: 10px 18px 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.vp-amt {
    flex: 1; min-width: 160px; border-radius: 14px; padding: 14px 20px;
    position: relative; overflow: hidden;
}
.vp-amt.accent-in       { background: #f0fdf4; border: 1.5px solid #16a34a; }
.vp-amt.accent-out      { background: #fff5f5; border: 1.5px solid #e05252; }
.vp-amt.accent-transfer { background: #f5f3ff; border: 1.5px solid #818cf8; }
.vp-amt-cur   { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.vp-amt-num   { font-size: 30px; font-weight: 900; color: #111; line-height: 1.1; }
.vp-amt.accent-in  .vp-amt-num { color: #0a7d34; }
.vp-amt.accent-out .vp-amt-num { color: #c0392b; }
.vp-amt.accent-transfer .vp-amt-num { color: #4f46e5; }
.vp-amt-words { font-size: 12.5px; color: #444; margin-top: 6px; font-style: italic; }

/* description */
.vp-desc-row {
    padding: 10px 18px; font-size: 13px; color: #333; line-height: 1.7;
    border-top: 1px dashed #e0e0e0; margin: 0 0 4px;
}
.vp-desc-text { margin-inline-start: 6px; }

/* transfer nodes */
.vp-transfer-row {
    display: flex; align-items: stretch; gap: 10px;
    padding: 14px 18px 10px;
}
.vp-tnode {
    flex: 1; border: 1.5px solid #c7d2fe; border-radius: 13px;
    padding: 12px 16px; text-align: center; background: #f5f3ff;
}
.vp-tnode-label  { display: block; font-size: 11px; color: #6b7280; margin-bottom: 4px; }
.vp-tnode-name   { display: block; font-size: 16px; font-weight: 800; color: #111; }
.vp-tnode-branch { display: block; font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.vp-tarrow { display: flex; align-items: center; font-size: 26px; color: #4f46e5; font-weight: 900; padding: 0 4px; }

/* signatures */
.vp-sigs {
    display: flex; gap: 0; margin: 40px 18px 18px;
    border-top: 1.5px solid #e0e0e0; padding-top: 0;
}
.vp-sig { flex: 1; text-align: center; padding: 0 8px; border-inline-end: 1px dashed #d0d5e0; }
.vp-sig:last-child { border-inline-end: none; }
.vp-sig-line { border-top: 1.5px solid #555; margin: 0 12px 8px; margin-top: 28px; }
.vp-sig-title { font-size: 13px; font-weight: 700; color: #333; }
.vp-sig-name  { font-size: 11px; color: #777; margin-top: 3px; }

/* footer */
.vp-footer {
    text-align: center; padding: 10px 18px 12px;
    border-top: 1px solid #e8eaf0; margin-top: 4px;
}
.vp-footer-note { font-size: 12px; font-weight: 600; color: #444; margin-bottom: 3px; }
.vp-footer-meta { font-size: 10.5px; color: #9ca3af; }

.logo-preview { max-height: 56px; max-width: 170px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface-2); }

/* closing report table (used in DailyClosing) */
.vp-table { width: 100%; border-collapse: collapse; margin: 16px 18px 6px; width: calc(100% - 36px); }
.vp-table th, .vp-table td { border: 1px solid #cfd4e0; padding: 10px 12px; font-size: 14px; text-align: center; }
.vp-table th { background: #eef0f7; font-weight: 700; }
.vp-table td:first-child { font-weight: 700; }
.vp-pos { color: #0a7d34; font-weight: 700; }
.vp-neg { color: #b21f2d; font-weight: 700; }

/* ---------- Dashboard: quick-action launcher + 7-day trend chart ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.qa { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; transition: transform .15s ease, box-shadow .15s ease; }
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.qa-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }

.trend { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 12px 4px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 5px; width: 100%; }
.tb { width: 40%; max-width: 24px; min-height: 3px; border-radius: 6px 6px 0 0; }
.tb-in { background: linear-gradient(180deg, #2bd396, #1a9e68); }
.tb-out { background: linear-gradient(180deg, #f4697a, #d83a4c); }
.trend-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 7px; direction: ltr; }
.dot-in, .dot-out { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: middle; margin-inline-end: 3px; }
.dot-in { background: #1a9e68; }
.dot-out { background: #d83a4c; }

/* ---------- Segmented quick-range picker (Reports) ---------- */
.seg { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; flex-wrap: wrap; }
.seg-btn { border: 0; background: transparent; color: var(--text-muted); font-weight: 600; font-size: 12.5px; padding: 8px 13px; border-radius: 9px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- Dashboard: per-branch KPI cards ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; flex-wrap: wrap; }
.section-title { font-size: 17px; font-weight: 800; color: var(--text); margin: 0; }
.branch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; margin-bottom: 22px; }
.branch-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.bc-name { font-size: 16px; font-weight: 800; color: var(--text); }
.bc-code { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; }
.bc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bc-kpi { text-align: center; background: var(--surface-2); border-radius: 12px; padding: 12px 6px; }
.bc-lbl { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.bc-val { font-size: 16px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.bc-val span { font-size: 11px; font-weight: 600; opacity: .75; }
.bc-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 11.5px; flex-wrap: wrap; }
@media (max-width: 540px) { .bc-kpis { grid-template-columns: 1fr; } }

/* ---------- Dashboard: big revenue hero ---------- */
.rev-hero { background: linear-gradient(125deg, #0f9d63 0%, #14b39a 55%, #0ea5b7 100%); color: #fff; border-radius: var(--radius); padding: 24px 30px; margin-bottom: 22px; box-shadow: var(--shadow); }
.rev-hero-head { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; opacity: .95; margin-bottom: 16px; }
.rev-hero-figs { display: flex; align-items: stretch; gap: 30px; flex-wrap: wrap; }
.rev-fig { display: flex; flex-direction: column; justify-content: center; }
.rev-amt { font-size: clamp(30px, 5vw, 46px); font-weight: 800; line-height: 1.04; letter-spacing: .5px; }
.rev-cur { font-size: 13px; opacity: .92; margin-top: 5px; font-weight: 600; }
.rev-sep { width: 1px; background: rgba(255, 255, 255, .35); }
.rev-hero-sub { margin-top: 16px; font-size: 13px; opacity: .95; border-top: 1px solid rgba(255, 255, 255, .25); padding-top: 12px; }
@media (max-width: 540px) { .rev-sep { display: none; } }

/* ---------- Dashboard: per-branch revenue mini-hero cards ---------- */
.branch-rev-card { background: linear-gradient(125deg, #0f9d63 0%, #14b39a 60%, #0ea5b7 100%); color: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.brc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.brc-name { font-size: 16px; font-weight: 800; }
.brc-code { font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .2); border-radius: 8px; padding: 3px 9px; }
.brc-figs { display: flex; align-items: stretch; gap: 18px; flex-wrap: wrap; }
.brc-fig { display: flex; flex-direction: column; }
.brc-amt { font-size: clamp(22px, 3vw, 31px); font-weight: 800; line-height: 1.05; }
.brc-cur { font-size: 11.5px; opacity: .9; margin-top: 3px; font-weight: 600; }
.brc-sep { width: 1px; background: rgba(255, 255, 255, .3); }
.brc-foot { margin-top: 14px; font-size: 11.5px; opacity: .92; border-top: 1px solid rgba(255, 255, 255, .22); padding-top: 10px; }

/* ---------- Notification bell + audit before/after detail ---------- */
.bell { position: relative; text-decoration: none; }
.bell-badge { position: absolute; top: -3px; inset-inline-end: -3px; min-width: 17px; height: 17px; padding: 0 4px; background: var(--red); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 800; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--card); }

.aud-detail-btn { cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 4px 12px; font-size: 11.5px; color: var(--primary); font-weight: 700; }
.aud-detail-btn:hover { background: var(--card); }
.aud-detail-row > td { background: var(--surface-2); padding: 12px 22px !important; }
.aud-changes { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
.aud-changes th, .aud-changes td { border: 1px solid var(--border-soft); padding: 7px 12px; font-size: 12.5px; text-align: start; }
.aud-changes th { background: var(--surface-2); font-weight: 700; color: var(--text-muted); }
.aud-old { color: #b21f2d; text-decoration: line-through; opacity: .85; }
.aud-new { color: #0a7d34; font-weight: 700; }

.notif { display: flex; gap: 13px; padding: 15px 6px; border-bottom: 1px solid var(--border-soft); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--surface-2); border-radius: 12px; }
.notif-ic { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 700; font-size: 14px; }
.notif-msg { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Category × branch matrix (dual-currency) report ---------- */
.matrix-wrap { overflow: auto; max-height: 72vh; }
.matrix { min-width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { white-space: nowrap; }
.matrix thead th { position: sticky; top: 0; z-index: 1; }
.matrix tbody tr:nth-child(even) > td { background: var(--surface-2); }
.matrix tbody tr:hover > td { background: var(--primary-light); }
.matrix .matrix-cat { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--card); box-shadow: 1px 0 0 var(--border-soft); }
.matrix tbody tr:nth-child(even) > .matrix-cat { background: var(--surface-2); }
.matrix thead .matrix-cat { z-index: 3; background: var(--surface-2); }
.matrix .matrix-total-col { background: var(--surface-2); }
.matrix tfoot td { background: var(--surface-2); font-weight: 800; border-top: 2px solid var(--border); }
.m-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.25; }
.m-iqd { font-weight: 700; font-size: 13px; color: var(--text); }
.m-usd { font-size: 11px; color: var(--text-muted); }
.m-iqd i, .m-usd i { font-style: normal; font-size: 9.5px; color: var(--text-muted); margin-inline-start: 3px; }
.m-cell.accent .m-iqd { color: var(--primary); }

/* ---------- Unified reports tab bar ---------- */
.report-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 5px; margin-bottom: 18px; flex-wrap: wrap; }
.rtab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--text-muted); text-decoration: none; transition: background .15s ease, color .15s ease; }
.rtab:hover { color: var(--text); }
.rtab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }
.rtab svg { width: 17px; height: 17px; }
.help-card {
    background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 14px;
    display: flex; align-items: center; gap: 10px; color: #cfd6ea; font-size: 13px;
}

/* ---------- Main ---------- */
.main { flex: 1; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h); background: var(--bg);
    display: flex; align-items: center; gap: 18px; padding: 0 30px;
    position: sticky; top: 0; z-index: 30;
}
.topbar__search {
    flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
    background: var(--card); border-radius: 30px; padding: 12px 20px;
    box-shadow: var(--shadow-sm); color: var(--text-muted);
}
.topbar__search input { border: 0; outline: 0; flex: 1; font-size: 13.5px; background: transparent; color: var(--text); }
.topbar__spacer { flex: 1; }

.year-pill { background: var(--card); border-radius: 16px; padding: 8px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; line-height: 1.1; }
.year-pill small { color: var(--text-muted); font-size: 10px; }
.year-pill b { font-size: 13px; }

.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow-sm); color: var(--text-muted); position: relative; cursor: pointer; border: 0; }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }

.user-chip { display: flex; align-items: center; gap: 11px; background: var(--card); border-radius: 30px; padding: 7px 16px 7px 7px; box-shadow: var(--shadow-sm); cursor: pointer; }
.user-chip .u-name { font-weight: 700; font-size: 13px; }
.user-chip .u-role { color: var(--text-muted); font-size: 11px; }

.content { padding: 8px 30px 40px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin: 10px 0 22px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 26px; font-weight: 800; }
.breadcrumb { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 17px; font-weight: 700; }
.link { color: var(--primary); font-weight: 600; font-size: 12.5px; cursor: pointer; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.stat__icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.stat__label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.stat__value { font-size: 24px; font-weight: 800; margin-top: 2px; }
.stat__trend { font-size: 11.5px; font-weight: 600; margin-top: 3px; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }

.bg-indigo { background: var(--primary-light); color: var(--primary); }
.bg-green { background: var(--green-soft); color: var(--green); }
.bg-red { background: var(--red-soft); color: var(--red); }
.bg-amber { background: var(--amber-soft); color: #f7991c; }
.bg-blue { background: var(--blue-soft); color: var(--blue); }
.bg-teal { background: var(--teal-soft); color: var(--teal); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 30px; font-size: 11.5px; font-weight: 700; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #f7991c; }
.badge-indigo { background: var(--primary-light); color: var(--primary); }
.badge-grey { background: var(--track); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-weight: 600; font-size: 13px; padding: 11px 18px; border-radius: 12px; transition: all .15s ease; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-light:hover { background: var(--surface-2); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.select, .input { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--text); outline: 0; box-shadow: var(--shadow-sm); }
.select { min-width: 150px; }

/* ---------- Table ---------- */
.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table thead th { text-align: start; padding: 16px 22px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.table tbody td { padding: 15px 22px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.person { display: flex; align-items: center; gap: 12px; }
.person .p-name { font-weight: 700; }
.person .p-sub { color: var(--text-muted); font-size: 12px; }

.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.avatar-initials { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px; flex: none; }

/* ---------- Bars ---------- */
.bar { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 8px; background: var(--primary); }

/* ---------- Layout grid ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 880px) {
    .sidebar { transform: translateX(-105%); }
    .main { margin-inline-start: 0; }
}

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.text-end { text-align: end; }
.w-full { width: 100%; }

/* error ui (framework) */
#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ============================================================
   Student 360 profile
   ============================================================ */
.profile-grid { display: grid; grid-template-columns: 1fr 330px; gap: 22px; margin-bottom: 22px; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-header { display: flex; gap: 24px; align-items: flex-start; }
.profile-photo { width: 132px; height: 132px; border-radius: 24px; flex: none; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: #fff; box-shadow: var(--shadow-sm); background-size: cover; background-position: center; }
.profile-photo-wrap { position: relative; flex: none; }
.profile-photo-actions { position: absolute; bottom: 6px; inset-inline-end: 6px; display: flex; gap: 5px; }
.pp-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--card); background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: var(--shadow); }
.pp-btn:hover { filter: brightness(1.08); }
.pp-btn:disabled { opacity: .5; pointer-events: none; }
.profile-name { font-size: 25px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.id-chip { background: var(--primary-soft); color: var(--primary); padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 22px; margin-top: 20px; }
.info-item { display: flex; gap: 10px; align-items: flex-start; }
.info-item .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.info-item .lbl { color: var(--text-muted); font-size: 11px; }
.info-item .val { font-weight: 700; font-size: 13px; margin-top: 2px; }

.guardians { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; border-top: 1px solid var(--border-soft); padding-top: 18px; }
.guardian .g-role { color: var(--text-muted); font-size: 11px; }
.guardian .g-name { font-weight: 700; margin-top: 3px; }
.guardian .g-contact { color: var(--text-muted); font-size: 12px; margin-top: 5px; display: flex; gap: 7px; align-items: center; }

.quick-info .qi-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.quick-info .qi-row:last-child { border-bottom: 0; }
.qi-label { color: var(--text-muted); font-size: 12.5px; display: flex; gap: 9px; align-items: center; }
.qi-value { font-weight: 700; font-size: 13px; }

.tabs { display: flex; gap: 4px; background: var(--card); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); margin-bottom: 22px; overflow-x: auto; }
.tab { padding: 10px 15px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(91,95,239,.35); }
.tab:hover:not(.active) { background: var(--primary-soft); color: var(--primary); }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mini { text-align: center; padding: 14px 8px; background: var(--surface-2); border-radius: 14px; }
.mini .m-val { font-size: 22px; font-weight: 800; }
.mini .m-lbl { color: var(--text-muted); font-size: 11.5px; margin-top: 3px; }

.subject-row { display: grid; grid-template-columns: 120px 40px 1fr 46px; align-items: center; gap: 12px; padding: 9px 0; }
.subject-row .s-name { font-weight: 600; font-size: 13px; }
.grade { font-weight: 800; font-size: 13px; }

.activity { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.activity:last-child { border-bottom: 0; }
.activity .a-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.activity .a-title { font-weight: 600; font-size: 13px; }
.activity .a-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.activity .a-time { margin-inline-start: auto; color: var(--text-muted); font-size: 11.5px; white-space: nowrap; }

.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 0; position: relative; }
.donut::before { content: ''; position: absolute; width: 104px; height: 104px; border-radius: 50%; background: var(--card); }
.donut .d-center { position: relative; text-align: center; }
.donut .d-val { font-size: 24px; font-weight: 800; color: var(--green); }
.donut .d-lbl { font-size: 11px; color: var(--text-muted); }

.legend-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-val { margin-inline-start: auto; font-weight: 700; }

.att-head { display: flex; gap: 22px; }
.att-head .a-col small { color: var(--text-muted); font-size: 11px; }
.att-head .a-col b { font-size: 18px; }
.att-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 16px; }
.att-bars span { flex: 1; border-radius: 3px; background: var(--green); min-width: 4px; }
.att-bars span.absent { background: var(--red); }
.att-bars span.late { background: var(--amber); }

.attachment { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 12px; }
.attachment .f-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex: none; }
.attachment .f-name { font-weight: 600; font-size: 12.5px; }
.attachment .f-sub { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* ============================================================
   Add Student & Family wizard
   ============================================================ */
.stepper { display: flex; align-items: flex-start; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 24px 36px; margin-bottom: 22px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 9px; position: relative; flex: 1; }
.step .s-circle { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--track); color: var(--text-muted); z-index: 2; }
.step.active .s-circle { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(91,95,239,.4); }
.step.done .s-circle { background: var(--green-soft); color: var(--green); }
.step .s-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-align: center; }
.step.active .s-label { color: var(--primary); }
.step .s-line { position: absolute; top: 20px; height: 2px; background: var(--border); width: calc(100% - 40px); inset-inline-start: calc(50% + 20px); z-index: 1; }
.step:last-child .s-line { display: none; }

.form-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; }
.section-title { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.section-title .st-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .form-grid, .form-grid.cols-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text); }
.field > label .req { color: var(--red); }
.field input, .field select, .field textarea { border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; font-size: 13px; color: var(--text); outline: 0; background: var(--card); font-family: inherit; transition: border-color .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.col-span-2 { grid-column: span 2; }

.upload-box { border: 2px dashed var(--border); border-radius: 16px; padding: 26px; text-align: center; color: var(--text-muted); font-size: 12px; }
.upload-box .u-photo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 26px; }

.sibling-row { display: grid; grid-template-columns: 38px 1.4fr 1fr 1fr 30px; gap: 10px; align-items: center; padding: 9px 0; }

.wizard-foot { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 24px; margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); }

.note-tip { background: var(--primary-soft); color: var(--primary); border-radius: 12px; padding: 12px 16px; font-size: 12.5px; display: flex; gap: 10px; align-items: center; }

/* ---------- Attendance marking pills ---------- */
.status-pills { display: inline-flex; gap: 7px; }
.pill { padding: 7px 15px; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--text-muted); }
.pill.on-present { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.on-absent { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.on-late { background: var(--amber-soft); color: #f7991c; border-color: transparent; }
.pill.on-excused { background: var(--blue-soft); color: var(--blue); border-color: transparent; }

/* generic colored soft text */
.t-green { color: var(--green); } .t-red { color: var(--red); } .t-amber { color: #f7991c; } .t-indigo { color: var(--primary); }

/* ---------- Communication chat ---------- */
.chat { display: grid; grid-template-columns: 330px 1fr; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; height: 640px; }
.chat__list { border-inline-end: 1px solid var(--border-soft); overflow-y: auto; }
.chat__item { display: flex; gap: 12px; padding: 14px 18px; cursor: pointer; border-bottom: 1px solid var(--border-soft); align-items: center; }
.chat__item.active { background: var(--primary-soft); }
.chat__item .ci-name { font-weight: 700; font-size: 13px; }
.chat__item .ci-msg { color: var(--text-muted); font-size: 12px; }
.chat__item .ci-time { margin-inline-start: auto; font-size: 10px; color: var(--text-muted); align-self: flex-start; }
.chat__main { display: flex; flex-direction: column; }
.chat__head { padding: 16px 22px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; }
.chat__body { flex: 1; padding: 24px; overflow-y: auto; background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 62%; padding: 11px 15px; border-radius: 14px; font-size: 13px; }
.bubble.in { background: var(--card); box-shadow: var(--shadow-sm); align-self: flex-start; }
.bubble.out { background: var(--primary); color: #fff; align-self: flex-end; }
.bubble .b-time { font-size: 10px; opacity: .7; margin-top: 5px; }
.chat__input { padding: 16px 22px; border-top: 1px solid var(--border-soft); display: flex; gap: 12px; }
.chat__input input { flex: 1; border: 1px solid var(--border); border-radius: 30px; padding: 12px 18px; outline: 0; }

/* ---------- Timetable grid ---------- */
.tt { width: 100%; border-collapse: separate; border-spacing: 8px; }
.tt th { font-size: 12px; color: var(--text-muted); font-weight: 700; padding-bottom: 6px; text-align: center; }
.tt td.time { font-size: 11.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.tt-cell { border-radius: 12px; padding: 11px; font-size: 12px; font-weight: 600; line-height: 1.35; }
.tt-cell small { font-weight: 500; opacity: .8; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-nav { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.sn-item { display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.sn-item.active { background: var(--primary); color: #fff; }
.sn-item:hover:not(.active) { background: var(--primary-soft); color: var(--primary); }

/* ---------- Settings panels (academic year / security / backup) ---------- */
.sx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sx-table th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.sx-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.sx-table tbody tr:last-child td { border-bottom: 0; }
.sx-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sx-stat { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px; }
.sx-stat-val { font-size: 22px; font-weight: 800; color: var(--text); }
.sx-stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sx-btn-primary { background: var(--primary); color: #fff; border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 700; font-size: 13px; cursor: pointer; }
.sx-btn-primary:hover { filter: brightness(1.05); }
.sx-btn-danger { background: var(--red, #ee5d50); color: #fff; border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 700; font-size: 13px; cursor: pointer; }
.sx-btn-danger:hover { filter: brightness(1.05); }

/* ---------- Monthly attendance register (students × days matrix) ---------- */
.reg-table { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.reg-table th, .reg-table td { border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); padding: 7px 6px; text-align: center; white-space: nowrap; }
.reg-table thead th { font-weight: 700; color: var(--text-muted); background: var(--bg); position: sticky; top: 0; z-index: 1; }
.reg-day { width: 30px; }
.reg-tot { width: 38px; font-weight: 700; }
.reg-sticky { position: sticky; left: 0; z-index: 2; background: var(--card); text-align: start !important; min-width: 168px; }
.reg-table thead .reg-sticky { z-index: 3; }
.reg-cell { font-weight: 700; }
.reg-cell.p { background: var(--green-soft); color: var(--green); }
.reg-cell.a { background: var(--red-soft); color: var(--red); }
.reg-cell.l { background: var(--amber-soft); color: var(--amber); }
.reg-cell.e { background: var(--blue-soft); color: var(--blue); }
.reg-cell.none { color: var(--border); }

/* ---------- ID card designer ---------- */
.cd-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.cd-grid { display: grid; grid-template-columns: 220px 1fr 256px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cd-grid { grid-template-columns: 1fr; } }
.cd-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.cd-panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; color: var(--text-muted); margin-bottom: 10px; }
.cd-add { display: flex; align-items: center; gap: 9px; width: 100%; text-align: start; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; }
.cd-add:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); }
.cd-stage { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: repeating-conic-gradient(#eef2f9 0% 25%, #f7f9fd 0% 50%) 50% / 22px 22px; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; min-height: 320px; }
.cd-side-toggle { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.cd-side-toggle button { border: 0; background: none; padding: 7px 20px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.cd-side-toggle button.active { background: var(--primary); color: #fff; }
.cd-card-pair { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.cd-canvas { position: relative; box-shadow: 0 10px 30px rgba(27,37,89,.18); border-radius: 14px; overflow: hidden; }
.cd-el { position: absolute; box-sizing: border-box; overflow: hidden; white-space: nowrap; cursor: move; user-select: none; line-height: 1.15; }
#cd-canvas .cd-el.sel { outline: 2px dashed var(--primary); outline-offset: 1px; }
.cd-photo { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; }
.cd-logo { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 800; border-radius: inherit; }
.cd-barcode { display: flex; flex-direction: column; height: 100%; justify-content: center; }
.cd-bars { display: flex; align-items: stretch; height: calc(100% - 13px); }
.cd-bars span { display: block; height: 100%; }
.cd-bc-label { font-size: 9px; text-align: center; letter-spacing: 2px; margin-top: 2px; font-weight: 600; }
.cd-qr { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.cd-qr svg { width: 100%; height: 100%; display: block; }
.cd-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.cd-color input[type=color] { width: 46px; height: 30px; border: 1px solid var(--border-soft); border-radius: 8px; background: none; cursor: pointer; padding: 2px; }
.cd-upload-row { display: flex; align-items: center; gap: 8px; }
.cd-upload-row .cd-add { flex: 1; margin-bottom: 0; }
.cd-clear { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--bg); color: var(--red, #ee5d50); cursor: pointer; flex: none; font-weight: 700; }
.cd-clear:hover { background: var(--red-soft); }
.cd-hint { color: var(--text-muted); font-size: 12px; margin-top: 12px; text-align: center; }
.cd-print-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.cd-print-item { position: relative; cursor: pointer; border: 2px solid transparent; border-radius: 14px; display: inline-block; }
.cd-print-item.off { opacity: .35; }
.cd-print-item input[type=checkbox] { position: absolute; top: 8px; left: 8px; z-index: 5; width: 18px; height: 18px; cursor: pointer; }
.cd-print-name { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.cd-upload-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--primary); color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 8px 16px; font-weight: 600; font-size: 13px; cursor: pointer; }
.cd-upload-btn:hover { filter: brightness(.98); }
.cd-upload-btn.busy { opacity: .6; pointer-events: none; }

/* ---------- Report cards ---------- */
.report-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; cursor: pointer; transition: transform .15s; }
.report-card:hover { transform: translateY(-3px); }
.report-card .rc-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }

/* ---------- RTL ---------- */
[dir="rtl"] body, [dir="rtl"] { font-family: 'Cairo', 'Tahoma', 'Segoe UI', sans-serif; }
@media (max-width: 880px) {
    [dir="rtl"] .sidebar { transform: translateX(105%); }
}

/* ---------- Theme + language toggles (topbar) ---------- */
.theme-toggle, .lang-toggle {
    height: 44px; padding: 0 14px; border-radius: 22px; background: var(--card);
    box-shadow: var(--shadow-sm); color: var(--text-muted); border: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px;
}
.theme-toggle:hover, .lang-toggle:hover { color: var(--primary); }
.lang-toggle { color: var(--text); }

/* Three-way language switcher (English / العربية / کوردی). */
.lang-switch {
    display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 5px;
    border-radius: 22px; background: var(--card); box-shadow: var(--shadow-sm); white-space: nowrap;
}
.lang-switch a {
    padding: 4px; border-radius: 8px; display: inline-flex; line-height: 0;
    text-decoration: none; transition: all .15s ease; opacity: .5;
}
.lang-switch a .flag {
    width: 27px; height: 18px; border-radius: 3px; display: block; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.lang-switch a:hover { opacity: 1; }
.lang-switch a.on { opacity: 1; }
.lang-switch a.on .flag { box-shadow: 0 0 0 2px var(--primary), 0 2px 6px rgba(0,0,0,.2); }

/* ---------- Notifications bell dropdown ---------- */
.notif-wrap { position: relative; display: inline-flex; }
.notif-panel {
    position: absolute; top: calc(100% + 12px); inset-inline-end: 0; width: 370px; max-width: 92vw;
    background: var(--card); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow); z-index: 70; padding: 6px; animation: notif-pop .14s ease;
}
@keyframes notif-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 8px; }
.notif-title { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; color: var(--text); }
.notif-title svg { color: var(--primary); }
.notif-markall { background: none; border: 0; color: var(--primary); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 5px 8px; border-radius: 9px; }
.notif-markall:hover { background: var(--primary-soft); }
.notif-tabs { display: flex; gap: 6px; padding: 2px 8px 10px; }
.notif-tab {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
    border: 0; padding: 8px 6px; border-radius: 12px; background: var(--surface-2); color: var(--text-muted);
    font-weight: 700; font-size: 12.5px; font-family: inherit;
}
.notif-tab.on { background: var(--primary); color: #fff; }
.notif-c { background: rgba(140,150,190,.18); border-radius: 20px; padding: 1px 7px; font-size: 11px; min-width: 20px; }
.notif-tab.on .notif-c { background: rgba(255,255,255,.26); }
.notif-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.notif-item {
    display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: start; cursor: pointer;
    background: none; border: 0; padding: 11px 10px; border-radius: 14px; font-family: inherit;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.ni-ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.ni-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ni-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ni-title { font-weight: 700; font-size: 13.5px; color: var(--text); }
.ni-time { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ni-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ni-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; }
.notif-foot { display: block; text-align: center; padding: 12px; margin-top: 4px; color: var(--primary); font-weight: 800; font-size: 13px; text-decoration: none; border-top: 1px solid var(--border); }
.notif-foot:hover { background: var(--surface-2); border-radius: 0 0 16px 16px; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; color: var(--text-muted); font-size: 13px; }
.notif-empty svg { color: var(--text-muted); opacity: .5; }
.ni--red { background: #ee5d50; } .ni--blue { background: #4318ff; } .ni--green { background: #05cd99; }
.ni--amber { background: #ffb547; } .ni--purple { background: #8a5cf6; } .ni--pink { background: #ff5da2; }
.ni--gray { background: #8f9bba; }
@media (max-width: 480px) { .notif-panel { position: fixed; top: 70px; inset-inline: 10px; width: auto; } }

/* Labelled Print button in the top bar — clearly discoverable on every screen. */
.topbar-print {
    height: 44px; padding: 0 16px; border-radius: 22px; cursor: pointer;
    background: var(--primary); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(91,95,239,.35);
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; white-space: nowrap;
}
.topbar-print:hover { background: var(--primary-dark); }
@media (max-width: 760px) { .topbar-print span { display: none; } .topbar-print { padding: 0; width: 44px; justify-content: center; } }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); padding-bottom: 4px; }
.cal-cell { background: var(--surface-2); border-radius: 12px; min-height: 100px; padding: 8px; }
.cal-cell.out { opacity: .35; }
.cal-cell.today { outline: 2px solid var(--primary); }
.cal-day { font-size: 12px; font-weight: 700; }
.cal-ev { font-size: 10.5px; font-weight: 600; padding: 3px 7px; border-radius: 6px; margin-top: 5px; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .kanban { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 760px) { .kanban { grid-template-columns: 1fr; } }
.kan-col { background: var(--surface-2); border-radius: 16px; padding: 14px; }
.kan-col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.kan-count { background: var(--card); border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.kan-card { background: var(--card); border-radius: 12px; padding: 13px; box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.kan-card:last-child { margin-bottom: 0; }

/* Live fleet map (Leaflet) markers */
.bus-marker { background: transparent; border: none; }
.bus-pin { display: flex; align-items: center; gap: 4px; background: #4f46e5; color: #fff; font-size: 14px;
    padding: 3px 8px 3px 6px; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap;
    transform: translateY(-2px); }
.bus-pin span { font-size: 11px; font-weight: 800; }
.map-canvas { width: 100%; border-radius: 16px; box-shadow: var(--shadow); }
.leaflet-container { font: inherit; }

/* ============================================================
   Aesthetic polish — depth, motion & focus (global, additive)
   Refines the system above via source order; no markup changes.
   ============================================================ */

/* One consistent, springy easing on everything that reacts to the pointer. */
.card, .stat, .icon-btn, .user-chip, .btn, .theme-toggle, .lang-toggle,
.report-card, .kan-card, .sx-stat, .mini, .tab, .nav-item, .pill, .sn-item,
.stat__icon, .table tbody tr {
    transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .18s ease,
        background-color .18s ease, color .18s ease, border-color .18s ease, filter .18s ease;
}

/* Frosted, layered top bar so page content scrolls under it elegantly.
   Falls back to the opaque --bg where color-mix / backdrop-filter are unsupported. */
.topbar {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

/* Summary tiles lift and deepen on hover; their icon gives a gentle pop. */
.stat:hover { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(112, 144, 176, .20); }
.stat:hover .stat__icon { transform: scale(1.06); }
.stat__icon { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .30); }
.stat__value { font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
:root[data-theme="dark"] .stat:hover { box-shadow: 0 24px 50px rgba(0, 0, 0, .50); }

/* Content cards only raise their shadow (no jump — they often hold forms/tables). */
.card:hover { box-shadow: 0 22px 46px rgba(112, 144, 176, .17); }
:root[data-theme="dark"] .card:hover { box-shadow: 0 22px 46px rgba(0, 0, 0, .50); }

/* Small, clearly-interactive cards lift. */
.kan-card:hover, .sx-stat:hover, .mini:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }

/* Buttons & topbar controls: a subtle lift + press, deeper primary glow. */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary:hover { box-shadow: 0 12px 24px rgba(91, 95, 239, .45); }
.icon-btn:hover, .theme-toggle:hover, .lang-toggle:hover, .user-chip:hover {
    transform: translateY(-2px); box-shadow: var(--shadow);
}

/* Clear, accessible keyboard focus ring across the shell. */
a:focus-visible, button:focus-visible, .btn:focus-visible, .icon-btn:focus-visible,
.nav-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.user-chip:focus-visible, .tab:focus-visible, .sn-item:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}

/* Sidebar: a crisp active-tick and a gentle hover slide. */
.nav-item { position: relative; }
.nav-item.active::before {
    content: ''; position: absolute; inset-inline-start: 7px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 3px; background: rgba(255, 255, 255, .9);
}
.nav-item:hover:not(.active) { transform: translateX(2px); }
[dir="rtl"] .nav-item:hover:not(.active) { transform: translateX(-2px); }

/* Slim, themed scrollbars app-wide (the sidebar keeps its own, more-specific rule). */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

/* Content rises in gently on each page mount (plays once per navigation, not on data refresh). */
.content > .page-head { animation: fadeIn .4s ease both; }
.content > .grid, .content > .card, .content > .table-card, .content > .form-section { animation: fadeIn .45s ease both; }
.stats-grid .stat { animation: riseIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.stats-grid .stat:nth-child(2) { animation-delay: .06s; }
.stats-grid .stat:nth-child(3) { animation-delay: .12s; }
.stats-grid .stat:nth-child(4) { animation-delay: .18s; }
.stats-grid .stat:nth-child(5) { animation-delay: .24s; }
.stats-grid .stat:nth-child(6) { animation-delay: .30s; }

@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .stat:hover, .card:hover, .btn:hover, .icon-btn:hover, .user-chip:hover, .theme-toggle:hover,
    .lang-toggle:hover, .kan-card:hover, .sx-stat:hover, .mini:hover, .nav-item:hover { transform: none !important; }
}

/* ============================================================
   Dashboard content polish
   ============================================================ */
/* Attendance mini-bars rise from their base on load, brighten on hover. */
.att-bars span { transform-origin: bottom; animation: barRise .6s cubic-bezier(.2, .7, .2, 1) both; transition: filter .15s ease, transform .15s ease; }
.att-bars span:hover { filter: brightness(1.08) saturate(1.1); transform: scaleY(1.03); }
@keyframes barRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* The students-by-year donut pops in gently and lifts a touch on hover. */
.donut { animation: donutIn .55s ease both; transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.donut:hover { transform: scale(1.03); }
@keyframes donutIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* Activity / unpaid / legend rows behave like hoverable list items; the negative
   inline margin tucks the highlight neatly into the surrounding card padding. */
.activity { border-radius: 12px; padding-inline: 10px; margin-inline: -10px; transition: background-color .15s ease; }
.activity:hover { background: var(--surface-2); }
.legend-row { border-radius: 8px; padding-inline: 8px; margin-inline: -8px; transition: background-color .15s ease; }
.legend-row:hover { background: var(--surface-2); }

/* ============================================================
   Responsive shell: mobile drawer + topbar user menu
   ============================================================ */
/* Hamburger lives in the topbar but only appears once the sidebar auto-hides. */
.nav-burger { display: none; }

/* Drawer state: .nav-open slides the sidebar back in over a dimmed backdrop. */
.app-shell.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
[dir="rtl"] .app-shell.nav-open .sidebar { transform: translateX(0); }
.nav-backdrop {
    position: fixed; inset: 0; z-index: 39; display: none;
    background: rgba(13, 20, 55, .45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    animation: fadeIn .2s ease both;
}

@media (max-width: 880px) {
    .nav-burger { display: grid; flex: none; }
    .nav-backdrop { display: block; }
    .topbar { gap: 10px; padding: 0 14px; }
    .topbar__search { max-width: none; }
    .year-pill { display: none; }
    .content { padding: 8px 14px 32px; }
}
@media (max-width: 640px) {
    .topbar__search { display: none; }
    .topbar__spacer { flex: 1; }
    .user-chip .u-text, .user-chip .u-caret { display: none; }
    .user-chip { padding: 7px; }
}

/* The user chip is now a real button that opens a small account menu. */
.user-menu-wrap { position: relative; }
.user-chip { border: 0; font-family: inherit; text-align: start; }
.user-chip .u-caret { color: var(--text-muted); display: grid; place-items: center; margin-inline-start: 2px; transition: transform .18s ease; }
.user-chip .u-caret.open { transform: rotate(180deg); }

.menu-backdrop { position: fixed; inset: 0; z-index: 48; background: transparent; }
.user-menu {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 49;
    min-width: 210px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
    border: 1px solid var(--border-soft); padding: 8px;
    animation: menuIn .16s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.user-menu .um-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.user-menu .um-name { font-weight: 800; font-size: 13.5px; }
.user-menu .um-role { color: var(--text-muted); font-size: 11.5px; margin-top: 1px; }
.um-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer;
    font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text); text-align: start;
    transition: background-color .15s ease, color .15s ease;
}
.um-item:hover { background: var(--primary-soft); color: var(--primary); }
.um-item.um-danger { color: var(--red); }
.um-item.um-danger:hover { background: var(--red-soft); color: var(--red); }

/* Icon buttons get a tactile press to match their hover lift. */
.icon-btn:active { transform: translateY(0) scale(.95); }

/* Friendly empty states (icon above a short line) instead of a bare grey sentence.
   An empty .es-ic gets a default inbox glyph from CSS, so most call sites need no SVG;
   sites that want a specific icon just put their own <svg> inside .es-ic (e.g. the dashboard). */
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    padding: 22px 12px; text-align: center; color: var(--text-muted);
    --es-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
}
.empty-state .es-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-muted); }
.empty-state .es-ic:empty::before {
    content: ''; width: 24px; height: 24px; background: currentColor;
    -webkit-mask: var(--es-mask) center / contain no-repeat; mask: var(--es-mask) center / contain no-repeat;
}
.empty-state .es-text { font-size: 13px; font-weight: 600; }

/* ============================================================
   HarakaERP additions: toolbar, row actions, amounts, modal dialog
   ============================================================ */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 420px; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-sm); color: var(--text-muted); }
.toolbar .search input { border: 0; outline: 0; flex: 1; background: transparent; color: var(--text); font-family: inherit; font-size: 13.5px; }
.toolbar .select { min-width: 170px; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--card); color: var(--text-muted); cursor: pointer; display: grid; place-items: center; transition: all .15s ease; }
.row-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.row-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.amount.pos { color: var(--green); }
.amount.neg { color: var(--red); }
.cur { font-size: 11px; color: var(--text-muted); margin-inline-start: 3px; font-weight: 600; }

.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(13, 20, 55, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fadeIn .15s ease both; }
.modal-card { width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); animation: riseIn .25s cubic-bezier(.2, .7, .2, 1) both; }
.modal-card.wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border-soft); }
.modal-close { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.modal-close:hover { background: var(--red-soft); color: var(--red); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; }

/* Fast data-entry helpers */
.field input.big-amount { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .3px; padding-block: 12px; }
.modal-foot .btn { min-width: 116px; justify-content: center; }
.kbd-hint { font-size: 11px; color: var(--text-muted); }
.kbd-hint kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-family: inherit; font-size: 10.5px; }

/* Money input with in-field currency suffix + live thousands separators */
.money-wrap { position: relative; }
.money-wrap input.money { width: 100%; padding-inline-end: 56px; text-align: start; }
.money-cur { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); font-size: 12.5px; font-weight: 800; color: var(--primary); pointer-events: none; }

/* ─── Badge teal (for Posted status on audit page) ─── */
.badge-teal { background: #e0f7f5; color: #00897b; }

/* ─── Audit-entries feed page ─── */
.aefeed-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.aestat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px; padding: 22px 26px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--card-shadow); }
.aestat__num   { font-size: 38px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.aestat__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.aestat--total    .aestat__num { color: var(--text); }
.aestat--pending  .aestat__num { color: #f7991c; }
.aestat--done     .aestat__num { color: var(--green); }
.aestat--cancelled .aestat__num { color: var(--text-muted); }

/* ── Audit table — big comfortable rows ── */
.ae-table th { white-space: nowrap; padding: 16px 20px !important; font-size: 13px !important; }
.ae-table td { padding: 18px 20px !important; font-size: 15px !important; vertical-align: middle; }
.ae-table .badge { font-size: 13px; padding: 6px 14px; }
.ae-kind   { white-space: nowrap; }
.ae-party  { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-row--audited td { background: #f0f7ff; }

/* audit status cell */
.ae-audit-col  { display: flex; flex-direction: column; gap: 4px; }
.ae-audit-when { font-size: 12px; color: var(--text-muted); padding-inline-start: 4px; }

/* lock / unlock — big touch-friendly buttons */
.btn-icon--lock, .btn-icon--unlock {
    width: 44px; height: 44px; border-radius: 10px; border: 0;
    cursor: pointer; display: grid; place-items: center; transition: background .18s;
}
.btn-icon--lock   { background: #fff4e0; color: #f7991c; }
.btn-icon--lock:hover   { background: #ffe8b0; }
.btn-icon--lock svg, .btn-icon--unlock svg { width: 20px; height: 20px; }
.btn-icon--unlock { background: var(--primary-light); color: var(--primary); }
.btn-icon--unlock:hover { background: #dde7ff; }

/* bulk action bar */
.ae-bulk      { margin-top: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ae-bulk-hint { font-size: 13px; color: var(--text-muted); }
.ae-bulk .btn { height: 50px; font-size: 15px; padding-inline: 24px; }

.spinner-sm { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* ── Mobile card view (≤ 768 px) ── */
@media (max-width: 768px) {
    .aefeed-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .aestat__num  { font-size: 30px; }

    /* hide the big table, show cards instead */
    .ae-table-wrap { display: none; }
    .ae-cards       { display: flex !important; flex-direction: column; gap: 12px; }

    .ae-card {
        background: var(--card); border: 1px solid var(--border-soft); border-radius: 14px;
        padding: 16px 18px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 10px;
    }
    .ae-card.audited { border-inline-start: 4px solid var(--primary); }
    .ae-card__top   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .ae-card__num   { font-size: 16px; font-weight: 800; color: var(--text); }
    .ae-card__meta  { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
    .ae-card__field { display: flex; flex-direction: column; gap: 2px; }
    .ae-card__lbl   { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
    .ae-card__val   { font-size: 14px; font-weight: 700; }
    .ae-card__amounts { display: flex; gap: 16px; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; }
    .ae-card__amnt  { display: flex; flex-direction: column; gap: 2px; }
    .ae-card__amnt-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; }
    .ae-card__amnt-val { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
    .ae-card__foot  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .ae-card__actions { display: flex; gap: 10px; }
    .ae-card__actions .btn-icon--lock,
    .ae-card__actions .btn-icon--unlock { width: 52px; height: 52px; border-radius: 12px; }
    .ae-card__actions .btn-icon--lock svg,
    .ae-card__actions .btn-icon--unlock svg { width: 24px; height: 24px; }
}

/* on desktop: show table, hide cards */
@media (min-width: 769px) {
    .ae-cards { display: none !important; }
    .ae-table-wrap { display: block; }
}

/* ══════════════════════════════════════════════════════════════
   AuditEntries — date preset chips
   ══════════════════════════════════════════════════════════════ */
.ae-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.ae-presets__chips { display: flex; gap: 6px; flex-wrap: wrap; }

.ae-preset {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.ae-preset:hover:not(.active) { background: var(--hover); border-color: var(--primary); }
.ae-preset.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ae-bulk-quick { margin-inline-start: auto; white-space: nowrap; }

/* ── Filter row with mobile collapsible ── */
.ae-filter-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.ae-filter-toggle {
    display: none;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-inline-start: 2px;
}

.ae-filter-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.ae-filter-content .select,
.ae-filter-content .filter-date { min-width: 150px; }
.filter-date {
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color .15s;
}
.filter-date:focus { border-color: var(--primary); }
.ae-filter-content .search { flex: 1; min-width: 180px; }

@media (max-width: 768px) {
    .ae-filter-toggle { display: flex; }
    .ae-filter-content { display: none; }
    .ae-filter-content.open { display: flex; }
    .ae-filter-content .select,
    .ae-filter-content .filter-date { flex: 1; min-width: 130px; }
    .ae-filter-content .search { min-width: 100%; width: 100%; }
    .ae-filter-content .btn { width: 100%; justify-content: center; }
    .ae-bulk-quick { width: 100%; justify-content: center; }
}

/* ══════════════════════════════════════════════════════════════
   Global responsive — modal on small screens
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-card {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 93vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
    }
    .modal-head { padding: 16px 18px 14px; }
    .modal-body { padding: 14px 18px; }
    .modal-foot {
        padding: 12px 18px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .modal-foot .btn { flex: 1; min-width: 110px; justify-content: center; }
    .kbd-hint { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   Global responsive — table card horizontal scroll
   ══════════════════════════════════════════════════════════════ */
.table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { min-width: 640px; }

/* ══════════════════════════════════════════════════════════════
   Global responsive — .toolbar (revenues / expenses / etc.)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .toolbar { padding: 10px 14px; gap: 8px; }
    .toolbar .search { min-width: 100%; width: 100%; order: -1; }
    .toolbar .select { flex: 1; min-width: 0; font-size: 13px; }
    .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-head .flex { width: 100%; }
    .page-head .flex .btn { flex: 1; justify-content: center; }
}

/* ══════════════════════════════════════════════════════════════
   Cashbox Statement — print-only layout (cs-*)
   ══════════════════════════════════════════════════════════════ */
.cs-print {
    display: none;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    direction: rtl; color: #111; background: #fff;
    max-width: 210mm; margin: 0 auto;
}

/* top / bottom band */
.cs-band { height: 8px; background: linear-gradient(90deg, #4f46e5, #818cf8); }

/* header */
.cs-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px 12px; border-bottom: 1.5px solid #e0e0e0;
}
.cs-company { display: flex; align-items: center; gap: 12px; }
.cs-logo { max-height: 52px; max-width: 150px; object-fit: contain; }
.cs-company-name { font-size: 20px; font-weight: 800; }
.cs-company-sub  { font-size: 11px; color: #6b7280; margin-top: 2px; }
.cs-badge-wrap   { text-align: center; }
.cs-type-badge {
    display: inline-block; padding: 6px 22px; border-radius: 50px;
    background: linear-gradient(135deg, #4f46e5, #818cf8); color: #fff;
    font-size: 16px; font-weight: 800;
}
.cs-period { margin-top: 5px; font-size: 12px; font-weight: 600; color: #555; }

/* info row */
.cs-info-row {
    display: flex; border-bottom: 1px solid #e8eaf0; margin: 0 0 4px;
}
.cs-info-cell {
    flex: 1; display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; padding: 8px 18px; border-inline-end: 1px solid #e8eaf0; font-size: 13px;
}
.cs-info-cell:last-child { border-inline-end: none; }
.cs-label { color: #6b7280; font-weight: 600; }
.cs-value { font-weight: 700; }

/* summary boxes */
.cs-summary { display: flex; gap: 12px; padding: 12px 18px; }
.cs-sum-box {
    flex: 1; border-radius: 14px; padding: 12px 16px; border: 1.5px solid;
}
.cs-sum-iqd { background: #f0f9ff; border-color: #7dd3fc; }
.cs-sum-usd { background: #fdf4ff; border-color: #e879f9; }
.cs-sum-cur { font-size: 12px; font-weight: 700; color: #555; margin-bottom: 8px; }
.cs-sum-row { display: flex; gap: 0; }
.cs-sum-item { flex: 1; text-align: center; padding: 4px 8px; }
.cs-sum-sep { width: 1px; background: #d1d5db; margin: 4px 0; }
.cs-sum-lbl { display: block; font-size: 10.5px; color: #6b7280; margin-bottom: 3px; }
.cs-sum-num { display: block; font-size: 14px; font-weight: 800; }
.cs-sum-in .cs-sum-num  { color: #0a7d34; }
.cs-sum-out .cs-sum-num { color: #c0392b; }

/* detail table */
.cs-table {
    width: calc(100% - 36px); margin: 8px 18px 0;
    border-collapse: collapse; font-size: 12.5px;
}
.cs-table th {
    padding: 9px 10px; font-size: 12px; font-weight: 700; color: #fff;
    background: #4f46e5; border: 1px solid #6366f1; white-space: nowrap;
}
.cs-table td { padding: 8px 10px; border: 1px solid #e2e8f0; vertical-align: middle; }

/* alternating rows */
.cs-row-even { background: #fff; }
.cs-row-odd  { background: #f8f9ff; }

/* column-specific cell colors */
.cs-td-in  { background: #f0fdf4 !important; }
.cs-td-out { background: #fff5f5 !important; }
.cs-td-bal { background: #f8faff !important; text-align: end; }

.cs-td-date { white-space: nowrap; font-size: 11.5px; }
.cs-td-date small { color: #888; display: block; font-size: 10px; }
.cs-td-type { white-space: nowrap; font-weight: 600; font-size: 12px; }
.cs-td-ref  { font-size: 11px; color: #5b5fef; font-weight: 600; }
.cs-td-notes { color: #444; }
.cs-td-in, .cs-td-out { text-align: end; }

/* amounts */
.cs-amt-in  { font-weight: 800; color: #0a7d34; font-size: 13px; }
.cs-amt-out { font-weight: 800; color: #c0392b; font-size: 13px; }
.cs-bal     { font-weight: 800; color: #4f46e5; font-size: 13px; }
.cs-cur-tag { font-size: 10px; color: #888; margin-inline-start: 3px; }
.cs-dash    { color: #bbb; }

/* th widths */
.cs-th-date  { width: 12%; }
.cs-th-type  { width: 11%; }
.cs-th-ref   { width: 14%; }
.cs-th-notes { width: auto; }
.cs-th-in    { width: 13%; background: #166534 !important; border-color: #14532d !important; }
.cs-th-out   { width: 13%; background: #991b1b !important; border-color: #7f1d1d !important; }
.cs-th-bal   { width: 13%; background: #1e1b4b !important; border-color: #312e81 !important; }

/* footer */
.cs-footer {
    text-align: center; padding: 10px 18px 12px;
    border-top: 1px solid #e8eaf0; margin-top: 8px;
}
.cs-footer-note { font-size: 12px; font-weight: 600; color: #444; margin-bottom: 3px; }
.cs-footer-meta { font-size: 10px; color: #9ca3af; }

/* show on print */
@media print {
    .cs-print { display: block !important; }
}

/* ══════════════════════════════════════════════════════════════
   Reports — details view column colors (screen)
   ══════════════════════════════════════════════════════════════ */
.rpt-td-iqd { background: #f0fdf4 !important; }
.rpt-td-usd { background: #f0f9ff !important; }
tfoot .rpt-td-iqd { font-weight: 800; color: #166534; }
tfoot .rpt-td-usd { font-weight: 800; color: #0e7490; }

/* ══════════════════════════════════════════════════════════════
   Reports — print-only layout (rpt-*)
   ══════════════════════════════════════════════════════════════ */
.rpt-print {
    display: none;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    direction: rtl; color: #111; background: #fff;
    max-width: 210mm; margin: 0 auto;
}

/* bands */
.rpt-band { height: 8px; }
.rpt-band-rev { background: linear-gradient(90deg, #0a7d34, #16a34a); }
.rpt-band-exp { background: linear-gradient(90deg, #c0392b, #e05252); }

/* header */
.rpt-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 18px 11px; border-bottom: 1.5px solid #e0e0e0;
}
.rpt-company { display: flex; align-items: center; gap: 12px; }
.rpt-logo { max-height: 50px; max-width: 140px; object-fit: contain; }
.rpt-company-name { font-size: 19px; font-weight: 800; }
.rpt-company-sub  { font-size: 11px; color: #6b7280; margin-top: 2px; }
.rpt-badge-wrap   { text-align: center; }
.rpt-type-badge {
    display: inline-block; padding: 5px 20px; border-radius: 50px; color: #fff;
    font-size: 15px; font-weight: 800;
}
.rpt-badge-rev { background: linear-gradient(135deg, #0a7d34, #16a34a); }
.rpt-badge-exp { background: linear-gradient(135deg, #c0392b, #e05252); }
.rpt-period  { margin-top: 4px; font-size: 12px; font-weight: 600; color: #555; }
.rpt-cat-chip {
    display: inline-block; margin-top: 4px; padding: 2px 10px;
    border-radius: 20px; background: #ede9fe; color: #5b21b6;
    font-size: 11px; font-weight: 700;
}

/* KPI boxes */
.rpt-kpis { display: flex; gap: 10px; padding: 10px 18px; flex-wrap: wrap; }
.rpt-kpi {
    flex: 1; min-width: 100px; border-radius: 12px;
    padding: 10px 14px; border: 1.5px solid;
}
.rpt-kpi-green  { background: #f0fdf4; border-color: #86efac; }
.rpt-kpi-teal   { background: #f0fdfa; border-color: #5eead4; }
.rpt-kpi-red    { background: #fff5f5; border-color: #fca5a5; }
.rpt-kpi-orange { background: #fff7ed; border-color: #fdba74; }
.rpt-kpi-indigo { background: #eef2ff; border-color: #a5b4fc; }
.rpt-kpi-gray   { background: #f9fafb; border-color: #d1d5db; }
.rpt-kpi-lbl { font-size: 10.5px; color: #6b7280; margin-bottom: 3px; }
.rpt-kpi-val { font-size: 18px; font-weight: 900; color: #111; }
.rpt-kpi-cur { font-size: 11px; color: #888; }

/* matrix table */
.rpt-table {
    width: calc(100% - 36px); margin: 8px 18px 4px;
    border-collapse: collapse; font-size: 11.5px;
}
.rpt-table th {
    padding: 8px 10px; font-weight: 700; color: #fff;
    background: #4f46e5; border: 1px solid #6366f1; white-space: nowrap; font-size: 11px;
}
.rpt-th-cat    { background: #312e81 !important; border-color: #312e81 !important; width: 15%; }
.rpt-th-branch { background: #4338ca !important; }
.rpt-th-total  { background: #1e1b4b !important; border-color: #1e1b4b !important; }
.rpt-table td  { padding: 7px 10px; border: 1px solid #e2e8f0; vertical-align: middle; }
.rpt-row-even { background: #fff; }
.rpt-row-odd  { background: #f8f9ff; }
.rpt-td-cat   { font-weight: 700; font-size: 12px; }
.rpt-td-total { background: #eef2ff !important; font-weight: 800; text-align: end; }
.rpt-td-cell  { text-align: end; }
tfoot tr td   { background: #e0e7ff !important; font-weight: 800; }

/* matrix print cell (IQD + USD stacked) */
.rpt-cell { text-align: end; }
.rpt-cell-iqd { color: #166534; font-weight: 800; font-size: 12px; }
.rpt-cell-usd { color: #0e7490; font-weight: 700; font-size: 11px; }
.rpt-cur-sm   { font-size: 9px; color: #888; margin-inline-start: 2px; }

/* details table override */
.rpt-detail-tbl .rpt-th-iqd { background: #166534 !important; border-color: #14532d !important; }
.rpt-detail-tbl .rpt-th-usd { background: #0e7490 !important; border-color: #155e75 !important; }
.rpt-td-iqd-cell { background: #f0fdf4 !important; text-align: end; }
.rpt-td-usd-cell { background: #f0fdfa !important; text-align: end; }
tfoot .rpt-td-iqd-cell { background: #dcfce7 !important; }
tfoot .rpt-td-usd-cell { background: #ccfbf1 !important; }
.rpt-iqd-num { font-weight: 800; color: #166534; font-size: 12px; }
.rpt-usd-num { font-weight: 800; color: #0e7490; font-size: 12px; }

/* footer */
.rpt-footer {
    text-align: center; padding: 9px 18px 11px;
    border-top: 1px solid #e8eaf0; margin-top: 8px;
}
.rpt-footer-note { font-size: 12px; font-weight: 600; color: #444; margin-bottom: 3px; }
.rpt-footer-meta { font-size: 10px; color: #9ca3af; }

/* show on print */
@media print {
    .rpt-print { display: block !important; }
}

/* ── Loading spinner ────────────────────────────────────────── */
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--c-border, #e6edf5);
    border-top-color: var(--c-primary, #5b5fef);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Developer credit ───────────────────────────────────────── */
.login-dev {
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,.35);
    margin-top: 6px;
    letter-spacing: .3px;
}
.login-dev span { color: rgba(255,255,255,.6); font-weight: 600; }

.app-footer {
    text-align: center;
    font-size: 11px;
    color: var(--c-text-muted, #8f9bba);
    padding: 14px 0 10px;
    opacity: .7;
    letter-spacing: .3px;
}
.app-footer span { font-weight: 700; color: var(--c-primary, #5b5fef); }

/* ══════════════════════════════════════════════════════════════
   Global responsive — form-grid on very small screens
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 500px) {
    .form-grid.cols-2 { grid-template-columns: 1fr; }
    .form-grid .col-span-2 { grid-column: span 1; }
    .big-amount { font-size: 22px !important; }
    .money-wrap { gap: 6px; }
    .aefeed-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .aestat__num { font-size: 30px; }
}
