/* ===========================================================================
   CSMS Orchestrator - "engineering operations console" design system
   Hanken Grotesk + IBM Plex Mono · deep pine brand · light/dark
   =========================================================================== */

:root {
  --font-ui: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Light (default tokens) ---- */
:root,
[data-theme="light"] {
  --bg: #f1efe8;
  --canvas: #f4f3ec;
  --surface: #ffffff;
  --surface-2: #faf9f4;
  --surface-3: #f0eee6;
  --border: #e4e1d6;
  --border-strong: #d2cec0;
  --text: #1a1c16;
  --text-2: #696c61;
  --text-3: #9b9d92;
  --brand: #15724e;
  --brand-hover: #0f5d3f;
  --brand-soft: rgba(21, 114, 78, 0.10);
  --brand-line: rgba(21, 114, 78, 0.28);
  --brand-contrast: #ffffff;
  --sev-crit: #c23047;
  --sev-high: #cf7129;
  --sev-med: #b08714;
  --sev-low: #5a7997;
  --sev-crit-bg: rgba(194, 48, 71, 0.10);
  --sev-high-bg: rgba(207, 113, 41, 0.12);
  --sev-med-bg: rgba(176, 135, 20, 0.14);
  --sev-low-bg: rgba(90, 121, 151, 0.12);
  --ok: #15724e;
  --warn: #b08714;
  --err: #c23047;
  --shadow-sm: 0 1px 2px rgba(28, 32, 24, 0.06);
  --shadow: 0 1px 2px rgba(28, 32, 24, 0.05), 0 10px 26px rgba(28, 40, 30, 0.07);
  --shadow-lg: 0 18px 48px rgba(20, 32, 24, 0.16);
  --grid-line: rgba(24, 50, 36, 0.045);
  --scrim: rgba(20, 24, 18, 0.38);
}

/* ---- Dark ---- */
[data-theme="dark"] {
  --bg: #0a0d0c;
  --canvas: #0b0f0d;
  --surface: #141815;
  --surface-2: #11150f;
  --surface-3: #1a1f1b;
  --border: #232a25;
  --border-strong: #323a33;
  --text: #e9ece8;
  --text-2: #8f988f;
  --text-3: #606a62;
  --brand: #38ca8e;
  --brand-hover: #4ad79b;
  --brand-soft: rgba(56, 202, 142, 0.12);
  --brand-line: rgba(56, 202, 142, 0.32);
  --brand-contrast: #04140d;
  --sev-crit: #e25670;
  --sev-high: #e2904a;
  --sev-med: #d8b441;
  --sev-low: #7fa3c4;
  --sev-crit-bg: rgba(226, 86, 112, 0.13);
  --sev-high-bg: rgba(226, 144, 74, 0.13);
  --sev-med-bg: rgba(216, 180, 65, 0.13);
  --sev-low-bg: rgba(127, 163, 196, 0.13);
  --ok: #38ca8e;
  --warn: #d8b441;
  --err: #e25670;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.55);
  --grid-line: rgba(120, 210, 165, 0.045);
  --scrim: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--brand-soft); }

.mono { font-family: var(--font-mono); }
.icn { display: inline-flex; align-items: center; flex: none; }
.icn svg, .ni-icon svg, .mi-icon svg { display: block; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}

/* ===== App shell ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px 14px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-mark { color: var(--brand); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.34em; color: var(--text-3); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 12px 6px;
}
.nav-domains { overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }
.nav-domains::-webkit-scrollbar { width: 8px; }
.nav-domains::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--surface-2); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  text-align: left;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item .ni-icon { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: currentColor; opacity: 0.9; }
.nav-item .ni-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-code {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--text-3); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; min-width: 24px; text-align: center;
}
.nav-item.active .nav-code { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.nav-dot.on { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.nav-dot.off { background: transparent; border: 1.5px solid var(--border-strong); }

.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-collapse { color: var(--text-3); }

/* collapsed sidebar - icons only */
body.sidebar-collapsed { --sidebar-w: 68px; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-item .ni-label,
body.sidebar-collapsed .nav-group-label { display: none; }
body.sidebar-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; gap: 0; }
body.sidebar-collapsed .brand { justify-content: center; padding: 4px 0 18px; }
body.sidebar-collapsed .nav-item.active::before { left: -10px; }

/* ===== Main / topbar ===== */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 15;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; gap: 1px; flex: none; }

