/* ============================================================================
   KaryaFlow — control tower
   Every row is a strip: a coloured spine, an ident, and one line that says
   exactly where the work is. Nothing here decorates; it reports.
   Type    Space Grotesk (display) · Inter Tight (body) · JetBrains Mono (data)
   Colour  ink #0F1216 · paper #F1F2F5 · violet #5B3DF5 · signal #E5484D
           hold #F5A524 · go #12A594
   ============================================================================ */
:root {
  --ink: #0F1216;
  --ink-2: #1A1F26;
  --ink-3: #2A313B;
  --paper: #F1F2F5;
  --surface: #FFFFFF;
  --line: #E1E4EA;
  --line-2: #EDEFF3;
  --text: #14181D;
  --muted: #6B7480;
  --faint: #98A1AD;

  --violet: #5B3DF5;
  --violet-soft: #EDEAFE;
  --signal: #E5484D;
  --signal-soft: #FDECEC;
  --hold: #F5A524;
  --hold-soft: #FEF3E0;
  --go: #12A594;
  --go-soft: #E3F5F2;

  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter Tight", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --r: 6px;
}

* { box-sizing: border-box; margin: 0; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body); font-size: 14.5px; line-height: 1.55;
  color: var(--text); background: var(--paper);
  display: flex; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--violet); color: #fff; }

