:root {
  --paper: #F5F6F4;
  --surface: #FFFFFF;
  --surface-2: #ECEEEB;
  --ink: #1A1D23;
  --ink-soft: #4A4F58;
  --ink-faint: #7A8089;
  --line: #D8DBD6;
  --accent: #0E8F86;
  --accent-ink: #0A6B64;
  --accent-wash: #E0F0EE;
  --good: #2E7D4F;
  --good-wash: #E2F0E7;
  --warn: #A06D0B;
  --warn-wash: #F5EAD1;
  --bad: #B3403A;
  --bad-wash: #F6E2E0;
  --hold: #6B7280;
  --hold-wash: #E8EAED;
  --shadow: 0 1px 2px rgba(20,24,30,.05), 0 4px 16px rgba(20,24,30,.06);
  --pc0: #3B5BB5; --pw0: #E4EAF7;
  --pc1: #7A4BB8; --pw1: #EDE5F7;
  --pc2: #2E7D4F; --pw2: #E2F0E7;
  --pc3: #B3612E; --pw3: #F7E9DD;
  --pc4: #B03A72; --pw4: #F7E1EB;
  --pc5: #0A6B64; --pw5: #E0F0EE;
  --rev: #0E7490; --rev-wash: #DFF2F8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101318;
    --surface: #181C23;
    --surface-2: #1F242D;
    --ink: #E8EAE8;
    --ink-soft: #B3B8BF;
    --ink-faint: #7E848D;
    --line: #2A303A;
    --accent: #35D0C4;
    --accent-ink: #5FDDD3;
    --accent-wash: #12312F;
    --good: #5BBF8A;
    --good-wash: #14291E;
    --warn: #E5B84B;
    --warn-wash: #2E2510;
    --bad: #E5736C;
    --bad-wash: #331715;
    --hold: #9AA1AB;
    --hold-wash: #232830;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --pc0: #8CA8E8; --pw0: #1B2233;
    --pc1: #BB93E8; --pw1: #261B33;
    --pc2: #5BBF8A; --pw2: #14291E;
    --pc3: #E8A46E; --pw3: #33241B;
    --pc4: #E884B3; --pw4: #331B27;
    --pc5: #5FDDD3; --pw5: #12312F;
    --rev: #56CCE8; --rev-wash: #123039;
  }
}
:root[data-theme="dark"] {
  --paper: #101318;
  --surface: #181C23;
  --surface-2: #1F242D;
  --ink: #E8EAE8;
  --ink-soft: #B3B8BF;
  --ink-faint: #7E848D;
  --line: #2A303A;
  --accent: #35D0C4;
  --accent-ink: #5FDDD3;
  --accent-wash: #12312F;
  --good: #5BBF8A;
  --good-wash: #14291E;
  --warn: #E5B84B;
  --warn-wash: #2E2510;
  --bad: #E5736C;
  --bad-wash: #331715;
  --hold: #9AA1AB;
  --hold-wash: #232830;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --pc0: #8CA8E8; --pw0: #1B2233;
  --pc1: #BB93E8; --pw1: #261B33;
  --pc2: #5BBF8A; --pw2: #14291E;
  --pc3: #E8A46E; --pw3: #33241B;
  --pc4: #E884B3; --pw4: #331B27;
  --pc5: #5FDDD3; --pw5: #12312F;
  --rev: #56CCE8; --rev-wash: #123039;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); opacity: .55; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px 96px; }

/* ---------- header ---------- */
header { padding: 48px 0 8px; display: flex; align-items: flex-start; gap: 24px; }
.spiro { flex: 0 0 auto; width: 84px; height: 84px; margin-top: 6px; }
.eyebrow {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink);
  margin: 0 0 10px;
}
h1 {
  font-family: "Spectral", Georgia, serif; font-weight: 500;
  font-size: clamp(30px, 4.6vw, 44px); line-height: 1.08; margin: 0 0 10px;
  text-wrap: balance; letter-spacing: .005em;
}
.subtitle { color: var(--ink-soft); max-width: 62ch; margin: 0; }
.meta-line {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-faint);
  margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 20px;
}

/* ---------- tabs ---------- */
.tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 2px; overflow-x: auto;
  margin: 28px -24px 0; padding: 6px 24px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tabs a {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  color: var(--ink-faint); padding: 10px 14px 12px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink-soft); }
.tabs a[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }

/* ---------- sections / panels ---------- */
section[role="tabpanel"] { margin-top: 36px; }
.block { margin-top: 48px; }
h2 {
  font-family: "Spectral", Georgia, serif; font-weight: 500; font-size: 26px;
  margin: 0 0 6px; letter-spacing: .003em; text-wrap: balance;
}
.section-note { color: var(--ink-soft); margin: 0 0 20px; max-width: 70ch; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }

/* ---------- status strip ---------- */
.strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 0 0 12px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .k {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px;
}
.stat .v {
  font-family: "Spectral", Georgia, serif; font-size: 26px; font-weight: 500;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 14px; font-family: "Archivo", sans-serif; color: var(--ink-soft); font-weight: 400; }
.progress-track {
  height: 6px; border-radius: 3px; background: var(--surface-2);
  margin-top: 10px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }

/* ---------- drumbeat ---------- */
.drumbeat { display: flex; flex-direction: column; gap: 8px; }
.beat {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 16px; box-shadow: var(--shadow);
}
.beat .b-role {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-ink); flex: 0 0 auto; min-width: 130px;
}
.beat .b-task { color: var(--ink-soft); font-size: 14px; }
.beat .b-week { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); margin-left: auto; }

