:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --border: #d7dce3;
  --accent: #1f5f99;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --error: #a32020;
  --error-bg: #fdecec;
  --info-bg: #eaf2fb;
  --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.surface-admin { --accent: #5b3a8c; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --surface: #1b2129; --text: #e6e9ee; --muted: #9aa6b5; --border: #313a46;
    --accent: #6ea8de; --accent-text: #0d1117; --info-bg: #17283a; --warn-bg: #2e2412; --error-bg: #3a1717;
    --ok: #57c98a; --warn: #e5b45a; --error: #f08a8a;
  }
  .surface-admin { --accent: #b69ae6; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); }
h1 { font-size: 1.5rem; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.2rem; margin: 0.4em 0; }
h3 { font-size: 1.05rem; margin: 0.4em 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; }
.card.narrow { max-width: 520px; margin: 48px auto; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.field small, .muted { color: var(--muted); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); max-width: 100%; }
textarea { width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.btn { font: inherit; border-radius: 4px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--accent); display: inline-block; text-decoration: none; margin: 4px 6px 4px 0; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--surface); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn-danger { background: var(--surface); color: var(--error); border-color: var(--error); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.alert { border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; border: 1px solid var(--border); }
.alert-info { background: var(--info-bg); }
.alert-ok { background: var(--info-bg); border-color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn); }
.alert-error { background: var(--error-bg); border-color: var(--error); color: var(--text); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); }
.badge { display: inline-block; font-size: 0.78rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); }
.badge.ok { border-color: var(--ok); color: var(--ok); }
.badge.warn, .status-dpia_required, .status-pending_approval, .status-queued { border-color: var(--warn); color: var(--warn); }
.status-active, .status-approved, .status-published, .status-validated, .status-verified, .status-sent { border-color: var(--ok); color: var(--ok); }
.status-rejected, .status-suspended, .status-disabled, .status-ineffective, .status-failed { border-color: var(--error); color: var(--error); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 12px 0; padding: 10px 14px; background: var(--surface); }
legend { font-weight: 600; padding: 0 6px; }
.group { margin: 18px 0; }
.rows .row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.cell { display: flex; flex-direction: column; font-size: 0.88rem; }
.refs { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 4px; }
.check { display: flex; gap: 6px; align-items: baseline; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.check.muted { color: var(--muted); }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.checklist { list-style: none; padding: 0; }
.checklist .ok { color: var(--ok); }
.checklist .todo { color: var(--warn); }
.summary { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 4px; font-size: 0.85rem; max-height: 360px; overflow: auto; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.score { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.qr { background: #fff; display: inline-block; padding: 4px; }
.secret { word-break: break-all; }
.codes code { font-size: 1.05rem; }
.tree { margin: 4px 0 4px 18px; padding: 0; }
.question { padding: 6px 0; border-bottom: 1px dashed var(--border); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-word; }
.context select { margin-left: 4px; }
.mail-body { max-height: 60vh; }

.checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0.5rem 0 1rem; }
label.check { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: normal; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li + li { margin-top: 2px; }
.badge.level-low { border-color: var(--ok); color: var(--ok); }
.badge.level-medium { border-color: var(--warn); color: var(--warn); }
.badge.level-high, .badge.level-very_high { border-color: var(--error); color: var(--error); }
.badge.level-very_high { background: var(--error-bg); font-weight: 600; }
.score .badge { font-size: 1rem; margin-top: 4px; }
details.card > summary, details.danger-zone > summary { cursor: pointer; font-weight: 600; }
details.danger-zone { margin: 24px 0; padding: 12px 16px; border: 1px dashed var(--error); border-radius: var(--radius); }


/* Training (participants) */
body.learn { background: linear-gradient(160deg, #e3f2fd 0%, #fce4ec 50%, #e8f5e9 100%); min-height: 100vh; }
.learn-shell { max-width: 860px; margin: 0 auto; padding: 16px; }
.learn-header { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: #1a237e; padding: 8px 4px 16px; }
.learn-logo { font-size: 1.6rem; }
.learn-card { background: #fff; color: #1c2430; border-radius: 22px; padding: 28px 32px; margin: 0 0 20px; box-shadow: 0 10px 30px rgba(26, 35, 126, .12); }
.learn-hero { text-align: center; }
.learn-hero .learn-art { max-width: 420px; }
.learn-art { display: block; width: 100%; max-width: 520px; margin: 12px auto 20px; border-radius: 18px; }
.learn-card h1 { font-size: 1.7rem; margin: .2em 0 .5em; }
.learn-lead { font-size: 1.12rem; color: #37474f; }
.learn-text p, .learn-text li { font-size: 1.05rem; line-height: 1.65; }
.learn-text ul { padding-left: 1.3em; }
.learn-chapter { border-top: 10px solid var(--chapter); }
.learn-chapter-head h1 { color: var(--chapter); }
.learn-step { display: inline-block; background: var(--chapter); color: #fff; border-radius: 999px; padding: 3px 12px; font-size: .85rem; font-weight: 600; }
.learn-key { background: color-mix(in srgb, var(--chapter) 12%, #fff); border-left: 6px solid var(--chapter); border-radius: 14px; padding: 12px 20px; margin: 18px 0; }
.learn-key h2 { font-size: 1.05rem; margin: 4px 0; color: var(--chapter); }
.learn-key li { margin: 4px 0; font-weight: 600; }
.learn-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 22px; }
.learn-hero .learn-nav { justify-content: center; }
.learn-progress { height: 10px; background: rgba(255, 255, 255, .7); border-radius: 999px; margin: 0 0 16px; overflow: hidden; }
.learn-progress-bar { height: 100%; background: linear-gradient(90deg, #1e88e5, #8e24aa, #e53935, #fb8c00, #43a047); border-radius: 999px; transition: width .3s; }
.learn-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 20px 0; }
.learn-facts div { background: #f3f6ff; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; }
.learn-facts strong { font-size: 1.6rem; color: #3949ab; }
.learn-question { border: 2px solid #e8eaf6; border-radius: 16px; padding: 14px 18px; margin: 16px 0; background: #fafbff; }
.learn-question legend { font-weight: 700; font-size: 1.05rem; padding: 0 6px; }
.learn-hint { color: #6a1b9a; font-size: .9rem; margin: 2px 0 6px; }
.learn-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.learn-option:hover { background: #eef2ff; }
.learn-option input { margin-top: 4px; transform: scale(1.2); }
.learn-input { width: 100%; font-size: 1.1rem; padding: 12px 14px; border-radius: 12px; margin: 10px 0; }
.learn-score { display: inline-flex; align-items: center; justify-content: center; width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, #43a047, #00897b); color: #fff; font-size: 2.2rem; font-weight: 800; margin: 8px auto; }
.learn-score-fail { background: linear-gradient(135deg, #fb8c00, #e53935); }
@media (max-width: 600px) { .learn-card { padding: 20px 18px; border-radius: 16px; } .learn-card h1 { font-size: 1.35rem; } }
.delegate-main { max-width: 1100px; margin: 0 auto; padding: 16px; background: var(--surface); border-radius: 18px; margin-top: 16px; }

/* Tenant appearance (issue #6) */
.tenant-logo { height: 32px; max-width: 160px; object-fit: contain; vertical-align: middle; margin-right: 10px; border-radius: 4px; background: #fff; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.swatch { width: 118px; padding: 8px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.swatch:disabled { cursor: default; opacity: 0.8; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); font-weight: 600; }
.swatch-chip { display: block; height: 34px; border-radius: 4px; margin-bottom: 6px; }
.logo-preview { display: block; max-height: 80px; max-width: 320px; background: #fff; border: 1px solid var(--border); padding: 6px; border-radius: var(--radius); margin: 8px 0; }

/* Organization tree (issue #5) */
.org-tree { list-style: none; padding: 0; margin: 8px 0 12px; }
.org-tree li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.org-tree li.current .org-name { font-weight: 600; }
.org-tree .org-name { flex: 1; }

/* Forms (issue #7): uniform section cards, table of contents, fields in rows,
   save bar that stays visible. Applies to all forms via the shared classes. */
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.form-toc { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 14px; margin: 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.form-toc a { text-decoration: none; }
.form-toc a:hover { text-decoration: underline; }
.form-section { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 20px 10px; margin: 16px 0; scroll-margin-top: 12px; }
.form-section > h2 { margin-top: 0; }
.form-section > p.muted { margin-top: -2px; }
/* List editors inside a section: no box in a box, legend as sub-heading. */
.form-section fieldset { border: 0; padding: 0; margin: 12px 0 4px; background: transparent; }
.form-section legend { padding: 0; font-size: 0.95rem; color: var(--text); }
.rows .row { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; margin: 6px 0; }
.rows .row .cell { flex: 1 1 180px; }
.rows .row .cell input, .rows .row .cell select { width: 100%; }
.form-actions { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 0; margin-top: 8px; }
fieldset { padding: 12px 16px; }
.danger-zone { border-color: var(--error); }
.danger-zone > h2 { color: var(--error); }

/* ---------------------------------------------------------------------
   Layout (issue #7): top bar, side navigation from 1024px, drawer below.
   Style follows datenschutz-ludwigsburg.eu: navy/slate, soft shadows,
   rounded cards; the tenant accent colours links, icons and highlights.
   --------------------------------------------------------------------- */
:root { --nav-w: 248px; --shadow: 0 8px 22px rgba(15, 23, 42, .06); --brand-navy: #1f2a44; --brand-green: #34d399; }
.icon { width: 20px; height: 20px; flex: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px 16px; padding: 8px 16px;
  background: var(--surface); border-bottom: 3px solid var(--accent); box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); min-width: 0; flex: 0 1 auto; }
.brand .icon { width: 26px; height: 26px; color: var(--accent); }
.brand .tenant-logo + .icon { display: none; }
.brand-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .context { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9rem; }
.topbar .context select { max-width: 260px; }
.user { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); flex: none; }
.topbar .context + .user { margin-left: 8px; }
.user .logout { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.layout { display: block; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; min-width: 0; }
.sidenav { background: var(--surface); border-right: 1px solid var(--border); }
.mainnav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px 24px; }
.navlink { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.navlink .icon { color: var(--accent); }
.navlink:hover { background: var(--bg); }
.navlink.current { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text); font-weight: 600; }
.navlink.sub { padding: 6px 10px 6px 40px; font-size: 0.94rem; }
.navgroup { margin-top: 10px; }
.navhead { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 0.78rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.navhead .icon { color: var(--accent); }
.nav-backdrop { display: none; }
.card, .form-section, fieldset, .score { box-shadow: var(--shadow); }
.card { border-radius: 14px; }
/* Wide screens (landscape tablets, PCs): navigation permanently on the left. */
@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); align-items: start; }
  .sidenav { position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; }
}
/* Narrow screens: drawer behind the menu button. */
@media (max-width: 1023px) {
  .menu-toggle { display: inline-flex; }
  .sidenav { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); overflow-y: auto;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(15, 23, 42, .2); }
  .app.nav-open .sidenav { transform: none; }
  .app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .35); }
}
/* Phones */
@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .brand { flex: 1 1 0; font-size: 0.98rem; }
  .user-name, .user > .icon, .user .logout span, .topbar .context > span { display: none; }
  .topbar .context { order: 5; width: 100%; margin-left: 0; }
  .topbar .context select { max-width: none; width: 100%; }
  h1 { font-size: 1.3rem; }
  .card, .form-section { padding: 12px 14px; }
  .card.narrow { margin: 16px auto; }
  .field-row { grid-template-columns: 1fr; }
  .rows .row .cell { flex-basis: 100%; }
  .actions .btn, .form-actions .btn { flex: 1 1 auto; text-align: center; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 6px; }
  .form-toc { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }
/* Illustrations (login, welcome) */
.hero { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 12px; }

/* ISMS (issue #37): process map, process editor, matrix, radar chart */
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; margin: 8px 0; }
.check-row { display: flex; align-items: baseline; gap: 4px; }
.switch-row { display: flex; align-items: baseline; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.canvas-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 75vh; }
.map-wrap { padding: 8px; }
.isms-svg { display: block; font: 12px system-ui, sans-serif; user-select: none; }
.isms-svg text { fill: var(--text); }
.isms-svg .lbl { font-size: 12px; }
.pm-band { stroke: var(--border); }
.pm-band.pm-mgmt, .pm-box.pm-mgmt { fill: rgba(59, 91, 169, 0.10); }
.pm-band.pm-core, .pm-box.pm-core { fill: rgba(217, 130, 43, 0.12); }
.pm-band.pm-support, .pm-box.pm-support { fill: rgba(58, 143, 75, 0.10); }
.pm-box { stroke-width: 1.5; }
.pm-box.pm-mgmt { stroke: #3b5ba9; fill: rgba(59, 91, 169, 0.22); }
.pm-box.pm-core { stroke: #d9822b; fill: rgba(217, 130, 43, 0.28); }
.pm-box.pm-support { stroke: #3a8f4b; fill: rgba(58, 143, 75, 0.22); }
.pm-link { cursor: pointer; }
.pm-link:hover .pm-box, .pm-link:focus .pm-box { stroke-width: 3; }
.isms-svg .pm-band-label { font-weight: 700; font-size: 13px; fill: var(--muted); }
.isms-svg .pm-empty, .isms-svg .pm-customer { fill: var(--muted); font-style: italic; }
.pm-need { fill: var(--warn); }
.pm-cif { fill: var(--error); }
.pm-rto { fill: var(--accent, #3b6ea5); }
.isms-svg .pm-badge-text { fill: #fff; font-size: 10px; font-weight: 700; }
.dg-toolbar, .dg-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 6px 0; }
.dg-palette .btn { padding: 4px 9px; font-size: 0.9rem; }
.btn.active { background: var(--accent); color: var(--accent-text); }
.dg-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .dg-body { grid-template-columns: 1fr; } }
.dg-props { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.dg-props h3 { margin-top: 0; }
.dg-props .field { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.dg-props textarea, .dg-props input, .dg-props select { width: 100%; box-sizing: border-box; }
.diagram:focus { outline: none; }
.dg-bg { fill: var(--surface); }
.lane { fill: var(--bg); stroke: var(--border); }
.lane-head { fill: var(--border); stroke: var(--border); cursor: pointer; }
.lane-head.selected { fill: var(--accent); }
.isms-svg .lane-lbl { font-weight: 600; pointer-events: none; }
.dg-node { cursor: move; }
.dg-node .shape { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.dg-node .shape.thick { stroke-width: 4; }
.dg-node .shape.inner { fill: none; }
.dg-node .shape.doc { fill: rgba(229, 180, 90, 0.18); }
.dg-node .shape.sys { fill: rgba(110, 168, 222, 0.18); }
.dg-start .shape { stroke: var(--ok); }
.dg-end .shape { stroke: var(--error); }
.dg-node .glyph { stroke: var(--accent); stroke-width: 3; fill: none; }
.dg-node .glyph.thin { stroke-width: 1.5; }
.dg-node.selected .shape { stroke: var(--warn); stroke-width: 4; }
.dg-node text { pointer-events: none; }
.dg-edge { cursor: pointer; }
.dg-edge .edge { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.dg-edge .edge-hit { stroke: transparent; stroke-width: 12; fill: none; }
.dg-edge.selected .edge { stroke: var(--warn); stroke-width: 3; }
.isms-svg .edge-lbl { font-size: 11px; fill: var(--muted); }
.arrowhead { fill: var(--muted); }
table.matrix th.rot { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 4px 2px; }
table.matrix th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 145px; overflow: hidden; text-overflow: ellipsis; }
table.matrix td.center { text-align: center; }
.radar-wrap { overflow-x: auto; }
.radar-ring { fill: none; stroke: var(--border); }
.radar-axis { stroke: var(--border); }
.isms-svg .radar-scale { font-size: 10px; fill: var(--muted); }
.isms-svg .radar-lbl { font-size: 11px; }
.radar-actual { fill: rgba(31, 95, 153, 0.25); stroke: var(--accent); stroke-width: 2; }
.radar-target { fill: none; stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.key { display: inline-block; width: 18px; height: 4px; vertical-align: middle; }
.key-actual { background: var(--accent); }
.key-target { background: var(--warn); }
.pm-linkline { fill: none; stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.75; }
.pm-linkline.support { stroke: #3a8f4b; }
.pm-linkline.management { stroke: #3b5ba9; }
.pm-links { pointer-events: stroke; }
.ctx-center { stroke-width: 3; }
.isms-svg .ctx-center-lbl { font-weight: 700; font-size: 13px; }
.ctx-asset { fill: rgba(110, 168, 222, 0.15); stroke: var(--accent); }
.ctx-asset.high { stroke: var(--warn); stroke-width: 2; }
.ctx-cif { fill: rgba(163, 32, 32, 0.08); stroke: var(--error); }
.ctx-asset-line { stroke: var(--accent); stroke-width: 1.2; fill: none; opacity: 0.6; }
.ctx-cif-line { stroke: var(--error); stroke-width: 1.2; fill: none; opacity: 0.6; }
.isms-svg .ctx-sub { font-size: 10px; fill: var(--muted); }
.period-picker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 12px; }
.period-picker .field { margin: 0; }
.status-not_applicable { border-color: var(--muted); color: var(--muted); }
details.not-applicable > summary { cursor: pointer; color: var(--muted); margin: 8px 0; }
.module-select { margin-left: 6px; font-size: 0.9rem; }
.module-select select { padding: 2px 4px; }

/* Key figures (vulnerability management, wave 2) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.stat strong { font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.stat-warn strong { color: var(--warn); }

/* Fulfilment bar (risk analysis, wave 3) */
.meter { position: relative; display: inline-block; width: 120px; height: 1.2em; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); vertical-align: middle; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent, #4a7); opacity: 0.35; }
.meter-fill.ok { background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-label { position: relative; display: block; text-align: center; font-size: 0.8rem; line-height: 1.2em; }
details.control.muted summary { color: var(--muted); }
.bia-matrix select { min-width: 7em; }

/* Form sections as tabs (risk analysis like the ISMS portal) */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--border); }
.tab { background: none; border: 1px solid transparent; border-bottom: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-radius: 6px 6px 0 0; font: inherit; }
.tab.active { border-color: var(--border); background: var(--surface); color: inherit; font-weight: 600; margin-bottom: -1px; }
.tab-panel { border-top-left-radius: 0; margin-top: 0; }

/* Incident page like the ISMS portal */
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pagehead h1 { margin: 4px 0; }
.small { font-size: 0.9rem; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.grid-2 > div > .card:first-child, .grid-2 > .card { margin-top: 0; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { padding: 6px 0; border-bottom: 1px solid var(--border); }
span.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
div.inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }

/* Wave 12: end-to-end view, risk marks, processes at risk */
.e2e-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.e2e-head h2 { margin: 0; }
.e2e-wrap { max-height: none; }
.e2e-band { fill: rgba(13, 148, 136, 0.04); stroke: none; }
.e2e-band.odd { fill: rgba(13, 148, 136, 0.08); }
.isms-svg .e2e-layer-lbl { font-size: 11px; font-weight: 700; fill: #0f766e; letter-spacing: .02em; text-transform: uppercase; }
.isms-svg .e2e-proc-lbl { font-size: 15px; font-weight: 700; }
.isms-svg .e2e-node-lbl { font-size: 12.5px; font-weight: 600; }
.isms-svg .e2e-sub { font-size: 10.5px; fill: var(--muted); }
.isms-svg .e2e-svc-head { font-size: 11px; font-weight: 700; fill: #1d4ed8; text-transform: uppercase; letter-spacing: .02em; }
.e2e-proc-box { stroke-width: 2.5; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .12)); }
.e2e-proc-box.p1 { stroke: #dc2626; stroke-width: 3.5; }
.e2e-proc-box.p2 { stroke: #d97706; stroke-width: 3.5; }
/* services: blue */
.e2e-svc-box { fill: #eff6ff; stroke: #2563eb; stroke-width: 1.6; }
.e2e-svc-box.p1 { stroke: #dc2626; stroke-width: 2.5; }
.e2e-svc-box.p2 { stroke: #d97706; stroke-width: 2.5; }
.e2e-svc-line { stroke: #2563eb; stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; fill: none; }
/* chain: teal family, darker towards the hardware */
.e2e-node { cursor: pointer; }
.e2e-node-box { fill: var(--surface); stroke: #0d9488; stroke-width: 1.4; }
.e2e-node:hover .e2e-node-box, .e2e-node:focus .e2e-node-box { stroke-width: 2.6; }
.e2e-node-box.below-p1 { stroke: #f87171; }
.e2e-node-box.below-p2 { stroke: #fbbf24; }
.e2e-node-box.own-p1 { fill: #fef2f2; stroke: #dc2626; stroke-width: 2.6; }
.e2e-node-box.own-p2 { fill: #fffbeb; stroke: #d97706; stroke-width: 2.6; }
.e2e-node-box.retired { stroke-dasharray: 4 3; opacity: .6; }
.e2e-kind-bar { fill: #14b8a6; }
.e2e-kind-bar.kind-application { fill: #0d9488; }
.e2e-kind-bar.kind-it_system, .e2e-kind-bar.kind-container { fill: #0f766e; }
.e2e-kind-bar.kind-cluster_node { fill: #115e59; }
.e2e-kind-bar.kind-hypervisor, .e2e-kind-bar.kind-infrastructure { fill: #134e4a; }
.isms-svg .e2e-chips { font-size: 10px; font-weight: 700; fill: var(--muted); }
.isms-svg .e2e-chips.p1 { fill: #dc2626; }
.isms-svg .e2e-chips.p2 { fill: #b45309; }
.e2e-edge { fill: none; stroke: #5eead4; stroke-width: 1.8; }
.e2e-edge.p2 { stroke: #f59e0b; stroke-width: 2.8; }
.e2e-edge.p1 { stroke: #dc2626; stroke-width: 3.2; stroke-dasharray: 8 4; animation: e2e-flow 1.2s linear infinite; }
@keyframes e2e-flow { to { stroke-dashoffset: -24; } }
@media (prefers-reduced-motion: reduce) { .e2e-edge.p1 { animation: none; } }
.e2e-warn-tri { stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.e2e-warn.p1 .e2e-warn-tri { fill: #dc2626; }
.e2e-warn.p2 .e2e-warn-tri { fill: #f59e0b; }
.isms-svg .e2e-warn-mark { fill: #fff; font-weight: 800; font-size: 13px; }
.pm-risk .e2e-warn-tri { stroke-width: 1.2; }
.risk-mark { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.risk-mark.p1 { background: #dc2626; color: #fff; }
.risk-mark.p2 { background: #f59e0b; color: #1c1917; }
.risk-mark.p3 { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.risk-mark.ok { color: var(--ok); }
.risk-pill { font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.risk-pill.p1 { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.risk-pill.p2 { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.risk-pill.ok { background: var(--info-bg); color: var(--ok); }
.stat-p1 strong { color: #dc2626; }
.stat-muted strong { color: var(--muted); }
.risk-detail { margin: 8px 0; }
.risk-detail summary { cursor: pointer; padding: 6px 0; }
.path { font-size: .85rem; }
.path-sep { color: var(--muted); }
.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; border: 2px solid; }
.legend-swatch.svc { background: #eff6ff; border-color: #2563eb; }
.legend-swatch.app { border-color: #0d9488; }
.legend-swatch.sys { border-color: #134e4a; background: rgba(13, 148, 136, .15); }
@media (prefers-color-scheme: dark) {
  .e2e-svc-box { fill: #172554; stroke: #60a5fa; }
  .e2e-node-box.own-p1 { fill: #3b0d0d; }
  .e2e-node-box.own-p2 { fill: #3a2a06; }
  .isms-svg .e2e-layer-lbl { fill: #5eead4; }
  .isms-svg .e2e-svc-head { fill: #93c5fd; }
  .e2e-edge { stroke: #2dd4bf; opacity: .7; }
  .risk-pill.p1 { background: #3b0d0d; color: #fca5a5; }
  .risk-pill.p2 { background: #3a2a06; color: #fcd34d; }
}

/* Wave 13 (#155): policies and knowledge base. --pd-dark/--pd-light come from the document type. */
.pol-chip { --pd-dark: #1F3864; --pd-light: #D6DCE5; display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--pd-light); color: var(--pd-dark); border: 1px solid var(--pd-dark); white-space: nowrap; }
.pol-chip-btn { cursor: pointer; font: inherit; font-size: .82rem; opacity: .75; }
.pol-chip-btn.on { background: var(--pd-dark); color: #fff; opacity: 1; }
.pol-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pol-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pol-tools input[type=search] { min-width: 240px; flex: 1; }
.pol-tree { display: flex; flex-direction: column; margin-top: 12px; border-top: 1px solid var(--border); }
.pol-row { --depth: 0; --pd-dark: #1F3864; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 8px 9px calc(10px + var(--depth) * 26px); border-bottom: 1px solid var(--border); border-left: 4px solid var(--pd-dark); position: relative; }
.pol-row:hover { background: var(--info-bg); }
.pol-row::before { content: ""; position: absolute; left: calc(var(--depth) * 26px - 12px); top: 0; bottom: 50%; width: 10px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); display: var(--tree, block); }
.pol-row[style*="--depth: 0"]::before { display: none; }
.pol-row-num { font-weight: 700; color: var(--pd-dark); min-width: 4.5em; font-variant-numeric: tabular-nums; }
.pol-row-title { font-weight: 600; flex: 1 1 260px; }
.pol-row-due { margin-left: auto; }
.pol-archived { opacity: .55; }
.pol-template { --pd-dark: #1F3864; --pd-light: #D6DCE5; margin-top: 16px; border: 1px dashed var(--border); border-radius: 10px; padding: 12px 16px; max-height: 360px; overflow: auto; font-size: .9rem; }
.pol-template-head { margin-bottom: 8px; color: var(--muted); }
.pol-sample { --pd-dark: #1F3864; --pd-light: #D6DCE5; min-width: 180px; border: 1px solid #cbd5db; border-radius: 4px; overflow: hidden; font-size: .8rem; }
.pol-sample-head { background: var(--pd-dark); color: #fff; padding: 3px 8px; font-weight: 600; }
.pol-sample-row { padding: 2px 8px; background: var(--pd-light); color: #1c1c1c; }
.pol-sample-row.alt { background: #f2f2f2; }
.pol-head { --pd-dark: #1F3864; --pd-light: #D6DCE5; display: flex; gap: 0; border-radius: 14px; overflow: hidden; margin: 8px 0 12px; box-shadow: var(--shadow); }
.pol-head-num { background: var(--pd-dark); color: #fff; font-size: 1.6rem; font-weight: 800; padding: 18px 22px; display: flex; align-items: center; letter-spacing: .02em; }
.pol-head-main { background: var(--pd-light); color: #1c2430; padding: 14px 20px; flex: 1; }
.pol-head-title { font-size: 1.45rem; font-weight: 700; color: var(--pd-dark); }
.pol-head-meta { font-size: .9rem; margin-top: 4px; }
.pol-read { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.pol-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; font-size: .88rem; border-right: 1px solid var(--border); padding-right: 12px; }
@media (max-width: 900px) { .pol-read { grid-template-columns: 1fr; } .pol-side { position: static; border: 0; } }
.md-toc { list-style: none; padding: 0; margin: 6px 0; }
.md-toc li { margin: 3px 0; }
.md-toc .md-toc-2 { padding-left: 16px; font-size: .95em; }
.md-toc a { text-decoration: none; color: inherit; }
.md-toc a:hover { text-decoration: underline; }
.md-toc .md-num { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Document view (screen) and print */
.pd { --pd-dark: #1F3864; --pd-light: #D6DCE5; font-family: Arial, Helvetica, sans-serif; line-height: 1.5; }
.pd-screen .pd-cover { display: none; }
.pd h2, .pd h3, .pd h4, .md h2, .md h3, .md h4 { color: var(--pd-dark, inherit); scroll-margin-top: 16px; }
.md h2 { border-bottom: 2px solid var(--pd-light, var(--border)); padding-bottom: 4px; margin-top: 1.6em; }
.md .md-num, .pd h2 .md-num, .pd h3 .md-num { color: var(--pd-dark); opacity: .85; }
.pd-info { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.pd-info th, .pd-info td { border: 1px solid #cbd5db; padding: 5px 9px; text-align: left; vertical-align: top; }
.pd-info th { width: 32%; background: var(--pd-light); color: var(--pd-dark); }
.pd-info td { background: var(--surface); }
.md-table { overflow-x: auto; margin: 10px 0 16px; }
.md-table table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.md-table th { background: var(--pd-dark, #1F3864); color: #fff; text-align: left; padding: 6px 9px; border: 1px solid var(--pd-dark, #1F3864); }
.md-table td { border: 1px solid #cbd5db; padding: 5px 9px; vertical-align: top; }
.md-table tbody tr:nth-child(even) td { background: rgba(127, 127, 127, .08); }
.md-callout { border-left: 5px solid var(--pd-dark, var(--accent)); background: var(--pd-light, var(--info-bg)); color: #1c2430; padding: 8px 14px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.md-callout p { margin: 4px 0; }
.md-callout-label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pd-dark, var(--accent)); }
.md-warning { border-left-color: #B3122B; background: #FBE4E8; }
.md-warning .md-callout-label { color: #B3122B; }
.md-tip { border-left-color: #1d7a46; background: #e7f6ed; }
.md-quote { border-left: 3px solid var(--border); margin: 10px 0; padding: 2px 14px; color: var(--muted); }
.md-figure { margin: 16px 0; text-align: center; }
.md-figure img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.md-figure figcaption { font-size: .85rem; color: var(--muted); font-style: italic; margin-top: 4px; }
.md-doclink { font-weight: 600; color: var(--pd-dark, var(--accent)); }
.md pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; }
.pd-toc { background: var(--bg); border-radius: 10px; padding: 10px 16px; margin: 12px 0 20px; }

/* Comparison */
.md-diff .md-same { opacity: .55; }
.md-diff .md-del { background: #fdecec; border-left: 4px solid #a32020; padding-left: 8px; text-decoration: line-through; color: #8b1a1a; }
.md-diff .md-ins { background: #e7f6ed; border-left: 4px solid #1d7a46; padding-left: 8px; }
.md-diff .md-changed { border-left: 4px solid #8a5a00; padding-left: 8px; }
.md-diff del { background: #fdecec; color: #a32020; }
.md-diff ins { background: #d3f0dd; color: #14532d; text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  .md-diff .md-del { background: #3a1717; color: #f3b0b0; }
  .md-diff .md-ins { background: #15301f; }
  .md-diff del { background: #3a1717; color: #f3b0b0; }
  .md-diff ins { background: #15301f; color: #a7e8bf; }
  .pd-info th { color: #1c2430; }
}

/* Editor */
.pol-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 10px 10px 0 0; background: var(--bg); position: sticky; top: 0; z-index: 3; margin-top: 12px; }
.pol-tb { font: inherit; font-size: .85rem; padding: 4px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit; cursor: pointer; }
.pol-tb:hover { border-color: var(--accent); }
.pol-toolbar select { font-size: .85rem; }
.pol-ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; margin-bottom: 12px; }
.pol-ed-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 4px; }
.pol-editor { min-height: 420px; border: 1px solid var(--border); border-radius: 0 0 10px 10px; padding: 8px 20px 20px; background: var(--surface); outline: none; counter-reset: s1 1; }
.pol-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 153, .15); }
.pol-editor h2 { counter-increment: s1; counter-reset: s2; }
.pol-editor h2::before { content: counter(s1) " "; color: var(--muted); }
.pol-editor h3 { counter-increment: s2; }
.pol-editor h3::before { content: counter(s1) "." counter(s2) " "; color: var(--muted); }
.pol-editor .md-table td, .pol-editor .md-table th { min-width: 4em; }
.pol-source { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; min-height: 420px; }

/* Print: only the print root, page layout per document (see policyexport.ts). */
.print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body.printing { background: #fff; color: #1c1c1c; }
  .print-root .pd { page: var(--page); color: #1c1c1c; font-size: 10pt; }
  .print-root .pd-cover { break-after: page; height: 250mm; display: flex; flex-direction: column; page: cover; position: relative; }
  .print-root .pd-body { break-after: page; }
  .print-root .pd-logo { max-height: 22mm; max-width: 70mm; align-self: flex-start; margin-bottom: 18mm; }
  .print-root .pd-org { color: #595959; font-size: 14pt; margin: 30mm 0 10mm; }
  .print-root .pd-band { background: var(--pd-dark); color: #fff; padding: 12mm 10mm; border-radius: 2mm; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-root .pd-num { font-size: 28pt; font-weight: 800; }
  .print-root .pd-title { font-size: 20pt; font-weight: 700; margin: 3mm 0; }
  .print-root .pd-kind { color: var(--pd-light); font-size: 12pt; }
  .print-root .pd-meta { color: var(--pd-dark); font-size: 12pt; margin-top: 8mm; }
  .print-root .pd-stamp { color: #B3122B; border: 2px solid #B3122B; display: inline-block; padding: 2mm 5mm; margin-top: 8mm; font-weight: 700; align-self: flex-start; }
  .print-root .pd-class { position: absolute; bottom: 0; color: #595959; font-weight: 700; }
  .print-root .pd-bundle { break-after: page; page: bundle; }
  .print-root .pd-bundle h1 { color: #1F3864; font-size: 26pt; margin: 4mm 0; }
  .print-root .pd-bundle-toc { list-style: none; padding: 0; }
  .print-root .pd-bundle-toc > li { --pd-dark: #1F3864; border-left: 3mm solid var(--pd-dark); padding: 2mm 4mm; margin: 2mm 0; break-inside: avoid; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-root .pd-bundle-toc ol { list-style: none; padding-left: 6mm; font-size: 9pt; color: #3a4149; margin: 1mm 0 0; }
  .print-root .pd-chip { font-size: 8pt; color: var(--pd-dark); font-weight: 700; text-transform: uppercase; }
  .print-root .md-table th, .print-root .pd-info th, .print-root .md-callout, .print-root .md-table tbody tr:nth-child(even) td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-root .md-table tbody tr:nth-child(even) td { background: #f2f2f2; }
  .print-root .md-table table, .print-root .pd-info { font-size: 9pt; }
  .print-root .md-table tr, .print-root .md-callout, .print-root .md-figure { break-inside: avoid; }
  .print-root h2, .print-root h3, .print-root h4 { break-after: avoid; }
  .print-root .md-figure img { border: 0; max-height: 160mm; }
  .print-root .pd-toc { background: #f4f5f7; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-root .md-toc a { color: #1c1c1c; }
}
.pol-log { font-size: .9rem; margin-top: 10px; }

/* Scenario heatmap (wave 14, #164) */
.hm-low { --hm: #cfe8d5; --hm-t: #14532d; }
.hm-medium { --hm: #fbe9a6; --hm-t: #5c4300; }
.hm-high { --hm: #f8c48d; --hm-t: #6b2f00; }
.hm-very_high { --hm: #f1a3a0; --hm-t: #6e1111; }
.hm-badge { display: inline-block; min-width: 2em; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--hm); color: var(--hm-t); font-weight: 600; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.hm-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; margin: 12px 0; }
.hm-figure { margin: 0; min-width: 0; }
.hm-figure figcaption { font-weight: 600; margin-bottom: 6px; }
.hm-matrix { display: grid; grid-template-columns: 5.5em repeat(4, minmax(0, 1fr)); gap: 3px; }
.hm-cell { font: inherit; text-align: left; border: 0; background: var(--hm); color: var(--hm-t); min-height: 84px; border-radius: 4px; padding: 4px 6px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; cursor: pointer; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.hm-cell:hover:not(:disabled) { outline: 2px solid var(--accent); }
.hm-cell.hm-empty { cursor: default; opacity: .55; }
.hm-count { font-size: 1.4em; font-weight: 700; line-height: 1.1; }
.hm-entry { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-more { font-size: 11px; font-style: italic; }
.hm-celllist .card { margin-top: 8px; }
.hm-axis { font-size: 11px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted, #666); }
.hm-axis-y { align-items: flex-end; padding-right: 4px; }
.hm-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted, #666); margin-top: 4px; padding-left: 5.5em; }
.hm-grid th, .hm-grid td { text-align: center; vertical-align: middle; }
.hm-grid tbody th { text-align: left; white-space: nowrap; }
.hm-gridcell { font: inherit; width: 100%; min-width: 5.5em; border: 1px dashed var(--border, #ccc); background: transparent; color: inherit; border-radius: 4px; padding: 6px 4px; cursor: pointer; }
.hm-gridcell.hm-low, .hm-gridcell.hm-medium, .hm-gridcell.hm-high, .hm-gridcell.hm-very_high { background: var(--hm); color: var(--hm-t); border-style: solid; border-color: transparent; }
.hm-filter select { width: auto; display: inline-block; }
.hm-live { font-size: 1.05em; }
@media print {
  .print-root.hm-print { color: #1c1c1c; font-size: 10pt; }
  .print-root.hm-print .hm-pair { grid-template-columns: 1fr 1fr; }
  .print-root.hm-print .hm-cell { min-height: 70px; }
}

/* Policy acknowledgement for training participants (#155) */
.learn-policy summary { cursor: pointer; }
.learn-policy .md { margin-top: 12px; }
.learn-ok { color: var(--ok); font-weight: 600; }
.learn-policy-hint { margin: 12px 0; }
.md-noimg { font-style: italic; }

/* Knowledge base and distribution list (#169) */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kb-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; border-left: 4px solid var(--accent); margin: 0; }
.kb-card:hover, .kb-card:focus-visible { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.kb-card-cat { text-transform: uppercase; letter-spacing: .04em; }
.kb-head h1 { margin: 2px 0 8px; }
.kb-members { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; margin-top: 6px; }
.aud { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.aud legend { font-weight: 600; padding: 0 6px; }
.aud-kinds { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.aud-choice { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.aud-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 10px; }
.aud-check { display: inline-flex; gap: 4px; align-items: baseline; cursor: pointer; }
.aud-card { margin-top: 8px; }
.pol-editor.kb-editor { counter-reset: s1 0; }

/* Agreements (#170) */
a.tab { display: inline-block; text-decoration: none; }
.pol-editor.ag-editor { counter-reset: s1 0; }
.pol-editor.ag-editor h2::before { content: "§ " counter(s1) " "; }
.ag-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.ag-party { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.ag-party legend { font-weight: 600; padding: 0 4px; }
.ag-doc { max-width: 820px; margin: 0 auto; line-height: 1.55; }
.ag-doc .ag-title { text-align: center; font-size: 1.5rem; margin: 8px 0 20px; }
.ag-doc h2 { font-size: 1.1rem; margin-top: 1.4em; }
.ag-doc h2.md-annex { margin-top: 2.4em; border-top: 1px solid var(--border); padding-top: 1em; }
.ag-sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 28px; margin-top: 40px; break-inside: avoid; }
.ag-sig-role { font-weight: 600; }
.ag-sig-name { min-height: 1.4em; margin-bottom: 18px; }
.ag-sig-line { border-bottom: 1px solid currentColor; height: 28px; }
.ag-sig-line.ag-sig-tall { height: 48px; }
.ag-sig-cap { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
@media print {
  .print-root .ag-print { page: ag; max-width: none; color: #1c1c1c; font-size: 10.5pt; }
  .print-root .ag-print .ag-title { font-size: 16pt; }
  .print-root .ag-print h2 { font-size: 11pt; }
  .print-root .ag-print h2.md-annex { break-before: page; border: 0; margin-top: 0; }
  .print-root .ag-print .ag-sig-cap { color: #595959; }
  .print-root .ag-sigs { break-inside: avoid; }
}

/* Knowledge host of a tenant (#171) */
.surface-kb { background: var(--bg, #f6f7f9); }
.kb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px max(16px, calc((100vw - 1100px) / 2)); background: var(--surface, #fff); border-bottom: 1px solid var(--border); }
.kb-top a { color: inherit; text-decoration: none; font-size: 1.1rem; }
.kb-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kb-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.kb-article { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 20px clamp(16px, 4vw, 36px); }
.kb-login { max-width: 460px; margin: 40px auto; }
.surface-kb .kb-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
