/* כרטסיית תלמידים: one stylesheet for the website and the desktop app. RTL throughout. */

/* ── Fonts (bundled; no network needed) ─────────────────────────────────── */
@font-face {
    font-family: "Heebo"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("../fonts/heebo-hebrew-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
    font-family: "Heebo"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("../fonts/heebo-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Frank Ruhl Libre"; font-style: normal; font-weight: 300 900; font-display: swap;
    src: url("../fonts/frank-ruhl-libre-hebrew-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
    font-family: "Frank Ruhl Libre"; font-style: normal; font-weight: 300 900; font-display: swap;
    src: url("../fonts/frank-ruhl-libre-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    color-scheme: light;
    --sans: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --serif: "Frank Ruhl Libre", "David", "Times New Roman", serif;

    --page: #f5f4ef;
    --surface: #fcfcfb;
    --surface-2: #f1f0ea;
    --hover: #f5f4ee;
    --line: #e4e2da;
    --line-soft: #eceae3;
    --line-strong: #cfcdc3;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --ink-3: #898781;
    --link: #1c5cab;
    --focus: #2a78d6;

    --primary-bg: #1b2440;
    --primary-bg-hover: #283563;
    --primary-ink: #ffffff;
    --gold: #b8893a;
    --gold-soft: #f6eedd;

    --side-bg: linear-gradient(180deg, #1d2747 0%, #151c35 100%);
    --side-ink: #f3f4f9;
    --side-mute: #a9b1cc;
    --side-line: rgba(255, 255, 255, 0.09);

    /* Data colours: shiur identity is always the same slot, in the same order. */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --good: #0ca30c;
    --warning: #fab219;
    --serious: #ec835a;
    --critical: #d03b3b;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --meter-fill: #2a78d6;
    --meter-track: #dbe8f8;
    --pip-off: #e1e0d9;
    --heat-0: #cde2fb; --heat-1: #9ec5f4; --heat-2: #6da7ec; --heat-3: #3987e5;
    --heat-4: #256abf; --heat-5: #184f95; --heat-6: #0d366b;
    --heat-ink-low: #0b0b0b; --heat-ink-high: #ffffff;

    --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.05);
    --shadow-md: 0 6px 18px -6px rgba(20, 24, 40, 0.14), 0 2px 4px rgba(20, 24, 40, 0.05);
    --shadow-lg: 0 24px 48px -12px rgba(20, 24, 40, 0.28), 0 4px 10px rgba(20, 24, 40, 0.08);
    --scrim: rgba(13, 17, 32, 0.38);
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --hover: #212120;
        --line: #2c2c2a; --line-soft: #252523; --line-strong: #3d3d3a;
        --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #898781; --link: #86b6ef; --focus: #5598e7;
        --primary-bg: #f0efec; --primary-bg-hover: #ffffff; --primary-ink: #0b0b0b;
        --gold: #cfa255; --gold-soft: #2c261a;
        --side-bg: linear-gradient(180deg, #151a2c 0%, #0f1322 100%);
        --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
        --grid: #2c2c2a; --axis: #383835;
        --meter-fill: #3987e5; --meter-track: #17304f; --pip-off: #383835;
        --heat-0: #0d366b; --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5;
        --heat-4: #6da7ec; --heat-5: #9ec5f4; --heat-6: #cde2fb;
        --heat-ink-low: #ffffff; --heat-ink-high: #0b0b0b;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.75);
        --scrim: rgba(0, 0, 0, 0.6);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --hover: #212120;
    --line: #2c2c2a; --line-soft: #252523; --line-strong: #3d3d3a;
    --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #898781; --link: #86b6ef; --focus: #5598e7;
    --primary-bg: #f0efec; --primary-bg-hover: #ffffff; --primary-ink: #0b0b0b;
    --gold: #cfa255; --gold-soft: #2c261a;
    --side-bg: linear-gradient(180deg, #151a2c 0%, #0f1322 100%);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --grid: #2c2c2a; --axis: #383835;
    --meter-fill: #3987e5; --meter-track: #17304f; --pip-off: #383835;
    --heat-0: #0d366b; --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5;
    --heat-4: #6da7ec; --heat-5: #9ec5f4; --heat-6: #cde2fb;
    --heat-ink-low: #ffffff; --heat-ink-high: #0b0b0b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.75);
    --scrim: rgba(0, 0, 0, 0.6);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: var(--sans); font-size: 14.5px; line-height: 1.5; color: var(--ink);
    background: var(--page); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--focus) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.icon { flex: none; display: inline-block; vertical-align: -0.18em; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.quiet { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.pre { white-space: pre-wrap; }
.clamp-1, .clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.link { border: 0; background: none; padding: 0; color: var(--link); font-weight: 500; }
.link:hover { text-decoration: underline; }
.late-mark { color: var(--critical); display: inline-flex; vertical-align: -0.15em; }

.shiur-1 { --c: var(--series-1); }
.shiur-2 { --c: var(--series-2); }
.shiur-3 { --c: var(--series-3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }

/* ── App frame ──────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 262px minmax(0, 1fr); height: 100vh; overflow: hidden; }
.app.nav-collapsed { grid-template-columns: 70px minmax(0, 1fr); }

.sidebar {
    background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column;
    padding: 18px 14px 12px; min-height: 0; overflow-y: auto; overflow-x: hidden;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 22px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
    background: linear-gradient(140deg, #dcb469 0%, #a8792c 100%); color: #1b2440;
    font-family: var(--serif); font-weight: 800; font-size: 26px; line-height: 1; padding-bottom: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
}
.brand-mark.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; white-space: nowrap; }
.brand-text strong { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.brand-text small { color: var(--side-mute); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
    border: 0; border-radius: 10px; background: none; color: var(--side-mute); text-align: start;
    font-size: 14.5px; white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, 0.11); color: #fff; font-weight: 500; }
.nav-item.active::before {
    content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--gold);
}
[dir="rtl"] .nav-item.active::before { border-radius: 4px 0 0 4px; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; }
.sample-note {
    display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; padding: 8px 10px; border-radius: 10px;
    background: rgba(220, 180, 105, 0.13); border: 1px solid rgba(220, 180, 105, 0.3); color: #f0dcae;
    font-size: 12.5px; white-space: nowrap;
}
.user-chip {
    display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 12px 6px 4px;
    border-top: 1px solid var(--side-line);
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.13); font-weight: 600;
}
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-text strong { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { color: var(--side-mute); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-collapsed .brand-text, .nav-collapsed .nav-item span, .nav-collapsed .user-text,
.nav-collapsed .sample-note span, .nav-collapsed .user-chip .icon-btn { display: none; }
.nav-collapsed .nav-item, .nav-collapsed .sample-note { justify-content: center; padding-inline: 0; }
.nav-collapsed .brand, .nav-collapsed .user-chip { justify-content: center; padding-inline: 0; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
    display: flex; align-items: center; gap: 14px; height: 62px; flex: none; padding: 0 22px;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 16px; }
.today { text-align: end; line-height: 1.25; white-space: nowrap; }
.today strong { display: block; font-size: 14px; font-weight: 600; }
.today small { color: var(--ink-3); font-size: 11.5px; }
.view-only {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
}

.search {
    position: relative; flex: 0 1 430px; display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px;
    background: var(--surface-2); border: 1px solid transparent; border-radius: 11px; color: var(--ink-3);
    transition: border-color 0.12s, background 0.12s;
}
.search:focus-within { background: var(--surface); border-color: var(--focus); }
.search.open { z-index: 22; }
.search > input {
    position: relative; z-index: 21; flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink);
}
.search > input::placeholder { color: var(--ink-3); }
.search > .icon { position: relative; z-index: 21; }
.search kbd {
    direction: ltr; font: 500 11px var(--sans); color: var(--ink-3); border: 1px solid var(--line-strong);
    border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.search-results {
    position: absolute; z-index: 21; top: calc(100% + 8px); inset-inline: 0; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-lg);
}
.search-result, .pick-row {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px;
    background: none; text-align: start; color: var(--ink);
}
.search-result:hover, .pick-row:hover:not(:disabled) { background: var(--surface-2); }
.search-result strong, .pick-row strong { display: block; font-weight: 500; }
.search-result small, .pick-row small { color: var(--ink-3); font-size: 12px; }
.search-empty { padding: 14px; text-align: center; color: var(--ink-3); }
.search-scrim, .menu-scrim { position: fixed; inset: 0; z-index: 20; }

.menu-wrap { position: relative; }
.menu {
    position: absolute; z-index: 21; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; padding: 6px;
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
    border-radius: 13px; box-shadow: var(--shadow-lg);
}
.menu button {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px;
    background: none; text-align: start; color: var(--ink);
}
.menu button:hover { background: var(--surface-2); }
.menu button .icon { color: var(--ink-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.tabstrip {
    display: flex; align-items: flex-end; gap: 2px; flex: none; padding: 8px 20px 0; overflow-x: auto;
    background: var(--surface-2); border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tab {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin-bottom: -1px;
    border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; color: var(--ink-2);
    white-space: nowrap; cursor: pointer; user-select: none; font-size: 13.5px;
}
.tab:hover { background: color-mix(in srgb, var(--page) 60%, transparent); color: var(--ink); }
.tab.active { background: var(--page); border-color: var(--line); color: var(--ink); font-weight: 500; }
.tab .icon { color: var(--ink-3); }
.tab.active .icon { color: var(--gold); }
.tab-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.tab-close {
    display: grid; place-items: center; width: 20px; height: 20px; margin-inline-end: -5px; border: 0;
    border-radius: 6px; background: none; color: var(--ink-3);
}
.tab-close:hover { background: var(--line); color: var(--ink); }

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 28px 56px; }
.tab-pane.hidden { display: none; }

/* ── Buttons, tags, small pieces ────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink);
    font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); height: 32px; padding: 0 9px; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.ghost.danger { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost.danger .icon { color: var(--critical); }
.btn.push { margin-inline-start: auto; }
.btn.block { width: 100%; height: 42px; font-size: 14.5px; }

.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 9px;
    background: none; color: var(--ink-3); transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on-dark { color: var(--side-mute); }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.tag {
    --tone: var(--ink-3);
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
    font-size: 12px; font-weight: 500; color: var(--ink);
    background: color-mix(in srgb, var(--tone) 11%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--tone) 26%, var(--surface));
}
.tag .icon { color: var(--tone); }
.tag.tone-good { --tone: var(--good); }
.tag.tone-warning { --tone: var(--warning); }
.tag.tone-serious { --tone: var(--serious); }
.tag.tone-critical { --tone: var(--critical); }
.tag.tone-warning .icon { color: color-mix(in srgb, var(--warning) 78%, var(--ink)); }

.count-pill {
    display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
    font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
}

.shiur-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
    font-size: 12.5px; font-weight: 500; color: var(--ink);
    background: color-mix(in srgb, var(--c) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c) 32%, var(--surface));
}
.avatar {
    display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
    font-size: 12.5px; font-weight: 600; color: var(--ink); letter-spacing: 0.02em;
    background: color-mix(in srgb, var(--c) 15%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c) 38%, var(--surface));
}
.avatar-lg { width: 68px; height: 68px; border-radius: 22px; font-size: 24px; border-width: 1.5px; font-family: var(--serif); font-weight: 700; }

.date-label { display: inline-flex; flex-direction: column; line-height: 1.3; white-space: nowrap; }
.date-label .civ { color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.date-label.inline { flex-direction: row; align-items: baseline; gap: 7px; }

.rating { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.rating .pips { display: inline-flex; gap: 3px; }
.rating .pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--pip-off); }
.rating .pips i.on { background: var(--meter-fill); }
.rating .word { font-size: 12.5px; color: var(--ink-2); }
.row > .rating { width: 164px; flex: none; }
.row > .row-date { width: 74px; flex: none; text-align: end; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 18px; text-align: center; }
.empty-icon {
    display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 6px; border-radius: 50%;
    background: var(--surface-2); color: var(--ink-3);
}
.empty-title { font-weight: 500; }
.empty-text { color: var(--ink-3); font-size: 13px; max-width: 46ch; }

.loading { display: flex; justify-content: center; gap: 7px; padding: 80px 0; }
.loading i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); animation: pulse 1s infinite ease-in-out; }
.loading i:nth-child(2) { animation-delay: 0.15s; }
.loading i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ── Views ──────────────────────────────────────────────────────────────── */
.view { display: flex; flex-direction: column; gap: 18px; max-width: 1480px; margin: 0 auto; }
.view.narrow { max-width: 1060px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.view-head h1, .file-id h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: 0.005em; }
.view-sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.view-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.filter-box {
    display: flex; align-items: center; gap: 8px; height: 36px; min-width: 230px; padding: 0 11px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink-3);
}
.filter-box:focus-within { border-color: var(--focus); }
.filter-box input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; align-items: start; }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.grid > .card { height: 100%; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; height: 100%; }
.stack > .card { flex: 1; }

.card {
    display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-titles { min-width: 0; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 600; }
.card-head h3 > .icon { color: var(--ink-3); }
.card-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card-body { padding: 14px 18px 18px; min-width: 0; }
.card-body.flush { padding: 10px 0 4px; }
.mini-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 18px 0 8px; }
.pad { padding: 2px 18px 12px; }

/* Stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.stat-row.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-tile {
    display: flex; flex-direction: column; gap: 6px; padding: 15px 16px 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.stat-tile.clickable { cursor: pointer; }
.stat-tile.clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: 9px; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.stat-label { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 32px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 20px; color: var(--ink-2); font-size: 12.5px; }
.stat-foot .segbar { flex-basis: 100%; margin-bottom: 3px; }
.stat-split { display: inline-flex; gap: 12px; }
.stat-split span, .stat-flag, .stat-delta { display: inline-flex; align-items: center; gap: 5px; }
.stat-split b, .stat-delta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-delta b { unicode-bidi: isolate; }
.stat-row.compact .stat-value { font-size: 26px; }

/* Rows */
.rows > * { border-top: 1px solid var(--line-soft); }
.rows > *:first-child { border-top: 0; }
.rows.boxed { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.scroll-rows { max-height: 344px; overflow-y: auto; }
.row, .task-line { display: flex; align-items: center; gap: 12px; padding: 10px 18px; min-width: 0; }
.row-btn { width: 100%; border: 0; border-top: 1px solid var(--line-soft); background: none; text-align: start; }
.row-btn:hover { background: var(--hover); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main strong { font-weight: 500; }
.row-main small { color: var(--ink-3); font-size: 12.5px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.row-btn > .icon { color: var(--ink-3); flex: none; }
.row-date { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.activity-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.subhead { display: flex; align-items: center; gap: 8px; padding: 12px 18px 8px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.more { width: 100%; padding: 10px; border: 0; border-top: 1px solid var(--line-soft); background: none; color: var(--ink-2); font-size: 13px; }
.more:hover { background: var(--hover); color: var(--ink); }

.pupil-link { display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; background: none; text-align: start; }
.row > .pupil-link { flex: 1; }
.pl-text { display: flex; flex-direction: column; min-width: 0; }
.pl-text strong { font-weight: 500; white-space: nowrap; }
.pl-text small { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pupil-link:hover strong { text-decoration: underline; }

.task-line.done .task-title { color: var(--ink-3); text-decoration: line-through; }
.check {
    display: grid; place-items: center; width: 21px; height: 21px; flex: none; padding: 0; border-radius: 7px;
    border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--primary-ink);
    transition: border-color 0.12s, background 0.12s;
}
.check:hover { border-color: var(--ink-2); }
.check.on { background: var(--primary-bg); border-color: var(--primary-bg); }
.task-icon { color: var(--ink-3); display: grid; place-items: center; width: 21px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 500; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 10px; color: var(--ink-2); font-size: 12.5px; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: 12.5px; }
.meta-item .icon { color: var(--ink-3); }
.task-due { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; white-space: nowrap; }
.task-due strong { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; }
.task-due small { color: var(--ink-3); font-size: 11.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 9px 14px; text-align: start; white-space: nowrap; color: var(--ink-3); font-size: 12px; font-weight: 500;
    border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-inline-start: 18px; }
.table th:last-child, .table td:last-child { padding-inline-end: 18px; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table tr.inactive { opacity: 0.6; }
.table td.num { white-space: nowrap; }
.table td.chev { width: 30px; color: var(--ink-3); }
.table.tight td, .table.tight th { padding: 8px 10px; }
.table.tight th:first-child, .table.tight td:first-child { padding-inline-start: 0; }
.table.tight th { background: none; }
.table.tight tfoot td { background: none; }
.meter-cell { width: 130px; }
.th-sort { border: 0; background: none; padding: 0; color: inherit; font-weight: inherit; }
.th-sort:hover { color: var(--ink); }
.sort-mark { font-style: normal; margin-inline-start: 3px; }
.name-cell { display: flex; align-items: center; gap: 11px; }
.name-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.name-text strong { font-weight: 500; white-space: nowrap; }
.name-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.rating-cell { display: inline-flex; align-items: center; gap: 8px; }
.next-due { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; font-size: 12px; white-space: nowrap; }

.roster { overflow: hidden; }
.roster-table { table-layout: fixed; min-width: 980px; }
.roster-head { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.roster-head h3 { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.roster-mark {
    display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 13px; padding-bottom: 2px;
    font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--ink);
    background: color-mix(in srgb, var(--c) 16%, var(--surface)); border: 1.5px solid var(--c);
}
.roster-stats { display: flex; gap: 28px; margin: 0; margin-inline-start: auto; }
.roster-stats div { text-align: end; }
.roster-stats dt { color: var(--ink-3); font-size: 12px; }
.roster-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Conversation entries */
.entry { display: flex; align-items: flex-start; gap: 16px; padding: 14px 18px; }
.entry-date { width: 96px; flex: none; line-height: 1.35; }
.entry-date strong { display: block; font-size: 13.5px; font-weight: 600; }
.entry-date small { color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.entry-main { flex: 1; min-width: 0; }
.entry-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 6px; }
.entry-author { color: var(--ink-3); font-size: 12px; }
.entry-text { white-space: pre-wrap; line-height: 1.65; }
.impression {
    margin-top: 9px; padding: 8px 13px; border-inline-start: 3px solid var(--gold); border-radius: 4px 0 0 4px;
    background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface));
}
.impression-label { display: block; color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.impression p { white-space: pre-wrap; line-height: 1.6; }

/* Incident board and timeline */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.board-col {
    display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line);
    border-radius: var(--radius); background: color-mix(in srgb, var(--surface-2) 60%, var(--page));
}
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.board-empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 13px; }
.board-card {
    display: flex; flex-direction: column; gap: 8px; padding: 13px 14px; text-align: start; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.board-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.board-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.board-title { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.board-text { color: var(--ink-2); font-size: 13px; }
.board-who { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.board-who .avatar { width: 28px; height: 28px; font-size: 11px; }
.board-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.board-foot .meta-item { font-size: 12px; color: var(--ink-3); }
.board .more { border: 0; border-radius: 10px; }

.incident.closed { opacity: 0.82; }
.incident-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; margin-top: 7px; color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 12px; top: 26px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.tl-mark {
    display: grid; place-items: center; width: 25px; height: 25px; flex: none; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.timeline li.decision .tl-mark { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 25px; font-size: 13px; }
.tl-head .icon-btn { width: 26px; height: 26px; }
.tl-body p { white-space: pre-wrap; line-height: 1.6; }

/* Pupil file */
.file-head {
    display: flex; flex-direction: column; gap: 18px; padding: 22px 24px 18px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm);
}
.file-top { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.file-id { flex: 1; min-width: 260px; }
.file-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.file-meta .meta-item { font-size: 13px; }
.file-watch {
    margin-top: 12px; padding: 8px 13px; width: fit-content; max-width: 80ch; border-inline-start: 3px solid var(--warning);
    border-radius: 4px 0 0 4px; background: var(--surface-2); font-size: 13.5px;
}
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.file-kpis > div { padding: 0 20px; border-inline-start: 1px solid var(--line); }
.file-kpis > div:first-child { padding-inline-start: 2px; border-inline-start: 0; }
.file-kpis dt { color: var(--ink-2); font-size: 12.5px; }
.file-kpis dd { margin: 1px 0; font-size: 27px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.file-kpis dd.text { font-size: 21px; line-height: 1.6; }
.file-kpis .of { margin-inline-start: 7px; color: var(--ink-3); font-size: 13px; font-weight: 400; }
.file-kpis small { color: var(--ink-3); font-size: 12px; }

.subtabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.subtab {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; margin-bottom: -1px; border: 0;
    border-bottom: 2px solid transparent; background: none; color: var(--ink-2); white-space: nowrap;
}
.subtab:hover { color: var(--ink); }
.subtab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.subtab .icon { color: var(--ink-3); }
.subtab.on .icon { color: var(--ink); }

.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 0; }
.details.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 22px; }
.details .wide { grid-column: 1 / -1; }
.details dt { color: var(--ink-3); font-size: 12px; margin-bottom: 1px; }
/* Latin text such as an English address keeps its own reading order inside the RTL page. */
.details dd { margin: 0; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: right; }
.linked-note { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12.5px; }
.card-body > .linked-note { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.tutors { display: flex; flex-direction: column; gap: 12px; }
.tutor { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.tutor.past { opacity: 0.72; }
.tutor > header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tutor > header strong { font-size: 15.5px; font-weight: 600; margin-inline-end: 4px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px;
}
.slot b { font-weight: 600; font-variant-numeric: tabular-nums; }

.hero-figure { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.hero-figure strong { font-size: 46px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-figure span { color: var(--ink-2); font-size: 13px; line-height: 1.55; max-width: 52ch; }
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 54px; align-items: center; gap: 12px; }
.bar-label { color: var(--ink-2); font-size: 13px; }
.bar-row strong { text-align: end; font-weight: 600; }
.bar-row .muted { text-align: end; }

.assess-latest { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; min-height: 32px; }
.assess-latest .rating .pips i { width: 20px; height: 8px; border-radius: 4px; }
.assess-latest .rating .word { font-size: 14px; font-weight: 500; color: var(--ink); }
.history { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.history summary { cursor: pointer; color: var(--ink-2); font-size: 13px; user-select: none; }
.history-row { padding: 9px 0 2px; margin-top: 8px; border-top: 1px dashed var(--line); }
.history-head { display: flex; align-items: center; gap: 12px; }
.history-row p { margin-top: 3px; color: var(--ink-2); font-size: 13.5px; white-space: pre-wrap; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.file-tile { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.file-tile:hover { border-color: var(--line-strong); }
.file-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 2px; border: 0; background: none; text-align: start; }
.file-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); }
.file-thumb { width: 42px; height: 42px; flex: none; border-radius: 11px; object-fit: cover; }
.file-text { min-width: 0; }
.file-text strong { font-size: 13.5px; font-weight: 500; }
.file-text small { color: var(--ink-3); font-size: 12px; }
.file-audio { width: 100%; height: 36px; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart { display: flex; flex-direction: column; gap: 12px; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 12.5px; }
.ch-key { display: inline-flex; align-items: center; gap: 7px; }
.ch-key i.line, .ch-tip-row i.line { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex: none; }
.ch-key i.box, .ch-tip-row i.box { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Charts read right to left like the rest of the page: the value axis sits on the right, time
   and categories start there, and the latest value is labelled at the left end of each line. */
.ch-frame, .cc-frame { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; direction: rtl; }
.ch-yaxis { position: relative; width: 36px; }
.ch-yaxis span {
    position: absolute; left: 0; direction: ltr; transform: translateY(-50%); color: var(--ink-3); font-size: 11.5px;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ch-plot { position: relative; margin-left: 50px; }
.ch-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ch-area { opacity: 0.1; stroke: none; }
.ch-dot {
    position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px var(--surface); pointer-events: none;
}
.ch-end {
    position: absolute; right: calc(100% + 10px); direction: ltr; transform: translateY(-50%); color: var(--ink);
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ch-col { position: absolute; top: 0; bottom: 0; outline: none; }
.ch-cross { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--axis); opacity: 0; }
.ch-col:hover .ch-cross, .ch-col:focus-visible .ch-cross { opacity: 1; }
.ch-tip {
    position: absolute; z-index: 5; top: 6px; left: calc(50% + 12px); min-width: 164px; padding: 9px 11px;
    direction: rtl; background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
    box-shadow: var(--shadow-md); font-size: 12.5px; opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.1s;
}
.tip-left .ch-tip { left: auto; right: calc(50% + 12px); }
.ch-col:hover .ch-tip, .ch-col:focus-visible .ch-tip, .cc-group:hover .ch-tip, .cc-group:focus-visible .ch-tip { opacity: 1; visibility: visible; }
.ch-tip-title { font-weight: 600; margin-bottom: 5px; }
.ch-tip-row { display: flex; align-items: center; gap: 7px; padding: 1px 0; color: var(--ink-2); white-space: nowrap; }
.ch-tip-row span { order: 1; }
.ch-tip-row b { order: 2; margin-inline-start: auto; padding-inline-start: 14px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-xaxis { grid-column: 2; position: relative; height: 24px; margin-left: 50px; }
.ch-xaxis span {
    position: absolute; top: 7px; transform: translateX(-50%); direction: rtl; color: var(--ink-3);
    font-size: 11.5px; white-space: nowrap;
}

.cc-plot { position: relative; }
.cc-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--grid); }
.cc-grid.base { background: var(--axis); }
.cc-groups { position: absolute; inset: 0; display: flex; direction: rtl; }
.cc-group { position: relative; flex: 1; display: flex; justify-content: center; align-items: flex-end; outline: none; border-radius: 6px 6px 0 0; }
.cc-group:hover, .cc-group:focus-visible { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.cc-bars { display: flex; align-items: flex-end; gap: 2px; height: 100%; direction: rtl; }
.cc-bar { width: clamp(9px, 1.5vw, 20px); min-height: 2px; border-radius: 4px 4px 0 0; }
.cc-group .ch-tip { top: 4px; }
.cc-xaxis { grid-column: 2; display: flex; direction: rtl; }
.cc-xaxis span { flex: 1; padding-top: 7px; text-align: center; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }

.heatmap-wrap { display: flex; flex-direction: column; gap: 12px; }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 4px; margin: -4px; }
.heatmap th { color: var(--ink-3); font-size: 12px; font-weight: 500; white-space: nowrap; }
.heatmap tbody th { text-align: start; color: var(--ink-2); font-size: 13px; padding-inline-end: 10px; width: 1%; }
.heat { display: block; padding: 6px 0; border-radius: 8px; text-align: center; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.heat-0 { background: var(--heat-0); } .heat-1 { background: var(--heat-1); } .heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); } .heat-4 { background: var(--heat-4); } .heat-5 { background: var(--heat-5); }
.heat-6 { background: var(--heat-6); }
.heat-0, .heat-1, .heat-2 { color: var(--heat-ink-low); }
.heat-4, .heat-5, .heat-6 { color: var(--heat-ink-high); }
.heat-3 { color: #0b0b0b; }
.heat-none { background: var(--surface-2); color: var(--ink-3); }
.heat-scale { display: flex; align-items: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; }
.heat-scale span:first-child { margin-inline-end: 5px; }
.heat-scale span:last-child { margin-inline-start: 5px; }
.heat-scale i { width: 22px; height: 8px; border-radius: 2px; }

.spark { position: relative; display: inline-block; width: 86px; height: 26px; vertical-align: middle; }
.spark svg { width: 100%; height: 100%; overflow: visible; }
.spark polyline { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--surface); }

.meter { display: block; height: 8px; min-width: 60px; border-radius: 4px; background: var(--meter-track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--meter-fill); }
.meter.empty { opacity: 0.5; }
.segbar { display: flex; gap: 2px; width: 100%; height: 6px; }
.segbar i { border-radius: 3px; min-width: 4px; }

/* ── Forms, editor panel, dialogs ───────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); backdrop-filter: blur(2px); animation: fade 0.16s ease-out; }
.scrim.strong { z-index: 45; }
.editor {
    position: fixed; z-index: 40; top: 0; bottom: 0; inset-inline-end: 0; width: min(540px, 100vw);
    display: flex; flex-direction: column; background: var(--surface); border-inline-start: 1px solid var(--line);
    box-shadow: var(--shadow-lg); animation: slide-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide-in { from { transform: translateX(-28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.editor-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.editor-head h2 { flex: 1; font-family: var(--serif); font-size: 20px; font-weight: 700; }
.editor-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--gold-soft); color: var(--ink); }
.editor-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; padding: 20px; }
.editor-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.field-hint { color: var(--ink-3); font-size: 12px; }
.req { color: var(--critical); margin-inline-start: 3px; font-weight: 600; }
.input {
    width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px;
    background: var(--surface); color: var(--ink); transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
textarea.input { resize: vertical; line-height: 1.6; }
select.input { padding-inline-end: 8px; }
.input.ltr, input[type="tel"].input, input[type="email"].input, input[type="time"].input, input[type="date"].input { direction: ltr; text-align: right; }
.input.num { font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-section { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.check-row { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--primary-bg); }
.check-row.compact { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); max-width: 100%; overflow-x: auto; }
.segmented button { padding: 5px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.segmented button:hover { color: var(--ink); }
.segmented button.on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line-strong);
    border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px;
}
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chip.on { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); }
.chip-count { opacity: 0.7; font-size: 11.5px; font-variant-numeric: tabular-nums; }

.datefield { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.df-heb { display: flex; gap: 6px; flex: 1; min-width: 230px; }
.df-heb select { min-width: 0; }
.df-heb select:nth-child(1) { flex: 0.8; }
.df-heb select:nth-child(2) { flex: 1.3; }
.df-heb select:nth-child(3) { flex: 1.1; }
.df-civ { width: 150px; flex: none; color: var(--ink-2); }

.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px;
    border: 1.5px dashed var(--line-strong); border-radius: 13px; text-align: center; cursor: pointer; color: var(--ink-2);
}
.dropzone:hover { border-color: var(--focus); background: var(--hover); }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.dropzone small { color: var(--ink-3); font-size: 12px; }

.picked { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 11px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-list:not(:empty) { padding: 4px; border: 1px solid var(--line); border-radius: 11px; }
.suggest { padding: 10px; border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--surface)); border-radius: 12px; background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface)); }
.suggest-title { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; padding: 0 4px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.suggest .pick-row:hover:not(:disabled) { background: var(--surface); }
.score-row { display: flex; align-items: flex-end; gap: 10px; }
.score-row .field { flex: 1; }
.score-of { padding-bottom: 9px; color: var(--ink-2); }
.score-pct { display: flex; flex-direction: column; align-items: center; min-width: 88px; padding: 3px 12px; border-radius: 11px; background: var(--surface-2); line-height: 1.3; }
.score-pct small { color: var(--ink-3); font-size: 11.5px; }
.score-pct strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rating-input { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating-input button {
    display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px; border: 1px solid var(--line-strong);
    border-radius: 11px; background: var(--surface); color: var(--ink-2);
}
.rating-input button b { color: var(--ink); font-size: 18px; font-weight: 600; }
.rating-input button small { font-size: 11px; white-space: nowrap; }
.rating-input button:hover { background: var(--surface-2); }
.rating-input button.on { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 9%, var(--surface)); box-shadow: 0 0 0 1px var(--focus); }
.slot-row { display: flex; align-items: center; gap: 8px; }
.slot-row select { flex: 1.5; }
.slot-row input { flex: 1; }

.dialog {
    position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(430px, 92vw);
    padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.dialog h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.dialog p { color: var(--ink-2); line-height: 1.6; }
.dialog-actions { display: flex; gap: 8px; margin-top: 18px; }

.toasts { position: fixed; z-index: 60; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 9px; max-width: min(560px, 90vw); padding: 10px 15px; border-radius: 12px;
    background: #1b2440; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in 0.18s ease-out;
}
.toast .icon { color: #7fd99a; }
.toast.error .icon { color: #ff9c8f; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Splash and account pages ───────────────────────────────────────────── */
.splash { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--page); }
.splash-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(440px, 100%); padding: 34px 30px;
    text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-md);
}
.splash-card.quiet { background: none; border: 0; box-shadow: none; color: var(--ink-3); }
.splash-card h1 { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.splash-card p { color: var(--ink-2); line-height: 1.6; }

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-side {
    position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 48px;
    background: var(--side-bg); color: var(--side-ink); overflow: hidden;
}
.auth-side::after {
    content: "כ"; position: absolute; inset-inline-end: -40px; bottom: -150px; font-family: var(--serif);
    font-size: 560px; font-weight: 800; line-height: 1; color: rgba(255, 255, 255, 0.035); pointer-events: none;
}
.auth-side .brand { padding: 0; }
.auth-pitch h2 { font-family: var(--serif); font-size: 38px; font-weight: 700; line-height: 1.25; max-width: 18ch; text-wrap: balance; }
.auth-pitch p { margin-top: 14px; color: var(--side-mute); font-size: 16px; line-height: 1.7; max-width: 40ch; }
.auth-points { display: flex; flex-direction: column; gap: 10px; margin: 26px 0 0; padding: 0; list-style: none; color: var(--side-ink); }
.auth-points li { display: flex; align-items: center; gap: 10px; }
.auth-points li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }
.auth-foot { color: var(--side-mute); font-size: 12.5px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.auth-card .lead { color: var(--ink-2); margin-top: -8px; line-height: 1.6; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-providers { display: flex; flex-direction: column; gap: 8px; }
.auth-providers .btn { height: 42px; font-size: 14.5px; }
.auth-providers svg { width: 18px; height: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.notice { padding: 11px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); line-height: 1.6; }
.notice.error { border-color: color-mix(in srgb, var(--critical) 35%, var(--surface)); background: color-mix(in srgb, var(--critical) 8%, var(--surface)); }
.notice.ok { border-color: color-mix(in srgb, var(--good) 35%, var(--surface)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.field-error, .validation-summary-errors, .text-danger { color: var(--critical); font-size: 12.5px; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 18px; }
.validation-summary-valid { display: none; }

.admin { max-width: 1240px; margin: 0 auto; padding: 30px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-top h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.admin .card { overflow: hidden; }
.admin .card-head { padding-bottom: 12px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.inline-form select.input { width: auto; min-height: 32px; padding: 4px 8px; }
.inline-form .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.shiur-checks { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shiur-checks label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 13px; }

/* ── Smaller windows ────────────────────────────────────────────────────── */
@media (max-width: 1380px) {
    .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
    .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
    .stat-row.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board { grid-template-columns: minmax(0, 1fr); }
    .file-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
    .file-kpis > div:nth-child(3) { padding-inline-start: 2px; border-inline-start: 0; }
    .details.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 70px minmax(0, 1fr); }
    .brand-text, .nav-item span, .user-text, .sample-note span, .user-chip .icon-btn { display: none; }
    .nav-item, .sample-note, .brand, .user-chip { justify-content: center; padding-inline: 0; }
    .today, .search kbd { display: none; }
    .content { padding: 18px 14px 40px; }
    .roster-stats { display: none; }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-side { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
