/* StageFlow — styles. Colours are tokens at the top; light and dark come from light-dark(). */

:root {
  color-scheme: light dark;
  --font-head: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --bg: light-dark(#F5F3EF, #0F1114);
  --bg-2: light-dark(#ECE8E1, #15181C);
  --surface: light-dark(#FFFFFF, #1A1D22);
  --surface-2: light-dark(#F7F5F1, #21252B);
  --line: light-dark(#E2DDD3, #2A2F36);
  --line-2: light-dark(#CFC8BA, #3A414A);
  --text: light-dark(#1B1D21, #F1EEE8);
  --text-2: light-dark(#4A4F57, #B7B2A8);
  --text-3: light-dark(#7B8089, #7F8791);
  --accent: light-dark(#C2540A, #FF8A2B);
  --accent-ink: light-dark(#FFFFFF, #1B1208);
  --accent-soft: color-mix(in oklab, var(--accent) 14%, transparent);

  --green: light-dark(#23794B, #4CC38A);
  --amber: light-dark(#A66A00, #F2B84B);
  --red: light-dark(#C0392B, #FF7468);

  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px -12px rgb(0 0 0 / .18);
  --max: 1180px;
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
@supports not (color: light-dark(#000, #fff)) {
  :root { --bg: #0F1114; --bg-2: #15181C; --surface: #1A1D22; --surface-2: #21252B; --line: #2A2F36; --line-2: #3A414A; --text: #F1EEE8; --text-2: #B7B2A8; --text-3: #7F8791; --accent: #FF8A2B; --accent-ink: #1B1208; --green: #4CC38A; --amber: #F2B84B; --red: #FF7468; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text-2); font: 400 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--text); margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.05rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip:focus { top: 12px; }

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(16px, 4vw, 40px); background: color-mix(in oklab, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 700 13px var(--font-head); letter-spacing: 0; }
.brand-name { font: 600 1.15rem var(--font-head); color: var(--text); letter-spacing: -.02em; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { padding: 8px 14px; border-radius: 999px; font-size: 14.5px; color: var(--text-2); }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.main { max-width: var(--max); margin: 0 auto; padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 40px) 80px; }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-radius: 999px; font-weight: 500; font-size: 14.5px; line-height: 1.2; transition: background-color .15s, border-color .15s, translate .15s; white-space: nowrap; }
.btn:active { translate: 0 1px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent), var(--text) 12%); }
.btn-ghost { border-color: var(--line-2); background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { border-color: color-mix(in oklab, var(--red) 45%, transparent); color: var(--red); background: transparent; }
.btn-danger-ghost:hover { background: color-mix(in oklab, var(--red) 12%, transparent); }
.btn-sm { padding: 7px 13px; font-size: 13.5px; }

/* ---------- Common blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head p { margin: 6px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; color: var(--text-3); font-size: 14px; }
.back:hover { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin-bottom: 12px; }
.card h3.sub { margin-top: 22px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.card-grid > .card { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.cols > .card { margin-bottom: 16px; }
.cols-heat { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .wide { grid-column: 1 / -1; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar p { margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); font: 500 12px/1.4 var(--font-mono); letter-spacing: .02em; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.chip-accent { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); background: var(--accent-soft); }
.chip-green { color: var(--green); border-color: color-mix(in oklab, var(--green) 40%, transparent); background: color-mix(in oklab, var(--green) 12%, transparent); }
.chip-amber { color: var(--amber); border-color: color-mix(in oklab, var(--amber) 40%, transparent); background: color-mix(in oklab, var(--amber) 12%, transparent); }
.chip-red { color: var(--red); border-color: color-mix(in oklab, var(--red) 40%, transparent); background: color-mix(in oklab, var(--red) 12%, transparent); }

.rag { display: inline-flex; align-items: center; gap: 7px; font: 500 12.5px var(--font-mono); letter-spacing: .02em; color: var(--text-2); white-space: nowrap; }
.rag i { width: 10px; height: 10px; border-radius: 50%; background: var(--rag, var(--green)); box-shadow: 0 0 0 3px color-mix(in oklab, var(--rag, var(--green)) 22%, transparent); }
.rag-green { --rag: var(--green); } .rag-amber { --rag: var(--amber); } .rag-red { --rag: var(--red); }

.bar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s; }
.bar.red span { background: var(--red); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-title { font: 600 1.1rem var(--font-head); color: var(--text); margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; opacity: 0; z-index: 400; padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; transition: .25s; pointer-events: none; }
.toast.show { translate: -50% 0; opacity: 1; }

/* ---------- Portfolio ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat b { display: block; font: 600 1.9rem/1 var(--font-head); color: var(--text); }
.stat span { font-size: 13px; color: var(--text-3); }
.stat.amber b { color: var(--amber); } .stat.red b { color: var(--red); }
.project-card { display: block; transition: translate .2s, border-color .2s; }
.project-card:hover { translate: 0 -3px; border-color: var(--line-2); }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pc-top .pc-chips { margin: 0; }
.project-card h3 { font-size: 1.25rem; margin-bottom: 4px; }
.pc-sub { margin: 0 0 14px; font-size: 14px; }
.pc-line { font-weight: 500; color: var(--text); margin-bottom: 8px; }
.pc-foot { margin: 8px 0 0; font-size: 13px; }

/* ---------- Project header & tabs ---------- */
.proj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.proj-sum { max-width: 68ch; margin: 8px 0 0; }
.proj-rag { padding-top: 28px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 24px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tab { padding: 10px 14px; font-size: 14.5px; color: var(--text-3); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

/* ---------- Overview ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tile-top { display: flex; align-items: center; justify-content: space-between; font: 500 12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.tile b { display: block; font: 600 1.15rem var(--font-head); color: var(--text); }
.tile small { display: block; margin-top: 2px; color: var(--text-3); font-size: 13px; }
.stepper { display: flex; list-style: none; margin: 0 0 12px; padding: 0; gap: 0; overflow-x: auto; }
.step { flex: 1; min-width: 110px; position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding-top: 2px; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--line-2); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.active::before { background: var(--accent); }
.step .dot { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); font: 600 12px var(--font-mono); color: var(--text-3); }
.step.active .dot { border-color: var(--accent); color: var(--accent); }
.step.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step .dot .ic { width: 15px; height: 15px; }
.step-name { font-size: 13.5px; color: var(--text); font-weight: 500; }
.step small { color: var(--text-3); font-size: 12px; }
.big-pct { font: 600 2.6rem/1 var(--font-head); color: var(--text); margin-bottom: 10px; }
.status-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.status-list li { display: flex; justify-content: space-between; font-size: 14.5px; }
.status-list b { color: var(--text); }
.task-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.task-lines li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.task-lines li:last-child { border: 0; }
.tl-title { color: var(--text); min-width: 0; }
.tl-meta { color: var(--text-3); font: 12.5px var(--font-mono); white-space: nowrap; }
.late { color: var(--red) !important; } .good { color: var(--green); }
.auth-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth-list li { display: flex; align-items: center; gap: 12px; color: var(--text); }
.auth-list small { margin-left: auto; }
.check { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2px solid var(--line-2); background: transparent; color: var(--accent-ink); padding: 0; }
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.facts dl, .stage-facts, .doc dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0; }
.facts dt, .stage-facts dt, .doc dt { color: var(--text-3); }
.facts dd, .stage-facts dd, .doc dd { margin: 0; color: var(--text); }
.cat-row { margin-bottom: 14px; }
.cat-top { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 14.5px; color: var(--text); }

/* ---------- Work ---------- */
.quick-add { display: flex; gap: 10px; margin-bottom: 14px; }
.quick-add input { flex: 1; min-width: 0; }
input, select, textarea { width: 100%; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--text); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input.invalid { border-color: var(--red); }
.filters select { width: auto; padding: 7px 12px; font-size: 14px; border-radius: 999px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; font-size: 14px; color: var(--text-3); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg .ic { width: 16px; height: 16px; }

.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 140px; transition: background-color .15s, border-color .15s; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.col h3 { font-size: .95rem; margin: 0; }
.count { font: 500 12px var(--font-mono); color: var(--text-3); }
.col-body { display: grid; gap: 8px; }
.col-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 14px 0; margin: 0; }
.task { padding: 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: grab; transition: translate .15s, box-shadow .15s; }
.task:hover { box-shadow: var(--shadow); translate: 0 -1px; }
.task.dragging { opacity: .45; }
.task.prio-must { border-left-color: var(--accent); }
.task.prio-should { border-left-color: var(--amber); }
.task.prio-wont { opacity: .7; }
.task-title { color: var(--text); font-weight: 500; font-size: 14.5px; line-height: 1.35; margin-bottom: 8px; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.task-meta .chip { font-size: 11px; padding: 1px 8px; }
.due { display: inline-flex; align-items: center; gap: 4px; font: 12px var(--font-mono); color: var(--text-3); }
.due .ic { width: 13px; height: 13px; }

.list-groups { display: grid; gap: 4px; }
.lg-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.lg-head h3 { margin: 0; }
.lg-items { list-style: none; margin: 0; padding: 0; }
.lg-items li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.lg-items li:last-child { border: 0; }
.lg-title { flex: 1; min-width: 0; text-align: left; padding: 0; border: 0; background: none; color: var(--text); font-size: 15px; }
.lg-title:hover { color: var(--accent); }
.lg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.is-done .lg-title { color: var(--text-3); text-decoration: line-through; }

/* ---------- Brief & PID ---------- */
.pid-head { display: grid; gap: 14px; }
.pid-head > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; }
.pid-head p { margin: 0; max-width: 60ch; }
.pid-actions { display: flex; gap: 8px; position: absolute; }
.pid-head { position: relative; }
.pid-head .pid-actions { position: static; display: flex; flex-wrap: wrap; gap: 8px; }
.group-title { font-size: 1.3rem; margin: 28px 0 4px; }
.group-note { margin: 0 0 12px; }
.pid-section { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.pid-section summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 13px 16px; cursor: pointer; list-style: none; }
.pid-section summary::-webkit-details-marker { display: none; }
.pid-section textarea, .team-grid { margin: 0 16px 16px; width: calc(100% - 32px); }
.pid-title { font-weight: 500; color: var(--text); }
.pid-state { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); color: var(--accent-ink); }
.pid-state.ok { background: var(--green); border-color: var(--green); }
.pid-state .ic { width: 13px; height: 13px; stroke-width: 2.8; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.team-grid label, .settings-form label { display: grid; gap: 5px; font-size: 13.5px; color: var(--text-3); }

/* ---------- Stages ---------- */
.gantt { padding-bottom: 14px; }
.g-axis { display: flex; justify-content: space-between; font: 12px var(--font-mono); color: var(--text-3); margin-bottom: 8px; }
.g-rows { position: relative; display: grid; gap: 7px; }
.g-row { position: relative; height: 28px; background: repeating-linear-gradient(90deg, var(--bg-2) 0 1px, transparent 1px 10%); border-radius: 6px; }
.g-bar { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; overflow: hidden; white-space: nowrap; background: var(--line-2); color: var(--text); }
.g-bar.done { background: color-mix(in oklab, var(--green) 55%, var(--surface)); color: var(--text); }
.g-bar.active { background: var(--accent); color: var(--accent-ink); }
.g-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--red); z-index: 2; }
.g-today span { position: absolute; top: -17px; left: 50%; translate: -50% 0; font: 500 10.5px var(--font-mono); color: var(--red); }
.g-rows { margin-top: 20px; }
.stage-list { display: grid; gap: 14px; }
.stage { margin: 0; }
.stage.active { border-color: color-mix(in oklab, var(--accent) 55%, var(--line)); }
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.stage-head h3 { margin: 0; font-size: 1.2rem; }
.stage-no { font: 500 11.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.stage-facts { margin: 12px 0; font-size: 14.5px; }
.checks { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.checks summary { cursor: pointer; color: var(--text); font-weight: 500; font-size: 14.5px; }
.checks ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.checks label { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; }
.stage-foot { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Products & registers ---------- */
.prod-group { margin-bottom: 8px; }
.group-title + .prod-grid { margin-top: 8px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.prod { margin: 0; cursor: pointer; display: grid; gap: 8px; align-content: start; }
.prod:hover { border-color: var(--line-2); }
.prod header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prod h4 { color: var(--text); }
.prod p, .prod footer { margin: 0; font-size: 14px; }
.prod-crit { color: var(--text-2); }
.rows { display: grid; gap: 10px; }
.row-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0; cursor: pointer; padding: 16px 18px; }
.row-card:hover { border-color: var(--line-2); }
.row-card.is-closed { opacity: .6; }
.row-main { min-width: 0; }
.row-main h4 { margin-bottom: 3px; }
.row-main p { margin: 0 0 4px; font-size: 14.5px; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px !important; }
.row-note { margin-top: 6px !important; }
.row-note b { color: var(--text); }
.score { display: grid; place-items: center; flex: none; width: 58px; padding: 8px 0; border-radius: 12px; text-align: center; border: 1px solid; }
.score b { font: 600 1.35rem/1 var(--font-head); }
.score small { font: 11px var(--font-mono); opacity: .8; }
.score.red { color: var(--red); background: color-mix(in oklab, var(--red) 12%, transparent); border-color: color-mix(in oklab, var(--red) 40%, transparent); }
.score.amber { color: var(--amber); background: color-mix(in oklab, var(--amber) 12%, transparent); border-color: color-mix(in oklab, var(--amber) 40%, transparent); }
.score.green { color: var(--green); background: color-mix(in oklab, var(--green) 12%, transparent); border-color: color-mix(in oklab, var(--green) 40%, transparent); }
.heat table { border-collapse: separate; border-spacing: 3px; width: 100%; table-layout: fixed; }
.heat td { height: 38px; border-radius: 7px; text-align: center; font: 600 14px var(--font-head); color: var(--text); }
.heat th { font: 500 11px var(--font-mono); color: var(--text-3); }
.heat-green { background: color-mix(in oklab, var(--green) 22%, var(--surface)); }
.heat-amber { background: color-mix(in oklab, var(--amber) 28%, var(--surface)); }
.heat-red { background: color-mix(in oklab, var(--red) 30%, var(--surface)); }
.heat-note { margin: 8px 0 0; font-size: 12.5px; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: grid; grid-template-columns: 110px 1fr auto; align-items: start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.log-list time { font: 13px var(--font-mono); color: var(--text-3); padding-top: 2px; }
.log-list span { color: var(--text); }

/* ---------- Reports & documents ---------- */
.card > .lbl, .lbl { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text); font-size: 14px; }
.doc h1 { font-size: 1.7rem; margin-bottom: 4px; }
.doc-sub { color: var(--text-3); margin-bottom: 20px; }
.doc h2 { font-size: 1.05rem; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); font-weight: 500; color: var(--text-3); }
.doc h3 { font-size: 1rem; margin: 14px 0 4px; }
.doc ul { margin: 0 0 .8em; padding-left: 1.2em; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 1em; }
.doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--text-3); font-weight: 500; }
.doc .card { box-shadow: none; }

/* ---------- Settings forms ---------- */
.settings-form h3:not(:first-child) { margin-top: 26px; }
.settings-form input, .settings-form select, .settings-form textarea { color: var(--text); }

/* ---------- Dialogs ---------- */
dialog.sheet { width: min(640px, calc(100% - 24px)); max-height: min(88vh, 860px); padding: 0; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text-2); box-shadow: 0 40px 100px -20px rgb(0 0 0 / .55); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet-sm { width: min(420px, calc(100% - 24px)); }
dialog.sheet::backdrop { background: color-mix(in oklab, black 50%, transparent); backdrop-filter: blur(4px); }
.sheet-form { display: flex; flex-direction: column; min-height: 0; max-height: min(88vh, 860px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.sheet-body { padding: 12px 22px 8px; overflow-y: auto; }
.sheet-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.confirm-text { color: var(--text); margin: 14px 0 0; }
.field { grid-column: 1 / -1; display: grid; gap: 5px; align-content: start; }
.field.half { grid-column: auto; }
.field label, .field .lbl { font-size: 13.5px; color: var(--text-3); margin: 0; font-weight: 400; }
.field small { color: var(--text-3); font-size: 12.5px; }
.req { color: var(--red); }
.cl-rows { display: grid; gap: 6px; margin-bottom: 8px; }
.cl-row { display: flex; align-items: center; gap: 8px; }
.cl-row input[type="text"] { flex: 1; padding: 7px 11px; }

/* ---------- Print ---------- */
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body { background: #fff; color: #111; }
  #print-root, #print-root * { color: #111 !important; }
  #print-root .doc h2, #print-root .doc dt, #print-root .doc th, #print-root .doc-sub { color: #555 !important; }
  #print-root .doc { padding: 0; }
  #print-root .doc h1 { font-size: 22pt; }
  @page { margin: 18mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .cols-heat { grid-template-columns: 1fr; }
  .proj-head { flex-direction: column; gap: 8px; }
  .proj-rag { padding-top: 0; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .log-list li { grid-template-columns: 1fr auto; }
  .log-list time { grid-column: 1 / -1; }
  .lg-items li { flex-wrap: wrap; }
  .lg-meta { width: 100%; justify-content: flex-start; padding-left: 36px; }
  .brand-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