/* ---------------------------------------------------------------- rail */
.sidebar {
  width: 214px; flex-shrink: 0; background: var(--ink); color: #A8B0BC;
  display: flex; flex-direction: column; padding: 18px 10px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: #2A313B var(--ink);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2A313B; border-radius: 99px; }
.main { flex: 1; min-width: 0; max-width: 100%; padding: 26px 30px 64px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: #fff; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: var(--violet); color: #fff; flex-shrink: 0;
}
.brand-name { font-family: var(--display); font-weight: 600; font-size: 16.5px; letter-spacing: -.02em; }
.brand-name em { font-style: normal; color: var(--violet); }
.brand-co {
  display: block; font-family: var(--mono); font-size: 9.5px; color: #6B7480;
  letter-spacing: .1em; text-transform: uppercase; margin-top: 1px;
}

.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  background: var(--ink-2); border-radius: var(--r); margin-bottom: 10px;
}
.uc-link { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.uc-link:hover .uc-text b { color: var(--violet); }
.uc-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.uc-text b { color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-text i {
  font-style: normal; font-family: var(--mono); font-size: 9.5px; color: var(--faint);
  letter-spacing: .08em; text-transform: uppercase;
}
.bell { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: #A8B0BC; }
.bell:hover { background: var(--ink-3); color: #fff; }
.badge {
  position: absolute; top: 0; right: 0; background: var(--signal); color: #fff;
  font-family: var(--mono); font-size: 9px; border-radius: 99px; padding: 0 4px; font-style: normal;
}

.side-search { margin-bottom: 10px; flex-shrink: 0; }
.side-search input {
  width: 100%; font: inherit; font-size: 12.5px; padding: 8px 10px; border-radius: var(--r);
  border: 1px solid var(--ink-3); background: var(--ink-2); color: #fff; min-height: 36px;
}
.side-search input::placeholder { color: #5D6673; }
.side-search input:focus { outline: none; border-color: var(--violet); }

.nav { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r);
  font-size: 13.5px; min-height: 36px; color: #A8B0BC;
}
.nav a svg { width: 16px; height: 16px; fill: currentColor; opacity: .7; flex-shrink: 0; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: #fff; color: var(--ink); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 10px; background: var(--signal);
  color: #fff; border-radius: 99px; padding: 1px 6px; font-weight: 500;
}

.side-foot { margin-top: auto; padding-top: 14px; flex-shrink: 0; }
.flow-legend {
  border-top: 1px solid var(--ink-3); padding: 12px 8px 0;
  display: flex; flex-direction: column; gap: 3px;
}
.fl-title {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--violet);
  text-transform: uppercase;
}
.fl-line { font-size: 11.5px; color: #8B93A0; line-height: 1.4; }
.fl-line b { color: #A8B0BC; font-weight: 500; }
.fl-line.dim { color: #5D6673; }
.foot-row { display: flex; align-items: center; gap: 3px; margin-top: 10px; }
.foot-row a {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; min-width: 34px; border-radius: var(--r); color: #6B7480; padding: 0 8px;
}
.foot-row a:hover { background: var(--ink-2); color: #fff; }
.foot-row .foot-out { flex: 1; justify-content: flex-start; font-size: 12.5px; }

/* ---------------------------------------------------------------- page head */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  padding-bottom: 14px; border-bottom: 2px solid var(--ink); margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 26px; line-height: 1.15; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; max-width: 62ch; }
.crumbs, .eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--faint);
  text-transform: uppercase; display: block; margin-bottom: 6px;
}
.crumbs a:hover { color: var(--violet); }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- surfaces */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; margin-bottom: 16px; min-width: 0;
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.card-head h2 {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.grid-2-1 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
.grid-2-1 > * { min-width: 0; }

/* ---------------------------------------------------------------- controls */
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  padding: 9px 15px; border-radius: var(--r); font-weight: 500; font-size: 13.5px;
  min-height: 40px; display: inline-flex; align-items: center; gap: 7px;
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--violet); border-color: var(--violet); }
.btn.primary:hover { background: #4B2FE0; }
.btn.danger { background: var(--signal); border-color: var(--signal); }
.mini {
  font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 5px 9px;
  border-radius: 4px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); letter-spacing: .02em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
}
.mini:hover { border-color: var(--ink); }
.mini.go { background: var(--go); border-color: var(--go); color: #fff; }
.mini.bad { background: var(--signal-soft); border-color: #F6C9CB; color: var(--signal); }
.mini.ghost { color: var(--muted); }
.link { color: var(--violet); font-weight: 500; }
.link:hover { text-decoration: underline; }
.hint { font-size: 12.5px; color: var(--muted); }
.hint.pad { display: block; padding-top: 10px; }
.empty { color: var(--muted); padding: 16px 4px; font-size: 13.5px; }
.late { color: var(--signal); font-weight: 600; }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .m-field {
  display: flex; flex-direction: column; gap: 5px; flex: 1;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.form input, .form select, .form textarea, .m-field select, .status-select, .filter select,
.tk-controls select, .search-big input, .confirm-form select {
  font-family: var(--body); font-size: 14px; text-transform: none;
  letter-spacing: 0; color: var(--text); padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); min-height: 40px; font-weight: 400;
}
.form textarea { min-height: auto; resize: vertical; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus, .m-field select:focus {
  outline: 2px solid var(--violet); outline-offset: -1px; border-color: var(--violet);
}
.form-row, .inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form { flex-direction: row; align-items: center; }
.inline-form input[name="note"], .inline-form input[name="body"], .inline-form input[name="value"],
.inline-form input[name="title"] { flex: 1; min-width: 140px; }
.m-label { display: flex; align-items: center; gap: 6px; }
.m-add {
  width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--paper); color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 0; display: inline-grid; place-items: center; line-height: 1;
}
.m-add:hover { background: var(--violet-soft); color: var(--violet); border-color: #CFC6FB; }
.dur-wrap { display: flex; gap: 6px; flex-wrap: wrap; }
.dur-wrap input { flex: 1; min-width: 66px; }
.dur-wrap select { width: auto; }

/* ---------------------------------------------------------------- SIGNATURE: strips */
.strips { display: flex; flex-direction: column; gap: 6px; }
.strip {
  display: grid; grid-template-columns: 3px 60px 1fr auto; align-items: center;
  gap: 0 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; min-height: 58px;
  transition: border-color .12s ease;
}
.strip:hover { border-color: var(--ink); }
.strip:hover .st-title { color: var(--violet); }
.spine { align-self: stretch; background: var(--faint); }
.strip.t-red .spine { background: var(--signal); }
.strip.t-hold .spine { background: var(--hold); }
.strip.t-on .spine { background: var(--violet); }
.strip.t-go .spine { background: var(--go); }
.strip.t-idle .spine { background: #C6CBD3; }
.st-ident { font-family: var(--mono); font-size: 11px; color: var(--faint); padding-left: 12px; }
.st-body { padding: 9px 0; min-width: 0; }
.st-title {
  font-family: var(--display); font-weight: 600; font-size: 14.5px; line-height: 1.25;
  display: block; color: var(--text);
}
.st-line {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; margin-top: 3px;
  color: var(--muted); display: block; text-transform: uppercase;
}
.strip.t-red .st-line { color: var(--signal); font-weight: 500; }
.strip.t-hold .st-line { color: #A56A00; }
.strip.t-go .st-line { color: var(--go); }
.st-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.st-side { display: flex; align-items: center; gap: 8px; padding-right: 14px; flex-wrap: wrap; }
.st-actions { display: flex; gap: 5px; align-items: center; }
.st-actions form { display: contents; }

/* headline — the page's thesis */
.page-head h1.headline, .headline {
  font-family: var(--display); font-size: 31px; font-weight: 600; letter-spacing: -.03em;
  line-height: 1.15; margin-bottom: 4px;
}
.headline .hl-red { color: var(--signal); }
.headline .hl-ok { color: var(--go); }
.pulse-note { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }

/* section rule */
.sec {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 10px; margin: 26px 0 10px;
}
.sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec b { color: var(--ink); font-weight: 500; }
.sec.alarm, .sec.alarm b { color: var(--signal); }

/* ---------------------------------------------------------------- data blocks */
.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; margin-bottom: 18px;
}
.kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { background: var(--surface); padding: 14px 16px; }
.kpi-num {
  font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: -.03em;
  display: block; color: var(--ink); font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-top: 2px; display: block;
}
.kpi-accent .kpi-num { color: var(--violet); }
.kpi-warn .kpi-num { color: var(--signal); }
.delta { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.delta.good { color: var(--go); }
.delta.bad { color: var(--signal); }
.delta.flat { color: var(--faint); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.card > .table, .card table.table { display: block; overflow-x: auto; max-width: 100%; }
.member-cell { display: flex; align-items: center; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; font-family: var(--mono); font-size: 10px;
  font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px; background: var(--paper); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.chip.dept, .chip.pri-high { background: var(--violet-soft); color: #4530C4; border-color: #D8D1FC; }
.chip.role, .chip.pri-medium { background: var(--paper); color: var(--muted); }
.chip.rework, .chip.pri-urgent { background: var(--signal-soft); color: var(--signal); border-color: #F6C9CB; }
.chip.pri-low { background: var(--paper); color: var(--faint); }
.chip.status-active, .chip.ok-chip, .chip.tk-closed { background: var(--go-soft); color: var(--go); border-color: #BFE7E1; }
.chip.status-completed { background: var(--violet-soft); color: #4530C4; border-color: #D8D1FC; }
.chip.tk-open, .chip.tk-reopened { background: var(--signal-soft); color: var(--signal); border-color: #F6C9CB; }
.chip.tk-in-progress { background: var(--violet-soft); color: #4530C4; border-color: #D8D1FC; }
.chip.tk-resolved, .chip.access-manager { background: var(--hold-soft); color: #8A5C00; border-color: #F7DFB4; }
.chip.access-admin { background: var(--signal-soft); color: var(--signal); border-color: #F6C9CB; }
.chip.access-team-lead { background: var(--violet-soft); color: #4530C4; border-color: #D8D1FC; }
.chip.st-chip-todo { background: var(--paper); }
.chip.st-chip-inprogress { background: var(--violet-soft); color: #4530C4; border-color: #D8D1FC; }
.chip.st-chip-testing, .chip.st-chip-qc { background: var(--hold-soft); color: #8A5C00; border-color: #F7DFB4; }
.chip.st-chip-done { background: var(--go-soft); color: var(--go); border-color: #BFE7E1; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-family: var(--mono); font-size: 11px;
  font-weight: 500; flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 9.5px; }
.avatar.none { background: var(--line); color: var(--muted); }

.bar { height: 4px; background: var(--line-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar.slim { height: 3px; }
.bar span { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
.pct { font-family: var(--mono); font-size: 12px; min-width: 34px; text-align: right; }
.score {
  font-family: var(--mono); font-weight: 500; padding: 3px 9px; border-radius: 3px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.score.good { background: var(--go-soft); color: var(--go); }
.score.mid { background: var(--hold-soft); color: #8A5C00; }
.score.low { background: var(--signal-soft); color: var(--signal); }

/* ---------------------------------------------------------------- board */
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.board > * { min-width: 0; }
.col-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; padding: 8px 11px; border-radius: var(--r) var(--r) 0 0;
  color: #fff; background: var(--ink);
}
.col-head.st-todo { background: #6B7480; }
.col-head.st-inprogress { background: var(--violet); }
.col-head.st-testing { background: var(--hold); color: #3A2A00; }
.col-head.st-qc { background: #8A5C00; }
.col-head.st-done { background: var(--go); }
.col-body {
  background: #E7E9EE; border-radius: 0 0 var(--r) var(--r); padding: 7px; min-height: 180px;
  display: flex; flex-direction: column; gap: 7px;
}
.col-body.drag-over { outline: 2px dashed var(--violet); outline-offset: -3px; }
.task {
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px;
  padding: 9px 11px; cursor: grab; border-left: 3px solid var(--line);
}
.task.mine { border-left-color: var(--violet); }
.task.t-red { border-left-color: var(--signal); }
.task.t-hold { border-left-color: var(--hold); }
.task.t-go { border-left-color: var(--go); }
.task:active { cursor: grabbing; }
.task.dragging { opacity: .45; }
.task-top { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
a.task-title, .task-title {
  font-family: var(--display); font-weight: 600; font-size: 13px; line-height: 1.3;
  display: block; color: var(--text);
}
a.task-title:hover { color: var(--violet); }
.task-line {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-top: 4px; display: block;
}
.task.t-red .task-line { color: var(--signal); }
.mini-rail { display: flex; gap: 3px; margin: 7px 0 5px; }
.mini-rail i { width: 12px; height: 3px; border-radius: 99px; background: var(--line); }
.mini-rail i.on { background: var(--violet); }
.task-foot { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.due, .est { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.est { margin-left: auto; }
.task-actions { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.task-actions form { display: contents; }
.board-hint {
  text-align: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--faint); margin-top: 12px; text-transform: uppercase;
}

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; padding: 9px 14px; font-family: var(--mono); font-size: 11px;
  font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; min-height: 38px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--ink); border-bottom-color: var(--violet); }
.tab-panel.hidden { display: none; }

/* ---------------------------------------------------------------- flow rail */
.flow-rail {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 16px 20px; background: var(--ink); border: 0; color: #fff; border-radius: var(--r);
  margin-bottom: 16px;
}
.rail-stage { text-align: center; min-width: 78px; padding: 8px 6px; border-radius: 5px; background: var(--ink-2); opacity: .5; }
.rail-stage.has { opacity: 1; }
.rail-count { font-family: var(--mono); font-size: 18px; font-weight: 500; display: block; color: var(--violet); font-variant-numeric: tabular-nums; }
.rail-label { font-family: var(--mono); font-size: 9px; color: #8B93A0; text-transform: uppercase; letter-spacing: .09em; }
.rail-now { display: block; font-family: var(--mono); font-size: 8.5px; color: var(--violet); letter-spacing: .1em; margin-top: 2px; }
.rail-arrow { display: flex; flex-direction: column; align-items: center; color: var(--violet); }
.rail-arrow em { font-family: var(--mono); font-size: 8px; font-style: normal; text-transform: uppercase; letter-spacing: .08em; color: #5D6673; }
.rail-stats {
  margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-family: var(--mono); font-size: 10.5px; color: #8B93A0; letter-spacing: .05em; text-transform: uppercase;
}
.rail-stats b { color: #fff; font-weight: 500; }
.rail-stats .late, .rail-stats .late b { color: #FF8B8F; }
.task-rail .rail-stats { text-transform: none; letter-spacing: 0; font-family: var(--body); font-size: 12.5px; }

/* project state banner */
.state-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--faint);
  margin-bottom: 16px; flex-wrap: wrap;
}
.state-banner.t-red { border-left-color: var(--signal); background: var(--signal-soft); }
.state-banner.t-hold { border-left-color: var(--hold); background: var(--hold-soft); }
.state-banner.t-on { border-left-color: var(--violet); background: var(--violet-soft); }
.state-banner.t-go { border-left-color: var(--go); background: var(--go-soft); }
.sb-line { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; font-weight: 500; }
.sb-note { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* gate / lock notices */
.gate {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--r);
  background: var(--hold-soft); border: 1px solid #F7DFB4; font-size: 13px; margin-bottom: 12px;
}
.gate.stop { background: var(--signal-soft); border-color: #F6C9CB; }
.gate b { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 2px; }

/* ---------------------------------------------------------------- feeds, lists */
.feed, .fb-list, .milestones, .tp-list, .master-list, .comment-list, .radar, .notif-list { list-style: none; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.feed li:last-child { border-bottom: 0; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex-shrink: 0; position: relative; top: 5px; }
.feed li.auto .feed-dot { background: var(--violet); }
.feed-body { flex: 1; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.feed-task { color: var(--muted); }
.feed-detail { display: block; color: var(--muted); font-size: 12px; }
.feed-time { font-family: var(--mono); font-size: 10px; color: var(--faint); white-space: nowrap; }
.tag-auto {
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--violet-soft); color: #4530C4; border-radius: 3px; padding: 1px 5px; margin-left: 6px;
}
.notif-list li.unread { background: var(--violet-soft); border-radius: 5px; padding-left: 8px; padding-right: 8px; }
.notif-list li.unread .feed-dot { background: var(--violet); }
.notif-link:hover { color: var(--violet); }

.workload, .perf-chart { display: flex; flex-direction: column; gap: 8px; }
.wl-row, .perf-row { display: flex; align-items: center; gap: 10px; }
.wl-name { width: 116px; font-size: 13px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-bar { flex: 1; height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.wl-bar.big { height: 10px; }
.wl-bar span { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
.wl-count { font-family: var(--mono); font-size: 12px; min-width: 22px; text-align: right; }

.milestones li { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); }
.milestones li:last-child { border-bottom: 0; }
.check {
  width: 22px; height: 22px; border-radius: 4px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--go); font-weight: 700; font-size: 12px;
  display: inline-grid; place-items: center; flex-shrink: 0;
}
li.done .check { border-color: var(--go); background: var(--go-soft); }
li.done .ms-title { color: var(--muted); text-decoration: line-through; }
.ms-title { flex: 1; font-size: 13.5px; }
.milestones li form { display: inline; }

.tp-list li, .master-list li {
  display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 2px;
  border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.tp-list li .feed-time { margin-left: auto; }
.master-list li.inactive { opacity: .45; }
.master-list { max-height: 230px; overflow-y: auto; margin-bottom: 10px; }

.comment-list li { display: flex; gap: 10px; padding: 12px 2px; border-top: 1px solid var(--line-2); }
.cm-body { flex: 1; min-width: 0; }
.cm-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 3px; }
.cm-body p { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.fb-list li { padding: 11px 4px; border-bottom: 1px solid var(--line-2); }
.fb-top { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; flex-wrap: wrap; }
.stars { color: var(--hold); letter-spacing: 2px; font-size: 13px; }
.stars i { font-style: normal; color: var(--line); }

.my-list { display: flex; flex-direction: column; }
.my-row {
  display: flex; align-items: center; gap: 9px; padding: 9px 4px;
  border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.my-row:last-child { border-bottom: 0; }
.my-row:hover .my-title { color: var(--violet); }
.my-title { font-weight: 500; font-size: 13.5px; flex: 1; min-width: 150px; }
.my-tasks { border-left: 3px solid var(--violet); }

.radar li { display: flex; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.radar-date { font-family: var(--mono); font-weight: 500; font-size: 12px; min-width: 42px; }
.radar-body { display: flex; flex-direction: column; min-width: 0; }
.radar-title { font-weight: 500; font-size: 13px; }
.radar-title:hover { color: var(--violet); }

/* ---------------------------------------------------------------- projects grid */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.proj-grid > * { min-width: 0; }
.proj-card { display: flex; flex-direction: column; gap: 9px; border-left: 3px solid var(--line); }
.proj-card:hover { border-color: var(--ink); border-left-color: var(--violet); }
.proj-card.t-red { border-left-color: var(--signal); }
.proj-card.t-hold { border-left-color: var(--hold); }
.proj-card.t-go { border-left-color: var(--go); }
.pc-top { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.proj-card h3 { font-size: 16px; }
.pc-desc { color: var(--muted); font-size: 13px; flex: 1; }
.pc-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- modals & toast */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(15, 18, 22, .55); display: none;
  align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto;
}
.modal-wrap.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 8px; padding: 22px 24px; width: 100%;
  max-width: 540px; box-shadow: 0 24px 70px rgba(15, 18, 22, .35); animation: rise .16s ease;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { font-size: 18px; }
.x { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); width: 40px; height: 40px; }
.x:hover { color: var(--text); }
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 60; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: var(--r); box-shadow: 0 10px 34px rgba(15,18,22,.4);
  font-size: 13.5px; max-width: 400px; border-left: 3px solid var(--violet); animation: rise .18s ease;
}

/* ---------------------------------------------------------------- login */
.login-body {
  display: grid; place-items: center; min-height: 100vh; background: var(--ink);
  background-image: radial-gradient(ellipse 70% 55% at 72% -8%, #241C5E 0%, transparent 62%);
}
.login-card { background: var(--surface); border-radius: 10px; padding: 32px 34px; width: 100%; max-width: 396px; box-shadow: 0 24px 70px rgba(0,0,0,.5); margin: 20px; }
.login-card.center { text-align: center; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.login-brand .brand-mark { width: 38px; height: 38px; }
.login-brand h1 { font-size: 22px; }
.login-brand em { font-style: normal; color: var(--violet); }
.login-sub { color: var(--muted); margin-bottom: 16px; font-size: 13.5px; }
.login-error { background: var(--signal-soft); color: var(--signal); border: 1px solid #F6C9CB; padding: 9px 12px; border-radius: var(--r); font-size: 13px; margin-bottom: 12px; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--muted); }
.btn.wide { width: 100%; justify-content: center; }
.err-code { font-family: var(--mono); font-size: 46px; color: var(--violet); margin-bottom: 4px; }

/* ---------------------------------------------------------------- calendar */
.cal-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h2 { font-family: var(--display); font-size: 17px; text-transform: none; letter-spacing: -.02em; color: var(--text); min-width: 150px; }
.cal-today { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); text-align: center; min-width: 0; }
.cal-cell { min-height: 90px; background: var(--paper); border-radius: 5px; padding: 6px; display: flex; flex-direction: column; gap: 3px; border: 1px solid transparent; min-width: 0; }
.cal-cell.other-month { opacity: .4; }
.cal-cell.is-today { border-color: var(--violet); background: var(--violet-soft); }
.cal-date { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cal-ev { font-size: 10.5px; line-height: 1.25; padding: 3px 5px; border-radius: 3px; background: #fff; border-left: 2px solid var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-task { border-left-color: var(--violet); }
.ev-milestone { border-left-color: #8A5C00; }
.ev-deadline { border-left-color: var(--hold); }
.ev-reminder { border-left-color: var(--go); }
.cal-ev.ev-done { opacity: .45; text-decoration: line-through; }
.cal-ev.ev-late { background: var(--signal-soft); border-left-color: var(--signal); color: var(--signal); font-weight: 500; }
.cal-more { font-family: var(--mono); font-size: 9.5px; color: var(--faint); padding-left: 3px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cal-legend span { display: flex; align-items: center; gap: 6px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.cal-legend .ev-task { background: var(--violet); border: 0; }
.cal-legend .ev-milestone { background: #8A5C00; border: 0; }
.cal-legend .ev-deadline { background: var(--hold); border: 0; }
.cal-legend .ev-reminder { background: var(--go); border: 0; }
.cal-legend .ev-late-dot { background: var(--signal); }
.overdue-panel { border-left: 3px solid var(--signal); }

/* ---------------------------------------------------------------- charts */
.week-chart { display: flex; gap: 8px; align-items: flex-end; height: 150px; padding-top: 6px; max-width: 100%; }
.wc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.wc-bar { width: 68%; max-width: 38px; background: var(--violet); border-radius: 3px 3px 1px 1px; min-height: 2px; }
.wc-count { font-family: var(--mono); font-size: 11px; min-height: 16px; }
.wc-label { font-family: var(--mono); font-size: 9px; color: var(--faint); white-space: nowrap; }
.dist { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.donut { width: 138px; height: 138px; flex-shrink: 0; }
.donut-num { font: 500 19px var(--mono); fill: var(--ink); }
.donut-sub { font: 400 8px var(--mono); fill: var(--muted); }
.dist-legend { list-style: none; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.dist-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dist-legend i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.dist-legend b { margin-left: auto; font-family: var(--mono); }

/* ---------------------------------------------------------------- tickets */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.tk-main { flex: 1; min-width: 0; }
.tk-top { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.tk-title { font-family: var(--display); font-weight: 600; font-size: 14.5px; }
.tk-desc { font-size: 13px; margin: 4px 0; overflow-wrap: anywhere; }
.tk-controls, .tk-controls-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 168px; }
.tk-controls select { font-size: 12.5px; padding: 6px 8px; min-height: 34px; }
.tk-thread { margin-top: 9px; border-top: 1px solid var(--line-2); padding-top: 9px; min-width: 0; }
.tk-msg { background: var(--paper); border-radius: 5px; padding: 8px 10px; margin-bottom: 5px; font-size: 13px; border-left: 2px solid var(--line); }
.tk-msg.from-cust { background: var(--violet-soft); border-left-color: var(--violet); }
.tk-msg p { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-slim { font-size: 12px; max-width: 180px; }
.portal-tk { border: 0; padding: 12px 0; border-bottom: 1px solid var(--line-2); border-radius: 0; margin-bottom: 0; }
.confirm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.confirm-form { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.confirm-form select { min-height: 34px; padding: 6px 8px; font-size: 12.5px; }

/* ---------------------------------------------------------------- task page */
.task-layout { display: grid; grid-template-columns: 1fr 312px; gap: 16px; align-items: start; }
.task-main { min-width: 0; }
.task-side { position: sticky; top: 18px; }
.details { display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; font-size: 13px; }
.details dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.details dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.override { margin-left: 6px; }
.override summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--hold); list-style: none; padding: 6px 10px; border: 1px dashed #4A5260; border-radius: 5px; }
.override summary::-webkit-details-marker { display: none; }
.override[open] summary { margin-bottom: 8px; }
.override-body { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.override-body form { display: contents; }

/* agenda / mywork / masters / danger */
.agenda { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ag-h { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.ag-h.ag-late, .ag-h.ag-late b { color: var(--signal); }
.ag-item { display: block; padding: 8px 10px; border-radius: 5px; background: var(--paper); margin-bottom: 5px; }
.ag-item:hover { background: var(--violet-soft); }
.ag-item-late { background: var(--signal-soft); }
.ag-title { display: block; font-weight: 500; font-size: 13px; }
.master-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed #F6C9CB; }
.danger-zone h3 { font-size: 13.5px; color: var(--signal); margin-bottom: 5px; }
.filter-row { margin-bottom: 14px; }
.filter { display: inline-flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.filter select { min-width: 230px; }
.search-big { display: flex; gap: 9px; align-items: center; }
.search-big input { flex: 1; }
.learn-add textarea { width: 100%; }
.learn-add.done-today { border-left: 3px solid var(--go); }
.req-form { gap: 10px; }
.req-h { font-family: var(--mono); font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--violet); margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line-2); }
.req-h:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 5px 12px; }
.check-item { flex-direction: row !important; align-items: center; gap: 8px; font-family: var(--body) !important; font-size: 13px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; padding: 5px 3px; cursor: pointer; }
.check-item input { width: 16px; height: 16px; min-height: 0 !important; accent-color: var(--violet); margin: 0; }
.req-actions, .req-toolbar { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.req-toolbar { margin-top: 0; margin-bottom: 14px; }
.req-toolbar form { display: contents; }
tr.inactive { opacity: .45; }

/* blueprints */
.bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.bp-card { display: flex; flex-direction: column; gap: 9px; border-left: 3px solid var(--violet); }
.bp-counts { display: flex; gap: 14px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bp-counts b { color: var(--ink); font-weight: 500; }

/* black box */
.bb-note { font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }

/* reports extras */
.okr-row { display: grid; grid-template-columns: 1fr 92px 62px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.okr-row:last-child { border-bottom: 0; }
.okr-kr { font-size: 13.5px; }
.okr-src { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); display: block; margin-top: 2px; }
.okr-val { font-family: var(--mono); font-size: 17px; font-variant-numeric: tabular-nums; text-align: right; }
.okr-row.hit .okr-val { color: var(--go); }
.okr-row.miss .okr-val { color: var(--signal); }
.okr-target { font-family: var(--mono); font-size: 10px; color: var(--faint); text-align: right; text-transform: uppercase; }
.not-measured { background: var(--paper); border: 1px dashed var(--line); border-radius: var(--r); padding: 14px 16px; font-size: 13px; color: var(--muted); }
.not-measured b { color: var(--text); font-weight: 500; }
.lift { font-size: 12.5px; color: var(--muted); }

/* report / brief print pages */
.report-body { display: block; background: var(--paper); }
.report { max-width: 880px; margin: 0 auto; padding: 26px 24px 60px; background: var(--surface); min-height: 100vh; }
.report-bar { display: flex; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.report-brand { font-family: var(--mono); font-weight: 500; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.report-brand em { font-style: normal; color: var(--violet); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.report-head h1 { font-size: 25px; margin: 4px 0 2px; }
.report-desc { color: var(--muted); margin: 10px 0 4px; }
.report h2 { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 24px 0 9px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.report-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 16px; }
.report-kpis div { background: var(--surface); padding: 12px 10px; text-align: center; }
.report-kpis b { display: block; font-family: var(--mono); font-size: 17px; font-weight: 500; }
.report-kpis span { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.report-foot { margin-top: 30px; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.health { display: inline-flex; font-family: var(--mono); font-size: 10px; font-weight: 500; padding: 4px 9px; border-radius: 3px; text-transform: uppercase; letter-spacing: .07em; }
.health.big { font-size: 12px; padding: 6px 12px; }
.h-ok { background: var(--go-soft); color: var(--go); }
.h-risk { background: var(--hold-soft); color: #8A5C00; }
.h-late { background: var(--signal-soft); color: var(--signal); }
.h-hold { background: var(--paper); color: var(--muted); }
.h-done { background: var(--violet-soft); color: #4530C4; }
.table.brief th.brief-l { width: 180px; text-align: left; vertical-align: top; }
.table.brief td.brief-block { white-space: pre-wrap; }
.table.small { font-size: 12px; }
.htitle { vertical-align: middle; margin-left: 6px; }

/* manual */
.manual { max-width: 880px; }
.man-h { font-family: var(--display); font-size: 16px; text-transform: none; letter-spacing: -.02em; color: var(--text); margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.manual p { margin-bottom: 9px; font-size: 14px; }
.man-flow { font-family: var(--mono); font-size: 12px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); display: inline-block; letter-spacing: .04em; }
.man-ol, .man-ul { margin: 0 0 8px 20px; font-size: 14px; }
.man-ol li, .man-ul li { margin-bottom: 6px; }
.manual code { font-family: var(--mono); background: var(--paper); padding: 1px 5px; border-radius: 3px; font-size: 12.5px; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 761px) and (max-height: 820px) {
  .sidebar { padding: 14px 9px; }
  .brand { padding-bottom: 12px; }
  .nav a { padding: 7px 10px; min-height: 34px; }
}
@media (min-width: 761px) and (max-height: 720px) { .flow-legend { display: none; } }

@media (max-width: 1080px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .task-layout { grid-template-columns: 1fr; }
  .task-side { position: static; }
  .agenda { grid-template-columns: 1fr; }
}
@media (max-width: 900px) { .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; max-width: 100%; height: auto; position: static; flex-direction: row;
    flex-wrap: wrap; align-items: center; padding: 8px 12px; gap: 8px; overflow: hidden;
  }
  .brand { padding: 0 6px 0 0; flex-shrink: 0; }
  .brand-name { display: none; }
  .user-chip { flex: 1; min-width: 0; margin-bottom: 0; }
  .side-search { width: 100%; order: 5; margin-bottom: 0; }
  .nav { flex-direction: row; width: 100%; order: 4; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex-shrink: 0; }
  .side-foot { order: 6; width: 100%; margin-top: 0; padding-top: 0; }
  .flow-legend { display: none; }
  .foot-row { margin-top: 0; justify-content: flex-end; }
  .main { padding: 18px 14px 50px; }
  .board { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 3px 1fr; }
  .st-ident { display: none; }
  .st-body { padding: 9px 12px; }
  .st-side { padding: 0 12px 10px; }
  .headline { font-size: 23px; }
  .cal-cell { min-height: 56px; padding: 3px; }
  .cal-ev { font-size: 8.5px; padding: 2px 3px; }
  .cal-grid { gap: 3px; }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table { display: block; overflow-x: auto; }
  .master-grid, .bp-grid { grid-template-columns: 1fr; }
  .tk-controls, .tk-controls-wrap { min-width: 0; width: 100%; }
  .modal { padding: 18px 16px; }
  .okr-row { grid-template-columns: 1fr 70px; }
  .okr-target { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  .sidebar, .no-print, .toast { display: none !important; }
  .main, .report { padding: 0; max-width: none; }
  .card { page-break-inside: avoid; }
}

/* ============================================================================
   V9 — themes, top bar, and the components added with them
   Three themes (tower / midnight / paper) × two modes (light / dark).
   Everything downstream reads the same variables, so nothing else changes.
   ============================================================================ */

/* --- dark mode --- */
html[data-mode="dark"] {
  --ink: #05070A;
  --ink-2: #11151B;
  --ink-3: #1D242D;
  --paper: #0B0E13;
  --surface: #131820;
  --line: #232B36;
  --line-2: #1B222B;
  --text: #E7EBF0;
  --muted: #8F9AA8;
  --faint: #6A7482;
  --violet-soft: #221C4D;
  --signal-soft: #3A1A1D;
  --hold-soft: #3A2B0E;
  --go-soft: #0E332F;
}
html[data-mode="dark"] body { background: var(--paper); }
html[data-mode="dark"] .sidebar { background: #05070A; border-right: 1px solid var(--line); }
html[data-mode="dark"] .nav a.active { background: var(--violet); color: #fff; }
html[data-mode="dark"] .col-body { background: #0E131A; }
html[data-mode="dark"] .col-head.st-testing { color: #24190A; }
html[data-mode="dark"] .flow-rail, html[data-mode="dark"] .state-banner { border: 1px solid var(--line); }
html[data-mode="dark"] .flow-rail { background: #10151D; }
html[data-mode="dark"] .rail-stage { background: #182029; }
html[data-mode="dark"] .chip { background: #1A212A; }
html[data-mode="dark"] .task, html[data-mode="dark"] .strip, html[data-mode="dark"] .modal,
html[data-mode="dark"] .card { background: var(--surface); }
html[data-mode="dark"] .form input, html[data-mode="dark"] .form select,
html[data-mode="dark"] .form textarea, html[data-mode="dark"] .m-field select,
html[data-mode="dark"] .filter select, html[data-mode="dark"] .filter input,
html[data-mode="dark"] .search-big input, html[data-mode="dark"] .tk-controls select {
  background: #0E131A; color: var(--text); border-color: var(--line);
}
html[data-mode="dark"] .btn { background: var(--violet); border-color: var(--violet); }
html[data-mode="dark"] .btn:hover { background: #4B2FE0; }
html[data-mode="dark"] .mini { background: #0E131A; color: var(--text); border-color: var(--line); }
html[data-mode="dark"] .cal-cell { background: #0E131A; }
html[data-mode="dark"] .cal-ev { background: #182029; }
html[data-mode="dark"] .ag-item, html[data-mode="dark"] .tk-msg,
html[data-mode="dark"] .not-measured { background: #0E131A; }
html[data-mode="dark"] .topbar { background: var(--surface); border-color: var(--line); }
html[data-mode="dark"] .report-body, html[data-mode="dark"] .report { background: var(--paper); }
html[data-mode="dark"] .login-card { background: var(--surface); }

/* --- shell + top bar --- */
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 30px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top-search { flex: 1; max-width: 460px; position: relative; display: flex; align-items: center; }
.top-search svg { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.top-search input {
  width: 100%; font: inherit; font-size: 13.5px; padding: 8px 12px 8px 32px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper);
  color: var(--text); min-height: 36px;
}
.top-search input:focus { outline: 2px solid var(--violet); outline-offset: -1px; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.inline-mini { display: flex; }
.top-btn {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r); color: var(--muted); border: 0; background: none;
}
.top-btn:hover { background: var(--paper); color: var(--text); }
.top-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 99px; border: 1px solid var(--line); margin-left: 6px; max-width: 190px;
}
.top-user:hover { border-color: var(--violet); }
.top-user .uc-text b { color: var(--text); font-size: 12.5px; }
.top-user .uc-text i { color: var(--faint); }
.main { padding: 22px 30px 64px; }

/* --- filters, pager --- */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; }
.filter-bar .filter input, .filter-bar .filter select { min-width: 220px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; flex-wrap: wrap; }
.pager-btns { display: flex; gap: 6px; }

/* --- announcements --- */
.ann { border-left: 3px solid var(--violet); margin-bottom: 0; }
.ann.ann-pinned { border-left-color: var(--hold); background: var(--hold-soft); }
.ann h3 { font-size: 16px; margin: 4px 0; }
.ann form { margin-top: 8px; }

/* --- requirement progress + wide modal --- */
.req-progress { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.req-progress .bar, .req-bar .bar { flex: 1; min-width: 160px; height: 7px; }
.req-pct { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.req-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 0 14px;
  border-bottom: 1px solid var(--line-2); margin-bottom: 14px; flex-wrap: wrap;
}
.req-saved { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.autosave-note { align-self: center; }
.modal.modal-wide { max-width: 860px; max-height: 86vh; overflow-y: auto; }
.req-modal-wrap { padding: 4vh 16px; }

/* --- plan tab (modules + milestones together) --- */
.plan-milestones { margin-top: 16px; }

@media (max-width: 760px) {
  .topbar { padding: 8px 14px; gap: 8px; position: static; }
  .top-search { max-width: none; }
  .top-user .uc-text { display: none; }
  .top-user { padding: 4px; }
  .filter-bar .filter input, .filter-bar .filter select { min-width: 0; width: 100%; }
  .filter-bar .filter { width: 100%; }
}

/* ============================================================================
   THEMES — four complete looks, not four accent colours.
   Each one redefines type, radius, depth, borders, surfaces and controls, so
   switching genuinely changes how the product feels. Everything downstream
   reads the same variables, so no page needs a per-theme branch.

     control  Control Tower — the operations desk. Sharp, mono, violet.
     aurora   Aurora — frosted glass, soft depth, rounded, system type.
     studio   Studio — calm modern product UI, generous space, teal.
     marigold Marigold — the original warm build. Ink navy and amber.
   ============================================================================ */

/* ---------------------------------------------------------------- CONTROL TOWER */
html[data-theme="control"] {
  --r: 6px; --r-lg: 8px; --r-pill: 4px;
  --shadow: none;
  --shadow-lift: 0 2px 8px rgba(15, 18, 22, .06);
  --border-w: 1px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter Tight", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --surface-blur: none;
  --nav-active-bg: #fff;
  --nav-active-fg: var(--ink);
  --btn-weight: 500;
  --label-transform: uppercase;
  --label-spacing: .1em;
  --label-font: var(--mono);
}

/* ---------------------------------------------------------------- AURORA (glass) */
html[data-theme="aurora"] {
  --ink: #1C1C1E; --ink-2: #2C2C2E; --ink-3: #3A3A3C;
  --paper: #F2F2F7; --surface: rgba(255, 255, 255, .72);
  --line: rgba(60, 60, 67, .13); --line-2: rgba(60, 60, 67, .07);
  --text: #1C1C1E; --muted: #6E6E73; --faint: #A1A1A6;
  --violet: #0A84FF; --violet-soft: rgba(10, 132, 255, .12);
  --signal: #FF3B30; --signal-soft: rgba(255, 59, 48, .12);
  --hold: #FF9F0A; --hold-soft: rgba(255, 159, 10, .14);
  --go: #30D158; --go-soft: rgba(48, 209, 88, .14);
  --r: 14px; --r-lg: 20px; --r-pill: 999px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 8px 30px rgba(0, 0, 0, .06);
  --shadow-lift: 0 4px 16px rgba(0, 0, 0, .08), 0 16px 48px rgba(0, 0, 0, .08);
  --border-w: 0.5px;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Tight", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Tight", sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", monospace;
  --surface-blur: saturate(180%) blur(20px);
  --nav-active-bg: rgba(255, 255, 255, .9);
  --nav-active-fg: var(--violet);
  --btn-weight: 590;
  --label-transform: none;
  --label-spacing: -.01em;
  --label-font: var(--body);
}
html[data-theme="aurora"] body {
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(10, 132, 255, .16), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(191, 90, 242, .14), transparent 58%),
    radial-gradient(760px 520px at 48% 108%, rgba(48, 209, 88, .10), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}
html[data-theme="aurora"] .card,
html[data-theme="aurora"] .strip,
html[data-theme="aurora"] .modal,
html[data-theme="aurora"] .topbar,
html[data-theme="aurora"] .task,
html[data-theme="aurora"] .kpi {
  backdrop-filter: var(--surface-blur);
  -webkit-backdrop-filter: var(--surface-blur);
}
html[data-theme="aurora"] .sidebar {
  background: rgba(28, 28, 30, .82);
  backdrop-filter: var(--surface-blur);
  -webkit-backdrop-filter: var(--surface-blur);
  border-right: var(--border-w) solid rgba(255, 255, 255, .1);
}
html[data-theme="aurora"] .topbar { background: rgba(255, 255, 255, .68); }
html[data-theme="aurora"] .card { box-shadow: var(--shadow); }
html[data-theme="aurora"] .card:hover { box-shadow: var(--shadow-lift); }
html[data-theme="aurora"] .strip:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
html[data-theme="aurora"] .btn {
  background: var(--violet); border-color: transparent; border-radius: var(--r-pill);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
html[data-theme="aurora"] .btn:hover { background: #0071E3; }
html[data-theme="aurora"] .btn.primary { background: var(--violet); }
html[data-theme="aurora"] .mini { border-radius: var(--r-pill); }
html[data-theme="aurora"] .chip { border-radius: var(--r-pill); }
html[data-theme="aurora"] .col-body { background: rgba(255, 255, 255, .4); }
html[data-theme="aurora"] .col-head { border-radius: var(--r) var(--r) 0 0; }
html[data-theme="aurora"] .flow-rail { background: rgba(28, 28, 30, .88); backdrop-filter: var(--surface-blur); }
html[data-theme="aurora"] .avatar { background: var(--violet); }
html[data-theme="aurora"] .nav a.active { box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------------------------------------------------------------- STUDIO (modern) */
html[data-theme="studio"] {
  --ink: #101720; --ink-2: #18202B; --ink-3: #232D3B;
  --paper: #F7F8FA; --surface: #FFFFFF;
  --line: #E6E9EF; --line-2: #F0F2F6;
  --text: #101720; --muted: #5C6675; --faint: #98A2B3;
  --violet: #0F766E; --violet-soft: #E5F5F2;
  --signal: #DC2626; --signal-soft: #FEECEC;
  --hold: #D97706; --hold-soft: #FEF4E6;
  --go: #059669; --go-soft: #E6F6F0;
  --r: 10px; --r-lg: 16px; --r-pill: 8px;
  --shadow: 0 1px 2px rgba(16, 23, 32, .04);
  --shadow-lift: 0 6px 20px rgba(16, 23, 32, .09);
  --border-w: 1px;
  --display: "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Inter Tight", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --surface-blur: none;
  --nav-active-bg: var(--violet-soft);
  --nav-active-fg: #0B5C55;
  --btn-weight: 600;
  --label-transform: none;
  --label-spacing: .01em;
  --label-font: var(--body);
}
html[data-theme="studio"] .sidebar { background: var(--ink); }
html[data-theme="studio"] .card { box-shadow: var(--shadow); }
html[data-theme="studio"] .card:hover { border-color: #D4DAE3; }
html[data-theme="studio"] .strip { box-shadow: var(--shadow); }
html[data-theme="studio"] .strip:hover { box-shadow: var(--shadow-lift); border-color: var(--violet); }
html[data-theme="studio"] .btn { background: var(--violet); border-color: var(--violet); }
html[data-theme="studio"] .btn:hover { background: #0B5C55; }
html[data-theme="studio"] .col-body { background: #EEF1F5; }
html[data-theme="studio"] .kpi-num { letter-spacing: -.02em; }
html[data-theme="studio"] .nav a.active { color: #fff; background: var(--violet); }
html[data-theme="studio"] .task { border-radius: var(--r); }
html[data-theme="studio"] .avatar { background: var(--violet); }

/* ---------------------------------------------------------------- MARIGOLD (original) */
html[data-theme="marigold"] {
  --ink: #12182B; --ink-2: #1B2340; --ink-3: #2A3355;
  --paper: #F3F4F8; --surface: #FFFFFF;
  --line: #E3E6EE; --line-2: #EDEFF4;
  --text: #1E2536; --muted: #667085; --faint: #98A1AD;
  --violet: #E8930C; --violet-soft: #FDF1DC;
  --signal: #D6455D; --signal-soft: #FBEDF0;
  --hold: #7C5CD6; --hold-soft: #F1EDFB;
  --go: #1E9E6A; --go-soft: #E7F6EF;
  --r: 12px; --r-lg: 14px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(18, 24, 43, .05), 0 4px 16px rgba(18, 24, 43, .05);
  --shadow-lift: 0 6px 24px rgba(18, 24, 43, .10);
  --border-w: 1px;
  --display: "Sora", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "Inter", system-ui, sans-serif;
  --surface-blur: none;
  --nav-active-bg: var(--ink-2);
  --nav-active-fg: #fff;
  --btn-weight: 600;
  --label-transform: none;
  --label-spacing: 0;
  --label-font: var(--body);
}
html[data-theme="marigold"] .card { box-shadow: var(--shadow); }
html[data-theme="marigold"] .btn { background: var(--violet); border-color: var(--violet); color: #241500; }
html[data-theme="marigold"] .btn:hover { background: #D4820A; }
html[data-theme="marigold"] .nav a.active { border-left: 3px solid var(--violet); }
html[data-theme="marigold"] .sidebar { background: var(--ink); }
html[data-theme="marigold"] .avatar { background: var(--ink); }
html[data-theme="marigold"] .col-head.st-testing { background: #7C5CD6; color: #fff; }
html[data-theme="marigold"] .col-head.st-qc { background: var(--violet); color: #241500; }
html[data-theme="marigold"] .strip:hover { box-shadow: var(--shadow-lift); }

/* ---------------------------------------------------------------- shared wiring
   Components read the variables above, so a theme change reshapes all of them. */
.card, .modal, .kpis, .col-body, .task, .strip, .cal-cell, .cal-ev, .top-search input,
.form input, .form select, .form textarea, .m-field select, .mini, .btn, .ann,
.tk-msg, .ag-item, .flow-rail, .state-banner, .gate, .not-measured, .filter-bar,
.rail-stage, .login-card, .top-user { border-radius: var(--r); }
.modal, .login-card { border-radius: var(--r-lg); }
.chip, .badge, .nav-badge, .score, .health { border-radius: var(--r-pill); }
.card { box-shadow: var(--shadow); border-width: var(--border-w); }
.btn { font-weight: var(--btn-weight); }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-fg); }
.card-head h2, .kpi-label, .st-line, .sec, .eyebrow, .crumbs, .tab, .col-head,
.form label, .m-field, .details dt, .filter, .req-h {
  font-family: var(--label-font);
  text-transform: var(--label-transform);
  letter-spacing: var(--label-spacing);
}
/* the state line stays monospaced everywhere: it is data, and it must align */
.st-line, .task-line, .kpi-num, .num, .feed-time, .st-ident, .st-meta,
.rail-count, .okr-val { font-family: var(--mono); }

/* leave module */
.ev-leave { border-left-color: #7C5CD6 !important; }
.ev-leave-pending { border-left-color: var(--hold) !important; opacity: .75; border-style: dashed; }
.cal-legend .ev-leave { background: #7C5CD6; border: 0; }
.cal-legend .ev-leave-pending { background: var(--hold); border: 0; opacity: .75; }
.leave-warn {
  background: var(--hold-soft); border: 1px solid var(--hold); border-radius: var(--r);
  padding: 10px 13px; font-size: 13px;
}
.leave-warn p { margin: 0 0 5px; }
.leave-warn p:last-child { margin-bottom: 0; }
.warn-red { color: var(--signal); }
.warn-amber { color: #8A5C00; }
html[data-mode="dark"] .warn-amber { color: var(--hold); }

/* theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.theme-card {
  border: 2px solid var(--line); border-radius: var(--r); padding: 0; overflow: hidden;
  background: var(--surface); cursor: pointer; text-align: left; display: block; width: 100%;
}
.theme-card:hover { border-color: var(--violet); }
.theme-card.is-current { border-color: var(--violet); }
.theme-swatch { height: 62px; display: flex; align-items: flex-end; gap: 4px; padding: 8px; }
.theme-swatch i { flex: 1; height: 100%; border-radius: 3px; display: block; }
.theme-meta { padding: 9px 11px; border-top: 1px solid var(--line); }
.theme-meta b { display: block; font-size: 13.5px; font-family: var(--display); }
.theme-meta span { font-size: 11.5px; color: var(--muted); }
.theme-current-tag { font-size: 10.5px; color: var(--violet); font-weight: 600; }


/* ---------------------------------------------------------------- dark, per theme
   A theme sets its own palette, so each one needs its own dark counterpart at
   matching specificity — otherwise the light colours win and dark mode does
   nothing on that theme. */
html[data-mode="dark"][data-theme="control"] {
  --ink: #05070A; --ink-2: #11151B; --ink-3: #1D242D;
  --paper: #0B0E13; --surface: #131820;
  --line: #232B36; --line-2: #1B222B;
  --text: #E7EBF0; --muted: #8F9AA8; --faint: #6A7482;
  --violet: #7C63FF; --violet-soft: #221C4D;
  --signal-soft: #3A1A1D; --hold-soft: #3A2B0E; --go-soft: #0E332F;
}
html[data-mode="dark"][data-theme="aurora"] {
  --ink: #000000; --ink-2: #1C1C1E; --ink-3: #2C2C2E;
  --paper: #000000; --surface: rgba(28, 28, 30, .72);
  --line: rgba(255, 255, 255, .14); --line-2: rgba(255, 255, 255, .07);
  --text: #F5F5F7; --muted: #98989D; --faint: #6E6E73;
  --violet: #0A84FF; --violet-soft: rgba(10, 132, 255, .22);
  --signal: #FF453A; --signal-soft: rgba(255, 69, 58, .2);
  --hold: #FF9F0A; --hold-soft: rgba(255, 159, 10, .2);
  --go: #30D158; --go-soft: rgba(48, 209, 88, .2);
  --nav-active-bg: rgba(255, 255, 255, .14);
  --nav-active-fg: #fff;
}
html[data-mode="dark"][data-theme="aurora"] body {
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(10, 132, 255, .26), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(191, 90, 242, .22), transparent 58%),
    radial-gradient(760px 520px at 48% 108%, rgba(48, 209, 88, .14), transparent 60%),
    #000;
  background-attachment: fixed;
}
html[data-mode="dark"][data-theme="aurora"] .sidebar { background: rgba(0, 0, 0, .6); }
html[data-mode="dark"][data-theme="aurora"] .topbar { background: rgba(28, 28, 30, .68); }
html[data-mode="dark"][data-theme="aurora"] .col-body { background: rgba(255, 255, 255, .05); }
html[data-mode="dark"][data-theme="studio"] {
  --ink: #070B10; --ink-2: #0E141C; --ink-3: #1A232E;
  --paper: #0A0F15; --surface: #121A22;
  --line: #223040; --line-2: #18222D;
  --text: #E8EDF2; --muted: #93A1B0; --faint: #6B7A89;
  --violet: #2DD4BF; --violet-soft: #0C312D;
  --signal-soft: #3A1616; --hold-soft: #3A2A0C; --go-soft: #0C3327;
  --nav-active-bg: var(--violet); --nav-active-fg: #04211D;
}
html[data-mode="dark"][data-theme="studio"] .col-body { background: #0E151D; }
html[data-mode="dark"][data-theme="marigold"] {
  --ink: #0A0E1A; --ink-2: #141B2E; --ink-3: #1F2942;
  --paper: #0C1120; --surface: #141B2B;
  --line: #262F45; --line-2: #1C2436;
  --text: #E9ECF5; --muted: #929BB0; --faint: #6C768C;
  --violet: #F2A62A; --violet-soft: #3A2A08;
  --signal: #F26A7E; --signal-soft: #3A161D;
  --hold: #9B7FE8; --hold-soft: #241C3D;
  --go: #2BB57F; --go-soft: #0D3327;
  --nav-active-bg: var(--ink-2); --nav-active-fg: #fff;
}
html[data-mode="dark"][data-theme="marigold"] .col-body { background: #101728; }
html[data-mode="dark"][data-theme="marigold"] .btn { color: #241500; }

/* things that must react to dark regardless of theme */
html[data-mode="dark"] .theme-card { background: var(--surface); }
html[data-mode="dark"] .top-search input { background: var(--ink-2); color: var(--text); }
html[data-mode="dark"] .leave-warn { background: var(--hold-soft); }

/* ---------------------------------------------------------------- design vault */
.insp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.insp {
  background: var(--surface); border: var(--border-w) solid var(--line);
  border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-width: 0;
}
.insp:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--violet); }
.insp-pinned { border-color: var(--violet); }
.insp-shot {
  position: relative; display: block; aspect-ratio: 16 / 10; background: var(--paper);
  overflow: hidden; border-bottom: var(--border-w) solid var(--line);
}
.insp-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.insp-link-shot {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; background:
    linear-gradient(135deg, var(--violet-soft), var(--paper));
}
.insp-favicon {
  width: 46px; height: 46px; border-radius: var(--r); background: var(--violet); color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-size: 20px; font-weight: 700;
}
.insp-domain { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.insp-count, .insp-pin {
  position: absolute; bottom: 8px; right: 8px; background: rgba(15, 18, 22, .78);
  color: #fff; font-family: var(--mono); font-size: 10px; padding: 3px 7px;
  border-radius: var(--r-pill); letter-spacing: .05em; text-transform: uppercase;
}
.insp-pin { top: 8px; bottom: auto; left: 8px; right: auto; background: var(--violet); }
.insp-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.insp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.insp-title { font-family: var(--display); font-weight: 600; font-size: 15px; line-height: 1.25; }
.insp:hover .insp-title { color: var(--violet); }
.insp-host { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.insp-points { display: flex; gap: 4px; flex-wrap: wrap; }
.chip.wp { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.insp-note { font-size: 12.5px; color: var(--muted); line-height: 1.45; flex: 1; }
.insp-foot {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  text-transform: uppercase; letter-spacing: .05em; padding-top: 8px;
  border-top: 1px solid var(--line-2); flex-wrap: wrap;
}
.insp-foot .link { text-transform: none; letter-spacing: 0; font-family: var(--body); }

/* detail */
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shot { margin: 0; border: var(--border-w) solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.shot img { width: 100%; display: block; max-height: 340px; object-fit: cover; }
.shot figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-2);
  background: var(--surface);
}
.insp-longnote { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.wp-set { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.wp-set legend {
  font-family: var(--label-font); font-size: 10.5px; letter-spacing: var(--label-spacing);
  text-transform: var(--label-transform); color: var(--muted); padding: 0 6px;
}
html[data-mode="dark"] .insp-count { background: rgba(0, 0, 0, .8); }
@media (max-width: 760px) {
  .insp-grid { grid-template-columns: 1fr; }
  .shot-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- milestones as the plan */
.ms-block {
  border: var(--border-w) solid var(--line); border-left: 3px solid var(--faint);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; background: var(--surface);
}
.ms-block.t-red { border-left-color: var(--signal); }
.ms-block.t-hold { border-left-color: var(--hold); }
.ms-block.t-on { border-left-color: var(--violet); }
.ms-block.t-go { border-left-color: var(--go); }
.ms-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.ms-seq {
  font-family: var(--mono); font-size: 12px; width: 26px; height: 26px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--paper); color: var(--muted);
}
.ms-title-wrap { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.ms-title-wrap h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ms-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ms-actions form { display: contents; }
.ms-block .bar { margin: 10px 0; }
.ms-tasks { display: flex; flex-direction: column; gap: 4px; padding-left: 38px; }
.ms-task {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 7px 10px; border-radius: var(--r); background: var(--paper);
  border-left: 2px solid transparent;
}
.ms-task.t-red { border-left-color: var(--signal); }
.ms-task.t-hold { border-left-color: var(--hold); }
.ms-task.t-go { border-left-color: var(--go); }
.ms-task-name { font-weight: 500; font-size: 13.5px; flex: 1; min-width: 140px; }
.ms-task-name:hover { color: var(--violet); }

/* ---------------------------------------------------------------- the tracker chain */
.chain-client { border-left: 3px solid var(--faint); }
.chain-client.t-red { border-left-color: var(--signal); }
.chain-client.t-hold { border-left-color: var(--hold); }
.chain-client.t-on { border-left-color: var(--violet); }
.chain-client.t-go { border-left-color: var(--go); }
.chain-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap;
}
.chain-title { font-size: 18px; }
.chain-title a:hover { color: var(--violet); }
.chain-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chain-project { padding: 10px 0 4px 0; border-top: 1px dashed var(--line-2); margin-top: 10px; }
.chain-project:first-of-type { border-top: 0; margin-top: 0; }
.chain-row { display: flex; gap: 10px; align-items: flex-start; }
.chain-rail { width: 3px; align-self: stretch; border-radius: 2px; background: var(--faint); flex-shrink: 0; }
.chain-rail.t-red { background: var(--signal); }
.chain-rail.t-hold { background: var(--hold); }
.chain-rail.t-on { background: var(--violet); }
.chain-rail.t-go { background: var(--go); }
.chain-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chain-name { font-family: var(--display); font-weight: 600; font-size: 15px; }
a.chain-name:hover { color: var(--violet); }
.chain-side { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chain-now {
  font-size: 13px; color: var(--muted); margin: 8px 0 6px 13px;
  padding-left: 10px; border-left: 2px solid var(--line);
}
.chain-ms { margin: 5px 0 5px 13px; }
.chain-ms summary {
  display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none;
  padding: 8px 10px; border-radius: var(--r); background: var(--paper); flex-wrap: wrap;
}
.chain-ms summary::-webkit-details-marker { display: none; }
.chain-ms summary:hover { background: var(--violet-soft); }
.chain-ms-body { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.chain-tasks { padding: 6px 0 6px 24px; display: flex; flex-direction: column; gap: 3px; }
.chain-task { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; padding: 4px 0; }
.chain-task-name { flex: 1; min-width: 140px; font-weight: 500; }
.chain-task-name:hover { color: var(--violet); }

/* ---------------------------------------------------------------- reports that explain themselves */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.qa {
  padding: 14px 16px; border: var(--border-w) solid var(--line); border-radius: var(--r);
  background: var(--surface); display: flex; flex-direction: column; gap: 4px;
}
.qa-bad { border-color: var(--signal); background: var(--signal-soft); }
.qa-warn { border-color: var(--hold); background: var(--hold-soft); }
.qa-num {
  font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: -.03em;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1;
}
html[data-mode="dark"] .qa-num { color: var(--text); }
.qa-label { font-weight: 600; font-size: 13.5px; }
.qa-how { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.pipe { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pipe-step {
  flex: 1; min-width: 92px; text-align: center; padding: 12px 8px;
  background: var(--paper); border-radius: var(--r);
}
.pipe-num { display: block; font-family: var(--mono); font-size: 22px; font-weight: 500; }
.pipe-label {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.pipe-arrow { color: var(--faint); font-size: 14px; }
@media (max-width: 760px) {
  .ms-tasks { padding-left: 0; }
  .chain-ms, .chain-now { margin-left: 4px; }
  .chain-tasks { padding-left: 8px; }
  .pipe-step { min-width: 70px; }
}
