/* Aperio by EMAX Solutions — design tokens (palette from emax.mt) */
:root {
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --font-display: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Helvetica, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;

  /* EMAX brand colours */
  --emax-sky: #4ad1f6;
  --emax-charcoal: #4f5759;
  --emax-navy: #171e31;
  --emax-green: #20c997;

  --bg: #f6f6f6;
  --surface: #ffffff;
  --surface-2: #f9fafa;
  --surface-3: #eaeced;
  --border: #dcdfe1;
  --border-strong: #c4c9cc;
  --text: #212529;
  --text-2: #4f5759;
  --text-3: #7a8285;
  /* Sky blue is too light for text on white, so actions use a deeper shade of it. */
  --accent: #086e93;
  --accent-hover: #065a79;
  --accent-ink: #ffffff;
  --accent-soft: #e1f6fd;
  --accent-text: #075f80;
  --focus: #1aa9d4;

  --nav-bg: #ffffff;
  --nav-border: #dcdfe1;
  --nav-text: #3b4245;
  --nav-text-dim: #737b7e;
  --nav-hover: #eff1f2;
  --nav-hover-text: #171e31;
  --nav-active-bg: #e1f6fd;
  --nav-active: #075f80;
  --nav-indicator: #086e93;
  /* Toasts and the selection bar stay dark in both themes. */
  --ink-bg: #171e31;

  /* Connection map: one colour per kind of item */
  --k-asset: #086e93; --k-person: #157a5c; --k-role: #6a4fb0; --k-process: #b4471f;
  --k-service: #2f62a0; --k-provider: #4f5759; --k-location: #9a6209; --k-customer: #171e31;

  --ok: #157a5c;       --ok-bg: #ddf5ec;
  --warn: #9a6209;     --warn-bg: #fbf0d9;
  --serious: #b4471f;  --serious-bg: #fbe7de;
  --danger: #b3261e;   --danger-bg: #fbe4e2;
  --info: #2f62a0;     --info-bg: #e3ecf7;
  --muted-bg: #eceeef;

  --radius-s: 4px;
  --radius: 4px;
  --radius-l: 8px;
  --shadow-pop: 0 10px 30px rgba(23, 30, 49, .16), 0 2px 6px rgba(23, 30, 49, .08);
  --row-h: 40px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1422; --surface: #161d2e; --surface-2: #1a2235; --surface-3: #20293e; --border: #29334a;
    --border-strong: #3a4560; --text: #e3e7ee; --text-2: #a6aec0; --text-3: #737d93;
    --accent: #4ad1f6; --accent-hover: #74dcf8; --accent-ink: #0b1a24; --accent-soft: #10303d; --accent-text: #6fdaf8; --focus: #74dcf8;
    --nav-bg: #0b1020; --nav-border: #1a2236; --nav-hover: #151c2e; --nav-active-bg: #1b2640;
    --nav-text: #c3c9d6; --nav-text-dim: #8790a6; --nav-hover-text: #ffffff; --nav-active: #ffffff; --nav-indicator: #4ad1f6; --ink-bg: #0b1020;
    --ok: #3fd3a6; --ok-bg: #0f3329; --warn: #e0a43a; --warn-bg: #352812; --serious: #ec8a5f; --serious-bg: #3a2016;
    --danger: #f07b72; --danger-bg: #3b1a18; --info: #79a6dc; --info-bg: #172a40; --muted-bg: #1f283b;
    --shadow-pop: 0 12px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
    --k-asset: #4ad1f6; --k-person: #3fd3a6; --k-role: #b39cf0; --k-process: #f0956b; --k-service: #7fb0ec; --k-provider: #b5bcc9; --k-location: #e5b45a; --k-customer: #e3e7ee;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --k-asset: #4ad1f6; --k-person: #3fd3a6; --k-role: #b39cf0; --k-process: #f0956b; --k-service: #7fb0ec; --k-provider: #b5bcc9; --k-location: #e5b45a; --k-customer: #e3e7ee;
  --bg: #0f1422; --surface: #161d2e; --surface-2: #1a2235; --surface-3: #20293e; --border: #29334a;
  --border-strong: #3a4560; --text: #e3e7ee; --text-2: #a6aec0; --text-3: #737d93;
  --accent: #4ad1f6; --accent-hover: #74dcf8; --accent-ink: #0b1a24; --accent-soft: #10303d; --accent-text: #6fdaf8; --focus: #74dcf8;
  --nav-bg: #0b1020; --nav-border: #1a2236; --nav-hover: #151c2e; --nav-active-bg: #1b2640;
    --nav-text: #c3c9d6; --nav-text-dim: #8790a6; --nav-hover-text: #ffffff; --nav-active: #ffffff; --nav-indicator: #4ad1f6; --ink-bg: #0b1020;
  --ok: #3fd3a6; --ok-bg: #0f3329; --warn: #e0a43a; --warn-bg: #352812; --serious: #ec8a5f; --serious-bg: #3a2016;
  --danger: #f07b72; --danger-bg: #3b1a18; --info: #79a6dc; --info-bg: #172a40; --muted-bg: #1f283b;
  --shadow-pop: 0 12px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--nav-bg) 236px, transparent 236px); }
