:root {
  color-scheme: dark;
  --bg: #08090b;
  --sidebar: #0c0e11;
  --surface: #111419;
  --surface-2: #171b21;
  --border: #272c34;
  --text: #eef0f3;
  --muted: #9299a3;
  --accent: #aab5c4;
  --green: #52b788;
  --green-soft: rgba(82, 183, 136, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: inherit; }
button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 100; left: 12px; top: -60px; padding: 9px 12px; color: var(--bg); background: var(--text); border-radius: 6px; }
.skip-link:focus { top: 12px; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 16px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--sidebar); }
.brand { font-weight: 800; letter-spacing: -.025em; text-decoration: none; }
.nav-label { margin: 30px 10px 8px; color: #666e78; font-size: .66rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 3px; }
.sidebar nav a { min-height: 40px; padding: 10px; border-radius: 7px; color: var(--muted); font-size: .84rem; text-decoration: none; }
.sidebar nav a:hover { color: var(--text); background: var(--surface-2); }
.logout-form { margin-top: auto; }
.text-button, .menu-button { min-height: 40px; border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; color: var(--muted); background: transparent; cursor: pointer; }
.text-button:hover, .menu-button:hover { color: var(--text); background: var(--surface-2); }
.mobile-header { display: none; }
.page-column { min-width: 0; }

main { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 64px; }
.progress-card { display: grid; grid-template-columns: 1fr auto; gap: 12px 28px; margin-bottom: 14px; padding: 20px 22px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.1; letter-spacing: -.035em; }
.progress-card p:last-child { margin-bottom: 0; color: var(--muted); font-size: .87rem; }
.eyebrow { margin-bottom: 5px; color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.progress-number { display: grid; align-content: center; text-align: right; }
.progress-number strong { font-size: 1.55rem; line-height: 1; font-variant-numeric: tabular-nums; }
.progress-number span { margin-top: 5px; color: var(--muted); font-size: .74rem; white-space: nowrap; }
.overall-progress { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 99px; background: #050607; }
.overall-progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }

.checklist-subjects { display: grid; gap: 12px; }
.checklist-section { scroll-margin-top: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.section-heading { display: flex; min-height: 52px; padding: 13px 16px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.section-heading h2 { margin: 0; font-size: 1rem; }
.section-heading span, .unit-checklist summary span { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.unit-checklist + .unit-checklist { border-top: 1px solid var(--border); }
.unit-checklist > summary { display: flex; min-height: 44px; padding: 10px 16px; align-items: center; justify-content: space-between; gap: 14px; color: #cbd0d7; background: rgba(255,255,255,.012); cursor: pointer; }
.unit-checklist > summary strong { font-size: .83rem; }
.topic-checklist { border-top: 1px solid rgba(39,44,52,.7); }
.topic-check { display: grid; grid-template-columns: 28px 1fr; min-height: 42px; padding: 0 16px; align-items: center; gap: 8px; scroll-margin-top: 12px; }
.topic-check + .topic-check { border-top: 1px solid rgba(39,44,52,.55); }
.topic-check:hover { background: rgba(255,255,255,.018); }
.native-check { width: 18px; height: 18px; margin: 0; accent-color: var(--green); cursor: pointer; }
.topic-check label { display: flex; min-height: 41px; align-items: center; padding: 8px 0; font-size: .85rem; cursor: pointer; }
.topic-check.done { background: var(--green-soft); }
.topic-check.done label { color: #7f9289; text-decoration: line-through; }

.empty-state { width: min(420px, calc(100% - 32px)); margin: 18vh auto 0; padding: 28px; border: 1px solid var(--border); border-radius: 10px; text-align: center; background: var(--surface); }
.empty-state h1 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
#login-form { display: grid; gap: 10px; margin-top: 22px; text-align: left; }
#login-form label { color: var(--muted); font-size: .82rem; }
#login-form input { min-height: 44px; border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; color: var(--text); background: var(--bg); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 0; border-radius: 7px; padding: 9px 13px; font-weight: 750; cursor: pointer; }
.button.primary { color: #090b0e; background: #c1c8d1; }

@media (max-width: 920px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(250px, 84vw); transform: translateX(-105%); box-shadow: 16px 0 40px rgba(0,0,0,.45); transition: transform .15s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { position: sticky; z-index: 30; top: 0; display: flex; min-height: 54px; padding: 7px 14px; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); background: rgba(8,9,11,.94); backdrop-filter: blur(10px); }
  main { width: min(760px, calc(100% - 24px)); padding-top: 14px; }
}

@media (max-width: 480px) {
  .progress-card { grid-template-columns: 1fr; padding: 16px; }
  .progress-number { position: absolute; right: 28px; text-align: right; }
  .progress-card { position: relative; }
  .progress-card > div:first-child { padding-top: 42px; }
  .overall-progress { grid-column: 1; }
  .section-heading, .unit-checklist > summary { padding-inline: 12px; }
  .topic-check { padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
