/* Gemeinsame Tokens – dunkel als Grundton, hell über prefers-color-scheme / data-theme */
:root {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2c2c2a;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255,255,255,0.10); --border-strong: rgba(255,255,255,0.18);
  --accent: #f2a93b; --accent-2: #e8603c; --accent-ink: #1a1206;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s1-wash: rgba(57,135,229,0.12);
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #0ca30c;
  --radius: 10px; --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee; --surface-3: #e9e8e3;
    --ink: #0b0b0b; --ink-2: #52514e; --muted: #6f6d68; --grid: #e1e0d9; --axis: #c3c2b7;
    --border: rgba(11,11,11,0.10); --border-strong: rgba(11,11,11,0.18);
    --accent: #b86e00; --accent-2: #c2410c; --accent-ink: #ffffff;
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s1-wash: rgba(42,120,214,0.10);
    --good-ink: #006300;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee; --surface-3: #e9e8e3;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #6f6d68; --grid: #e1e0d9; --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10); --border-strong: rgba(11,11,11,0.18);
  --accent: #b86e00; --accent-2: #c2410c; --accent-ink: #ffffff;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s1-wash: rgba(42,120,214,0.10);
  --good-ink: #006300;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .label { font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font-size: 1.55rem; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.tile .value small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile .sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.good { background: var(--good); } .dot.bad { background: var(--critical); } .dot.warn { background: var(--warning); } .dot.off { background: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font-size: 0.88rem; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.danger { border-color: color-mix(in srgb, var(--critical) 60%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--critical) 18%, var(--surface-2)); }
.btn:disabled { opacity: 0.5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; font-size: 0.82rem; color: var(--ink-2); }
.seg button.on { background: var(--surface-3); color: var(--ink); font-weight: 600; }
input[type=text], input[type=number], input[type=search], select { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--ink-2); font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Balkenliste */
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; font-size: 0.86rem; }
.bar-row .bl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .bl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bv { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-row .track { grid-column: 1 / -1; height: 8px; border-radius: 0 4px 4px 0; position: relative; }
.bar-row .fill { position: absolute; inset: 0 auto 0 0; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }

/* Diagramme */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tt { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 9px; font-size: 0.8rem; white-space: nowrap; z-index: 5; box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.chart .tt b { font-size: 0.9rem; }
.chart .tt .k { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; }
.empty { color: var(--muted); font-size: 0.88rem; padding: 12px 0; }

.head { image-rendering: pixelated; border-radius: 3px; flex: none; background: var(--surface-3); }
