/* One stylesheet, no build step. Brand colour comes from the org settings (--brand).
   Design idea: a ledger. Rows, not cards. The "when" column is the loudest thing on the page. */
:root {
  --ink: #14213d;
  --muted: #5b6478;
  --paper: #f3f5f8;
  --surface: #fff;
  --line: #d8dde6;
  --brand: #0b6e6e;
  --need: #b97a00;
  --need-bg: #fff4d6;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --ok: #2e7d4f;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1 { font-size: 1.9rem; line-height: 1.1; letter-spacing: -0.02em; font-weight: 650; margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 2rem 0 0; padding-bottom: 0.4rem; border-bottom: 2px solid var(--ink); display: flex; justify-content: space-between; align-items: baseline; }
h2 .count { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
p { margin: 0.4rem 0; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Shell: bottom tabs on a phone, a left rail on a wide screen. */
.shell { min-height: 100vh; padding-bottom: 4.5rem; }
main { padding: 1.25rem 1rem 2rem; max-width: 72rem; }
.nav { position: fixed; inset: auto 0 0 0; display: flex; background: var(--ink); z-index: 5; overflow-x: auto; }
.nav a { flex: 1; min-width: 0; padding: 0.85rem 0.2rem; text-align: center; color: #c9d2e3; text-decoration: none; font-size: 0.75rem; white-space: nowrap; }
.nav a[aria-current] { color: #fff; box-shadow: inset 0 3px 0 var(--brand); background: #1d2c4d; }
.nav .badge { background: var(--need); color: #fff; border-radius: 99px; padding: 0 0.4em; margin-left: 0.25em; font-variant-numeric: tabular-nums; }
.nav .brand, .nav form { display: none; }
@media (min-width: 60rem) {
  .shell { display: grid; grid-template-columns: 12.5rem 1fr; padding-bottom: 0; }
  .nav { position: sticky; top: 0; height: 100vh; flex-direction: column; inset: auto; overflow: visible; padding: 1.25rem 0; }
  .nav a { flex: none; text-align: left; padding: 0.6rem 1.25rem; font-size: 0.95rem; }
  .nav a[aria-current] { box-shadow: inset 3px 0 0 var(--brand); }
  .nav .brand { display: block; color: #fff; font-weight: 650; font-size: 1.05rem; padding: 0 1.25rem 1.25rem; }
  .nav form { display: block; margin-top: auto; padding: 0 1.25rem; }
  .nav form button { background: none; border: 0; color: #c9d2e3; padding: 0; min-height: 0; text-decoration: underline; }
  main { padding: 2rem 2.5rem 3rem; }
}

/* Ledger rows */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); }
.rows > li { display: grid; grid-template-columns: 5.25rem 1fr; gap: 0.25rem 0.9rem; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--line); align-items: start; }
.when { font-variant-numeric: tabular-nums; line-height: 1.15; }
.when b { display: block; font-size: 1.25rem; font-weight: 650; letter-spacing: -0.01em; }
.when span { font-size: 0.8rem; color: var(--muted); }
.late .when b, .late .when span { color: var(--danger); }
.what strong { font-weight: 600; }
.what .line { display: block; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.35rem; }
@media (min-width: 46rem) {
  .rows > li { grid-template-columns: 6rem 1fr auto; }
  .acts { grid-column: 3; margin-top: 0; justify-content: flex-end; }
}
.empty { background: var(--surface); padding: 1rem 0.9rem; color: var(--muted); border-bottom: 1px solid var(--line); max-width: none; margin: 0; }
.needs { border-left: 4px solid var(--need); }
blockquote { margin: 0.35rem 0 0; padding: 0.5rem 0.7rem; background: var(--paper); border-left: 3px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; }
blockquote.suggested { border-left-color: var(--brand); }

/* Buttons and forms: 44px targets for a thumb */
button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn { min-height: 2.75rem; padding: 0.5rem 0.9rem; border: 1px solid var(--ink); background: var(--surface); border-radius: 4px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.danger { border-color: var(--danger); color: var(--danger); }
input, select, textarea { width: 100%; min-height: 2.75rem; padding: 0.5rem 0.6rem; border: 1px solid #9aa3b5; border-radius: 4px; background: #fff; }
textarea { min-height: 5rem; resize: vertical; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.7rem 0 0.2rem; }
label .muted { font-weight: 400; }
.inline { display: inline; }
.grid2 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
details { background: var(--surface); border-bottom: 1px solid var(--line); }
details > summary { padding: 0.8rem 0.9rem; cursor: pointer; font-weight: 600; }
details > form, details > .body { padding: 0 0.9rem 1rem; }
.flash { padding: 0.7rem 0.9rem; margin: 0 0 1rem; background: var(--need-bg); border-left: 4px solid var(--need); }
.flash.error { background: var(--danger-bg); border-left-color: var(--danger); }
.banner { padding: 0.8rem 0.9rem; margin: 1rem 0; background: var(--danger); color: #fff; font-weight: 600; }
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 99px; font-size: 0.8rem; background: #e6eaf1; white-space: nowrap; }
.tag.need { background: var(--need-bg); color: #6b4700; }
.tag.stop { background: var(--danger-bg); color: var(--danger); }
.tag.good { background: #e2f3e9; color: #1f5c38; }

/* Facts under a page title */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem 1.5rem; margin: 1rem 0 0; }
.facts div { border-top: 1px solid var(--line); padding-top: 0.4rem; overflow-wrap: anywhere; }
.facts dt { font-size: 0.8rem; color: var(--muted); }
.facts dd { margin: 0; }

/* Pipeline board: columns scroll sideways on a phone */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(13.5rem, 1fr); gap: 0.75rem; overflow-x: auto; padding-bottom: 1rem; margin-top: 1rem; align-items: start; }
.col { background: #e9edf3; min-height: 8rem; }
.col.over { outline: 3px dashed var(--brand); }
.col header { padding: 0.6rem 0.7rem; border-bottom: 2px solid var(--ink); }
.col header b { display: block; }
.col header span { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.deal { background: var(--surface); margin: 0.5rem; padding: 0.65rem 0.7rem; border: 1px solid var(--line); border-left: 4px solid var(--brand); }
.deal[draggable="true"] { cursor: grab; }
.deal.stale { border-left-color: var(--need); }
.deal a { font-weight: 600; text-decoration: none; }
.deal .meta { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
.deal .next { font-size: 0.9rem; margin-top: 0.3rem; }
.deal form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.deal select, .deal button { min-height: 2.25rem; padding: 0.25rem 0.5rem; font-size: 0.9rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-top: 0.75rem; }
.filters > * { width: auto; }

/* Tables for lists */
.table { width: 100%; border-collapse: collapse; background: var(--surface); margin-top: 0.5rem; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 0.5rem 0.7rem; border-bottom: 2px solid var(--ink); }
.table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) { .table .wide { display: none; } }

/* Signed-out pages */
.door { max-width: 24rem; margin: 12vh auto 0; padding: 0 1.25rem; }
.door h1 { font-size: 2.4rem; }
.door button { width: 100%; margin-top: 1.2rem; justify-content: center; }
@media (prefers-reduced-motion: no-preference) { .col { transition: outline-color 0.1s; } }