/* ---------- ground rules ---------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.rule {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.rule .num {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent-ink);
  letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 8px;
}
.rule p { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; }

/* ---------- milestones ---------- */
.milestones { display: flex; flex-direction: column; gap: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.ms { position: relative; padding: 0 0 26px 26px; }
.ms:last-child { padding-bottom: 4px; }
.ms::before {
  content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px;
  box-sizing: border-box; transform: rotate(45deg); transform-origin: center center;
  background: var(--paper); border: 2px solid var(--hold);
}
.ms[data-fill="1"]::before { background: var(--accent); border-color: var(--accent); }
.ms .ms-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.ms .ms-date { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-faint); }
.ms .ms-title { font-family: "Spectral", Georgia, serif; font-size: 19px; font-weight: 600; }
.ms .ms-count { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); }
.ms .ms-exit { color: var(--ink-soft); font-size: 14px; margin: 6px 0 0; max-width: 72ch; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 500;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.planned { color: var(--hold); background: var(--hold-wash); }
.chip.progress { color: var(--warn); background: var(--warn-wash); }
.chip.review { color: var(--rev); background: var(--rev-wash); }
.chip.count { font-variant-numeric: tabular-nums; }
.chip.done { color: var(--good); background: var(--good-wash); }
.chip.blocked { color: var(--bad); background: var(--bad-wash); }
.chip.active { color: var(--accent-ink); background: var(--accent-wash); }
.chip.na { color: var(--ink-faint); background: transparent; }
.chip.na::before { display: none; }

/* ---------- matrix ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; min-width: 960px; }
th, td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
thead th {
  border-top: 0; font-family: "IBM Plex Mono", monospace; font-size: 11px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500;
  background: var(--surface-2); position: sticky; top: 0;
}
td.scene-cell { min-width: 240px; }
td.prog-cell { min-width: 120px; white-space: nowrap; }
.prog-cell .progress-track { display: inline-block; width: 60px; margin: 0 8px 0 0; vertical-align: middle; }
.prog-cell .progress-fill { display: block; }
.prog-cell .cov-count { vertical-align: middle; }
.scene-id { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent-ink); }
.scene-name { font-weight: 600; }
.scene-beats { color: var(--ink-faint); font-size: 12.5px; margin-top: 2px; }
td.wk { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

/* ---------- weeks ---------- */
.week {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); margin-bottom: 16px;
  /* no overflow:hidden — the task ⋯ menus must be able to escape the card */
}
.week-head {
  padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
}
.week-head .wk-id { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.week-head .wk-title { font-family: "Spectral", Georgia, serif; font-size: 18px; font-weight: 600; }
.week-head .wk-dates { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-faint); }
.week-head .wk-progress { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-soft); }
.week-goal { padding: 12px 18px 0; color: var(--ink-soft); font-size: 14px; max-width: 78ch; }
.lanes { padding: 14px 18px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px 22px; }
.lane h4 {
  margin: 0 0 8px; font-family: "IBM Plex Mono", monospace; font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600;
}

/* ---------- tasks & subtasks ---------- */
.task { display: flex; align-items: flex-start; gap: 9px; padding: 4px 0; font-size: 14px; }
.task .box {
  flex: 0 0 auto; width: 14px; height: 14px; margin-top: 3px; border-radius: 4px;
  border: 1.5px solid var(--hold); position: relative;
}
.task[data-s="done"] .box { background: var(--good); border-color: var(--good); }
.task[data-s="done"] .box::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 3px; height: 7px;
  border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.task[data-s="progress"] .box { border-color: var(--warn); background: linear-gradient(135deg, var(--warn) 50%, transparent 50%); }
.task[data-s="review"] .box { background: var(--rev); border-color: var(--rev); }
.task[data-s="review"] .box::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--paper);
}
.task[data-s="blocked"] .box { border-color: var(--bad); background: var(--bad-wash); }
.task[data-s="done"] .t-label { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--line); }
.task .t-label { color: var(--ink-soft); }
.task .t-flag {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .06em;
  color: var(--bad); text-transform: uppercase; margin-left: 6px;
}
.task .t-count, .kl-title .t-count, .kb-title .t-count {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint);
  margin-left: 6px; white-space: nowrap;
}

