@font-face {
  font-family: Atkinson;
  src: url("/atkinson-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Atkinson;
  src: url("/atkinson-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Atkinson, system-ui, sans-serif;
  color: #eeedf4;
  background: #101015;
  --sidebar: #15151d;
  --panel: #191923;
  --raised: #20202c;
  --field: #121219;
  --border: #303040;
  --soft-border: #282833;
  --muted: #a5a3b6;
  --accent: #bcb2ff;
  --accent-panel: #2b2542;
  --brand: #ab9cfc;
  --green: #a3dcba;
  --alert: #ffac9f;
  --radius: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a { color: var(--accent); }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
p { line-height: 1.52; }

.app { min-height: 100vh; display: grid; grid-template-columns: 268px minmax(0, 1fr); }
.login-panel {
  width: min(420px, calc(100% - 36px));
  margin: 13vh auto 0;
  display: grid;
  gap: 16px;
  justify-items: start;
}
.login-panel .brand { padding: 0; }
.sidebar {
  align-self: start;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding: 22px 16px 12px;
  border-right: 1px solid var(--soft-border);
  background: var(--sidebar);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 5px 24px; }
.brand strong, .brand div span { display: block; }
.brand strong { font-size: 1.125rem; }
.brand div span { color: var(--muted); margin-top: 1px; font-size: .875rem; }
.brand-mark {
  flex: none;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 11px;
  background: var(--brand);
  color: #1a1530;
}
.brand-mark i { display: block; width: 4px; height: 8px; border-radius: 2px; background: currentColor; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 18px; }
.primary-nav { display: grid; gap: 4px; padding-bottom: 16px; border-bottom: 1px solid var(--soft-border); }
.nav-button, .lesson-button, .add-lesson, .tab {
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}
.nav-button, .lesson-button { border-radius: 9px; }
.nav-button { padding: 9px 11px; font-weight: 700; color: var(--muted); }
.nav-button:hover, .lesson-button:hover { background: var(--raised); color: #f5f4f8; }
.nav-button[aria-current="page"], .lesson-button[aria-current="page"] {
  color: #dfd8ff;
  background: var(--accent-panel);
  border-color: #40355f;
}
.lesson-nav { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.lesson-nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 5px 8px 10px;
}
.lesson-nav-heading h2 {
  font-size: .8125rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.add-lesson {
  display: inline-grid;
  line-height: 1;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.35rem;
  color: var(--accent);
}
.add-lesson:hover { background: var(--accent-panel); }
#outline { overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.lesson-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: baseline;
  gap: 7px;
  width: 100%;
  padding: 7px 8px;
  color: #dad8e5;
  font-size: .875rem;
  line-height: 1.24;
}
.lesson-number { color: var(--muted); font-variant-numeric: tabular-nums; }
.source-link {
  margin-top: 9px;
  padding: 12px 8px 3px;
  border-top: 1px solid var(--soft-border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: .875rem;
  text-decoration: none;
}
.source-link:hover { color: var(--accent); }
.source-link span { font-size: .75rem; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; }
.workspace { min-width: 0; }
.topbar {
  min-height: 66px;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 20px;
  padding: 11px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--soft-border);
  background: #16161e;
}
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .875rem; }
.breadcrumb strong { color: var(--accent); }
.breadcrumb select {
  max-width: 100%;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  color: #eeedf4;
}
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.save-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 5px; color: var(--muted); font-size: .875rem; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-status[data-state="saved"] { color: var(--green); }
.save-status[data-state="dirty"] { color: var(--accent); }
.save-status[data-state="error"] { color: var(--alert); }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--raised);
  font-size: .875rem;
  line-height: 1.25;
  font-weight: 700;
}
.button:hover:enabled { background: #2e2d3c; }
.button.primary { background: var(--brand); color: #1b1530; border-color: transparent; }
.button.primary:hover:enabled { background: #c7bbff; }
.button.quiet { background: transparent; }
.button.danger { color: var(--alert); background: transparent; border-color: transparent; }
.button.danger:hover:enabled { background: #382832; }
.button.compact { min-height: 34px; padding: 5px 10px; }
.workspace-body { max-width: 1330px; margin: 0 auto; padding: 32px clamp(18px, 3.2vw, 42px) 24px; }
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 20px; margin-bottom: 22px; }
.heading > div:first-child { min-width: 0; }
.eyebrow { color: var(--accent); font-size: .875rem; line-height: 1.32; font-weight: 700; display: block; margin-bottom: 7px; }
.heading h1 { font-size: clamp(1.75rem, 3vw, 2.6rem); line-height: 1.11; letter-spacing: -.032em; overflow-wrap: anywhere; }
.heading p { max-width: 68ch; margin-top: 9px; color: var(--muted); overflow-wrap: anywhere; }
.heading-controls { display: flex; gap: 12px; align-items: flex-end; flex: none; }
.metric-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 23px; }
.metric {
  padding: 14px 16px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.metric span { display: block; color: var(--muted); font-size: .875rem; }
.metric strong { display: block; margin-top: 6px; color: #ddd4ff; font-size: 1.625rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric small { font-size: .875rem; color: var(--muted); font-weight: 400; }
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab { flex: none; padding: 8px 12px; border-radius: 7px; color: var(--muted); font-size: .925rem; font-weight: 700; }
.tab[aria-pressed="true"] { color: #e3ddff; border-color: #40355f; background: var(--accent-panel); }
.tab:hover { color: #f4f0ff; background: var(--raised); }
.plan, .panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.plan { overflow: hidden; }
.plan-heading, .plan-row {
  width: 100%;
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr) 74px 78px;
  align-items: center;
  column-gap: 14px;
  padding: 11px 16px;
}
.plan-heading { background: var(--raised); color: var(--muted); font-size: .8125rem; }
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-list li + li { border-top: 1px solid var(--soft-border); }
.plan-row { position: relative; padding-block: 13px; }
.plan-row > .button { position: relative; justify-self: start; }
.plan-lesson { padding: 0; text-align: left; background: transparent; border: 0; }
.plan-lesson::after { content: ''; position: absolute; inset: 0; }
.plan-lesson:hover strong { color: var(--accent); text-decoration: underline; }
.plan-lesson strong { display: block; font-size: 1rem; line-height: 1.22; }
.plan-lesson small { display: block; font-size: .875rem; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.plan-definitions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 20px; padding: 12px 16px 18px; background: var(--field); }
.term-group > strong { color: var(--accent); font-size: .875rem; }
.term-group dl { margin: 6px 0 0; }
.term-group dt { font-weight: 700; }
.term-group dd { margin: 0 0 8px; line-height: 1.4; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 23px;
  border-radius: 5px;
  border: 1px solid var(--border);
  padding: 2px 7px;
  color: var(--muted);
  font-size: .8125rem;
}
.badge.draft { color: var(--accent); background: var(--accent-panel); border-color: #463966; }
.coverage-stack, .editor-stack { display: grid; gap: 16px; }
.coverage-panel { overflow: hidden; }
.coverage-heading { padding: 14px 16px 11px; font-size: 1rem; border-bottom: 1px solid var(--border); }
.coverage-heading span { color: var(--accent); margin-right: 8px; }
.table-scroll { overflow-x: auto; }
.coverage { width: 100%; min-width: 625px; border-collapse: collapse; table-layout: fixed; }
.coverage th, .coverage td { vertical-align: top; text-align: left; padding: 9px 11px; font-size: .875rem; }
.coverage td, .coverage tbody th { border-top: 1px solid var(--soft-border); }
.coverage th:first-child { padding-left: 16px; width: 34%; }
.coverage th:last-child { padding-right: 16px; }
.coverage thead th { color: var(--muted); font-weight: 400; }
.coverage tbody th { font-weight: 700; }
.coverage-links { display: flex; flex-wrap: wrap; gap: 5px; }
.coverage .plan-link, .coverage .coverage-link {
  border: 0;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-panel);
  padding: 3px 6px;
  text-align: left;
  font-size: .8125rem;
}
.coverage .coverage-link[data-reviewed="true"] { color: var(--green); background: #23372f; }
.coverage .plan-link { background: var(--raised); color: #e3dfec; }
.coverage .plan-link:hover, .coverage .coverage-link:hover { text-decoration: underline; }
.missing, .muted { color: var(--muted); }
.missing { font-size: .8125rem; }
.panel { padding: clamp(14px, 2vw, 20px); scroll-margin-top: 85px; }
.coverage-panel { padding: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.panel-header h2 { font-size: 1.125rem; }
.panel-header h3 { font-size: 1rem; }
.panel-actions, .field-heading { display: flex; align-items: center; gap: 8px; }
.panel-actions { margin-left: auto; }
.field-heading { justify-content: space-between; }
.section-heading { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; }
.section-heading h2 { font-size: 1.2rem; }
.fields, .field { display: grid; min-width: 0; gap: 12px; }
.field { gap: 5px; font-size: .875rem; }
.field > span, .field-heading label { color: #d5d2e0; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #3b3a4c;
  border-radius: 8px;
  background-color: var(--field);
  padding: 8px 10px;
  font-size: 1rem;
  line-height: 1.37;
}
.field input::placeholder, .field textarea::placeholder { color: #848295; opacity: 1; }
.field textarea { resize: vertical; min-height: 74px; }
.field select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #aaa5bf 50%), linear-gradient(135deg, #aaa5bf 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field select option, .field select optgroup { color: #eeedf4; background: var(--field); }
.heading-controls select { min-width: 74px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.entry {
  scroll-margin-top: 85px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.entry:first-child { margin-top: 0; }
.entry-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.entry-head strong { font-size: .875rem; }
.inline-entry { grid-template-columns: minmax(0, 1fr) auto; align-items: flex-end; }
.inline-entry .danger { margin-bottom: 2px; }
.entry-label { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .875rem; }
.check input { flex: none; margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--brand); }
.item-meta { display: grid; gap: 9px; margin-top: 4px; padding-top: 13px; border-top: 1px solid var(--soft-border); }
.item-meta summary { cursor: pointer; width: fit-content; font-weight: 700; font-size: .875rem; color: var(--accent); }
.item-meta fieldset { min-width: 0; border: 0; margin: 7px 0 0; padding: 0 0 0 13px; display: grid; gap: 8px; }
.outcome-text { display: block; color: var(--muted); line-height: 1.36; }
.empty { color: var(--muted); padding: 14px 0; }
.empty.panel { padding-inline: 16px; }
.draft-file {
  margin-top: 16px;
  color: #9f9bad;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
.notice {
  background: #252039;
  border: 1px solid #4e4169;
  color: #e3d9ff;
  border-radius: 9px;
  margin-bottom: 16px;
  padding: 11px 13px;
  overflow-wrap: anywhere;
}
.notice[data-state="error"] { background: #322227; border-color: #75494b; color: #ffd2cb; }
.notice ul { margin: 5px 0 4px; padding-left: 22px; }
.notice .button { margin-top: 8px; }
.notice code { display: block; margin-top: 4px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
dialog {
  width: min(780px, calc(100% - 28px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  border: 1px solid #48455a;
  border-radius: 16px;
  background: var(--panel);
  color: #eeedf4;
  overflow: auto;
}
dialog::backdrop { background: rgb(0 0 0 / .7); }
.dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.dialog-header h2 { font-size: 1.35rem; line-height: 1.15; overflow-wrap: anywhere; }
.dialog-content { display: grid; gap: 17px; padding: 19px 22px 24px; }
.preview-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-status { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.preview-card { border: 1px solid var(--border); border-radius: 9px; padding: 13px; display: grid; gap: 9px; background: var(--field); }
.preview-block { display: grid; gap: 9px; }
.preview-block h3 { font-size: 1.125rem; }
.preview-card summary { cursor: pointer; font-weight: 700; }
.preview-card details p { margin-top: 8px; }
.preview-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: .925rem;
}
.preview-option input { flex: none; accent-color: var(--brand); }
.preview-card > .button { justify-self: start; }
.preview-result { color: var(--muted); }
.preview-result[data-result="correct"] { color: var(--green); }
.preview-result[data-result="incorrect"] { color: var(--alert); }
.preview-reference { color: var(--muted); overflow-wrap: anywhere; font-size: .875rem; }

.copy-status {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  max-width: calc(100% - 32px);
  pointer-events: none;
  font-size: .875rem;
  font-weight: 700;
}
.copy-status:not(:empty) {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--raised);
}
.copy-status[data-state="error"] { color: var(--alert); }

@media (max-width: 980px) {
  .app { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .heading { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 700px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding-bottom: 12px; }
  .primary-nav { display: flex; padding-bottom: 10px; }
  #outline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 195px; }
  .topbar { flex-wrap: wrap; }
  .top-actions { gap: 6px; }
  .workspace-body { padding-top: 22px; }
  .panel { scroll-margin-top: 130px; }
  .entry { scroll-margin-top: 130px; }
}

@media (max-width: 440px) {
  .pair { grid-template-columns: 1fr; }
  .plan-heading, .plan-row { grid-template-columns: 24px minmax(0, 1fr) 63px 58px; column-gap: 6px; padding-inline: 10px; }
  .metric-list { gap: 6px; }
  .metric { padding: 9px; }
  .metric span { font-size: .8125rem; }
}
