/* Strategizer — a stone table, paper chits and dark slabs.
   Light tiles are outlined and thin; heavy tiles are solid with a thick lower
   edge, in both themes. One accent, kept for "I will" and for decisions.
   Fonts are self-hosted so the table still looks like itself with no signal. */

@font-face { font-family: "Figtree"; src: url("fonts/figtree.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --table: #e9e7e1;
  --table-2: #dfddd5;
  --tray: #f3f2ed;
  --tray-will: #fbfbf8;
  --ink: #161815;
  --ink-2: #51554e;
  --ink-3: #868a80;
  --line: #d3d1c8;
  --line-2: #bcbab0;
  --chit: #fffdf7;
  --chit-edge: rgba(22, 24, 21, .10);
  --slab: #1c1f1c;
  --slab-ink: #f3f0e6;
  --slab-edge: #000;
  --accent: #2b47d6;
  --accent-ink: #fff;
  --accent-soft: #dfe4fb;
  --works: #24744a;
  --works-soft: #d9ecdf;
  --tight: #a56a12;
  --tight-soft: #f3e4c4;
  --breaks: #b3372b;
  --breaks-soft: #f6d9d4;
  --pos: #1f6b40;
  --neg: #a23a2e;
  --sheet: #fbfaf6;
  --shadow: 0 18px 50px rgba(20, 22, 18, .22), 0 3px 10px rgba(20, 22, 18, .12);
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --gutter: 16px;
  --top-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --table: #131412;
    --table-2: #1a1b18;
    --tray: #1c1d1a;
    --tray-will: #20221f;
    --ink: #ecebe4;
    --ink-2: #a9aaa1;
    --ink-3: #777970;
    --line: #2e302b;
    --line-2: #43463f;
    --chit: #272924;
    --chit-edge: rgba(0, 0, 0, .5);
    --slab: #eceadf;
    --slab-ink: #161815;
    --slab-edge: #a9a698;
    --accent: #9aabff;
    --accent-ink: #10142c;
    --accent-soft: #262c4f;
    --works: #6fc391;
    --works-soft: #1c3326;
    --tight: #e0ae56;
    --tight-soft: #3a2d12;
    --breaks: #f08a7e;
    --breaks-soft: #42201c;
    --pos: #7fcf9d;
    --neg: #f09a8f;
    --sheet: #1d1e1b;
    --shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 3px 10px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--table);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h2, h3, h4, p { margin: 0; }
q { quotes: "“" "”"; }
kbd { font: 600 .72rem/1 var(--sans); padding: .22em .45em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--tray); margin: 0 1px; }
.nw { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.by-touch { display: none; }
@media (hover: none) { .by-touch { display: inline; } }

.app { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter) 150px; }

/* ── top bar ───────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  height: var(--top-h);
  background: color-mix(in srgb, var(--table) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand svg .bg { fill: var(--slab); }
.brand svg .lt { fill: none; stroke: var(--slab-ink); stroke-width: 1.6; }
.brand svg .hv { fill: var(--slab-ink); }
.brand svg .edge { fill: var(--accent); }
.brand b { font-weight: 750; letter-spacing: -.015em; font-size: 1.05rem; }
.board-name {
  justify-self: start; max-width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; font-family: var(--serif); font-style: italic; font-size: 1.4rem; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2);
}
.board-name:hover { border-color: var(--line-2); color: var(--ink); }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--table-2); border-radius: 999px; }
.tabs button {
  border: 0; background: transparent; min-height: 36px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px;
}
.tabs button[aria-selected="true"] { background: var(--chit); color: var(--ink); box-shadow: 0 1px 2px var(--chit-edge); }
.badge { font-size: .72rem; font-weight: 700; min-width: 1.5em; padding: .12em .45em; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums; text-align: center; }
.badge:empty { display: none; }
.top-acts { display: flex; gap: 4px; }
.icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; color: var(--ink-2); }
.icon:hover:not(:disabled) { background: var(--table-2); color: var(--ink); }
.icon:disabled { opacity: .3; cursor: default; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon svg circle { fill: currentColor; stroke: none; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.primary, .ghost {
  min-height: 44px; padding: 0 18px; border-radius: 11px; font-weight: 650; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.primary { border: 0; background: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: .38; cursor: default; }
.ghost { border: 1px solid var(--line-2); background: transparent; color: var(--ink); }
.ghost:hover:not(:disabled) { background: var(--tray); }
.ghost:disabled { opacity: .35; cursor: default; }
.ghost.danger { color: var(--breaks); border-color: color-mix(in srgb, var(--breaks) 40%, transparent); }
.small { min-height: 40px; padding: 0 14px; font-size: .88rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── the hint ──────────────────────────────────────────────────────────── */
.hint {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  margin-top: 14px; padding: 12px 14px 12px 16px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-size: .93rem;
}
.hint[hidden] { display: none; }
.hint p { flex: 1 1 320px; }
.hint .ghost { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ── the table ─────────────────────────────────────────────────────────── */
.lanes-head, .mod { display: grid; grid-template-columns: 164px minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, .9fr); gap: 10px; }
.lanes-head {
  position: sticky; top: var(--top-h); z-index: 10; align-items: end;
  padding: 16px 0 8px; background: linear-gradient(var(--table) 78%, transparent);
}
.lanes-head h2 { font: italic 400 2rem/1 var(--serif); letter-spacing: -.01em; padding-left: 4px; }
.lanes-head h2:nth-of-type(2) { color: var(--accent); }
.lanes-head h2:nth-of-type(3) { color: var(--ink-3); }

