
[hidden] { display: none !important }
/* Site Ledger. Phone-first: one column, tabs at the bottom, forms slide up from the bottom. */
:root {
  --bg: #e7eae8;        /* poured concrete */
  --surface: #ffffff;
  --sunk: #f3f5f4;
  --ink: #18212b;
  --muted: #5b6672;
  --line: #d4dad7;
  --accent: #2147a8;    /* blueprint ink */
  --accent-soft: #e3e9f8;
  --good: #23784a;
  --good-soft: #e1f1e7;
  --warn: #a86a00;      /* hi-vis amber, darkened for text */
  --warn-soft: #fbefd6;
  --bad: #b8392a;
  --bad-soft: #f8e2de;
  --frame: #18212b;
  --shadow: 0 1px 2px rgba(24,33,43,.06), 0 8px 24px rgba(24,33,43,.08);
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1317; --surface: #182029; --sunk: #131a21; --ink: #e6ebef; --muted: #96a1ac; --line: #2a343f;
  --accent: #86a6ff; --accent-soft: #1d2a4a; --good: #5cc48b; --good-soft: #15301f; --warn: #f2b63f; --warn-soft: #33270e;
  --bad: #f17a68; --bad-soft: #3a1c18; --frame: #05070a; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0f1317; --surface: #182029; --sunk: #131a21; --ink: #e6ebef; --muted: #96a1ac; --line: #2a343f;
  --accent: #86a6ff; --accent-soft: #1d2a4a; --good: #5cc48b; --good-soft: #15301f; --warn: #f2b63f; --warn-soft: #33270e;
  --bad: #f17a68; --bad-soft: #3a1c18; --frame: #05070a; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark }

* { box-sizing: border-box }
html, body { background: var(--bg); color: var(--ink) }
body { font-family: var(--body); font-size: 15px; line-height: 1.4; margin: 0; -webkit-tap-highlight-color: transparent }
button, input, select { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px }
.card h3 { margin: 0 0 10px; font-family: var(--display); font-size: 18px; letter-spacing: .3px; display: flex; align-items: center; justify-content: space-between; gap: 8px }
.card h3 .link { font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0 }
.label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .6px; text-transform: uppercase }
.big { font-family: var(--display); font-size: 30px; line-height: 1.05 }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px }
.stat .big { font-size: 26px; margin-top: 2px }
.stat small { color: var(--muted); font-size: 12.5px }
.bar { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; position: relative; border: 1px solid var(--line) }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px }
.bar i.ghost { background: var(--accent-soft) }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); min-width: 0 }
.row:first-of-type { border-top: 0 }
.row .main { flex: 1; min-width: 0 }
.row .main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row .main small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row .end { text-align: right; flex: none }
.row .end b { display: block; font-weight: 600 }
button.row { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; font: inherit; color: inherit }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap }
.pill.good { background: var(--good-soft); color: var(--good) }
.pill.warn { background: var(--warn-soft); color: var(--warn) }
.pill.bad { background: var(--bad-soft); color: var(--bad) }
.pill.blue { background: var(--accent-soft); color: var(--accent) }
.sample { font-family: var(--mono); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line) }
.alert:first-of-type { border-top: 0 }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none }
.dot.bad { background: var(--bad) } .dot.warn { background: var(--warn) } .dot.blue { background: var(--accent) }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted) }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 3px }
.seg button { border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted) }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow) }
.search { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px }
.phase-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 6px 2px -6px }
.phase-h b { font-family: var(--display); font-size: 17px }
.phase-h span { font-size: 12.5px; color: var(--muted) }
.back { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; display: inline-flex; align-items: center; gap: 4px; align-self: flex-start }
.title { font-family: var(--display); font-size: 28px; line-height: 1.05; margin: 0; text-wrap: balance }
.sub { color: var(--muted); margin-top: 2px; font-size: 13.5px }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px }
.kv dt { color: var(--muted) } .kv dd { margin: 0; text-align: right; font-weight: 500 }
.missing { color: var(--warn); font-weight: 600 }
.quote { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); width: 100%; text-align: left }
.quote + .quote { margin-top: 8px }
.quote[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft) }
.quote .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center }
.quote[aria-pressed="true"] .radio { border-color: var(--accent) }
.quote[aria-pressed="true"] .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent) }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 14px; font-weight: 600 }
.btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent) }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap }
.lock { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 8px }
.empty { color: var(--muted); font-size: 14px; padding: 4px 0 }

/* schedule */
.gantt-head { position: relative; height: 18px; margin-left: 0; font-family: var(--mono); font-size: 10px; color: var(--muted) }
.gantt-head span { position: absolute; top: 0; transform: translateX(-1px); white-space: nowrap }
.task { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 8px 0; border-top: 1px solid var(--line) }
.task:first-of-type { border-top: 0 }
.task .t { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 500 }
.task .t span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.track { position: relative; height: 10px; margin-top: 6px; background: var(--sunk); border-radius: 3px }
.track .span { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent-soft); border: 1px solid var(--accent); min-width: 4px; overflow: hidden }
.track .span i { position: absolute; inset: 0 auto 0 0; background: var(--accent) }
.track .today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--bad) }