.shell.collapsed { grid-template-columns: 64px 1fr; background: linear-gradient(to right, var(--nav-bg) 64px, transparent 64px); }
.nav {
  background: var(--nav-bg); color: var(--nav-text); border-right: 1px solid var(--nav-border);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; z-index: 30;
}
.brand { display: flex; flex-direction: column; justify-content: center; gap: 5px; height: 76px; padding: 0 20px; color: var(--nav-active); flex: none; text-decoration: none; border-bottom: 1px solid var(--nav-border); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; align-self: flex-start; }
.brand-logo.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo.on-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo.on-dark { display: block; }
}
:root[data-theme="dark"] .brand-logo.on-light { display: none; }
:root[data-theme="dark"] .brand-logo.on-dark { display: block; }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 7px; display: none; }
.brand-name { font: 700 13.5px/1 var(--font-display); letter-spacing: .24em; text-transform: uppercase; color: var(--nav-indicator, #4ad1f6); white-space: nowrap; padding-left: 2px; }
.shell.collapsed .brand { padding: 0; align-items: center; }
.shell.collapsed .brand-logo { display: none; }
.shell.collapsed .brand-mark { display: block; }
.nav-list { list-style: none; margin: 6px 0 0; padding: 0 10px; flex: 1; overflow-y: auto; }
.nav-group { margin: 18px 10px 6px; color: var(--nav-text-dim); font-size: 12px; white-space: nowrap; }
.nav-item a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: var(--radius);
  color: var(--nav-text); white-space: nowrap; text-decoration: none; position: relative;
}
.nav-item a:hover { background: var(--nav-hover); color: var(--nav-hover-text); }
.nav-item a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active); }
.nav-item a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--nav-indicator, var(--accent)); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--nav-text-dim); font-variant-numeric: tabular-nums; }
.nav-foot { padding: 10px; border-top: 1px solid var(--nav-border); display: flex; flex-direction: column; gap: 2px; }
.nav-foot button {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius);
  color: var(--nav-text); cursor: pointer; white-space: nowrap; text-align: left;
}
.nav-foot button:hover { background: var(--nav-hover); color: var(--nav-hover-text); }
.shell.collapsed .brand-name, .shell.collapsed .nav-label, .shell.collapsed .nav-group, .shell.collapsed .count { display: none; }
.shell.collapsed .nav-item a, .shell.collapsed .nav-foot button { justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.menu-btn { display: none; }
.search-trigger {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-3); cursor: text; text-align: left;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; }
.search-trigger > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
kbd { font: 11.5px var(--mono); padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); background: var(--surface); }
.scope { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--text-2); font-size: 13px; }
.scope select { min-width: 190px; }
.content { padding: 24px 28px 48px; max-width: 1560px; width: 100%; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font: 600 24px/1.2 var(--font-display); letter-spacing: -.015em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-2); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  font-weight: 500; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.input, select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  min-width: 0;
}
select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2376838f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon svg { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 32px; width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section { margin: 22px 0 10px; font: 600 13.5px var(--font); color: var(--text); display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-section:first-child { margin-top: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.error-text { color: var(--danger); font-size: 13px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.panel-head h2 { font: 600 14.5px/1.3 var(--font); margin: 0; }
.panel-head .sub { color: var(--text-3); font-size: 13px; }
.panel-head .more { margin-left: auto; font-size: 13px; }
.panel-body { padding: 14px 18px 18px; }
.panel-body.flush { padding: 8px 0 4px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: 1.35fr repeat(4, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); margin-bottom: 20px; overflow: hidden; }
.kpi { padding: 16px 20px 18px; border-left: 1px solid var(--border); color: inherit; text-decoration: none; display: block; position: relative; }
button.kpi { background: none; border: 0; border-left: 1px solid var(--border); text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.kpi:first-child { border-left: 0; }
.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi .k-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font: 600 30px/1.1 var(--font-display); letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi:first-child .k-value { font-size: 38px; }
.kpi .k-note { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.kpi.alert .k-value { color: var(--serious); }
.kpi.warn .k-value { color: var(--warn); }
.kpi .k-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.dash .c-4 { grid-column: span 4; } .dash .c-5 { grid-column: span 5; } .dash .c-6 { grid-column: span 6; }
.dash .c-7 { grid-column: span 7; } .dash .c-8 { grid-column: span 8; } .dash .c-12 { grid-column: span 12; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 34%) 1fr 46px; align-items: center; gap: 12px; font-size: 13px; color: inherit; text-decoration: none; border-radius: 4px; }
a.bar-row:hover { text-decoration: none; }
a.bar-row:hover .bar-label { color: var(--accent-text); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 10px; background: transparent; position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.bar-fill.ok { background: var(--ok); } .bar-fill.warn { background: var(--warn); } .bar-fill.serious { background: var(--serious); }
.bar-fill.danger { background: var(--danger); } .bar-fill.muted { background: var(--border-strong); }

.seg { display: flex; height: 14px; gap: 2px; margin: 4px 0 14px; }
.seg span { border-radius: 2px; min-width: 3px; }
.seg span:first-child { border-radius: 4px 2px 2px 4px; }
.seg span:last-child { border-radius: 2px 4px 4px 2px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; font-size: 13px; }
.legend a { display: flex; align-items: center; gap: 8px; color: var(--text-2); text-decoration: none; }
.legend a:hover { color: var(--text); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; padding: 7px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 22px; bottom: -8px; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 9px; height: 9px; border-radius: 50%; margin: 6px 0 0 3px; background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface); }
.timeline .dot.create { background: var(--ok); } .timeline .dot.update { background: var(--info); } .timeline .dot.delete { background: var(--danger); }
.timeline .dot.import { background: var(--accent); } .timeline .dot.relate { background: var(--warn); }
.timeline .t-sum { font-size: 13.5px; }
.timeline .t-meta { font-size: 12.5px; color: var(--text-3); }
.timeline .t-changes { margin: 6px 0 2px; font-size: 12.5px; color: var(--text-2); display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
.timeline .t-changes del { color: var(--text-3); }

/* ---------- tables ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .spacer { flex: 1; }
.filter-btn { position: relative; }
.filter-btn.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; border: 0; cursor: pointer; }
.chip svg { width: 13px; height: 13px; }
.chip.plain { background: none; color: var(--text-2); padding: 0 8px; }
.chip:hover { filter: brightness(.97); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.grid th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-2);
  padding: 0 12px; height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1;
}
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { color: var(--text); }
.grid th .sort { display: inline-block; width: 12px; color: var(--accent-text); }
.grid td { padding: 0 12px; height: var(--row-h); border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr.clickable { cursor: pointer; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tbody tr.selected td { background: var(--accent-soft); }
.grid .col-check { width: 40px; padding: 0 0 0 14px; }
.grid .col-check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; vertical-align: middle; cursor: pointer; }
.grid td.wrap { white-space: normal; }
.grid .right { text-align: right; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); }
.cell-2 { line-height: 1.25; padding-top: 4px; padding-bottom: 4px; }
.table-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); background: var(--surface); }
.table-foot .pager { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.table-foot select { height: 28px; font-size: 13px; }
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty h3 { font: 600 16px var(--font); color: var(--text); margin: 12px 0 4px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; }
.empty .e-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty .e-icon svg { width: 22px; height: 22px; }

.bulkbar {
  position: sticky; bottom: 16px; z-index: 15; margin: 12px auto 0; width: max-content; max-width: 100%; display: flex; align-items: center; gap: 8px;
  background: var(--ink-bg); color: #fff; padding: 8px 8px 8px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); flex-wrap: wrap;
}
.bulkbar .btn { background: transparent; color: #fff; border-color: #ffffff30; }
.bulkbar .btn:hover { background: #ffffff14; }
.bulkbar .btn.danger { color: #ffb3ab; }

/* ---------- pills & tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--muted-bg); color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.serious { background: var(--serious-bg); color: var(--serious); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }

/* The asset tag: a printed label, the one thing this app owns visually. */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 7px 0 9px; font: 500 12px/1 var(--mono); letter-spacing: .02em;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 3px; position: relative; white-space: nowrap;
}
.tag::before { content: ""; width: 3px; align-self: stretch; margin: 3px 7px 3px -5px; border-radius: 1px;
  background: repeating-linear-gradient(to bottom, var(--text-2) 0 1px, transparent 1px 2.5px); opacity: .7; }
.type-ico { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); flex: none; }
.type-ico svg { width: 15px; height: 15px; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 11px; font-weight: 600; color: #fff; flex: none; letter-spacing: .02em; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* ---------- asset detail ---------- */
.detail-head { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 18px 20px; margin-bottom: 20px; }
.detail-head h1 { font: 600 24px/1.2 var(--font-display); margin: 0 0 6px; letter-spacing: -.015em; word-break: break-word; }
.detail-head .meta { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: 13.5px; }
.detail-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.label-card {
  width: 236px; background: #fff; color: #111; border: 1px solid #c9d0d6; border-radius: 6px; padding: 9px 12px 8px;
  box-shadow: 0 1px 0 #00000010, inset 0 0 0 3px #fff, inset 0 0 0 4px #e6eaed; position: relative;
}
.label-card .l-top { display: flex; justify-content: space-between; font-size: 10px; color: #555; letter-spacing: .01em; }
.label-card .l-tag { font: 600 17px/1.1 var(--mono); letter-spacing: .06em; margin: 3px 0 4px; }
.label-card svg.barcode { width: 100%; height: 40px; display: block; }
.label-card .l-foot { font-size: 9.5px; color: #666; margin-top: 3px; display: flex; justify-content: space-between; gap: 8px; }
.label-card .l-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
dl.props { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; margin: 0; }
dl.props dt, dl.props dd { padding: 8px 0; border-bottom: 1px solid var(--border); margin: 0; font-size: 13.5px; min-width: 0; }
dl.props dt { color: var(--text-2); padding-right: 12px; }
dl.props dd { color: var(--text); overflow-wrap: anywhere; }
dl.props > :nth-last-child(-n+2) { border-bottom: 0; }
.props-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.relmap { width: 100%; height: auto; display: block; }
.relmap .edge { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.relmap .node rect { fill: var(--surface); stroke: var(--border-strong); }
.relmap .node.center rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.relmap .node.person rect { fill: var(--surface-2); stroke-dasharray: 3 2; }
.relmap .node text { fill: var(--text); font-size: 12px; font-family: var(--font); }
.relmap .node text.sub { fill: var(--text-3); font-size: 10.5px; }
.relmap .elabel { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); }
.relmap a .node:hover rect { stroke: var(--accent); }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.rel-list li:first-child { border-top: 0; }
.rel-list .rel-type { color: var(--text-3); font-size: 12.5px; min-width: 92px; }
.rel-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.callout { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 14px; }
.callout svg { margin-top: 2px; }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.warn span { color: var(--text); }
.callout.info { background: var(--info-bg); }
.callout.info svg { color: var(--info); }

/* ---------- drawer, modal, popover, toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 18, 24, .42); z-index: 80; animation: fade .14s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 81; display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop); animation: slide .18s cubic-bezier(.2, .8, .2, 1);
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font: 600 17px var(--font-display); }
.drawer-head .btn { margin-left: auto; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }
.drawer-foot .left { margin-right: auto; }
.modal {
  position: fixed; left: 50%; top: 14vh; transform: translateX(-50%); width: min(480px, calc(100vw - 32px)); background: var(--surface);
  border-radius: var(--radius-l); z-index: 81; box-shadow: var(--shadow-pop); animation: pop .16s ease-out;
}
.modal-body { padding: 20px; }
.modal-body h2 { margin: 0 0 8px; font: 600 17px var(--font-display); }
.modal-body p { margin: 0 0 4px; color: var(--text-2); }
.modal-foot { padding: 12px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-l) var(--radius-l); }
.popover {
  position: absolute; z-index: 95; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
  min-width: 220px; max-width: 320px; padding: 6px; animation: pop .1s ease-out;
}
.popover .pop-search { padding: 4px 4px 6px; }
.popover .pop-list { max-height: 300px; overflow-y: auto; }
.popover .pop-note { padding: 6px 10px 4px; font-size: 12px; color: var(--text-2); }
.popover label.opt, .popover button.opt {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px; background: none; border: 0; text-align: left;
}
.popover .opt:hover { background: var(--surface-3); }
.popover .opt input { accent-color: var(--accent); margin: 0; }
.popover .opt .n { margin-left: auto; color: var(--text-3); font-size: 12px; }
.popover .pop-foot { display: flex; justify-content: space-between; padding: 6px 4px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); max-height: 260px; overflow-y: auto; padding: 4px; }
.combo-list button { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: none; border-radius: 4px; cursor: pointer; }
.combo-list button:hover, .combo-list button.hl { background: var(--surface-3); }
.combo-list .sub { display: block; font-size: 12px; color: var(--text-3); }

.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; background: var(--ink-bg); color: #fff; box-shadow: var(--shadow-pop); font-size: 13.5px; animation: pop .16s ease-out; max-width: min(560px, 90vw); }
.toast.error { background: var(--danger); }
.toast svg { flex: none; }

.palette { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); z-index: 91; background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .14s ease-out; }
.palette .p-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette .p-input input { flex: 1; height: 52px; border: 0; background: none; font-size: 16px; outline: none; }
.palette .p-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette .p-group { font-size: 12px; color: var(--text-3); padding: 10px 10px 4px; }
.palette .p-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); text-decoration: none; }
.palette .p-item.hl, .palette .p-item:hover { background: var(--accent-soft); text-decoration: none; }
.palette .p-item .sub { color: var(--text-3); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.palette .p-empty { padding: 26px; text-align: center; color: var(--text-3); }
.palette .p-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
@keyframes pop { from { opacity: 0; transform: translateX(var(--tx, 0)) scale(.98); } }
.modal, .palette { --tx: -50%; }
.toasts .toast { --tx: 0; }

/* ---------- import ---------- */
.steps { display: flex; gap: 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text-3); font-size: 13.5px; border-left: 1px solid var(--border); }
.step:first-child { border-left: 0; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1.5px solid currentColor; flex: none; }
.step.current { color: var(--text); font-weight: 500; background: var(--surface-2); }
.step.current .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step.done { color: var(--text-2); }
.step.done .n { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.source-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.source-opt { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-l); cursor: pointer; background: var(--surface); text-align: left; }
.source-opt:hover { border-color: var(--text-3); }
.source-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.source-opt h3 { margin: 0 0 3px; font: 600 15px var(--font); }
.source-opt p { margin: 0; color: var(--text-2); font-size: 13px; }
.source-opt .s-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-text); flex: none; }
.source-opt[aria-pressed="true"] .s-ico { background: var(--surface); }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-l); padding: 30px 20px; text-align: center; color: var(--text-2); background: var(--surface-2); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); }
.file-chosen { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.how-to { font-size: 13.5px; color: var(--text-2); }
.how-to ol { margin: 6px 0 0; padding-left: 20px; }
.how-to li { margin: 3px 0; }
.counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; background: var(--surface); margin-bottom: 16px; }
.counts > div { padding: 12px 16px; border-left: 1px solid var(--border); }
.counts > div:first-child { border-left: 0; }
.counts .c-n { font: 600 24px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.counts .c-l { font-size: 13px; color: var(--text-2); }
.counts .create .c-n { color: var(--ok); } .counts .update .c-n { color: var(--info); } .counts .skip .c-n { color: var(--warn); }
.diff { font-size: 12.5px; color: var(--text-2); white-space: normal; line-height: 1.5; padding: 4px 0; }
.diff b { font-weight: 500; color: var(--text); }
.diff del { color: var(--text-3); }
.diff ins { text-decoration: none; color: var(--text); background: var(--info-bg); padding: 0 3px; border-radius: 3px; }
.map-table td { height: 46px; }
.map-table select { width: 100%; min-width: 180px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .n { color: var(--text-3); font-weight: 400; margin-left: 4px; }

/* ---------- register ---------- */
.reg-table td.c-proc { max-width: 290px; }
.reg-table td.c-role { max-width: 220px; }
.reg-table td.c-sys { max-width: 200px; }
.reg-table td .cell-sub, .reg-table td .cell-main { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }

/* ---------- misc ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.loading { padding: 40px; text-align: center; color: var(--text-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--border); }
  .dash .c-4, .dash .c-5, .dash .c-7 { grid-column: span 6; }
  .dash .c-8 { grid-column: span 12; }
  .detail-grid, .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; background: none; }
  .nav { position: fixed; left: 0; width: 248px; transform: translateX(-100%); transition: transform .18s ease-out; }
  .shell.nav-open .nav { transform: none; box-shadow: var(--shadow-pop); }
  .shell.collapsed .brand-name, .shell.collapsed .nav-label, .shell.collapsed .nav-group, .shell.collapsed .count { display: revert; }
  .shell.collapsed .brand { padding: 0 20px; align-items: flex-start; }
  .shell.collapsed .brand-logo { display: block; }
  .shell.collapsed .brand-mark { display: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .scope span { display: none; }
  .scope select { min-width: 0; width: 150px; }
  .search-trigger kbd { display: none; }
  .content { padding: 18px 16px 40px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--border); }
  .kpi:first-child { grid-column: span 2; border-top: 0; }
  .dash .c-4, .dash .c-5, .dash .c-6, .dash .c-7, .dash .c-8 { grid-column: span 12; }
  .detail-head { grid-template-columns: 1fr; }
  .detail-head .actions { justify-content: flex-start; }
  .form-grid, .settings-grid, .props-2, .source-pick { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .counts { grid-template-columns: repeat(2, 1fr); }
  .steps .step span.t { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print: asset labels only ---------- */
.print-area { display: none; }
@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: flex !important; flex-wrap: wrap; gap: 6mm; }
  .print-area .label-card { box-shadow: none; break-inside: avoid; border-color: #999; }
}

/* ---------- connection map ---------- */
.map-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.map-panel { position: relative; overflow: hidden; }
.map-stage { height: calc(100vh - 230px); min-height: 460px; background:
  radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--emax-sky) 7%, transparent), transparent 70%), var(--surface); }
