/* Siemens Energy identity: purple #641E8C, deep purple #1B1534, violet accent #8A00E5. */
:root {
  --bg: #f7f5fa;
  --surface: #ffffff;
  --surface-2: #f1edf6;
  --border: #e5e0ec;
  --border-strong: #d1c8de;
  --text: #1b1534;
  --muted: #5f5873;
  --accent: #641e8c;
  --accent-hover: #4e1570;
  --accent-soft: #f1e8f8;
  --violet: #8a00e5;
  --on-accent: #ffffff;
  --track: #ece8f2;
  --danger: #d12d3f;
  --green: #1e8c5a;
  --yellow: #b87400;
  --red: #d12d3f;
  /* Workstream status */
  --st-done: #1e8c5a; --st-done-fg: #ffffff;
  --st-in_progress: #8a00e5; --st-in_progress-fg: #ffffff;
  --st-review: #d98c00; --st-review-fg: #1b1534;
  --st-blocked: #d12d3f; --st-blocked-fg: #ffffff;
  --st-not_started: #d6d0e0; --st-not_started-fg: #5f5873;
  /* Severity: text colour / background */
  --sev-critical: #8e1d2c; --sev-critical-bg: #f6d9dd;
  --sev-high: #d12d3f; --sev-high-bg: #fbe6e8;
  --sev-medium: #9a6200; --sev-medium-bg: #fdf1dc;
  --sev-low: #1e8c5a; --sev-low-bg: #e4f4ec;
  --sev-info: #5f5873; --sev-info-bg: #ece8f2;
  --hm-critical: #8e1d2c; --hm-high: #d12d3f; --hm-medium: #f0b43c; --hm-low: #9fd4b8;
  --shadow: 0 1px 2px rgba(27, 21, 52, .06), 0 4px 16px rgba(27, 21, 52, .06);
  --radius: 14px;
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120e22;
    --surface: #1b1534;
    --surface-2: #241c42;
    --border: #332a52;
    --border-strong: #463b6a;
    --text: #eeeaf5;
    --muted: #a9a1bf;
    --accent: #b67cff;
    --accent-hover: #c99bff;
    --accent-soft: #2e2150;
    --violet: #b67cff;
    --on-accent: #1b1534;
    --track: #2c2448;
    --danger: #ff6b7a;
    --green: #3ec486;
    --yellow: #f0b43c;
    --red: #ff6b7a;
    --st-done: #2fa873; --st-done-fg: #0d1a14;
    --st-in_progress: #a45cf0; --st-in_progress-fg: #ffffff;
    --st-review: #e0a030; --st-review-fg: #1b1534;
    --st-blocked: #e85a6a; --st-blocked-fg: #1b1534;
    --st-not_started: #3a3158; --st-not_started-fg: #c9c1dc;
    --sev-critical: #ff8f9c; --sev-critical-bg: #4a1a26;
    --sev-high: #ff6b7a; --sev-high-bg: #3d1a26;
    --sev-medium: #f0b43c; --sev-medium-bg: #3a2c12;
    --sev-low: #3ec486; --sev-low-bg: #143426;
    --sev-info: #a9a1bf; --sev-info-bg: #2c2448;
    --hm-critical: #c43246; --hm-high: #e85a6a; --hm-medium: #d9a030; --hm-low: #2f8f63;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 "Siemens Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 24px; letter-spacing: -.015em; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 16px; }
h3 { margin: 4px 0 8px; font-size: 14px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.good { color: var(--green); }
.bad { color: var(--red); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner { max-width: 1480px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { color: var(--text); font-size: 18px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 11.5px; }
.nav { display: flex; gap: 2px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin: 0 auto; overflow-x: auto; }
.nav a { padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav a.nav-report.active { color: var(--accent); }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.backup-note { border: 0; background: color-mix(in srgb, var(--yellow) 16%, transparent); color: var(--yellow); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; cursor: pointer; }
.icon-btn.menu-btn { display: none; }

@media (max-width: 980px) {
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .brand { margin-right: auto; }
  .nav { order: 3; width: 100%; display: none; flex-direction: column; margin: 0; }
  body.nav-open .nav { display: flex; }
  .brand small { display: none; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav a:focus-visible, .cell:focus-visible, .link-btn:focus-visible, .phase-row:focus-visible, .menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger-bg { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger) !important; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 15px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; cursor: pointer; text-align: left; }
.link-btn:hover, .link:hover { text-decoration: underline; }
.link { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---------- Layout ---------- */
.layout { max-width: 1480px; margin: 0 auto; padding: 22px var(--gutter) 64px; display: flex; flex-direction: column; gap: 18px; min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 80ch; }
.page-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card.pad, .pad { padding: 18px; }
.pad-x { padding: 0 18px 14px; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title-row h2 { margin: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row-actions.center { justify-content: center; }
.back { font-size: 13px; font-weight: 600; text-decoration: none; }
.spacer { flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { color: var(--border-strong); }
.empty p { margin: 6px auto; max-width: 52ch; }
.empty strong { color: var(--text); font-size: 15px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.kpi b { font-size: 28px; line-height: 1.05; letter-spacing: -.02em; }
.kpi span { font-size: 13px; font-weight: 600; margin-top: 4px; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.warn { border-left-color: var(--yellow); }
.kpi.bad { border-left-color: var(--red); }
.kpi.good { border-left-color: var(--green); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

.phase-rows { display: flex; flex-direction: column; gap: 4px; }
.phase-row { display: grid; grid-template-columns: 26px minmax(150px, 1.1fr) minmax(0, 2fr) 48px; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 9px; color: inherit; text-decoration: none; }
.phase-row:hover { background: var(--surface-2); }
.ph-num { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.ph-name { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.ph-name small { display: block; color: var(--muted); font-weight: 400; }
.ph-pct { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .phase-row { grid-template-columns: 26px minmax(0, 1fr) 44px; } .phase-row .stack { grid-column: 2 / -1; grid-row: 2; } }

.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; min-width: 0; }
.stack span { min-width: 3px; }
.empty-stack { background: var(--track); }
.st-bg-done { background: var(--st-done); color: var(--st-done-fg); }
.st-bg-in_progress { background: var(--st-in_progress); color: var(--st-in_progress-fg); }
.st-bg-review { background: var(--st-review); color: var(--st-review-fg); }
.st-bg-blocked { background: var(--st-blocked); color: var(--st-blocked-fg); }
.st-bg-not_started { background: var(--st-not_started); color: var(--st-not_started-fg); }
.st-bg-na { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); background-image: repeating-linear-gradient(135deg, transparent 0 4px, var(--border) 4px 5px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.overall { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.overall b { display: block; font-size: 20px; }
.overall span { color: var(--muted); font-size: 12.5px; }
.site-rows { display: flex; flex-direction: column; gap: 10px; }
.site-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 1.2fr) 42px; gap: 10px; align-items: center; font-size: 13.5px; font-weight: 600; }
.site-row small { display: block; color: var(--muted); font-weight: 400; }
.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; min-width: 40px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.bar-val { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
td.prog .prog-in { display: grid; grid-template-columns: minmax(50px, 1fr) 38px; gap: 6px; align-items: center; min-width: 110px; }
.pc-bar, .stat-list li:has(.bar) { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.stat-list li:has(.bar) { grid-template-columns: minmax(0, 1fr) 90px 40px; }
.ring { flex: none; }

.stat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stat-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.stat-list li:last-child { border-bottom: 0; }
.stat-list b { font-variant-numeric: tabular-nums; }
.sev-counts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 13px; align-items: center; }
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 14px; }
.funnel div { background: var(--surface-2); border-radius: 8px; padding: 8px 4px; text-align: center; }
.funnel div:last-child { background: var(--accent-soft); }
.funnel b { display: block; font-size: 20px; }
.funnel span { font-size: 11px; color: var(--muted); }
.funnel.big b { font-size: 28px; }
.funnel.big span { font-size: 12.5px; }

.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; max-height: 360px; overflow-y: auto; }
.activity time { display: block; color: var(--muted); font-size: 11.5px; }
.activity a { color: var(--text); text-decoration: none; }
.activity a:hover { color: var(--accent); }

/* Heat map */
.heatmap { display: grid; grid-template-columns: 16px 1fr; grid-template-rows: 1fr auto; gap: 4px; max-width: 400px; }
.hm-axis-y { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; color: var(--muted); text-align: center; }
.hm-axis-x { grid-column: 2; font-size: 11px; color: var(--muted); text-align: center; }
.hm-grid { display: grid; grid-template-columns: 78px repeat(4, 1fr); gap: 3px; }
.hm-y, .hm-x { font-size: 10.5px; line-height: 1.15; color: var(--muted); display: grid; place-items: center; text-align: center; }
.hm-y { justify-items: end; text-align: right; padding-right: 4px; }
.hm-cell { aspect-ratio: 1.5; border-radius: 5px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted); cursor: default; }
.hm-cell:not(.has) { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.hm-cell.has.hm-critical { background: var(--hm-critical); color: #fff; }
.hm-cell.has.hm-high { background: var(--hm-high); color: #fff; }
.hm-cell.has.hm-medium { background: var(--hm-medium); color: #1b1534; }
.hm-cell.has.hm-low { background: var(--hm-low); color: #1b1534; }
.hm-cell:not(.has).hm-critical, .hm-cell:not(.has).hm-high { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hm-high) 30%, transparent); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill .sym { font-weight: 800; }
.pill.st-done { background: color-mix(in srgb, var(--st-done) 16%, transparent); color: var(--green); }
.pill.st-in_progress { background: color-mix(in srgb, var(--st-in_progress) 14%, transparent); color: var(--violet); }
.pill.st-review { background: color-mix(in srgb, var(--st-review) 18%, transparent); color: var(--yellow); }
.pill.st-blocked { background: color-mix(in srgb, var(--st-blocked) 14%, transparent); color: var(--red); }
.pill.st-na { background: transparent; border: 1px dashed var(--border-strong); }
.sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical); }
.sev-high { background: var(--sev-high-bg); color: var(--sev-high); }
.sev-medium { background: var(--sev-medium-bg); color: var(--sev-medium); }
.sev-low { background: var(--sev-low-bg); color: var(--sev-low); }
.sev-info { background: var(--sev-info-bg); color: var(--sev-info); }
.pill.sev-critical, .pill.sev-high, .pill.sev-medium, .pill.sev-low { text-transform: capitalize; }
.crit-critical { background: var(--sev-critical-bg); color: var(--sev-critical); }
.crit-high { background: var(--sev-high-bg); color: var(--sev-high); }
.crit-medium { background: var(--sev-medium-bg); color: var(--sev-medium); }
.crit-low { background: var(--sev-low-bg); color: var(--sev-low); }
.tag-lock { background: color-mix(in srgb, var(--yellow) 16%, transparent); color: var(--yellow); }
.tag-mon { background: var(--accent-soft); color: var(--accent); }
.tag-yes { background: var(--sev-low-bg); color: var(--sev-low); }
.tag-no { background: var(--surface-2); color: var(--muted); }
.tag-warn { background: var(--sev-medium-bg); color: var(--sev-medium); }

.note { margin: 8px 0 0; font-size: 13px; padding: 8px 12px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.note.warn { background: color-mix(in srgb, var(--yellow) 12%, transparent); color: var(--text); }
.note.bad { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--text); }
.note.good { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--text); }
.due { white-space: nowrap; }
.due.overdue { color: var(--red); font-weight: 700; }
.due.soon { color: var(--yellow); font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border-strong); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid td small { display: block; color: var(--muted); font-size: 11.5px; }
table.grid tr.click { cursor: pointer; }
table.grid tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.grid .act { width: 40px; text-align: right; }
.card > .table-wrap { border-top: 1px solid var(--border); }
.card > .table-wrap:first-child { border-top: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; }
.filters input[type=search] { flex: 1 1 240px; max-width: 360px; }
select.compact, .filters select { width: auto; padding: 7px 30px 7px 10px; }

/* Equipment matrix */
.matrix-wrap { max-height: calc(100vh - 250px); }
table.matrix td { vertical-align: middle; }
table.matrix th.ph { text-align: center; padding: 6px 4px; font-size: 10.5px; }
table.matrix th.ph span { display: block; font-size: 13px; color: var(--accent); }
table.matrix .chk { width: 34px; }
table.matrix .chk input { width: 16px; height: 16px; accent-color: var(--accent); }
table.matrix td.eq-name a { font-weight: 650; color: var(--text); text-decoration: none; }
table.matrix td.eq-name a:hover { color: var(--accent); text-decoration: underline; }
table.matrix tr.selected td { background: var(--accent-soft); }
td.mcell { padding: 4px 3px; text-align: center; }
th.focus, td.focus { background: color-mix(in srgb, var(--accent-soft) 70%, transparent) !important; }
.cell { width: 34px; height: 30px; border: 0; border-radius: 7px; cursor: pointer; font-weight: 800; font-size: 14px; display: inline-grid; place-items: center; transition: transform .08s; }
.cell:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.cell.locked::after { content: ""; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid > * { grid-column: auto !important; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 2px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; }
.help { color: var(--muted); }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="password"], input[type="url"], input:not([type]), select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 11px; font-size: 14px; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.invalid { border-color: var(--danger) !important; }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.range-row output { width: 42px; font-weight: 700; text-align: right; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 99px; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--surface); }
.segmented span:hover { border-color: var(--accent); }
.segmented input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.segmented input:checked + .seg-done { background: color-mix(in srgb, var(--st-done) 16%, transparent); border-color: var(--st-done); color: var(--green); }
.segmented input:checked + .seg-blocked { background: color-mix(in srgb, var(--st-blocked) 12%, transparent); border-color: var(--st-blocked); color: var(--red); }
.segmented input:checked + .seg-review { background: color-mix(in srgb, var(--st-review) 16%, transparent); border-color: var(--st-review); color: var(--yellow); }
.segmented input:disabled + span { opacity: .5; cursor: not-allowed; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.stack-opts { flex-direction: column; }
.stack-opts span { border-radius: 10px; display: block; padding: 10px 12px; }
.review-box { border: 1px solid var(--border); border-left: 4px solid var(--yellow); border-radius: 10px; padding: 12px 14px; background: color-mix(in srgb, var(--yellow) 5%, var(--surface)); }
.review-box h3 { margin-top: 0; }
.score-preview { margin: 0; font-size: 13px; min-height: 1.4em; }

/* Attachments */
.files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.files li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.files li .link-btn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files small { color: var(--muted); white-space: nowrap; }
.drop { display: flex; flex-direction: column; align-items: center; padding: 14px; border: 2px dashed var(--border-strong); border-radius: 10px; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13.5px; text-align: center; }
.drop small { color: var(--muted); font-weight: 400; }
.drop:hover, .attach.over .drop { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Equipment detail ---------- */
.eq-head .eq-title { display: flex; align-items: center; gap: 16px; }
.eq-head h1 { font-size: 22px; }
.eq-head p { margin: 6px 0 0; display: flex; gap: 6px; flex-wrap: wrap; }
.meta-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 16px 0 0; }
.meta-list dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.meta-list dd { margin: 0; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.phase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.phase-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--st-not_started); }
.st-edge-done { border-top-color: var(--st-done); }
.st-edge-in_progress { border-top-color: var(--st-in_progress); }
.st-edge-review { border-top-color: var(--st-review); }
.st-edge-blocked { border-top-color: var(--st-blocked); }
.st-edge-na { border-top-style: dashed; border-top-color: var(--border-strong); opacity: .75; }
.phase-card header { display: flex; gap: 10px; align-items: flex-start; }
.phase-card h3 { margin: 0; font-size: 14.5px; }
.phase-card header small { color: var(--muted); }
.pc-status { display: flex; gap: 6px; flex-wrap: wrap; }
.facts-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.facts-list li { display: flex; justify-content: space-between; gap: 10px; }
.facts-list span { color: var(--muted); }
.facts-list b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.pc-notes { margin: 0; font-size: 12.5px; color: var(--muted); white-space: pre-wrap; border-left: 2px solid var(--border-strong); padding-left: 8px; }
.phase-card footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.files-count { font-size: 12.5px; color: var(--muted); }
.cia { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 5px; margin: 0 3px 3px 0; border-radius: 5px; background: var(--surface-2); color: var(--muted); }

.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.queue li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--st-review); border-radius: 9px; }
.queue small { display: block; color: var(--muted); }

/* ---------- Pentest ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pt-card { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s; }
.pt-card:hover { border-color: var(--accent); }
.pt-card h2 { margin: 0; }
.pt-card p { margin: 0; }
.mini-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11.5px; color: var(--muted); }
.mini-stats li { background: var(--surface-2); border-radius: 8px; padding: 6px; text-align: center; }
.mini-stats b { display: block; font-size: 18px; color: var(--text); }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.subtabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.subtabs small { background: var(--surface-2); border-radius: 99px; padding: 0 7px; margin-left: 4px; }
.add-row { margin-top: 10px; border: 2px dashed var(--border-strong); background: transparent; border-radius: 10px; padding: 10px; width: 100%; font-weight: 650; color: var(--accent); cursor: pointer; }
.add-row:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Sensors */
.steps-dots { display: flex; gap: 3px; }
.steps-dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--track); }
.steps-dots i.on { background: var(--accent); }
.cover-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; max-height: 280px; overflow-y: auto; }
.cover-list fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.cover-list legend { font-weight: 700; padding: 0 4px; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 12, 20, .5); backdrop-filter: blur(2px); }
.modal-inner { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-sub { margin: -10px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-body > h3 { margin: 6px 0 -4px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.modal-body p { margin: 0; }
.modal-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); position: sticky; bottom: -20px; background: var(--surface); padding-bottom: 4px; }
.privacy { margin: 0; font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .menu-grid { grid-template-columns: 1fr; } }
.menu-item { text-align: left; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.menu-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.menu-item span { font-size: 12px; color: var(--muted); }
.menu-item.danger b { color: var(--danger); }
.map-list { display: flex; flex-wrap: wrap; gap: 6px; }
.map-list span { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--sev-low-bg); color: var(--sev-low); }
.map-list span.skip { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

/* ---------- Report ---------- */
.report-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .report-layout { grid-template-columns: minmax(0, 1fr); } }
.report-cfg { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
@media (max-width: 1100px) { .report-cfg { position: static; max-height: none; } }
.sec-help { margin: 0 0 8px; font-size: 12px; }
.snap-box { border-top: 1px solid var(--border); padding-top: 12px; }
.snap-box p { margin: 0 0 8px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.paper { background: #ffffff; color: #1f2937; border: 1px solid var(--border); border-radius: 12px; padding: clamp(14px, 2.5vw, 26px); outline: none; color-scheme: light; overflow-x: auto; }
.paper:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }

/* ---------- Toast & tooltip ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: #1b1534; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; gap: 14px; align-items: center; z-index: 1000; max-width: calc(100vw - 32px); }
.toast button { background: none; border: 0; color: #c99bff; font-weight: 700; cursor: pointer; padding: 0; }
.tip { position: fixed; left: 0; top: 0; z-index: 999; pointer-events: none; background: #1b1534; color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 300px; display: flex; flex-direction: column; }
.tip strong { font-size: 12.5px; }
.tip span { color: #d8cce6; }

/* ---------- Print: only the report ---------- */
@media print {
  body { background: #fff; }
  .topbar, .page-head, .report-cfg, .toolbar, .hint, .toast, .tip { display: none !important; }
  .layout { padding: 0; display: block; }
  .report-layout { display: block; }
  .card.report-out { border: 0; box-shadow: none; padding: 0; }
  .paper { border: 0; padding: 0; overflow: visible; }
  [data-view="dashboard"] { page: dashboard; }
  [data-view="detail"] { page: detail; break-before: page; }
  @page dashboard { size: A4 landscape; margin: 10mm; }
  @page detail { size: A4 portrait; margin: 12mm; }
  tr, td { break-inside: avoid; }
}
