/* ============================================================
   BCMP Prüftool — Design v2  (hochwertig, ruhig, Light + Dark)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --roche: #0B41CD; --roche-700: #0833a3; --roche-50: #eef3ff;
  --ink: #14171c; --ink-2: #3d434d; --ink-3: #6b7280; --ink-4: #9aa1ab;
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #fafbfe; --line: #e7eaf2; --line-2: #eff1f7;
  --ok: #1f9d57; --ok-bg: #eafaf0; --warn: #c9821f; --warn-bg: #fdf5e8; --crit: #d6402f; --crit-bg: #fdeeec;
  --shadow: 0 1px 2px rgba(20,30,60,.04), 0 6px 20px rgba(20,30,60,.06);
  --shadow-lg: 0 12px 40px rgba(20,30,60,.14);
  --radius: 14px; --radius-sm: 9px; --sidebar: 244px;
  --st-red: #E2001A;
  --t: .22s cubic-bezier(.4,0,.2,1);
}
html[data-theme="dark"] {
  --roche: #5b8bff; --roche-700: #7aa0ff; --roche-50: #16203a;
  --ink: #eef1f6; --ink-2: #c4cbd6; --ink-3: #8b93a1; --ink-4: #69707d;
  --bg: #0d1017; --surface: #161a22; --surface-2: #1b202a; --line: #262c38; --line-2: #20262f;
  --ok: #3ecf7e; --ok-bg: #122a1d; --warn: #e3a64a; --warn-bg: #2a2113; --crit: #f0705f; --crit-bg: #2c1714;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.4); --shadow-lg: 0 16px 50px rgba(0,0,0,.55);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; transition: background var(--t), color var(--t); }
a { color: inherit; text-decoration: none; }
h1 { font-size: 15px; font-weight: 700; }
.mono { font-family: 'SFMono-Regular', ui-monospace, 'Consolas', monospace; font-size: .92em; }
::selection { background: var(--roche-50); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px; gap: 2px; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 14px; }
.brand img { width: 100%; height: 54px; object-fit: cover; border-radius: 8px; margin: 2px 0 9px; display: block; border: 1px solid var(--line); }
.brand .tool { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.brand .tool b { display: block; font-size: 14px; color: var(--ink); font-weight: 800; letter-spacing: -.2px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--ink-4);
  font-weight: 700; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; cursor: pointer; transition: background var(--t), color var(--t); }
.nav-item svg { width: 18px; height: 18px; opacity: .8; flex: 0 0 auto; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--roche-50); color: var(--roche); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item .badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.nav-item .badge[data-n="0"], .nav-item .badge:empty { display: none; }
.sidebar .spacer { flex: 1; min-height: 12px; }
.side-foot { font-size: 10.5px; color: var(--ink-4); padding: 12px 10px 4px; border-top: 1px solid var(--line); margin-top: 8px; line-height: 1.6; }
.side-foot svg { width: 92px; height: auto; margin-bottom: 6px; display: block; }
.roche-top { width: 92px; height: auto; flex: 0 0 auto; margin-left: 10px; }
[data-theme="dark"] .roche-top polygon, [data-theme="dark"] .roche-top text { stroke: #6f9bff; fill: #6f9bff; }
[data-theme="dark"] .roche-top polygon { fill: none; }
.nav-item.viewer-locked { opacity: .5; }
.nav-item.viewer-locked:hover { opacity: .7; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 26px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 14px; font-weight: 700; }
.topbar .scope { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; margin-top: 3px; }
.crumb { padding: 3px 9px; border-radius: 6px; background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
.crumb.proj { background: var(--roche-50); color: var(--roche); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2); transition: var(--t); flex: 0 0 auto; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-4); }
.icon-btn svg { width: 18px; height: 18px; }
.role-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 7px 12px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.role-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.content { padding: 26px; max-width: 1680px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.page-head p { color: var(--ink-3); margin-top: 3px; font-size: 13px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); cursor: pointer; margin-bottom: 10px; }
.back-btn:hover { color: var(--roche); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); margin-bottom: 18px; }
.row { display: grid; gap: 16px; margin-bottom: 16px; }
.row.c2 { grid-template-columns: 1fr 1fr; } .row.c3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 1100px) { .row.c2, .row.c3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.card > h3 { font-size: 13.5px; font-weight: 700; padding: 15px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 8px; }
.card.pad { padding: 18px; } .card.pad > h3 { padding: 0 0 12px; border: none; }
.card .hint { font-size: 11.5px; color: var(--ink-4); font-weight: 500; margin-left: auto; }
.card .hint-click { color: var(--roche); margin-left: 8px; }
.clickable { cursor: pointer; } .card.clickable:hover { border-color: var(--roche); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.kpi { padding: 18px; display: flex; flex-direction: column; gap: 4px; animation: pop .4s ease backwards; }
.kpi .lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.kpi .val small { font-size: 15px; font-weight: 700; color: var(--ink-3); margin-left: 2px; }
.kpi .trend { font-size: 12px; color: var(--ink-3); }
.kpi .accent { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.kpi .accent i { display: block; height: 100%; border-radius: 4px; transform-origin: left; animation: grow .7s ease; }

/* ---------- Buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--roche); color: #fff; font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: var(--t); }
.btn:hover { background: var(--roche-700); }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--ink-4); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.ignore { background: var(--surface); color: var(--crit); border-color: var(--line); }
.input, .select, .textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; transition: var(--t); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--roche); box-shadow: 0 0 0 3px var(--roche-50); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
select.select { max-width: 360px; cursor: pointer; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { max-width: 320px; } .spacer { flex: 1; } .sub { font-size: 12px; color: var(--ink-3); }
.chip { padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: var(--t); }
.chip:hover { border-color: var(--ink-4); } .chip.on { background: var(--roche); color: #fff; border-color: var(--roche); }
.tpl { padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: var(--t); }
.tpl.on { background: var(--roche-50); color: var(--roche); border-color: var(--roche); }
.tpl-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

/* ---------- Tables ---------- */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 72vh; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; text-align: left;
  padding: 11px 14px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
