/* Risk Cockpit – Designsystem „Cockpit“ (eigene Gestaltung). Rollen-Tokens, Daten zuerst, ruhig und gut lesbar. */
:root {
  --bg: #0b0e13; --surface: #121722; --surface-2: #1a2130; --border: #283247; --border-input: #6a7a96;
  --text: #e9eef7; --text-muted: #a3b0c7; --accent: #4aa3ff; --on-accent: #04101f;
  --ok: #35d492; --reduced: #e8cb55; --warn: #ffa24d; --breach: #ff6b78;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --ease: cubic-bezier(.2, .8, .2, 1); --fast: 120ms; --base: 200ms;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35); --pop: 0 18px 48px rgba(0, 0, 0, .55);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] { --bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef1f7; --border: #d5dbe6; --border-input: #6a7a96; --text: #12171f; --text-muted: #435068; --accent: #1858b0; --on-accent: #ffffff; --ok: #0b6a49; --reduced: #6f5700; --warn: #8f4700; --breach: #a81d33; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .08); --pop: 0 12px 32px rgba(16, 24, 40, .18); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; } h1 { font-size: 26px; font-weight: 750; } h2 { font-size: 20px; font-weight: 650; } h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; } a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, [role="button"] { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.muted { color: var(--text-muted); } .small { font-size: 13px; } .xs { font-size: 12px; } .bold { font-weight: 650; } .center { text-align: center; } .mono { font-family: var(--mono); font-size: 13px; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; } .row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .gap-lg { gap: 20px; } .between { justify-content: space-between; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
#app { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; } #app > * { min-width: 0; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.02em; color: var(--text); text-decoration: none; font-size: 17px; } .brand svg { width: 28px; height: 28px; }
.main { padding: 18px 16px 96px; max-width: 1180px; width: 100%; margin: 0 auto; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; color: var(--text-muted); text-decoration: none; font-size: 11.5px; min-height: 52px; justify-content: center; position: relative; }
.nav a svg { width: 22px; height: 22px; } .nav a[aria-current="page"] { color: var(--accent); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--breach); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
@media (min-width: 900px) {
  #app { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; } .top { grid-column: 1 / -1; }
  .nav { position: sticky; top: 56px; align-self: start; height: calc(100dvh - 56px); grid-auto-flow: row; grid-auto-rows: 46px; border-top: 0; border-right: 1px solid var(--border); padding: 12px 8px; gap: 2px; align-content: start; bottom: auto; z-index: 20; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: var(--r-md); font-size: 14px; } .nav a:hover { background: var(--surface-2); color: var(--text); } .nav a[aria-current="page"] { background: var(--surface-2); }
  .badge { position: static; margin-left: auto; } .main { padding-bottom: 40px; }
}

/* Karten, Chips, Buttons */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); } .card.flat { box-shadow: none; } .card.tight { padding: 12px; }
.card.sub { background: var(--surface-2); box-shadow: none; }
.grid { display: grid; gap: 14px; } .grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } .grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast); touch-action: manipulation; }
.btn:active { transform: scale(.98); } .btn:disabled { opacity: .5; cursor: not-allowed; } .btn.block { width: 100%; } .btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .btn.danger { background: transparent; border-color: var(--breach); color: var(--breach); } .btn.danger.solid { background: var(--breach); color: #1b0509; } .btn.ghost { background: transparent; }
@media (hover: hover) and (pointer: fine) { .btn:hover:not(:disabled) { border-color: var(--text-muted); } .btn.primary:hover:not(:disabled) { filter: brightness(1.08); } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; white-space: nowrap; } .chip.sm { padding: 1px 8px; font-size: 11.5px; }
.lv-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); } .lv-reduced { color: var(--reduced); border-color: color-mix(in srgb, var(--reduced) 45%, var(--border)); }
.lv-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); } .lv-breach { color: var(--breach); border-color: color-mix(in srgb, var(--breach) 55%, var(--border)); }
.env-sim { color: var(--accent); } .env-demo { color: var(--reduced); } .env-live { color: var(--breach); font-weight: 750; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); display: inline-block; flex: none; } .dot.live { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); } .dot.delayed { background: var(--reduced); } .dot.disconnected, .dot.never { background: var(--breach); }
.pos { color: var(--ok); } .neg { color: var(--breach); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; } .field > span { font-size: 13px; color: var(--text-muted); font-weight: 600; } .field small { color: var(--text-muted); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-input); border-radius: var(--r-md); font-size: 16px; } textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; } .check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--accent); } .check.on { border-color: var(--accent); }
.err { color: var(--breach); font-size: 14px; min-height: 0; } .ok-msg { color: var(--ok); font-size: 14px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Banner */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); } .banner.breach { border-color: color-mix(in srgb, var(--breach) 70%, var(--border)); background: color-mix(in srgb, var(--breach) 12%, var(--surface)); }
.banner.info { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); } .banner svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }

/* Tabs / Segment */
.tabs { max-width: 100%; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; border-bottom: 1px solid var(--border); scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--text-muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; min-height: 44px; } .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 3px; gap: 2px; } .seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; color: var(--text-muted); font-weight: 600; cursor: pointer; min-height: 36px; } .seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* Tabellen */
.tbl-wrap { overflow-x: auto; } table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; } .tbl th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; } .tbl tr:last-child td { border-bottom: 0; } .tbl td.r, .tbl th.r { text-align: right; } .tbl tbody tr.click { cursor: pointer; } @media (hover: hover) { .tbl tbody tr.click:hover { background: var(--surface-2); } }

