/* Minewhyle Admin — Design-System (keine Build-Tools, reines CSS) */
* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #dfe3e8;
  --border-strong: #c9cfd6;
  --text: #1a2230;
  --text-2: #475467;
  --text-muted: #6b7686;
  --accent: #1f3a5f;
  --accent-hover: #172d4a;
  --accent-soft: #e9eef5;
  --accent-soft-2: #d5dfeb;
  --accent-contrast: #ffffff;
  --grid: #e8ebef;
  --sidebar-bg: #15253c;
  --sidebar-text: #c3cddb;
  --sidebar-muted: #7f8ea3;
  --sidebar-active: #22385a;
  --sidebar-indicator: #8fb3e0;
  --good: #2f855a;
  --good-text: #22643f;
  --good-soft: #e7f3ec;
  --warning: #d69e2e;
  --warning-text: #7a5410;
  --warning-soft: #fbf3e2;
  --critical: #c53030;
  --critical-soft: #fbecec;
  --shadow-sm: 0 1px 1px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --radius: 6px;
  --radius-sm: 4px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1217;
    --surface: #161a21;
    --surface-2: #1b2029;
    --border: #2a313c;
    --border-strong: #38414e;
    --text: #e6e9ee;
    --text-2: #b4bcc8;
    --text-muted: #808a98;
    --accent: #7fa3cf;
    --accent-hover: #93b3da;
    --accent-soft: #1b2636;
    --accent-soft-2: #24344a;
    --accent-contrast: #0d1522;
    --grid: #252b35;
    --sidebar-bg: #0b0f15;
    --sidebar-active: #1a2638;
    --good: #48a878;
    --good-text: #6cc394;
    --good-soft: #16281f;
    --warning: #d9a94a;
    --warning-text: #e3b863;
    --warning-soft: #2c2413;
    --critical: #e06a6a;
    --critical-soft: #321b1b;
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent); }
svg.i { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* --- Formulare & Buttons --------------------------------------------------- */

input[type="email"], input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-2);
}
textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .nav-item:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--critical); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--critical-soft); border-color: var(--critical); }
.btn.danger-solid { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.icon-only { padding: 6px; }
.btn.block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > span, .label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 32px; height: 18px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.seg button { font: inherit; font-size: 12.5px; border: 0; background: transparent; color: var(--text-2); padding: 5px 11px; border-radius: 3px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* --- Auth / Onboarding ------------------------------------------------------ */

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-card.wide { max-width: 520px; }
.auth-card h1 { font-size: 20px; font-weight: 600; margin: 14px 0 6px; }
.auth-card .lead { font-size: 13.5px; color: var(--text-2); margin: 0 0 22px; }
.auth-card form .btn { width: 100%; }
.auth-card .divider { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; margin: 20px 0; }
.auth-card .divider::before, .auth-card .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.brand-mark { width: 44px; height: 44px; display: block; }
.center-screen .brand-mark { margin: 0 auto; }
.auth-card .brand-mark { margin: 0; }
.status-msg { font-size: 12.5px; margin: 12px 0 0; min-height: 18px; }
.status-msg.ok { color: var(--good-text); }
.status-msg.error { color: var(--critical); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.choice h3 { font-size: 14px; margin: 0 0 4px; }
.choice p { font-size: 12.5px; color: var(--text-2); margin: 0 0 12px; }
.choice input { margin-bottom: 8px; }

/* --- App-Shell -------------------------------------------------------------- */

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 6px; }
.brand .brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.brand-name { font-size: 15px; font-weight: 600; color: #ffffff; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 10.5px; font-weight: 600; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: .08em; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  font: inherit; font-size: 13.5px;
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.nav-item.active { background: var(--sidebar-active); color: #ffffff; font-weight: 600; box-shadow: inset 3px 0 0 var(--sidebar-indicator); }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--sidebar-muted); font-weight: 500; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me .who { min-width: 0; flex: 1; }
.me .who strong { display: block; font-size: 13px; color: #ffffff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11.5px; color: var(--sidebar-muted); }
.sidebar .avatar { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.sidebar .btn.ghost { color: var(--sidebar-text); }
.sidebar .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.sidebar .nav-item:focus-visible, .sidebar .btn:focus-visible { outline-color: var(--sidebar-indicator); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600;
  background: var(--accent-soft-2); color: var(--accent);
  flex-shrink: 0;
}

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 600; margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--text-muted); }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; }
.view { padding: 24px 32px 64px; max-width: 1240px; }

/* --- Karten, Kacheln -------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.card-head .desc { font-size: 12.5px; color: var(--text-muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

.tile { padding: 16px 18px; }
.tile .t-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tile .t-value { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .t-value small { font-size: 14px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.tile .t-foot { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  padding: 22px 24px;
  background: var(--surface);
  border-left: 4px solid var(--accent);
}
.hero .h-value { font-size: 46px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero .h-label { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.hero .h-side h2 { font-size: 15px; margin: 0 0 4px; }
.hero .h-side p { font-size: 13px; color: var(--text-2); margin: 0 0 12px; max-width: 60ch; }

/* Meter + Status-Balken */
.meter { height: 8px; border-radius: 2px; background: var(--accent-soft-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.meter.good > span { background: var(--good); }
.stackbar { display: flex; height: 10px; border-radius: 2px; overflow: hidden; gap: 2px; background: var(--surface); }
.stackbar > span { display: block; height: 100%; }
.stackbar > span:first-child { border-radius: 2px 0 0 99px; }
.stackbar > span:last-child { border-radius: 0 99px 99px 0; }
.stackbar > span:only-child { border-radius: 2px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.privacy-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin: 12px 0 0 !important; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Status-Pillen (immer Icon + Text) */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 7px 2px 5px; border-radius: 3px; white-space: nowrap; }
.status svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.status.ok { background: var(--good-soft); color: var(--good-text); }
.status.progress { background: var(--warning-soft); color: var(--warning-text); }
.status.inactive { background: var(--critical-soft); color: var(--critical); }

/* Badges & Chips */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 550; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 7px; white-space: nowrap; }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; padding: 2px 8px 2px 7px; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-toggle { cursor: pointer; }
.chip-toggle { position: relative; }
.chip-toggle input, .type-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip-toggle:has(input:focus-visible), .type-picker label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- Tabellen ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .p-text { min-width: 0; }
.person .p-text > strong, .person .p-text > div > strong { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .p-text > span, .person .p-text > div > span { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.nowrap { white-space: nowrap; }
.cell-meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-meter .meter { flex: 1; height: 6px; }
td select { width: auto; padding: 5px 8px; font-size: 12.5px; }

/* --- Listen (Fragen, Handlungsbedarf) ------------------------------------- */

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.inactive .q-text { color: var(--text-muted); }
.q-text { font-size: 13.5px; font-weight: 550; margin-bottom: 5px; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-muted); }
.q-stats { text-align: right; min-width: 92px; font-size: 12px; color: var(--text-muted); }
.q-stats strong { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.list-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }

.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-row:last-child { border-bottom: 0; }

/* Horizontale Balken (Gruppen, Themen, Optionen) */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar .hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.hbar .hb-top .hb-val { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.hbar .hb-track { height: 8px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.hbar .hb-fill { height: 100%; background: var(--accent); border-radius: 2px; min-width: 2px; }
.hbar.correct .hb-fill { background: var(--good); }

/* --- Fragen-Layout: Themen links ------------------------------------------ */

.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.topic-list { position: sticky; top: 76px; }
.topic-item { display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: 13px; color: var(--text-2); background: transparent; border: 0; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.topic-item:hover { background: var(--surface); color: var(--text); }
.topic-item.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.topic-item .count { margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 500; }
.topic-item .t-actions { display: none; gap: 2px; }
.topic-item:hover .t-actions { display: inline-flex; }
.topic-item:hover .count { display: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.toolbar .search input { padding-left: 32px; }
.toolbar select { width: auto; }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.bulkbar .spacer { flex: 1; }

/* Gruppen-Karten */
.group-card { display: flex; flex-direction: column; gap: 12px; border-top: 3px solid var(--g, var(--accent)); }
.group-card h3 { font-size: 15px; margin: 0; }
.group-card .g-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.group-card .g-stats div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.group-card .g-stats strong { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.group-card .g-stats span { font-size: 11.5px; color: var(--text-muted); }
.avatars { display: flex; }
.avatars .avatar { width: 26px; height: 26px; font-size: 10.5px; border: 2px solid var(--surface); margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px var(--surface); }
.swatch.active { border-color: var(--text); }

/* Einladungscode */
.invite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.invite code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 20px; letter-spacing: .1em; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 14px; font-weight: 600; }

/* Leerzustände */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .e-icon { width: 44px; height: 44px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.empty .e-icon svg.i { width: 22px; height: 22px; }
.empty h3 { font-size: 15px; color: var(--text); margin: 0 0 4px; }
.empty p { font-size: 13px; margin: 0 auto 14px; max-width: 46ch; }

/* --- Diagramm ---------------------------------------------------------------- */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); transition: opacity .1s; pointer-events: none; }
.chart .bar.zero { fill: var(--grid); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { opacity: .75; }
.chart .hit:focus { outline: none; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--text); color: var(--bg);
  font-size: 12px; line-height: 1.4;
  padding: 7px 10px; border-radius: 4px;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip strong { font-size: 14px; display: block; }

/* --- Dialog, Toast ---------------------------------------------------------- */

dialog.modal {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 36, .5); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-head h2 { font-size: 16.5px; margin: 0; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 16px 22px; overflow-y: auto; max-height: calc(100vh - 190px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 8px 8px; }
.modal-foot .left { margin-right: auto; }

.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row input[type="radio"], .opt-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--good); flex-shrink: 0; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-picker label { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px; font-size: 13px; cursor: pointer; text-align: center; }
.type-picker label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 4px; font-size: 13px; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; max-width: 380px; }
.toast.error { background: var(--critical); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.callout { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); color: var(--text); font-size: 13px; }
.callout svg.i { color: var(--accent); margin-top: 2px; }
.callout p { margin: 0; }
.callout.ok { border-left-color: var(--good); }
.callout.ok svg.i { color: var(--good); }
.callout.warn { border-left-color: var(--warning); }
.callout.warn svg.i { color: var(--warning-text); }
.keybox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; }
pre.snippet { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; white-space: pre; margin: 6px 0 12px; max-height: 260px; }
.receipt { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--border-strong); font-size: 11.5px; color: var(--text-muted); }
.receipt code { font-size: 11px; word-break: break-all; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--grid), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 4px; height: 90px; }
@keyframes sk { to { background-position: -200% 0; } }

/* --- Druck-Nachweis ---------------------------------------------------------- */

.print-only { display: none; }

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block; }
  th { background: #f2f2f2 !important; }
  .status { border: 1px solid currentColor; }
  a { color: #000; text-decoration: none; }
}

/* --- Responsive -------------------------------------------------------------- */

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .view { padding: 8px 16px 48px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .topic-list { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .topic-list .label { display: none; }
  .toolbar .search { min-width: 100%; }
  .toolbar select { flex: 1; }
  .topbar .actions .btn span.hide-sm { display: none; }
  .topic-item { width: auto; white-space: nowrap; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 12px; }
  .hero .h-value { font-size: 44px; }
  .choice-grid { grid-template-columns: 1fr; }
  .q-stats { display: none; }
  .hide-sm { display: none; }
}

@media (max-width: 520px) {
  .grid.cols-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile .t-value { font-size: 23px; }
}


/* ── Einrichtungsassistent ─────────────────────────────────────────────── */
#setupScreen { min-height: 100vh; background: var(--bg); }
.wiz { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.wiz-side { background: var(--sidebar-bg); color: var(--sidebar-text); padding: 28px 24px; display: flex; flex-direction: column; gap: 28px; }
.wiz-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: #fff; }
.wiz-rail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wiz-rail li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 6px; font-size: 13.5px; color: var(--sidebar-muted); }
.wiz-rail li .dot { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--sidebar-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.wiz-rail li .dot svg.i { width: 13px; height: 13px; }
.wiz-rail li.current { background: var(--sidebar-active); color: #fff; }
.wiz-rail li.current .dot { border-color: var(--sidebar-indicator); color: var(--sidebar-indicator); }
.wiz-rail li.done { color: var(--sidebar-text); }
.wiz-rail li.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.wiz-logout { margin-top: auto; align-self: flex-start; color: var(--sidebar-muted); }
.wiz-main { padding: 48px clamp(20px, 5vw, 72px) 40px; display: flex; flex-direction: column; overflow-y: auto; max-height: 100vh; }
.wiz-content { max-width: 720px; width: 100%; }
.wiz-content h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.01em; }
.wiz-lead { font-size: 15px; color: var(--text-2); margin: 0 0 26px; max-width: 62ch; line-height: 1.55; }
.wiz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 28px; }
.wiz-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.wiz-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.wiz-card-i { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.wiz-actions { display: flex; gap: 12px; margin: 8px 0 22px; }
.wiz-join { margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.wiz-join summary { cursor: pointer; }
.wiz-inline { display: flex; gap: 10px; margin: 12px 0 8px; max-width: 420px; }
.wiz-inline input { flex: 1; }
.wiz-help { margin-top: 6px; }
.wiz-opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.wiz-opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wiz-opt input { margin-top: 4px; }
.wiz-opt p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.pill { font-style: normal; font-size: 11px; font-weight: 600; background: var(--good-soft); color: var(--good-text); border-radius: 99px; padding: 1px 8px; margin-left: 6px; }
.wiz-confirm { display: flex; gap: 10px; font-size: 13px; padding: 10px 12px; background: var(--warning-soft); border-radius: var(--radius-sm); color: var(--warning-text); }
.wiz-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.wiz-nav { max-width: 720px; width: 100%; display: flex; align-items: center; gap: 14px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.wiz-nav .status-msg { flex: 1; text-align: right; margin: 0; }
.wiz-done { text-align: left; }
.wiz-done-i { width: 48px; height: 48px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.wiz-done-i svg.i { width: 26px; height: 26px; }
.wiz-next { padding-left: 20px; line-height: 1.6; max-width: 62ch; }
.wiz-next li { margin-bottom: 14px; color: var(--text-2); }
.wiz-next strong { color: var(--text); }
@media (max-width: 860px) {
  .wiz { grid-template-columns: 1fr; }
  .wiz-side { flex-direction: row; align-items: center; padding: 14px 16px; gap: 16px; overflow-x: auto; }
  .wiz-rail { flex-direction: row; }
  .wiz-rail li span:not(.dot) { display: none; }
  .wiz-rail li.current span:not(.dot) { display: inline; }
  .wiz-logout { margin-top: 0; margin-left: auto; }
  .wiz-main { max-height: none; padding-top: 28px; }
}

/* ── Rundgang + Hilfe ──────────────────────────────────────────────────── */
.tour { position: fixed; inset: 0; z-index: 1000; }
.tour-spot { position: fixed; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(10, 18, 32, 0.62); border: 2px solid var(--sidebar-indicator); pointer-events: none; transition: all .25s ease; display: none; }
.tour-card { position: fixed; width: min(380px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px 22px 16px; }
.tour-card h3 { margin: 4px 0 8px; font-size: 17px; }
.tour-card p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.tour-step { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.tour-btns { display: flex; gap: 8px; align-items: center; }
.help-i { width: 30px; height: 30px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.help-flow { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; font-size: 13.5px; color: var(--text-2); }
.help-flow li { margin-bottom: 8px; }
.help-flow strong { color: var(--text); }
.help-gloss details { border-bottom: 1px solid var(--border); padding: 9px 0; }
.help-gloss details:last-child { border-bottom: 0; }
.help-gloss summary { cursor: pointer; font-size: 13.5px; font-weight: 550; }
.help-gloss p { margin: 8px 0 2px; font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* Live-Demo-Hinweis */
.demo-bar { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18); font-size: 13px; }
.demo-bar .btn { white-space: nowrap; }