table.data tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
td.cell-bad, .cell-bad { background: var(--crit-bg) !important; color: var(--crit) !important; font-weight: 600; }
td.cell-ok, .cell-ok { background: color-mix(in srgb, var(--ok) 8%, transparent) !important; color: var(--ok) !important; }
.err-ch { color: var(--crit); font-weight: 800; text-decoration: underline wavy var(--crit); background: color-mix(in srgb, var(--crit) 16%, transparent); border-radius: 2px; padding: 0 1px; }
.stand-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.stand-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 12px; }
.stand-chip .del-stand { color: var(--crit); cursor: pointer; font-weight: 800; font-size: 14px; line-height: 1; padding: 0 2px; }
.stand-chip .del-stand:hover { background: var(--crit-bg); border-radius: 4px; }
.guid { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--ink-3); cursor: pointer; border-bottom: 1px dotted var(--ink-4); }
.guid:hover { color: var(--roche); }
.tag-id { font-family: ui-monospace, monospace; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.empty, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.missing, .pill.crit { background: var(--crit-bg); color: var(--crit); } .pill.info { background: var(--roche-50); color: var(--roche); }
.conf { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.conf.hi { background: var(--ok-bg); color: var(--ok); } .conf.mid { background: var(--warn-bg); color: var(--warn); } .conf.lo { background: var(--crit-bg); color: var(--crit); }
.count-chip { font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 6px; color: var(--ink-2); }

/* Matrix */
.matrix-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 74vh; background: var(--surface); }
table.mx { border-collapse: collapse; font-size: 12.5px; }
table.mx th, table.mx td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 7px 9px; white-space: nowrap; }
table.mx thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 3; font-size: 11px; color: var(--ink-3); font-weight: 700; }
table.mx th.rot { height: 140px; padding: 0; vertical-align: bottom; } table.mx th.rot span { display: inline-block; transform: rotate(-58deg); transform-origin: left bottom; width: 26px; margin: 0 0 10px 22px; font-weight: 600; }
table.mx td.fix, table.mx th.fix { position: sticky; left: 0; background: var(--surface); z-index: 2; text-align: left; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
table.mx th.fix { z-index: 4; } table.mx td.fix.nr, table.mx th.fix.nr { left: 240px; }
table.mx td.mc { text-align: center; cursor: pointer; font-weight: 700; }
td.mc.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, transparent); }
td.mc.empty { color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, transparent); }
td.mc.missing { color: var(--crit); background: color-mix(in srgb, var(--crit) 11%, transparent); }
.pctcell { font-weight: 800; text-align: center; }

