/* 11 Radinden — an architect's title block across the top, then sheets of
   work below, like a drawing register. Pen blue is interactive; revision-cloud
   red flags what needs attention. */
:root {
  --paper: #f5f6f3;
  --sheet: #ffffff;
  --ink: #1d2124;
  --ink-2: #5b6268;
  --rule: #d6d9d4;
  --rule-strong: #1d2124;
  --accent: #2443a8;
  --accent-soft: #e6ebf8;
  --redline: #c2362b;
  --redline-soft: #fbe9e6;
  --wait: #a86a00;
  --wait-soft: #fbf0d9;
  --done: #2f7a4a;
  --done-soft: #e3f1e7;
  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181b; --sheet: #1c2024; --ink: #e7e9e6; --ink-2: #9aa2a8;
    --rule: #30363b; --rule-strong: #c9cdc8; --accent: #8aa4ff; --accent-soft: #1f2a4a;
    --redline: #ff7b6e; --redline-soft: #3a1f1c; --wait: #f0b54a; --wait-soft: #3a2c12;
    --done: #6fcf8f; --done-soft: #183022; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--f-body); }
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 64px; display: grid; gap: 20px; }

/* Top bar */
.topbar { background: var(--ink); color: var(--paper); }
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; min-height: 48px; }
.topbar .brand { font: 700 18px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--paper); text-decoration: none; margin-right: 8px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 2px; }
.topbar nav a { color: var(--paper); opacity: .72; text-decoration: none; font: 600 14px/1 var(--f-body); padding: 16px 10px 13px; border-bottom: 3px solid transparent; }
.topbar nav a:hover { opacity: 1; }
.topbar nav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--accent-soft); }
.topbar .me { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.topbar .me a, .topbar .me button { color: var(--paper); opacity: .8; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; text-decoration: none; }
.topbar .me a:hover, .topbar .me button:hover { opacity: 1; text-decoration: underline; }
@media (max-width: 640px) {
  .topbar .inner { gap: 0 10px; }
  .topbar .brand { width: 100%; padding-top: 12px; }
  .topbar nav a { padding: 10px 7px 8px; font-size: 13.5px; }
  .topbar .me { margin-left: 0; width: 100%; padding-bottom: 8px; }
}

/* Title block */
.tb { background: var(--sheet); border: 2px solid var(--rule-strong); display: grid; grid-template-columns: 1.6fr 1fr 1fr; }
.tb > div { padding: 10px 14px; border-left: 1px solid var(--rule); min-width: 0; display: grid; gap: 8px; align-content: start; }
.tb > div:first-child { border-left: 0; }
.lbl { font: 600 11px/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.tb h1 { font: 700 clamp(28px, 5vw, 40px)/1 var(--f-display); margin: 4px 0 0; letter-spacing: .01em; }
.tb .sub { color: var(--ink-2); font-size: 13px; }
.tb .val { font-weight: 500; line-height: 1.35; }
.mono { font-family: var(--f-mono); font-size: .9em; }
@media (max-width: 720px) {
  .tb { grid-template-columns: 1fr 1fr; }
  .tb > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--rule); }
  .tb > div:nth-child(2) { border-left: 0; }
}