details.task-group { padding: 0; }
details.task-group > summary {
  list-style: none; cursor: pointer; border-radius: 6px;
}
details.task-group > summary::-webkit-details-marker { display: none; }
details.task-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.caret {
  flex: 0 0 auto; width: 0; height: 0; margin: 8px 0 0;
  border-left: 5px solid var(--ink-faint); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.caret.spacer { visibility: hidden; }
details.task-group[open] > summary .caret { transform: rotate(90deg); }
.subs { margin: 2px 0 6px 36px; padding-left: 12px; border-left: 1px solid var(--line); }
.subs .task { font-size: 13.5px; padding: 3px 0; }
.subs .task .box { width: 12px; height: 12px; margin-top: 4px; border-radius: 3px; }
.subs .task[data-s="done"] .box::after { left: 3px; top: 0; width: 3px; height: 6px; }

/* ---------- risks ---------- */
.risk-list { display: flex; flex-direction: column; gap: 12px; }
.risk {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 15px 18px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: baseline;
}
.sev {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.sev.high { color: var(--bad); background: var(--bad-wash); }
.sev.med { color: var(--warn); background: var(--warn-wash); }
.sev.low { color: var(--hold); background: var(--hold-wash); }
.risk .r-title { font-weight: 600; }
.risk .r-body { grid-column: 2; color: var(--ink-soft); font-size: 14px; max-width: 76ch; margin: 0; }
.risk .r-mit { grid-column: 2; font-size: 13.5px; margin: 4px 0 0; color: var(--ink-soft); }
.risk .r-mit strong { color: var(--accent-ink); font-weight: 600; }

/* ---------- assets ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.asset-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 15px 18px; box-shadow: var(--shadow); }
.asset-card ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 14px; }
.asset-card li { margin: 4px 0; }

/* ---------- changelog ---------- */
.log { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 24px; display: flex; flex-direction: column; gap: 14px; }
.log-entry .l-date { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--accent-ink); }
.log-entry .l-text { color: var(--ink-soft); font-size: 14px; margin-top: 2px; max-width: 76ch; }

.howto {
  margin-top: 28px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 10px;
  color: var(--ink-faint); font-size: 13.5px;
}
.howto code { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- sync badge ---------- */
.sync-badge { font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.sync-badge.ok { color: var(--good); }
.sync-badge.warn { color: var(--warn); }
.sync-badge.err { color: var(--bad); }

/* ---------- timeline (masterplan increments) ---------- */
.increments {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 18px 18px 10px; overflow-x: auto;
}
.tl { display: grid; grid-template-columns: 235px 1fr; min-width: 720px; }
.tl-labels { display: flex; flex-direction: column; }
.tl-lab {
  height: 40px; display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--ink-soft); white-space: nowrap;
  padding-right: 16px; overflow: hidden; text-overflow: ellipsis;
}
.tl-lab-id { font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600; color: var(--accent-ink); }
.tl-lab small { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--ink-faint); }
.tl-spacer { height: 24px; }
.tl-msspacer { height: 30px; }
.tl-chart { position: relative; }
.tl-axisrow { height: 24px; }
.tl-msrow { position: relative; height: 30px; }
.tl-tick {
  position: absolute; top: 0; transform: translateX(3px);
  font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--ink-faint);
}
.tl-gridline { position: absolute; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.tl-trackrow { position: relative; height: 40px; }
.tl-bar {
  position: absolute; top: 7px; height: 26px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: block; overflow: hidden; text-decoration: none;
}
.tl-bar[data-status="active"] { border-color: var(--accent); }
.tl-bar[data-status="done"] { border-color: var(--good); }
.tl-bar:hover { filter: brightness(1.05); }
.tl-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: .45; }
.tl-bar[data-status="done"] .tl-fill { background: var(--good); }
.tl-pct {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--ink-soft);
}
.tl-today { position: absolute; top: 14px; bottom: 0; width: 2px; background: var(--warn); z-index: 2; }
.tl-today i {
  position: absolute; top: -13px; left: 4px; font-style: normal;
  font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--warn);
  background: var(--surface); padding: 0 3px; border-radius: 3px;
}
.tl-ms {
  position: absolute; top: 4px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: "IBM Plex Mono", monospace; font-size: 9px; color: var(--ink-faint);
}
.tl-ms i {
  width: 9px; height: 9px; box-sizing: border-box;
  transform: rotate(45deg); transform-origin: center center;
  background: var(--paper); border: 1.5px solid var(--accent);
}
.tl-ms[data-fill="1"] i { background: var(--accent); }

/* ---------- people ---------- */
.avatar {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "IBM Plex Mono", monospace; font-size: 8.5px; font-weight: 600;
  letter-spacing: .02em; border: 1px solid; cursor: default;
}
.avatar[data-p="0"] { color: var(--pc0); background: var(--pw0); border-color: var(--pc0); }
.avatar[data-p="1"] { color: var(--pc1); background: var(--pw1); border-color: var(--pc1); }
.avatar[data-p="2"] { color: var(--pc2); background: var(--pw2); border-color: var(--pc2); }
.avatar[data-p="3"] { color: var(--pc3); background: var(--pw3); border-color: var(--pc3); }
.avatar[data-p="4"] { color: var(--pc4); background: var(--pw4); border-color: var(--pc4); }
.avatar[data-p="5"] { color: var(--pc5); background: var(--pw5); border-color: var(--pc5); }

