/* The Mini App's one stylesheet: the chosen warm neutral/amber board (dark first, light following the
   system), contrast-corrected where a prototype pair fell under WCAG AA, system fonts only, still by
   default. Amber is spent on the now marker, the next step and the active control; nothing is red. */
:root {
  color-scheme: dark;
  --bg: #171410;
  --surface: #211c16;
  --surface-2: #2a241c;
  --line: #3a3128;
  --ink: #ece4d4;
  --ink-2: #b7ab97;
  --ink-3: #9a8d76;
  --amber: #e39a35;
  --amber-ink: #1a1408;
  --amber-soft: rgba(227, 154, 53, 0.14);
  --past: rgba(255, 255, 255, 0.05);
  --block: #4a3d2a;
  --block-ink: #f1e6cf;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3ede2;
    --surface: #fbf7ef;
    --surface-2: #efe7d8;
    --line: #d9cfbc;
    --ink: #241d14;
    --ink-2: #5c5241;
    --ink-3: #6b604e;
    --amber: #8f5510;
    --amber-ink: #fff8ec;
    --amber-soft: rgba(143, 85, 16, 0.1);
    --past: rgba(0, 0, 0, 0.05);
    --block: #e2d2b3;
    --block-ink: #2a1f0e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding: 12px 16px 64px;
  overflow-wrap: anywhere;
}
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 2; }

