/* =========================================================
   e-Rapor SMP v2 — sistem desain
   ========================================================= */
:root {
  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #f7f8fd; --surface-3: #eef1f9;
  --border: #e3e7f1; --border-strong: #cfd5e6;
  --text: #121632; --text-2: #3a4064; --muted: #6a7192;
  --primary: #4f46e5; --primary-2: #7c3aed; --primary-ink: #ffffff; --primary-soft: #eef0ff; --primary-text: #4338ca;
  --teal: #0d9488; --teal-soft: #e0f7f4; --amber: #b45309; --amber-soft: #fff4e0; --rose: #e11d48; --rose-soft: #ffe8ee;
  --violet: #7c3aed; --violet-soft: #f2ebff; --mint: #059669; --mint-soft: #e2f8ef; --sky: #0284c7; --sky-soft: #e3f3fd;
  --band-sb: #10b981; --band-b: #6366f1; --band-c: #f59e0b; --band-k: #f43f5e;
  --sidebar: #0e1130; --sidebar-2: #161a44; --sidebar-text: #b9bde3; --sidebar-muted: #6f75a8;
  --shadow-sm: 0 1px 2px rgba(18, 22, 50, .06); --shadow: 0 1px 3px rgba(18, 22, 50, .06), 0 8px 24px -12px rgba(18, 22, 50, .12);
  --shadow-lg: 0 24px 60px -20px rgba(18, 22, 50, .35);
  --radius: 16px; --radius-sm: 10px; --radius-xs: 8px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090c1d; --surface: #111530; --surface-2: #151a39; --surface-3: #1b2146;
    --border: #232a52; --border-strong: #313a6b; --text: #e9ebfb; --text-2: #c3c7ea; --muted: #8e94c0;
    --primary: #818cf8; --primary-2: #a78bfa; --primary-ink: #0b0d24; --primary-soft: rgba(129, 140, 248, .14); --primary-text: #a5b0ff;
    --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .12); --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .12); --rose: #fb7185; --rose-soft: rgba(251, 113, 133, .13);
    --violet: #c4b5fd; --violet-soft: rgba(167, 139, 250, .14); --mint: #34d399; --mint-soft: rgba(52, 211, 153, .12); --sky: #38bdf8; --sky-soft: rgba(56, 189, 248, .12);
    --sidebar: #070918; --sidebar-2: #0d1030;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 10px 30px -18px rgba(0, 0, 0, .8); --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090c1d; --surface: #111530; --surface-2: #151a39; --surface-3: #1b2146;
  --border: #232a52; --border-strong: #313a6b; --text: #e9ebfb; --text-2: #c3c7ea; --muted: #8e94c0;
  --primary: #818cf8; --primary-2: #a78bfa; --primary-ink: #0b0d24; --primary-soft: rgba(129, 140, 248, .14); --primary-text: #a5b0ff;
  --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .12); --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .12); --rose: #fb7185; --rose-soft: rgba(251, 113, 133, .13);
  --violet: #c4b5fd; --violet-soft: rgba(167, 139, 250, .14); --mint: #34d399; --mint-soft: rgba(52, 211, 153, .12); --sky: #38bdf8; --sky-soft: rgba(56, 189, 248, .12);
  --sidebar: #070918; --sidebar-2: #0d1030;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 10px 30px -18px rgba(0, 0, 0, .8); --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 1.7rem; font-weight: 750; }