.board { display: grid; gap: 10px; }
.mod { scroll-margin: 130px; }
.mod.fresh .cell { animation: fresh 1.1s ease; }
@keyframes fresh { from { box-shadow: inset 0 0 0 2px var(--accent); } to { box-shadow: inset 0 0 0 2px transparent; } }
.mod-head { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 8px 0 0; min-width: 0; }
.mod-name {
  max-width: 100%; text-align: left; border: 0; background: transparent; padding: 4px 8px; margin-left: -8px; min-height: 36px; border-radius: 8px;
  font-size: 1.06rem; letter-spacing: -.01em; line-height: 1.15;
}
.mod-name b { font-weight: 750; }
.mod-name:hover { background: var(--table-2); }
.mod-pick, .mod-state { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.mod-state { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .8rem; color: var(--ink-2); }
.mod-state.open::before, .mod-state.soft::before, .mod-state.closed::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; border: 1.5px solid var(--accent); vertical-align: baseline;
}
.mod-state.soft::before { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.mod-state.closed::before { background: var(--accent); border-radius: 2px; }

.cell {
  position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; align-items: stretch; gap: 8px;
  min-height: 84px; padding: 10px; border-radius: 14px; background: var(--tray);
  transition: box-shadow .12s, background .12s;
}
.cell[data-lane="will"] { background: var(--tray-will); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 38%, transparent); }
.cell[data-lane="wont"] {
  background: repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--line-2) 34%, transparent) 9px 10px), var(--table-2);
}
.cell.over { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--tray)); }
.blank { align-self: center; padding: 0 6px; font-size: .84rem; color: var(--ink-3); font-style: italic; pointer-events: none; }
.no-mods { padding: 40px 0; color: var(--ink-2); font-family: var(--serif); font-style: italic; font-size: 1.5rem; }
.add {
  flex: 0 0 auto; align-self: flex-start; min-height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1.5px dashed var(--line-2); background: transparent; color: var(--ink-2); font-size: .86rem; font-weight: 600;
}
.add:hover { border-color: var(--accent); color: var(--accent); }