/* Status dots, donut, gauge, bars, stack */
.dot-state { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.s-ok { background: var(--ok); } .s-warn { background: var(--warn); } .s-crit { background: var(--crit); } .s-na { background: var(--ink-4); }
.alert-i { color: var(--crit); font-weight: 800; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 18px; font-size: 12px; color: var(--ink-3); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
table.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
table.matrix th, table.matrix td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; }
table.matrix tbody tr { cursor: pointer; } table.matrix tbody tr:hover { background: var(--surface-2); }
.gw.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.donut-wrap { display: flex; gap: 26px; align-items: center; padding: 22px 18px; flex-wrap: wrap; justify-content: center; }
.donut-wrap svg circle { transition: stroke-dasharray .9s cubic-bezier(.4,0,.2,1); }
.donut-legend { display: flex; flex-direction: column; gap: 11px; min-width: 150px; }
.donut-legend .li { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; padding: 6px 9px; border-radius: 8px; transition: var(--t); }
.donut-legend .li:hover { background: var(--surface-2); }
.donut-legend .sw { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }
.donut-legend .li b { margin-left: auto; }
.stack { display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.stack i { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; transition: width .8s cubic-bezier(.4,0,.2,1); min-width: 0; }
.stack i.ok { background: var(--ok); } .stack i.empty { background: var(--warn); } .stack i.missing { background: var(--crit); }
.barrow { display: grid; grid-template-columns: 1fr 2.4fr 50px; align-items: center; gap: 12px; padding: 7px 0; }
.barrow .nm { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .nm .u { color: var(--ink-4); font-size: 11px; }
.barrow .bar { height: 9px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.barrow .bar i { display: block; height: 100%; border-radius: 5px; transform-origin: left; animation: grow .7s ease; }
.barrow .pct { font-size: 12px; font-weight: 700; text-align: right; color: var(--ink-2); }
.barrow.clickable:hover .nm { color: var(--roche); }

/* AKS / RDS segments */
.aks { display: inline-flex; align-items: center; font-family: ui-monospace, monospace; font-size: 12.5px; gap: 1px; }
.aks .seg { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
.aks .seg.bad { background: var(--crit-bg); border-color: var(--crit); color: var(--crit); font-weight: 700; }
.aks .dash { color: var(--ink-4); }
.rds-ok { color: var(--ok); font-weight: 700; } .rds-bad { color: var(--crit); font-weight: 700; }
/* RDS-Befüllung je Stufe + Split-Tabelle */
.rds-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 28px; }
@media (max-width: 900px) { .rds-stat-grid { grid-template-columns: 1fr; } }
.rds-stat-grid .barrow { grid-template-columns: minmax(120px, 1.3fr) minmax(70px, 1.6fr) auto; gap: 10px; }
.rds-stat-grid .barrow .pct { white-space: nowrap; min-width: 104px; text-align: right; }
.rds-stat-grid .barrow .pct .sub { font-size: 10.5px; }
.rds-stat-grid .barrow .nm { white-space: normal; }
.rds-stat-total { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.data.rds-split th, .data.rds-split td { white-space: nowrap; }
.data.rds-split td.rseg { text-align: center; padding: 4px 6px; }
.data.rds-split td.rseg .seg { font-family: ui-monospace, monospace; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
.data.rds-split td.rseg .seg.bad { background: var(--crit-bg); border-color: var(--crit); color: var(--crit); font-weight: 700; }
.rvt-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: #fff3cd; color: #856404; border: 1px solid #ffc107; border-radius: 4px;
  padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
html[data-theme="dark"] .rvt-badge { background: #3d2f00; color: #ffd04d; border-color: #b8860b; }

/* Attribut-Status-Streifen (Befunde Bauteile) */
.attr-row { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 260px; align-items: center; }
.attr-cell { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.attr-cell.s-ok { background: var(--ok); }
.attr-cell.s-warn { background: var(--warn); }
.attr-cell.s-crit { background: var(--crit); }
.attr-cell.clickable { cursor: pointer; transition: transform .1s; }
.attr-cell.clickable:hover { transform: scale(1.5); box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 3px var(--line); }

/* RDS-Zusammensetzung (Mapping → RDS-Quelle) */
.rds-build { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.rds-seg { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2, #f1f3f6); border: 1px solid var(--line, #dfe3e8);
  border-radius: 6px; padding: 3px 8px; font-size: 12.5px; }
.rds-seg b { color: var(--ink-3); font-weight: 700; }
.rds-seg a { cursor: pointer; color: var(--ink-3); text-decoration: none; font-weight: 700; }
.rds-seg a:hover { color: var(--roche); }
.rds-seg a.del:hover { color: var(--crit); }
.rds-join { color: var(--ink-4); font-weight: 700; }
select.map-ovr { width: 100%; max-width: 360px; }

/* Toggle-Switch (IDM Attribut aktiv/inaktiv) */
.sw { display: inline-block; width: 34px; height: 19px; border-radius: 19px; background: var(--line, #cdd3da);
  position: relative; cursor: pointer; transition: background .15s; vertical-align: middle; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.sw.on { background: var(--ok); }
.sw.on::after { left: 17px; }
.sw.locked { opacity: .4; pointer-events: none; cursor: not-allowed; }
tr.idm-off { opacity: .5; }
.idm-scope .scope-row { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.idm-scope .scope-h { font-size: 12.5px; color: var(--ink-2); }
.idm-scope .scope-grp { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.idm-scope .scope-lbl { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-4); }
.idm-scope .scope-sw { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.idm-scope .scope-sw.absent { opacity: .42; }
tr.idm-off b { text-decoration: line-through; }
tr.row-off { opacity: .5; }
tr.row-off b { text-decoration: line-through; }

/* Stand/Version + Veröffentlichungs-Status (Topbar) */
.stand-extra { display: inline-flex; align-items: center; gap: 7px; }
.stand-extra .select.sm { padding: 5px 8px; font-size: 12px; max-width: 150px; }
.stand-pill { font-size: 12px; color: var(--ink-3, #6b7480); background: var(--surface-2, #eef1f5); border: 1px solid var(--line, #dfe3e8); border-radius: 6px; padding: 3px 8px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.save-ind { font-size: 11.5px; }
.save-ind .si { display: inline-flex; align-items: center; border-radius: 6px; padding: 2px 7px; font-weight: 600; }
.si-ok { color: #1a7f37; } .si-wait { color: #9a6700; } .si-local { color: #6b7480; }
.si-err { color: #fff; background: var(--crit); animation: si-pulse 1.4s ease-in-out infinite; }
@keyframes si-pulse { 0%,100%{opacity:1} 50%{opacity:.55} }
.diag-out table.data td { padding: 4px 8px; }
.auth-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 400; background: var(--crit, #b3261e); color: #fff; padding: 9px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.auth-banner .btn { background: #fff; color: var(--crit, #b3261e); border: none; font-weight: 700; }
.auth-banner .x { margin-left: auto; cursor: pointer; font-size: 20px; line-height: 1; opacity: .85; }

/* Template-Leiste mit Löschen */
.tpl-wrap { display: inline-flex; align-items: center; }
.tpl-del { background: transparent; border: none; color: var(--ink-4, #99a0aa); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; margin-left: -4px; border-radius: 4px; }
.tpl-del:hover { color: var(--crit, #b3261e); background: var(--surface-2, #eef1f5); }

/* 3D-Viewer (Three.js) */
.v3d-wrap { position: relative; height: 72vh; min-height: 460px; border: 1px solid var(--line, #dfe3e8); border-radius: 12px; overflow: hidden; background: var(--surface-2, #eef1f5); }
.v3d-canvas { position: absolute; inset: 0; }
.v3d-canvas canvas { display: block; width: 100%; height: 100%; }
#v3d-cutslider { vertical-align: middle; accent-color: var(--roche, #0B41CD); cursor: pointer; }
/* Vollbild: Viewer + Tabellen füllen den Bildschirm */
#view-viewer.v3d-fs { position: fixed; inset: 0; z-index: 1000; background: var(--surface-2, #eef1f5); padding: 8px 10px 10px; display: flex; flex-direction: column; overflow: hidden; }
#view-viewer.v3d-fs .page-head, #view-viewer.v3d-fs #v3d-note { display: none; }
#view-viewer.v3d-fs .v3d-wrap { height: auto; flex: 1 1 auto; min-height: 0; }
#view-viewer.v3d-fs #v3d-objtable { flex: 0 0 auto; max-height: 34vh; overflow: auto; margin-top: 8px; }
.v3d-bars { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.v3d-bar { position: static; display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  background: var(--surface, #fff); border: 1px solid var(--line, #dfe3e8); border-radius: 9px; padding: 6px 8px; box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,.08)); }
.v3d-bar2 { font-size: 12px; }
.v3d-models { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.v3d-mchip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2, #eef1f5); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 11.5px; font-weight: 600; }
.v3d-mchip .v3d-mdel { color: var(--crit); cursor: pointer; font-weight: 800; }
.select.sm { padding: 4px 8px; font-size: 12px; max-width: 220px; }
.v3d-ctx { position: fixed; z-index: 300; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.18)); padding: 4px; min-width: 180px; display: flex; flex-direction: column; }
.v3d-ctx button { text-align: left; background: none; border: none; padding: 8px 12px; font-size: 13px; color: var(--ink); cursor: pointer; border-radius: 6px; font-weight: 500; }
.v3d-ctx button:hover { background: var(--surface-2, #eef1f5); }
.v3d-sep { width: 1px; height: 18px; background: var(--line, #dfe3e8); margin: 0 2px; }
.v3d-subbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2, #eef1f5); border-top: 1px solid var(--line); font-size: 12px; }
.v3d-clipax { display: inline-flex; align-items: center; gap: 4px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 7px; padding: 2px 7px; }
.v3d-clipax .sub { min-width: 78px; }
.v3d-cs { width: 70px; accent-color: var(--roche, #0B41CD); }
.v3d-lvlchip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; cursor: pointer; font-size: 11.5px; font-weight: 600; opacity: .5; }
.v3d-lvlchip.on { opacity: 1; border-color: var(--roche, #0B41CD); }
.v3d-lvlchip .bx { color: transparent; font-size: 10px; }
.v3d-lvlchip.on .bx { color: var(--ok, #1a7f37); }
.v3d-legend { position: absolute; left: 10px; bottom: 10px; z-index: 5; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 11.5px; max-height: 46%; overflow: auto; box-shadow: var(--shadow, 0 4px 14px rgba(0,0,0,.12)); }
.v3d-legend .lg-h { font-weight: 700; margin-bottom: 5px; }
.v3d-legend .lg-i { display: flex; align-items: center; gap: 6px; line-height: 1.7; border-radius: 4px; padding: 0 3px; }
.v3d-legend .lg-i.clickable { cursor: pointer; }
.v3d-legend .lg-i.clickable:hover { background: var(--surface-2, #eef1f5); }
.v3d-legend .lg-i .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.vbtn { background: var(--surface-2, #eef1f5); color: var(--ink-2, #3a4658); border: 1px solid transparent; border-radius: 7px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.vbtn:hover { background: var(--line-2, #e6eaef); }
.vbtn.act { background: var(--roche, #0B41CD); color: #fff; }
.v3d-load { position: absolute; inset: 0; display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--ink-3, #6b7480); font-size: 14px; background: var(--surface-2, #eef1f5); z-index: 6; }
.v3d-load-txt { display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.v3d-load-bar { width: 260px; height: 6px; background: var(--line, #dfe3e8); border-radius: 4px; overflow: hidden; position: relative; }
.v3d-load-fill { height: 100%; width: 0; background: var(--roche, #0B41CD); transition: width .15s; }
.v3d-load-bar.indet .v3d-load-fill { width: 40%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.spin { width: 18px; height: 18px; border: 2px solid var(--line, #dfe3e8); border-top-color: var(--roche, #0B41CD); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.v3d-props { position: absolute; top: 56px; right: 10px; width: 304px; max-height: calc(100% - 70px); overflow: auto; z-index: 5;
  background: var(--surface, #fff); border: 1px solid var(--line, #dfe3e8); border-radius: 10px; box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,.18)); font-size: 12.5px; }
.v3d-ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line, #dfe3e8); font-size: 13.5px; }
.v3d-ph .x { cursor: pointer; color: var(--ink-3, #6b7480); font-size: 18px; line-height: 1; }
.v3d-props table { width: 100%; border-collapse: collapse; }
.v3d-props td { padding: 4px 12px; border-bottom: 1px solid var(--line-2, #eef1f5); vertical-align: top; word-break: break-word; }
.v3d-props td:first-child { color: var(--ink-3, #6b7480); white-space: nowrap; width: 38%; }
.v3d-sub { font-weight: 700; color: var(--roche, #0B41CD); padding-top: 10px !important; }

/* Notes */
.note { display: flex; gap: 11px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.note svg { flex: 0 0 auto; margin-top: 1px; }
.note.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.note.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note.crit { background: var(--crit-bg); border-color: color-mix(in srgb, var(--crit) 30%, transparent); }
.empty-state { padding: 50px; text-align: center; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Mapping / classify cards */
.map-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 11px; box-shadow: var(--shadow); animation: pop .3s ease backwards; }
.map-card.ok { border-left-color: var(--ok); } .map-card.review { border-left-color: var(--warn); } .map-card.none { border-left-color: var(--ink-4); }
.map-card .mh { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.map-card .unit { color: var(--ink-4); font-size: 12px; }
.cand { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 7px; cursor: pointer; transition: var(--t); }
.cand:hover { border-color: var(--ink-4); } .cand.chosen { border-color: var(--roche); background: var(--roche-50); }
.cand.pulse { animation: pulse 1.4s ease; } @keyframes pulse { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px var(--roche-50); } }
.cand .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-4); flex: 0 0 auto; }
.cand.chosen .radio { border-color: var(--roche); background: radial-gradient(var(--roche) 40%, transparent 45%); }
.cand .pp { font-size: 13px; font-weight: 600; } .cand .ps { color: var(--roche); }
.cand .samples { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.map-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.colpick { display: flex; flex-wrap: wrap; gap: 7px; }
.colpick label { padding: 6px 11px; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; cursor: pointer; color: var(--ink-2); transition: var(--t); }
.colpick label.on { background: var(--roche-50); border-color: var(--roche); color: var(--roche); font-weight: 600; }
.field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field-row > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.saved-flash { color: var(--ok); font-size: 12.5px; font-weight: 600; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,30,.5); backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 24px; animation: fade .2s ease; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: min(680px, 100%);
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .26s ease; }
.modal.wide { width: min(920px, 100%); }
.mhd { display: flex; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mhd h3 { font-size: 16px; font-weight: 700; } .mhd .x { margin-left: auto; cursor: pointer; font-size: 24px; color: var(--ink-3); line-height: 1; }
.mhd .x:hover { color: var(--ink); }
.mbd { padding: 20px; }

/* Assistant */
.fab { position: fixed; right: 26px; bottom: 26px; width: 56px; height: 56px; border-radius: 50%; background: var(--roche);
  color: #fff; border: none; cursor: pointer; box-shadow: var(--shadow-lg); display: grid; place-items: center; z-index: 60; transition: var(--t); }
.fab:hover { transform: scale(1.06); } .fab svg { width: 24px; height: 24px; }
.asst { position: fixed; right: 26px; bottom: 26px; width: 410px; max-width: calc(100vw - 36px); height: 580px; max-height: calc(100vh - 52px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; z-index: 61; overflow: hidden; }
.asst.open { display: flex; animation: pop .26s ease; }
.asst-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.asst-hd .t { font-weight: 700; font-size: 14px; } .asst-hd .x { margin-left: auto; cursor: pointer; color: var(--ink-3); font-size: 22px; }
.asst-hd svg { color: var(--roche); }
.asst-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 11px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 13px; font-size: 13px; line-height: 1.55; animation: pop .25s ease; word-wrap: break-word; }
.msg.a { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.u { background: var(--roche); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.msg.a b { color: var(--roche); } .msg .ttl { font-weight: 700; display: block; margin-bottom: 5px; color: var(--ink); font-size: 13.5px; }
.msg.a table { width: 100%; font-size: 12px; margin-top: 6px; border-collapse: collapse; }
.msg.a table td { padding: 3px 6px; border-bottom: 1px solid var(--line-2); } .msg.a table td:last-child { text-align: right; font-weight: 700; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%; background: var(--ink-4); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
.asst-chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px 10px; }
.asst-chips button { font-size: 11.5px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink-2); cursor: pointer; }
.asst-chips button:hover { border-color: var(--roche); color: var(--roche); }
.asst-input { display: flex; gap: 9px; padding: 12px 14px; border-top: 1px solid var(--line); }

/* Viewer */
.viewer { position: relative; height: 60vh; min-height: 440px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.vbar { position: absolute; top: 12px; left: 12px; z-index: 5; display: flex; gap: 7px; }
.vbtn { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.vbtn.act { background: var(--roche); color: #fff; border-color: var(--roche); }
.roommap { position: absolute; inset: 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 60px 18px 18px; overflow: auto; align-content: flex-start; }
.rm-cell { width: 52px; height: 40px; border-radius: 7px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; opacity: .28; cursor: pointer; transition: var(--t); }
.rm-cell.on { opacity: 1; } .rm-cell.ok { background: var(--ok); } .rm-cell.warn { background: var(--warn); } .rm-cell.crit { background: var(--crit); }
.rm-cell.sel { outline: 3px solid var(--roche); outline-offset: 1px; }
.vstats { position: absolute; bottom: 12px; right: 14px; font-size: 11.5px; color: var(--ink-3); background: var(--surface); padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; }
.login .bg { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.05); animation: kenburns 24s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.05) translate(0,0); } to { transform: scale(1.16) translate(-2%, -2%); } }
.login .veil { position: absolute; inset: 0; background: linear-gradient(120deg, rgba(8,16,40,.86), rgba(11,65,205,.42) 60%, rgba(8,16,40,.7)); }
.login .card { position: relative; width: min(430px, 92vw); padding: 42px 38px; border-radius: 20px;
  background: rgba(18,22,34,.62); backdrop-filter: blur(22px) saturate(140%); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 30px 80px rgba(0,0,0,.5); color: #fff; animation: pop .5s ease; }
.login .lg { height: 30px; margin-bottom: 26px; filter: brightness(0) invert(1); object-fit: contain; }
.login h1 { font-size: 25px; font-weight: 800; line-height: 1.2; letter-spacing: -.5px; }
.login h1 span { color: #7aa0ff; }
.login p { color: rgba(255,255,255,.66); font-size: 13px; margin: 12px 0 26px; line-height: 1.55; }
.login .field { margin-bottom: 14px; }
.login input { width: 100%; padding: 13px 15px; border-radius: 11px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 14px; }
.login input::placeholder { color: rgba(255,255,255,.5); }
.login input:focus { outline: none; border-color: #7aa0ff; box-shadow: 0 0 0 3px rgba(122,160,255,.25); }
.login button { width: 100%; padding: 13px; border-radius: 11px; border: none; background: var(--roche); color: #fff;
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; transition: var(--t); }
.login button:hover { background: #1a52e0; transform: translateY(-1px); }
.login .err { color: #ff9b8f; font-size: 12.5px; margin-top: 12px; min-height: 16px; text-align: center; }
.login .ft { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12); font-size: 10.5px; color: rgba(255,255,255,.55); }
.login .dots i { display: inline-block; width: 5px; height: 5px; margin: 0 1px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite both; }

html[data-theme="dark"] .login .lg { filter: brightness(0) invert(1); opacity: .92; }
.admin-only.hide { display: none !important; }