/* overlays */
.drawer h4 { margin: 14px 4px 4px; font-size: 11px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase }
.navbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 11px 8px; border-radius: 10px; text-align: left; font-weight: 600; width: 100% }
.navbtn:hover { background: var(--sunk) }
.navbtn.active { background: var(--accent-soft); color: var(--accent) }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center }
.sheet h2 { font-family: var(--display); font-size: 24px; margin: 0 }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.choice { border: 1px solid var(--line); background: var(--sunk); border-radius: 14px; padding: 14px 12px; text-align: left }
.choice b { display: block; font-size: 15px } .choice small { color: var(--muted); font-size: 12.5px }
.field { display: flex; flex-direction: column; gap: 4px }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted) }
.field input, .field select { border: 1px solid var(--line); background: var(--sunk); border-radius: 10px; padding: 10px; width: 100%; min-width: 0 }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.calc { background: var(--sunk); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 14px }
.calc b { text-align: right }
.slider { width: 100% }

@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: right .22s ease-out }
  @keyframes up { from { transform: translateY(30px) } }
  @keyframes right { from { transform: translateX(-30px) } }
}

/* the app frame */
.app { position: relative; max-width: 640px; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column }
.appbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--bg) }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none }
.iconbtn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round }
.project { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0 }
.project small { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.project b { font-family: var(--display); font-size: 22px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.content { flex: 1; padding: 4px 16px calc(120px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px }
.content > * { flex-shrink: 0 }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(4px, calc((100vw - 640px) / 2)) calc(8px + env(safe-area-inset-bottom, 0px)) }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 0; text-decoration: none; cursor: pointer }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.tab[aria-current="page"] { color: var(--accent) }
.fab { position: fixed; right: max(16px, calc((100vw - 640px) / 2 + 16px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 3; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center }
.fab svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round }
.scrim { position: fixed; inset: 0; background: rgba(10,14,18,.45); z-index: 5 }
.drawer { position: fixed; top: 0; bottom: 0; left: max(0px, calc((100vw - 640px) / 2)); width: min(320px, 84vw); background: var(--surface); z-index: 6; padding: calc(22px + env(safe-area-inset-top, 0px)) 16px 22px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); width: min(640px, 100vw); bottom: 0; max-height: 92dvh; overflow-y: auto; background: var(--surface); z-index: 6; border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px }
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 9; max-width: calc(100vw - 32px); text-align: center }
.field textarea { border: 1px solid var(--line); background: var(--sunk); border-radius: 10px; padding: 10px; width: 100%; min-height: 70px; font: inherit; color: inherit; resize: vertical }
.checklist { border: 1px solid var(--line); border-radius: 10px; max-height: 240px; overflow-y: auto; background: var(--sunk) }
.checklist label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink); font-weight: 500 }
.checklist label:first-child { border-top: 0 }
.field .checklist input { width: auto; flex: none; margin-top: 3px; padding: 0 }
.checklist label span { flex: 1; min-width: 0 }
.danger { color: var(--bad) }
.btn.danger { border-color: var(--bad); color: var(--bad) }
.btn.danger.armed { background: var(--bad); color: var(--surface) }
.login { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px }
.login h1 { font-family: var(--display); font-size: 34px; margin: 0 }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; font: inherit; font-weight: 600 }
.notes-text { white-space: pre-wrap; color: var(--muted); font-size: 14px }
.drawer-user { color: var(--muted); font-size: 13px; padding: 8px }
.row.log-row .main small, .row.log-row .main b { white-space: normal }
@keyframes up2 { from { transform: translate(-50%, 30px) } }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up2 .2s ease-out } }

/* spreadsheet-style tables (Trades › Table, Schedule › Table) */
.app.wide { max-width: 1600px }
.tablewrap { overflow: auto; max-height: calc(100dvh - 230px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13.5px; width: max-content; min-width: 100% }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: top; background: var(--surface) }
table.grid td small { color: var(--muted); font-size: 12px }
table.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--sunk); font-size: 11.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); text-align: right }
table.grid tbody th, table.grid tfoot th, table.grid thead th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; max-width: 260px; white-space: normal; min-width: 180px; font-weight: 600 }
table.grid thead th:first-child { z-index: 3 }
table.grid tbody tr[data-go], table.grid tbody tr[data-task] { cursor: pointer }
table.grid tbody tr[data-go]:hover > *, table.grid tbody tr[data-task]:hover > * { background: var(--accent-soft) }
table.grid .phase-row th { background: var(--sunk); font-family: var(--display); font-size: 16px; text-align: left; position: sticky; left: 0 }
table.grid .sum-row > * { background: var(--sunk); font-weight: 600 }
table.grid .total-row > * { position: sticky; bottom: 0; background: var(--ink); color: var(--bg); font-weight: 700; border-color: var(--ink) }
table.grid .chosen-cell { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent) }
table.grid td:last-child, table.grid td.t { text-align: left }
@media (max-width: 600px) { table.grid tbody th, table.grid tfoot th, table.grid thead th:first-child { min-width: 130px; max-width: 150px } }
.good-text { color: var(--good) }
.note-dot { color: var(--accent); font-size: 9px; vertical-align: 2px }
@media (max-width: 420px) {
  .appbar { gap: 6px; padding-inline: 12px }
  .appbar .iconbtn { width: 36px; height: 36px; border-radius: 11px }
  .project b { font-size: 20px }
}
