/* ═══════════════════════ Grundlagen ═══════════════════════ */
:root {
  color-scheme: dark;
  --bg: #0a0d14;
  --bg-glow: rgba(91, 140, 255, .07);
  --surface: #11161f;
  --surface-2: #161d2a;
  --surface-3: #1e2738;
  --raise: rgba(255, 255, 255, .025);
  --border: #222b3b;
  --border-strong: #2e3a50;
  --text: #e8edf6;
  --muted: #8a96ad;
  --faint: #5f6b82;
  --accent: #5b8cff;
  --accent-2: #8aafff;
  --accent-soft: rgba(91, 140, 255, .14);
  --violet: #8b5cf6;
  --ok: #2ecc8f;
  --warn: #f5a524;
  --danger: #ef5a5a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --side-w: 256px;
  --top-h: 60px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(139, 92, 246, .05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 680; letter-spacing: -.015em; }
h1 { font-size: 24px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
a { color: var(--accent-2); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
pre { margin: 6px 0 0; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: auto; max-height: 220px; white-space: pre-wrap; word-break: break-word; }
kbd { font: 600 10.5px/1 ui-monospace, Menlo, Consolas, monospace; padding: 3px 5px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-3); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.ico { flex: none; display: block; }

/* ═══════════════════════ Rahmen ═══════════════════════ */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; display: flex; flex-direction: column; }

/* Seitenleiste */
.side {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-right: 1px solid var(--border);
  padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 16px;
  box-shadow: 0 6px 18px rgba(91, 140, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand b { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-size: 11.5px; }
.nav-search {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); cursor: pointer; text-align: left;
}
.nav-search:hover { border-color: var(--border-strong); color: var(--text); }
.nav-search span { flex: 1; }
.nav-scroll { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.nav-group { margin-top: 10px; }
.nav-group-head {
  display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer;
  padding: 6px 10px; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.nav-group-head span:first-child { flex: 1; text-align: left; }
.nav-group-head:hover { color: var(--muted); }
.nav-group-head .ico { transition: transform .18s ease; }
.nav-group.open .nav-group-head .ico { transform: rotate(90deg); }
.nav-items { display: grid; gap: 2px; }
.nav-items.closed { display: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 9px;
  color: var(--muted); cursor: pointer; font-size: 13.5px; transition: background .12s, color .12s;
}
.nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .ico { opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-item.active .ico { color: var(--accent-2); opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.nav-foot { border-top: 1px solid var(--border); padding: 12px 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 9px; min-width: 0; }
.me .avatar { margin: 0; background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; }
.me-text { min-width: 0; }
.me-text b { display: block; font-size: 12.5px; }
.me-text span { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }

/* Kopfleiste */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 8px; padding: 0 clamp(16px, 3vw, 40px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; }
.crumbs .ico { color: var(--faint); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn.on { color: var(--ok); }
.icon-btn .dot {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.menu-btn { display: none; }
.scrim { display: none; }

.main { padding: 28px clamp(16px, 3vw, 40px) 64px; min-width: 0; width: 100%; max-width: 1480px; }
.page { animation: page-in .22s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
/* Zwischenüberschriften direkt auf der Seite */
.page > h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px !important; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  margin: 26px 0 12px !important;
}
.page > h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.spacer { flex: 1; }

/* ═══════════════════════ Knöpfe, Eingaben ═══════════════════════ */
.btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); padding: 7px 13px; border-radius: 9px;
  cursor: pointer; white-space: nowrap; font-weight: 550; transition: background .12s, border-color .12s, transform .06s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #6c98ff, var(--accent)); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(91, 140, 255, .3); }
.btn.primary:hover { background: linear-gradient(180deg, #7aa3ff, #4f82f7); }
.btn.danger { background: rgba(239, 90, 90, .12); border-color: rgba(239, 90, 90, .45); color: #ff9a9a; box-shadow: none; }
.btn.danger:hover { background: rgba(239, 90, 90, .24); }
.btn.ok { background: rgba(46, 204, 143, .12); border-color: rgba(46, 204, 143, .42); color: #7fe6bd; box-shadow: none; }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: none; box-shadow: none; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 11px; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label.field { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 550; }
label.field > input, label.field > select, label.field > textarea { color: var(--text); font-size: 14px; font-weight: 400; }
label.field.row { display: flex; align-items: center; gap: 8px; }
.search { min-width: 240px; flex: 1; max-width: 420px; }

/* ═══════════════════════ Karten & Kacheln ═══════════════════════ */
.card {
  background: linear-gradient(180deg, var(--raise), transparent 40%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 14px; }
.grid { display: grid; gap: 14px; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }

/* Kachel: Beschriftung oben, Zahl groß, Zusatz unten (Reihenfolge per CSS,
   das Markup aus core.js tile() bleibt gleich). */
.tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  background: linear-gradient(180deg, var(--raise), transparent 50%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px 14px; text-align: left;
  box-shadow: var(--shadow-sm);
}
.tile .l:not(.small) { order: -1; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.35; margin: 0; }
.tile .v { font-size: 27px; font-weight: 720; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l.small { color: var(--faint); font-size: 11.5px; line-height: 1.4; margin: 0; }
button.tile { cursor: pointer; width: 100%; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
button.tile:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow); }
button.tile::after {
  content: "→"; position: absolute; right: 14px; top: 13px; color: var(--faint); font-size: 13px; opacity: 0; transition: opacity .15s, transform .15s;
}
button.tile:hover::after { opacity: 1; transform: translateX(2px); }
.tile.alert { border-color: rgba(245, 165, 36, .5); background: linear-gradient(180deg, rgba(245, 165, 36, .1), rgba(245, 165, 36, .03)), var(--surface); }
.tile.alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn); }
.tile.alert .v { color: var(--warn); }

.banner { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.banner.warn { border-color: rgba(245, 165, 36, .5); background: rgba(245, 165, 36, .09); }
.banner.err { border-color: rgba(239, 90, 90, .5); background: rgba(239, 90, 90, .09); }

/* ═══════════════════════ Chips, Badges ═══════════════════════ */
.chips { display: inline-flex; gap: 2px; flex-wrap: wrap; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.chip { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; transition: background .12s, color .12s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--border-strong); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: rgba(46, 204, 143, .14); color: #7fe6bd; }
.badge.warn { background: rgba(245, 165, 36, .15); color: #ffcb70; }
.badge.danger { background: rgba(239, 90, 90, .16); color: #ff9a9a; }
.badge.info { background: rgba(91, 140, 255, .16); color: #a4c0ff; }
.count { min-width: 20px; text-align: center; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; background: var(--danger); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.wrap { white-space: pre-wrap; word-break: break-word; }

/* ═══════════════════════ Inhalte ═══════════════════════ */
.item { display: flex; flex-direction: column; gap: 10px; }
.item .meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.media { border-radius: 9px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.media img, .media video { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #000; }
.media .ph { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.author { background: none; border: 0; padding: 0; color: var(--accent-2); cursor: pointer; font-weight: 600; }
.author:hover { text-decoration: underline; }

/* ═══════════════════════ Tabellen ═══════════════════════ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: 11.5px; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; margin-right: 9px; vertical-align: middle; flex: none; }

/* ═══════════════════════ Diagramme ═══════════════════════ */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .end-dot { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* ═══════════════════════ Dialoge, Toasts ═══════════════════════ */
.overlay { position: fixed; inset: 0; background: rgba(4, 7, 14, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); width: min(540px, 100%); max-height: 90vh; overflow: auto; padding: 22px; animation: pop .18s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal.wide { width: min(780px, 100%); }
.modal h2 { margin-bottom: 12px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: pop .18s ease both; }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }

/* Schnellsuche */
.overlay:has(.qs) { place-items: start center; padding-top: 12vh; }
.modal:has(.qs) { padding: 0; width: min(560px, 100%); overflow: hidden; }
.qs-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.qs-input input { flex: 1; border: 0 !important; background: none !important; box-shadow: none !important; padding: 2px 0; font-size: 16px; color: var(--text); }
.qs-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.qs-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: none; padding: 9px 11px; border-radius: 9px; cursor: pointer; text-align: left; color: var(--text); }
.qs-item span:nth-of-type(1) { flex: 1; }
.qs-item .ico { color: var(--muted); }
.qs-item:hover, .qs-item.sel { background: var(--accent-soft); }
.qs-item.sel .ico { color: var(--accent-2); }

/* ═══════════════════════ Anmeldung ═══════════════════════ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 32px 30px; box-shadow: var(--shadow); border-color: var(--border-strong); }
.login .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; }
.login h1 { margin: 18px 0 4px; font-size: 22px; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login .btn.primary { padding: 10px 14px; margin-top: 4px; }

.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }

/* ═══════════════════════ Inhalte: Darstellungsarten ═══════════════════════ */
.media audio { display: block; width: 100%; }
.media.thumb { width: 84px; flex: none; }
.media.thumb img, .media.thumb video { max-height: 60px; object-fit: cover; }
.media.thumb .ph { padding: 8px 4px; font-size: 11px; }
.media.tile { display: block; border-radius: 0; border: 0; height: 100%; padding: 0; box-shadow: none; background: var(--bg); overflow: hidden; }
.media.tile img, .media.tile video { aspect-ratio: 1; max-height: none; height: 100%; object-fit: cover; }
.grid.gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tile-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: pointer; padding: 0; text-align: left; color: inherit; transition: border-color .15s, transform .15s; }
.tile-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile-item .txt { padding: 10px; font-size: 12px; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.tile-item .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; display: flex; gap: 6px; align-items: center; justify-content: space-between; font-size: 11px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); color: #fff; pointer-events: none; }
.tile-item.hidden-item { opacity: .55; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--border-strong); }
td.thumbcell { width: 96px; padding-right: 0; }
.cell-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; max-width: 520px; }
.nowrap { white-space: nowrap; }
tr.dim { opacity: .6; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-right: 6px; box-shadow: 0 0 0 0 rgba(46, 204, 143, .7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(46, 204, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 204, 143, 0); } }

/* ═══════════════════════ Systemzustand, Detailseite ═══════════════════════ */
.tile.good { border-color: rgba(46, 204, 143, .5); }
.tile.bad { border-color: rgba(239, 90, 90, .6); background: rgba(239, 90, 90, .08); }
.tile.good .v { color: #7fe6bd; }
.tile.bad .v { color: #ff9a9a; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }
.linkrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.linkrow:last-child { border-bottom: 0; }
.bar { height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; min-width: 120px; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.alert-toggle { margin-top: 8px; width: 100%; }
.grid > .card + .card { margin-top: 0; }

/* ═══════════════════════ Mobil ═══════════════════════ */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); height: 100vh;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); background: var(--surface);
  }
  .shell.nav-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(4, 7, 14, .55); z-index: 25; }
  .shell.nav-open .scrim { display: block; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .main { padding: 20px 14px 50px; }
  h1 { font-size: 21px; }
  .grid.tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .tile .v { font-size: 23px; }
}

/* ═══════════════════════ Hell-Modus ═══════════════════════ */
/* Gesetzt über html[data-theme="light"] (core.js applyAppearance). 'auto' wird
   dort zu light/dark aufgelöst, daher kein @media nötig. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --bg-glow: rgba(47, 107, 223, .07);
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e5eaf3;
  --raise: rgba(255, 255, 255, 0);
  --border: #e1e6ef;
  --border-strong: #cfd7e4;
  --text: #141c2f;
  --muted: #5a6580;
  --faint: #8a94aa;
  --accent: #2f6bdf;
  --accent-2: #2f6bdf;
  --accent-soft: rgba(47, 107, 223, .1);
  --ok: #1f9d6b;
  --warn: #b7791f;
  --danger: #d23f3f;
  --shadow: 0 12px 34px rgba(20, 30, 60, .1);
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06);
}
html[data-theme="light"] .chip.active, html[data-theme="light"] .seg button.active { box-shadow: 0 1px 3px rgba(20, 30, 60, .12), inset 0 0 0 1px var(--border); }
html[data-theme="light"] .btn.primary { background: var(--accent); box-shadow: 0 4px 12px rgba(47, 107, 223, .25); }
html[data-theme="light"] .overlay { background: rgba(20, 28, 47, .35); }
/* Für den dunklen Untergrund gedachte Pastelltöne im Hellmodus abdunkeln. */
html[data-theme="light"] .badge.ok,  html[data-theme="light"] .btn.ok,  html[data-theme="light"] .tile.good .v { color: #0f7a52; }
html[data-theme="light"] .badge.warn { color: #8a5a00; }
html[data-theme="light"] .badge.danger, html[data-theme="light"] .btn.danger, html[data-theme="light"] .tile.bad .v { color: #b32a2a; }
html[data-theme="light"] .badge.info { color: #1e52b8; }
html[data-theme="light"] a { color: #2f6bdf; }
html[data-theme="light"] tbody tr:hover { background: rgba(20, 30, 60, .03); }
html[data-theme="light"] .media img, html[data-theme="light"] .media video { background: #e3e9f4; }

/* ═══════════════════════ Barrierefreiheit ═══════════════════════ */
/* Größere Schrift */
html.a11y-large body { font-size: 16px; }
html.a11y-large h1 { font-size: 27px; }
html.a11y-large h2 { font-size: 18px; }
html.a11y-large h3 { font-size: 16px; }
html.a11y-large .small, html.a11y-large .badge, html.a11y-large label.field, html.a11y-large .tile .l { font-size: 13.5px !important; }
html.a11y-large .btn.small { font-size: 14px; }
html.a11y-large .nav-item { font-size: 15px; }

/* Hoher Kontrast: kräftigere Ränder, unterstrichene Links, deutlicher Fokus */
html.a11y-contrast { --border: #4a5a7a; --border-strong: #6a7a9a; --muted: #c2ccdf; --faint: #aab4c8; }
html[data-theme="light"].a11y-contrast { --border: #7c8aa6; --border-strong: #5e6c88; --muted: #39425a; --faint: #4a5470; }
html.a11y-contrast a { text-decoration: underline; }
html.a11y-contrast .btn { border-width: 2px; }
html.a11y-contrast :focus-visible, html.a11y-contrast :focus { outline: 3px solid var(--accent) !important; outline-offset: 1px; }
html.a11y-contrast .badge { border: 1px solid currentColor; }

/* Bewegung reduzieren (Schalter) + Systemeinstellung respektieren */
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
  }
}

/* ═══════════════════════ Claude Code ═══════════════════════ */
.cc {
  display: flex; flex-direction: column; height: calc(100vh - var(--top-h) - 190px); min-height: 460px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.cc-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cc-field { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cc-field select { padding: 5px 9px; font-size: 13px; }
.cc-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.cc-empty { margin: auto; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); }
.cc-empty .ico { color: var(--accent-2); }
.cc-msg { max-width: min(860px, 92%); padding: 11px 14px; border-radius: 14px; line-height: 1.55; word-break: break-word; }
.cc-msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-bottom-right-radius: 4px; }
.cc-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.cc-msg.live::after { content: "▍"; color: var(--accent-2); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cc-text { display: grid; gap: 8px; }
.cc-para { white-space: pre-wrap; }
.cc-para code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.cc-code { margin: 0; max-height: 360px; background: var(--bg); }
.cc-tool {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; max-width: 92%;
  padding: 4px 10px; border-radius: 8px; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
  color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.cc-tool span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tool .ico { animation: spin 1.2s linear infinite; }
.cc-tool.ok .ico, .cc-tool.err .ico { animation: none; }
.cc-tool.ok .ico { color: var(--ok); }
.cc-tool.err { color: #ff9a9a; border-color: rgba(239, 90, 90, .45); }
.cc-result { align-self: center; font-size: 11.5px; color: var(--faint); padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); }
.cc-result.err { color: var(--warn); border-color: rgba(245, 165, 36, .45); }
.cc-compose { border-top: 1px solid var(--border); padding: 12px 14px; background: var(--surface-2); display: grid; gap: 8px; }
.cc-input { min-height: 70px; max-height: 240px; background: var(--surface); }
.cc-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 960px) { .cc { height: calc(100vh - var(--top-h) - 150px); } .cc-msg { max-width: 100%; } }
