/* ==========================================================================
   UniSZA English Roster — design system
   ========================================================================== */

:root {
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Neutrals: warm paper */
  --bg: hsl(40 24% 96%);
  --bg-glow-1: hsl(214 70% 92% / 0.55);
  --bg-glow-2: hsl(42 90% 88% / 0.45);
  --surface: hsl(0 0% 100%);
  --surface-2: hsl(40 22% 97.5%);
  --surface-3: hsl(40 16% 93.5%);
  --surface-hover: hsl(40 20% 95.5%);
  --ink: hsl(222 32% 14%);
  --ink-2: hsl(222 13% 36%);
  --ink-3: hsl(222 9% 54%);
  --line: hsl(36 16% 88%);
  --line-strong: hsl(36 11% 78%);

  /* Brand: UniSZA navy + gold */
  --brand: hsl(214 64% 26%);
  --brand-hover: hsl(214 66% 21%);
  --brand-ink: hsl(0 0% 100%);
  --brand-soft: hsl(214 60% 95%);
  --brand-soft-ink: hsl(214 60% 30%);
  --gold: hsl(43 92% 52%);
  --gold-soft: hsl(45 95% 91%);
  --gold-ink: hsl(34 78% 27%);

  /* Course tiers */
  --t1: hsl(22 84% 54%);  --t1-soft: hsl(24 92% 94%);  --t1-ink: hsl(20 72% 33%);
  --t2: hsl(170 58% 36%); --t2-soft: hsl(168 46% 92%); --t2-ink: hsl(172 62% 22%);
  --t3: hsl(218 72% 52%); --t3-soft: hsl(218 85% 95%); --t3-ink: hsl(220 62% 34%);
  --t0: hsl(222 8% 60%);  --t0-soft: hsl(222 14% 93%); --t0-ink: hsl(222 12% 38%);

  --warn-soft: hsl(4 85% 95%);
  --warn-ink: hsl(4 64% 40%);
  --ok: hsl(150 52% 38%);
  --ok-soft: hsl(148 48% 92%);

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 1px hsl(222 32% 14% / 0.04);
  --shadow-sm: 0 1px 2px hsl(222 32% 14% / 0.06), 0 0 0 1px hsl(222 32% 14% / 0.045);
  --shadow: 0 1px 2px hsl(222 32% 14% / 0.05), 0 0 0 1px hsl(222 32% 14% / 0.05), 0 12px 32px -18px hsl(222 40% 20% / 0.28);
  --shadow-lg: 0 2px 4px hsl(222 32% 14% / 0.06), 0 24px 48px -16px hsl(222 40% 16% / 0.35);
  --ring: 0 0 0 3px hsl(214 80% 55% / 0.28);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sidebar-w: 248px;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme='dark'] {
  --bg: hsl(220 22% 8.5%);
  --bg-glow-1: hsl(214 60% 30% / 0.22);
  --bg-glow-2: hsl(40 70% 40% / 0.10);
  --surface: hsl(220 18% 12%);
  --surface-2: hsl(220 17% 14%);
  --surface-3: hsl(220 15% 18%);
  --surface-hover: hsl(220 16% 16%);
  --ink: hsl(40 20% 94%);
  --ink-2: hsl(220 10% 72%);
  --ink-3: hsl(220 8% 56%);
  --line: hsl(220 14% 20%);
  --line-strong: hsl(220 12% 28%);

  --brand: hsl(212 78% 64%);
  --brand-hover: hsl(212 82% 70%);
  --brand-ink: hsl(222 40% 10%);
  --brand-soft: hsl(214 40% 20%);
  --brand-soft-ink: hsl(212 80% 80%);
  --gold-soft: hsl(40 50% 18%);
  --gold-ink: hsl(44 90% 68%);

  --t1-soft: hsl(22 45% 18%);  --t1-ink: hsl(24 92% 72%);
  --t2-soft: hsl(170 35% 15%); --t2-ink: hsl(166 55% 62%);
  --t3-soft: hsl(218 40% 20%); --t3-ink: hsl(216 90% 76%);
  --t0-soft: hsl(220 12% 20%); --t0-ink: hsl(220 10% 70%);

  --warn-soft: hsl(4 40% 18%);
  --warn-ink: hsl(6 85% 74%);
  --ok-soft: hsl(150 30% 16%);
  --ok: hsl(150 50% 58%);

  --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.3), 0 0 0 1px hsl(0 0% 100% / 0.05);
  --shadow: 0 1px 2px hsl(0 0% 0% / 0.3), 0 0 0 1px hsl(0 0% 100% / 0.055), 0 16px 36px -18px hsl(0 0% 0% / 0.6);
  --shadow-lg: 0 2px 4px hsl(0 0% 0% / 0.35), 0 24px 48px -16px hsl(0 0% 0% / 0.7);
  --ring: 0 0 0 3px hsl(212 80% 60% / 0.35);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    var(--noise),
    radial-gradient(1200px 600px at 100% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 0;
}

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
code { font-family: var(--font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: 5px; background: var(--surface-3); }
kbd { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 17px; background: var(--surface-2); }
:focus-visible { outline: none; box-shadow: var(--ring); }
svg { display: block; width: 100%; height: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(12px);
}

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 0 6px; }
.brand-logo {
  flex: none;
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-logo img { display: block; height: 34px; width: auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; padding-left: 2px; }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.015em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.is-active { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -8px hsl(214 64% 26% / 0.6); }
.nav-icon { width: 18px; height: 18px; flex: none; }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.nav-item.is-active .nav-badge { background: var(--gold); color: hsl(34 80% 18%); }

.sidebar-foot { margin-top: auto; display: flex; align-items: flex-end; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.source-list { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.source { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.source-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; }
.source-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.source-dot.is-wait { background: var(--gold); }
.source-name { font-weight: 600; }
.source-meta { color: var(--ink-3); margin-left: auto; white-space: nowrap; }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 64px; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); display: flex; gap: 6px; }
.eyebrow-sep { opacity: 0.6; }
.page-title { margin-top: 4px; font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.page-intro { margin-top: 6px; color: var(--ink-2); max-width: 60ch; }

.view { display: flex; flex-direction: column; gap: 18px; }

/* ---------- surfaces ---------- */
.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.section-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.section-head p { margin-top: 4px; max-width: 75ch; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-hover); box-shadow: var(--shadow-sm), 0 4px 12px -6px hsl(222 30% 14% / 0.2); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 0 hsl(0 0% 100% / 0.12) inset, 0 6px 16px -8px hsl(214 64% 26% / 0.65); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-quiet { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-3); box-shadow: none; color: var(--ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 16px; height: 16px; flex: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 7px;
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.icon-btn:active:not(:disabled) { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.35; }

.link { border: 0; padding: 0; background: none; color: var(--brand); font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
.link-quiet { color: var(--ink); font-weight: 400; text-decoration: none; text-align: left; }
.link-quiet:hover { color: var(--brand); text-decoration: underline; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 340px;
  height: 36px;
  padding: 0 10px 0 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.search:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--brand), var(--ring); }
.search-icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search:focus-within kbd { display: none; }

.select, .input {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background-color: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.15s var(--ease);
}
.select {
  appearance: none;
  padding-right: 32px;
  flex: 0 1 200px;
  min-width: 120px;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878d99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 15px;
  background-position: right 10px center;
}
.select-sm { flex-basis: 140px; }
.select:hover, .input:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.select:focus, .input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--brand), var(--ring); }
.select:disabled { opacity: 0.5; }
.select option { background: var(--surface); color: var(--ink); }

.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 12px;
  background: var(--surface-3);
  box-shadow: inset 0 1px 2px hsl(222 30% 14% / 0.06);
  flex: none;
}
.segmented-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.segmented-item:hover { color: var(--ink); }
.segmented-item.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-3); }

