/* CaRMS Portal — light, print-adjacent. Set like a working document, not a dashboard:
   hairline rules, one restrained accent, serif headings, no glowing metrics. */

:root {
  --paper: #faf8f5;
  --surface: #ffffff;
  --sunk: #f4f2ee;
  --rule: #e2ded6;
  --rule-strong: #cfc9be;

  --ink: #22201d;
  --ink-2: #4a463f;
  --ink-3: #6c665c;

  --accent: #1f5d4c;        /* deep green — links, active state, emphasis */
  --accent-soft: #eaf2ef;
  --danger: #9a2c1c;
  --danger-soft: #fbeeeb;
  --warn: #8a5a12;
  --warn-soft: #fdf3e3;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
/* `display` rules below would otherwise beat the UA stylesheet's [hidden] */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- masthead ---------- */
.top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 30px; flex-wrap: wrap;
  padding: 26px 34px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.mark { display: none; }
.top h1 {
  margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 600;
  letter-spacing: -0.015em;
}
.sub { margin: 0; color: var(--ink-3); font-size: 13px; }

/* Dates, set as a quiet row of facts rather than a scoreboard. */
.counters { display: flex; gap: 26px; flex-wrap: wrap; align-items: baseline; }
.counter { display: flex; align-items: baseline; gap: 7px; }
.counter .n {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.counter .n.warn { color: var(--warn); }
.counter .n.bad { color: var(--danger); }
.counter .l { font-size: 12.5px; color: var(--ink-3); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 0; padding: 0 34px; background: var(--surface);
  border-bottom: 1px solid var(--rule); overflow-x: auto;
}
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-2); font: inherit; font-size: 14px; padding: 10px 15px 11px;
  cursor: pointer; white-space: nowrap; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 550; }

main { padding: 30px 40px 90px; max-width: 1640px; }
.tab { display: none; }
.tab.active { display: block; }

