:root {
  --ink: #1a2330;
  --ink-soft: #4c5968;
  --muted: #6d7886;
  --paper: #f3eee6;
  --card: #fffdf9;
  --line: #e3d9cc;
  --rail: #141c24;
  --rail-soft: #243140;
  --gold: #b8894a;
  --teal: #0f6b64;
  --teal-deep: #0c3f3c;
  --amber: #9a5b16;
  --amber-bg: #f8e6cc;
  --red: #8d3030;
  --red-bg: #f8d9d4;
  --green: #1d6b43;
  --green-bg: #e3f3e8;
  --neutral-bg: #efeae2;
  --shadow: 0 18px 40px rgba(28, 36, 48, 0.08);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal-deep); }

#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  background: var(--rail);
  color: #f4efe6;
  padding: 28px 18px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.mark {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
}
.mark span { display: block; margin-top: 6px; font-family: var(--sans); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.rail nav { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; }
.rail .group {
  margin: 16px 8px 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8d97a3;
}
.rail button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #e7e1d6;
  border-radius: 8px;
  padding: 8px 10px;
}
.rail button.active, .rail button:hover { background: var(--rail-soft); }
.rail .save-note { margin-top: 22px; color: #9aa3ad; font-size: 12px; padding: 0 8px; }

.main { min-width: 0; padding: 28px 32px 64px; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.eyebrow { margin: 0; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-size: 12px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; }
h1 { margin: 4px 0 0; font-size: 40px; line-height: 1.05; }
.lede { max-width: 68ch; color: var(--ink-soft); margin: 8px 0 0; }
.banner {
  background: var(--amber-bg);
  color: #6d3d0c;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 8px 0 18px;
}
.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.metric .label { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 6px; font-family: var(--serif); font-size: 34px; line-height: 1; }
.metric p { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; }
.split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr); }
.split > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.rowline {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.rowline time { color: var(--teal-deep); font-variant-numeric: tabular-nums; }
.days { color: var(--muted); font-size: 13px; }
.action { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.action > div { min-width: 0; }
.action p, .quiet { color: var(--ink-soft); margin: 4px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
input, select, textarea {
  background: #fff;
  border: 1px solid #d9d0c4;
  border-radius: 10px;
  padding: 8px 10px;
  max-width: 100%;
}
.field input, .field select, .inline input, .inline select { width: 100%; }
textarea { width: 100%; min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #d7ebe8; border-color: var(--teal); }
.grow { flex: 1; min-width: 220px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: #f7f3ec; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
td.sticky, th.sticky { position: sticky; left: 0; background: #fffdf9; min-width: 220px; }
.name-btn {
  background: none; border: 0; padding: 0; text-align: left;
  font-weight: 600; color: var(--teal-deep);
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.35;
  background: var(--neutral-bg);
  color: var(--ink-soft);
}
.pill.met { background: var(--green-bg); color: var(--green); }
.pill.missing { background: var(--amber-bg); color: var(--amber); }
.pill.below { background: var(--red-bg); color: var(--red); }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
}
.chip.active { background: var(--teal-deep); color: white; border-color: var(--teal-deep); }
.fields { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-block;
  margin-left: 8px;
  background: var(--amber-bg);
  color: var(--amber);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.doc {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
  margin-bottom: 12px;
}
.files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.file-link { font-size: 14px; }
.drawer-back {
  position: fixed; inset: 0; background: rgba(20, 28, 36, 0.35); z-index: 30;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%);
  background: var(--card); z-index: 31; overflow: auto; padding: 28px;
  box-shadow: -20px 0 50px rgba(20, 28, 36, 0.18);
}
.drawer h2 { margin-top: 0; }
.close {
  float: right; border: 1px solid var(--line); background: white; border-radius: 999px; padding: 6px 10px;
}
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.note { white-space: pre-wrap; }
.coverage { color: var(--ink-soft); font-size: 14px; }
.coverage li { margin: 6px 0; }
.tiny { font-size: 12px; color: var(--muted); }
.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: end; }
.warn { color: var(--red); }

@media (max-width: 1280px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .split, .doc { grid-template-columns: 1fr; }
}
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start; }
.step b { font-family: var(--serif); font-size: 28px; line-height: 1; color: var(--teal); }
.school h2 { margin: 4px 0 8px; font-size: 28px; }
.school ul { margin: 8px 0 0; padding-left: 18px; }
.school li { margin: 6px 0; }
.next { background: #f6f0e4; border-radius: 12px; padding: 12px 14px; }
button[data-go], .gate button.primary { background: var(--teal-deep); color: white; border: 0; border-radius: 999px; padding: 10px 16px; }
#sign-out { margin-top: 18px; width: calc(100% - 16px); margin-left: 8px; background: transparent; color: #e7e1d6; border: 1px solid #3a4654; border-radius: 999px; padding: 8px 10px; }
.signed-as { margin: 8px 8px 0; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); background: var(--card); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow); }
.gate h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.05; margin: 18px 0 8px; }
.gate label { display: block; margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.gate input { width: 100%; margin-top: 6px; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 10px 12px; }
.gate .error { color: var(--red); min-height: 1.2em; }
.gate .switch { background: none; border: 0; color: var(--teal-deep); padding: 0; }
.gate button.primary { margin-top: 6px; }
.gate button.primary:disabled { opacity: 0.6; }
details summary { cursor: pointer; color: var(--teal-deep); margin-top: 8px; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: relative; height: auto; }
  h1 { font-size: 32px; }
  .main { padding: 18px 14px 48px; }
}