/* ── tiles ─────────────────────────────────────────────────────────────── */
.tile {
  position: relative; flex: 1 1 136px; max-width: 250px; min-width: 0; min-height: 58px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 9px 11px 10px; border-radius: 10px; text-align: left;
  border: 1px solid var(--line-2); background: var(--chit); color: var(--ink);
  box-shadow: 0 1.5px 0 var(--chit-edge);
  cursor: grab; touch-action: pan-y;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.tile:hover { transform: translateY(-1px); }
.tile.heavy {
  background: var(--slab); color: var(--slab-ink); border-color: var(--slab);
  box-shadow: 0 4px 0 var(--slab-edge); margin-bottom: 4px;
  --pos: #8fd6a8; --neg: #f1aa9f; --ink-3: color-mix(in srgb, var(--slab-ink) 62%, transparent);
}
@media (prefers-color-scheme: dark) { .tile.heavy { --pos: #1f6b40; --neg: #a23a2e; } }
.t-title { font-weight: 650; font-size: .93rem; line-height: 1.2; letter-spacing: -.005em; overflow-wrap: anywhere; }
.tile.heavy .t-title { font-weight: 750; }
.t-meta { display: flex; flex-wrap: wrap; gap: 2px 9px; }
.chip { font-style: normal; font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.chip small { font-size: .9em; font-weight: 500; opacity: .8; }
.chip.money.pos { color: var(--pos); }
.chip.money.neg { color: var(--neg); }
.t-when { font-family: var(--serif); font-style: italic; font-size: .95rem; line-height: 1.1; color: var(--ink-3); }
.t-seal {
  font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em;
  padding: .28em .6em; border-radius: 5px; background: var(--accent); color: var(--accent-ink);
}
.tile.closed { opacity: .5; border-style: dashed; }
.tile.closed.heavy { box-shadow: 0 2px 0 var(--slab-edge); }
.cell[data-lane="wont"] .tile { opacity: .82; }
.cell[data-lane="wont"] .t-title { text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
.tile.lifted { opacity: .28; }
.tile.landed { animation: land .34s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes land { from { transform: scale(1.09) translateY(-5px); } to { transform: none; } }

.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; margin: 0; max-width: none; pointer-events: none; cursor: grabbing;
  box-shadow: var(--shadow); transition: none; will-change: transform;
}
.drag-ghost.heavy { box-shadow: 0 5px 0 var(--slab-edge), var(--shadow); }
.drag-ghost.home { transition: transform .22s cubic-bezier(.2, .8, .3, 1); }
.dragging, .dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.marker { flex: 0 0 0; width: 0; margin: 0 -4px; position: relative; align-self: stretch; min-height: 44px; pointer-events: none; }
.marker::before { content: ""; position: absolute; left: -1.5px; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--accent); }

.board-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 18px; }
.keys { font-size: .8rem; color: var(--ink-3); }
@media (hover: none) { .keys { display: none; } }

/* ── the plan bar ──────────────────────────────────────────────────────── */
.planbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; justify-content: center; gap: 0;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--slab); color: var(--slab-ink);
  --ink-3: color-mix(in srgb, var(--slab-ink) 60%, transparent);
  --pos: #8fd6a8; --neg: #f1aa9f;
}
@media (prefers-color-scheme: dark) { .planbar { --pos: #1f6b40; --neg: #a23a2e; } }
.app:not([data-tab="board"]) .planbar { display: none; }
.fig { flex: 0 1 230px; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 0 18px; border: 0; background: transparent; color: inherit; text-align: left; border-left: 1px solid color-mix(in srgb, var(--slab-ink) 16%, transparent); }
.fig:first-child { border-left: 0; }
.fig > span { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); white-space: nowrap; }
.fig b { font-size: 1.06rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig b small { font-size: .8em; font-weight: 500; color: var(--ink-3); }
.fig b.pos { color: var(--pos); }
.fig b.neg { color: var(--neg); }
.fig.hours { flex-basis: 150px; }
.fig.once { flex-basis: 130px; }
.meter { display: block; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--slab-ink) 18%, transparent); margin-top: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--slab-ink); border-radius: 2px; }
.fig.hours.over b, .fig.hours.over .meter i { color: var(--neg); }
.fig.hours.over .meter i { background: var(--neg); }
.fig.open { flex-basis: 150px; min-height: 44px; border-radius: 0; }
.fig.open b { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* ── futures ───────────────────────────────────────────────────────────── */
.fut-head, .log-head { padding: 26px 0 12px; }
.fut-head h2, .log-head h2 { font: 400 2.6rem/1.02 var(--serif); letter-spacing: -.015em; }
.sub { color: var(--ink-2); max-width: 62ch; margin-top: 8px; }
.tally { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: .9rem; font-weight: 650; }
.tally .rule { font-weight: 400; color: var(--ink-3); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: currentColor; flex: none; }
.works { --v: var(--works); } .tight { --v: var(--tight); } .breaks { --v: var(--breaks); }
.tally .works, .tally .tight, .tally .breaks { color: var(--v); }

.maybes { margin: 6px 0 16px; }
.lab { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); margin-bottom: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.maybe {
  min-height: 44px; padding: 5px 12px; border-radius: 10px; text-align: left; display: flex; flex-direction: column; justify-content: center;
  border: 1.5px dashed var(--line-2); background: transparent; color: var(--ink-2);
}
.maybe b { font-size: .88rem; font-weight: 650; }
.maybe small { font-size: .72rem; font-variant-numeric: tabular-nums; opacity: .8; }
.maybe[aria-pressed="true"] { border-style: solid; border-color: var(--line-2); background: var(--chit); color: var(--ink); box-shadow: 0 1.5px 0 var(--chit-edge); }
.maybe.heavy[aria-pressed="true"] { background: var(--slab); color: var(--slab-ink); border-color: var(--slab); box-shadow: 0 3px 0 var(--slab-edge); }
.maybe[aria-pressed="true"] b::before { content: "+ "; }

.treebox { overflow-x: auto; overflow-y: hidden; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 14px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tree { position: relative; }
.tree svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.tree path { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.tree path.on { stroke: var(--accent); stroke-width: 2.5; }
.tree path.tail { stroke-dasharray: 2 5; stroke-linecap: round; }
.tree-head span { position: absolute; top: 0; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node {
  position: absolute; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; border-radius: 9px; text-align: left;
  border: 1px solid var(--line-2); background: var(--chit); color: var(--ink); box-shadow: 0 1.5px 0 var(--chit-edge); overflow: hidden;
}
.node b { font-size: .82rem; font-weight: 650; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.node small { font-size: .68rem; font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.node.heavy { background: var(--slab); color: var(--slab-ink); border-color: var(--slab); box-shadow: 0 3px 0 var(--slab-edge); --ink-3: color-mix(in srgb, var(--slab-ink) 62%, transparent); }
.node.root { background: transparent; border-style: dashed; box-shadow: none; }
.node.current::after { content: "now"; position: absolute; right: 6px; top: 4px; font-size: .56rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.node.on { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.outcome {
  position: absolute; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 2px; padding: 0 0 0 12px; text-align: left;
  border: 0; background: transparent; color: var(--ink);
}
.outcome .dot { grid-row: span 2; margin-right: 8px; width: 11px; height: 11px; }
.outcome b { font-size: .84rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.outcome small { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--v); }
.outcome .dot { color: var(--v); }
.outcome.on b { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.skipped { color: var(--ink-2); font-size: .9rem; margin: 0 0 14px; }

.leaf { margin: 6px 0 26px; padding: 18px 20px 20px; border-radius: 16px; background: var(--tray-will); border: 1px solid var(--line); border-left: 5px solid var(--v); scroll-margin: 90px; }
.leaf header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.leaf h3 { font: 400 1.9rem/1.05 var(--serif); letter-spacing: -.01em; }
.why { font-size: .78rem; color: var(--ink-3); }
.pill { font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; padding: .3em .7em; border-radius: 999px; white-space: nowrap; }
.pill.works { background: var(--works-soft); color: var(--works); }
.pill.tight { background: var(--tight-soft); color: var(--tight); }
.pill.breaks { background: var(--breaks-soft); color: var(--breaks); }
.line { margin-top: 8px; color: var(--ink-2); }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 22px; margin: 16px 0 0; }
.figs div { min-width: 0; }
.figs dt { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.figs dd { margin: 2px 0 0; font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.figs dd.bad { color: var(--breaks); }
.figs dd s { font-weight: 500; color: var(--ink-3); }
.counted { margin-top: 12px; font-size: .86rem; color: var(--ink-2); }
.leaf h4 { margin: 20px 0 8px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.moves li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 0 0; border-top: 1px solid var(--line); }
.mv { display: inline-flex; align-items: center; gap: 10px; flex: 1 1 240px; min-width: 0; }
.in { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.mv b { padding: 5px 10px; border-radius: 8px; font-size: .88rem; font-weight: 650; border: 1px solid var(--line-2); background: var(--chit); min-width: 0; overflow-wrap: anywhere; }
.mv b.heavy { background: var(--slab); color: var(--slab-ink); border-color: var(--slab); box-shadow: 0 3px 0 var(--slab-edge); }
.moves em { font-family: var(--serif); font-size: 1.05rem; color: var(--ink-2); }
.moves li.stays { opacity: .6; }

.ranked-h { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); margin-bottom: 8px; }
.ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ranked button {
  width: 100%; min-height: 46px; display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto 5ch auto; align-items: center; gap: 12px;
  padding: 6px 12px; border-radius: 10px; border: 1px solid transparent; background: var(--tray); color: var(--ink); text-align: left;
}
.ranked button.on { border-color: var(--accent); background: var(--tray-will); }
.rk { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nm { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en, .hr { font-size: .84rem; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; text-align: right; }

/* ── log ───────────────────────────────────────────────────────────────── */
.log { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.log li { display: grid; grid-template-columns: 5.5ch minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.log time { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 3px; }
.verb { font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-right: 4px; }
.log li.undo .verb { color: var(--tight); }
.log q, .standing q { display: block; font-family: var(--serif); font-style: italic; font-size: 1.25rem; line-height: 1.2; color: var(--ink-2); margin-top: 3px; }
.none { color: var(--ink-2); padding: 6px 0 10px; }
.standing { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 40px; max-width: 900px; }
.standing h3 { font: italic 400 1.7rem/1 var(--serif); margin-bottom: 8px; }
.standing div:first-child h3 { color: var(--accent); }
.standing ul { list-style: none; margin: 0; padding: 0; }
.standing li { padding: 10px 0; border-top: 1px solid var(--line); }
.standing div:last-child li b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.standing .in { margin-left: 6px; }

/* ── sheets ────────────────────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; margin: auto;
  width: min(580px, calc(100vw - 32px)); max-width: none; max-height: min(88dvh, 860px); padding: 0; border: 0; border-radius: 18px;
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(14, 16, 13, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet[open] { animation: rise .2s cubic-bezier(.2, .8, .3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.sheet-in { padding: 22px 24px 22px; outline: 0; }
.eyebrow { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.eyebrow.gap { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet h2 { font: 400 2rem/1.05 var(--serif); letter-spacing: -.01em; margin-top: 4px; }
.lead { margin-top: 10px; color: var(--ink-2); }
.lead b { color: var(--ink); }
.lead q { font-family: var(--serif); font-style: italic; font-size: 1.12em; }
.help { font-size: .82rem; color: var(--ink-3); margin-top: 7px; }
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); margin-bottom: 5px; }
.field input, .field textarea, .field select, .amount input, .link-sheet textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--chit); font-size: 1rem;
}
.field textarea, .link-sheet textarea { resize: vertical; line-height: 1.35; display: block; }
.link-sheet textarea { margin-top: 12px; font-size: .8rem; word-break: break-all; }
.field.big { margin-top: 6px; }
.field.big input { font: 400 1.9rem/1.1 var(--serif); padding: 8px 12px; min-height: 56px; }
.field input.bad { border-color: var(--breaks); }
.group { margin-top: 16px; }
.pair { display: grid; grid-template-columns: 1fr 1.6fr; gap: 0 12px; }
.pair.three { grid-template-columns: 1fr 1fr; }
.seg { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; background: var(--chit); }
.seg label { flex: 1 1 0; position: relative; min-width: 0; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line-2); }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 6px 12px; height: 100%; }
.seg b { font-size: .92rem; font-weight: 650; }
.seg small { font-size: .74rem; color: var(--ink-3); line-height: 1.25; }
.seg input:checked + span { background: var(--slab); color: var(--slab-ink); }
.seg input:checked + span small { color: color-mix(in srgb, var(--slab-ink) 66%, transparent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.amount { display: flex; align-items: center; gap: 8px; }
.amount .seg { flex: 0 0 auto; }
.amount .seg span { padding: 6px 13px; }
.amount input { flex: 1 1 0; min-width: 0; font-variant-numeric: tabular-nums; }
.amount .to { color: var(--ink-3); font-size: .9rem; }
.decided-note { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: .9rem; }
.decided-note q { font-family: var(--serif); font-style: italic; font-size: 1.15em; }
.foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
/* the long forms keep their buttons in reach while the fields scroll */
.tile-form .foot {
  position: sticky; bottom: 0; margin: 20px -24px -22px; padding: 12px 24px 16px;
  background: linear-gradient(transparent, var(--sheet) 14px);
}
.foot .danger { margin-left: auto; }
.menu-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file { position: relative; cursor: pointer; }
.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sheet.k-reason .figs { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); padding: 14px 16px; border-radius: 12px; background: var(--tray); margin-top: 16px; }

.lib-list { display: grid; gap: 8px; margin-top: 16px; }
.lib-item {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--chit); color: var(--ink);
}
.lib-item:hover { border-color: var(--accent); }
.lib-item b { font-weight: 750; font-size: 1.02rem; }
.lib-item .pick { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.lib-item .blurb { grid-column: 1 / -1; font-size: .88rem; color: var(--ink-2); }
.lib-item .samples { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px 6px; margin-top: 6px; }
.samples i { font-style: normal; font-size: .76rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); }
.samples i.heavy { background: var(--slab); color: var(--slab-ink); border-color: var(--slab); }
.samples small { font-weight: 500; opacity: .75; font-variant-numeric: tabular-nums; }
.lib-item.is-empty { border-style: dashed; background: transparent; }

/* ── toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 120; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px; min-height: 44px;
  border-radius: 12px; background: var(--ink); color: var(--table); font-size: .9rem; font-weight: 500; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
/* the toast floats over the table: it must never be what a tile is dropped on */
.toast { pointer-events: none; }
.toast button { pointer-events: auto; }
.dragging .toast { display: none; }
.toast.show { animation: toast .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }
.toast span { padding: 4px 8px 4px 0; }
.toast button { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: color-mix(in srgb, var(--table) 16%, transparent); color: inherit; font-weight: 700; white-space: nowrap; }
.app:not([data-tab="board"]) ~ .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ── a phone ───────────────────────────────────────────────────────────── */
@media (max-width: 719px) {
  :root { --top-h: 104px; --gutter: 14px; }
  .app { padding-bottom: 130px; }
  .top { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 54px 46px; gap: 0 6px; height: var(--top-h); align-items: center; }
  .brand b { display: none; }
  .brand { min-height: 40px; }
  .board-name { font-size: 1.5rem; padding: 0 8px; color: var(--ink); }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; margin-bottom: 8px; }
  .tabs button { flex: 1 1 0; justify-content: center; min-height: 40px; padding: 0 8px; }
  .top-acts { grid-column: 3; grid-row: 1; }

  .lanes-head { display: none; }
  .board { gap: 14px; margin-top: 14px; }
  .mod { display: block; padding: 12px; border-radius: 16px; background: var(--table-2); scroll-margin: 120px; }
  .mod-head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 0 0 8px; }
  .mod-name { font-size: 1.15rem; min-height: 40px; }
  .mod-state { margin-left: auto; }
  .cell { margin-top: 8px; padding: 30px 9px 9px; min-height: 76px; }
  .cell::before { content: attr(data-label); position: absolute; left: 12px; top: 6px; font: italic 400 1.15rem/1 var(--serif); color: var(--ink-2); }
  .cell[data-lane="will"]::before { color: var(--accent); }
  .cell[data-lane="wont"]::before { color: var(--ink-3); }
  .tile { flex: 1 1 132px; max-width: none; min-height: 56px; }
  .tile:hover { transform: none; }
  .blank { align-self: flex-start; padding: 8px 4px; }

  .planbar { padding: 9px 4px calc(9px + env(safe-area-inset-bottom)); }
  .fig { padding: 0 10px; flex: 1 1 0; }
  .fig.once, .fig.open { display: none; }
  .fig.hours { flex: 0 0 96px; }
  .fig b { font-size: .92rem; }
  .fig > span { font-size: .6rem; letter-spacing: .06em; }

  .fut-head h2, .log-head h2 { font-size: 2.1rem; }
  .leaf { padding: 16px 14px 16px; }
  .leaf h3 { font-size: 1.6rem; }
  .node { padding: 0 7px; }
  .node b { font-size: .74rem; }
  .node small { font-size: .62rem; }
  .node.root { padding: 0 4px; align-items: center; }
  .outcome { padding-left: 4px; }
  .outcome .dot { margin-right: 5px; width: 9px; height: 9px; }
  .outcome b { font-size: .76rem; }
  .outcome small.hi { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
  .mv { flex-basis: 100%; }
  .moves em { flex: 1 1 auto; }
  .ranked button { grid-template-columns: 2ch minmax(0, 1fr) auto; row-gap: 2px; padding: 8px 10px; }
  .ranked .en { grid-column: 2; grid-row: 2; text-align: left; font-size: .78rem; }
  .ranked .hr { display: none; }
  .ranked .pill { grid-column: 3; grid-row: 1 / span 2; }

  .sheet { width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sheet-in { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .tile-form .foot { margin: 16px -16px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .sheet h2 { font-size: 1.75rem; }
  .pair, .pair.three { grid-template-columns: 1fr 1fr; }
  .amount { flex-wrap: wrap; }
  .amount .seg { flex: 1 1 100%; }
  .foot .primary { flex: 1 1 100%; }
  .foot .ghost { flex: 1 1 0; }
  .foot .danger { margin-left: 0; }
  .tile-form .foot .primary { flex: 1.5 1 0; }
  .tile-form .foot .ghost { padding: 0 10px; }
  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
