/* Inter (subset WOFF2, ~25 KB each), the same face as the invoice PDFs. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/Inter-Regular.26d68fa9bf08.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500 600; font-display: swap; src: url("../fonts/Inter-SemiBold.eb086cef61db.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/Inter-Bold.ffd12618e6d3.woff2") format("woff2"); }

/* 0xb8 time — one stylesheet, light and dark. */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --surface-3: #ebebe6;
  --fg: #1b1b19;
  --muted: #696964;
  --faint: #a5a59f;
  --line: #e3e3dd;
  --line-strong: #cfcfc8;
  --accent: #2d5bd7;
  --accent-fg: #ffffff;
  --accent-soft: #e8eeff;
  --warn: #a35a00;
  --warn-soft: #fff5e3;
  --warn-line: #efc069;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --ok: #1b7f3a;
  --ok-soft: #e7f6ec;
  --shadow: 0 1px 2px rgba(20, 20, 18, .05), 0 1px 1px rgba(20, 20, 18, .03);
  --pop-shadow: 0 24px 60px rgba(20, 20, 18, .22), 0 2px 6px rgba(20, 20, 18, .08);
  --radius: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b1a;
    --surface-2: #212120;
    --surface-3: #2a2a28;
    --fg: #ecece7;
    --muted: #a3a39d;
    --faint: #6f6f6a;
    --line: #2d2d2a;
    --line-strong: #3d3d39;
    --accent: #7ea3ff;
    --accent-fg: #0c1430;
    --accent-soft: #1c2643;
    --warn: #f3b24d;
    --warn-soft: #2a2110;
    --warn-line: #6e521d;
    --bad: #ff8f86;
    --bad-soft: #2e1715;
    --ok: #6fd391;
    --ok-soft: #13271a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --pop-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top bar ---------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 6px; color: var(--fg); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { font: 700 13px var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--fg); color: var(--bg); }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.topnav a:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.who form { margin: 0; }

.page { max-width: 1320px; margin: 0 auto; padding: 24px 20px 40px; }