.wrap { max-width: 720px; margin: 0 auto; display: grid; gap: 14px; }
main:focus { outline: none; }
h1 { font-size: 22px; font-weight: 600; line-height: 1.25; margin: 4px 0 0; }
h2 { font-size: 13.5px; font-weight: 600; color: var(--ink-3); margin: 0; letter-spacing: 0.01em; }
h3.sub, h4.sub { font-size: 14px; font-weight: 600; margin: 10px 0 0; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.intro { max-width: 62ch; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* the frame */
.top { max-width: 720px; margin: 0 auto 10px; }
.sections, .tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sections a, .tabs a, .chips a, button, summary {
  font: inherit;
  font-size: 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.tabs a { flex: 1; justify-content: center; }
.sections a[aria-current="page"], .tabs a[aria-current="page"], .chips a[aria-current="page"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: var(--amber);
}
.board, .areas { display: grid; gap: 14px; }
.daytop { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.daytop .num { color: var(--ink-3); font-size: 13px; }

.card {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 14px 14px 16px;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.state h1 { font-size: 18px; }
.next { border: 1px solid var(--amber); background: var(--amber-soft); }
/* On the amber wash muted ink falls just under AA, so the next step's quiet words use the second ink. */
.next h2, .next .muted { color: var(--ink-2); }
.lead { font-size: 17px; font-weight: 500; line-height: 1.35; }

/* rows: a line of the person's words, then quieter detail */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.row { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; padding-top: 0; }
.row b { font-weight: 500; }
.row span { color: var(--ink-2); font-size: 14px; }
.row span.muted { color: var(--ink-3); }
.row a { text-decoration: none; }
.row a:hover b, .row a:focus-visible b { text-decoration: underline; }
/* A completed or passed line dims to muted ink (never celebrates, never fades below AA). */
.done b, .done span, .done a, .passed, .dim { color: var(--ink-3); }
.rest b { font-weight: 400; }
.tl { grid-template-columns: 96px 1fr; column-gap: 10px; }
.tl > * { grid-column: 2; }
.tl > .num { grid-column: 1; grid-row: 1 / span 3; padding-top: 2px; font-size: 12.5px; }
details { border-top: 1px solid var(--line); padding-top: 6px; }
.card > details:first-child { border-top: 0; padding-top: 0; }
summary { list-style: none; border: 0; background: transparent; padding: 6px 0; color: var(--ink-3); border-radius: 6px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "›"; display: inline-block; width: 1em; }
details[open] > summary::before { transform: rotate(90deg); }

/* the band: the day from its start to its end, time as space */
.band .scale {
  display: block;
  width: 100%;
  height: 56px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.band .past { fill: var(--past); }
.band .appt { fill: var(--block); stroke: var(--ink-3); stroke-width: 1; }
.band .appt.passed { fill-opacity: 0.55; }
.band .appt-name { fill: var(--block-ink); font-family: var(--mono); font-size: 10.5px; }
.band .now { fill: var(--amber); filter: drop-shadow(0 0 3px var(--amber)); }
.band .now-label { fill: var(--amber); font-family: var(--mono); font-size: 10.5px; }
.ticks { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 14px; }
.list li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.list .num { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.gap { font-size: 14px; color: var(--ink-2); }

.domains { list-style: none; margin: 0; padding: 0; }
.dom { display: grid; grid-template-columns: 76px 1fr; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.dom:first-child { border-top: 0; padding-top: 0; }
.dom .label { color: var(--ink-3); font-size: 13px; padding-top: 1px; }
.dom b { display: block; font-weight: 500; }
.dom span { display: block; color: var(--ink-2); font-size: 14px; }
.dom .sofar span { display: inline; }

/* memory */
.crumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-3); }
.crumb li + li::before { content: "›"; margin-right: 6px; }
.crumb a { color: var(--ink-3); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { min-height: 36px; font-size: 13.5px; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.links small { display: block; }
.tree details { border: 0; padding: 0; }
.tree .sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.words { display: grid; gap: 8px; }
.words .li { padding-left: 14px; text-indent: -10px; }
.words .li::before { content: "·"; display: inline-block; width: 10px; color: var(--ink-3); }
.entry { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.entry:first-of-type { border-top: 0; }
.entry .label { font-size: 13px; }
.entry.superseded .words, .entry.original .words { color: var(--ink-2); }
.attrib { border-left: 2px solid var(--amber); padding-left: 10px; color: var(--ink-2); }
.proposal { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }

/* forms */
form { display: grid; gap: 10px; margin: 6px 0; }
.field { display: grid; gap: 4px; }
label { font-size: 13.5px; color: var(--ink-2); }
input, textarea, select {
  font: inherit;
  font-size: 15px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--ink-3);
  background: var(--surface);
  color: var(--ink);
}
textarea { resize: vertical; }
.hint { color: var(--ink-3); font-size: 12.5px; }
.was { font-size: 13.5px; color: var(--ink-2); border-left: 2px solid var(--line); padding-left: 8px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
button.primary { border-color: var(--amber); color: var(--ink); background: var(--amber-soft); }
/* A removal is deliberate, not alarming: a heavier outline, never red. */
button.danger { border-width: 2px; border-color: var(--ink-2); }
details.remove { margin-top: 8px; }
button[disabled] { cursor: progress; border-style: dashed; }
.msg:empty, .flash:empty { display: none; }
.msg, .flash { font-size: 14px; color: var(--ink); }
.flash { max-width: 720px; margin: 12px auto 0; }
.loading { color: var(--ink-2); display: grid; gap: 4px; }

/* the operator's section: figures and comparison tables, in the same tokens; amber marks attention */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.figures div { display: grid; gap: 2px; }
.figures dt { font-size: 13px; color: var(--ink-3); }
.figures dd { margin: 0; font-size: 18px; }
.attention { border-left: 2px solid var(--amber); padding-left: 10px; }
form.period { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
/* A date field's own picker button takes focus inside the field, where :focus-visible does not reach. */
input[type="date"]:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }
form.period .msg { grid-column: 1 / -1; }
.scroll { overflow-x: auto; max-width: 100%; border-radius: 8px; }
/* A table keeps its words whole and scrolls sideways in its region rather than breaking them. */
table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 14px; overflow-wrap: normal; }
th[scope="row"] { max-width: 24ch; overflow-wrap: anywhere; }
td:last-child { min-width: 16ch; }
caption { text-align: left; font-weight: 600; font-size: 14px; padding: 6px 0; }
th, td { text-align: left; padding: 6px 10px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--ink-3); font-weight: 600; font-size: 13px; border-top: 0; white-space: nowrap; }
td.num { white-space: nowrap; }
th[scope="row"] { font-weight: 500; }

@media (min-width: 900px) {
  body { font-size: 16px; padding-top: 24px; }
  .areas { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .msg:not(:empty), .flash:not(:empty) { animation: arrive 180ms ease-out; }
}
@keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