/* Kennzahlen */
.kpi { display: flex; flex-direction: column; gap: 2px; } .kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; } .kpi .l { font-size: 12.5px; color: var(--text-muted); }
.kpi.big .v { font-size: 30px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); } .meter > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width var(--base) var(--ease); }
.meter.reduced > i { background: var(--reduced); } .meter.warn > i { background: var(--warn); } .meter.breach > i { background: var(--breach); }

/* Sheet / Dialog */
.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .6); animation: fade var(--base) var(--ease); } .scrim.out { opacity: 0; transition: opacity 150ms; }
.sheet { position: fixed; z-index: 91; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0; border: 1px solid var(--border); padding: 18px 16px calc(18px + var(--safe-b)); box-shadow: var(--pop); animation: up 260ms cubic-bezier(.32, .72, 0, 1); }
.sheet.out { transform: translateY(100%); transition: transform 170ms ease-in; } .sheet .head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: var(--border); margin: -6px auto 12px; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(680px, 94vw); transform: translate(-50%, -50%); border-radius: var(--r-lg); max-height: 88dvh; animation: pop 220ms var(--ease); } .sheet.out { transform: translate(-50%, -48%); opacity: 0; transition: all 150ms; } }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(100%); } } @keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
#toasts { position: fixed; z-index: 120; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--pop); animation: up 200ms var(--ease); } .toast.bad { border-color: var(--breach); } .toast.good { border-color: var(--ok); } .toast.warn { border-color: var(--warn); }
@media (min-width: 900px) { #toasts { bottom: 24px; left: auto; right: 24px; align-items: flex-end; } }

/* Modus-Karten */
.modes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.mode-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); } .mode-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; } .mode-card ul { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 13.5px; } .mode-card li { margin: 3px 0; }
.mode-card .n { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 750; background: var(--surface-2); border: 1px solid var(--border); }
.modebar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); }
.killbtn { min-height: 52px; font-size: 16px; font-weight: 750; letter-spacing: .02em; }

/* Gauge / Charts */
.gauge { position: relative; width: 100%; max-width: 220px; margin: 0 auto; } .gauge svg { width: 100%; display: block; } .gauge .gv { position: absolute; inset: auto 0 6px 0; text-align: center; } .gauge .gv b { display: block; font-size: 24px; font-weight: 750; } .gauge .gv span { font-size: 12px; color: var(--text-muted); }
.chart { width: 100%; height: auto; display: block; } .chart text { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; } .bars .b { flex: 1; min-width: 6px; border-radius: 3px 3px 0 0; background: var(--ok); position: relative; } .bars .b.n { background: var(--breach); }
.explain { font-size: 12.5px; color: var(--text-muted); background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r-md); padding: 10px 12px; } .explain code { font-family: var(--mono); color: var(--text); }
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; min-height: 32px; display: flex; align-items: center; } details > summary::-webkit-details-marker { display: none; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-muted); display: flex; flex-direction: column; gap: 10px; align-items: center; } .empty svg { width: 44px; height: 44px; color: var(--text-muted); }
.auth { max-width: 440px; margin: 0 auto; padding: 28px 16px 60px; display: flex; flex-direction: column; gap: 18px; } .auth .hero { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.setup { overflow:hidden; padding:0; }.setup-hero{display:flex;gap:16px;align-items:flex-start;padding:22px;background:radial-gradient(circle at 10% 0,var(--accent-soft),transparent 48%),var(--surface-2)}.setup-iris{width:52px;height:52px;flex:0 0 52px;border-radius:50%;display:grid;place-items:center;color:var(--accent);background:radial-gradient(circle,var(--accent-soft),transparent 68%);border:1px solid var(--border)}.setup-notice{display:flex;gap:10px;flex-wrap:wrap;padding:14px 22px;border-bottom:1px solid var(--border);background:var(--surface)}.setup-device{display:inline-flex;gap:7px;align-items:center;flex-wrap:wrap}.setup-flow{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}.setup-step{display:flex;gap:14px;padding:20px;border-bottom:1px solid var(--border);min-width:0}.setup-step:nth-child(odd){border-right:1px solid var(--border)}.setup-num{color:var(--accent);font:700 12px/1 ui-monospace,monospace;padding-top:4px}.setup-diagram{display:flex;align-items:center;gap:7px;flex-wrap:wrap;color:var(--text-muted);font-size:12px}.setup-diagram svg{width:16px;transform:rotate(180deg)}.setup-url{display:block;max-width:100%;overflow:auto;padding:9px 10px;border-radius:8px;background:var(--surface-3);color:var(--text);font-size:12px}.help-page{max-width:920px}.help-item summary{cursor:pointer;font-weight:650;list-style:none}.help-item summary::after{content:'+';float:right;color:var(--accent)}.help-item[open] summary::after{content:'−'}.help-item p{margin:14px 0 0;line-height:1.55}@media(max-width:680px){.setup-flow{grid-template-columns:1fr}.setup-step:nth-child(odd){border-right:0}.setup-hero{padding:18px}.setup-notice{padding:12px 18px}.setup-step{padding:18px}.setup-iris{width:44px;height:44px;flex-basis:44px}}
.sim-panel { border: 1px dashed var(--border-input); border-radius: var(--r-md); padding: 12px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; margin: 20px auto; } @keyframes rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.risk-note { font-size: 12.5px; color: var(--text-muted); text-align: center; padding: 8px 0; }

/* Verbindungsassistent */
.choice { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: left; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; min-height: 44px; padding: 16px; }
.choice:hover { border-color: var(--accent); } .choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; } .stepper li { display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.stepper .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-input); font-size: 13px; }
.stepper li.now { color: var(--text); font-weight: 650; } .stepper li.now .n { border-color: var(--accent); color: var(--accent); } .stepper li.done .n { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.cols-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; } .danger-zone { border-color: var(--breach); }
