:root {
  color-scheme: light;
  --ink: #192b2b;
  --muted: #536663;
  --teal: #0d6656;
  --surface: #fff;
  --bg: #f4f7f5;
  --line: #d9e4df;
  --pale: #e2f2eb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
aside {
  position: sticky; top: 0; height: 100vh; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 17px;
}
.brand { display: flex; align-items: center; gap: 10px; margin: 5px 3px 37px; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; color: var(--muted); }
.mark { background: var(--teal); color: white; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; font-size: 24px; }
nav { display: grid; gap: 5px; }
nav a { text-decoration: none; color: var(--muted); padding: 12px; display: flex; align-items: center; gap: 12px; border-radius: 9px; font-weight: 600; font-size: 14px; }
nav a:hover, nav a[aria-current] { background: var(--pale); color: #055144; }
nav span { width: 19px; font-size: 18px; line-height: 1; text-align: center; }
.local { margin: auto 3px 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.local i { display: inline-block; background: var(--teal); border-radius: 50%; width: 7px; height: 7px; margin-right: 6px; }
main { width: 100%; max-width: 1320px; min-width: 0; padding: 32px clamp(20px, 4vw, 56px) 52px; margin-inline: auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.08; letter-spacing: -.045em; margin-bottom: 12px; }
h2 { font-size: 19px; letter-spacing: -.02em; margin-bottom: 16px; }
h3 { font-size: 16px; margin-bottom: 8px; }
p, li { line-height: 1.6; }
small, .muted { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--teal); margin-bottom: 10px; }
.hero {
  position: relative; overflow: hidden; isolation: isolate; padding: clamp(24px, 4vw, 43px);
  border-radius: 18px; background: #103e37; color: white; margin-bottom: 20px;
}
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%;
  width: 340px; height: 340px; right: -60px; top: -135px; border: 1px solid #ffffff29;
  box-shadow: 0 0 0 32px #ffffff0a, 0 0 0 65px #ffffff08;
}
.hero::after { width: 210px; height: 210px; top: -70px; right: 5px; }
.hero .eyebrow, .hero p { color: #c5e6dc; }
.hero .button { background: #dff7e9; color: #12443a; }
.stats, .split, .filters { display: grid; gap: 14px; margin-bottom: 18px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.filters { grid-template-columns: 1fr 2fr 1fr 1fr; }
.card, .stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.card + .card { margin-top: 14px; }
.split > .card { margin-top: 0; }
.stat strong { display: block; font-size: 30px; letter-spacing: -.045em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat span, .empty { color: var(--muted); font-size: 14px; }
.empty { background: var(--bg); border-radius: 9px; padding: 13px; margin-bottom: 0; }
.block { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 11px 0; font-size: 14px; }
.block + .block { border-top: 1px solid var(--line); }
.block small { grid-column: 1 / -1; }
.block progress, .run-progress { grid-column: 1 / -1; width: 100%; height: 7px; border: 0; border-radius: 8px; background: #e8eeeb; overflow: hidden; }
progress::-webkit-progress-bar { background: #e8eeeb; }
progress::-webkit-progress-value { background: #21896f; }
progress::-moz-progress-bar { background: #21896f; }
.button, button {
  display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 10px 15px;
  font: inherit; font-size: 14px; font-weight: 650; text-decoration: none; cursor: pointer;
  background: var(--teal); color: white; line-height: 1.35;
}
button:disabled { opacity: .55; cursor: default; }
.secondary { background: white; border-color: var(--line); color: var(--teal); }
:focus-visible { outline: 3px solid #e5a73c; outline-offset: 3px; }
select, input[type=number] {
  display: block; width: 100%; min-width: 0; border: 1px solid #b8cbc4;
  color: var(--ink); background: white; border-radius: 8px; padding: 10px; font: inherit; margin-top: 6px;
}
label { font-size: 14px; font-weight: 600; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.choices, .actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.choices label, .option { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.option { line-height: 1.5; margin-bottom: 8px; font-weight: 400; }
.choices label:has(input:checked), .option:has(input:checked) { border-color: var(--teal); background: var(--pale); }
input { accent-color: var(--teal); }
.chapter { border-bottom: 1px solid var(--line); margin-bottom: 19px; padding-bottom: 12px; }
.source { margin-bottom: 12px; display: block; font-size: 13px; }
.prompt { line-height: 1.6; white-space: pre-line; }
.notice { padding: 12px 15px; background: var(--pale); border-radius: 8px; margin-bottom: 14px; }
.error { background: #fce9e5; color: #852d22; }
.warn { background: #fff2da; color: #684500; }
.list { display: grid; gap: 8px; }
.list button { text-align: left; }
.list strong { display: block; }
details { padding: 12px 0; border-bottom: 1px solid var(--line); }
details:last-child { border-bottom: 0; }
details > div { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; line-height: 1.4; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); }
td:not(:first-child), th:not(:first-child) { text-align: right; }
.table-wrap { overflow-x: auto; }
.chart { display: grid; gap: 10px; }
.chart a { color: var(--teal); font-size: 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.chart progress { width: 100%; accent-color: var(--teal); }
.pill { display: inline-block; border-radius: 18px; background: var(--pale); color: #0b5144; padding: 4px 9px; font-size: 12px; }
.correct { color: #0d6656; font-weight: 700; }
.wrong { color: #962d22; font-weight: 700; }
@media (max-width: 850px) {
  body { grid-template-columns: 190px minmax(0, 1fr); }
  aside { padding-inline: 10px; }
  .brand { white-space: normal; }
  .split, .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { display: block; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .brand { margin: 0 0 10px; }
  nav { grid-template-columns: repeat(3, 1fr); }
  nav a { padding: 8px 5px; font-size: 12px; gap: 3px; }
  .local { display: none; }
  main { padding: 20px 12px 36px; }
  .split { grid-template-columns: 1fr; }
}
input[type=text], input[type=file], textarea {
  display: block; width: 100%; min-width: 0; color: var(--ink); background: white;
  border: 1px solid #b8cbc4; border-radius: 8px; padding: 10px; font: inherit; margin: 6px 0 12px;
}
textarea { resize: vertical; }
#import-preview { margin-block: 14px; }
#import-preview td { text-align: left; }
.question-image { margin: 0 0 18px; }
.question-image img { display: block; max-width: 100%; height: auto; }
.question-image figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; }
.passage { padding: 16px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 8px; }
.passage details .prompt { margin-top: 14px; }
.review-filters { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.review-filters input[type=date] {
  display: block; width: 100%; min-width: 0; margin-top: 6px; padding: 10px;
  border: 1px solid #b8cbc4; border-radius: 8px; background: white; color: var(--ink); font: inherit;
}
#review-text { line-height: 1.5; }
.result-table { margin-top: 20px; }
.discipline-total { background: var(--pale); }
.result-table td:last-child { white-space: nowrap; }
.review-actions { margin: 14px 0; }
.result-options { list-style: none; padding: 0; }
.result-option { cursor: default; }
.result-option .prompt { margin: 0 0 4px; }
.selected-answer { border: 2px dashed #765737; }
.correct-answer { background: var(--pale); border-left: 5px solid var(--teal); }
#notebook h2 { margin-top: 24px; }
#notebook details details { margin-left: 10px; }
.mark { padding: 0; object-fit: contain; background: #000; }
.secondary-menu { margin-top: 16px; font-size: .87rem; }
.secondary-menu a { display: block; padding: 8px 0; color: var(--teal); }
@media (max-width: 680px) {
  #main { padding-inline: 14px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .actions button, .actions a, nav a { min-height: 44px; }
  .actions { gap: 8px; }
  .brand .mark { width: 36px; height: 36px; }
  .secondary-menu { margin-top: 4px; }
  input, textarea, select { font-size: 16px; }
}
.category-cards .stat { color: var(--ink); text-align: left; text-decoration: none; }
.category-cards .stat:hover { border-color: var(--teal); background: var(--pale); }
.result-table .amount { min-width: 38px; padding: 6px; }
@media (max-width: 680px) { .result-table .amount { min-width: 44px; min-height: 44px; } }