h2 { font-size: 1.06rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); padding: .1em .4em; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.js-enabled .js-fallback { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ---------- Layout ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px 14px; color: var(--sidebar-text);
  background: radial-gradient(120% 50% at 0% 0%, rgba(99, 102, 241, .28), transparent 60%), radial-gradient(90% 40% at 100% 100%, rgba(20, 184, 166, .14), transparent 60%), linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  z-index: 40; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-symbol { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #14b8a6); box-shadow: 0 8px 20px -6px rgba(99, 102, 241, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.brand-symbol .icon { width: 20px; height: 20px; }
.brand-tag { margin-left: 6px; font-size: .62rem; font-weight: 800; letter-spacing: .08em; padding: 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #c7cbff; vertical-align: 3px; }
.icon-btn.sidebar-close { display: none; }
.school-identity { display: flex; gap: 10px; align-items: center; padding: 11px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); }
.school-identity strong { display: block; color: #fff; font-size: .86rem; line-height: 1.3; }
.school-identity small { color: var(--sidebar-muted); font-size: .74rem; }
.school-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #c7cbff; flex: none; }
.school-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 9px; background: #fff; padding: 3px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { display: block; margin: 12px 10px 6px; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--sidebar-text); font-weight: 550; font-size: .9rem; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item .icon { width: 18px; height: 18px; opacity: .85; }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(129, 140, 248, .28), rgba(129, 140, 248, .06)); box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .16); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(#a5b4fc, #2dd4bf); }
.nav-item.active .icon { color: #a5b4fc; opacity: 1; }
.sidebar-bottom { margin-top: auto; padding-top: 10px; }
.account { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); }
.account form { margin-left: auto; }
.account-info { min-width: 0; color: inherit; }
.account-info:hover { text-decoration: none; }
.account-info strong { display: block; color: #fff; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.account-info small { color: var(--sidebar-muted); font-size: .74rem; }
.account .icon-btn { color: var(--sidebar-text); }
.account .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444); flex: none; }
.avatar.xl { width: 72px; height: 72px; border-radius: 22px; font-size: 1.5rem; }
.sidebar-scrim { display: none; }

.workspace { margin-left: 272px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .9rem; }
.breadcrumb strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-muted { color: var(--muted); }
.crumb-sep { width: 14px; height: 14px; color: var(--muted); }
.icon-btn.mobile-menu { display: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.term-switch { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--muted); }
.term-switch select { border: 0; background: transparent; padding: 5px 26px 5px 2px; font-weight: 650; color: var(--text); box-shadow: none; min-height: 0; }
.term-switch select:focus { box-shadow: none; }
.theme-toggle .only-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .only-dark { display: block; }
:root[data-theme="dark"] .theme-toggle .only-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .only-dark { display: block; } :root:not([data-theme="light"]) .theme-toggle .only-light { display: none; } }
.main-content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 28px 22px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn { --b: var(--border-strong); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border-radius: 11px; border: 1px solid var(--b); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .88rem; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .15s, background .15s, border-color .15s; }
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary-text); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }
.btn.primary { border: 0; color: #fff; background: linear-gradient(135deg, #5b50f0, #7c3aed); box-shadow: 0 8px 20px -8px rgba(91, 80, 240, .75), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.primary:hover { color: #fff; box-shadow: 0 12px 26px -8px rgba(91, 80, 240, .85), inset 0 1px 0 rgba(255, 255, 255, .25); filter: brightness(1.05); }
.btn.danger { border: 0; color: #fff; background: linear-gradient(135deg, #f43f5e, #e11d48); }
.btn.danger:hover { color: #fff; filter: brightness(1.06); }
.btn.danger.ghost { background: transparent; color: var(--rose); border: 1px solid color-mix(in srgb, var(--rose) 40%, transparent); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.light { border: 0; background: #fff; color: #3730a3; }
.btn.light:hover { color: #312e81; }
.btn.glass { color: #fff; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); box-shadow: none; }
.btn.glass:hover { color: #fff; background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .4); }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: .8rem; border-radius: 9px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn.lg { min-height: 48px; font-size: .95rem; }
.btn.full { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); text-decoration: none; }
.topbar .icon-btn { background: var(--surface); border: 1px solid var(--border); }
.text-button { border: 0; background: none; font: inherit; font-weight: 600; font-size: .82rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.danger-text { color: var(--rose) !important; }
.text-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; font-size: .86rem; }
.text-link .icon { width: 15px; height: 15px; }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .icon { width: 13px; height: 13px; }
.badge.mint { background: var(--mint-soft); color: var(--mint); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.rose { background: var(--rose-soft); color: var(--rose); }
.badge.indigo { background: var(--primary-soft); color: var(--primary-text); }
.badge.neutral { background: var(--surface-3); color: var(--text-2); }
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; font-weight: 550; border: 1px solid; }
.alert span { flex: 1; }
.alert.success { background: var(--mint-soft); color: var(--mint); border-color: color-mix(in srgb, var(--mint) 25%, transparent); }
.alert.error { background: var(--rose-soft); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 25%, transparent); }
.alert button { border: 0; background: none; color: inherit; cursor: pointer; display: grid; padding: 2px; border-radius: 6px; }
.toast { animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.info-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; background: var(--primary-soft); color: var(--text-2); font-size: .86rem; border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent); }
.info-note > .icon { color: var(--primary-text); margin-top: 1px; }

/* ---------- Page heading ---------- */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-heading p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.page-heading .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-label { display: inline-block; margin-bottom: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .12em; color: var(--primary-text); }
.section-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 4px 2px -6px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel.padded { padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; flex-wrap: wrap; }
.panel-heading.flush { padding: 0 0 12px; }
.panel-heading p { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); }
.empty-state > .icon { width: 46px; height: 46px; padding: 11px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-text); }
.empty-state h3 { color: var(--text); }
.empty-state .btn { margin-top: 6px; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px 16px !important; }

/* ---------- Hero / dashboard ---------- */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 32px; border-radius: 22px; color: #fff;
  background: radial-gradient(60% 120% at 100% 0%, rgba(45, 212, 191, .45), transparent 60%), radial-gradient(50% 90% at 0% 100%, rgba(236, 72, 153, .35), transparent 60%), linear-gradient(120deg, #3730a3, #5b21b6 55%, #4338ca);
  box-shadow: 0 24px 50px -24px rgba(67, 56, 202, .7); }
.hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px); background-size: 18px 18px; mask-image: linear-gradient(90deg, transparent 30%, #000); -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); pointer-events: none; }
.hero h1 { color: #fff; font-size: 1.85rem; margin: 10px 0 6px; }
.hero p { color: rgba(255, 255, 255, .82); max-width: 52ch; }
.hero-text { position: relative; z-index: 1; }
.hero-label { display: inline-flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 800; letter-spacing: .12em; padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 0 rgba(94, 234, 212, .7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(94, 234, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); } }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-ring { position: relative; z-index: 1; width: 150px; height: 150px; flex: none; display: grid; place-items: center; }
.hero-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 12; }
.ring-fg { fill: none; stroke: #5eead4; stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.hero-ring div { text-align: center; line-height: 1.1; }
.hero-ring strong { display: block; font-size: 2rem; font-weight: 800; }
.hero-ring small { color: rgba(255, 255, 255, .75); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: currentColor; opacity: .06; }
.stat-card.indigo { color: var(--primary); } .stat-card.teal { color: var(--teal); } .stat-card.amber { color: var(--amber); } .stat-card.violet { color: var(--violet); }
.stat-card > div { color: var(--text); }
.stat-label { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-card strong { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.stat-card small { color: var(--muted); }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.indigo { background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-icon.rose { background: var(--rose-soft); color: var(--rose); }
.stat-icon.mint { background: var(--mint-soft); color: var(--mint); }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }

progress { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 99px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #6366f1, #14b8a6); border-radius: 99px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #6366f1, #14b8a6); border-radius: 99px; }

.task-list, .class-progress-list { display: flex; flex-direction: column; padding: 0 12px 12px; }
.task, .class-progress { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; color: inherit; }
.task:hover { background: var(--surface-2); text-decoration: none; }
.task-info, .class-progress-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-info small, .class-progress-info small { color: var(--muted); }
.class-progress-info > div { display: flex; justify-content: space-between; gap: 8px; }
.progress-percent { font-weight: 800; font-size: .9rem; min-width: 44px; text-align: right; }
.class-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .78rem; flex: none; background: var(--primary-soft); color: var(--primary-text); }
.class-avatar.l8 { background: var(--teal-soft); color: var(--teal); }
.class-avatar.l9 { background: var(--amber-soft); color: var(--amber); }
.class-avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: .68rem; }
.class-avatar.lg { width: 52px; height: 52px; border-radius: 15px; font-size: .95rem; }

.hbars { display: flex; flex-direction: column; gap: 9px; padding: 4px 20px 20px; }
.hbar { display: grid; grid-template-columns: 64px 1fr 44px; gap: 12px; align-items: center; }
.hbar-label { font-size: .78rem; font-weight: 700; color: var(--text-2); }
.hbar-track { width: 100%; height: 10px; display: block; }
.hbar-track .track { fill: var(--surface-3); }
.hbar-value { text-align: right; font-weight: 750; font-size: .84rem; }
.fill.band-sb, .bar.b4 { fill: var(--band-sb); } .fill.band-b, .bar.b3 { fill: var(--band-b); } .fill.band-c, .bar.b2 { fill: var(--band-c); } .fill.band-k, .bar.b0 { fill: var(--band-k); }
.bar.b1 { fill: #fb923c; }
.histogram { width: 100%; height: auto; padding: 0 14px 14px; display: block; }
.histogram .bar-value { font-size: 10px; font-weight: 700; fill: var(--text); }
.histogram .bar-label { font-size: 9px; fill: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0 20px 18px; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.checklist a { color: var(--text-2); }
.check-dot { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.check-dot .icon { width: 14px; height: 14px; }
.checklist li.done .check-dot { background: var(--mint-soft); color: var(--mint); }
.checklist li.done a { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.activity { list-style: none; margin: 0; padding: 0 12px 12px; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; }
.activity li div { flex: 1; min-width: 0; }
.activity strong { display: block; font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity small { color: var(--muted); }
.activity time { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.score-badge { width: 40px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; font-size: .88rem; background: var(--surface-3); flex: none; }
.score-badge.band-sb, .cell-score.band-sb, .final.band-sb { background: color-mix(in srgb, var(--band-sb) 16%, transparent); color: color-mix(in srgb, var(--band-sb) 80%, var(--text)); }
.score-badge.band-b, .cell-score.band-b, .final.band-b { background: color-mix(in srgb, var(--band-b) 14%, transparent); color: color-mix(in srgb, var(--band-b) 80%, var(--text)); }
.score-badge.band-c, .cell-score.band-c, .final.band-c { background: color-mix(in srgb, var(--band-c) 18%, transparent); color: color-mix(in srgb, var(--band-c) 75%, var(--text)); }
.score-badge.band-k, .cell-score.band-k, .final.band-k { background: color-mix(in srgb, var(--band-k) 15%, transparent); color: color-mix(in srgb, var(--band-k) 85%, var(--text)); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 11px 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.row-active td { background: var(--primary-soft) !important; }
.row-muted td { opacity: .55; }
.cell-sub { display: block; color: var(--muted); font-size: .76rem; margin-top: 1px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.student-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .74rem; font-weight: 800; background: var(--sky-soft); color: var(--sky); flex: none; }
.student-avatar.pink { background: #fde7f3; color: #be185d; }
:root[data-theme="dark"] .student-avatar.pink { background: rgba(236, 72, 153, .14); color: #f9a8d4; }
.student-avatar.sm { width: 30px; height: 30px; border-radius: 9px; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 18px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); }
.col-check { width: 44px; text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .84rem; color: var(--text-2); }
input, select, textarea { width: 100%; font: inherit; font-size: .9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a90b4' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
input:disabled, select:disabled, textarea:disabled { opacity: .65; cursor: not-allowed; background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--primary); cursor: pointer; flex: none; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 650; font-size: .82rem; border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px; background: var(--primary-soft); color: var(--primary-text); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.checkbox-label { flex-direction: row; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: .84rem; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.check-grid legend { grid-column: 1 / -1; }
.switch { flex-direction: row; align-items: center; gap: 12px; cursor: pointer; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--border-strong); flex: none; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + .switch-ui { background: linear-gradient(135deg, #6366f1, #7c3aed); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch b, .radio-cards b { display: block; color: var(--text); }
.switch small, .radio-cards small { color: var(--muted); font-weight: 500; }
.radio-cards { display: flex; flex-direction: column; gap: 8px; }
.radio-cards label { flex-direction: row; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.radio-cards label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-cards input { margin-top: 2px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.segmented label { flex-direction: row; cursor: pointer; flex: 1; min-width: 180px; }
.segmented label input { position: absolute; opacity: 0; width: 1px; }
.segmented label span { flex: 1; padding: 10px 14px; border-radius: 9px; font-weight: 700; color: var(--text-2); }
.segmented label span small { display: block; font-weight: 500; color: var(--muted); }
.segmented label input:checked + span { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow); }
.segmented label input:focus-visible + span { outline: 2px solid var(--primary); }
.segmented.compact a { padding: 7px 13px; border-radius: 9px; font-weight: 650; font-size: .84rem; color: var(--text-2); }
.segmented.compact a:hover { text-decoration: none; color: var(--text); }
.segmented.compact a.active { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow); }
.dropzone { align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 22px; border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.dropzone > .icon { width: 28px; height: 28px; color: var(--primary-text); }
.dropzone input { max-width: 300px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; background: none; font: inherit; font-weight: 650; color: var(--muted); padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--primary-text); border-color: var(--primary); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px; }
.password-field .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; }

.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px 18px; }
.filter-bar.flush { padding: 0; }
.filter-bar label { min-width: 180px; }
.filter-bar .flex-grow { flex: 1; min-width: 220px; }
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 38px; }
.filter-bar > select { width: auto; min-width: 180px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; min-width: 160px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); margin-left: auto; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend i.band-sb { background: var(--band-sb); } .legend i.band-b { background: var(--band-b); } .legend i.band-c { background: var(--band-c); } .legend i.band-k { background: var(--band-k); }

/* ---------- Dialog ---------- */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.wide { width: min(820px, calc(100vw - 24px)); }
dialog[open] { animation: dialog-in .25s cubic-bezier(.2, .9, .3, 1.1); }
dialog::backdrop { background: rgba(9, 12, 32, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
dialog.confirm { width: min(420px, calc(100vw - 24px)); text-align: center; }
dialog.confirm form { display: flex; flex-direction: column; align-items: center; gap: 10px; }
dialog.confirm p { color: var(--muted); }
dialog.confirm .form-actions { justify-content: center; margin-top: 8px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--rose-soft); color: var(--rose); }
.confirm-icon .icon { width: 26px; height: 26px; }
.tab-panel[hidden] { display: none; }

/* ---------- Settings & misc pages ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.sticky-actions { grid-column: 1 / -1; position: sticky; bottom: 14px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.save-status { color: var(--muted); font-size: .82rem; }
.save-status.dirty { color: var(--amber); font-weight: 650; }
.logo-preview { height: 120px; border-radius: 14px; display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface-2) 0 50%) 0 0 / 16px 16px; border: 1px solid var(--border); }
.logo-preview img { max-height: 100px; max-width: 80%; object-fit: contain; }
.logo-preview .icon { width: 42px; height: 42px; color: var(--muted); }
.class-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.class-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: transform .15s, box-shadow .15s; }
.class-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.class-card-head { display: flex; align-items: center; gap: 12px; }
.class-card-head small { color: var(--muted); }
.class-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.class-meta div { text-align: center; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.class-meta strong { display: block; font-size: 1.15rem; }
.class-meta small { color: var(--muted); font-size: .72rem; }
.class-teacher { display: flex; gap: 10px; align-items: center; }
.class-teacher small { display: block; color: var(--muted); font-size: .72rem; }
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.side-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.side-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.side-list a span:nth-child(2) { flex: 1; }
.side-list a small { color: var(--muted); }
.side-list a:hover { background: var(--surface-2); text-decoration: none; }
.side-list a.active { background: var(--primary-soft); color: var(--primary-text); }
.tp-list { list-style: none; margin: 0; padding: 0 12px 12px; counter-reset: tp; }
.tp-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 8px; border-bottom: 1px dashed var(--border); }
.tp-list li:last-child { border-bottom: 0; }
.tp-list p { flex: 1; }
.tp-code { font-family: var(--mono); font-weight: 700; font-size: .76rem; padding: 3px 8px; border-radius: 7px; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mini-stats > div { padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.mini-stats small { display: block; color: var(--muted); font-weight: 600; font-size: .76rem; }
.mini-stats strong { font-size: 1.3rem; font-weight: 800; }
.mini-stats .small-text { font-size: .92rem; display: block; margin-top: 4px; }
.text-rose { color: var(--rose); } .text-amber { color: var(--amber); }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; padding: 5px 11px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .8rem; font-weight: 600; }
details.panel summary { cursor: pointer; }
details.panel .chips { margin-top: 12px; }
.activity-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.activity-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
.activity-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); transform: translateY(-1px); }
.activity-card.active { border-color: var(--primary); background: linear-gradient(135deg, var(--primary-soft), transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.activity-card small { color: var(--muted); }
.card-edit { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.card-edit:hover { background: var(--surface-3); color: var(--text); }
.card-edit .icon { width: 15px; height: 15px; }
.doc-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-picker legend { margin-bottom: 6px; }
.doc-option { flex-direction: row; cursor: pointer; }
.doc-option input { position: absolute; opacity: 0; width: 1px; }
.doc-option span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 11px; border: 1px solid var(--border-strong); font-weight: 650; color: var(--text-2); transition: all .15s; }
.doc-option input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.doc-option input:focus-visible + span { outline: 2px solid var(--primary); }
.mini-progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.mini-progress span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-right: 7px; }
.dot.ok { background: var(--band-sb); box-shadow: 0 0 0 3px color-mix(in srgb, var(--band-sb) 20%, transparent); }
.profile-card { display: flex; gap: 16px; align-items: center; }
.profile-card h2 { font-size: 1.2rem; }
.bulk-bar select { min-height: 34px; padding-top: 5px; padding-bottom: 5px; }

/* ---------- Grade sheets ---------- */
.grade-wrap { max-height: calc(100vh - 220px); overflow: auto; }
.grade-table th { position: sticky; top: 0; z-index: 2; }
.grade-table td { padding: 8px 10px; vertical-align: top; }
.grade-table .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.grade-table th.sticky-col { z-index: 3; background: var(--surface-2); }
.grade-table .sticky-col.name-col { left: 44px; min-width: 190px; box-shadow: 6px 0 8px -8px rgba(0, 0, 0, .25); }
.grade-table .no-col { color: var(--muted); font-weight: 600; width: 44px; text-align: center; }
.name-col strong { display: block; font-size: .87rem; }
.num-col { text-align: center; width: 76px; }
.final-col { width: 92px; }
.desc-col { min-width: 320px; }
.dim-col { text-align: center; min-width: 120px; }
th.dim-col { white-space: normal; }
.score-input { width: 62px; min-height: 38px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; padding: 6px 4px; }
.score-input.sas { background: color-mix(in srgb, var(--violet-soft) 70%, var(--surface)); }
.score-input.invalid { border-color: var(--rose); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 18%, transparent); }
.score-input.under { color: var(--rose); }
output.final { display: inline-grid; place-items: center; min-width: 52px; height: 38px; padding: 0 8px; border-radius: 10px; font-weight: 800; font-size: 1rem; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.final-flash { animation: flash .6s; }
@keyframes flash { 30% { transform: scale(1.12); } }
.desc-box { position: relative; }
.desc-box textarea { min-height: 62px; font-size: .84rem; padding-bottom: 28px; }
.desc-mode { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 0; font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; background: var(--surface-3); color: var(--muted); }
.desc-mode .icon { width: 12px; height: 12px; }
.desc-mode.is-auto { background: var(--primary-soft); color: var(--primary-text); }
.save-bar { position: sticky; bottom: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 0 0 var(--radius) var(--radius); }
.save-bar > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; }
.grade-pill { width: 76px; min-height: 34px; padding: 4px 22px 4px 10px; font-weight: 800; text-align: center; background-position: right 7px center; }
.grade-pill.g-sb { background-color: color-mix(in srgb, var(--band-sb) 16%, var(--surface)); color: color-mix(in srgb, var(--band-sb) 80%, var(--text)); }
.grade-pill.g-b { background-color: color-mix(in srgb, var(--band-b) 14%, var(--surface)); color: color-mix(in srgb, var(--band-b) 80%, var(--text)); }
.grade-pill.g-c { background-color: color-mix(in srgb, var(--band-c) 18%, var(--surface)); color: color-mix(in srgb, var(--band-c) 75%, var(--text)); }
.grade-pill.g-pb { background-color: color-mix(in srgb, var(--band-k) 15%, var(--surface)); color: color-mix(in srgb, var(--band-k) 85%, var(--text)); }
.desc-preview td { background: var(--surface-2) !important; color: var(--text-2); font-size: .82rem; padding-top: 6px; }
.desc-preview .icon { width: 14px; height: 14px; color: var(--primary-text); vertical-align: -2px; margin-right: 6px; }
.attendance-table .num-col { width: 64px; }
.attendance-table .score-input { width: 52px; }
.attendance-table select { min-width: 170px; }
.ledger-wrap { max-height: calc(100vh - 230px); overflow: auto; }
.ledger th { position: sticky; top: 0; z-index: 2; }
.ledger td, .ledger th { padding: 8px 9px; }
.ledger .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.ledger th.sticky-col { z-index: 3; background: var(--surface-2); }
.ledger .sticky-col.name-col { left: 40px; min-width: 200px; box-shadow: 6px 0 8px -8px rgba(0, 0, 0, .25); }
.ledger .num-col { width: 58px; }
.cell-score { display: inline-grid; place-items: center; min-width: 38px; height: 28px; border-radius: 8px; font-weight: 750; font-variant-numeric: tabular-nums; font-size: .84rem; }
.missing { color: var(--border-strong); }
.rank { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: .8rem; background: var(--surface-3); }
.rank.r1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; }
.rank.r2 { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #1f2937; }
.rank.r3 { background: linear-gradient(135deg, #fed7aa, #c2410c); color: #fff; }
.ledger tfoot td { font-weight: 750; background: var(--surface-2); border-top: 2px solid var(--border); position: sticky; bottom: 0; }
.ledger tfoot .sticky-col { background: var(--surface-2); }

/* ---------- Auth & install ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--bg); }
.auth-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; padding: 40px 56px; color: #fff;
  background: radial-gradient(70% 60% at 100% 0%, rgba(45, 212, 191, .4), transparent 60%), radial-gradient(60% 60% at 0% 100%, rgba(236, 72, 153, .35), transparent 60%), linear-gradient(140deg, #1e1b4b, #3730a3 50%, #5b21b6); }
.auth-story::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 22px 22px; mask-image: radial-gradient(70% 70% at 70% 30%, #000, transparent); -webkit-mask-image: radial-gradient(70% 70% at 70% 30%, #000, transparent); pointer-events: none; }
.auth-story > * { position: relative; z-index: 1; }
.auth-hero h1 { color: #fff; font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.08; letter-spacing: -.03em; margin: 16px 0; }
.auth-hero p { color: rgba(255, 255, 255, .8); max-width: 48ch; font-size: 1.02rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 800; letter-spacing: .14em; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }
.eyebrow .icon { width: 15px; height: 15px; }
.gradient-text { background: linear-gradient(90deg, #5eead4, #a5b4fc, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-features { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .88); }
.auth-features .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #5eead4; }
.auth-card-art { align-self: flex-end; width: min(360px, 100%); padding: 16px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); transform: rotate(-2deg); }
.mock-row { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); margin-bottom: 8px; font-size: .88rem; }
.mock-row span { font-weight: 800; color: #5eead4; }
.mock-desc { font-size: .8rem; color: rgba(255, 255, 255, .75); padding: 4px 4px 0; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px 20px; }
.auth-main > footer { margin-top: auto; padding-top: 30px; color: var(--muted); font-size: .8rem; }
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; margin-top: auto; }
.auth-form h2 { font-size: 1.8rem; letter-spacing: -.02em; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; }
.auth-help { color: var(--muted); font-size: .84rem; text-align: center; }
.install-page { min-height: 100vh; padding: 40px 16px; background: radial-gradient(60% 50% at 100% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent), radial-gradient(50% 40% at 0% 100%, color-mix(in srgb, var(--teal) 14%, transparent), transparent), var(--bg); }
.install-card { width: min(720px, 100%); margin: 0 auto; padding: 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.install-card .brand { color: var(--text); }
.install-card .brand-tag { background: var(--primary-soft); color: var(--primary-text); }
.install-card h1 { font-size: 1.6rem; margin-top: 8px; }
.install-card h3 { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.step { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #6366f1, #7c3aed); }
[data-show-when][hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats-grid, .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-columns, .settings-grid, .split.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.open ~ .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(9, 12, 32, .5); backdrop-filter: blur(2px); }
  .icon-btn.sidebar-close { display: inline-grid; color: var(--sidebar-text); }
  .workspace { margin-left: 0; }
  .icon-btn.mobile-menu { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .main-content { padding: 18px 16px 32px; }
  .app-footer { padding: 14px 16px 20px; flex-direction: column; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .side-list { position: static; flex-direction: row; overflow-x: auto; }
  .side-list a { flex: none; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-story { padding: 28px 22px; }
  .auth-card-art { display: none; }
  .crumb-muted, .crumb-sep { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .hero { flex-direction: column; align-items: flex-start; padding: 22px; }
  .hero h1 { font-size: 1.45rem; }
  .hero-ring { width: 120px; height: 120px; align-self: center; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.three, .check-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .term-switch .icon { display: none; }
  .term-switch select { max-width: 160px; font-size: .8rem; }
  .breadcrumb strong { display: none; }
  .filter-bar label, .filter-bar > select, .inline-form select { min-width: 0; width: 100%; }
  .page-heading .actions { width: 100%; }
  .install-card { padding: 22px; }
  .desc-col { min-width: 240px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Impor data ---------- */
.how-it-works { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.how-it-works > div { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.how-it-works .step { grid-row: span 2; }
.how-it-works small { color: var(--muted); }
.import-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.import-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.import-card-head { display: flex; align-items: center; gap: 12px; }
.import-card-head .mini-label { margin-bottom: 2px; }
.upload-form { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.upload-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dropzone.compact { flex-direction: row; padding: 12px; gap: 10px; }
.dropzone.compact > .icon { width: 22px; height: 22px; }
.dropzone.compact { flex-wrap: wrap; justify-content: flex-start; text-align: left; }
.dropzone.compact input { flex: 1 1 100%; max-width: 100%; }
.import-report { border-width: 2px; }
.import-report.has-errors { border-color: color-mix(in srgb, var(--rose) 45%, var(--border)); }
.import-report.is-saved { border-color: color-mix(in srgb, var(--mint) 45%, var(--border)); }
.import-report.is-checked { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.import-report h2 { display: flex; align-items: center; gap: 8px; }
.mini-stats.inset { padding: 0 20px 16px; }
.mini-stats.inset > div { box-shadow: none; background: var(--surface-2); }
.report-foot { padding: 12px 20px 16px; font-size: .86rem; }
@media (max-width: 900px) { .how-it-works { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .how-it-works { grid-template-columns: minmax(0, 1fr); } .import-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Kosongkan data ---------- */
.danger-zone { border: 2px solid color-mix(in srgb, var(--rose) 35%, var(--border)); }
.danger-zone h2 { display: flex; align-items: center; gap: 8px; color: var(--rose); }
.reset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.reset-option { flex-direction: row; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 500; }
.reset-option:has(input:checked) { border-color: var(--rose); background: var(--rose-soft); }
.reset-option.recommended { border-style: dashed; border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.reset-option b { display: block; color: var(--text); }
.reset-option small { color: var(--muted); }
.reset-option input { margin-top: 2px; }
.form-actions.align-end { align-items: flex-end; }
