/* Levarix Bond – gemeinsames Designsystem für Client und Admin.
   Ruhige Appliance-Optik: dunkles Navy, Haarlinien, Grün nur als Statusfarbe. */
:root {
  --bg: #07141D;
  --surface: #0C1D29;
  --surface-2: #102634;
  --surface-3: #15303F;
  --line: rgba(150, 185, 205, .11);
  --line-strong: rgba(150, 185, 205, .2);
  --text: #E3ECF1;
  --muted: #8AA1AF;
  --faint: #5E7685;
  --brand: #0A2A3D;
  --green: #4CAF2A;
  --green-text: #7FD05E;
  --green-bg: rgba(76, 175, 42, .12);
  --orange: #F57C2A;
  --orange-text: #FFA66B;
  --orange-bg: rgba(245, 124, 42, .12);
  --red: #E5484D;
  --red-text: #FF8589;
  --red-bg: rgba(229, 72, 77, .12);
  --focus: #F57C2A;
  --r: 10px;
  --r-sm: 7px;
  --font: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, "Noto Sans", sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 13.5px/1.5 var(--font); font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(76, 175, 42, .35); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code, .mono { font-family: var(--mono); font-size: 12px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 600; }
h2 { font-size: 14.5px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Bausteine ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 32px; padding: 0 14px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); border-color: rgba(150, 185, 205, .3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--green); border-color: var(--green); color: #061108; font-weight: 600; }
.btn.primary:hover { background: #57bd33; }
.btn.danger { color: var(--red-text); }
.btn.danger:hover { background: var(--red-bg); border-color: rgba(229, 72, 77, .45); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.ico { width: 16px; height: 16px; flex: none; display: block; }
.btn .ico { width: 15px; height: 15px; }

.input, textarea.input {
  width: 100%; height: 34px; padding: 0 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(76, 175, 42, .18); }
label.field { display: grid; gap: 6px; }
label.field > span { color: var(--muted); font-size: 12.5px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.ok .dot, .dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(76, 175, 42, .18); }
.warn .dot, .dot.warn { background: var(--orange); }
.err .dot, .dot.err { background: var(--red); }
.pill.ok { color: var(--green-text); background: var(--green-bg); border-color: rgba(76, 175, 42, .3); }
.pill.warn { color: var(--orange-text); background: var(--orange-bg); border-color: rgba(245, 124, 42, .3); }
.pill.err { color: var(--red-text); background: var(--red-bg); border-color: rgba(229, 72, 77, .3); }

/* Kennzahlen-Leiste: eine Fläche mit Trennlinien statt einzelner Karten */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { padding: 14px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.kpi-value small { font: 500 12.5px var(--font); color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-sub { color: var(--faint); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .kpis, .kpis.n3, .kpis.n5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi:nth-child(3) { border-left: 0; } .kpi:nth-child(n+3) { border-top: 1px solid var(--line); } }

/* Tabellen */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: rgba(150, 185, 205, .035); }
.table .r { text-align: right; }
.table td.num, .table td.r { white-space: nowrap; }
.table td.strong { font-weight: 600; }
.table .sub { color: var(--faint); font-size: 12px; }
.table-wrap { overflow-x: auto; }

/* Balken */
.bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width .5s ease; }
.bar.warn > i { background: var(--orange); }

/* Schalter */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #C5D3DB; transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--green); border-color: var(--green); }
.switch input:checked + i::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Segmentierte Auswahl */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 14px; border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* Definitionen */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog */
dialog.modal { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
dialog.modal::backdrop { background: rgba(2, 8, 12, .72); }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; gap: 12px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 16px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); font-size: 13px; }
.toast.err { color: var(--red-text); border-color: rgba(229, 72, 77, .4); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--orange-bg); border: 1px solid rgba(245, 124, 42, .25); color: var(--orange-text); font-size: 12.5px; }
.notice.info { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.empty { color: var(--muted); padding: 28px 18px; text-align: center; }

canvas.chart { display: block; width: 100%; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i.lg-down { background: var(--green); }
.legend i.lg-up { background: var(--orange); }
.legend i { display: inline-block; width: 10px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