/* ---------- typography ---------- */
h2 {
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  margin: 38px 0 6px; letter-spacing: -0.01em;
}
h2:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }
p.hint { color: var(--ink-2); font-size: 14px; line-height: 1.65; margin: 0 0 18px; max-width: 92ch; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 4px; padding: 20px 22px;
}
.card.tight { padding: 0; }
.card.tight > table { margin: 0; }
.card.accent { border-left: 3px solid var(--accent); }
.card.danger { background: var(--danger-soft); border-color: #eccfc9; }
.card.warn { background: var(--warn-soft); border-color: #eeddbe; }

/* ---------- small type ---------- */
.pill {
  display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 3px;
  border: 1px solid var(--rule-strong); color: var(--ink-2); background: var(--sunk);
  white-space: nowrap;
}
.pill.lime { background: var(--accent-soft); border-color: #b9d3ca; color: var(--accent); font-weight: 550; }
.pill.red { background: var(--danger-soft); border-color: #e7c4bd; color: var(--danger); }
.pill.amber { background: var(--warn-soft); border-color: #e8d3ac; color: var(--warn); }
.pill.blue { background: #eef1f6; border-color: #c8d2e2; color: #37507c; }
.pill.ghost { background: none; border-color: var(--rule); color: var(--ink-3); }

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.sep { height: 1px; background: var(--rule); margin: 14px 0; }

/* Long site names must not shove the seat count onto its own row. */
.card .row.between > :first-child { min-width: 0; }
.site { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 26ch; color: var(--ink-3); font-size: 13px; }

/* ---------- controls ---------- */
button.btn, a.btn {
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong);
  border-radius: 4px; padding: 6px 12px; font: inherit; font-size: 13.5px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.btn:hover, a.btn:hover { border-color: var(--accent); color: var(--accent); }
button.btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 550;
}
button.btn.primary:hover { background: #194d3f; color: #fff; }
button.btn.sm { padding: 3px 9px; font-size: 12.5px; }
button.btn.danger { color: var(--danger); border-color: #ddc3bd; }
button.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

input, select, textarea {
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong);
  border-radius: 4px; padding: 7px 9px; font: inherit; font-size: 14px; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[readonly] { background: var(--sunk); color: var(--ink-2); }
textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 0 0 4px; font-weight: 500; }
.field { margin-bottom: 13px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 5px 0;
  color: var(--ink); font-weight: 400; }
.checkline input { width: auto; accent-color: var(--accent); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--rule-strong); background: var(--sunk);
}
td { padding: 13px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfaf8; }
.scroll-x { overflow-x: auto; }

/* Referee training. The institution is what gets scanned for, so it carries the
   weight and the qualifier behind it is stepped back. Deliberately not set in the
   faint grey — this is content to be read, not metadata. */

.lede { color: var(--ink); font-size: 13px; margin-top: 4px; font-weight: 500; }
.why { color: var(--ink-3); font-size: 12px; margin-left: 4px; }

/* The referee column carries a whole training history, so give it real width and
   let the table scroll rather than crushing the fellowship lines into slivers. */
table.referees { min-width: 1180px; }
/* Block/day counts read as numbers, not as prose — never wrap them. */
table.referees td:nth-child(5) { white-space: nowrap; }
table.referees td:first-child, table.referees th:first-child { width: 42%; min-width: 400px; }

/* Program facts, set as a two-column spec table rather than a scatter of badges. */
dl.spec { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 13.5px; }
dl.spec dt { color: var(--ink-3); }
dl.spec dd { margin: 0; color: var(--ink); }

/* ---------- progress ---------- */
.bar { height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden;
  border: 1px solid var(--rule); }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.warn { background: var(--warn); }
.bar > i.bad { background: var(--danger); }

/* ---------- timeline ---------- */
.tl { position: relative; padding-left: 24px; }
.tl::before { content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px;
  width: 1px; background: var(--rule-strong); }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before {
  content: ''; position: absolute; left: -23px; top: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--paper); border: 1.5px solid var(--rule-strong);
}
.tl-item.hard::before { background: var(--accent); border-color: var(--accent); }
.tl-item.critical::before { background: var(--danger); border-color: var(--danger); }
.tl-item.done::before { background: var(--ink-3); border-color: var(--ink-3); }
.tl-item.past { opacity: 0.5; }
.tl-date { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-title { font-size: 15px; font-weight: 550; margin: 1px 0 3px; }
/* the generic `label` rule is for form captions; milestone titles are prose */
.tl-title label { font-size: 15px; color: var(--ink); margin: 0; font-weight: 550; }
.tl-why { font-size: 13.5px; color: var(--ink-2); max-width: 74ch; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(34, 32, 29, 0.34);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 46px 20px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 5px;
  width: min(900px, 100%); padding: 28px 32px; position: relative;
  box-shadow: 0 12px 40px rgba(34, 32, 29, 0.14);
}
.modal h2 { font-size: 21px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: 0;
  color: var(--ink-3); font-size: 24px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--danger); }

pre.email {
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; max-height: 440px; overflow-y: auto;
  margin: 0; color: var(--ink);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 13.5px;
  padding: 9px 18px; border-radius: 4px; z-index: 60;
  box-shadow: 0 6px 20px rgba(34, 32, 29, 0.22);
}

/* ---------- misc ---------- */
details { border-top: 1px solid var(--rule); }
details > summary { cursor: pointer; font-size: 14px; color: var(--accent); padding: 9px 0; }
details > summary:hover { color: #143f33; }
details[open] > summary { font-weight: 550; }
.longtext {
  font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.6;
  max-height: 300px; overflow-y: auto; padding: 0 8px 12px 0;
}
.empty {
  line-height: 1.7;
  color: var(--ink-3); font-size: 14px; padding: 28px; text-align: center;
  border: 1px dashed var(--rule-strong); border-radius: 4px; background: var(--surface);
}

/* ---------- referee dossier ---------- */
/* A referee reads as a page: identity, what you can prove, then the log as lines.
   Nothing is an open editor until asked for — that is the whole point of it. */
.namelink { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.namelink:hover { color: var(--accent); border-bottom-color: var(--accent); }

.domstrip { display: flex; gap: 3px; }
.dom {
  width: 20px; height: 20px; border-radius: 3px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; border: 1px solid var(--rule-strong);
}
.dom.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dom.off { background: var(--sunk); color: var(--ink-3); }

.domtable td { vertical-align: top; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); }
.domtable tr:last-child td { border-bottom: none; }

.quote {
  margin: 6px 0; padding: 6px 0 6px 14px; border-left: 2px solid var(--accent);
  font-family: var(--serif); font-size: 15px; color: var(--ink);
}
.quote cite { display: block; font: 12px var(--sans); color: var(--ink-3); font-style: normal; margin-top: 3px; }
.tight-list { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }

.block { border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); margin-bottom: 8px; }
.blockhead {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; background: none; border: none; cursor: pointer; font: inherit; color: var(--ink);
}
.blockhead:hover { background: var(--sunk); }
.blockhead .chev { color: var(--ink-3); width: 10px; }
.blockhead .grow { flex: 1; }
.blockbody { border-top: 1px solid var(--rule); }

/* One day, one line. Click to open just that one. */
.dayrow {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 12px 6px 32px;
  border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 13.5px;
}
.dayrow:last-child { border-bottom: none; }
.dayrow:hover { background: var(--sunk); }
.dayrow.starred { background: var(--accent-soft); }
.daystar { cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; }
.dayrow.starred .daystar { color: var(--accent); }
.daydate { font-variant-numeric: tabular-nums; color: var(--ink-2); width: 88px; flex: none; }
.daykind { width: 74px; flex: none; font-size: 12px; }
.daysum { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayedit { padding: 12px; border-bottom: 1px solid var(--rule); background: var(--sunk); }
.danger-label { color: var(--danger); }
.warn-text { color: var(--warn); }

/* ---------- letters ---------- */
/* A letter is written, not filled in. The program's own words sit in a fixed rail on
   the left; the writing surface takes the rest and is set like a page of prose. */

.lethead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin: 12px 0 0; }
.lethead h2 { margin: 0 0 2px; font-size: 24px; }
.lethead h2 .disc { font: 400 15px var(--sans); color: var(--ink-3); }
.lethead p { margin: 0; font-size: 13px; }

/* One line of state: how long it is, how much is answered, how many pieces. */
.metrics { display: flex; align-items: flex-end; gap: 28px; margin: 16px 0 4px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.meterwrap { flex: 1; max-width: 420px; }
.meterline { font-size: 13px; margin-bottom: 5px; }
.meterline > span:first-child { font: 600 17px var(--serif); font-variant-numeric: tabular-nums; }
.meter { height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.meterfill { height: 100%; background: var(--accent); transition: width .18s ease; }
.meterfill.over { background: var(--danger); }
.metric { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }
.metric strong { font: 600 17px var(--serif); font-variant-numeric: tabular-nums; }

.lettergrid { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 30px; align-items: start; margin-top: 18px; }
@media (max-width: 1080px) { .lettergrid { grid-template-columns: 1fr; } .letterside .sticky { position: static; } }
.letterside .sticky { position: sticky; top: 14px; }
.railhead { margin: 0 0 2px; font-size: 14px; }
.railnote { font-size: 12.5px; line-height: 1.55; margin: 0 0 10px; }

/* The descriptor's own text — never truncated, never reflowed. Monospaced so it reads
   as a quotation of a source document rather than as this app's own prose. */
.verbatim {
  white-space: pre-wrap; font: 13.5px/1.7 var(--sans); color: var(--ink);
  background: var(--sunk); border-left: 2px solid var(--rule-strong);
  padding: 12px 14px; max-height: 54vh; overflow-y: auto;
}
.rulelist { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.65; color: var(--ink-2); }
.rulelist li { margin-bottom: 5px; }

/* Their questions, as a checklist you work down. */
.qlist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 5px; background: var(--surface); }
.qrow { display: flex; align-items: baseline; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.qrow:last-child { border-bottom: none; }
.qrow:hover { background: var(--sunk); }
.qrow .qn {
  flex: none; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  font: 600 11.5px var(--sans); color: var(--ink-3); border: 1px solid var(--rule-strong); background: var(--surface);
}
.qrow.done .qn { background: var(--accent); border-color: var(--accent); color: #fff; }
.qrow .qtext { flex: 1; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.qrow.done .qtext { color: var(--ink-2); }
.qrow .qact { flex: none; font-size: 12.5px; color: var(--ink-3); min-width: 44px; text-align: right; }
.qrow:hover .qact { color: var(--accent); }

/* A section. The question it answers sits above it, quietly, as a caption. */
.lsec { border: 1px solid var(--rule); border-radius: 5px; background: var(--surface); margin-bottom: 16px; }
.lsec.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.answering {
  padding: 13px 18px; border-bottom: 1px solid var(--rule); background: var(--accent-soft);
  font: 15px/1.6 var(--serif); color: var(--ink); border-radius: 4px 4px 0 0;
}
.answering::before {
  content: 'Answering'; display: block; font: 600 10.5px var(--sans);
  letter-spacing: .09em; text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.lsechead { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; }
.lsechead .s-title { flex: 1; border: none; background: none; font: 600 16px var(--serif); color: var(--ink); padding: 2px 0; }
.lsechead .s-title:focus { outline: none; box-shadow: inset 0 -1px 0 var(--accent); }
.lsechead .sw { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ib {
  width: 24px; height: 24px; border: 1px solid transparent; background: none; border-radius: 3px;
  cursor: pointer; color: var(--ink-3); font-size: 13px; line-height: 1;
}
.ib:hover:not(:disabled) { background: var(--sunk); border-color: var(--rule-strong); color: var(--ink); }
.ib.danger:hover { color: var(--danger); border-color: var(--danger); }
.ib:disabled { opacity: .3; cursor: default; }

.toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 10px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--sunk); }
.tb {
  min-width: 26px; height: 24px; padding: 0 6px; border: 1px solid transparent;
  background: none; border-radius: 3px; cursor: pointer; font: 12.5px var(--sans); color: var(--ink-2);
}
.tb:hover { background: var(--surface); border-color: var(--rule-strong); color: var(--ink); }
.tbsep { width: 1px; height: 15px; background: var(--rule-strong); margin: 0 5px; }
.hlchip { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: #ffe98a; border: 1px solid var(--rule-strong); vertical-align: -1px; }

/* The writing surface: serif, generous, and the widest thing on the page. */
.editor { min-height: 170px; padding: 20px 24px; font: 15.5px/1.8 var(--serif); color: var(--ink); outline: none; overflow-wrap: break-word; }
.editor:empty::before { content: attr(data-placeholder); color: var(--ink-3); font-style: italic; }
.editor:focus { background: #fffefc; }
.editor ul, .editor ol { padding-left: 24px; margin: 10px 0; }
.editor p { margin: 0 0 12px; }
.editor p:last-child { margin-bottom: 0; }
.editor mark, .editor span[style*="background"] { padding: 0 2px; border-radius: 2px; }

/* Topic tags live under the text, not crammed into the toolbar. */
.lsecfoot { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--rule); background: var(--sunk); flex-wrap: wrap; }
.taglist { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tagchip {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 999px; padding: 1px 9px; font: 11.5px var(--sans); cursor: pointer;
}
.tagchip:hover { background: var(--danger); border-color: var(--danger); }
.tagmenu { position: relative; }
.tagpop {
  position: absolute; right: 0; bottom: 30px; z-index: 20; width: 262px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.12); padding: 4px; display: flex; flex-direction: column;
}
.tagopt { text-align: left; border: none; background: none; padding: 6px 9px; border-radius: 3px; cursor: pointer; font: 12.5px var(--sans); color: var(--ink-2); }
.tagopt:hover { background: var(--accent-soft); color: var(--accent); }

/* The reuse library. */
.libgroup { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.libgroup:last-child { border-bottom: none; }
.libhead { font: 600 13px var(--sans); color: var(--ink); margin-bottom: 4px; }
.librow { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-size: 13px; }
.librow.pick { cursor: pointer; padding: 7px 6px; border-radius: 3px; }
.librow.pick:hover { background: var(--accent-soft); }
.libtext { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tips { border: 1px solid var(--rule); border-radius: 5px; background: var(--surface); padding: 11px 15px; margin: 16px 0 0; }
.tips summary { cursor: pointer; font: 600 14px var(--serif); color: var(--ink); }
.tips ol { margin: 10px 0 2px; padding-left: 20px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); max-width: 76ch; }
.tips li { margin-bottom: 7px; }

.prompt { margin: 6px 0; padding-left: 12px; border-left: 2px solid var(--rule-strong); font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.letters td { vertical-align: top; }

/* ---------- experiences & coverage ---------- */
.chip {
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 4px 13px; font: 13px var(--sans); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on .faint { color: rgba(255,255,255,.8); }
.chipsep { width: 1px; height: 18px; background: var(--rule-strong); margin: 0 4px; }

/* Rows are clickable records, so they need a hover that says so. */
.letrow { cursor: pointer; }
.letrow:hover > td { background: var(--sunk); }

.exp td, .cov td { vertical-align: top; }
.exp th:nth-child(2), .exp th:nth-child(3) { white-space: nowrap; }

.covrow {
  display: flex; align-items: flex-start; gap: 16px; padding: 14px 18px;
  border-bottom: 1px solid var(--rule); cursor: pointer;
}
.covrow:hover { background: var(--sunk); }
.covcount {
  flex: none; min-width: 30px; height: 24px; padding: 0 7px; border-radius: 3px;
  display: grid; place-items: center; font: 600 13px var(--sans);
  background: var(--danger-soft); color: var(--danger); border: 1px solid #e7c4bd;
}
.covmain { flex: 1; min-width: 220px; }
.covprogs { flex: 2; display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
.covrow .chev { flex: none; }
.covdetail { padding: 4px 18px 16px 64px; border-bottom: 1px solid var(--rule); background: var(--sunk); }
.quoterow { margin-bottom: 10px; }

.pill.sm { font-size: 11.5px; padding: 1px 7px; }
.checkline.sm { font-size: 13px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- programs & timeline ---------- */
.progs td { padding: 11px 14px; }
.progs tr.dim td { color: var(--ink-3); }
.progs tr.dim strong { font-weight: 500; }
.progs tr:hover > td { background: var(--sunk); }

/* The next date, said once and loudly, above the spine. */
.nextup {
  margin-top: 18px; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 4px;
}
.nextlabel { font: 600 10.5px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.nexttitle { font: 600 19px var(--serif); margin: 3px 0 2px; }

.tlmonth { margin-top: 26px; }
.tlmonthhead {
  font: 600 12px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}

/* Section counters, and how much of a section is selected right now. */
.subcount { display: flex; gap: 12px; font-size: 12.5px; margin-top: 4px; }
#sel-w { color: var(--accent); font-weight: 550; }

/* Delete waits for a second click instead of a browser dialog. */
.ib.armed {
  width: auto; padding: 0 8px; background: var(--danger); border-color: var(--danger);
  color: #fff; font-size: 12px;
}
.ib.armed:hover { background: var(--danger); color: #fff; }

/* ---------- dashboard & settings ---------- */
/* Every row here goes somewhere. Naming a problem without a way to it is a nag. */
.attn {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--rule); cursor: pointer;
}
.attn:last-child { border-bottom: none; }
.attn:hover { background: var(--sunk); }
.attn .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.attn .dot.bad { background: var(--danger); }
.attntext { flex: 1; font-size: 14px; color: var(--ink); }

.setgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 18px; margin-top: 18px; align-items: start; }
.setgrid .card h3 { margin-bottom: 12px; }

/* ---------- referee career ---------- */
/* Internal reference material: complete, on the page with room for it, folded away
   once it has been looked up. */
.career { border: 1px solid var(--rule); border-radius: 5px; background: var(--surface); margin-top: 18px; }
.career > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; cursor: pointer;
  font: 600 14px var(--serif); color: var(--ink); list-style: none;
}
.career > summary::-webkit-details-marker { display: none; }
.career > summary::before { content: '\25b8'; color: var(--ink-3); font-size: 11px; }
.career[open] > summary::before { content: '\25be'; }
.career .crole { font: 400 13px var(--sans); color: var(--ink-2); flex: 1; }
.careerbody { padding: 4px 18px 16px 34px; }
.crow { display: flex; gap: 14px; padding: 5px 0; border-top: 1px solid var(--rule); }
.crow:first-child { border-top: none; }
.clabel {
  flex: none; width: 96px; font: 600 10.5px var(--sans); letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); padding-top: 3px;
}
.cval { flex: 1; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.cval strong { color: var(--ink); font-weight: 600; }
.cval .qual { color: var(--ink-3); font-size: 12.5px; }

.refs td { padding: 12px 16px; }

/* ---------- emails ---------- */
.modal.wide { width: min(1360px, 100%); }
.emailgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .emailgrid { grid-template-columns: 1fr; } }
.emailgrid pre.email { max-height: 46vh; }

/* The five emails in the order they go out, with what has already been sent marked. */
.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 6px; padding: 6px 13px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 4px; font: 13px var(--sans); cursor: pointer;
}
.step:hover { border-color: var(--accent); color: var(--accent); }
.step.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.done .stepmark { color: var(--accent); font-weight: 700; }
.step.on.done .stepmark { color: #fff; }
.stepmark { width: 9px; font-size: 12px; }
.ok-text { color: var(--accent); }
.linkbtn {
  background: none; border: none; padding: 0 0 0 6px; color: var(--accent);
  font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer;
}

/* ---------- documents, electives, interviews ---------- */
/* The assignment grid. A blank cell is a document the program cannot see. */
.docs th.dhead { font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
.docs td.dcell { text-align: center; padding: 8px 6px; }
.docs td.dcell.optional { background: repeating-linear-gradient(45deg, transparent, transparent 5px, var(--sunk) 5px, var(--sunk) 10px); }
.dbox { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
.dbox input { accent-color: var(--accent); width: 15px; height: 15px; }
.dbox .opt { font-size: 9px; color: var(--ink-3); letter-spacing: .04em; }
.docs tr:hover > td { background: var(--sunk); }

.covcount.soft { background: var(--warn-soft); color: var(--warn); border-color: #e8d3ac; }
tr.clash > td { background: var(--danger-soft); }
tr.clash:hover > td { background: #f7e3de; }

/* ---------- rank, costs, sweep ---------- */
.critrow { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--rule); }
.critrow:last-child { border-bottom: none; }
.critrow .c-label { flex: 1; border: none; background: none; font: 14px var(--sans); color: var(--ink); padding: 2px 0; }
.critrow .c-label:focus { outline: none; box-shadow: inset 0 -1px 0 var(--accent); }
.critrow input[type=range] { width: 150px; accent-color: var(--accent); }
.cweight { width: 14px; font: 600 14px var(--serif); font-variant-numeric: tabular-nums; color: var(--ink-2); }

.scoregrid td { padding: 8px 10px; }
.scoregrid tr.dim td { opacity: .5; }
.scoresel { width: 54px; padding: 3px 6px; font-size: 13px; }
.gutinput { width: 56px; padding: 3px 6px; font-size: 13px; text-align: center; }

/* Field-by-field read against the real 2027 page. */
.vrow { display: flex; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.vrow:last-child { border-bottom: none; }
.vlabel {
  flex: none; width: 170px; font: 600 10.5px var(--sans); letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); padding-top: 3px;
}
.vvalue { flex: 1; font-size: 13.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }

/* ---------- stories ---------- */
/* Four boxes, because the parts people skip are Task and Result. */
.starbox { border-left: 2px solid var(--rule-strong); padding-left: 16px; margin-bottom: 6px; }
.starfield { min-height: 62px; font: 14px/1.65 var(--serif); }
.starbox .field label .faint { font-weight: 400; }

/* ---------- search ---------- */
.search-backdrop {
  position: fixed; inset: 0; background: rgba(34,32,29,.28); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.search-box {
  width: min(680px, 92vw); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.18); overflow: hidden;
}
#search-input {
  width: 100%; border: none; border-bottom: 1px solid var(--rule); border-radius: 0;
  padding: 15px 18px; font: 16px var(--sans); background: none; color: var(--ink);
}
#search-input:focus { outline: none; }
#search-results { max-height: 56vh; overflow-y: auto; }
.sres { display: flex; align-items: baseline; gap: 11px; padding: 9px 18px; cursor: pointer; }
.sres.on, .sres:hover { background: var(--accent-soft); }
.sreslabel { flex: 1; font-size: 14px; color: var(--ink); }
kbd {
  font: 11px var(--mono); border: 1px solid var(--rule-strong); border-radius: 3px;
  padding: 0 4px; color: var(--ink-3); background: var(--sunk);
}

/* ---------- snapshot ---------- */
.snap-backdrop { position: fixed; inset: 0; background: var(--paper); z-index: 95; overflow-y: auto; }
.snap-bar {
  position: sticky; top: 0; display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--rule);
}
.snap-page { max-width: 900px; margin: 0 auto; padding: 34px 40px 80px; background: var(--surface); }
.snaphead h1 { font: 600 26px var(--serif); margin: 0 0 4px; }
.snaphead p { margin: 0; font-size: 14px; color: var(--ink-2); }
.snapdate { font-size: 12.5px !important; color: var(--ink-3) !important; margin-top: 6px !important; }
.snapsec { margin-top: 26px; page-break-inside: avoid; }
.snapsec h3 {
  font: 600 11px var(--sans); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--rule); padding-bottom: 5px; margin: 0 0 10px;
}
.snapsec ul { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.75; color: var(--ink); }
.snaptable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.snaptable th {
  text-align: left; font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--rule-strong); padding: 5px 8px 5px 0;
}
.snaptable td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.snaptable .q { color: var(--ink-3); font-size: 11.5px; }
.snapfoot { margin-top: 30px; font-size: 11.5px; color: var(--ink-3); }

/* An addendum is not part of the letter's word count, and should not look like it is. */
.lsec.isaddendum { border-color: #e8d3ac; background: var(--warn-soft); }
.lsec.isaddendum .editor:focus { background: #fffdf7; }

@media print {
  body > header, body > nav, body > main, #toast, #modal, #search, .snap-bar { display: none !important; }
  .snap-backdrop { position: static; overflow: visible; }
  .snap-page { max-width: none; padding: 0; }
  .snaptable { font-size: 10.5px; }
}
