/* Heilsan Praxis-OS – Designsystem */
:root {
  --bg: #060a13;
  --bg2: #0a1020;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-solid: #0f172a;
  --panel2: #131d33;
  --panel3: #18233d;
  --line: rgba(148, 163, 184, 0.13);
  --line2: rgba(148, 163, 184, 0.24);
  --text: #e7eef8;
  --text2: #c3cfe0;
  --muted: #8495b0;
  --faint: #7a89a3;
  --accent: #38bdf8;
  --accent-ink: #04131f;
  --accent-soft: rgba(56, 189, 248, 0.13);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.14);
  --crit: #dc2626;
  --info: #60a5fa;
  --pink: #f472b6;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --r: 14px;
  --r-sm: 9px;
  --r-xs: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --side-w: 232px;
  --top-h: 58px;
  --t: 160ms cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef2f8;
  --bg2: #f6f8fc;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel2: #f3f6fb;
  --panel3: #e9eef6;
  --line: rgba(15, 23, 42, 0.09);
  --line2: rgba(15, 23, 42, 0.18);
  --text: #0d1626;
  --text2: #24324a;
  --muted: #5a6a85;
  --faint: #56657c;
  --accent: #0369a1;
  --accent-ink: #ffffff;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.09);
  --ok: #065f46;
  --ok-soft: rgba(5, 150, 105, 0.1);
  --warn: #92400e;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --err: #b91c1c;
  --err-soft: rgba(220, 38, 38, 0.09);
  --crit: #dc2626;
  --info: #2563eb;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(167, 139, 250, 0.06), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