.map-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 2; }
.map-tools .btn { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.map-hint { margin: 0; padding: 8px 14px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); }
.map-trail { flex-wrap: wrap; }
.map-centre { display: flex; gap: 12px; align-items: flex-start; }
.map-centre .mk-dot { width: 14px; height: 14px; margin-top: 4px; }
.map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.map-legend li { display: flex; align-items: center; gap: 10px; }
.mk-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--kc, var(--text-3)); }
.chip.on { background: var(--surface-3); color: var(--text-2); }

.k-asset { --kc: var(--k-asset); } .k-person { --kc: var(--k-person); } .k-role { --kc: var(--k-role); } .k-process { --kc: var(--k-process); }
.k-service { --kc: var(--k-service); } .k-provider { --kc: var(--k-provider); } .k-location { --kc: var(--k-location); } .k-customer { --kc: var(--k-customer); }

svg.cmap { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; font-family: var(--font); }
svg.cmap.dragging { cursor: grabbing; }
.cmap .medge { stroke: var(--border-strong); stroke-width: 1.4; fill: none; transition: opacity .12s; }
.cmap .medge.cross { stroke-dasharray: 2 4; stroke-width: 1.2; opacity: .8; }
.cmap .elabel { font-size: 10.5px; fill: var(--text-3); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.cmap .mnode { cursor: pointer; transition: opacity .12s; outline: none; }
.cmap .mnode .disc { fill: var(--kc); stroke: var(--surface); stroke-width: 3; transition: transform .12s; }
.cmap .mnode .mic { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.cmap .mnode.centre .halo { fill: none; stroke: var(--emax-sky); stroke-width: 3; opacity: .9; }
.cmap .mnode.group .disc { fill: var(--surface); stroke: var(--kc); stroke-width: 2; stroke-dasharray: 4 3; }
.cmap .mnode .gcount { font-size: 13px; font-weight: 700; fill: var(--kc); pointer-events: none; }
.cmap .mnode .flag { fill: var(--danger); stroke: var(--surface); stroke-width: 2; }
.cmap .mlabel { font-size: 12px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.cmap .mlabel.big { font-size: 14.5px; font-weight: 700; }
.cmap .mlabel.radial { font-size: 11px; }
.cmap .mlabel.radial .msub { font-weight: 400; font-size: 10px; stroke-width: 0; }
.cmap .msub { font-size: 10.5px; fill: var(--text-3); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.cmap .mnode:hover .disc, .cmap .mnode:focus-visible .disc { stroke: var(--emax-sky); stroke-width: 3.5; }
.cmap .mnode:focus-visible .mlabel { text-decoration: underline; }
[data-theme="dark"] .cmap .mnode .mic { stroke: #0b1a24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cmap .mnode .mic { stroke: #0b1a24; } }
.cmap.focusing .mnode:not(.lit), .cmap.focusing .medge:not(.lit), .cmap.focusing .elabel:not(.lit) { opacity: .22; }
.cmap.focusing .medge.lit { stroke: var(--accent); stroke-width: 2; opacity: 1; }
@media (max-width: 1100px) { .map-layout { grid-template-columns: 1fr; } .map-stage { height: 70vh; } }
@media print { .map-tools, .map-hint, .map-side { display: none; } .map-layout { grid-template-columns: 1fr; } }

/* ---------- DORA compliance ---------- */
.mini-bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin: 2px 0 4px; max-width: 220px; }
.mini-bar span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.pillars-panel { margin-bottom: 16px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pillar { text-align: left; background: none; border: 0; border-left: 1px solid var(--border); padding: 14px 16px 12px; font: inherit; color: inherit; cursor: pointer; position: relative; }
.pillar:first-child { border-left: 0; }
.pillar:hover { background: var(--surface-2); }
.pillar.on { background: var(--accent-soft); }
.pillar.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); }
.pillar .p-name { font-weight: 600; font-size: 13.5px; }
.pillar .seg { margin: 9px 0 6px; height: 8px; }
.pillar .p-note { font-size: 12px; color: var(--text-3); }
.kpi.on { background: var(--accent-soft); }
.req-table td.c-req { max-width: 420px; }
.req-table td .cell-sub, .req-table td .cell-main { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.req-table tr.grp td, .grid tr.grp td { background: var(--surface-2); height: 32px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.grid tr.na td { color: var(--text-3); }
.grid tr.na .cell-main { color: var(--text-3); font-weight: 400; }
table.grid.compact td { height: 34px; }
.legend-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; margin-left: auto; }
.legend-inline .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.sw.ok { background: var(--ok); } .sw.info { background: var(--info); } .sw.muted { background: var(--border-strong); }

.req-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.req-summary { font-size: 14.5px; line-height: 1.55; margin: 0 0 8px; }
.facts { border: 1px solid var(--border); border-radius: var(--radius-l); padding: 12px 14px; background: var(--surface-2); margin: 6px 0 4px; }
.facts-head { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.facts-head svg { width: 14px; height: 14px; }
.facts-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0 0 10px; font-size: 13px; }
.facts-grid dt { color: var(--text-2); }
.facts-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.facts-grid dd.warn { color: var(--warn); }
.form-section.sec-row::after { display: none; }
.form-section.sec-row { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.form-section .n { font-weight: 400; color: var(--text-3); }
.form-section .spacer { flex: 1; }

.seg-btns { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 32px; font-size: 13px; cursor: pointer; border-left: 1px solid var(--border); background: var(--surface); color: var(--text-2); user-select: none; }
.seg-btn:first-child { border-left: 0; }
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn svg { width: 15px; height: 15px; }
.seg-btn:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.seg-btn:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.seg-btn:has(input:disabled) { cursor: default; opacity: .7; }
.status-seg .seg-btn:has(input[value="Implemented"]:checked) { background: var(--ok); color: #fff; }
.status-seg .seg-btn:has(input[value="In progress"]:checked) { background: var(--info); color: #fff; }
.status-seg .seg-btn:has(input[value="Not started"]:checked) { background: var(--warn); color: #fff; }
.status-seg .seg-btn:has(input[value="Not applicable"]:checked) { background: var(--text-3); color: #fff; }

.dropzone.dz { padding: 18px 16px; }
.dz .dz-text { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface-2); margin: 8px 0; }
.file-card > svg { width: 22px; height: 22px; color: var(--accent-text); flex: none; }
.file-card .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-links { white-space: nowrap; font-size: 13px; }
.ev-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13.5px; color: var(--text-2); }
.note-body { padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.req-picker .chips { margin: 0 0 8px; }
.req-picker .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sop-head { grid-template-columns: auto 1fr auto; }
.sop-badge { width: 64px; height: 64px; border-radius: var(--radius-l); background: var(--accent-soft); color: var(--accent-text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
.sop-badge svg { width: 24px; height: 24px; }

/* Rendered Markdown */
.md { font-size: 14.5px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h2 { font: 600 19px/1.3 var(--font-display); margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3 { font: 600 16px/1.3 var(--font-display); margin: 20px 0 6px; }
.md h4 { font: 600 14.5px/1.3 var(--font); margin: 16px 0 4px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li.task { list-style: none; margin-left: -18px; }
.md li.task input { margin: 0 6px 0 0; vertical-align: -1px; accent-color: var(--accent); }
.md code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: 1px 4px; border-radius: 3px; }
.md pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--warn-bg); border-radius: 0 var(--radius) var(--radius) 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md .md-table { overflow-x: auto; margin: 0 0 12px; }
.md table { border-collapse: collapse; font-size: 13.5px; min-width: 60%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 600; }
.md .md-ph { background: var(--warn-bg); color: var(--warn); border-radius: 3px; padding: 0 2px; }
.md.doc { max-width: 820px; }

/* Markdown editor */
.md-editor { border: 1px solid var(--border-strong); border-radius: var(--radius-l); overflow: hidden; background: var(--surface); }
.md-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.md-toolbar .spacer { flex: 1; }
.md-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.md-view { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.md-view button { border: 0; background: var(--surface); padding: 0 10px; height: 26px; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer; border-left: 1px solid var(--border); }
.md-view button:first-child { border-left: 0; }
.md-view button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.md-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 460px; }
.md-panes.edit { grid-template-columns: 1fr; } .md-panes.edit .md-preview { display: none; }
.md-panes.preview { grid-template-columns: 1fr; } .md-panes.preview .md-input { display: none; }
.md-input { border: 0; border-radius: 0; resize: vertical; min-height: 460px; padding: 14px; font: 13.5px/1.6 var(--mono); background: var(--surface); color: var(--text); box-shadow: none; }
.md-input:focus { box-shadow: none; }
.md-preview { min-height: 460px; padding: 14px 18px; border-left: 1px solid var(--border); overflow: auto; max-height: 70vh; background: var(--surface); }
.md-panes.preview .md-preview { border-left: 0; max-height: none; }
.md-foot { font-size: 12px; padding: 6px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }

@media (max-width: 860px) {
  .md-panes { grid-template-columns: 1fr; }
  .md-panes.split .md-preview { border-left: 0; border-top: 1px solid var(--border); }
  .pillar { border-left: 0; border-top: 1px solid var(--border); }
  .sop-head { grid-template-columns: 1fr; } .sop-badge { display: none; }
}
@media print {
  .md-toolbar, .md-foot { display: none; }
}

.detail-grid.editing { grid-template-columns: 1fr; }
.detail-grid.editing > .stack:last-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.field .combo, .field .combo .input { width: 100%; }
[hidden] { display: none !important; }
.req-picker .combo, .req-picker .combo .input { width: 100%; }
.md table { overflow-wrap: normal; }
.md th, .md td { min-width: 64px; }

/* ---------- due list and recurring tasks ---------- */
.due-list { list-style: none; margin: 0; padding: 0; }
.due-list li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); }
.due-list li:first-child { border-top: 0; }
.due-list .grow { flex: 1; min-width: 0; }
.due-list .grow > a { font-weight: 500; color: var(--text); }
.due-list .grow > a:hover { color: var(--accent-text); }
.due-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-ico { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.due-ico svg { width: 16px; height: 16px; }
.due-overdue .due-ico { background: var(--danger-bg); color: var(--danger); }
.due-soon .due-ico { background: var(--warn-bg); color: var(--warn); }
.due-when { text-align: right; display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.due-when strong { font-size: 13px; color: var(--text); font-weight: 600; }
.due-overdue .due-when strong { color: var(--danger); }
.due-soon .due-when strong { color: var(--warn); }
.due-list.compact li { padding: 8px 18px; }
.due-group { margin-bottom: 16px; }
.due-group.od .panel-head h2, .due-panel.od .panel-head h2 { color: var(--danger); }
.due-panel { margin-bottom: 20px; }
.due-panel .more { margin-left: auto; }
.nav .count.alert { color: #fff; background: var(--danger); border-radius: 9px; padding: 0 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 12.5px; }
.steps-list { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; line-height: 1.55; }
.steps-list li { margin-bottom: 6px; }
.setup-steps { border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface-2); padding: 10px 14px; }
.setup-steps summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.setup-steps[open] summary { margin-bottom: 10px; }
.setup-steps .steps-list { margin-bottom: 4px; }
.perm-list li svg { width: 16px; height: 16px; flex: none; }
.m365-table td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; height: auto; }
.m365-table td.ids > span { display: block; max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; line-height: 1.6; }
.m365-table td.ids > span > .muted { display: inline-block; width: 46px; }
.m365-table .mono { font-size: 12.5px; }
.m365-table .row-actions { text-align: right; white-space: nowrap; }
.m365-table .row-actions .btn + .btn { margin-left: 6px; }
.perm-list li.ok svg { color: var(--ok); }
.perm-list li.no svg { color: var(--danger); }
.sg-table td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; height: auto; }
.sg-table .input { height: 32px; }
@media (max-width: 860px) { .due-list li { flex-wrap: wrap; } .due-list .btn { margin-left: 42px; } }

/* ---------- users ---------- */
.top-user { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-left: auto; white-space: nowrap; }
.top-user svg { width: 16px; height: 16px; }
.top-user + .scope, .top-user + .scope-fixed { margin-left: 18px; }
@media (max-width: 860px) { .top-user > span { display: none; } }
.nav-user { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px 10px; color: var(--nav-text); font-size: 12.5px; line-height: 1.35; border-bottom: 1px solid var(--nav-border); margin-bottom: 6px; }
.nav-user svg { flex: none; margin-top: 2px; }
.nav-user strong { color: var(--nav-active); font-weight: 600; }
.nav-user .nav-label span { color: var(--nav-text-dim); }
.shell.collapsed .nav-user .nav-label { display: none; }
.scope-fixed { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.tabs a[role=tab] { padding: 9px 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; text-decoration: none; }
.tabs a[role=tab][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* Settings: customer modules */
.mod-table td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; height: auto; }
.mod-cell { display: flex; flex-direction: column; gap: 4px; }
.mod-cell .check { font-size: 13px; white-space: nowrap; }
.mod-cell .check.dim { color: var(--text-2); }

/* Framework tags (DORA, ISO 27001) */
.fw-tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; padding: 0 5px; border-radius: 3px; line-height: 16px; vertical-align: 1px; background: var(--muted-bg); color: var(--text-2); }
.fw-tag.fw-dora { background: var(--info-bg); color: var(--info); }
.fw-tag.fw-iso { background: var(--ok-bg); color: var(--ok); }

.nav-sub { margin: 10px 10px 2px 12px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nav-text-dim); white-space: nowrap; }
.nav-sub.solo, .shell.collapsed .nav-sub { display: none; }

/* ISO 27001 risk register */
.risk-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.risk-top .kpis { margin-bottom: 0; }
@media (max-width: 1100px) { .risk-top { grid-template-columns: 1fr; } }
.heat-panel { margin: 0; }
.heat-panel .panel-body { padding-top: 6px; }
.heat { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: 1fr auto; gap: 4px; }
.heat-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 11.5px; color: var(--text-3); }
.heat-x { grid-column: 2; text-align: center; font-size: 11.5px; color: var(--text-3); }
.heat-grid { display: grid; grid-template-columns: 18px repeat(5, 1fr); gap: 3px; }
.heat-lab { font-size: 11.5px; color: var(--text-3); display: grid; place-items: center; }
.heat-cell { height: 30px; border: 0; border-radius: 3px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text); }
.heat-cell.ok { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
.heat-cell.warn { background: color-mix(in srgb, var(--warn) 28%, var(--surface)); }
.heat-cell.serious { background: color-mix(in srgb, var(--serious) 32%, var(--surface)); }
.heat-cell.danger { background: color-mix(in srgb, var(--danger) 38%, var(--surface)); }
.heat-cell.on { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg-tabs button { border: 0; background: none; padding: 3px 9px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sw.warn { background: var(--warn); } .sw.serious { background: var(--serious); } .sw.danger { background: var(--danger); }
.warn-text { color: var(--serious); }
/* Management review inputs */
.mr-input { border: 1px solid var(--border); border-radius: var(--radius-l); padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.mr-input h4 { margin: 0 0 6px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.mr-input h4 .n { font-weight: 400; color: var(--text-3); font-size: 12px; }
.mr-input textarea { width: 100%; min-height: 60px; }
.mr-fact { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 4px; padding: 6px 8px; margin: 0 0 6px; display: flex; gap: 8px; align-items: flex-start; }
.mr-fact span { flex: 1; }
.mr-done { color: var(--ok); }
.signin-panel .panel-head .btn + .btn { margin-left: 6px; }
dl.props.signin-props { grid-template-columns: 150px 1fr; }
dl.props.signin-props dd { word-break: break-word; }
.panel-head .spacer { flex: 1; }