/* ---------- chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill-muted { background: var(--surface-3); color: var(--ink-3); font-weight: 500; }
.pill-warn { background: var(--warn-soft); color: var(--warn-ink); }

.course-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 8px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--tier-soft, var(--t0-soft));
  color: var(--tier-ink, var(--t0-ink));
}
.course-chip::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--tier, var(--t0)); }
.tier-1 { --tier: var(--t1); --tier-soft: var(--t1-soft); --tier-ink: var(--t1-ink); }
.tier-2 { --tier: var(--t2); --tier-soft: var(--t2-soft); --tier-ink: var(--t2-ink); }
.tier-3 { --tier: var(--t3); --tier-soft: var(--t3-soft); --tier-ink: var(--t3-ink); }

.group-list { display: flex; flex-wrap: wrap; gap: 4px; }
.group-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  color: var(--ink-2);
}
.group-chip.is-warn { background: var(--warn-soft); color: var(--warn-ink); }
.group-name { font-family: var(--font-mono); font-weight: 500; margin-right: 6px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 16px 18px 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat:active { transform: translateY(0); }
.stat.is-selected { background: linear-gradient(180deg, var(--tier-soft, var(--brand-soft)), var(--surface) 140%); }
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.stat .course-code { font-family: var(--font-mono); color: var(--tier-ink); font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); min-height: 22px; }
.stat-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--surface-3); }
.stat-bar > span { display: block; height: 100%; background: var(--tier); border-radius: 0 3px 3px 0; transition: width 0.6s var(--ease); }
.stat-total.is-selected { background: linear-gradient(180deg, var(--brand-soft), var(--surface) 140%); }

/* ---------- toolbar / table ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.toolbar-spacer { flex: 1; }

.context { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.context-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.context-text { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.context-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.context-groups { color: var(--ink-2); }
.context-by { color: var(--ink-3); }
.context-actions { display: flex; align-items: center; gap: 6px; }

.table-wrap { overflow: auto; max-height: min(70vh, 900px); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}
.table th:not(:has(.th-btn)) { padding: 10px 14px; }
.table th.num { text-align: right; }
.th-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
}
.th-btn:hover { color: var(--ink); }
.th-icon { width: 13px; height: 13px; opacity: 0.35; transition: opacity 0.15s; }
.th-btn:hover .th-icon { opacity: 0.7; }
.th-icon.is-active { opacity: 1; color: var(--brand); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.table-compact td { padding: 8px 14px; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions > * { vertical-align: middle; }
.table .actions .icon-btn { margin-right: 2px; }

.col-order { width: 56px; color: var(--ink-3); }
.col-matric { white-space: nowrap; color: var(--ink-2); }
.col-name { min-width: 180px; }
.col-name .name { font-weight: 500; }
.col-program { min-width: 260px; }
.program { display: block; font-size: 13px; color: var(--ink); line-height: 1.35; }
.faculty { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); line-height: 1.3; }
.col-score .score { display: inline-block; min-width: 34px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager-label { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); }
.empty.small { padding: 24px 12px; font-size: 13px; }
.empty-title { font-weight: 600; color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty-card { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ok-icon { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); margin-bottom: 6px; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.callout-icon { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--brand); }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--radius-sm); font-size: 13px; }
.banner-error { background: var(--warn-soft); color: var(--warn-ink); }
.banner-icon { width: 18px; height: 18px; flex: none; }

/* ---------- upload ---------- */
.upload { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 320px;
  padding: 32px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(400px 200px at 50% 0%, var(--brand-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}
.dropzone:hover { border-color: var(--brand); }
.dropzone.is-over { border-color: var(--brand); transform: scale(1.01); }
.dropzone-icon { width: 52px; height: 52px; padding: 13px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); box-shadow: 0 10px 24px -10px hsl(214 64% 26% / 0.7); }
.dropzone-title { margin-top: 6px; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.dropzone-text { max-width: 42ch; color: var(--ink-2); }
.dropzone-sm { min-height: 0; flex-direction: row; padding: 16px; gap: 12px; box-shadow: none; background: var(--surface-2); border-radius: var(--radius); }
.dropzone-sm .dropzone-icon { width: 36px; height: 36px; padding: 9px; border-radius: 10px; box-shadow: none; }

.upload-side { display: flex; flex-direction: column; gap: 12px; }
.note { display: flex; gap: 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--ink-2); font-size: 13px; }
.note-title { font-weight: 600; color: var(--ink); margin-bottom: 3px; font-size: 14px; }
.note-icon { width: 34px; height: 34px; padding: 8px; flex: none; border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); }

