/* ==========================================================================================================
   Design tokens
   ========================================================================================================== */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-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+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f5f6fa;
  --card: #ffffff;
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-700: #3730a3;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --ok: #059669;
  --ok-50: #ecfdf5;
  --warn: #b45309;
  --warn-50: #fffbeb;
  --bad: #dc2626;
  --bad-50: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
  --sidebar: 236px;

  --bs-body-font-family: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-body-font-size: .9375rem;
  --bs-border-color: var(--line);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--brand-700);
  --bs-link-hover-color-rgb: 55, 48, 163;
  --bs-secondary-color: var(--muted);
  --bs-border-radius: 8px;
}

html { font-size: 16px; }
[hidden] { display: none !important; }
body { font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
code { color: var(--brand-700); }
.text-muted { color: var(--muted) !important; }
.small, small { font-size: .8125rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================================================
   Bootstrap refinements
   ========================================================================================================== */
.btn { font-weight: 550; border-radius: 8px; padding: .45rem .9rem; font-size: .9rem; white-space: nowrap; }
.btn-sm { padding: .28rem .6rem; font-size: .8125rem; border-radius: 7px; }
.btn-lg { padding: .7rem 1.3rem; font-size: 1rem; border-radius: 10px; }
.btn i { margin-right: .35rem; }
.btn-icon i { margin-right: 0; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-bg: #a5b4fc; --bs-btn-disabled-border-color: #a5b4fc;
  box-shadow: 0 1px 2px rgba(79, 70, 229, .35);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: #c7d2fe;
  --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-border-color: #a5b4fc;
  --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--brand-700); --bs-btn-active-border-color: #a5b4fc;
}
.btn-light {
  --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink-2);
  --bs-btn-hover-bg: var(--line-2); --bs-btn-hover-border-color: #cbd5e1;
  --bs-btn-active-bg: var(--line); --bs-btn-active-border-color: #cbd5e1;
}
.btn-link { font-weight: 550; text-decoration: none; }
.btn-ghost { border: 0; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-ghost.text-danger:hover { background: var(--bad-50); }

.form-label { font-weight: 550; font-size: .875rem; margin-bottom: .3rem; color: var(--ink-2); }
.form-control, .form-select { border-color: #cbd5e1; font-size: .9375rem; background-color: #fff; }
.input-group-text { background: #f8fafc; border-color: #cbd5e1; color: var(--muted); font-size: .875rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-text { color: var(--muted); font-size: .8125rem; }
.field-validation-error, .validation-summary-errors { color: var(--bad); font-size: .8125rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.input-validation-error { border-color: var(--bad) !important; }

.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .85rem 1.1rem; font-weight: 600; }
.card-body { padding: 1.1rem; }
.card-title { font-size: 1rem; font-weight: 650; margin-bottom: .2rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .9rem; }
.table > :not(caption) > * > * { padding: .6rem .9rem; border-bottom-color: var(--line-2); vertical-align: middle; }
.table thead th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fafbff; }
.table tbody tr:last-child td { border-bottom: 0; }

.dropdown-menu { border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 10px; padding: .35rem; font-size: .9rem; }
.dropdown-item { border-radius: 7px; padding: .4rem .65rem; }
.dropdown-item:active { background: var(--brand); }
.dropdown-item i { width: 1.2rem; display: inline-block; color: var(--muted); }
.dropdown-item:active i { color: inherit; }
.dropdown-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }

.modal-content { border: 0; border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--line-2); padding: 1rem 1.25rem; }
.modal-title { font-size: 1.05rem; font-weight: 650; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--line-2); padding: .85rem 1.25rem; }

.alert { border-radius: 10px; border: 1px solid transparent; font-size: .9rem; padding: .7rem .9rem; }
.alert-success { background: var(--ok-50); border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.alert-danger { background: var(--bad-50); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--brand-50); border-color: #c7d2fe; color: var(--brand-700); }

.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; padding: .55rem .8rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: transparent; }

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