/* global search */
.topbar-search { position: relative; flex: 1; max-width: 560px; margin: 0 24px; }
.topbar-search .ts-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.topbar-search input { width: 100%; height: 38px; padding: 0 46px 0 36px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ts-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 440px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; animation: pop 0.14s var(--ease); }
.sr-empty { padding: 18px; color: var(--text-3); font-size: 13px; text-align: center; }
.sr-group-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.sr-item:hover { background: var(--surface-3); }
.sr-item .icn { color: var(--text-2); flex: none; }
.sr-title { font-size: 13px; font-weight: 600; }
.sr-sub { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 760px) { .topbar-search { margin: 0 12px; } .ts-kbd { display: none; } }
.topbar-title h1 { font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-divider { width: 1px; height: 26px; background: var(--border); }
.notif-menu { position: relative; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.notif-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--err); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.notif-dropdown { width: 380px; max-width: calc(100vw - 24px); }
.notif-head { justify-content: space-between; }
.notif-count { font-size: 11px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 999px; }
.notif-list { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; overflow-x: hidden; }
.notif-item { display: flex; align-items: flex-start; gap: 11px; width: 100%; padding: 10px 8px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.notif-item:hover { background: var(--surface-3); }
.notif-item:hover .notif-go { opacity: 1; transform: none; }
.notif-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); margin-top: 1px; }
.notif-ic.ok { background: var(--brand-soft); color: var(--ok); }
.notif-ic.warn { background: var(--sev-med-bg); color: var(--warn); }
.notif-ic.bad { background: var(--sev-crit-bg); color: var(--err); }
.notif-main { min-width: 0; flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-count-badge { flex: none; font-size: 10.5px; font-weight: 700; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.notif-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.notif-domain { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px 1px 5px; white-space: nowrap; }
.notif-domain .icn { color: var(--text-3); }
.notif-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.notif-go { flex: none; align-self: center; color: var(--text-3); opacity: 0; transform: translateX(-3px); transition: all 0.15s; }
.notif-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-empty { display: flex; align-items: center; gap: 9px; padding: 16px 10px; color: var(--text-3); font-size: 12.5px; }
.notif-empty .icn { color: var(--brand); }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  transition: all 0.16s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }

/* user menu */
.user-menu { position: relative; }
.avatar-btn {
  display: inline-flex; padding: 0; border: none; background: transparent;
  border-radius: 50%; cursor: pointer; transition: box-shadow 0.16s var(--ease);
}
.avatar-btn .avatar { transition: box-shadow 0.16s var(--ease); }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--brand-soft); }
.avatar-btn:focus-visible { outline: none; }
.avatar-btn:focus-visible .avatar { box-shadow: 0 0 0 3px var(--brand-soft); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: 0.04em;
  color: var(--brand-contrast);
  background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #7bdcb1));
}
.avatar-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.avatar-name { font-size: 12.5px; font-weight: 600; }
.avatar-role { font-size: 10.5px; color: var(--text-3); }
.chev { color: var(--text-3); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 256px; padding: 8px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: pop 0.16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.dropdown-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; gap: 11px; align-items: center; }
.dropdown-head .avatar { width: 38px; height: 38px; font-size: 13px; }
.dropdown-head .dh-name { font-weight: 600; font-size: 13.5px; }
.dropdown-head .dh-role { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.dropdown-head .dh-email { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; text-align: left;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item .mi-icon { width: 16px; height: 16px; color: var(--text-2); }
.menu-item.danger { color: var(--err); }
.menu-item.danger .mi-icon { color: var(--err); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-meta { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

/* ===== Canvas ===== */
.canvas {
  flex: 1; padding: 30px 34px 60px; min-width: 0;
  background-color: var(--canvas);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 30px 30px;
  background-position: -1px -1px;
}
.view { max-width: 1600px; margin: 0 auto; }
.view > * { animation: fadeup 0.5s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: 0.05s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.15s; }
.view > *:nth-child(5) { animation-delay: 0.2s; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== Page header ===== */
.page-head { margin-bottom: 24px; }
.page-head h2 { font-size: 26px; letter-spacing: -0.025em; }
.page-head .lede { color: var(--text-2); margin-top: 6px; max-width: 70ch; font-size: 14px; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

/* coverage bar (governance dashboard) */
.cov-bar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.cov-seg { min-width: 3px; }
.cov-seg.ok { background: var(--ok); }
.cov-seg.warn { background: var(--warn); }
.cov-seg.none { background: var(--border-strong, #d4d4d8); }
.cov-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.cov-leg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.cov-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.cov-dot.ok { background: var(--ok); }
.cov-dot.warn { background: var(--warn); }
.cov-dot.bad { background: var(--err); }
.cov-dot.none { background: var(--border-strong, #d4d4d8); }

/* risk-level badges (Security Risk Register) */
.rl-badge { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.rl-badge.rl1 { background: #d6f3e4; color: #15724e; }
.rl-badge.rl2 { background: #e7f5d8; color: #4a7a17; }
.rl-badge.rl3 { background: #fbeccb; color: #8a6410; }
.rl-badge.rl4 { background: #fad9bd; color: #9a4d12; }
.rl-badge.rl5 { background: #f7ccce; color: #a32230; }

/* item-definition diagram editor */
.id-diagram-wrap { margin-top: 10px; }
.id-diagram-wrap .flow-scroll { height: 560px; background:
  linear-gradient(var(--surface-2) 0 0) padding-box,
  radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: auto, 20px 20px; }
.id-canvas { position: relative; }
.id-node { position: absolute; box-sizing: border-box; border: 1px solid var(--border-strong, #d4d4d8); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.05); padding: 9px 11px; cursor: default; transition: box-shadow 0.12s, border-color 0.12s; overflow: hidden; }
.id-node:hover { border-color: var(--brand); }
.id-node.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), 0 0 8px color-mix(in srgb, var(--brand) 55%, transparent); }
.id-node.connect-source { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.id-node.connect-target { border-style: dashed; border-color: var(--brand); }
.id-node.container { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border-style: solid; cursor: default; }
/* header bar: tinted by the component type; icon left · title · type label right. Drag handle for the block. */
.id-node-head { display: flex; align-items: center; gap: 7px; margin: -9px -11px 8px; padding: 7px 10px; background: color-mix(in srgb, var(--nc, #9aa) 16%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--nc, #9aa) 34%, transparent); border-radius: 9px 9px 0 0; cursor: grab; }
.id-node:not(.ro) .id-node-head:active { cursor: grabbing; }
.idn-ic { color: var(--nc, var(--text-2)); flex: none; }
.id-node-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-node-kind { margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: color-mix(in srgb, var(--nc, #777) 75%, var(--text-3)); flex: none; }
.id-node-tb { display: inline-flex; align-items: center; color: var(--err); flex: none; margin-left: 2px; }
.id-node-meta { color: var(--text-3); font-size: 10.5px; margin-top: 3px; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-node-desc { color: var(--text-2); font-size: 11.5px; margin-top: 5px; line-height: 1.35; }
.id-node-assets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.id-asset { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.id-node.container .id-asset { background: var(--surface); }
.id-resize { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; cursor: nwse-resize; border-right: 2px solid var(--border-strong, #c9c4b4); border-bottom: 2px solid var(--border-strong, #c9c4b4); border-bottom-right-radius: 8px; opacity: 0; transition: opacity 0.12s; }
.id-node:hover .id-resize { opacity: 0.7; }
/* per-kind colour (drives the header tint + icon) */
.id-node { --nc: var(--text-3); }
.id-node.k-item, .id-node.k-system { --nc: var(--brand); }
.id-node.k-ecu, .id-node.k-component { --nc: #5b8def; }
.id-node.k-software { --nc: #15724e; }
.id-node.k-hardware { --nc: #b08714; }
.id-node.k-network, .id-node.k-interface { --nc: #7a5af0; }
.id-node.k-data { --nc: #c2410c; }
.id-node.k-external, .id-node.k-actor { --nc: #6b7280; border-style: dashed; }
/* connections: thicker, rounded orthogonal routes, with edge ports */
.flow-edges path.id-edge { stroke: var(--border-strong, #b9bdc6); stroke-width: 3.5; fill: none; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.flow-edges path.id-edge-hit { stroke: transparent; stroke-width: 24; fill: none; pointer-events: stroke; cursor: move; }
.flow-edges path.id-edge-hit.ro { cursor: pointer; }
/* selected connection / interface */
.flow-edges path.id-edge.id-edge-sel { stroke: var(--brand); stroke-width: 5; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand) 55%, transparent)); }
.flow-edges rect.id-port.id-port-sel { fill: var(--brand); stroke: var(--brand); }
.id-port { fill: var(--surface); stroke: var(--border-strong, #9aa0ab); stroke-width: 1.5; pointer-events: auto; cursor: grab; }
.id-port:active { cursor: grabbing; }
.id-canvas.ro .id-port, .id-diagram-wrap .id-port { cursor: default; }
/* edges drawn above the (translucent) container boxes; clicks pass through except on labels */
.id-canvas .flow-edges { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; }
/* grid painted on the scroll viewport so it fills empty space; size & offset are set in JS to track zoom + pan */
.flow-scroll.id-grid-on { background-image: linear-gradient(to right, color-mix(in srgb, var(--border) 75%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--border) 75%, transparent) 1px, transparent 1px); }
/* component hierarchy tree (Product Management) - collapsible, with connector lines */
.ctree { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 4px; }
.ctree-row { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; transition: background 0.12s; }
.ctree-row:hover { background: var(--surface-2); }
.ctree-row.vehicle { background: var(--surface-2); font-weight: 600; }
.ctree-ic { color: var(--text-2); flex: none; }
.ctree-name { flex: 1; min-width: 0; font-size: 13px; color: inherit; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.ctree-name:hover { color: var(--brand); text-decoration: underline; }
.ctree-toggle { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; color: var(--text-3); cursor: pointer; padding: 0; border-radius: 4px; transition: transform 0.12s, background 0.12s; }
.ctree-toggle:hover { background: var(--border); color: var(--text); }
.ctree-toggle.ctree-leaf { cursor: default; visibility: hidden; }
.ctree-node:not(.collapsed) > .ctree-row > .ctree-toggle { transform: rotate(90deg); }
.ctree-node.collapsed > .ctree-children { display: none; }
/* connector lines: vertical rail per child + horizontal elbow into each row */
.ctree-children { margin-left: 20px; }
.ctree-children > .ctree-node { position: relative; }
.ctree-children > .ctree-node::before { content: ''; position: absolute; left: -10px; top: 0; height: 100%; border-left: 1px solid var(--border-strong, #c9c4b4); }
.ctree-children > .ctree-node:last-child::before { height: 18px; }
.ctree-children > .ctree-node::after { content: ''; position: absolute; left: -10px; top: 18px; width: 10px; border-top: 1px solid var(--border-strong, #c9c4b4); }

/* product profile */
.profile-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.profile-stack .card { margin: 0; }
.pm-head-right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; flex: none; }
.pm-viewer { width: 220px; height: 150px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 35%, var(--surface), var(--surface-2)); }
.pm-viewer model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
.pm-viewer.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); }
.inc-row { padding: 10px 0; border-bottom: 1px solid var(--border); border-radius: 6px; }
.inc-row:last-child { border-bottom: none; }
.eflash { animation: eflash 1.6s ease-out; }
@keyframes eflash { 0% { background: var(--brand-soft, rgba(21,114,78,0.18)); box-shadow: 0 0 0 2px var(--brand); } 100% { background: transparent; box-shadow: none; } }

/* two-track lifecycle + cybersecurity timeline */
.tl2-scroll { overflow-x: auto; padding-bottom: 6px; }
.tl2-inner { position: relative; height: 300px; width: 100%; }
.tl2-axis { position: absolute; left: 0; right: 0; top: 130px; height: 2px; background: var(--border-strong, #c9c4b4); }
.tl2-tick { position: absolute; top: 6px; bottom: 22px; width: 0; border-left: 1px dashed var(--border); }
.tl2-tick-label { position: absolute; bottom: -20px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
/* milestones (top track) */
.tl2-ms { position: absolute; top: 0; width: 0; }
.tl2-ms-dot { position: absolute; top: 124px; left: -6px; width: 13px; height: 13px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--brand); }
.tl2-ms.phase-operational .tl2-ms-dot { background: #7a5af0; box-shadow: 0 0 0 1px #7a5af0; }
.tl2-ms-stem { position: absolute; top: 84px; left: -0.5px; height: 46px; border-left: 2px dotted var(--border-strong, #c9c4b4); }
.tl2-ms-label { position: absolute; top: 30px; left: -84px; width: 168px; text-align: center; }
.tl2-ms-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.tl2-ms-date { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 2px; }
.tl2-ms.phase-operational .tl2-ms-name { color: #5b46b0; }
/* cyber events (bottom track) */
.tl2-ev { position: absolute; top: 130px; width: 0; cursor: pointer; }
.tl2-ev-stem { position: absolute; top: 0; left: -0.5px; height: 24px; border-left: 2px solid var(--border-strong, #c9c4b4); }
.tl2-ev-icon { position: absolute; top: 22px; left: -15px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 2px solid var(--text-3); color: var(--text-2); transition: transform 0.12s; }
.tl2-ev:hover .tl2-ev-icon { transform: scale(1.12); }
.tl2-ev.tl-assessment .tl2-ev-icon { border-color: var(--brand); color: var(--brand); }
.tl2-ev.tl-vuln .tl2-ev-icon { border-color: var(--warn); color: var(--warn); }
.tl2-ev.tl-incident .tl2-ev-icon { border-color: var(--err); color: var(--err); }
.tl2-tip { position: absolute; top: 56px; left: -110px; width: 220px; background: var(--surface); border: 1px solid var(--border-strong, #c9c4b4); border-radius: 8px; box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,0.12)); padding: 9px 11px; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.12s, transform 0.12s; z-index: 5; pointer-events: none; text-align: left; }
.tl2-ev:hover .tl2-tip { opacity: 1; visibility: visible; transform: translateY(0); }
.tl2-tip-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.tl2-tip-line { font-size: 11.5px; color: var(--text-2); line-height: 1.45; }
.tl2-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.tl2-leg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.tl2-leg-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tl2-leg-dot.phase-development { background: var(--brand); }
.tl2-leg-dot.phase-operational { background: #7a5af0; }
.tl2-leg-dot.tl-assessment { background: var(--brand); }
.tl2-leg-dot.tl-vuln { background: var(--warn); }
.tl2-leg-dot.tl-incident { background: var(--err); }
/* clustered (stacked) event marker */
.tl2-ev-count { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); }
.tl2-ev.multi .tl2-ev-icon { box-shadow: 2px 2px 0 -1px var(--surface), 3px 3px 0 -1px currentColor; }
.tl2-tip-ev + .tl2-tip-ev { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* risk-over-time stacked-area sparkline (risk register header) */
.risk-trend-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 14px 16px; margin-bottom: 16px; }
.rt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rt-title { font-size: 12px; font-weight: 600; }
.risk-trend { display: block; width: 100%; height: 120px; }
.rt-axis { position: relative; height: 16px; margin-top: 2px; }
.rt-axis-label { position: absolute; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--text-3); white-space: nowrap; }
.rt-axis-label.start { transform: none; left: 0; }
.rt-axis-label.end { transform: none; right: 0; left: auto; }
.rt-grid { display: grid; grid-template-columns: 22px 1fr; column-gap: 6px; }
.rt-yaxis { position: relative; }
.rt-y-label { position: absolute; right: 0; transform: translateY(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--text-3); line-height: 1; }
.rt-svg-box { position: relative; min-width: 0; }
.rt-xaxis-cell { grid-column: 2; min-width: 0; }
.rt-grid-line { stroke: var(--border); stroke-width: 1; opacity: .6; }
.feas-cell { display: inline-block; }
.feas-tip { position: fixed; width: 230px; background: var(--surface); border: 1px solid var(--border-strong, #c9c4b4); border-radius: 8px; box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,0.12)); padding: 9px 11px; opacity: 0; visibility: hidden; transition: opacity 0.12s; z-index: 200; pointer-events: none; }
.feas-tip.show { opacity: 1; visibility: visible; }
.pm-model-status { margin-top: 8px; }
.pm-model-url { margin-top: 8px; }
.pm-model-url > summary { cursor: pointer; font-size: 12px; color: var(--text-2); }

.btn.btn-warn { color: var(--warn); border-color: var(--warn); }
.pbar { height: 7px; background: var(--surface-2, #eee); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.pbar-fill { height: 100%; background: #3a8a5f; transition: width .3s ease; }
.method-edit-grid { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .method-edit-grid { grid-template-columns: 1fr; } }
.field-pick-chip { display: inline-flex; align-items: center; gap: 4px; cursor: grab; user-select: none; font-size: 11.5px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2, #f3f3ef); white-space: nowrap; }
.field-pick-chip:hover { border-color: #3a8a5f; color: #2f7d5b; }
.field-pick-chip:active { cursor: grabbing; }
.tara-graph { min-width: 100%; }
.tara-node { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; box-shadow: 0 1px 2px rgba(0,0,0,.05); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.tara-node:hover { border-color: #3a8a5f; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.tara-node.asset { border-left: 3px solid #6b7280; }
.tara-node.risk { border-left: 3px solid #2f7d5b; }
.tara-node.damage { border-left: 3px solid #ef6c00; }
.tara-col-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #8a8f98); font-weight: 700; }
.id-editor-row { display: flex; gap: 12px; align-items: stretch; }
.id-library { width: 210px; flex: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); display: flex; flex-direction: column; max-height: 600px; overflow: hidden; }
.id-lib-head { display: flex; align-items: center; gap: 6px; padding: 9px 11px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border); }
input.id-lib-search { margin: 0 10px 8px; width: calc(100% - 20px); box-sizing: border-box; }
.id-lib-list { overflow-y: auto; overflow-x: hidden; padding: 2px 8px 10px; }
.id-lib-item { min-width: 0; }
.id-lib-item > .icn, .id-pm-caret { flex: none; }
.id-lib-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-lib-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #8a8f98); font-weight: 700; margin: 11px 4px 4px; }
.id-lib-item { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 7px; font-size: 12px; cursor: grab; border: 1px solid transparent; }
.id-lib-item:hover { background: var(--surface-2, #f3f4f6); border-color: var(--border); }
.id-lib-item:active { cursor: grabbing; }
@media (max-width: 920px) { .id-editor-row { flex-direction: column; } .id-library { width: 100%; max-height: 220px; } }
.tara-node.wk-component, .tara-node.wk-unit { border-left: 3px solid #6b7280; }
.tara-node.wk-sbom { border-left: 3px solid #3a6ea5; }
.tara-node.wk-lib, .tara-node.wk-vuln { border-left: 3px solid #c9ccd1; }
.pm-dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 14px; align-items: stretch; }
.pm-dash-chart { grid-column: span 2; }
.pm-dash-chart, .pm-dash-panel { background: var(--surface-2, #f7f8fa); border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; min-width: 0; }
.pm-dash-chart .risk-trend { width: 100%; height: 96px; display: block; }
.pm-dash-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #8a8f98); font-weight: 700; margin-bottom: 8px; }
.pm-stat-rows { display: flex; flex-direction: column; gap: 6px; }
.pm-stat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pm-stat-n { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pm-dash-sub { margin-top: 9px; font-size: 11px; color: var(--muted, #8a8f98); }
.pm-attr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; }
.pm-attr-cell .pm-attr-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8a8f98); font-weight: 700; }
.pm-attr-cell .pm-attr-val { font-size: 14px; font-weight: 600; margin-top: 3px; }
.pm-stat-body { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pm-donut { flex: none; }
.pm-donut-total { font-size: 19px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.pm-legend { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.pm-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pm-legend-n { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.pm-legend-row { font-size: 12px; }
.pm-legend-head { font-weight: 700; }
.pm-legend-sub { padding-left: 4px; }
.pm-legend-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pm-sev-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.eyebrow a.crumb-link { color: inherit; text-decoration: none; cursor: pointer; }
.eyebrow a.crumb-link:hover { color: var(--brand); text-decoration: underline; }
.req-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; cursor: pointer; }
.req-link:hover { color: var(--brand); }
a.req-chip { text-decoration: none; cursor: pointer; }
a.req-chip:hover { border-color: var(--brand); color: var(--brand); }
.req-flash { animation: reqflash 1.5s ease; border-radius: 8px; }
.level-badge.level-unmapped { background: #fdf1e3; color: #b7791f; }
.home-sec-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #8a8f98); font-weight: 700; margin: 0 0 8px; }
.home-list { display: flex; flex-direction: column; gap: 6px; }
.home-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface, #fff); text-decoration: none; color: inherit; }
a.home-row:hover { border-color: var(--brand); }
.home-row-title { font-weight: 600; font-size: 13px; }
.home-row-sub { color: var(--muted, #8a8f98); font-size: 11.5px; margin-top: 2px; }
@keyframes reqflash { 0%, 100% { background: transparent; } 18% { background: var(--brand-soft, rgba(58,138,95,.2)); } }

/* ===== read-only item-definition (model detail) ===== */
.id-node.ro { cursor: pointer; }
.id-node.ro:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.10); }
.id-node.ro .id-resize { display: none; }

/* ===== full-screen item-definition editor ("workshop") ===== */
body.fullscreen-editor .app { grid-template-columns: 1fr; }
body.fullscreen-editor .sidebar, body.fullscreen-editor .topbar { display: none; }
body.fullscreen-editor .main { min-width: 0; }
body.fullscreen-editor .canvas { padding: 0; height: 100vh; max-height: 100vh; overflow: hidden; }
body.fullscreen-editor .view { height: 100vh; }
.editor-shell { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; color: var(--text); background: var(--surface, #fff); border-bottom: 1px solid var(--border); z-index: 6; }
.editor-eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.editor-title { font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: .2px; }
.editor-hint { font-size: 11.5px; color: #15803d; display: flex; align-items: center; gap: 4px; }
/* full-height 3-pane editor: toolbar on top · component library left · canvas centre · attributes drawer right */
.editor-body { flex: 1; min-height: 0; display: flex; }
.id-fs { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.id-fs-toolbar { flex: 0 0 auto; margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface, #fff); }
.id-fs-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.id-fs-body .id-library { flex: 0 0 244px; width: 244px; max-height: none; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: var(--surface, #fff); }
.id-fs-canvas { flex: 1; min-width: 0; margin: 0; }
.id-fs-canvas .flow-scroll { height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
.id-props { flex: 0 0 322px; width: 322px; min-width: 0; border-left: 1px solid var(--border); background: var(--surface, #fff); overflow-x: hidden; overflow-y: auto; }
/* slide-out animation for the left (library) and right (attributes) drawers */
.id-fs-body .id-library, .id-props { transition: margin .24s var(--ease, ease), opacity .2s var(--ease, ease); }
.id-fs-body .id-library.id-pane-hidden { margin-left: -245px; opacity: 0; pointer-events: none; }
.id-props.id-pane-hidden { margin-right: -323px; opacity: 0; pointer-events: none; }
.id-props-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; text-align: center; color: var(--muted); padding: 24px; }
.id-props-empty .icn { opacity: .45; }
.id-props-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface, #fff); z-index: 1; }
.id-props-title { font-weight: 700; font-size: 13px; flex: 1; }
.id-props-x { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.id-props-x:hover { color: var(--text); }
.id-props-body { padding: 14px; display: flex; flex-direction: column; gap: 11px; }
/* the drawer is too narrow for the 320px-min two-column grid - stack those fields full-width instead */
.id-props-body .grid-2 { grid-template-columns: 1fr; gap: 11px; }
.id-props-body .field { min-width: 0; }
@media (max-width: 980px) { .id-props { flex-basis: 256px; width: 256px; } .id-fs-body .id-library { flex-basis: 200px; width: 200px; } }
/* toolbar: icon buttons, divider, library toggle */
.id-fs-toolbar { display: flex; align-items: center; gap: 8px; }
.id-fs-toolbar .btn-icon { padding: 6px 7px; }
.id-fs-toolbar .btn svg { display: block; }
.id-fs-toolbar .btn:disabled { opacity: .4; cursor: default; }
.id-fs-toolbar .btn.active { background: var(--accent, #4f46e5); border-color: var(--accent, #4f46e5); color: #fff; }
.id-fs-toolbar .btn.active .id-fs-plus svg { stroke: #fff; }
.id-fs-plus { display: inline-flex; align-items: center; }
.id-fs-div { width: 1px; align-self: stretch; margin: 3px 2px; background: var(--border); }
/* library: new-asset button + product-structure tree */
.id-lib-new { width: calc(100% - 20px); margin: 10px 10px 8px; justify-content: center; box-sizing: border-box; }
.id-pm-tree { display: flex; flex-direction: column; }
.id-pm-row { gap: 5px; }
.id-pm-caret { display: inline-flex; align-items: center; justify-content: center; width: 14px; flex: none; color: var(--muted); cursor: pointer; border-radius: 4px; }
.id-pm-caret:hover { background: color-mix(in srgb, var(--accent, #6366f1) 16%, transparent); color: var(--text); }
/* filter: ghost the de-selected component types */
.id-node.id-ghost { opacity: .22; filter: grayscale(1); }
.id-fs-pop-wrap { position: relative; display: inline-flex; }
.id-fs-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 210px; padding: 8px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--border); box-shadow: 0 16px 42px rgba(20,30,60,.2); }
.id-fs-pop-h { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 2px 6px 8px; }
.id-fs-pop-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.id-fs-pop-row:hover { background: color-mix(in srgb, var(--accent, #6366f1) 12%, transparent); }
.id-fs-pop-row input { accent-color: var(--accent, #6366f1); }

/* the game canvas itself */
.game-canvas { background-color: #0a0c16; background-image: radial-gradient(900px 500px at 50% 0%, rgba(99,102,241,.16), transparent 60%); }
.game-canvas::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(120,140,210,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(120,140,210,.10) 1px, transparent 1px);
  background-size: 30px 30px; -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 45%, #000 55%, transparent 100%); mask-image: radial-gradient(ellipse 80% 80% at 50% 45%, #000 55%, transparent 100%); }
.game-canvas .id-edge { stroke: rgba(150,170,235,.75); stroke-width: 2.5; filter: drop-shadow(0 0 5px rgba(120,140,255,.5)); }
.game-canvas .id-edge-label { fill: #cfd6ee; }
.game-canvas rect.id-edge-label.edge-label-bg { fill: rgba(18,22,40,.95); stroke: rgba(140,160,220,.3); }
/* 3D extruded neon blocks */
.game-canvas .id-node { --gc: #94a3b8; --gcd: #3a4356;
  background: linear-gradient(180deg, rgba(34,40,64,.97), rgba(18,21,38,.97)); color: #e9edf7;
  border: 1px solid color-mix(in srgb, var(--gc) 55%, transparent); border-top: 3px solid var(--gc); border-radius: 14px;
  box-shadow: 0 7px 0 var(--gcd), 0 11px 22px rgba(0,0,0,.5); transition: transform .12s ease, box-shadow .12s ease; }
.game-canvas .id-node.ro { cursor: pointer; }
.game-canvas .id-node:hover { transform: translateY(-3px); box-shadow: 0 10px 0 var(--gcd), 0 16px 30px rgba(0,0,0,.55), 0 0 24px color-mix(in srgb, var(--gc) 45%, transparent); }
.game-canvas .id-node.selected { box-shadow: 0 7px 0 var(--gcd), 0 0 0 2px var(--gc), 0 0 30px color-mix(in srgb, var(--gc) 60%, transparent); }
.game-canvas .id-node.connect-source { box-shadow: 0 7px 0 var(--gcd), 0 0 0 2px #fbbf24, 0 0 26px rgba(251,191,36,.6); }
.game-canvas .id-node.connect-target:hover { box-shadow: 0 10px 0 var(--gcd), 0 0 0 2px #34d399, 0 0 26px rgba(52,211,153,.55); }
.game-canvas .id-node .id-node-head { color: #fff; }
.game-canvas .id-node .id-node-kind { color: var(--gc); }
.game-canvas .id-node .id-node-meta, .game-canvas .id-node .id-node-desc { color: #aab2c8; }
.game-canvas .id-node .id-asset { background: rgba(255,255,255,.08); color: #d6dcec; border-color: transparent; }
.game-canvas .id-node.container { background: rgba(20,24,42,.5); border-style: dashed; box-shadow: inset 0 0 40px rgba(0,0,0,.4), 0 0 0 1px color-mix(in srgb, var(--gc) 28%, transparent); }
.game-canvas .id-node.container:hover { transform: none; }
.game-canvas .id-resize { border-color: var(--gc); opacity: .7; }
.game-canvas .id-node.k-software { --gc: #22d3ee; --gcd: #0e6b80; }
.game-canvas .id-node.k-hardware { --gc: #f59e0b; --gcd: #8a5a06; }
.game-canvas .id-node.k-ecu { --gc: #a78bfa; --gcd: #5b46a8; }
.game-canvas .id-node.k-network { --gc: #34d399; --gcd: #167a55; }
.game-canvas .id-node.k-interface { --gc: #60a5fa; --gcd: #2d5fa8; }
.game-canvas .id-node.k-data { --gc: #f472b6; --gcd: #9d3b73; }
.game-canvas .id-node.k-actor { --gc: #fb7185; --gcd: #9c2f3e; }
.game-canvas .id-node.k-external { --gc: #fb923c; --gcd: #9a5215; }
.game-canvas .id-node.k-item, .game-canvas .id-node.k-system { --gc: #cbd5e1; --gcd: #4a5568; }
/* plug nubs */
.id-plug { display: none; }
.game-canvas .id-node .id-plug { display: block; position: absolute; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--gc); box-shadow: 0 0 8px var(--gc), inset 0 0 0 2px rgba(0,0,0,.3); }
.game-canvas .id-node .id-plug-r { right: -7px; }
.game-canvas .id-node .id-plug-l { left: -7px; opacity: .55; }

@media (max-width: 620px) { .pm-dash { grid-template-columns: 1fr; } .pm-dash-chart { grid-column: span 1; } }
.card-head-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.card-head-collapsible { cursor: pointer; user-select: none; }
.card-collapse { background: none; border: none; padding: 0; margin: 0; cursor: pointer; color: var(--muted, #8a8f98); display: inline-flex; align-items: center; flex: none; }
.card-collapse:hover { color: var(--text, #1a1a1a); }
.card.collapsed .card-head { border-bottom: none; }
.pm-grip { background: none; border: none; padding: 0; margin: 0; cursor: grab; color: var(--muted, #b5b9c0); display: inline-flex; align-items: center; flex: none; touch-action: none; }
.pm-grip:hover { color: var(--text, #1a1a1a); }
.pm-grip:active { cursor: grabbing; }
.pm-reorder.dragging { opacity: .55; outline: 2px dashed var(--brand, #3a8a5f); outline-offset: 2px; }
a.owner-chip { text-decoration: none; cursor: pointer; }
a.owner-chip:hover { border-color: var(--brand); color: var(--brand); }

/* persistent save-failure indicator (SEC-005) */
.save-error-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 400; display: flex; align-items: center; gap: 10px; background: var(--sev-crit-bg); color: var(--err); border: 1px solid var(--err); border-radius: 10px; padding: 9px 12px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.16); }
.save-error-bar .icn { flex: none; }

/* catalog source badges + cross-map gap rows */
.src-badge { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.src-badge.src-emb3d { color: #2f6fb0; background: rgba(47, 111, 176, 0.13); }
.src-badge.src-esam { color: #7a5cc0; background: rgba(122, 92, 192, 0.13); }
.src-badge.src-org { color: var(--text-2); background: var(--surface-3); }
.src-badge.src-std { color: var(--ok); background: var(--brand-soft); }
tr.crossmap-gap td { background: var(--sev-med-bg); }

/* feature / function hierarchy */
.feat-comps { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-left: 8px; }
.feat-comps .icn { color: var(--text-3); flex: none; }
.feat-comp-chip { font-size: 10.5px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.level-badge.lv-feat { color: #7a5cc0; background: rgba(122, 92, 192, 0.12); }
.level-badge.lv-fn { color: #2f7db0; background: rgba(47, 125, 176, 0.12); }

/* equal-size square icon action buttons (edit / delete) */
.btn.iconbtn { width: 30px; min-width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* risk register: resizable + sortable table */
.rrt-wrap { overflow-x: auto; }
table.rrt { table-layout: fixed; border-collapse: collapse; }
table.rrt th { position: relative; }
table.rrt th, table.rrt td { overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.col-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; user-select: none; }
.col-resize:hover { background: var(--brand-soft, rgba(21,114,78,0.25)); }
.feas-tip-title { font-size: 11px; font-weight: 600; margin-bottom: 5px; }
.feas-frow { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; padding: 2px 0; }
.feas-frow .feas-k { color: var(--text-2); }
.feas-frow .feas-v { font-weight: 600; white-space: nowrap; }
.rt-area { stroke: var(--surface); stroke-width: 0.5; }
.rt-area.rt-RL1 { fill: #6fc79a; } .rt-area.rt-RL2 { fill: #a9d977; }
.rt-area.rt-RL3 { fill: #ecc35a; } .rt-area.rt-RL4 { fill: #e79a52; } .rt-area.rt-RL5 { fill: #de6b73; }
.rt-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.rt-leg { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; color: var(--text-2); }
.rt-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.rt-dot.rt-RL1 { background: #6fc79a; } .rt-dot.rt-RL2 { background: #a9d977; }
.rt-dot.rt-RL3 { background: #ecc35a; } .rt-dot.rt-RL4 { background: #e79a52; } .rt-dot.rt-RL5 { background: #de6b73; }

.id-edge-label { cursor: pointer; pointer-events: auto; }
text.id-edge-label { fill: var(--text-2); font-size: 10.5px; }
rect.id-edge-label { fill: var(--surface); stroke: var(--border); }

/* stat */
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat .stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.stat .stat-value { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; line-height: 1; }
.stat .stat-value.danger { color: var(--err); }
.role-unassigned { color: var(--err); font-weight: 600; }
.stat .stat-foot { margin-top: 8px; font-size: 12px; color: var(--text-2); }
.stat .stat-spark { position: absolute; right: -6px; top: -6px; color: var(--brand-soft); }

/* ===== Domain cards (overview) ===== */
.domain-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px;
  cursor: pointer; transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.domain-card:hover { transform: translateY(-2px); border-color: var(--brand-line); box-shadow: var(--shadow); }
.domain-card .dc-top { display: flex; align-items: center; gap: 10px; }
.domain-card .dc-title { font-weight: 600; font-size: 14.5px; }
.domain-card .dc-blurb { color: var(--text-2); font-size: 12.5px; min-height: 34px; }
.domain-card .dc-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }

/* ===== Chips / badges ===== */
.code-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: 6px; padding: 2px 7px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
}
.chip.brand { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.chip.tool { font-family: var(--font-mono); font-size: 11px; }
.cap-chip {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 8px; border-radius: 6px;
  color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border);
}
.cap-chip.none { color: var(--text-3); font-style: italic; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border); margin: 1px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dot.off { border: 1.5px solid var(--border-strong); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn:hover { border-color: var(--text-3); background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: var(--err); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ===== Inputs ===== */
.input, .select {
  width: 100%; padding: 9px 11px; font-size: 13px; font-family: inherit;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--radius-sm); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field .help { font-size: 11px; color: var(--text-3); }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; }
.segmented button {
  border: none; background: transparent; color: var(--text-2); cursor: pointer;
  padding: 5px 13px; font-size: 12px; font-weight: 600; border-radius: 6px; transition: all 0.15s var(--ease);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs .tab[draggable] { cursor: grab; }
.tabs .tab[draggable]:active { cursor: grabbing; }
.tabs .tab.tab-dragging { opacity: 0.4; }
.tabs .tab.tab-drop { box-shadow: inset 3px 0 0 var(--brand); }
.tab {
  padding: 10px 14px; border: none; background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 600; cursor: pointer; position: relative; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.active { color: var(--brand); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.th-sort:hover { color: var(--text); }
table.data th.th-sort.on { color: var(--brand); }
.th-arrow { font-weight: 700; }
.role-ava.sm { width: 28px; height: 28px; border-radius: 8px; }
.role-link { font-weight: 600; font-size: 13.5px; color: var(--text); text-decoration: none; cursor: pointer; }
.role-link:hover { color: var(--brand); text-decoration: underline; }
/* organizational risk register (ISO 31000) */
.orl-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.orl-low { color: #1e7a46; background: rgba(111, 199, 154, 0.20); }
.orl-med { color: var(--sev-med); background: var(--sev-med-bg); }
.orl-high { color: var(--sev-high); background: var(--sev-high-bg); }
.orl-crit { color: var(--err); background: var(--sev-crit-bg); }
.orisk-st { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
.orisk-st.st-open { color: var(--sev-high); background: var(--sev-high-bg); }
.orisk-st.st-monitoring { color: var(--sev-med); background: var(--sev-med-bg); }
.orisk-st.st-mitigated { color: #1e7a46; background: rgba(111, 199, 154, 0.20); }
.orisk-st.st-closed { color: var(--text-3); background: var(--surface-3); }
.orisk-heat { display: grid; grid-template-columns: 30px repeat(5, minmax(0, 1fr)); gap: 4px; max-width: 460px; }
.oh-corner { font-size: 9px; color: var(--text-3); display: grid; place-items: center; font-family: var(--font-mono); }
.oh-axis { height: 34px; font-size: 10px; color: var(--text-3); display: grid; place-items: center; font-family: var(--font-mono); }
.oh-cell { height: 34px; display: grid; place-items: center; border-radius: 6px; font-weight: 700; font-size: 13px; color: #2a2a2a; }
.oh-low { background: #cdeadb; } .oh-med { background: #f1dd9b; } .oh-high { background: #f0c39a; } .oh-crit { background: #eaa6ad; }
/* governance maturity dashboard */
.gov-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.gd-green { background: #2f9e63; } .gd-yellow { background: var(--sev-med); } .gd-orange { background: var(--sev-high); } .gd-red { background: var(--err); } .gd-gray { background: var(--text-3); }
.gov-pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.gp-green { color: #1e7a46; background: rgba(111, 199, 154, 0.2); } .gp-yellow { color: var(--sev-med); background: var(--sev-med-bg); }
.gp-orange { color: var(--sev-high); background: var(--sev-high-bg); } .gp-red { color: var(--err); background: var(--sev-crit-bg); } .gp-gray { color: var(--text-3); background: var(--surface-3); }
.gov-lvl { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); }
.gov-trend { font-weight: 600; font-size: 12px; }
.gov-trend.up { color: #2f9e63; } .gov-trend.down { color: var(--err); }
.gov-conf { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; padding: 1px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.gc-high { color: #1e7a46; background: rgba(111, 199, 154, 0.2); } .gc-medium { color: var(--sev-med); background: var(--sev-med-bg); }
.gc-low { color: var(--err); background: var(--sev-crit-bg); } .gc-unknown { color: var(--text-3); background: var(--surface-3); }
.gov-score .stat-value { color: var(--brand); }
.gov-score-inline { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--brand); }
.gov-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; }
.gov-metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.gov-metric-v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.gov-metric-v.danger { color: var(--err); }
.gov-metric-k { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.gov-radar-lbl { font-size: 9.5px; fill: var(--text-2); font-family: var(--font-mono); }
.orisk-st.gst-not-started { color: var(--text-3); background: var(--surface-3); }
.orisk-st.gst-in-progress { color: var(--sev-med); background: var(--sev-med-bg); }
.orisk-st.gst-blocked { color: var(--err); background: var(--sev-crit-bg); }
.orisk-st.gst-overdue { color: var(--err); background: var(--sev-crit-bg); }
.orisk-st.gst-completed { color: #1e7a46; background: rgba(111, 199, 154, 0.2); }
.orisk-st.gst-deferred { color: var(--text-3); background: var(--surface-3); }
/* movable / resizable dashboard grid */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-tile { min-width: 0; position: relative; }
.dash-tile > .card { height: 100%; margin: 0; }
.dash-grid.editing .dash-tile { outline: 1px dashed var(--border-strong); outline-offset: 4px; border-radius: 14px; }
.dash-grid.editing .dash-tile:hover { outline-color: var(--brand); }
.dash-tile.dragging { opacity: 0.45; }
.dash-handle { position: absolute; top: 8px; right: 10px; z-index: 4; width: 26px; height: 22px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 7px; cursor: grab; color: var(--text-3); box-shadow: var(--shadow-sm); }
.dash-handle:active { cursor: grabbing; }
.dash-resize { position: absolute; top: 0; right: -4px; width: 10px; height: 100%; cursor: ew-resize; z-index: 4; }
.dash-resize::after { content: ''; position: absolute; top: 50%; right: 3px; transform: translateY(-50%); width: 3px; height: 34px; border-radius: 3px; background: var(--border-strong); }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid .dash-tile { grid-column: 1 / -1 !important; } }
table.data td.num, table.data td.mono { font-family: var(--font-mono); }

.sev { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.sev-critical { color: var(--sev-crit); background: var(--sev-crit-bg); }
.sev-high { color: var(--sev-high); background: var(--sev-high-bg); }
.sev-medium { color: var(--sev-med); background: var(--sev-med-bg); }
.sev-low { color: var(--sev-low); background: var(--sev-low-bg); }
.sev-unknown { color: var(--text-3); background: var(--surface-3); }
.risk-5 { color: var(--sev-crit); background: var(--sev-crit-bg); }
.risk-4 { color: var(--sev-high); background: var(--sev-high-bg); }
.risk-3 { color: var(--sev-med); background: var(--sev-med-bg); }
.risk-2, .risk-1 { color: var(--sev-low); background: var(--sev-low-bg); }

/* ===== Pills (test results) ===== */
.pill { font-size: 12px; padding: 4px 11px; border-radius: 999px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.pill.ok { color: var(--ok); background: var(--brand-soft); border: 1px solid var(--brand-line); }
.pill.err { color: var(--err); background: var(--sev-crit-bg); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); }
.pill.testing { color: var(--warn); background: var(--sev-med-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

/* ===== Connector / settings ===== */
.connector-card { padding: 18px; }
.connector-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.label-input {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em; min-width: 200px;
  background: transparent; border: 1px solid transparent; color: var(--text); border-radius: 7px; padding: 4px 7px;
}
.label-input:hover { border-color: var(--border); }
.label-input:focus { outline: none; border-color: var(--brand); background: var(--surface-2); }
.type-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
}
.type-badge.evsec { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.type-badge.jira { color: #4688ec; background: rgba(70, 136, 236, 0.12); border-color: rgba(70, 136, 236, 0.32); }
.spacer { flex: 1; }
.caps { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 13px; margin-top: 14px; }
.connector-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

.explorer-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 16px 0; }
.explorer-controls > .field { min-width: 220px; }
.explorer-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report-group { display: inline-flex; gap: 6px; align-items: center; padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--border); }
.explorer-output { padding-top: 8px; }

pre.json-inline { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow: auto; font-family: var(--font-mono); font-size: 11.5px; max-height: 360px; color: var(--text); }
details.raw { margin-top: 14px; }
details.raw summary { cursor: pointer; color: var(--text-2); font-size: 12px; font-family: var(--font-mono); }
details.raw pre { margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow: auto; font-family: var(--font-mono); font-size: 11px; max-height: 320px; }

/* ===== Misc ===== */
.muted { color: var(--text-2); }
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .empty-mark { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-3); }
.banner { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.banner.err { color: var(--err); background: var(--sev-crit-bg); border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); }
.banner.info { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.roadmap { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.roadmap li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text-2); }
.roadmap li:last-child { border-bottom: none; }
.roadmap .rm-mark { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); flex: none; }

/* ===== Toast ===== */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13px; min-width: 240px;
  animation: toastin 0.22s var(--ease);
}
.toast.err { border-left-color: var(--err); }
@keyframes toastin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ===== Modal ===== */
.modal-scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: center; padding: 24px; animation: fade 0.18s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.2s var(--ease); }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* right-side edit drawer */
.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; display: flex; justify-content: flex-end; opacity: 0; transition: opacity 0.2s var(--ease); }
.drawer-scrim.open { opacity: 1; }
.drawer { width: 460px; max-width: 92vw; height: 100%; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -10px 0 36px rgba(15, 23, 30, 0.16); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.24s var(--ease); }
.drawer-scrim.open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-close { border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--text-3); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; flex: none; }
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.btn-plus { font-size: 17px; line-height: 1; font-weight: 600; padding-left: 11px; padding-right: 11px; }
.ai-btn { background: linear-gradient(135deg, color-mix(in srgb, #8a5cf6 18%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, #8a5cf6 35%, var(--border-strong)); color: #6b21a8; }
.ai-btn:hover { background: linear-gradient(135deg, color-mix(in srgb, #8a5cf6 28%, var(--surface)), var(--surface-3)); }
.ai-btn .icn { color: #8a5cf6; }
.icon-only-btn { padding: 6px 8px; }
.icon-only-btn .icn { color: var(--text-2); }
.icon-only-btn:hover .icn { color: var(--text); }
.card.editing { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.sec-history { position: relative; }
.sec-v-badge { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: var(--brand-contrast); font-family: var(--font-mono); font-size: 9px; font-weight: 700; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
body.no-scroll { overflow: hidden; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); font-family: var(--font-mono); font-size: 11px; padding-top: 2px; }
.kv dd { margin: 0; }

/* ===== Domain operating model: process flow ===== */
.flow-wrap { display: grid; grid-template-columns: 1fr 322px; gap: 16px; align-items: start; }
.flow-main { min-width: 0; }
.flow-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.flow-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.flow-hint.active { color: var(--brand); font-weight: 600; }
.flow-scroll { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: auto; max-height: 660px; box-shadow: var(--shadow-sm); }
.flow-scroll.space-pan { cursor: grab; }
.flow-scroll.panning { cursor: grabbing; }
.flow-canvas { position: relative; min-width: 640px; min-height: 440px; background-image: radial-gradient(var(--grid-line) 1.4px, transparent 1.4px); background-size: 22px 22px; }
.flow-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.flow-edges .edge { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.flow-edges text.edge-label { fill: var(--text-3); font-family: var(--font-mono); font-size: 10px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.flow-node { position: absolute; width: 208px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-sm); cursor: grab; user-select: none; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.flow-node:hover { border-color: var(--text-3); }
.flow-node.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.flow-node.connect-target { border-style: dashed; border-color: var(--brand); }
.flow-node.connect-source { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fn-head { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.fn-title { font-weight: 600; font-size: 13px; }
.fn-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px; }
.fn-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); }
.fn-chip.role.ai-agent, .fn-chip.role.ai-skill { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.fn-chip.role.human { color: var(--sev-low); background: var(--sev-low-bg); border-color: color-mix(in srgb, var(--sev-low) 30%, transparent); }
.fn-chip.tool { font-family: var(--font-mono); }
.fn-chip.warn { color: var(--warn); background: var(--sev-med-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.inspector { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); max-height: calc(100vh - var(--topbar-h) - 48px); overflow: auto; }
.inspector .field { margin-bottom: 12px; }
.inspector-head { margin-bottom: 12px; }
.inspector-empty { text-align: center; color: var(--text-3); padding: 30px 10px; }
.inspector-empty p { margin-top: 10px; font-size: 13px; }
.inspector textarea.input { resize: vertical; min-height: 52px; font-family: inherit; }

.ctx-menu { position: fixed; z-index: 70; min-width: 184px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); animation: pop 0.12s var(--ease); }

/* switch + role / kind badges */
.switch { width: 38px; height: 22px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-3); position: relative; cursor: pointer; padding: 0; flex: none; transition: background 0.16s var(--ease), border-color 0.16s var(--ease); }
.switch.on { background: var(--brand); border-color: var(--brand); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.16s var(--ease); }
.switch.on .switch-knob { transform: translateX(16px); }
.kind-badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-2); }
.kind-badge.ai-agent { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.kind-badge.ai-skill { color: var(--sev-low); background: var(--sev-low-bg); border-color: color-mix(in srgb, var(--sev-low) 30%, transparent); }
.role-card .role-name { font-weight: 600; font-size: 14px; margin-top: 10px; }
.role-card.off { opacity: 0.62; }

/* markdown preview */
.md-preview { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.md-preview h2 { font-size: 16px; margin: 8px 0 6px; }
.md-preview h3 { font-size: 14px; margin: 8px 0 6px; }
.md-preview h4 { font-size: 12.5px; margin: 8px 0 6px; color: var(--text-2); }
.md-preview p { margin: 6px 0; color: var(--text-2); }
.md-preview ul { margin: 6px 0; padding-left: 18px; color: var(--text-2); }
.md-preview code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

.fn-head { display: flex; align-items: center; gap: 7px; }
.fn-num { display: grid; place-items: center; width: 19px; height: 19px; flex: none; border-radius: 50%; background: var(--brand); color: var(--brand-contrast); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.flow-edges .edge.flow { stroke: var(--border-strong); }
.flow-edges .edge.assoc { stroke: var(--brand-line); stroke-width: 1.3; stroke-dasharray: 4 4; opacity: 0.85; }

/* placement (role / method) cards */
.flow-node.placement { width: 168px; }
.flow-node.placement .pn-head { display: flex; align-items: center; gap: 6px; padding: 9px 12px 0; color: var(--text-3); }
.flow-node.placement .pn-kind { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.flow-node.placement .pn-name { padding: 4px 12px 11px; font-weight: 600; font-size: 12.5px; }
.flow-node.placement.role { border-color: color-mix(in srgb, var(--sev-low) 45%, var(--border-strong)); background: linear-gradient(180deg, var(--sev-low-bg), var(--surface) 60%); }
.flow-node.placement.role .pn-head { color: var(--sev-low); }
.flow-node.placement.method { border-color: var(--brand-line); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 60%); }
.flow-node.placement.method .pn-head { color: var(--brand); }
.flow-node.placement.selected { box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }

/* KPI cards */
.kpi-card .kpi-name { font-weight: 600; font-size: 14px; margin: 12px 0 8px; }
.kpi-value { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kpi-value > span:first-child { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.kpi-unit { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.kpi-target { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.kpi-bar { margin-top: 12px; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width 0.4s var(--ease); }
.kpi-bar-fill.warn { background: var(--warn); }
.kpi-bar-fill.bad { background: var(--err); }
.kpi-bar-fill.none { background: var(--border-strong); }
.kpi-status { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; }
.kpi-status.ok { color: var(--ok); background: var(--brand-soft); }
.kpi-status.warn { color: var(--warn); background: var(--sev-med-bg); }
.kpi-status.bad { color: var(--err); background: var(--sev-crit-bg); }
.kpi-status.none { color: var(--text-3); background: var(--surface-3); }
/* circular KPI status badge (green check / amber hazard / red cross) */
.kpi-badge { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 700; line-height: 1; flex: none; }
.kpi-badge .icn { stroke-width: 2.4; }
.kpi-badge.kpi-ok { background: var(--ok); }
.kpi-badge.kpi-warn { background: var(--warn); }
.kpi-badge.kpi-bad { background: var(--err); }
.kpi-badge.kpi-none { background: var(--text-3); }
.kpi-list td { vertical-align: middle; }
.kpi-list-name { font-weight: 600; font-size: 13px; }

/* governance activities + requirements */
.activity { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.activity + .activity { margin-top: 0; }
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.activity-title { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.activity-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; max-width: 70ch; line-height: 1.45; }
.req-list { display: flex; flex-direction: column; }
.req-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.req-row:last-child { border-bottom: none; }
.req-ref { flex: none; align-self: flex-start; margin-top: 1px; font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.req-main { flex: 1; min-width: 0; }
.req-text { font-size: 13px; line-height: 1.4; }
.req-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; }
.req-source { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.req-link { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-3); padding: 2px 9px; border-radius: 999px; }
.req-link .icn { color: var(--brand); }
.req-link.unlinked { color: var(--err); background: var(--sev-crit-bg); }
a.req-link.req-obligation { text-decoration: none; color: #2f6fae; background: color-mix(in srgb, #2f6fae 12%, transparent); border: 1px solid color-mix(in srgb, #2f6fae 30%, transparent); }
a.req-link.req-obligation .icn { color: #2f6fae; }
a.req-link.req-obligation:hover { background: color-mix(in srgb, #2f6fae 20%, transparent); }
.req-link.unlinked .icn { color: var(--err); }
.req-empty { padding: 14px 16px; font-size: 12.5px; color: var(--text-3); }

/* profile region & format */
.region-head { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 700; font-size: 13px; }
.region-head .icn { color: var(--brand); }
.region-detected { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.region-preview { display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; font-size: 12.5px; }
.region-preview .rp-label { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }

/* role catalogue */
.role-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 15px 16px; cursor: pointer; transition: box-shadow 0.14s, border-color 0.14s, transform 0.14s; display: flex; flex-direction: column; gap: 10px; }
.role-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.role-card-top { display: flex; align-items: center; gap: 11px; }
.role-ava { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.role-ava.agent { background: #ede7fb; color: #7c54e0; }
.role-ava.lg { width: 52px; height: 52px; border-radius: 14px; }
.role-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-dom { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.role-summary { font-size: 12.5px; color: var(--text-2); line-height: 1.45; flex: 1; }
.role-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-comp-count { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* competency matrix */
.cm-wrap { overflow-x: auto; }
.cmatrix { border-collapse: collapse; width: 100%; min-width: 560px; }
.cmatrix th, .cmatrix td { padding: 8px 10px; text-align: center; }
.cmatrix th.cm-comp, .cmatrix td.cm-comp { text-align: left; }
.cmatrix thead th { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 600; }
.cmatrix th.cm-lvl { white-space: nowrap; }
.cmatrix td.cm-comp { font-size: 12.5px; font-weight: 550; border-bottom: 1px solid var(--border); }
.cmatrix td.cm-cell { border-bottom: 1px solid var(--border); }
.cmatrix tr.cm-cat td { text-align: left; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand); padding-top: 14px; padding-bottom: 5px; font-weight: 700; }
.cm-dot { width: 30px; height: 26px; border: none; border-radius: 7px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; transition: transform 0.1s; }
.cm-dot:hover { transform: scale(1.12); }
.cm-dot.m0 { background: var(--surface-3); color: var(--text-3); }
.cm-dot.m1 { background: #e2efe8; color: #3a6a54; }
.cm-dot.m2 { background: #abd6c1; color: #134d36; }
.cm-dot.m3 { background: #5fae89; color: #fff; }
.cm-dot.m4 { background: var(--brand); color: var(--brand-contrast); }
.cm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.cm-legend-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.cm-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.cm-legend-item .cm-dot { width: 22px; height: 20px; cursor: default; }
.cm-legend-item .cm-dot:hover { transform: none; }

/* AI agent role config */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; }
.agent-kv { display: flex; flex-direction: column; gap: 4px; }
.agent-k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.agent-v { font-size: 13.5px; color: var(--text); font-weight: 550; }

/* standards & regulations overview */
.std-kind { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin: 18px 0 8px; }
.std-kind:first-child { margin-top: 2px; }
.std-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.std-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background 0.12s; }
.std-row:last-child { border-bottom: none; }
.std-row:hover { background: var(--surface-2); }
.std-code { flex: none; min-width: 132px; font-weight: 600; color: var(--brand); font-size: 12.5px; }
.std-main { flex: 1; min-width: 0; }
.std-title { font-size: 13px; font-weight: 550; }
.std-draft { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--warn); background: var(--sev-med-bg); padding: 1px 6px; border-radius: 5px; margin-left: 8px; vertical-align: middle; }
.std-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.std-reqs { flex: none; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.std-chev { color: var(--text-3); font-size: 18px; flex: none; }
.aud-pct { font-size: 11px; color: var(--text-2); min-width: 36px; text-align: right; flex: none; }

/* requirements-management outline (standard detail) */
.rm-list { display: flex; flex-direction: column; }
.rm-header { display: flex; align-items: center; gap: 10px; padding: 11px 4px 7px; border-bottom: 1px solid var(--border); }
.rm-header.lvl1 { margin-top: 4px; }
.rm-header.lvl2, .rm-header.lvl3 { padding-left: 14px; }
.rm-header .rm-clause { flex: none; font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; }
.rm-header .rm-htext { font-weight: 700; font-size: 13.5px; letter-spacing: -0.01em; }
.rm-header.lvl1 .rm-htext { font-size: 14.5px; }
.rm-header .rm-acts, .rm-info .rm-acts { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s; }
.rm-header:hover .rm-acts, .rm-info:hover .rm-acts { opacity: 1; }
.rm-info { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px 8px 24px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.rm-info .rm-ref { flex: none; font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }
.rm-info .rm-main { flex: 1; min-width: 0; }
.rm-info .rm-text { font-size: 12.5px; line-height: 1.45; }
.rm-info .rm-tag { flex: none; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; margin-top: 1px; }
.rm-req { padding-left: 24px; }
.rm-req .req-ref { background: var(--brand-soft); }
.rm-opts { width: 30px; height: 30px; flex: none; border: 1px solid transparent; background: transparent; color: var(--text-3); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.rm-opts:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.toast-action { margin-left: 12px; border: 1px solid var(--border-strong); background: transparent; color: var(--brand); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 7px; cursor: pointer; }
.toast-action:hover { background: var(--brand-soft); }

/* requirements table view */
.rm-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rm-count { font-size: 11.5px; margin-bottom: 8px; }
.rm-table th.rm-optcol { width: 40px; }
.rm-table .rm-c-ref { color: var(--brand); font-weight: 600; white-space: nowrap; }
.rm-table .rm-c-clause { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.rm-table .rm-c-text { min-width: 280px; }
.rm-table .rm-c-headertext { font-weight: 700; }
.rm-table td { vertical-align: top; }
.rm-typetag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.rm-typetag.requirement { color: var(--brand); background: var(--brand-soft); }
.rm-typetag.header { color: var(--text-2); background: var(--surface-3); }
.rm-typetag.information { color: var(--text-3); background: var(--surface-3); }

/* policy document */
.policy-doc { display: flex; flex-direction: column; gap: 14px; }
.pb-block { padding: 4px 0; border-radius: 8px; }
.pb-block:hover { background: var(--surface-2); }
.pb-head { display: flex; align-items: flex-start; gap: 10px; padding: 4px 8px; }
.pb-htext { flex: 1; font-weight: 700; letter-spacing: -0.01em; }
.pb-htext.h1 { font-size: 22px; margin-top: 8px; }
.pb-htext.h2 { font-size: 17px; margin-top: 6px; }
.pb-htext.h3 { font-size: 14.5px; }
.pb-ptext { flex: 1; margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.pb-acts { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; flex: none; }
.pb-block:hover .pb-acts { opacity: 1; }
.pb-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 8px 8px 8px; }
.pb-link { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line); padding: 2px 9px; border-radius: 999px; text-decoration: none; cursor: pointer; }
.pb-link:hover { background: var(--brand); color: var(--brand-contrast); }
.pb-link:hover .icn { color: var(--brand-contrast); }
.pb-linkrow { gap: 8px; }
.drawer-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.pb-addlink { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 4px; }

/* policy → activity sections */
.policy-acts { display: flex; flex-direction: column; gap: 14px; }
.pa-section { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.pb-block.pa-section { padding: 0; }
.pb-block.pa-section:hover { background: var(--surface); }
.pa-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pa-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.pa-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; max-width: 70ch; line-height: 1.45; }

/* traceability graph */
.tg-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tg-leg { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.tg-leg.off { opacity: 0.45; text-decoration: line-through; }
.tg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.tg-layout { display: grid; grid-template-columns: 1fr 280px; gap: 14px; align-items: start; }
.tg-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: radial-gradient(circle at 50% 38%, var(--surface), var(--surface-2)); max-height: 640px; }
.tg-stage { position: relative; }
.tg-svg { position: absolute; inset: 0; pointer-events: none; }
.tg-svg .tg-edge { stroke: var(--border-strong); stroke-width: 1.4; opacity: 0.55; fill: none; }
.tg-svg .tg-edge.on { stroke: var(--brand); stroke-width: 2; opacity: 0.95; }
.tg-svg .tg-edge.off { opacity: 0.06; }
.tg-lane-h { position: absolute; top: 0; text-align: center; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; padding-top: 6px; }
.tg-node { position: absolute; transform: translateX(-50%); box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 8px 11px; border-radius: 13px; border: 1.5px solid var(--c); background: var(--surface); cursor: pointer; box-shadow: var(--shadow-sm); text-align: left; transition: opacity 0.12s, box-shadow 0.12s; }
.tg-node .tg-type { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c); font-weight: 700; }
.tg-node .tg-nrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tg-node .tg-nrow .icn { color: var(--c); flex: none; }
.tg-node .tg-label { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-doms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tg-dom { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; color: #0d9488; background: color-mix(in srgb, #0d9488 12%, transparent); border-radius: 5px; padding: 1px 5px; max-width: 100%; }
.tg-dom .icn { color: #0d9488; }
.tg-roles { position: absolute; right: 6px; bottom: -11px; display: flex; }
.tg-role { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 8.5px; font-weight: 700; color: #fff; border: 2px solid var(--surface); margin-left: -8px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.1s; }
.tg-role:first-child { margin-left: 0; }
.tg-role:hover { transform: translateY(-2px); z-index: 20 !important; }
.tg-role.human { background: linear-gradient(150deg, #475569, #64748b); }
.tg-role.ai { background: linear-gradient(150deg, #8a5cf6, #a855f7); }
.tg-role.ai .icn { color: #fff; }
.tg-role.more { background: var(--surface-3); color: var(--text-2); }
.tg-methods { position: absolute; left: 6px; bottom: -11px; display: flex; }
.tg-method { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 8.5px; font-weight: 800; letter-spacing: 0.02em; color: #fff; border: 2px solid var(--surface); margin-left: -7px; box-shadow: var(--shadow-sm); cursor: pointer; background: linear-gradient(150deg, #9333ea, #c084fc); transition: transform 0.1s; }
.tg-method:first-child { margin-left: 0; }
.tg-method:hover { transform: translateY(-2px); z-index: 20 !important; }
.tg-method.more { background: var(--surface-3); color: var(--text-2); }
.tg-node:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 16%, transparent); }
.tg-node.sel { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent); border-width: 2px; z-index: 6; }
.tg-node.adj { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); z-index: 5; }
.tg-node.dim { opacity: 0.22; }
.tg-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.tg-crumbs a { color: var(--brand); font-weight: 600; text-decoration: none; }
.tg-crumb-cur { color: var(--text); font-weight: 600; }
.tg-detail { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); position: sticky; top: 12px; }
.tg-d-head { display: flex; gap: 10px; align-items: center; }
.tg-d-ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex: none; }
.tg-d-type { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.tg-d-name { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.tg-d-sub { font-size: 11.5px; color: var(--text-3); margin: 12px 0 6px; }
.tg-d-list { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow: auto; }
.tg-d-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; }
.tg-d-item:hover { background: var(--surface-2); }
.tg-d-itext { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-d-itype { font-size: 10px; color: var(--text-3); flex: none; }
@media (max-width: 900px) { .tg-layout { grid-template-columns: 1fr; } }

/* version control */
.ver-list { display: flex; flex-direction: column; }
.ver-row { display: flex; align-items: flex-start; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.ver-row:last-child { border-bottom: none; }
.ver-hash { flex: none; font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; margin-top: 1px; }
.ver-main { min-width: 0; }
.ver-msg { font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.ver-head { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; color: var(--brand); border: 1px solid var(--brand-soft); background: var(--brand-soft); padding: 1px 6px; border-radius: 5px; }
.ver-meta { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 3px; }
.diff { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; max-height: 54vh; overflow: auto; padding: 6px 0; }
.diff-line { padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff-line.add { background: rgba(21, 114, 78, 0.12); color: #14533a; }
.diff-line.del { background: var(--sev-crit-bg); color: var(--err); }
.diff-line.same { color: var(--text-3); }
.diff-gap { padding: 3px 12px; margin: 2px 0; color: var(--text-3); font-size: 10.5px; background: var(--surface-3); text-align: center; }

/* spec catalogue (Admin → Industry) */
.region-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.region-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.region-chip:hover { background: var(--surface-2); }
.region-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.spec-card-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px; background: none; border: none; cursor: pointer; text-align: left; }
.spec-card-head h3 { margin: 0; font-size: 15px; }
.spec-head-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.spec-chev { margin-left: auto; color: var(--text-3); transition: transform 0.15s; }
.spec-card-head.collapsed .spec-chev { transform: rotate(-90deg); }
.spec-table-wrap { overflow-x: auto; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.spec-table th { text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 0 12px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.spec-table th.sortable { cursor: pointer; user-select: none; }
.spec-table th.sortable:hover { color: var(--text); }
.spec-table th.sorted { color: var(--brand); }
.spec-table .sort-ar { margin-left: 4px; }
.spec-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.spec-table tbody tr:last-child td { border-bottom: none; }
.spec-table tbody tr:hover { background: var(--surface-2); }
.spec-table td.spec-cb, .spec-table th.spec-cb { width: 34px; padding-right: 0; }
.spec-cb-wrap { display: inline-flex; }
.spec-table input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }
.spec-table .spec-code { font-weight: 600; color: var(--brand); white-space: nowrap; }
.spec-table .spec-title { color: var(--text); }
.spec-table .spec-group-cell { color: var(--text-2); white-space: nowrap; }

/* domain icon picker */
.icon-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-choice { width: 44px; height: 44px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: transform 0.1s, border-color 0.12s; }
.icon-choice:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.icon-choice.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

/* requirement → proof traceability map */
.trace-head { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.trace-wrap { overflow-x: auto; padding-bottom: 4px; }
.trace-map { position: relative; }
.trace-lines { position: absolute; inset: 0; pointer-events: none; }
.trace-lines path { fill: none; stroke-width: 2; }
.tl-verified { stroke: var(--ok); } .tl-linked { stroke: var(--warn); } .tl-draft { stroke: var(--text-3); }
.trace-node { position: absolute; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 0 12px; display: flex; align-items: center; gap: 9px; box-shadow: var(--shadow-sm); }
.trace-node.req.unlinked { border-color: var(--err); }
.trace-node.target { border-color: var(--brand-soft); background: var(--surface-2); }
.trace-node .icn { color: var(--brand); flex: none; }
.trace-ref { flex: none; font-size: 10px; color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 5px; }
.trace-text { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.trace-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-left: auto; }
.trace-dot.ok { background: var(--ok); } .trace-dot.warn { background: var(--warn); } .trace-dot.none { background: var(--text-3); }
.trace-legend { display: flex; gap: 16px; align-items: center; margin-top: 14px; font-size: 11.5px; color: var(--text-3); }
.tl-key { display: inline-flex; align-items: center; gap: 6px; }
.tl-key::before { content: ''; width: 16px; height: 3px; border-radius: 2px; }
.tl-key.verified::before { background: var(--ok); } .tl-key.linked::before { background: var(--warn); } .tl-key.draft::before { background: var(--text-3); }

/* canvas wrap + zoom + add */
.flow-canvas-wrap { position: relative; }
.flow-sizer { transform-origin: 0 0; }
.flow-add { position: absolute; top: 12px; right: 12px; z-index: 6; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-contrast); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; }
.flow-add:hover { background: var(--brand-hover); }
.zoom-ctrl { display: inline-flex; align-items: center; gap: 5px; }
.zbtn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; line-height: 1; }
.zbtn:hover { background: var(--surface-3); }
.zoom-label { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); min-width: 42px; text-align: center; }
textarea.input { resize: vertical; line-height: 1.55; }

/* step node becomes a positioning container; .fn-card is the visible box */
.flow-node.step { background: transparent; border: none; box-shadow: none; width: 196px; }
.flow-node.step:hover { border: none; }
.fn-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-sm); }
.flow-node.step.selected { box-shadow: none; }
.flow-node.step.selected .fn-card { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.flow-node.step.connect-target .fn-card { border-style: dashed; border-color: var(--brand); }
.flow-node.step.connect-source .fn-card { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.flow-node.step .fn-head { padding: 10px 12px; }
.flow-node.step .fn-chips { padding: 0 12px 10px; }

/* role orb (left) + method attach (right) */
.role-orb { position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 16px; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; pointer-events: none; }
.role-orb .orb-ini { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--brand-contrast); background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #7bdcb1)); box-shadow: var(--shadow-sm); }
.role-orb.human .orb-ini { background: linear-gradient(150deg, var(--sev-low), color-mix(in srgb, var(--sev-low) 60%, #9ec3e6)); color: #fff; }
.role-orb .orb-name { font-size: 9.5px; line-height: 1.15; color: var(--text-2); max-width: 68px; }
.method-attach { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 16px; display: flex; align-items: center; gap: 6px; max-width: 150px; padding: 7px 10px; border-radius: 8px; background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand); font-size: 11px; pointer-events: none; }
.method-attach span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* trigger node */
.flow-node.trigger { width: 188px; background: linear-gradient(180deg, var(--sev-med-bg), var(--surface) 65%); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border-strong)); border-radius: 10px; box-shadow: var(--shadow-sm); padding: 10px 13px; }
.flow-node.trigger .tn-head { display: flex; align-items: center; gap: 6px; color: var(--warn); }
.tn-kind { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.tn-name { font-weight: 600; font-size: 13px; margin-top: 5px; }
.tn-type { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.flow-node.trigger.off { opacity: 0.6; }
.flow-node.trigger.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }

/* decision step + step output footer */
.fn-dec { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warn); background: var(--sev-med-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 4px; padding: 1px 5px; }
.flow-node.step.decision .fn-card { border-color: color-mix(in srgb, var(--warn) 50%, var(--border-strong)); background: linear-gradient(180deg, var(--sev-med-bg), var(--surface) 55%); }
.fn-output { display: flex; align-items: center; gap: 5px; padding: 7px 12px; border-top: 1px dashed var(--border); color: var(--text-2); font-size: 11px; }
.fn-output > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn-metric-badge { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 5px; padding: 0 5px; }
.flow-edges .edge-label-bg { fill: var(--surface); stroke: var(--border); }

/* project dashboard */
.level-badge { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 6px; color: var(--sev-low); background: var(--sev-low-bg); border: 1px solid color-mix(in srgb, var(--sev-low) 30%, transparent); white-space: nowrap; }
.manage-list { display: flex; flex-direction: column; }
.manage-row { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.manage-row:last-child { border-bottom: none; }
.metric-row { display: grid; grid-template-columns: 1fr 72px 60px auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.output-editor { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }

/* process list pills */
.proc-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.proc-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s var(--ease); }
.proc-pill:hover { border-color: var(--text-3); color: var(--text); }
.proc-pill.active { border-color: var(--brand); color: var(--text); background: var(--brand-soft); }
.proc-pill .proc-count { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.proc-pill.active .proc-count { color: var(--brand); border-color: var(--brand-line); background: transparent; }

/* subprocess (process-reference) step */
.flow-node.step.subprocess .fn-card { border-style: dashed; border-color: color-mix(in srgb, var(--sev-low) 55%, var(--border-strong)); background: linear-gradient(180deg, var(--sev-low-bg), var(--surface) 60%); }
.fn-sub-badge { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sev-low); background: var(--sev-low-bg); border: 1px solid color-mix(in srgb, var(--sev-low) 35%, transparent); border-radius: 4px; padding: 1px 5px; }
.fn-subref { display: flex; align-items: center; gap: 5px; padding: 8px 12px; color: var(--sev-low); font-size: 12px; font-weight: 600; cursor: pointer; }
.fn-subref:hover { text-decoration: underline; }

/* sidebar new-alert badge + domain tabs spacing */
.nav-alert { margin-left: auto; min-width: 19px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-family: var(--font-mono); font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 18%, transparent); }
.domain-tabs { margin-top: 2px; }
.model-link { color: var(--text); cursor: pointer; }
.model-link:hover { color: var(--brand); text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.back-link:hover { color: var(--brand); }

/* ===== Connector marketplace ===== */
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.cat-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all 0.15s var(--ease); }
.cat-chip:hover { color: var(--text); border-color: var(--text-3); }
.cat-chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.cat-count { font-family: var(--font-mono); font-size: 10.5px; opacity: 0.7; }
.cat-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.cat-section-head h3 { font-size: 15px; }
.cat-section-head .cat-sub { color: var(--text-3); font-size: 12.5px; flex: 1; }
.cat-section-head .cat-n { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.app-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.app-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.app-top { display: flex; align-items: center; gap: 11px; }
.app-logo { width: 38px; height: 38px; flex: none; border-radius: 9px; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); }
.app-logo.evsec, .app-logo.github, .app-logo.jira, .app-logo.manual { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.app-logo.img { background: #fff; padding: 0; overflow: hidden; }
.app-logo.img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; display: block; }

/* support button + modal rows */
.support-btn { display: inline-flex; align-items: center; gap: 6px; }
.support-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.support-row:hover { border-color: var(--brand-line); background: var(--surface-2); }

/* documentation */
.docs-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.docs-nav { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.docs-nav-item { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; }
.docs-nav-item:hover { background: var(--surface-3); color: var(--text); }
.docs-nav-item.active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.doc-content { font-size: 14px; line-height: 1.6; }
.doc-content h2 { font-size: 22px; margin: 4px 0 12px; letter-spacing: -0.02em; }
.doc-content h3 { font-size: 16px; margin: 22px 0 8px; }
.doc-content h4 { font-size: 13px; margin: 16px 0 6px; color: var(--text-2); }
.doc-content p { margin: 10px 0; color: var(--text); }
.doc-content ul { margin: 10px 0; padding-left: 20px; color: var(--text); }
.doc-content li { margin: 4px 0; }
.doc-content strong { font-weight: 700; }
.doc-content code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 860px) { .docs-wrap { grid-template-columns: 1fr; } .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; } }
.app-name { font-weight: 650; font-size: 14px; }
.app-vendor { font-size: 11.5px; color: var(--text-3); }
.app-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.5; margin: 12px 0 14px; flex: 1; }
.app-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; }
.app-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.app-status.available { color: var(--sev-low); }
.app-status.available::before { background: var(--sev-low); }
.app-status.setup { color: var(--warn); }
.app-status.setup::before { background: var(--warn); }
.app-status.connected { color: var(--brand); }
.app-status.connected::before { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ===== General tooling slot rows ===== */
.gtool-row { display: grid; grid-template-columns: 36px 1fr minmax(220px, 320px) auto; gap: 14px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.gtool-row:last-child { border-bottom: none; }
.gtool-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--surface-3); color: var(--brand); display: grid; place-items: center; flex: none; }
.gtool-main { min-width: 0; }
.gtool-title { font-weight: 650; font-size: 13.5px; }
.gtool-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.gtool-pick { min-width: 0; }
.gtool-status { white-space: nowrap; font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.gtool-static { padding: 7px 12px; font-size: 13px; font-weight: 550; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.gtool-static.muted { color: var(--text-3); font-weight: 500; font-style: italic; }
.migration-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.migration-list li { margin-bottom: 4px; }
@media (max-width: 880px) { .gtool-row { grid-template-columns: 36px 1fr; row-gap: 8px; } .gtool-pick, .gtool-status { grid-column: 1 / -1; } }

/* ===== Asset hierarchy ===== */
.hier-list { display: flex; flex-direction: column; gap: 8px; }
.hier-row { display: flex; align-items: center; gap: 8px; }
.bom-badge { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.bom-badge.top { color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line); }
.bom-badge.sbom { color: #2f7ed8; background: rgba(47, 126, 216, 0.12); border: 1px solid rgba(47, 126, 216, 0.3); }
.bom-badge.hbom { color: #b5791f; background: var(--sev-med-bg); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.bom-badge.cbom { color: #8a5cf6; background: rgba(138, 92, 246, 0.12); border: 1px solid rgba(138, 92, 246, 0.3); }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 24px; position: relative; }
.tree { padding-left: 4px; }
.tree li { position: relative; padding: 5px 0; }
.tree ul li::before { content: ''; position: absolute; left: -13px; top: -5px; height: 22px; width: 13px; border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-bottom-left-radius: 7px; }
.tree ul li:not(:last-child)::after { content: ''; position: absolute; left: -13px; top: -5px; bottom: -5px; border-left: 1px solid var(--border-strong); }
.tree-node { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 13px; }
.tree-node .tn-label { font-weight: 600; }

/* horizontal flow: role orb on top, method card on bottom of each step */
.flow-node.step.h .role-orb { right: auto; left: 50%; top: auto; bottom: 100%; transform: translateX(-50%); margin: 0 0 14px 0; }
.flow-node.step.h .method-attach { left: 50%; right: auto; top: 100%; transform: translateX(-50%); margin: 14px 0 0 0; }

@media (max-width: 1080px) { .flow-wrap { grid-template-columns: 1fr; } .inspector { position: static; max-height: none; } }

/* ===== Responsive ===== */
@media (max-width: 920px) {
  .app { grid-template-columns: 72px 1fr; }
  .brand-text, .nav-item .ni-label, .nav-group-label, .avatar-meta { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .brand { justify-content: center; padding: 4px 0 18px; }
  .canvas { padding: 22px 16px 48px; }
}

/* ===== Spinner — small inline loading indicator ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spinner-rot 0.8s linear infinite;
  vertical-align: -3px;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spinner-rot { to { transform: rotate(360deg); } }

/* ===== Login screen =====
   Shown when /api/me returns 401 at boot. Replaces the app shell with a
   centered sign-in card. Same brand language as the sidebar wordmark. */
body.login-mode {
  background:
    radial-gradient(60% 60% at 30% 18%, var(--brand-soft) 0%, transparent 65%),
    radial-gradient(50% 50% at 80% 90%, var(--brand-soft) 0%, transparent 70%),
    var(--bg);
}
body.login-mode .app { display: none; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface, #fff);
  border: 1px solid var(--brand-line);
  border-radius: 14px;
  padding: 38px 36px 30px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.04);
  text-align: center;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  color: var(--brand);
  margin-bottom: 22px;
}
.login-wordmark { text-align: left; line-height: 1.05; }
.login-name { font-weight: 800; font-size: 20px; letter-spacing: 0.02em; color: var(--text); }
.login-sub  { font-weight: 600; font-size: 10px; letter-spacing: 0.22em; color: var(--text-2); }
.login-title {
  margin: 4px 0 6px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
}
.login-tag {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
}
.login-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-3);
}