/* ---- buttons & inputs ------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg);
  font: 500 14px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, select:focus-visible, .note-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
select { height: 34px; max-width: 100%; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg); font: 14px var(--font); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }

/* ---- flash messages & callouts ---------------------------------------- */
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.flash.success { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.flash.error { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.callout { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--warn-line); background: var(--warn-soft); }
.callout h2 { margin: 0 0 6px; font-size: 14px; color: var(--warn); }
.callout ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.callout button { all: unset; cursor: pointer; color: var(--fg); }
.callout button:hover { text-decoration: underline; }
.callout .when { color: var(--muted); margin-right: 6px; }

/* ---- week header -------------------------------------------------------- */
.week-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.week-head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.week-head .spacer { flex: 1; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font: 650 22px var(--font); font-variant-numeric: tabular-nums; }

/* ---- the sheet ---------------------------------------------------------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet-scroll { overflow-x: auto; border-radius: var(--radius) var(--radius) 0 0; }
table.grid { width: 100%; min-width: 980px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.grid col.c-label { width: 300px; }
.grid col.c-total { width: 84px; }
.grid th, .grid td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid thead th { position: sticky; top: 0; background: var(--surface); font-weight: 500; text-align: center; padding-top: 12px; padding-bottom: 10px; }
.grid thead th.label { text-align: left; padding-left: 16px; color: var(--muted); font-size: 12px; font-weight: 500; }
.grid .dow { display: block; font-size: 12px; color: var(--muted); }
.grid .dom { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid th.today .dow, .grid th.today .dom { color: var(--accent); }
.grid td.today { box-shadow: inset 0 2px 0 -1px var(--accent-soft); }
.grid th.today .dom::after { content: ""; display: block; width: 4px; height: 4px; margin: 3px auto 0; border-radius: 50%; background: var(--accent); }
.grid td.weekend, .grid th.weekend { background: var(--surface-2); }
.grid td.label { position: sticky; left: 0; z-index: 1; background: var(--surface); padding-left: 16px; }
.grid tbody tr:hover td.label, .grid tbody tr:hover td { background-image: linear-gradient(var(--surface-2), var(--surface-2)); }
.grid td.total, .grid th.total { text-align: right; padding-right: 16px; font-variant-numeric: tabular-nums; }
.grid td.total { font-weight: 600; }
.grid tfoot td { border-bottom: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; color: var(--muted); }
.grid tfoot td.label { color: var(--fg); text-align: left; }
.grid tfoot td.total { color: var(--fg); }

.row-label { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: baseline; min-width: 0; }
.code { font: 600 11.5px var(--mono); letter-spacing: .02em; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--fg); min-width: 38px; text-align: center; }
.row-label .client { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-label .sub { grid-column: 2; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-error { grid-column: 1 / -1; margin-top: 4px; color: var(--bad); font-size: 12.5px; white-space: normal; }

/* a day cell */
.cell { position: relative; display: flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.cell:hover { border-color: var(--line-strong); }
.cell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cell input.hours { flex: 1; min-width: 0; height: 100%; padding: 0 2px 0 8px; border: 0; outline: 0; background: transparent; color: var(--fg);
  font: 500 14px var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.cell .hours-ro { flex: 1; padding: 0 2px 0 8px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.cell.locked { background: var(--surface-2); border-color: transparent; }
.cell.locked .hours-ro { color: var(--muted); }
.cell.empty-locked { background: transparent; border-color: transparent; }
.cell.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.cell.error { border-color: var(--bad); background: var(--bad-soft); }
.cell.dirty { border-color: var(--accent); }

.note-btn { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-right: 3px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--faint); cursor: pointer; }
.note-btn:hover { background: var(--surface-3); color: var(--fg); }
/* An empty cell's note icon appears only when the cell is hovered or focused. */
.cell .note-btn:not(.has-note):not(.warn):not(.error) { opacity: 0; transition: opacity .12s; }
.cell:hover .note-btn, .cell:focus-within .note-btn, .note-btn:focus-visible { opacity: 1 !important; }
@media (hover: none) { .cell .note-btn { opacity: 1 !important; } }
.note-btn svg { width: 15px; height: 15px; }
.note-btn.has-note { color: var(--accent); }
.note-btn.warn, .note-btn.error { color: var(--warn); }
.note-btn.error { color: var(--bad); }

/* the note popover */
.note-pop { width: min(460px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--fg); box-shadow: var(--pop-shadow); }
.note-pop::backdrop { background: rgba(10, 10, 9, .18); }
.note-pop header { display: flex; gap: 10px; align-items: baseline; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.note-pop header .what { min-width: 0; }
.note-pop header .what strong { display: block; }
.note-pop header .what span { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-pop .body { padding: 12px 16px 16px; display: grid; gap: 10px; }
.note-pop textarea { width: 100%; min-height: 104px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--fg); font: 14px/1.45 var(--font); resize: vertical; }
.note-pop textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-pop .readonly { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-pop .hint { font-size: 12.5px; color: var(--muted); }
.note-pop .msg { padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.note-pop .msg.warn { background: var(--warn-soft); color: var(--warn); }
.note-pop .msg.error { background: var(--bad-soft); color: var(--bad); }
.note-pop .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note-pop .entries { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

/* sticky action bar under the sheet */
.actionbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px;
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px); }
.actionbar .add { display: flex; gap: 8px; align-items: center; min-width: 0; }
.actionbar .add .combo { width: 380px; }
.actionbar .spacer { flex: 1; }
.actionbar .state { color: var(--muted); font-size: 13px; }
.actionbar .state.dirty { color: var(--accent); font-weight: 500; }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.legend i.l-locked { background: var(--surface-2); border-color: var(--line-strong); }
.legend i.l-warn { background: var(--warn-soft); border-color: var(--warn-line); }

/* ---- sign-in ------------------------------------------------------------ */
.auth { min-height: calc(100vh - 52px); display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 32px 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card p { margin: 0 0 20px; color: var(--muted); }
.auth-card .btn { width: 100%; height: 42px; font-size: 15px; }
.auth-card .error { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); }
.auth-card .dev { margin: 16px 0 0; font-size: 13px; text-align: center; }
.auth-card form p { margin: 0 0 12px; color: var(--fg); }
.auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] { width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font: 14px var(--font); }

/* ---- search-as-you-type picker -------------------------------------------- */
.combo { position: relative; min-width: 0; }
.combo-input { width: 100%; height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--fg);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%238a8a85' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='5' cy='5' r='3.5'/%3E%3Cpath d='M7.6 7.6 10.5 10.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  font: 14px var(--font); text-overflow: ellipsis; }
.combo-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo-input::placeholder { color: var(--faint); }
.combo-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; width: max(100%, 380px); max-height: 360px; overflow: auto; margin: 0; padding: 4px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--pop-shadow); }
.combo[data-up] .combo-list { top: auto; bottom: calc(100% + 4px); }
.combo-group { padding: 8px 10px 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.combo-option { padding: 7px 10px 7px 20px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-option[aria-selected="true"] { background: var(--accent-soft); }
.combo mark { background: none; color: var(--accent); font-weight: 650; }
.combo-empty { padding: 10px; color: var(--muted); }
.person-pick { width: 240px; }

/* ---- single entry page --------------------------------------------------- */
.entry-card { max-width: 620px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.entry-card h1 { margin: 0 0 4px; font-size: 20px; }
.entry-card .lede { margin: 0 0 20px; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; min-width: 0; }
.field label { font-weight: 500; }
.field input[type=date], .field input[type=text], .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg); font: 14px var(--font); }
.field input[type=date], .field input[type=text] { height: 36px; padding: 0 10px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-size: 13px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 16px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.btn-danger { color: var(--bad); }
.meta { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
.viewing { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .who .name { display: none; }
  .page { padding: 16px 12px 32px; }
  .grid col.c-label { width: 200px; }
  .actionbar .add select, .actionbar .add .combo { width: 100%; }
  .person-pick { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .actionbar .add { flex: 1 1 100%; }
}

/* ---- day view ------------------------------------------------------------- */
.view-toggle .btn[aria-current="page"] { background: var(--surface-3); font-weight: 600; cursor: default; }
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.day-head .spacer { flex: 1; }
.btn-track { height: 36px; padding: 0 16px; font-weight: 600; }
.datepick { position: relative; min-width: 210px; gap: 8px; }
.datepick input[type="date"] { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.daytabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) auto; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.daytab, .weektotal { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 9px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.daytab:hover { color: var(--fg); text-decoration: none; background: var(--surface-2); border-radius: 8px 8px 0 0; }
.daytab .dname { font-weight: 600; color: var(--fg); }
.daytab .dtotal, .weektotal .dtotal { font-size: 13px; font-variant-numeric: tabular-nums; }
.daytab.selected { border-bottom-color: var(--accent); }
.daytab.selected .dtotal { color: var(--fg); font-weight: 600; }
.daytab.is-today .dname { color: var(--accent); }
.weektotal { align-items: flex-end; text-align: right; }
.weektotal .dname { color: var(--fg); font-weight: 600; }
.weektotal .dtotal { color: var(--fg); font-weight: 600; }

.entries { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 12px; }
.entry { border-bottom: 1px solid var(--line); }
.entry.warn { background: var(--warn-soft); }
.entry-view { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; align-items: center; gap: 16px; padding: 14px 16px; }
.entry-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.entry-title strong { font-weight: 650; }
.entry-task { margin-top: 1px; }
.entry-note { margin-top: 4px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.entry-warn { margin-top: 6px; color: var(--warn); font-size: 13px; }
.entry-meta { margin-top: 4px; color: var(--faint); font-size: 12px; }
.entry-hours { font: 600 20px var(--font); font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }
.entry-actions { display: flex; justify-content: flex-end; }
.lock { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12.5px; }
.entry-edit { padding: 14px 16px; background: var(--surface-2); }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; }
.edit-grid textarea { grid-column: 1 / -1; }
.hours-input { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg);
  font: 600 15px var(--font); font-variant-numeric: tabular-nums; text-align: right; width: 100%; }
.entry-edit textarea, .track-dialog textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--fg); font: 14px/1.45 var(--font); resize: vertical; }
.hours-input:focus, .entry-edit textarea:focus, .track-dialog textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.edit-actions .spacer { flex: 1; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.day-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.day-foot .spacer { flex: 1; }
.day-foot strong { font-size: 18px; min-width: 64px; text-align: right; margin-right: 126px; }
.day-bottom { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.day-bottom .spacer { flex: 1; }

.track-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); box-shadow: var(--pop-shadow); overflow: visible; }
.track-dialog::backdrop { background: rgba(10, 10, 9, .28); }
.track-dialog header { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.track-dialog h2 { margin: 0; font-size: 16px; }
.track-dialog .body { display: grid; gap: 12px; padding: 16px 20px; }
.track-dialog footer { display: flex; gap: 8px; padding: 12px 20px 16px; }
.track-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; align-items: start; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.shortcut { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 10px 0 4px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--fg); font: 13px var(--font); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shortcut .code { min-width: 0; padding: 1px 5px; font-size: 11px; }
.shortcut:hover { border-color: var(--accent); }
.shortcut.picked { border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 720px) {
  .daytabs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .weektotal { display: none; }
  .daytab { padding: 8px 4px; align-items: center; }
  .entry-view { grid-template-columns: minmax(0, 1fr) auto; }
  .entry-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .day-foot strong { margin-right: 0; }
  .track-row, .edit-grid { grid-template-columns: 1fr; }
  .datepick { min-width: 0; }
}

/* ---- invoicing ------------------------------------------------------------ */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .spacer, .tabs .spacer, .create-bar .spacer, .form-actions .spacer { flex: 1; }
.page-head form { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.small { font-size: 12.5px; }
.tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.tabs a:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.tabs .count { margin-left: 4px; color: var(--faint); font-variant-numeric: tabular-nums; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list tbody tr:hover { background: var(--surface-2); }
table.list .r, table.lines .r, .lines input.r { text-align: right; }
.empty-row { text-align: center; padding: 28px !important; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--fg); white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-draft { background: var(--accent-soft); color: var(--accent); }
.client-pick { width: 320px; }
.period { padding: 16px; margin-bottom: 16px; }
.period-grid { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.period-grid label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.period-grid input[type=date], .inv-head input, .inv-head select, .pay-form input, .gate input[type=text], .gate select {
  height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font: 14px var(--font); }
.period-grid .check-inline { display: inline-flex; color: var(--fg); font-size: 13px; padding-bottom: 8px; }
.summary { margin: 12px 0 0; }
.gate h2 { margin: 20px 0 4px; font-size: 16px; color: var(--warn); }
.gate h3 { margin: 16px 0 8px; font-size: 14px; }
.gate-list { overflow: hidden; }
.gate-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--warn-soft); }
.gate-row:last-child { border-bottom: 0; }
.gate-actions { display: grid; gap: 6px; align-content: start; }
.gate-actions form.inline { display: flex; gap: 6px; }
.gate-actions input[type=text], .gate-actions select { flex: 1; min-width: 0; }
.create-bar { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.create-bar button[disabled] { opacity: .5; cursor: not-allowed; }
.inv-stats { display: flex; flex-wrap: wrap; gap: 28px; margin: 0 0 16px; }
.inv-stats > div { display: flex; flex-direction: column; }
.inv-stats .label { font-size: 12px; color: var(--muted); }
.inv-stats .value { font-size: 18px; font-weight: 600; }
.inv-form { padding: 16px; }
.inv-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.inv-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.inv-head label, .pay-form label, .notes { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.inv-head .wide { grid-column: 1 / -1; }
table.lines { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.lines th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lines tfoot td { border-bottom: 0; padding-top: 12px; font-size: 15px; }
table.lines select, table.lines input, table.lines textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); font: 13.5px/1.4 var(--font); }
table.lines textarea { resize: vertical; min-height: 34px; field-sizing: content; }
table.lines td.amount { padding-top: 13px; font-weight: 600; }
table.lines tr.removed td { opacity: .4; text-decoration: line-through; }
.lines .del { display: inline-flex; padding-top: 9px; color: var(--muted); cursor: pointer; font-size: 13px; }
.lines .del input { width: auto; }
.inv-form fieldset[disabled] select, .inv-form fieldset[disabled] input, .inv-form fieldset[disabled] textarea { border-color: transparent; background: transparent; color: var(--fg); }
.notes { margin-top: 16px; }
.notes textarea { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font: 14px var(--font); }
.inv-form .form-actions { margin-top: 16px; }
.payments { padding: 16px; margin-top: 16px; }
.payments h2 { margin: 0 0 10px; font-size: 16px; }
.pay-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-row form { margin-left: auto; }
.pay-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.pay-form .wide { flex: 1; min-width: 200px; }
@media (max-width: 720px) {
  .inv-head { grid-template-columns: 1fr 1fr; }
  .gate-row { grid-template-columns: 1fr; }
  .client-pick { width: 100%; }
}
.preview { padding: 16px; margin-bottom: 16px; }
.preview h2 { margin: 0 0 10px; font-size: 16px; }
.inv-head input[type=text] { width: 100%; }
.lines .check-inline { white-space: nowrap; padding-top: 8px; }
.btn.disabled { opacity: .5; cursor: not-allowed; }
/* weekly review */
.review { margin-bottom: 18px; }  /* not overflow:hidden: the project picker's list must show */
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.review-head h2 { margin: 0; font-size: 16px; }
.review-head .spacer { flex: 1; }
.review-table td { vertical-align: top; }
.review-table tr.flagged td { background: var(--warn-soft); }
.review-table textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); font: 13.5px/1.4 var(--font); resize: vertical; field-sizing: content; min-height: 34px; }
.review-table .hours-input { width: 70px; }
.review-table .readonly { padding: 6px 8px; border-radius: 6px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.review-table td.day-cell, .review-table td.pair-cell { padding-left: 8px; padding-right: 4px; }
.review-table td.day-cell { padding-left: 10px; }
/* Day and project read as text until hovered or focused. */
.review-table select.quiet, .review-table .combo.quiet .combo-input { width: 100%; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--fg); font: 13.5px var(--font); text-overflow: ellipsis; }
.review-table select.quiet { font-weight: 600; appearance: none; -webkit-appearance: none; cursor: pointer; }
.review-table .combo.quiet .combo-input { padding-right: 6px; background-image: none; }
.review-table tr:hover select.quiet, .review-table tr:hover .combo.quiet .combo-input { border-color: var(--line-strong); background: var(--surface); }
.review-table select.quiet:focus, .review-table .combo.quiet .combo-input:focus { outline: 0; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.review-table td.billed-cell { color: var(--muted); padding-top: 16px; }
.review-table td.hours-cell { padding-top: 10px; }
.review-table tr.locked td.day-cell, .review-table tr.locked td.pair-cell { padding-top: 16px; }
.review-table td.actions-cell { padding-top: 10px; text-align: right; white-space: nowrap; }
.review-table td.actions-cell .check-inline { margin-right: 4px; color: var(--muted); }
.review-table tr.to-delete td { background: var(--surface-2); }
.review-table tr.to-delete :is(select, .combo-input, textarea, .hours-input) { text-decoration: line-through; opacity: .55; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.lint { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.review .actionbar { position: static; border-radius: 0; }
/* With unsaved changes, Save stays in view while scrolling that client's entries. */
.review form.dirty .actionbar { position: sticky; bottom: 0; box-shadow: 0 -6px 16px rgba(0, 0, 0, .06); }

/* review: work that went on no entry */
.gaps .review-head .muted { flex-basis: 100%; font-size: 13.5px; }
.gap-list { margin: 0; padding: 0; list-style: none; }
.gap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.gap:last-child { border-bottom: 0; }
.gap-folder { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }
.gap-form, .gap-decided { display: flex; align-items: center; gap: 8px; margin: 0; }
.gap-form .combo { width: 260px; }
.gap-decided span { color: var(--muted); font-size: 13.5px; max-width: 420px; }
.gap.decided { background: var(--surface-2); }
.entry-from { margin-top: 4px; color: var(--muted); font-size: 12.5px; }

/* client margins */
.report-tabs { margin: -4px 0 14px; }
.period-pick { margin: 0; }
.num.neg, .neg .num { color: var(--bad); }
.margin-table td { white-space: nowrap; }
.margin-table td.lead { white-space: normal; }
.margin-table tfoot td { border-bottom: 0; font-weight: 600; }
.margin-table tfoot tr.total-row td { border-top: 1px solid var(--line-strong); }
.margin-table tfoot tr.internal-row td { font-weight: 400; }
.margin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.card-title { margin: 0; padding: 14px 16px 10px; font-size: 15px; border-bottom: 1px solid var(--line); }
.fine-print { margin-top: 12px; max-width: 900px; }
p.back { margin: 0 0 6px; }

/* detailed report */
.range-nav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.range-label { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-filters { padding: 16px; margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.filter-grid > label, .multi-field { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.filter-grid select, .filter-grid input[type=date], .filter-grid input[type=text]:not(.combo-input) { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font: 14px var(--font); width: 100%; }
.filter-grid .check-inline { display: inline-flex; padding-bottom: 8px; color: var(--fg); font-size: 13px; }
.report-filters .form-actions { margin-top: 14px; }
.combo.multi .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.combo.multi .chips:not(:empty) { margin-bottom: 4px; }
.chip-sel { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--fg); font-size: 12.5px; }
.chip-sel button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.chip-sel button:hover { color: var(--fg); }
.report-totals { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0 0 14px; }
.report-totals > div { display: flex; flex-direction: column; }
.report-totals .label { font-size: 12px; color: var(--muted); }
.report-totals .value { font-size: 18px; font-weight: 600; }
.report-table td { vertical-align: top; }
.report-table td.note-cell { overflow-wrap: anywhere; }
.report-table td.num.lead { white-space: nowrap; }
.report-filters summary { cursor: pointer; list-style: none; }
.report-filters summary::-webkit-details-marker { display: none; }
.report-filters summary::before { content: "▸ "; color: var(--muted); }
.report-filters[open] summary::before { content: "▾ "; }
.report-filters[open] summary { margin-bottom: 12px; }
.report-table tr.flagged td { background: var(--warn-soft); }
.report-table tr.group-row td { background: var(--surface-2); border-top: 1px solid var(--line-strong); }
@media (max-width: 1000px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .filter-grid { grid-template-columns: 1fr; }
  .report-totals .value { font-size: 16px; }
  .report-table tr.group-row td { padding: 8px 0; }
}

/* ===== phone-only pieces, hidden on larger screens ===== */
.tabbar, .fab, .day-summary, .m-card { display: none; }

/* the "More" sheet (opened from the tab bar) */
.sheet-menu { position: fixed; inset: auto 0 0 0; width: 100%; margin: 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  border: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; background: var(--surface); color: var(--fg); box-shadow: var(--pop-shadow); }
.sheet-menu::backdrop { background: rgba(10, 10, 9, .3); }
.sheet-handle { width: 40px; height: 4px; margin: 4px auto 12px; border-radius: 4px; background: var(--line-strong); }
.sheet-menu p { margin: 0 4px 6px; }
.sheet-menu a, .sheet-menu button { display: flex; align-items: center; width: 100%; min-height: 50px; padding: 0 6px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--fg); font: 500 16px var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.sheet-menu form { margin: 0; }
.sheet-menu button { color: var(--bad); }

/* ===== phones ===== */
@media (max-width: 720px) {
  /* iOS zooms into any field under 16px; keep every field at 16px. */
  input, select, textarea, .combo-input { font-size: 16px !important; }

  body.signed-in { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; gap: 0; flex-wrap: nowrap; }
  .topnav, .who { display: none; }
  .page { padding: 12px 14px 28px; }
  .page-head { gap: 8px 10px; margin-bottom: 12px; }
  .page-head h1, .week-head h1 { font-size: 22px; letter-spacing: -.015em; }
  .flash { font-size: 14px; }

  /* bottom tab bar */
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; padding: 0; border: 0; background: none; color: var(--muted); font: 500 10.5px var(--font); letter-spacing: .01em;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button svg circle { fill: currentColor; stroke: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.1; }

  /* ---- day view ---- */
  .day-head { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 4px; }
  .btn-track, .view-toggle, .day-foot { display: none; }
  .datenav { display: grid; grid-template-columns: 46px 1fr 46px; width: 100%; }
  .datenav .btn { height: 46px; font-size: 16px; }
  .datenav .btn-icon { font-size: 22px; }
  .datepick { min-width: 0; font-weight: 600; letter-spacing: -.01em; }
  .datepick svg { display: none; }
  .today-link { justify-self: start; margin: -2px 0 0 2px; font-size: 14px; font-weight: 500; }
  .person-pick { width: 100%; }
  .daytabs { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 6px 0 4px; border: 0; }
  .weektotal { display: none; }
  .daytab { align-items: center; gap: 0; padding: 7px 0 8px; margin: 0; border: 0; border-radius: 14px; -webkit-tap-highlight-color: transparent; }
  .daytab:hover { background: none; border-radius: 14px; }
  .daytab .dname { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .daytab .dnum { font-size: 18px; font-weight: 600; color: var(--fg); line-height: 1.25; font-variant-numeric: tabular-nums; }
  .daytab .dtotal { font-size: 10.5px; color: var(--faint); }
  .daytab.is-today .dnum { color: var(--accent); }
  .daytab.selected, .daytab.selected:hover { background: var(--accent); }
  .daytab.selected .dname, .daytab.selected .dnum, .daytab.selected .dtotal { color: var(--accent-fg); }
  .day-summary { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 4px 10px; font-size: 14.5px; }
  .day-summary strong { font-size: 17px; }

  .entries { margin-top: 0; border-radius: 16px; overflow: hidden; }
  .entry-view { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 14px 16px; align-items: start; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .entry-view:active { background: var(--surface-2); }
  .entry-main { grid-column: 1; grid-row: 1 / 3; }
  .entry-hours { grid-column: 2; grid-row: 1; font-size: 19px; min-width: 0; }
  .entry-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .entry-actions .btn { display: none; } /* tap the card to edit */
  .entry-title { gap: 6px; }
  .entry-title strong { font-size: 15.5px; letter-spacing: -.01em; }
  .entry-task { margin-top: 1px; font-size: 13.5px; color: var(--muted); }
  .entry-note { margin-top: 6px; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .entry.expanded .entry-note { display: block; }
  .entry-edit { padding: 14px 16px 16px; }
  .edit-grid { grid-template-columns: 1fr 96px; }
  .edit-grid .combo { grid-column: 1 / -1; }
  .edit-grid textarea { grid-column: 1 / -1; grid-row: 2; }
  .edit-grid .hours-input { grid-column: 1; grid-row: 3; width: 110px; height: 44px; }
  .edit-actions .btn { height: 40px; }
  .day-bottom { justify-content: center; margin: 18px 0 6px; }
  .day-bottom .spacer { display: none; }

  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 25;
    width: 58px; height: 58px; border: 0; border-radius: 20px; background: var(--accent); color: var(--accent-fg); cursor: pointer;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgba(0, 0, 0, .15); -webkit-tap-highlight-color: transparent; }
  .fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
  .fab:active { transform: scale(.96); }

  /* Track time: a bottom sheet */
  .track-dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border: 0; border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0; overflow: auto; padding-bottom: env(safe-area-inset-bottom); }
  .track-dialog header { padding: 18px 18px 12px; }
  .track-dialog h2 { font-size: 17px; }
  .track-dialog .body { padding: 14px 18px; }
  .track-dialog .shortcuts { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 0 18px 4px; scrollbar-width: none; }
  .track-dialog .shortcuts::-webkit-scrollbar { display: none; }
  .track-dialog .shortcuts > .muted { flex: none; }
  .shortcut { flex: none; height: 34px; }
  .track-row { grid-template-columns: 1fr 96px; }
  .track-row .hours-input { height: 44px; }
  .track-dialog footer { position: sticky; bottom: 0; padding: 12px 18px 16px; background: var(--surface); border-top: 1px solid var(--line); }
  .track-dialog footer .btn { flex: 1; height: 46px; font-size: 16px; }
  .combo-list { width: 100%; max-height: 50dvh; }
  .combo-option { padding: 11px 12px 11px 20px; }

  /* ---- generic label/value stacking (recurring, QuickBooks lists) ---- */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead, table.stack colgroup { display: none; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 2px 0; text-align: left !important; }
  table.stack td[data-label] { display: flex; justify-content: space-between; gap: 12px; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex: none; }
  table.stack td.full { display: block; }
  table.stack td.lead { font-size: 15.5px; font-weight: 600; }

  /* ---- phone cards: invoices list and report ---- */
  .m-card { display: block; }
  .inv-table thead, .report-table thead, .margin-table thead { display: none; }
  .inv-table, .inv-table tbody, .report-table, .report-table tbody, .margin-table, .margin-table tbody, .margin-table tfoot { display: block; }
  .inv-table tr, .report-table tr, .margin-table tr { display: block; }
  .inv-table td:not(.m-card), .report-table tr:not(.group-row) td:not(.m-card), .margin-table td:not(.m-card) { display: none; }
  .margin-table td.m-card { padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: normal; }
  .margin-table tfoot tr.total-row { display: none; }  /* the tiles above carry the totals */
  .margin-table tfoot td.m-card { font-weight: 400; }
  .margin-grid { grid-template-columns: 1fr; }
  .gap { grid-template-columns: 1fr; }
  .gap-form { flex-wrap: wrap; }
  .gap-form .combo { width: 100%; }
  .gap-form .btn { flex: 1; height: 40px; }
  .margin-months thead { display: none; }
  .margin-months, .margin-months tbody { display: block; }
  .margin-months tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.margin-months td { display: block; padding: 0; border: 0; text-align: left !important; }
  .margin-months td.lead { grid-column: 1 / -1; font-weight: 600; font-size: 15px; margin-bottom: 2px; }
  .margin-months td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11.5px; }
  .inv-table td.m-card, .report-table td.m-card { padding: 0; border-bottom: 1px solid var(--line); }
  .inv-table td.m-card a { display: block; padding: 13px 16px; color: var(--fg); text-decoration: none; }
  .inv-table td.m-card a:active { background: var(--surface-2); }
  .mc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .mc-top strong, .mc-top a { font-size: 15.5px; font-weight: 600; }
  .mc-top .num, .mc-hours { font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .mc-sub { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; color: var(--muted); font-size: 13.5px; }
  .report-table td.m-card { padding: 13px 16px; }
  .report-table tr.flagged td.m-card { background: var(--warn-soft); }
  .mc-where { margin-top: 3px; font-size: 13.5px; }
  .mc-note { margin-top: 5px; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .mc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
  .report-table tr.group-row td { display: block; padding: 10px 16px; font-size: 14px; }
  .report-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-totals > div { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
  .report-totals .value { font-size: 17px; }
  .tabs { gap: 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }

  /* ---- weekly review: one card per entry ---- */
  .review { border-radius: 16px; }
  .review-head { padding: 14px 16px; }
  .review-head h2 { font-size: 17px; }
  .review-table, .review-table tbody { display: block; }
  .review-table thead, .review-table colgroup { display: none; }
  /* One block per entry: day + hours / project / note / billed + actions. */
  .review-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
  table.review-table td, table.review-table td[class] { display: block; width: auto; padding: 0; border: 0; text-align: left; }
  .review-table td.day-cell { grid-area: 1 / 1; }
  .review-table td.hours-cell { grid-area: 1 / 2; text-align: right; }
  .review-table td.pair-cell { grid-area: 2 / 1 / 3 / 3; }
  .review-table td.note-cell { grid-area: 3 / 1 / 4 / 3; }
  table.review-table td.hours-cell { justify-self: end; }
  .review-table tr.flagged { background: var(--warn-soft); }
  .review-table tr.flagged td, .review-table tr.to-delete td { background: transparent; }
  .review-table tr.to-delete { background: var(--surface-2); }
  .review-table td.billed-cell { grid-area: 4 / 1; font-size: 13px; }
  .review-table td.billed-cell::before { content: "Billed "; }
  .review-table td.actions-cell { grid-area: 4 / 2; display: flex; align-items: center; gap: 6px; }
  .review-table tr.locked td.day-cell { font-size: 15.5px; }
  .review-table tr.locked td.pair-cell { color: var(--muted); font-size: 13.5px; }
  .review-table select.quiet { width: auto; max-width: 100%; height: 40px; padding: 0 8px; border-color: var(--line); background: var(--surface); appearance: auto; -webkit-appearance: menulist; }
  .review-table .combo.quiet .combo-input { height: 44px; padding: 0 10px; border-color: var(--line); background: var(--surface); color: var(--muted); }
  .review-table .hours-input { width: 84px; height: 40px; }
  .review-table textarea { min-height: 88px; padding: 10px 12px; font-size: 16px; }
  .review-table td.actions-cell .btn { height: 36px; }
  .review .actionbar { flex-direction: column-reverse; align-items: stretch; gap: 8px; padding: 12px 16px 16px; }
  .review .actionbar .btn { height: 44px; }
  .review .actionbar .spacer { display: none; }

  /* ---- invoice page ---- */
  .inv-form { padding: 14px; }
  .inv-head { grid-template-columns: 1fr 1fr; }
  table.lines, table.lines tbody { display: block; }
  table.lines colgroup, table.lines thead { display: none; }
  table.lines tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.lines tbody td { border: 0; padding: 0; }
  table.lines tbody td:nth-child(1) { grid-area: 1 / 1; }
  table.lines tbody td:nth-child(5) { grid-area: 1 / 2; text-align: right; padding-top: 8px; }
  table.lines tbody td:nth-child(2) { grid-area: 2 / 1 / 3 / 3; }
  table.lines tbody td:nth-child(3) { grid-area: 3 / 1; }
  table.lines tbody td:nth-child(4) { grid-area: 3 / 2; }
  table.lines tbody td:nth-child(6) { grid-area: 4 / 1 / 5 / 3; }
  table.lines tbody td:nth-child(3)::before, table.lines tbody td:nth-child(4)::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  .lines .del::after { content: " Remove line"; }
  table.lines tfoot { display: block; }
  table.lines tfoot tr { display: flex; justify-content: flex-end; gap: 16px; }
  table.lines tfoot td { padding: 12px 0 0; }
  .inv-stats { gap: 12px 22px; }
  .inv-stats .value { font-size: 16px; }

  .entry-edit textarea { min-height: 96px; }
  .track-dialog textarea { min-height: 96px; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs .spacer { display: none; }
  .tabs > span.muted { width: 100%; margin: 6px 2px 0; }
  .page-head h1 { flex-basis: 100%; order: -2; }
  .page-head .btn-primary { order: -1; }

  /* sticky bars sit above the tab bar */
  .actionbar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .review .actionbar { bottom: auto; }
  .review form.dirty .actionbar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .review form.dirty .actionbar [data-mark] { display: none; }  /* keeps the stuck bar short; it can't be used until saved anyway */
}