.loading-card { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 64px 20px; color: var(--ink-2); }
.loading-icon { width: 22px; height: 22px; color: var(--brand); }

/* ---------- lecturers ---------- */
.split { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.list-pane { position: sticky; top: 20px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); overflow: hidden; }
.pane-head { padding: 14px; border-bottom: 1px solid var(--line); }
.pane-head .search { max-width: none; }
.pane-count { margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.lect-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.lect-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  transition: background 0.15s var(--ease);
}
.lect-item:hover { background: var(--surface-hover); }
.lect-item.is-active { background: var(--brand-soft); }
.lect-item.is-active .avatar { background: var(--brand); color: var(--brand-ink); }
.lect-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.lect-name { font-size: 13px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lect-meta { font-size: 12px; color: var(--ink-3); }
.load-bar { display: block; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.load-bar > span { display: block; height: 100%; border-radius: 2px; background: var(--gold); transition: width 0.5s var(--ease); }

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.avatar-lg { width: 48px; height: 48px; border-radius: 14px; font-size: 15px; background: var(--brand); color: var(--brand-ink); }

.detail-pane { padding: 22px; min-height: 420px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.detail-title { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.detail-id .muted { font-family: var(--font-mono); font-size: 12px; margin-top: 2px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 20px 0 8px; border-radius: var(--radius); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.kpis > div { padding: 12px 16px; }
.kpis > div + div { border-left: 1px solid var(--line); }
.kpis dt { font-size: 12px; color: var(--ink-3); }
.kpis dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.course-block { margin-top: 22px; }
.course-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.course-title { font-weight: 600; text-transform: capitalize; }
.course-count { margin-left: auto; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.course-block .table-wrap { border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); max-height: none; }
.course-block .table th:first-child { border-top-left-radius: var(--radius-sm); }
.course-block .table th:last-child { border-top-right-radius: var(--radius-sm); }

/* ---------- data check ---------- */
.issue-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.issue-stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.issue-num { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 10px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.issue-stat.is-clear .issue-num { background: var(--ok-soft); color: var(--ok); }
.issue-label { color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.section-card .table-wrap { border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); max-height: 420px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.data-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.data-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.data-icon { width: 34px; height: 34px; padding: 8px; flex: none; border-radius: 10px; background: var(--surface-3); color: var(--ink-3); }
.data-icon.is-on { background: var(--ok-soft); color: var(--ok); }
.data-body { flex: 1; min-width: 0; font-size: 13px; }
.data-body .muted { overflow-wrap: anywhere; }
.data-title { font-weight: 600; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.form-actions { display: flex; justify-content: flex-end; }

/* ---------- overlays ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: hsl(214 64% 12% / 0.45); backdrop-filter: blur(4px); pointer-events: none; }
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 56px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); font-size: 16px; font-weight: 600; }

.busy { position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); }
.busy svg { width: 16px; height: 16px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lg); font-size: 13px; }
.toast::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--brand); }
.toast-success::before { background: var(--ok); }
.toast-error::before { background: var(--warn-ink); }
.toast-warn::before { background: var(--gold); }
.toast-msg { flex: 1; }
.toast-close { width: 22px; height: 22px; padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); flex: none; }
.toast-close:hover { background: var(--surface-3); color: var(--ink); }
.toast-enter { transition: transform 0.25s var(--ease), opacity 0.25s var(--ease); }
.toast-leave { transition: transform 0.2s ease-in, opacity 0.2s ease-in; }
.toast-enter-start { transform: translateY(8px) scale(0.98); opacity: 0; }

.noscript { padding: 40px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .list-pane { position: static; max-height: 360px; }
  .settings-grid, .upload { grid-template-columns: minmax(0, 1fr); }
  .dropzone { min-height: 240px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    z-index: 40;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand { padding: 0; }
  .brand-text, .source-list { display: none; }
  .brand-logo { padding: 5px 8px; border-radius: 10px; }
  .brand-logo img { height: 26px; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 10px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .main { padding-top: 20px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .segmented { align-self: flex-start; }
  .issue-summary { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .brand { display: none; }
  .nav-label { display: none; }
  .nav-item.is-active .nav-label { display: inline; }
  .stats { gap: 8px; }
  .stat { padding: 12px 14px 14px; }
  .stat-value { font-size: 24px; }
  .search { max-width: none; flex-basis: 100%; }
  .select, .select-sm { flex: 1 1 140px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(3) { border-left: 0; }
  .kpis > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .detail-pane { padding: 16px; }
  .table td, .table .th-btn, .table th:not(:has(.th-btn)) { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .sidebar, .toolbar, .table-foot, .segmented, .toasts, .busy { display: none !important; }
  .app { display: block; }
  .card, .stat { box-shadow: none; border: 1px solid #ccc; }
  .table-wrap { max-height: none; overflow: visible; }
  body { background: #fff; }
}
