/* Tally — ledger page. Tokens first; everything is ruled by one grid. */
:root {
  --paper: #F2F1EC;
  --ink: #111111;
  --ink-2: #5F5E59;
  --ink-3: #6B6A64;
  --rule: rgba(17, 17, 17, 0.28);
  --rule-strong: #111111;
  --field: #FFFFFF;
  --pencil: #D24E00;      /* inferred: 4.6:1 on paper */
  --pencil-bg: rgba(210, 78, 0, 0.08);
  --pending: #1F4FCC;     /* planned */
  --pending-bg: rgba(31, 79, 204, 0.06);
  --hatch: rgba(31, 79, 204, 0.22);
  --danger: #B3261E;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --col-when: 56px;
  --col-level: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000;
    --ink: #E8E6DF;
    --ink-2: #A6A49D;
    --ink-3: #7A7973;
    --rule: rgba(232, 230, 223, 0.26);
    --rule-strong: #E8E6DF;
    --field: #0D0D0D;
    --pencil: #FF7A2F;
    --pencil-bg: rgba(255, 122, 47, 0.10);
    --pending: #7B9BFF;
    --pending-bg: rgba(123, 155, 255, 0.07);
    --hatch: rgba(123, 155, 255, 0.28);
    --danger: #FF6B62;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #000000;
  --ink: #E8E6DF;
  --ink-2: #A6A49D;
  --ink-3: #7A7973;
  --rule: rgba(232, 230, 223, 0.26);
  --rule-strong: #E8E6DF;
  --field: #0D0D0D;
  --pencil: #FF7A2F;
  --pencil-bg: rgba(255, 122, 47, 0.10);
  --pending: #7B9BFF;
  --pending-bg: rgba(123, 155, 255, 0.07);
  --hatch: rgba(123, 155, 255, 0.28);
  --danger: #FF6B62;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; }
body {
  font: 14px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  color: var(--ink);
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  caret-color: var(--pencil);
  accent-color: var(--ink);
}
::selection { background: var(--ink); color: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 1px; }
input::placeholder { color: var(--ink-3); }
a { color: inherit; }
svg { display: block; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- shell ---------- */
#app { height: 100%; min-width: 0; min-height: 0; overflow: hidden; }
.shell {
  height: 100dvh;
  width: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  padding-top: var(--top);
  overflow: hidden;
}
.shell > * { min-width: 0; min-height: 0; }
.shell.plain { grid-template-rows: auto minmax(0, 1fr); }
.top {
  display: flex; align-items: stretch; height: 44px;
  border-bottom: 2px solid var(--rule-strong);
}
.top .brand { padding: 0 16px; display: flex; align-items: center; font-weight: 700; letter-spacing: 0.12em; font-size: 13px; }
.top nav { margin-left: auto; display: flex; }
.top nav button {
  padding: 0 14px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  border-left: 1px solid var(--rule); min-width: 44px;
}
.top nav button[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.top nav button:active { background: var(--ink); color: var(--paper); }

/* day index tabs */
.daytabs { display: flex; border-bottom: 1px solid var(--rule); height: 36px; }
.daytabs .strip { display: flex; overflow-x: auto; flex: 1 1 0; min-width: 0; scroll-snap-type: x proximity; }
.daytabs button {
  flex: 0 0 auto; padding: 0 12px; height: 35px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  border-right: 1px solid var(--rule); white-space: nowrap; color: var(--ink-2); scroll-snap-align: start;
}
.daytabs button.on { background: var(--ink); color: var(--paper); }
.daytabs button.ghost { color: var(--pending); }
.daytabs button.next { color: var(--ink); border-right: 0; position: sticky; right: 0; background: var(--paper); border-left: 1px solid var(--rule); margin-left: auto; }
.daytabs button.next .plus { display: inline-block; width: 10px; height: 10px; position: relative; margin-right: 6px; vertical-align: -1px; }
.daytabs button.next .plus::before, .daytabs button.next .plus::after { content: ""; position: absolute; background: currentColor; }
.daytabs button.next .plus::before { left: 4px; top: 0; width: 2px; height: 10px; }
.daytabs button.next .plus::after { top: 4px; left: 0; height: 2px; width: 10px; }
.daytabs .cal { border-left: 1px solid var(--rule); border-right: 0; width: 44px; padding: 0; display: grid; place-items: center; color: var(--ink); }
.daytabs button:active { background: var(--ink); color: var(--paper); }

.statrule {
  display: flex; align-items: center; gap: 14px; height: 26px; padding: 0 16px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
  border-bottom: 1px solid var(--rule); overflow-x: auto; white-space: nowrap;
}
.statrule b { color: var(--ink); font-weight: 600; }
.statrule .up { color: var(--ink); } .statrule .down { color: var(--ink-2); }
.statrule .arrow { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; margin: 0 2px 1px 4px; }
.statrule .arrow.up { border-bottom: 6px solid currentColor; }
.statrule .arrow.down { border-top: 6px solid currentColor; }

/* ---------- ledger ---------- */
.ledger { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.ledger > * { flex: 0 0 auto; }
.ledger .rules { flex: 1 0 auto; min-height: 48px; background-image: repeating-linear-gradient(to bottom, transparent 0 47px, var(--rule) 47px 48px); }
.ledger .head, .row {
  display: grid; grid-template-columns: var(--col-when) minmax(0, 1fr) var(--col-level) var(--col-level);
  border-bottom: 1px solid var(--rule);
}
.ledger .head {
  position: sticky; top: 0; z-index: 2; background: var(--paper);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  border-bottom: 2px solid var(--rule-strong);
}
.ledger .head > div { min-width: 0; padding: 6px 8px; border-right: 1px solid var(--rule); overflow-wrap: anywhere; }
.ledger .head > div:last-child { border-right: 0; }
.ledger .head > div.c { text-align: center; padding-left: 0; padding-right: 0; letter-spacing: 0.06em; }
.row { min-height: 48px; position: relative; }
.row > .cell { padding: 7px 8px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.row > .cell:last-child { border-right: 0; }
.row.prop { min-height: var(--h, 48px); }
.when { min-width: 0; font-size: 12px; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.when .end { color: var(--ink-2); }
.when .dur { font-size: 10px; color: var(--ink-3); margin-top: 2px; letter-spacing: 0.04em; }
.when .none { color: var(--ink-3); }
.what { min-width: 0; font-size: 15px; line-height: 1.3; text-wrap: pretty; overflow-wrap: anywhere; }
.what .tag { font-size: 10px; color: var(--ink-3); letter-spacing: 0.06em; margin-top: 2px; text-transform: uppercase; }
.row .cell.lvl { padding: 0; display: block; }
.row .cell.lvl > button { width: 100%; height: 100%; min-height: 47px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0; transition: color 120ms var(--ease-out); }
.row .cell.lvl > button:active { background: var(--ink); color: var(--paper); }
.row .cell.lvl.ai > button { color: var(--pencil); }
.row .cell.lvl.user > button { color: var(--ink); }
.row .cell.lvl.none > button { color: var(--ink-3); }
.row .cell.lvl .lab { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; }
.blocks { display: flex; gap: 2px; }
.blocks i { display: block; width: 6px; height: 10px; border: 1px solid currentColor; }
.blocks i.f { background: currentColor; }
.blocks.n5 i { width: 5px; }
.blocks .half { position: relative; overflow: hidden; }
.blocks .half::after { content: ""; position: absolute; inset: 0; width: var(--fill, 50%); background: currentColor; }
.row.gap { min-height: 26px; background: transparent; }
.row.gap .cell { grid-column: 1 / -1; padding: 4px 8px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); text-align: center; border-right: 0; flex-direction: row; justify-content: center; gap: 8px; }
.row.gap .cell::before, .row.gap .cell::after { content: ""; flex: 1; border-top: 1px dashed var(--rule); }
.row.now { min-height: 36px; color: var(--pencil); border-bottom: 1px solid var(--pencil); }
.row.now .cell { border-right: 0; grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.row.now .cursor { display: inline-block; width: 8px; height: 14px; background: currentColor; animation: blink 1s steps(1) infinite; }
.row.now .fill { flex: 1; }
.row.planned { background: var(--pending-bg); color: var(--pending); }
.row.planned .when, .row.planned .when .end, .row.planned .what { color: var(--pending); }
.row.planned .cell.lvl { background-image: repeating-linear-gradient(45deg, transparent 0 6px, var(--hatch) 6px 7px); }
.row.planned .cell.lvl > button { color: var(--pending); }
.row.planned .plan-lab { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.row.untimed-head { min-height: 22px; }
.row.untimed-head .cell { grid-column: 1 / -1; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 4px 8px; border-right: 0; }
.row.flash { animation: flash 900ms var(--ease-out); }
.row .cell.tap { cursor: pointer; }
.row .cell.tap:active { background: var(--ink); color: var(--paper); }
.row .cell.tap:active .what .tag, .row .cell.tap:active .when .end, .row .cell.tap:active .when .dur { color: var(--paper); }
.row.add { min-height: 36px; width: 100%; display: block; color: var(--ink-3); border-bottom: 1px dashed var(--rule); }
.row.add .cell { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; border-right: 0; padding: 0 8px; height: 40px; display: flex; }
.row.add:active { background: var(--ink); color: var(--paper); }
.ledger .empty { padding: 32px 16px; color: var(--ink-2); font-size: 13px; max-width: 42ch; }
.ledger .empty b { color: var(--ink); }
.ledger .foot { display: grid; grid-template-columns: var(--col-when) minmax(0, 1fr) var(--col-level) var(--col-level); border-top: 2px solid var(--rule-strong); border-bottom: 2px solid var(--rule-strong); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.ledger .foot > div { min-width: 0; padding: 8px; border-right: 1px solid var(--rule); overflow-wrap: anywhere; }
.ledger .foot > div:last-child { border-right: 0; }
.ledger .foot b { color: var(--ink); font-weight: 600; display: block; font-size: 13px; letter-spacing: 0; }
.ledger .foot .arrow, .statrule .arrow { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; margin: 0 1px 1px 3px; }
.ledger .foot .arrow.up, .statrule .arrow.up { border-bottom: 6px solid currentColor; }
.ledger .foot .arrow.down, .statrule .arrow.down { border-top: 6px solid currentColor; }
.ledger .foot .d { font-size: 10px; color: var(--ink-2); letter-spacing: 0; text-transform: none; }
.ledger .foot .c { text-align: center; padding-left: 0; padding-right: 0; }
.ledger .spacer { height: 0; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes flash { 0% { background: var(--pencil-bg); } 100% { background: transparent; } }

/* ---------- posting line ---------- */
.post { min-width: 0; border-top: 2px solid var(--rule-strong); padding-bottom: var(--bottom); background: var(--paper); }
.post .clarify { padding: 8px 12px; border-bottom: 1px solid var(--rule); font-size: 12px; }
.post .clarify .q { color: var(--ink-2); margin-bottom: 6px; }
.post .clarify .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 10px; border: 1px solid var(--ink); font-size: 12px; min-height: 36px; }
.chip:active, .chip.on { background: var(--ink); color: var(--paper); }
.post .inflight { border-bottom: 1px solid var(--rule); }
.post .inflight .item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; font-size: 12px; color: var(--ink-2); min-height: 32px; }
.post .inflight .item .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .inflight .item .st { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.post .inflight .item.err { color: var(--danger); }
.post .inflight .item button { text-decoration: underline; text-underline-offset: 3px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; min-height: 32px; }
.post .transcript { padding: 6px 12px 8px; font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .transcript.err { color: var(--danger); white-space: normal; }
.post .line { display: flex; align-items: stretch; height: 56px; }
.post .prompt { width: 28px; display: grid; place-items: center; color: var(--ink-2); font-size: 16px; }
.post input { flex: 1; min-width: 0; font-size: 16px; padding: 0 4px; background: transparent; }
.post .line button { width: 56px; display: grid; place-items: center; border-left: 1px solid var(--rule); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.post .line button:active, .post .line button.rec { background: var(--ink); color: var(--paper); }
.post .line button.rec { background: var(--pencil); color: #fff; }
.post .line button.rec svg { animation: blink 1s steps(1) infinite; }
.post .line button:disabled { color: var(--ink-3); }
.undo { position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom) + 128px); background: var(--ink); color: var(--paper); display: flex; align-items: center; height: 44px; padding: 0 0 0 14px; font-size: 12px; z-index: 20; letter-spacing: 0.04em; }
.undo button { margin-left: auto; height: 44px; padding: 0 16px; border-left: 1px solid rgba(255,255,255,0.25); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.undo button:active { background: var(--paper); color: var(--ink); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--paper); color: var(--ink);
  border-top: 2px solid var(--rule-strong); max-height: 88dvh; display: flex; flex-direction: column;
  padding-bottom: var(--bottom); transform: translateY(0); transition: transform 220ms var(--ease-out);
  touch-action: none;
}
.sheet.dragging { transition: none; }
.sheet .handle { height: 22px; display: grid; place-items: center; }
.sheet .handle i { width: 40px; height: 3px; background: var(--ink); display: block; }
.sheet .body { overflow-y: auto; padding: 0 16px 16px; touch-action: pan-y; }
.sheet h2 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding: 4px 0 10px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; display: flex; gap: 12px; }
.sheet h2 .id { margin-left: auto; color: var(--ink-3); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.field input[type="text"], .field input[type="password"], .field input[type="time"], .field input[type="date"], .field textarea, .field select {
  width: 100%; height: 44px; padding: 0 10px; border: 1px solid var(--ink); background: var(--field); font-size: 16px;
}
.field textarea { height: auto; padding: 10px; min-height: 64px; resize: vertical; }
.field .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.seg { display: flex; border: 1px solid var(--ink); }
.seg button { min-width: 0; flex: 1; min-height: 44px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; border-right: 1px solid var(--ink); padding: 0 6px; overflow-wrap: anywhere; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg button:active { background: var(--ink); color: var(--paper); }
.seg.pencil button.on { background: var(--pencil); color: #fff; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 0 30%; border-bottom: 1px solid var(--ink); }
.field .range { display: flex; gap: 10px; align-items: center; min-width: 0; min-height: 48px; }
.field .range input[type="range"] {
  appearance: none; -webkit-appearance: none; flex: 1 1 auto; min-width: 0; width: 100%; height: 44px;
  margin: 0; padding: 0; background: transparent; cursor: pointer; touch-action: pan-y;
}
.field .range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border: 1px solid var(--ink); background: var(--field); border-radius: 0;
}
.field .range input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin-top: -11px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); box-shadow: none;
}
.field .range input[type="range"]::-moz-range-track {
  height: 4px; border: 1px solid var(--ink); background: var(--field); border-radius: 0;
}
.field .range input[type="range"]::-moz-range-progress { height: 4px; background: var(--ink); }
.field .range input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); box-shadow: none;
}
.field .range input[type="range"]:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; }
.field .range output { width: 44px; text-align: right; font-size: 14px; }
.field .hint { font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.field .hint.pencil { color: var(--pencil); }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--ink); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1; }
.btn:active { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:active { background: var(--paper); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:active { background: var(--danger); color: #fff; }
.btn.quiet { border-color: var(--rule); color: var(--ink-2); }
.btn:disabled { opacity: 0.4; }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.cal-grid .wd { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 6px 0; text-align: center; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.cal-grid button { height: 52px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; }
.cal-grid button.empty { color: var(--ink-3); }
.cal-grid button.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-grid button:active { background: var(--ink); color: var(--paper); }
.cal-grid .dot { width: 18px; height: 4px; background: currentColor; opacity: var(--o, 0.2); }
.cal-grid .plan { width: 18px; height: 4px; background-image: repeating-linear-gradient(45deg, transparent 0 2px, var(--pending) 2px 3px); }
.cal-nav { display: flex; align-items: center; margin-bottom: 10px; }
.cal-nav b { flex: 1; text-align: center; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.cal-nav button { width: 44px; height: 44px; font-size: 18px; }

/* ---------- pages (stats, settings) ---------- */
.page { min-width: 0; min-height: 0; overflow-y: auto; padding: 0 16px 40px; }
.page section { padding: 14px 0 18px; border-bottom: 1px solid var(--rule); }
.page h3 { min-width: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.page h3 small { min-width: 0; color: var(--ink-3); letter-spacing: 0.04em; text-transform: none; font-weight: 400; overflow-wrap: anywhere; }
.page p { color: var(--ink-2); font-size: 13px; text-wrap: pretty; max-width: 60ch; }
.page .muted { color: var(--ink-3); }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); }
.totals div { padding: 10px 6px; border-right: 1px solid var(--rule); min-width: 0; }
.totals div:last-child { border-right: 0; }
.totals b { display: block; font-size: 20px; font-weight: 600; line-height: 1.1; margin: 4px 0 2px; }
.totals span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.totals .d { font-size: 10px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.rangebar { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 2px solid var(--rule-strong); position: sticky; top: 0; background: var(--paper); z-index: 2; }
.rangebar .seg { flex: 1; }
.rangebar .seg button { min-height: 40px; }
.rangebar .nav { display: flex; }
.rangebar .nav button { width: 40px; height: 40px; border: 1px solid var(--ink); font-size: 18px; }
.rangebar .nav button + button { border-left: 0; }
.rangebar .nav button:active { background: var(--ink); color: var(--paper); }
.range-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding: 8px 0 0; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); }
.chart .axis { stroke: var(--rule); stroke-width: 1; }
.chart .bar { fill: var(--ink); }
.chart .bar.e { fill: url(#hatch); stroke: var(--ink); stroke-width: 0.75; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .line.soft { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.heat { min-width: 0; display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.heat .lab { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.heat i { display: block; aspect-ratio: 1; background: var(--ink); opacity: var(--o, 0.06); }
.heat i.none { background: none; border: 1px solid var(--rule); opacity: 1; }
.heat .hours { min-width: 0; grid-column: 2 / -1; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); font-size: 9px; color: var(--ink-3); }
.list { list-style: none; }
.list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13px; align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list li .k { flex: 1; min-width: 0; }
.list li .v { min-width: 0; color: var(--ink-2); font-size: 12px; white-space: normal; overflow-wrap: anywhere; text-align: right; }
.list li b { font-weight: 600; }
.kv { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 6px 12px; font-size: 13px; }
.kv span { color: var(--ink-2); }
.kv b { min-width: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* settings */
.setting { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.setting:last-child { border-bottom: 0; }
.setting .lab { font-size: 12px; }
.setting .desc { font-size: 11px; color: var(--ink-3); }
.setting .seg button { min-height: 40px; }
.setting select, .setting input[type="text"] { width: 100%; height: 44px; border: 1px solid var(--ink); padding: 0 10px; background: var(--field); font-size: 14px; }
.setting textarea { width: 100%; border: 1px solid var(--ink); padding: 8px 10px; background: var(--field); font-size: 13px; min-height: 60px; resize: vertical; }
.rubric-row { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; margin-bottom: 6px; font-size: 12px; }
.rubric-row input { width: 100%; height: 36px; border: 1px solid var(--rule); padding: 0 8px; background: var(--field); font-size: 12px; }
.rubric-row span { color: var(--ink-3); padding-top: 9px; font-size: 11px; }

/* auth */
.auth { display: grid; place-items: center; padding: 24px 16px; height: 100%; }
.auth form { width: min(100%, 360px); }
.auth .btn { width: 100%; }
.auth h1 { font-size: 13px; letter-spacing: 0.14em; font-weight: 700; margin-bottom: 20px; }
.auth p { color: var(--ink-2); font-size: 12px; margin-top: 12px; }

/* toast */
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom) + 128px); z-index: 25; background: var(--ink); color: var(--paper); padding: 12px 14px; font-size: 12px; }
.toast.err { background: var(--danger); color: #fff; }

@media (min-width: 720px) {
  :root { --col-when: 96px; --col-level: 72px; }
  .shell { max-width: 760px; margin: 0 auto; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
  .when .stack { display: inline; }
  .undo, .toast { left: 50%; right: auto; transform: translateX(-50%); width: min(92vw, 520px); }
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: min(100vw, 560px); }
  .sheet.dragging { transform: translateX(-50%); }
}
@media (hover: hover) and (pointer: fine) {
  .top nav button:hover, .daytabs button:hover, .btn:hover, .chip:hover { background: var(--ink); color: var(--paper); }
  .row .cell.tap:hover { background: var(--pencil-bg); }
}
@media (prefers-reduced-motion: reduce) {
  .row.now .cursor, .post .line button.rec svg { animation: none; }
  .sheet { transition: none; }
  .row.flash { animation: none; }
}
@media (prefers-contrast: more) {
  :root { --rule: var(--rule-strong); --ink-2: var(--ink); }
}

/* Account entry uses the same ruled controls as the ledger. */
.auth-note { margin: 16px 0; color: var(--ink-2); line-height: 1.6; }
.auth-error { margin-top: 16px; color: var(--danger); }
.auth-actions { flex-direction: column; }
.passphrase { width: 100%; padding: 12px; resize: vertical; background: var(--field); color: var(--ink); border: 1px solid var(--ink); font: inherit; line-height: 1.6; }

/* Five date slots stay visible on a phone; distant dates occupy an outer slot. */
.daytabs { height: 48px; }
.daytabs .strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; }
.daytabs .strip button { min-width: 0; height: 47px; padding: 2px; letter-spacing: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.daytabs .strip button small { font-size: 9px; }
.daytabs .strip button.has-plans:not(.on) { color: var(--pending); }
.daytabs .cal { height: 47px; flex: 0 0 44px; }