.sidebar {
  background: #0c1222; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: .9rem .7rem; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; padding: .35rem .55rem 1rem; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }
.side-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .65rem .35rem; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 8px; color: #cbd5e1; font-weight: 500;
  font-size: .9rem; margin-bottom: 2px;
}
.side-link i { font-size: 1rem; color: #7c8aa5; width: 1.1rem; text-align: center; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.side-link.active { background: rgba(99, 102, 241, .22); color: #fff; }
.side-link.active i { color: #a5b4fc; }
.side-link .count { margin-left: auto; font-size: .72rem; color: #94a3b8; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: .75rem .65rem .25rem; font-size: .75rem; color: #64748b; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 20;
}
.topbar .btn-school { font-weight: 600; color: var(--ink); border: 1px solid var(--line); background: #fff; padding: .35rem .7rem; max-width: 22rem; }
.topbar .btn-school span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn-school:hover { background: var(--line-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); font-weight: 650; font-size: .8rem; display: inline-grid; place-items: center; }
.page { padding: 1.5rem 1.75rem 3rem; width: 100%; max-width: 1440px; }
.page-narrow { max-width: 860px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .lead { color: var(--muted); font-size: .9375rem; font-weight: 400; margin: .25rem 0 0; max-width: 46rem; }
.page-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.crumb { font-size: .8125rem; color: var(--muted); margin-bottom: .35rem; }
.crumb a { color: var(--muted); }
.sidebar-toggle { display: none; }

@media (max-width: 991px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: inline-flex; }
  .page { padding: 1rem; }
}

/* ==========================================================================================================
   Small components
   ========================================================================================================== */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-50); color: #047857; }
.pill-warn { background: var(--warn-50); color: #92400e; }
.pill-bad { background: var(--bad-50); color: #b91c1c; }
.pill-info { background: var(--brand-50); color: var(--brand-700); }
.pill-muted { background: var(--line-2); color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .5rem; border-radius: 6px; font-size: .78rem; font-weight: 550;
  background: color-mix(in srgb, var(--c, #64748b) 12%, white); color: color-mix(in srgb, var(--c, #64748b) 70%, black);
  border: 1px solid color-mix(in srgb, var(--c, #64748b) 22%, white); white-space: nowrap;
}
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, #64748b); display: inline-block; flex: none; }
.swatch { width: 1.1rem; height: 1.1rem; border-radius: 5px; background: var(--c, #64748b); display: inline-block; vertical-align: -3px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: var(--line-2); padding: .05rem .35rem; border-radius: 5px; color: var(--ink-2); }

.stat { padding: .9rem 1rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 550; }

.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--muted); }
.empty .icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-50); color: var(--brand); display: inline-grid; place-items: center; font-size: 1.5rem; margin-bottom: .85rem; }
.empty h2 { margin-bottom: .35rem; }
.empty p { max-width: 30rem; margin: 0 auto 1rem; }

.loadbar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 70px; }
.loadbar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.loadbar.over > span { background: var(--bad); }
.loadbar.full > span { background: var(--ok); }

.flash { position: fixed; top: 68px; right: 20px; z-index: 1080; max-width: 26rem; box-shadow: var(--shadow-lg); animation: flash-in .25s ease-out; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.help { color: var(--muted); font-size: .8125rem; }
.divider { height: 1px; background: var(--line); margin: 1.25rem 0; }
.hint-box { background: var(--brand-50); border: 1px solid #c7d2fe; color: var(--brand-700); border-radius: 10px; padding: .7rem .9rem; font-size: .875rem; }
.hint-box i { margin-right: .4rem; }

/* Setup checklist */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.steps li:last-child { border-bottom: 0; }
.step-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .95rem; background: var(--line-2); color: var(--faint); }
.step-mark.done { background: var(--ok-50); color: var(--ok); }
.step-title { font-weight: 600; }
.step-summary { color: var(--muted); font-size: .85rem; }

/* Issues list */
.issue { display: flex; gap: .7rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.issue:last-child { border-bottom: 0; }
.issue > i { font-size: 1rem; margin-top: .1rem; }
.issue.error > i { color: var(--bad); }
.issue.warning > i { color: #d97706; }
.issue.info > i { color: var(--brand); }
.issue-title { font-weight: 600; font-size: .9rem; }
.issue-detail { color: var(--muted); font-size: .84rem; }

/* Choice cards (radio groups that look like cards) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice label { display: block; border: 1.5px solid var(--line); border-radius: 10px; padding: .7rem .85rem; cursor: pointer; background: #fff; height: 100%; transition: border-color .12s, background .12s; }
.choice label strong { display: block; font-weight: 600; font-size: .9rem; }
.choice label span { color: var(--muted); font-size: .8rem; }
.choice input:hover + label { border-color: #c7d2fe; }
.choice input:checked + label { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.choice input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ==========================================================================================================
   Public pages (landing, sign in)
   ========================================================================================================== */
.public { background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
.public-nav { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; max-width: 1180px; margin: 0 auto; width: 100%; }
.public-nav .brand { color: var(--ink); padding: 0; }
.public-nav .brand:hover { color: var(--ink); }
.hero { max-width: 1180px; margin: 0 auto; padding: 3rem 1.5rem 2rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); line-height: 1.07; letter-spacing: -.035em; font-weight: 750; margin-bottom: 1.1rem; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, #4f46e5, #9333ea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.125rem; color: var(--ink-2); max-width: 34rem; margin-bottom: 1.6rem; line-height: 1.55; }
.hero-note { color: var(--muted); font-size: .875rem; margin-top: 1rem; }
.hero-art { background: linear-gradient(160deg, #eef2ff, #faf5ff); border: 1px solid var(--brand-100); border-radius: 20px; padding: 1.1rem; box-shadow: var(--shadow-lg); }
.mock { display: grid; grid-template-columns: 2.2rem repeat(5, 1fr); gap: 5px; font-size: .68rem; }
.mock .h { color: var(--muted); font-weight: 600; text-align: center; padding: .15rem 0; }
.mock .p { color: var(--faint); font-weight: 600; display: grid; place-items: center; }
.mock .l { border-radius: 7px; padding: .4rem .45rem; background: color-mix(in srgb, var(--c) 13%, white); border-left: 3px solid var(--c); color: color-mix(in srgb, var(--c) 65%, black); font-weight: 650; line-height: 1.25; min-height: 2.6rem; }
.mock .l small { display: block; font-weight: 500; opacity: .75; font-size: .62rem; }
.mock .brk { grid-column: 1 / -1; text-align: center; color: var(--faint); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; padding: .05rem 0; }
.features { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem 3.5rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.feature { border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; }
.feature .icon { width: 40px; height: 40px; border-radius: 11px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 1.15rem; margin-bottom: .8rem; }
.feature h3 { font-size: 1.02rem; margin-bottom: .35rem; }
.feature p { color: var(--muted); font-size: .9rem; margin: 0; line-height: 1.5; }
.public-foot { margin-top: auto; text-align: center; color: var(--faint); font-size: .8rem; padding: 1.5rem; border-top: 1px solid var(--line-2); }
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 1.5rem; gap: 2rem; }
  .features { grid-template-columns: minmax(0, 1fr); }
}

.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 500px at 50% -10%, #e0e7ff 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 1.9rem; }
.auth-card .brand { color: var(--ink); padding: 0; margin-bottom: 1.2rem; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: .3rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.3rem; font-size: .9rem; }
.auth-alt { text-align: center; margin-top: 1.1rem; font-size: .9rem; color: var(--muted); }

/* Welcome / school picker */
.welcome { max-width: 1040px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.welcome h1 { font-size: 1.75rem; }
.option-card { border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 1.4rem; box-shadow: var(--shadow); height: 100%; display: flex; flex-direction: column; }
.option-card .kicker { font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); margin-bottom: .4rem; }
.option-card h2 { font-size: 1.15rem; margin-bottom: .4rem; }
.option-card p { color: var(--muted); font-size: .9rem; }
.option-card ul { padding-left: 0; list-style: none; margin: .25rem 0 1.1rem; font-size: .86rem; color: var(--ink-2); }
.option-card ul li { padding: .12rem 0; }
.option-card ul li i { color: var(--ok); margin-right: .4rem; }
.option-card .mt-auto { margin-top: auto; }
.option-card.featured { border-color: #c7d2fe; background: linear-gradient(180deg, #f5f7ff, #fff 55%); }

/* ==========================================================================================================
   Timetable grid
   ========================================================================================================== */
.tt-wrap { overflow-x: auto; }
.tt { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 640px; }
.tt th { font-size: .78rem; font-weight: 650; color: var(--ink-2); text-align: center; padding: .3rem .2rem; }
.tt th.period { width: 5.6rem; text-align: left; padding-left: .2rem; color: var(--ink); vertical-align: middle; }
.tt th.period small { display: block; color: var(--faint); font-weight: 500; font-size: .68rem; white-space: nowrap; }
.tt td { height: 4.1rem; padding: 0; vertical-align: top; border-radius: 9px; background: #fff; border: 1px dashed var(--line); position: relative; }
.tt td.filled { border: 0; background: transparent; }
.tt td.closed { background: repeating-linear-gradient(135deg, #f1f5f9, #f1f5f9 6px, #e9eef5 6px, #e9eef5 12px); border: 0; }
.tt td.unavailable { background: repeating-linear-gradient(135deg, #f8fafc, #f8fafc 6px, #eef2f7 6px, #eef2f7 12px); border-style: solid; border-color: var(--line); }
.tt td.unavailable::after, .tt td.prefer-not::after { content: attr(data-label); position: absolute; inset: auto 6px 4px auto; font-size: .62rem; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tt td.prefer-not { background: #fffdf5; border-color: #fde68a; }
.tt tr.gap td { height: auto; border: 0; background: transparent; text-align: center; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: .05rem 0; }
.tt tr.gap th { padding: 0; }

.lesson {
  display: flex; flex-direction: column; height: 100%; min-height: 4.1rem; border-radius: 9px; padding: .38rem .5rem .35rem .6rem; cursor: pointer;
  background: color-mix(in srgb, var(--c, #64748b) 11%, white); border-left: 4px solid var(--c, #64748b);
  color: color-mix(in srgb, var(--c, #64748b) 62%, black); line-height: 1.25; position: relative; overflow: hidden;
  transition: box-shadow .12s, transform .12s; text-align: left; width: 100%; border-top: 0; border-right: 0; border-bottom: 0; font: inherit;
}
.lesson:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, .12); transform: translateY(-1px); text-decoration: none; }
.lesson .t { font-weight: 650; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .s { font-size: .74rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .m { font-size: .68rem; opacity: .8; margin-top: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .flags { position: absolute; top: 4px; right: 5px; font-size: .68rem; display: flex; gap: 3px; opacity: .8; }
.lesson.mixed { --c: #6366f1; background: #f5f6ff; }
.lesson.clash { box-shadow: inset 0 0 0 2px var(--bad); }
.lesson.clash .flags { color: var(--bad); opacity: 1; }
.lesson.selected { box-shadow: 0 0 0 2.5px var(--brand), 0 6px 16px rgba(79, 70, 229, .25); }
.lesson.stacked { min-height: 0; flex: 1; }
.cell-stack { display: flex; flex-direction: column; gap: 3px; height: 100%; }

/* Move mode */
.tt.moving td.target-ok { outline: 2px dashed var(--ok); outline-offset: -2px; background: var(--ok-50); cursor: pointer; }
.tt.moving td.target-ok .lesson { opacity: .55; }
.tt.moving td.target-ok:hover { background: #d1fae5; }
.tt.moving td.target-no { opacity: .45; cursor: not-allowed; }
.tt.moving td.target-no .lesson { cursor: not-allowed; }
.tt.moving td.drop-hover { outline-style: solid; background: #a7f3d0; }
.move-banner { position: sticky; top: 64px; z-index: 15; }

/* Whole-school overview */
.ov { border-collapse: separate; border-spacing: 2px; font-size: .68rem; }
.ov th { font-weight: 600; color: var(--muted); padding: .1rem .15rem; text-align: center; white-space: nowrap; }
.ov th.rowhead { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 2; padding-right: .5rem; color: var(--ink); font-size: .78rem; }
.ov th.day { border-bottom: 2px solid var(--line); color: var(--ink-2); font-size: .74rem; }
.ov td { width: 2.05rem; min-width: 2.05rem; height: 1.7rem; text-align: center; border-radius: 4px; font-weight: 650; background: #f8fafc; color: transparent; }
.ov td.on { background: color-mix(in srgb, var(--c, #64748b) 22%, white); color: color-mix(in srgb, var(--c, #64748b) 70%, black); }
.ov td.off { background: repeating-linear-gradient(135deg, #f1f5f9, #f1f5f9 4px, #e2e8f0 4px, #e2e8f0 8px); }
.ov td.day-start { border-left: 3px solid transparent; }
.ov tr.year th { text-align: left; padding-top: .6rem; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; font-size: .66rem; }

/* Entity picker beside the grid */
.picker { max-height: calc(100vh - 220px); overflow-y: auto; }
.picker .group { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: .7rem .8rem .25rem; font-weight: 600; }
.picker a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .34rem .8rem; color: var(--ink-2); font-size: .875rem; border-left: 3px solid transparent; }
.picker a:hover { background: var(--line-2); text-decoration: none; }
.picker a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; border-left-color: var(--brand); }
.picker a small { color: var(--faint); font-variant-numeric: tabular-nums; }

/* Quality */
.score-ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--ring, var(--brand)) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex: none; }
.score-ring > div { width: 68px; height: 68px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 750; font-size: 1.35rem; letter-spacing: -.03em; }
.metric { padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.metric:last-child { border-bottom: 0; }
.metric .bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: .35rem 0; }
.metric .bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.metric .bar span.mid { background: #f59e0b; }
.metric .bar span.low { background: var(--bad); }

/* ==========================================================================================================
   Availability grid, curriculum matrix
   ========================================================================================================== */
.avail { border-collapse: separate; border-spacing: 4px; }
.avail th { font-size: .76rem; font-weight: 600; color: var(--muted); text-align: center; padding: .1rem .3rem; }
.avail th.period { text-align: left; color: var(--ink-2); padding-right: .6rem; white-space: nowrap; }
.avail td button { width: 5.4rem; height: 2.1rem; border-radius: 7px; border: 1px solid #a7f3d0; background: var(--ok-50); color: #047857; font-size: .72rem; font-weight: 600; cursor: pointer; }
.avail td button[data-state="1"] { background: #f1f5f9; border-color: #cbd5e1; color: var(--muted); background-image: repeating-linear-gradient(135deg, transparent, transparent 5px, rgba(100, 116, 139, .12) 5px, rgba(100, 116, 139, .12) 10px); }
.avail td button[data-state="2"] { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.avail td button:hover { filter: brightness(.97); }
.avail td.closed { background: repeating-linear-gradient(135deg, #f1f5f9, #f1f5f9 5px, #e2e8f0 5px, #e2e8f0 10px); border-radius: 7px; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i.key { width: .9rem; height: .9rem; border-radius: 4px; display: inline-block; border: 1px solid transparent; }

.cm { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; }
.cm th, .cm td { border-bottom: 1px solid var(--line-2); padding: .4rem .5rem; }
.cm thead th { background: #fafbfc; font-size: .78rem; color: var(--ink-2); text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cm th.line { text-align: left; font-weight: 600; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 2; }
.cm thead th.line { z-index: 3; background: #fafbfc; }
.save-bar { position: sticky; bottom: 1rem; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .6rem .8rem; width: fit-content; max-width: 100%; }
.cm td { text-align: center; }
.cm tfoot td, .cm tfoot th { background: #fafbfc; font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.cm .periods { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cm input.num { width: 3.4rem; text-align: center; padding: .2rem .25rem; border: 1px solid transparent; border-radius: 6px; background: transparent; font: inherit; font-variant-numeric: tabular-nums; }
.cm input.num:hover { border-color: var(--line); background: #fff; }
.cm input.num:focus { border-color: #818cf8; background: #fff; outline: 0; box-shadow: 0 0 0 3px rgba(99, 102, 241, .16); }
.cm input.num.changed { background: #fef9c3; border-color: #fde047; }
.cm .mixed-cell { color: var(--muted); font-size: .8rem; }
.total-ok { color: var(--ok); }
.total-under { color: #b45309; }
.total-over { color: var(--bad); }

.blk {
  display: block; width: 100%; text-align: left; border: 1px solid color-mix(in srgb, var(--c, #6366f1) 25%, white); border-radius: 8px;
  background: color-mix(in srgb, var(--c, #6366f1) 8%, white); padding: .3rem .45rem; cursor: pointer; font: inherit; color: var(--ink);
  line-height: 1.3; transition: box-shadow .12s;
}
.blk:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.blk .cls { display: flex; gap: .4rem; align-items: baseline; font-size: .8rem; justify-content: space-between; }
.blk .cls b { font-weight: 600; white-space: nowrap; }
.blk .cls span { color: var(--muted); white-space: nowrap; font-size: .76rem; }
.blk .cls span.none { color: var(--bad); font-weight: 600; }
.blk.single { text-align: center; }
.blk.single .cls { justify-content: center; }
.blk .meta { font-size: .68rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }

/* ==========================================================================================================
   Generation progress
   ========================================================================================================== */
.gen { max-width: 640px; margin: 2rem auto; }
.gen-phase { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; color: var(--faint); }
.gen-phase .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; flex: none; }
.gen-phase.active { color: var(--ink); font-weight: 600; }
.gen-phase.active .tick { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.gen-phase.done { color: var(--ink-2); }
.gen-phase.done .tick { border-color: var(--ok); background: var(--ok); color: #fff; }
.gen-phase small { margin-left: auto; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
.spark { width: 100%; height: 64px; }

/* ==========================================================================================================
   Print
   ========================================================================================================== */
.print-only { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  html { font-size: 13px; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .flash, .page-actions, .picker-col { display: none !important; }
  .app { display: block; }
  .page { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
  .print-page { break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .lesson, .tt td, .ov td, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt td { height: 3.6rem; }
  .lesson { min-height: 3.6rem; }
  a { color: inherit; }
}