:root[data-theme="light"] body { background-image: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14.5px; }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .err-t { color: var(--err); } .acc-t { color: var(--accent); } .vio-t { color: var(--violet); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap4 { gap: 4px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.p12 { padding: 12px; } .p16 { padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4, .g6 { grid-template-columns: minmax(0, 1fr); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.18); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.32); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(56, 189, 248, 0.3); }

/* ---------- App-Shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100vh; }
.app.collapsed { --side-w: 66px; }
.side {
  grid-row: 1 / span 2; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 16, 32, 0.92), rgba(6, 10, 19, 0.95));
  display: flex; flex-direction: column; min-height: 0;
}
:root[data-theme="light"] .side { background: #ffffff; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; background: transparent; color: inherit; font: inherit; text-align: left; width: 100%; }
.brand-text { display: block; }
.brand-name, .brand-sub { display: block; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center;
  background: conic-gradient(from 210deg, #38bdf8, #a78bfa, #f472b6, #38bdf8); box-shadow: 0 0 22px rgba(56, 189, 248, 0.35); }
.brand-mark svg { width: 18px; height: 18px; color: #04131f; }
.brand-name { font-weight: 750; letter-spacing: .14em; font-size: 14px; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; margin-top: -2px; }
.app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav-badge, .app.collapsed .side-foot .txt { display: none; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 12px 10px 4px; }
.app.collapsed .nav-sec { visibility: hidden; height: 8px; padding: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text2);
  cursor: pointer; transition: background var(--t), color var(--t); position: relative; user-select: none; font-weight: 520;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; background: var(--panel3); color: var(--text2); }
.nav-badge.alert { background: var(--crit); color: #fff; animation: pulse-red 1.6s infinite; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.side-foot svg { width: 16px; height: 16px; color: var(--ok); }

.top {
  display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 19, 0.6); backdrop-filter: blur(14px); min-width: 0;
}
:root[data-theme="light"] .top { background: rgba(255, 255, 255, 0.85); }
.top-title { font-size: 16px; font-weight: 650; white-space: nowrap; }
.top-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.clock { font-family: var(--mono); font-size: 13px; padding: 5px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; color: var(--text); cursor: pointer; }
.clock .sim { color: var(--warn); font-weight: 700; margin-left: 6px; }
.main { overflow: auto; min-height: 0; position: relative; }
.view { padding: 20px 22px 40px; max-width: 1680px; margin: 0 auto; animation: fade-in .25s ease; }
.view.full { max-width: none; padding: 14px; height: 100%; }
.view-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head .sub { color: var(--muted); margin-top: 3px; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Bausteine ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow-sm); min-width: 0; position: relative;
}
.card.flat { box-shadow: none; }
.card.tight { padding: 12px; }
.card.glow { border-color: rgba(56, 189, 248, 0.35); box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15), 0 0 40px rgba(56, 189, 248, 0.08); }
.card.alert { border-color: rgba(239, 68, 68, 0.55); box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25), 0 0 30px rgba(239, 68, 68, 0.12); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.card-head h3 { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--accent); flex: 0 0 17px; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: inherit; font-weight: 560; cursor: pointer;
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t); white-space: nowrap; user-select: none;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn:hover { border-color: var(--accent); background: var(--panel3); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 18px rgba(56, 189, 248, 0.25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.violet { background: var(--violet); color: #12052b; border-color: transparent; }
.btn.ok { background: var(--ok); color: #03221a; border-color: transparent; }
.btn.danger { background: var(--crit); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: rgba(148, 163, 184, 0.1); border-color: transparent; }
.btn.outline { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.xs svg, .btn.sm svg { width: 14px; height: 14px; flex-basis: 14px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.xl { height: 64px; padding: 0 28px; font-size: 18px; border-radius: 16px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.rec { background: var(--crit); color: #fff; border-color: transparent; animation: pulse-red 1.6s infinite; }
.btn-group { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.btn-group .btn { border: 0; border-radius: 0; background: transparent; height: 32px; }
.btn-group .btn.active { background: var(--accent-soft); color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--panel3); color: var(--text2); border: 1px solid var(--line); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip svg { width: 12px; height: 12px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.chip.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.vio { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.chip.solid-err { background: var(--crit); color: #fff; border-color: transparent; }
.chip.click { cursor: pointer; }
.chip.click:hover { border-color: var(--accent); }
.chip.lg { height: 28px; padding: 0 12px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: 0 0 8px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.err { background: var(--err); box-shadow: 0 0 8px var(--err); }
.dot.info { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.live { background: var(--crit); animation: blink 1.2s infinite; }

.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .lbl svg { width: 14px; height: 14px; }
.kpi .val { font-size: 28px; font-weight: 720; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .delta { font-size: 12px; margin-top: 2px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: 12px; color: var(--muted); font-weight: 560; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; width: 100%;
  outline: none; transition: border-color var(--t), box-shadow var(--t); min-width: 0;
}
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; flex: 0 0 16px; }
input[type="range"] { padding: 0; accent-color: var(--accent); background: transparent; border: 0; }
input[type="color"] { padding: 2px; height: 34px; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { padding-left: 34px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 580; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 6px; user-select: none; }
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .chip { height: 18px; font-size: 10.5px; padding: 0 6px; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg > * { padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 580; font-size: 12.5px; user-select: none; white-space: nowrap; }
.seg > .active { background: var(--panel3); color: var(--text); box-shadow: var(--shadow-sm); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 620; padding: 8px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(148, 163, 184, 0.05); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.tbl-wrap { overflow-x: auto; }

.list { display: flex; flex-direction: column; gap: 6px; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); min-width: 0; }
.li.click { cursor: pointer; transition: border-color var(--t), background var(--t); }
.li.click:hover { border-color: var(--line2); background: var(--panel3); }
.li.active { border-color: var(--accent); background: var(--accent-soft); }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #04131f;
  background: linear-gradient(135deg, #7dd3fc, #c4b5fd); }
.avatar.lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; flex-basis: 72px; font-size: 24px; }

.meter { height: 8px; border-radius: 6px; background: var(--panel3); overflow: hidden; position: relative; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); transition: width .4s ease; }
.meter.ok > i { background: var(--ok); } .meter.warn > i { background: var(--warn); } .meter.err > i { background: var(--err); }
.meter.grad > i { background: linear-gradient(90deg, var(--ok), var(--warn), var(--err)); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-size: 13px; }
.banner svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.banner.info { background: var(--accent-soft); border-color: rgba(56, 189, 248, 0.25); } .banner.info svg { color: var(--accent); }
.banner.warn { background: var(--warn-soft); border-color: rgba(251, 191, 36, 0.3); } .banner.warn svg { color: var(--warn); }
.banner.err { background: var(--err-soft); border-color: rgba(248, 113, 113, 0.35); } .banner.err svg { color: var(--err); }
.banner.ok { background: var(--ok-soft); border-color: rgba(52, 211, 153, 0.3); } .banner.ok svg { color: var(--ok); }
.banner b { font-weight: 650; }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 12px; }
.empty svg { width: 28px; height: 28px; opacity: .6; display: block; margin: 0 auto 8px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
.kv > :nth-child(odd) { color: var(--muted); }
.stat-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-variant-numeric: tabular-nums; }

.pill-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-geplant { background: var(--panel3); color: var(--muted); }
.st-benachrichtigt { background: var(--violet-soft); color: var(--violet); }
.st-unterwegs { background: var(--accent-soft); color: var(--accent); }
.st-angekommen { background: var(--warn-soft); color: var(--warn); }
.st-im_zimmer { background: var(--ok-soft); color: var(--ok); }
.st-fertig { background: transparent; color: var(--faint); border: 1px solid var(--line); }
.st-abgesagt, .st-nicht_erschienen { background: var(--err-soft); color: var(--err); }

.triage-1 { --tc: #ef4444; } .triage-2 { --tc: #f97316; } .triage-3 { --tc: #eab308; } .triage-4 { --tc: #22c55e; } .triage-5 { --tc: #3b82f6; }
.triage-badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--tc); color: #0b0b0b; font-weight: 800; font-size: 13px; flex: 0 0 26px; }

.ai-badge { border: 0; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.16), rgba(167, 139, 250, 0.2)); color: var(--violet); white-space: nowrap; }
.ai-badge svg { width: 12px; height: 12px; }
.ai-badge.local { background: var(--panel2); color: var(--text2); box-shadow: inset 0 0 0 1px var(--line2); }
.ai-shimmer { background: linear-gradient(90deg, var(--panel2) 0%, var(--panel3) 40%, var(--panel2) 80%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px; }

.disclaimer { font-size: 11.5px; color: var(--faint); line-height: 1.45; display: flex; gap: 6px; align-items: flex-start; }
.disclaimer svg { width: 13px; height: 13px; flex: 0 0 13px; margin-top: 2px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; flex: 0 0 16px; }

.drop { border: 2px dashed var(--line2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color var(--t), background var(--t); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Overlays ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 14, 0.66); backdrop-filter: blur(5px); z-index: 900; display: grid; place-items: center; padding: 20px; animation: fade-in .15s ease; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; animation: pop-in .2s cubic-bezier(.2, .8, .2, 1.2); }
.modal.wide { width: min(1020px, 100%); }
.modal.xwide { width: min(1320px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line2); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: slide-in .25s ease; font-size: 13px; }
.toast svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.toast.ok svg { color: var(--ok); } .toast.warn svg { color: var(--warn); } .toast.err svg { color: var(--err); } .toast.info svg { color: var(--accent); }
.toast.err { border-color: rgba(248, 113, 113, 0.5); }
.alarm-bar { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 950; background: var(--crit); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 40px rgba(239, 68, 68, 0.45); display: flex; align-items: center; gap: 12px; font-weight: 650; animation: pop-in .25s ease; max-width: calc(100vw - 40px); }
.alarm-bar svg { width: 20px; height: 20px; animation: blink 1s infinite; }
.alarm-bar .btn { background: rgba(255, 255, 255, 0.18); color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---------- Cockpit ---------- */
.cockpit { display: grid; grid-template-columns: 300px minmax(440px, 1fr) minmax(420px, 470px); gap: 12px; height: calc(100vh - var(--top-h) - 28px); }
.cockpit > .colm { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.cockpit > .colm > .card { display: flex; flex-direction: column; min-height: 0; }
.cockpit .scroll { overflow: auto; min-height: 0; flex: 1; }
@media (max-width: 1360px) { .cockpit { grid-template-columns: 260px minmax(380px, 1fr) 400px; } }
@media (max-width: 1150px) {
  .cockpit { grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto auto; height: auto; }
  .cockpit > .colm:nth-child(3) { grid-column: 1 / -1; }
  .cockpit > .colm { min-height: 420px; }
}
@media (max-width: 820px) {
  .cockpit { grid-template-columns: minmax(0, 1fr); }
  .cockpit > .colm:first-child { min-height: 0; max-height: 360px; }
}
.pipe-item { padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; transition: all var(--t); display: flex; gap: 10px; align-items: flex-start; }
.pipe-item:hover { border-color: var(--line2); }
.pipe-item.active { border-color: var(--accent); background: var(--accent-soft); }
.pipe-item .time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pipe-item .eta { font-family: var(--mono); font-size: 11.5px; }
.pt-head { display: flex; gap: 12px; align-items: center; }
.pt-head .name { font-size: 18px; font-weight: 700; }
.pt-flags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- Charts ---------- */
.spark { display: block; overflow: visible; }
.chart-axis { stroke: var(--line2); stroke-width: 1; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-lbl { fill: var(--muted); font-size: 10px; font-family: var(--mono); }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff !important; color: #000 !important; overflow: visible; }
  .app > .side, .top, .toasts, .no-print, .modal-back:not(.print-keep) { display: none !important; }
  .print-only { display: block; }
}

/* ---------- Animationen ---------- */
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@keyframes pulse-acc { 0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5); } 70% { box-shadow: 0 0 0 12px rgba(56, 189, 248, 0); } 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- Barrierefreiheit & Tablet (Ausbaustufe 3) ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 2000; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 700; box-shadow: var(--shadow); transition: top .15s; }
.skip-link:focus { top: 10px; text-decoration: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .nav-item:focus-visible, .tab:focus-visible, .chip.click:focus-visible, .li.click:focus-visible, .pipe-item:focus-visible, .seg > *:focus-visible, .clock:focus-visible, .brand:focus-visible, .ai-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent-soft); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.main:focus { outline: none; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item { text-decoration: none; }
.nav-item:hover { text-decoration: none; }
button.chip { font-family: inherit; cursor: pointer; }
.menu-btn { display: none; flex: 0 0 34px; }
.nav-backdrop { display: none; }
.err-hint { position: fixed; left: 18px; bottom: 18px; z-index: 990; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line2); box-shadow: var(--shadow); font-size: 12.5px; color: var(--text2); animation: slide-in .25s ease; max-width: calc(100vw - 36px); }
.err-hint > span:first-child svg { width: 16px; height: 16px; color: var(--warn); display: block; }
.err-stack { white-space: pre-wrap; background: var(--panel2); padding: 8px; border-radius: 8px; max-height: 220px; overflow: auto; margin: 6px 0 0; }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line2); border-bottom-width: 2px; background: var(--panel2); font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.kbd + .kbd { margin-left: 4px; }

