/* Layout: site-register look — a title block per project, category strip, then task rows like an RFI log. */
:root {
  --bg: #f3f4f2;
  --panel: #ffffff;
  --ink: #1d2226;
  --muted: #5d666c;
  --line: #d9ddd9;
  --line-soft: #e8ebe8;
  --accent: #d9661f;
  --accent-soft: #fbe9dd;
  --done: #2f7d4a;
  --done-soft: #e2f1e6;
  --prog: #9a6a00;
  --prog-soft: #fbf0d6;
  --na: #7b8288;
  --na-soft: #eceeed;
  --crit: #b3361f;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191b; --panel: #1d2225; --ink: #e8ebe9; --muted: #9aa3a8; --line: #333b3f; --line-soft: #2a3134;
    --accent: #f08a45; --accent-soft: #3a2619; --done: #63c283; --done-soft: #1d3326; --prog: #e3b24a; --prog-soft: #3a3019;
    --na: #8d959a; --na-soft: #262c2f; --crit: #f07a5f; 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(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--ink); color: var(--bg); padding-inline: 16px; }
.topbar-in { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding-block: 10px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .02em; color: var(--bg); text-decoration: none; margin-right: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 14px; }
.nav a, .nav button { all: unset; cursor: pointer; color: var(--bg); opacity: .85; }
.nav a:hover, .nav button:hover, .nav a[aria-current="page"] { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.nav a:focus-visible, .nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav .who { opacity: .7; }

main { padding-inline: 16px; padding-block: 24px 64px; }
.wrap { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* Text */
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 40px); line-height: 1.05; margin: 4px 0 6px; text-wrap: balance; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0; text-wrap: balance; }
h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Title block */
.titleblock { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1.5px solid var(--ink); background: var(--panel); }
.titleblock .main { padding: 16px 18px; border-right: 1.5px solid var(--ink); min-width: 0; }
.titleblock p { margin: 0; color: var(--muted); max-width: 70ch; white-space: pre-wrap; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(100px, 1fr)); }
.meta div { padding: 8px 14px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.meta div:nth-child(odd) { border-left: 0; }
.meta div:nth-last-child(-n+2) { border-bottom: 0; }
.meta .k { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta .v { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meta .v.alert { color: var(--crit); }
@media (max-width: 700px) {
  .titleblock { grid-template-columns: 1fr; }
  .titleblock .main { border-right: 0; border-bottom: 1.5px solid var(--ink); }
  .meta { grid-template-columns: repeat(4, 1fr); }
  .meta div { border-bottom: 0 !important; border-left: 1px solid var(--line) !important; }
  .meta div:first-child { border-left: 0 !important; }
}

/* Panels, forms, buttons */
.panel { background: var(--panel); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel.strong { border: 1.5px solid var(--ink); }
.narrow { max-width: 460px; margin: 6vh auto 0; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.field, div.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; min-width: 0; }
label.field .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); border-radius: 0; min-width: 0;
}
textarea { min-height: 70px; resize: vertical; line-height: 1.4; }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); background: var(--bg); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.err { color: var(--crit); font-size: 14px; min-height: 1.2em; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { font-weight: 600; font-size: 14px; padding: 7px 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); cursor: pointer; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--crit); border-color: var(--crit); }
.btn.sm { font-size: 13px; padding: 4px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { all: unset; cursor: pointer; color: var(--accent); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn.danger { color: var(--crit); }
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs { display: flex; gap: 0; border-bottom: 1.5px solid var(--ink); }
.tabs button { all: unset; cursor: pointer; padding: 8px 16px; font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: var(--crit); color: #fff; }
.banner { border: 1px solid var(--prog); background: var(--prog-soft); padding: 10px 14px; font-size: 14px; }

/* Project list */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pcard { all: unset; box-sizing: border-box; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--ink); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pcard:hover { border-color: var(--ink); }
.pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pcard .desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .stats { font-family: var(--font-mono); font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pcard .stats .alert { color: var(--crit); }
.bar { height: 6px; background: var(--line-soft); position: relative; overflow: hidden; }
.bar span { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--ink)); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); }

/* Category strip */
.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.cat-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c); min-width: 0; }
.cat-card[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--c); }
.cat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-card .nm { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.15; overflow-wrap: anywhere; }
.cat-card .ct { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .grow { flex: 1 1 200px; min-width: 0; }
.toolbar select { width: auto; }

/* Task list */
section.group { background: var(--panel); border: 1px solid var(--line); }
.group-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; padding: 10px 16px; border-bottom: 1.5px solid var(--ink); }
.group-head h2 { display: flex; align-items: center; gap: 10px; }
.swatch { width: 12px; height: 12px; background: var(--c); display: inline-block; flex: none; }
.gcount { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.task { display: grid; grid-template-columns: 64px minmax(0, 1fr) 150px; gap: 6px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.task:last-child { border-bottom: 0; }
.task .ref { font-family: var(--font-mono); font-size: 13px; color: var(--muted); padding-top: 2px; overflow-wrap: anywhere; }
.task.crit .ref { color: var(--crit); font-weight: 500; }
.task .body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.task .title { margin: 0; overflow-wrap: anywhere; }
.task[data-state="done"] .title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.task[data-state="na"] .title { color: var(--muted); }
.task .details { margin: 0; font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.tag { font-weight: 600; padding: 1px 8px; border: 1px solid var(--c, var(--line)); color: var(--c, var(--muted)); white-space: nowrap; }
.tag.crit { --c: var(--crit); }
.tag.overdue { --c: var(--crit); background: var(--accent-soft); }
.stamp { color: var(--muted); }
.task .links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
select.status { font-weight: 600; font-size: 13px; padding: 7px 8px; background: var(--panel); cursor: pointer; }
select.status[data-state="done"] { background: var(--done-soft); border-color: var(--done); color: var(--done); }
select.status[data-state="progress"] { background: var(--prog-soft); border-color: var(--prog); color: var(--prog); }
select.status[data-state="na"] { background: var(--na-soft); border-color: var(--na); color: var(--na); }
.thread { border-left: 3px solid var(--line); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.thread .ev { font-size: 13px; }
.thread .ev .who { font-weight: 600; }
.thread .ev .when { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.thread .ev .txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
@media (max-width: 640px) {
  .task { grid-template-columns: 52px minmax(0, 1fr); }
  .task .ctl { grid-column: 1 / -1; }
}

/* Admin */
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.aproj { background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.aproj-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; padding: 14px 16px; }
.aproj-head .info { min-width: 0; flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.pill { font-size: 12px; font-weight: 600; padding: 1px 8px; border: 1px solid var(--c, var(--line)); color: var(--c, var(--muted)); }
.pill.on { --c: var(--done); }
.pill.off { --c: var(--na); }
.linkbox { display: flex; gap: 6px; align-items: center; min-width: 0; }
.linkbox code { font-family: var(--font-mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.aproj-body { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.catrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.catrow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }

/* Architecture plans register */
.cat-card .ct .alert { color: var(--crit); }
.stage-badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 6px 8px; border: 1px solid var(--c); color: var(--c); background: var(--panel); line-height: 1.25; }
.stage-badge.sm { font-size: 12px; padding: 1px 8px; }
.task.plan[data-state="done"] .title { text-decoration: none; }
.followup { font-size: 13px; padding: 6px 10px; border-left: 3px solid var(--prog); background: var(--prog-soft); overflow-wrap: anywhere; }
.followup.due { border-left-color: var(--crit); background: var(--accent-soft); }
.inline-form { border: 1px solid var(--line); background: var(--bg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.inline-form input[type=text], .inline-form input[type=email], .inline-form input[type=date], .inline-form select, .inline-form textarea { background: var(--panel); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.timeline li { border-left: 3px solid var(--c); padding-left: 10px; }
.stagerow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 110px 120px 250px; gap: 8px; align-items: center; }
.stagerow.head { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stagerow input[type=number] { width: 100%; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); border-radius: 0; }
.stagerow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.only-sm { display: none; }
@media (max-width: 760px) {
  .stagerow { grid-template-columns: 44px minmax(0, 1fr) 90px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
  .stagerow.head { display: none; }
  .stagerow .check, .stagerow .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .only-sm { display: inline; }
}
.small.ok { color: var(--done); }
.small.err { color: var(--crit); }
code { font-family: var(--font-mono); font-size: 12px; }
