/* The Tare app's look, from the Tare Design System (tokens.json): board-coloured ground, one deep green, Libre Caslon
   for words, IBM Plex Mono for anything measured. Borders, not shadows; the app doesn't animate. */

@font-face { font-family: "Libre Caslon Display"; src: url("/fonts/caslon-display.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; src: url("/fonts/caslon-text.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; src: url("/fonts/caslon-text-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --tare-green: #1F4A38; --kraft: #B99B6B;
  --ground: #F2ECE1; --surface: #FBF8F2; --ink: #1F4A38; --text: #333333; --muted: #6B5530;
  --rule: #B99B6B; --rule-soft: #E2D7C3; --panel: #1F4A38; --on-panel: #F2ECE1; --on-panel-muted: #E6DCCB;
  --lamp: #E3C48E; --action: #1F4A38; --on-action: #F2ECE1; --focus: #1F4A38;
  --late-bg: #F3D9D2; --late-fg: #7A2618; --soon-bg: #F3E2BF; --soon-fg: #5E4210; --good-bg: #DCE8DF; --good-fg: #173A2C;
  --neutral-bg: #E8DFCF;
  --font-display: "Libre Caslon Display", "Big Caslon", "Iowan Old Style", Georgia, serif;
  --font-serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  --radius-md: 6px; --radius-lg: 8px; --radius-xl: 10px; --radius-pill: 999px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #10291F; --surface: #16352A; --ink: #F2ECE1; --text: #DCD3C2; --muted: #C9AE80;
    --rule: #8C7350; --rule-soft: #2A4A3C; --panel: #0B1F17; --on-panel-muted: #C9BFAE;
    --action: #E3D3B0; --on-action: #10291F; --focus: #E3C48E;
    --late-bg: #4A2018; --late-fg: #F4C7BB; --soon-bg: #46371A; --soon-fg: #F0D9A6; --good-bg: #1E3D30; --good-fg: #CDE5D5;
    --neutral-bg: #2A4A3C;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.5 var(--font-serif); }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Header ---- */
.app-header { background: var(--panel); color: var(--on-panel); padding: 14px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.wordmark { font-family: var(--font-display); font-size: 22px; letter-spacing: .18em; color: var(--on-panel); text-decoration: none; }
.app-nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.navlink { color: var(--on-panel-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-md); }
.navlink[aria-current="page"] { color: var(--on-panel); background: rgba(242, 236, 225, .14); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mode, .env { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--radius-pill); padding: 6px 12px;
  font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.mode-sim { border: 1px solid var(--kraft); color: var(--on-panel-muted); }
.mode-sim .dot { background: var(--lamp); }
.mode-live { border: 1px solid var(--on-panel); color: var(--on-panel); }
.mode-live .dot { background: var(--on-panel); }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.env { border: 1px dashed var(--on-panel-muted); color: var(--on-panel-muted); }
.signout { background: none; border: 1px solid transparent; color: var(--on-panel-muted); font: inherit; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-md); min-height: 44px; }
.signout:hover { color: var(--on-panel); }
.ticks { height: 9px; background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 12px) left bottom / 100% 6px no-repeat,
  linear-gradient(var(--rule), var(--rule)) left bottom / 100% 1px no-repeat; }

/* ---- Page ---- */
.page { max-width: 1240px; margin: 0 auto; padding: 40px 32px 64px; display: flex; flex-direction: column; gap: 40px; }
.page.narrow { max-width: 720px; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }
.title { font: 400 44px/1.1 var(--font-display); color: var(--ink); margin: 0; }
.heading { font: 400 28px/1.2 var(--font-display); color: var(--ink); margin: 0; }
.subheading { font: 400 20px/1.3 var(--font-display); color: var(--ink); }
.lede { font-size: 19px; line-height: 1.5; margin: 0; max-width: 60rem; }
.prose { margin: 0; white-space: pre-wrap; }
.caption, .note { font-size: 13px; line-height: 1.45; color: var(--muted); }
.aside { margin: 0; font-style: italic; color: var(--muted); }
.label { font: 500 11px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.num, .number-lg { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.number-lg { font-size: 30px; line-height: 1.1; color: var(--ink); }
.muted { color: var(--muted); }
.ink, .strong { color: var(--ink); }
.strong { font-weight: 500; }
.title-row, .section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.crumbs { font-size: 14px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tiles-6 .tile { padding: 14px 16px; gap: 4px; }
.number-md { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; line-height: 1.2; color: var(--ink); }
.number-md.late { color: var(--late-fg); }
.big { font-size: 18px; }
.nowrap { white-space: nowrap; }
.tbl tr.withdrawn td { color: var(--muted); text-decoration: line-through; }
.tbl tr.withdrawn td:last-child, .tbl tr.withdrawn td:nth-child(3) { text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.filters .field { flex: 0 1 260px; }
select { font: inherit; color: var(--text); background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 10px 12px; min-height: 44px; width: 100%; }
.facts .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tile, .panel { background: var(--surface); border: 1px solid var(--rule-soft); border-radius: var(--radius-xl); }
.tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.panel { padding: 6px 14px; }
.scroll { overflow-x: auto; }
.split { display: flex; flex-wrap: wrap; gap: 24px; }
.split > * { flex: 1 1 420px; min-width: 0; }
.empty { border: 1px dashed var(--rule); border-radius: var(--radius-xl); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.notice { background: var(--soon-bg); color: var(--soon-fg); border-radius: var(--radius-xl); padding: 12px 16px; }
.cards, .plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--rule-soft); border-radius: var(--radius-xl); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.tbl tfoot td { border-bottom: none; border-top: 1px solid var(--rule); font-weight: 700; }
.tbl .r { text-align: right; }

.pill { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 13px; }
.pill-late { background: var(--late-bg); color: var(--late-fg); }
.pill-soon { background: var(--soon-bg); color: var(--soon-fg); }
.pill-good { background: var(--good-bg); color: var(--good-fg); }
.pill-neutral { background: var(--neutral-bg); color: var(--text); }

/* ---- Decisions ---- */
.layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.layout > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.layout > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.decision { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.decision .row { display: flex; justify-content: space-between; gap: 12px; }
.decision .total { font-size: 17px; border-top: 1px solid var(--rule); padding-top: 10px; font-weight: 700; }
.facts { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.facts .label { margin-top: 8px; }
.facts .label:first-child { margin-top: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--ink);
  border-radius: var(--radius-lg); background: transparent; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.button-primary { min-height: 48px; padding: 0 20px; border: none; background: var(--action); color: var(--on-action); font-size: 17px; }
.button-quiet { border-color: var(--rule); color: var(--text); }
.button-small { min-height: 40px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.button:disabled { opacity: .55; cursor: default; }
.ok { margin: 0; color: var(--good-fg); background: var(--good-bg); border-radius: var(--radius-lg); padding: 10px 12px; }
.error { margin: 0; color: var(--late-fg); background: var(--late-bg); border-radius: var(--radius-lg); padding: 10px 12px; }
.result:empty { display: none; }
.result { display: flex; flex-direction: column; gap: 10px; }

.form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form .row { display: flex; gap: 12px; align-items: baseline; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 500 11px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
input, textarea { font: inherit; color: var(--text); background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { font: 14px/1.5 var(--font-mono); resize: vertical; }
input[readonly], textarea[readonly] { background: transparent; border-style: dashed; }

@media (max-width: 1000px) {
  .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .tiles, .tiles-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page, .app-header { padding-left: 16px; padding-right: 16px; }
  .title { font-size: 34px; }
}