/* Tablet & schmale Fenster: Navigation als einblendbare Leiste */
@media (max-width: 1100px) {
  .app, .app.collapsed { grid-template-columns: 1fr; --side-w: 260px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 920; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); background: var(--bg2); }
  .app.nav-open .side { transform: none; }
  .app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav-badge, .app.collapsed .side-foot .txt { display: revert; }
  .app.collapsed .nav-sec { visibility: visible; height: auto; padding: 12px 10px 4px; }
  .app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 910; background: rgba(2, 6, 14, 0.55); }
  .top { grid-column: 1; padding: 0 12px; gap: 8px; }
  .main { grid-column: 1; }
  .menu-btn { display: inline-flex; }
  .view { padding: 16px 14px 32px; }
  .view.full { padding: 10px; }
}
@media (max-width: 900px) { .top-patient { display: none !important; } .top-sub { display: none; } }
@media (max-width: 640px) { .top-ai, .top-help { display: none !important; } .clock { padding: 5px 7px; font-size: 12px; } }
@media (prefers-contrast: more) { :root { --line: rgba(148, 163, 184, 0.35); --line2: rgba(148, 163, 184, 0.55); --muted: #a9b6cb; --faint: #95a3bb; } :root[data-theme="light"] { --line: rgba(15, 23, 42, 0.3); --line2: rgba(15, 23, 42, 0.5); --muted: #3f4d64; --faint: #4d5b72; } }
@media (forced-colors: active) { .btn, .chip, .nav-item, .tab, .li.click { border: 1px solid ButtonText; } .nav-item.active, .tab.active { outline: 2px solid Highlight; } }
:root[data-theme="light"] .btn.violet, :root[data-theme="light"] .btn.ok { color: #fff; }

/* Sehr lange Namen dürfen die Kopfzeile nicht verbreitern */
.top-right .chip, .top-right .top-patient { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