/* ---------- scene coverage (masterplan) ---------- */
.coverage { display: flex; flex-direction: column; gap: 4px; }
.cov-row {
  display: grid; grid-template-columns: 34px minmax(160px, 240px) 1fr 46px;
  gap: 12px; align-items: center; text-decoration: none; color: inherit;
  padding: 6px 10px; border-radius: 8px;
}
.cov-row:hover { background: var(--surface); }
.cov-id { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent-ink); }
.cov-name { font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cov-bar .progress-track { display: block; margin: 0; }
.cov-bar .progress-fill { display: block; }
.cov-count { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- backlog ---------- */
.type-group { margin-bottom: 26px; }
.type-head { display: flex; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.type-head h3 { font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
.type-head .wk-progress { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-faint); }
.sprint-tag {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .06em;
  color: var(--accent-ink); background: var(--accent-wash); border-radius: 4px;
  padding: 1px 6px; margin-left: auto; white-space: nowrap; text-transform: uppercase;
}

/* ---------- structured add-task form ---------- */
.task-form {
  display: flex; flex-direction: column; gap: 14px; margin: 0 0 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; box-shadow: var(--shadow);
}
.task-form .title-input {
  width: 100%; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px;
  font: inherit; font-size: 15px;
}
.task-form .title-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.field {
  display: flex; flex-direction: column; gap: 5px;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.field select {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; height: 38px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; min-width: 165px; max-width: 230px;
}
.field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-spacer { flex: 1 1 auto; }
.form-actions {
  display: flex; align-items: center; gap: 12px; margin-left: auto;
  flex: 0 0 auto; white-space: nowrap;
}
.form-actions .note-ind { height: 30px; }
.form-row .btn-secondary, .form-row .btn-primary {
  height: 38px; padding: 0 16px; font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 8px; cursor: pointer;
}
.form-row .btn-secondary { background: var(--surface); color: var(--accent-ink); border: 1px solid var(--accent); }
.form-row .btn-secondary:hover { background: var(--accent-wash); }
.form-row .btn-primary { background: var(--accent); color: var(--paper); border: 0; }
.form-row .btn-primary:hover { background: var(--accent-ink); }
.form-row button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- forms ---------- */
.add-task { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 26px; }
.add-task input[type="text"], .add-task select, .add-task button, .add-task .file-label { min-height: 38px; }
.add-task input[type="text"] {
  flex: 1 1 240px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  font: inherit; font-size: 14px;
}
.add-task select {
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-family: "IBM Plex Mono", monospace; font-size: 12px;
  max-width: 200px;
}
.add-task button {
  background: var(--accent); color: var(--paper); border: 0; border-radius: 8px;
  padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.add-task button:hover { background: var(--accent-ink); }
.add-task button.btn-secondary { background: var(--surface); color: var(--accent-ink); border: 1px solid var(--accent); font-weight: 600; }
.add-task button.btn-secondary:hover { background: var(--accent-wash); }
.add-task input:focus-visible, .add-task select:focus-visible, .add-task button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* ---------- task controls ---------- */
button.box { padding: 0; cursor: pointer; background: transparent; }
.task .box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subs details.menu > summary { padding: 0 5px; font-size: 12px; color: var(--ink-faint); }

.task .t-label { flex: 1; }
.task-wrap { position: relative; }
.task-wrap > details.menu { position: absolute; top: 2px; right: 0; }
.task-wrap > .task, .task-wrap > details.task-group > summary { padding-right: 30px; }
details.menu { position: relative; margin-left: 4px; flex: 0 0 auto; }
details.menu > summary {
  list-style: none; cursor: pointer; color: var(--ink-faint); border-radius: 6px;
  padding: 0 6px; font-size: 15px; line-height: 1.3; user-select: none;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { color: var(--ink); background: var(--surface-2); }
details.menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 45; min-width: 190px;
  width: max-content; max-width: 280px;
  max-height: calc(100vh - 24px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.menu-pop button, .menu-pop select {
  font: inherit; font-size: 13px; text-align: left; background: transparent;
  color: var(--ink-soft); border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer;
}
.menu-pop select { border: 1px solid var(--line); background: var(--surface); font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.menu-pop button:hover { background: var(--surface-2); color: var(--ink); }
.menu-pop button.danger:hover { background: var(--bad-wash); color: var(--bad); }

/* clickable chips (matrix cells, milestones) */
[data-cell], [data-ms] { cursor: pointer; }
[data-cell]:hover, [data-ms]:hover { filter: brightness(1.08); }
[data-cell]:focus-visible, [data-ms]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- assigned tab ---------- */
.asg-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 24px;
}
.asg-label {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.asg-controls select {
  background-color: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; height: 36px; box-sizing: border-box;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  max-width: 260px;
}
.asg-controls select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.asg-group { margin-bottom: 26px; }
.asg-group .type-head { align-items: center; }
.asg-group .type-head h3 { text-transform: none; letter-spacing: 0; font-family: "Archivo", sans-serif; font-size: 14px; font-weight: 600; color: var(--ink); }
.asg-empty { color: var(--ink-faint); font-size: 13.5px; margin: 6px 0 0; }

/* ---------- notes ---------- */
.note-ico {
  flex: 0 0 auto; background: transparent; border: 0; cursor: pointer;
  color: var(--accent-ink); font-size: 13px; line-height: 1; padding: 2px 5px;
  border-radius: 5px;
}
.note-ico:hover { background: var(--accent-wash); }
.note-ico:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.modal-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-back[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 24px 26px; width: min(760px, 100%);
  max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { margin: 0; font-family: "Spectral", Georgia, serif; font-size: 18px; font-weight: 600; }
.modal textarea {
  width: 100%; resize: vertical; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 14px;
}
.modal textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-text { margin: 0; color: var(--ink-soft); font-size: 14px; white-space: pre-wrap; }
.note-img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-actions button {
  font: inherit; font-size: 13.5px; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.modal-actions button:hover { color: var(--ink); }
.modal-actions .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--paper); font-weight: 600; }
.modal-actions .btn-primary:hover { background: var(--accent-ink); color: var(--paper); }
.modal-actions .danger-btn:hover { background: var(--bad-wash); color: var(--bad); border-color: var(--bad); }
.modal-actions .danger-btn.solid { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.modal-actions .danger-btn.solid:hover { filter: brightness(1.1); color: #fff; }
.modal-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- add-task note row + file inputs ---------- */
.add-note-row { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.add-note-row textarea {
  flex: 1 1 300px; resize: vertical; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13.5px;
}
.add-note-row textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.file-label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-soft);
  background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px;
  align-self: flex-start;
}
.file-label:hover { border-color: var(--accent); color: var(--accent-ink); }
.file-label input[type="file"] { max-width: 180px; font-size: 11px; color: var(--ink-faint); }

/* ---------- sprints head + add-sprint form ---------- */
.sprints-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.sprints-head .section-note { margin-bottom: 0; }
.sprints-head .btn-secondary { margin-top: 4px; }
.btn-secondary {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 8px; padding: 0 14px; height: 36px; box-sizing: border-box;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--accent-wash); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sprint-form { margin-bottom: 22px; align-items: flex-end; }
.sprint-form .grow { flex: 2 1 320px; }
.date-label {
  display: flex; flex-direction: column; gap: 3px;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint);
}
.date-label input[type="date"] {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-family: "IBM Plex Mono", monospace; font-size: 12px;
}
.date-label input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- sprint filter + milestone flag ---------- */
.sprints-controls { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; flex-wrap: wrap; max-width: 100%; }
.sprints-controls select {
  background-color: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; height: 36px; box-sizing: border-box;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; max-width: 220px;
}
.sprints-controls select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ms-badge {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-wash);
  border: 1px solid var(--accent); border-radius: 999px; padding: 2px 10px;
  display: inline-flex; align-items: center; gap: 7px;
}
.ms-badge::before { content: "◇"; font-size: 15px; line-height: 1; }
.ms-badge.filled::before { content: "◆"; }

/* ---------- sprint kanban ---------- */
.kanban-scroll { overflow-x: auto; padding: 14px 18px 18px; }
.kb-empty { padding: 0 18px 16px; }
.kanban {
  display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px; min-width: 780px; align-items: start;
}
.kb-col-head {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 2px 8px 7px; border-bottom: 2px solid var(--line);
}
.kb-col-head[data-st="planned"] { color: var(--hold); border-color: var(--hold); }
.kb-col-head[data-st="progress"] { color: var(--warn); border-color: var(--warn); }
.kb-col-head[data-st="review"] { color: var(--rev); border-color: var(--rev); }
.kb-col-head[data-st="done"] { color: var(--good); border-color: var(--good); }
.kb-cell {
  display: flex; flex-direction: column; gap: 7px;
  min-height: 72px; padding: 7px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.kb-cell:empty { background: transparent; border-style: dashed; }
.kb-cell.drag-over { border-color: var(--accent); background: var(--accent-wash); border-style: solid; }
.kb-card {
  background: var(--paper); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 8px; padding: 8px 10px; cursor: grab; user-select: none;
}
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: .45; }
.kb-card[data-s="planned"] { border-left-color: var(--hold); }
.kb-card[data-s="progress"] { border-left-color: var(--warn); background: var(--warn-wash); }
.kb-card[data-s="review"] { border-left-color: var(--rev); background: var(--rev-wash); }
.kb-card[data-s="done"] { border-left-color: var(--good); background: var(--good-wash); }
.kb-card[data-s="blocked"] { border-left-color: var(--bad); background: var(--bad-wash); }
.kb-title { font-size: 12.5px; line-height: 1.35; color: var(--ink); }
.kb-card[data-s="done"] .kb-title { text-decoration: line-through; text-decoration-color: var(--ink-faint); color: var(--ink-soft); }
.task.kb-meta { padding: 0; margin-top: 7px; gap: 6px; font-size: 11px; align-items: center; }
.kb-subs { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.task.kb-sub { padding: 0; gap: 6px; font-size: 11px; align-items: center; }
.kb-sub .box { margin-top: 0; width: 11px; height: 11px; border-radius: 3px; }
.kb-sub-t { flex: 1 1 auto; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.kb-sub[data-s="done"] .kb-sub-t { text-decoration: line-through; text-decoration-color: var(--line); color: var(--ink-faint); }
.kb-gap { flex: 1 1 auto; }
.kb-meta .avatar { width: 18px; height: 18px; font-size: 8px; }
.kb-type {
  font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint);
}
.kb-ch {
  font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: .06em;
  color: var(--accent-ink); background: var(--accent-wash); border-radius: 4px; padding: 1px 5px;
}
.dep-chip {
  font-family: "IBM Plex Mono", monospace; font-size: 9.5px; letter-spacing: .04em;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap; flex: 0 0 auto;
}
.dep-chip.waiting { color: var(--warn); background: var(--warn-wash); }
.dep-chip.ready { color: var(--good); background: var(--good-wash); }
.dep-chip.blocks { color: var(--accent-ink); background: var(--accent-wash); }
.kb-dep {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; line-height: 1.4;
  margin-top: 5px; cursor: pointer; border-radius: 5px; padding: 2px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-dep.waiting { color: var(--warn); background: var(--warn-wash); }
.kb-dep.ready { color: var(--good); background: var(--good-wash); }
.kb-dep:hover { filter: brightness(1.1); text-decoration: underline; }
.drag-ph {
  height: 0; border: 1.5px dashed var(--accent); background: var(--accent-wash);
  border-radius: 8px; box-sizing: border-box; transition: height .16s ease;
  flex: 0 0 auto;
}
@media (prefers-reduced-motion: reduce) { .drag-ph { transition: none; } }

/* ---------- sprint view toggle + list view ---------- */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.view-toggle button {
  width: 28px; height: 22px; border: 0; background: var(--surface); color: var(--ink-faint);
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
}
.view-toggle button + button { border-left: 1px solid var(--line); }
.view-toggle button.on { background: var(--accent-wash); color: var(--accent-ink); }
.view-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.klist { display: flex; flex-direction: column; gap: 7px; padding: 14px 18px 18px 46px; position: relative; }
.klist-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.kl-link { fill: none; stroke: var(--line); stroke-width: 1.5; }
.kl-link.done { stroke: var(--good); opacity: .55; }
.kl-link.hot { stroke: var(--warn); stroke-width: 2; }
.kl-link-hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.link-x { cursor: pointer; pointer-events: none; opacity: 0; transition: opacity .12s ease; }
.link-x.show { opacity: 1; pointer-events: all; }
/* X states, single-layered: ring follows the connection (gray idle, amber
   when hot); the glyph is ink-white, red only while hovering the X itself. */
.link-x circle { fill: var(--surface); stroke: var(--line); stroke-width: 1.8; }
.link-x.hot circle { stroke: var(--warn); }
.link-x path { stroke: var(--ink); stroke-width: 1.7; fill: none; }
.link-x:hover path { stroke: var(--bad); }
#link-overlay .link-x { opacity: 1; pointer-events: all; }
@media (prefers-reduced-motion: reduce) { .link-x { transition: none; } }
/* port states */
.link-port.p-block { color: var(--bad); background: var(--bad-wash); }
.link-port.p-wait { color: var(--warn); background: var(--warn-wash); }
.link-port.p-ready { color: var(--good); background: var(--good-wash); }
.kl-item {
  background: var(--paper); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 8px; cursor: grab; user-select: none;
}
.kl-item:active { cursor: grabbing; }
.kl-item.dragging { opacity: .45; }
.kl-item[data-s="planned"] { border-left-color: var(--hold); }
.kl-item[data-s="progress"] { border-left-color: var(--warn); }
.kl-item[data-s="review"] { border-left-color: var(--rev); }
.kl-item[data-s="done"] { border-left-color: var(--good); }
.kl-item[data-s="blocked"] { border-left-color: var(--bad); background: var(--bad-wash); }
.kl-item[data-s="done"] .kl-title { text-decoration: line-through; text-decoration-color: var(--ink-faint); color: var(--ink-soft); }
.kl-item.dep-hi { outline: 2px solid var(--accent); outline-offset: 1px; }
.kl-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px; font-size: 13.5px; }
.kl-subs {
  display: flex; flex-direction: column; gap: 3px;
  padding: 0 12px 8px 38px; border-top: 1px dashed var(--line);
  margin: 0 0 0 0; padding-top: 7px;
}
.task.kl-sub { padding: 0; gap: 8px; font-size: 12.5px; align-items: center; }
.kl-sub-t { flex: 1 1 auto; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.kl-sub[data-s="done"] .kl-sub-t { text-decoration: line-through; text-decoration-color: var(--line); color: var(--ink-faint); }
.kl-sub .box { margin-top: 0; }
.kl-sub details.menu > summary { padding: 0 5px; font-size: 12px; color: var(--ink-faint); }
.kl-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
button.st-chip { border: 0; cursor: pointer; font-family: "IBM Plex Mono", monospace; }
button.st-chip:hover { filter: brightness(1.08); }
button.st-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-card.dep-hi { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-card.dep-flash { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 0 5px var(--accent-wash); transition: box-shadow .3s ease; }
@media (prefers-reduced-motion: reduce) { .kb-dep:hover { filter: none; } }

/* ---------- ghost buttons & card actions ---------- */
.btn-ghost {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .04em;
  background: transparent; color: var(--ink-faint); border: 1px solid transparent;
  border-radius: 6px; padding: 3px 8px; cursor: pointer;
}
.btn-ghost:hover { color: var(--accent-ink); background: var(--accent-wash); }
.btn-ghost.danger:hover { color: var(--bad); background: var(--bad-wash); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-actions { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; }
/* Always-visible row menus (⋯) — no hover-only actions anywhere. */
details.row-menu { display: inline-block; vertical-align: middle; margin-left: 8px; flex: 0 0 auto; }
details.row-menu > summary {
  width: 26px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--ink-faint); font-size: 14px; line-height: 1; padding: 0;
}
details.row-menu > summary:hover { color: var(--ink); border-color: var(--ink-faint); background: var(--surface-2); }
.kb-meta details.menu > summary { padding: 0 4px; font-size: 13px; }

.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.block-head h2 { margin: 0; }
.rule { position: relative; }
.rule .card-actions { position: absolute; top: 12px; right: 12px; margin: 0; }
button.rule.add-rule {
  font: inherit; cursor: pointer; color: var(--accent-ink); text-align: center;
  border-style: dashed; background: transparent; font-size: 14px; font-weight: 600;
}
button.rule.add-rule:hover { background: var(--accent-wash); }
.stat .v.editable { cursor: pointer; text-decoration: underline dotted var(--ink-faint); text-underline-offset: 3px; }

/* ---------- note draft indicator ---------- */
.note-ind {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent-ink);
  background: var(--accent-wash); border-radius: 999px; padding: 4px 10px;
}
.note-ind button {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px;
}

/* ---------- note view: picture left, text right + gallery ---------- */
.note-view { display: flex; flex-direction: column; gap: 14px; }
.note-view.with-img { flex-direction: row; align-items: flex-start; }
.note-view .gallery { flex: 0 1 55%; min-width: 0; }
.note-view .note-text { flex: 1 1 45%; min-width: 0; }
.gallery img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.dots { display: flex; justify-content: center; gap: 7px; margin-top: 9px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--line);
}
.dot.on { background: var(--accent); }
.dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; }
.thumb img { width: 132px; height: 132px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb.is-new img { border-color: var(--accent); }
.modal.dragover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash), var(--shadow); }
.thumb button {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 11px; line-height: 1; cursor: pointer;
}
.thumb button:hover { color: var(--bad); border-color: var(--bad); }
.modal-input {
  width: 100%; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 14px;
}
.modal-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 560px) { .note-view.with-img { flex-direction: column; } }

/* ---------- assets ---------- */
.acard { display: block; }
.a-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acard .r-body { margin-top: 6px; }
.a-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 6px 4px 12px;
}
.file-chip a { color: var(--accent-ink); text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip a:hover { text-decoration: underline; }
.file-chip button {
  background: transparent; border: 0; color: var(--ink-faint); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 4px; border-radius: 50%;
}
.file-chip button:hover { color: var(--bad); }
.file-add { position: relative; overflow: hidden; cursor: pointer; }
.file-add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.acard .card-actions { opacity: 1; }

/* ---------- team ---------- */
.person-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 18px; box-shadow: var(--shadow); margin-bottom: 10px;
}
.person-row .avatar { width: 28px; height: 28px; font-size: 10px; }
.p-role { font-weight: 600; min-width: 180px; }
.p-name { color: var(--ink-soft); }
.p-name em { color: var(--ink-faint); font-style: italic; }
.p-count { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); }
.add-task .short { max-width: 110px; flex: 0 1 auto; }
.code-field {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 14px; font-weight: 600; color: var(--accent-ink);
}
.code-field input {
  width: 72px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; height: 38px;
  font-family: "IBM Plex Mono", monospace; font-size: 13px;
}
.code-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Safari renders selects at its own height unless appearance is reset. */
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888e96' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px !important; /* later component rules set shorthand padding */
}

/* ---------- accent presets (per project; class on body or card) ---------- */
.accent-red { --accent: #FF0200; --accent-ink: #C40200; --accent-wash: #FFE5E4; }
.accent-cobalt { --accent: #2E5BD7; --accent-ink: #2347AB; --accent-wash: #E4EAFA; }
.accent-violet { --accent: #7A4BB8; --accent-ink: #613C93; --accent-wash: #EDE5F7; }
.accent-amber { --accent: #B07C10; --accent-ink: #8A600C; --accent-wash: #F5EAD1; }
.accent-magenta { --accent: #B03A72; --accent-ink: #8C2E5B; --accent-wash: #F7E1EB; }
.accent-green { --accent: #016734; --accent-ink: #015229; --accent-wash: #E1F0E8; }
.accent-yellow { --accent: #EFC900; --accent-ink: #8F7500; --accent-wash: #FBF3D0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .accent-red { --accent: #FF0200; --accent-ink: #FF7A73; --accent-wash: #3C0E0C; }
  :root:not([data-theme="light"]) .accent-cobalt { --accent: #7FA0FF; --accent-ink: #A3BAFF; --accent-wash: #17213D; }
  :root:not([data-theme="light"]) .accent-violet { --accent: #B48AE8; --accent-ink: #C9A9F0; --accent-wash: #261B33; }
  :root:not([data-theme="light"]) .accent-amber { --accent: #E5B84B; --accent-ink: #EFCB74; --accent-wash: #2E2510; }
  :root:not([data-theme="light"]) .accent-magenta { --accent: #E87FB0; --accent-ink: #F0A3C5; --accent-wash: #331B27; }
  :root:not([data-theme="light"]) .accent-green { --accent: #2FA96B; --accent-ink: #6FD09A; --accent-wash: #0E2A1C; }
  :root:not([data-theme="light"]) .accent-yellow { --accent: #FFD500; --accent-ink: #FFE566; --accent-wash: #332B08; }
}
:root[data-theme="dark"] .accent-red { --accent: #FF0200; --accent-ink: #FF7A73; --accent-wash: #3C0E0C; }
:root[data-theme="dark"] .accent-cobalt { --accent: #7FA0FF; --accent-ink: #A3BAFF; --accent-wash: #17213D; }
:root[data-theme="dark"] .accent-violet { --accent: #B48AE8; --accent-ink: #C9A9F0; --accent-wash: #261B33; }
:root[data-theme="dark"] .accent-amber { --accent: #E5B84B; --accent-ink: #EFCB74; --accent-wash: #2E2510; }
:root[data-theme="dark"] .accent-magenta { --accent: #E87FB0; --accent-ink: #F0A3C5; --accent-wash: #331B27; }
:root[data-theme="dark"] .accent-green { --accent: #2FA96B; --accent-ink: #6FD09A; --accent-wash: #0E2A1C; }
:root[data-theme="dark"] .accent-yellow { --accent: #FFD500; --accent-ink: #FFE566; --accent-wash: #332B08; }

/* ---------- theme toggle ---------- */
.theme-toggle {
  position: fixed; top: 14px; right: 16px; z-index: 60;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 14px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header controls ---------- */
.header-body { flex: 1 1 auto; min-width: 0; }
.top-controls {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin-top: 10px;
}
.top-controls .home-btn {
  text-decoration: none; border: 1px solid var(--line); padding: 0 12px;
  font-size: 12px; white-space: nowrap;
  height: 36px; display: inline-flex; align-items: center; box-sizing: border-box;
}
.top-controls select {
  background-color: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; font-family: "IBM Plex Mono", monospace; font-size: 12px;
  max-width: 220px; height: 36px; box-sizing: border-box;
}
.logo-lilly { flex: 0 0 auto; width: 116px; height: auto; margin-top: 10px; color: var(--accent); }
.logo-trenord { flex: 0 0 auto; width: 84px; height: auto; margin-top: 8px; color: var(--accent); }
.logo-plenitude { flex: 0 0 auto; width: 108px; height: auto; margin-top: 2px; color: var(--accent); }
/* The Ultra mark sits in a square card-style tile; the raster is white,
   so the image (not the tile) inverts on light backgrounds. */
.logo-ultra {
  flex: 0 0 auto; width: 104px; height: 104px; padding: 20px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.logo-ultra image { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-ultra image { filter: none; }
}
:root[data-theme="dark"] .logo-ultra image { filter: none; }
.top-controls select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- company home ---------- */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px; margin-top: 12px;
}
.proj-card {
  display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; box-shadow: var(--shadow); border-top: 3px solid var(--accent);
  transition: transform .12s ease, border-color .12s ease;
}
.proj-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.proj-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pc-company {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-ink);
}
.pc-title { font-family: "Spectral", Georgia, serif; font-size: 24px; font-weight: 500; margin: 0; line-height: 1.15; }
.pc-big { font-family: "Spectral", Georgia, serif; font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pc-big small { font-size: 13px; font-family: "Archivo", sans-serif; color: var(--ink-soft); font-weight: 400; }
.proj-card .progress-track { margin-top: 0; }
.pc-sprints { display: flex; gap: 4px; }
.pc-sp { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--surface-2); }
.pc-sp.active { outline: 1px solid var(--accent); outline-offset: 1px; }
.pc-nosprint { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); }
.pc-stats {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft);
}
.pc-phase { color: var(--ink-faint); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.pc-loading { color: var(--ink-faint); font-family: "IBM Plex Mono", monospace; font-size: 12px; }

footer { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: 8px 24px; }

@media (max-width: 640px) {
  header { flex-direction: column; gap: 12px; }
  .spiro { width: 64px; height: 64px; }
  .beat .b-role { min-width: 0; }
  .beat .b-week { margin-left: 0; }
}
@media (max-width: 700px) {
  .kl-row { flex-wrap: wrap; row-gap: 6px; }
  .kl-title { flex-basis: 55%; }
}
@media (prefers-reduced-motion: reduce) {
  .spiro-rotor { animation: none !important; }
  .progress-fill { transition: none; }
  details.task-group > summary .caret { transition: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.spiro-rotor { animation: spin 90s linear infinite; transform-origin: 50% 50%; }

/* ---------- dependency link ports, overlay, curves ---------- */
#link-overlay {
  position: fixed; inset: 0; z-index: 58; pointer-events: none;
  width: 100vw; height: 100vh;
}
.link-line { fill: none; stroke-width: 2; }
.link-line.drafting { stroke: var(--accent); stroke-dasharray: 6 5; }
.link-line.waiting { stroke: var(--warn); }
.link-line.ready { stroke: var(--good); }
.link-line.link-hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.link-line.link-hit:hover + *, #link-overlay:has(.link-hit:hover) .waiting, #link-overlay:has(.link-hit:hover) .ready { stroke-width: 3; }
#link-hint {
  position: fixed; z-index: 59; pointer-events: none;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-ink); background: var(--accent-wash);
  border: 1px solid var(--accent); border-radius: 999px; padding: 2px 9px;
}
.link-port {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 18px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--ink-faint); cursor: crosshair;
  touch-action: none;
}
.link-port:hover { color: var(--accent-ink); background: var(--accent-wash); }
.link-port:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.linking, body.linking * { cursor: crosshair !important; }
[data-kb].link-target { outline: 2px dashed var(--accent); outline-offset: 1px; }
[data-kb].link-invalid { outline: 2px dashed var(--bad); outline-offset: 1px; }

/* ---------- subtask disclosure + ghosted (related-only) tasks ---------- */
.twist {
  flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle; margin-right: 2px; border-radius: 7px;
}
.twist svg { display: block; transition: transform .14s ease; }
.twist.open svg { transform: rotate(90deg); }
.twist:hover { background: var(--surface-2); color: var(--accent-ink); }
.twist:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .twist svg { transition: none; } }
.kb-card .twist { margin-right: 2px; }
.ghost {
  filter: grayscale(1); opacity: .42; pointer-events: none;
}

/* backlog chapter-order drag */
.bk-grip { color: var(--ink-faint); font-size: 11px; letter-spacing: -2px; flex: 0 0 auto; cursor: grab; }
[data-bkb] { cursor: grab; }
[data-bkb]:active { cursor: grabbing; }
[data-bkb].dragging { opacity: .45; }
.bk-list { display: flex; flex-direction: column; }

.proj-tools { margin-top: 8px; }
.proj-tools details.menu { display: inline-block; margin-left: -6px; }
.proj-tools summary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 24px; border-radius: 6px;
  font-size: 16px; letter-spacing: 1px;
}
.modal .field { width: 100%; }
.modal .field .modal-input, .modal .field select { width: 100%; margin-top: 4px; }
.modal .form-row { width: 100%; }
.modal .form-row .field { flex: 1 1 180px; }