/* Stage strip */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--rule); background: var(--sheet); }
.stage { padding: 10px 12px; border-left: 1px solid var(--rule); display: grid; gap: 4px; min-width: 0; color: inherit; text-decoration: none; }
.stage:first-child { border-left: 0; }
.stage .n { font: 600 11px/1 var(--f-mono); color: var(--ink-2); }
.stage .t { font: 600 15px/1.15 var(--f-display); letter-spacing: .03em; text-transform: uppercase; }
.stage .c { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stage.is-current { background: var(--accent-soft); box-shadow: inset 0 3px 0 var(--accent); }
.stage.is-done .t { color: var(--ink-2); }
.stage.is-done .n::after { content: " ✓"; color: var(--done); }
@media (max-width: 720px) { .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stage:nth-child(4) { border-left: 0; } .stage:nth-child(n+4) { border-top: 1px solid var(--rule); } }

/* Headings and sections */
.page-h { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; justify-content: space-between; }
.page-h h1 { font: 700 32px/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.page-h p { margin: 4px 0 0; color: var(--ink-2); }
.group { display: grid; }
.group-h { display: flex; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--rule-strong); padding-bottom: 4px; }
.group-h .n { font: 500 12px var(--f-mono); color: var(--ink-2); }
.group-h h2 { font: 700 20px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.group-h .c { margin-left: auto; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.panel { background: var(--sheet); border: 1px solid var(--rule); padding: 14px 16px; display: grid; gap: 10px; min-width: 0; align-content: start; }
.panel h2 { font: 700 18px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Tally and countdown */
.tally { display: flex; flex-wrap: wrap; gap: 8px 22px; font-variant-numeric: tabular-nums; }
.tally b { font: 700 24px/1 var(--f-display); margin-right: 4px; }
.tally .r b { color: var(--redline); }
.tally .w b { color: var(--wait); }
.tally .d b { color: var(--done); }
.countdown { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 12px 16px; border: 2px solid var(--redline); background: var(--redline-soft); }
.countdown b { font: 700 34px/1 var(--f-display); color: var(--redline); font-variant-numeric: tabular-nums; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--rule); background: var(--sheet); }
.seg a { padding: 6px 10px; font: 500 13px var(--f-body); color: var(--ink-2); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--rule); }
.seg a[aria-current="true"] { background: var(--ink); color: var(--sheet); }
input, select, textarea { font: 14px var(--f-body); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); padding: 7px 9px; border-radius: 0; min-width: 0; max-width: 100%; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
.btn, button.btn, input[type="submit"] { display: inline-block; font: 600 13px var(--f-body); border: 1px solid var(--ink); background: var(--ink); color: var(--sheet); padding: 8px 14px; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.danger { background: transparent; color: var(--redline); border-color: var(--redline); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* Forms */
.form { display: grid; gap: 14px; background: var(--sheet); border: 1px solid var(--rule); padding: 16px; max-width: 760px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font: 600 11px var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--ink-2); }
.errors { border: 1px solid var(--redline); background: var(--redline-soft); color: var(--redline); padding: 10px 12px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

/* Flash */
.flash { padding: 10px 14px; border: 1px solid var(--done); background: var(--done-soft); }
.flash.alert { border-color: var(--redline); background: var(--redline-soft); }

/* Task rows */
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid var(--rule); align-items: start; scroll-margin-top: 60px; }
.task .main { min-width: 0; display: grid; gap: 4px; }
.task .title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.task .title:hover { text-decoration: underline; }
.task.is-done .title { text-decoration: line-through; color: var(--ink-2); font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.task .notes { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.task details summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.pill { font: 600 11px/1 var(--f-body); letter-spacing: .04em; text-transform: uppercase; padding: 6px 9px; border: 1px solid currentColor; background: none; white-space: nowrap; }
button.pill { cursor: pointer; }
.pill.todo, .pill.not_started { color: var(--accent); background: var(--accent-soft); }
.pill.waiting, .pill.in_progress, .pill.submitted { color: var(--wait); background: var(--wait-soft); }
.pill.done, .pill.approved, .pill.ongoing, .pill.not_required { color: var(--done); background: var(--done-soft); }
.chip { font: 500 12px var(--f-mono); padding: 2px 6px; border: 1px solid var(--rule); color: var(--ink); background: var(--paper); }
.int { font: 600 11px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border: 1px dashed var(--ink-2); color: var(--ink-2); }
.prio { color: var(--redline); font-weight: 700; }
.over { color: var(--redline); font-weight: 600; }
.empty { padding: 24px 16px; text-align: center; color: var(--ink-2); border: 1px dashed var(--rule); background: var(--sheet); }

/* Register tables */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); }
table.reg { width: 100%; border-collapse: collapse; font-size: 14px; }
table.reg th { text-align: left; font: 600 11px var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 8px 10px; border-bottom: 2px solid var(--rule-strong); white-space: nowrap; }
table.reg td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.reg tr:last-child td { border-bottom: 0; }
table.reg.register { table-layout: fixed; min-width: 640px; }
table.reg .c-num { width: 110px; } table.reg .c-rev { width: 90px; } table.reg .c-date { width: 110px; }
table.reg .c-for { width: 120px; } table.reg .c-file { width: 90px; } table.reg .c-money { width: 108px; }
@media (max-width: 640px) {
  table.reg.register { min-width: 0; }
  table.reg .c-num { width: 48px; } table.reg .c-rev { width: 46px; } table.reg .c-date { width: 58px; } table.reg .c-file { width: 50px; }
  table.reg th, table.reg td { padding-inline: 6px; }
  table.reg .c-for, table.reg .for { display: none; }
  table.reg .c-money { width: 84px; }
}
table.reg td { overflow-wrap: break-word; }
table.reg td.num { font-family: var(--f-mono); font-size: 13px; white-space: nowrap; }
table.reg td.rev { font: 700 16px/1 var(--f-display); white-space: nowrap; }
table.reg td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { padding: 6px 10px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); text-decoration: none; font-size: 13px; }
.tabs a[aria-current="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.tabs a .c { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tabs a[aria-current="true"] .c { color: var(--sheet); opacity: .7; }

/* Planning conditions */
.cond { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 2px; border-bottom: 1px solid var(--rule); scroll-margin-top: 60px; }
.cond .no { font: 700 26px/1 var(--f-display); color: var(--ink-2); }
.cond h3 { margin: 0; font-size: 15px; }
.cond .req { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.cond.blocks .no { color: var(--redline); }
.cond .side { display: grid; gap: 6px; justify-items: end; align-content: start; }
@media (max-width: 560px) { .cond { grid-template-columns: 34px minmax(0, 1fr); } .cond .side { grid-column: 2; justify-items: start; } }

/* Feed and lists */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.feed time { color: var(--ink-2); font-size: 12px; margin-left: 4px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.list li:last-child { border-bottom: 0; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; background: var(--sheet); border: 2px solid var(--rule-strong); }
.auth .card header { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.auth .card header h1 { font: 700 30px/1 var(--f-display); margin: 4px 0 0; }
.auth .card .body { padding: 16px; display: grid; gap: 14px; }
.auth .card .body input { width: 100%; }

.copybox { display: flex; gap: 8px; }
.copybox input { flex: 1; font-family: var(--f-mono); font-size: 13px; }

/* Schedule timeline: a label column, then a track where each row's bar is
   placed by --l (start) and --w (length) as percentages of the whole range. */
.gantt-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); }
.gantt { min-width: 760px; display: grid; }
.g-row { display: grid; grid-template-columns: 230px minmax(0, 1fr); border-bottom: 1px solid var(--rule); min-height: 30px; scroll-margin-top: 60px; }
.g-row:last-child { border-bottom: 0; }
.g-label { padding: 5px 10px; font-size: 13px; line-height: 1.25; display: flex; gap: 8px; align-items: center; border-right: 1px solid var(--rule); min-width: 0; }
.g-label a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-label a:hover { text-decoration: underline; }
.g-stage { font: 500 11px var(--f-mono); color: var(--ink-2); flex: none; }
.g-track { position: relative; }
.g-head { border-bottom: 2px solid var(--rule-strong); }
.g-head .g-track { display: flex; }
.g-month { font: 600 11px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 9px 0 7px 4px; border-left: 1px solid var(--rule); white-space: nowrap; overflow: visible; }
.g-month.is-jan { color: var(--ink); border-left-color: var(--rule-strong); }
.g-bar { position: absolute; top: 8px; bottom: 8px; left: var(--l); width: var(--w); background: var(--accent); min-width: 4px; }
.g-ms { position: absolute; top: 50%; left: var(--l); width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); background: var(--accent); }
.g-bar.planned, .g-ms.planned { background: color-mix(in srgb, var(--accent) 55%, var(--sheet)); }
.g-bar.in_progress, .g-ms.in_progress { background: var(--accent); }
.g-bar.done, .g-ms.done { background: var(--done); }
.g-bar.at_risk, .g-ms.at_risk { background: var(--redline); }
.g-ms.is-deadline { background: var(--redline); }
.g-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid; pointer-events: none; }
.g-line.today { border-color: var(--ink); opacity: .35; border-left-style: dashed; }
.g-line.deadline { border-color: var(--redline); }
.g-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.g-legend span { display: inline-flex; align-items: center; gap: 6px; }
.g-legend .sw { width: 14px; height: 10px; display: inline-block; }
.g-legend .sw.planned { background: color-mix(in srgb, var(--accent) 55%, var(--sheet)); }
.g-legend .sw.in_progress { background: var(--accent); }
.g-legend .sw.done { background: var(--done); }
.g-legend .sw.at_risk { background: var(--redline); }
.g-legend .ln { width: 0; height: 14px; border-left: 2px solid; display: inline-block; }
.g-legend .ln.today { border-color: var(--ink); opacity: .35; border-left-style: dashed; }
.g-legend .ln.deadline { border-color: var(--redline); }
.pill.planned { color: var(--accent); background: var(--accent-soft); }
.pill.at_risk { color: var(--redline); background: var(--redline-soft); }
tr.is-now td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 640px) { .g-row { grid-template-columns: 150px minmax(0, 1fr); } }

/* Budget */
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.reg th.money { text-align: right; }
table.reg tfoot td { border-top: 2px solid var(--rule-strong); font-weight: 600; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 2px solid var(--rule-strong); background: var(--sheet); }
.figures > div { padding: 10px 14px; border-left: 1px solid var(--rule); display: grid; gap: 4px; }
.figures > div:first-child { border-left: 0; }
.figures b { font: 700 26px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.unpriced { color: var(--wait); font-weight: 600; }

/* Cost plan drill-down */
table.cp-summary td:first-child { white-space: nowrap; }
table.cp-summary tr.strong td { font-weight: 700; border-top: 2px solid var(--rule-strong); }
table.reg .c-ph { width: 64px; } table.reg .c-qty { width: 130px; } table.reg .c-rate { width: 110px; } table.reg .c-range { width: 175px; }
.cp-group { background: var(--sheet); border: 1px solid var(--rule); scroll-margin-top: 60px; }
.cp-group > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.cp-group > summary::-webkit-details-marker { display: none; }
.cp-group > summary::before { content: "▸"; color: var(--ink-2); width: 10px; }
.cp-group[open] > summary::before { content: "▾"; }
.cp-group[open] > summary { border-bottom: 2px solid var(--rule-strong); }
.cp-group .table-wrap { border: 0; }
.cp-group > p { padding: 0 14px 12px; }
.cp-code { font: 700 13px var(--f-mono); color: var(--ink-2); }
.cp-name { font: 700 18px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; }
.cp-sum { margin-left: auto; font-variant-numeric: tabular-nums; }
.cp-total { color: var(--ink); font-weight: 700; font-size: 15px; }
@media (max-width: 640px) {
  table.reg .c-qty { width: 84px; } table.reg .c-rate { width: 72px; } table.reg .c-range { width: 0; }
}

/* On phones, wide money tables become cards: the item across the top, then
   its figures in a labelled two-column grid. */
@media (max-width: 640px) {
  table.reg.stack, table.reg.stack tbody, table.reg.stack tfoot, table.reg.stack tr, table.reg.stack td { display: block; width: auto; min-width: 0; }
  table.reg.stack colgroup, table.reg.stack thead { display: none; }
  table.reg.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px 12px; border-bottom: 1px solid var(--rule); }
  table.reg.stack tr:last-child { border-bottom: 0; }
  table.reg.stack td { padding: 0; border: 0; text-align: left; white-space: normal; }
  table.reg.stack td:first-child { grid-column: 1 / -1; }
  table.reg.stack td[data-label]::before { content: attr(data-label); display: block; font: 600 10.5px/1.4 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
  table.reg.stack tfoot tr { background: var(--paper); }
  table.reg.stack tfoot td { border-top: 0; }
  table.reg.stack tfoot td:first-child { font-weight: 700; }
  .figures { grid-template-columns: 1fr 1fr; }
  .figures > div:nth-child(3) { border-left: 0; }
  .figures > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .figures b { font-size: 22px; }
}

.cp-cards { display: none; }
@media (max-width: 640px) {
  .cp-summary-wrap { display: none; }
  .cp-cards { display: grid; gap: 12px; }
  .cp-cards .list li { gap: 12px; }
  .cp-cards .list li > :last-child { text-align: right; font-variant-numeric: tabular-nums; }
}
