/* Server-Dashboard (Telegram Mini App). Farben: validierte Referenzpalette, hell und dunkel separat gewählt. */
:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --s1: #2a78d6;
  --s2: #eb6834;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --accent: #2a78d6;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0d0d0d; --surface: #1a1a19; --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.06);
    --s1: #3987e5; --s2: #d95926; --good-text: #0ca30c; --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d; --surface: #1a1a19; --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.06);
  --s1: #3987e5; --s2: #d95926; --good-text: #0ca30c; --accent: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--plane); color: var(--text); }
body { font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
.app { max-width: 720px; margin: 0 auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.note { font-size: 13px; margin: 0 2px 10px; }

.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.hero-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero-main p { margin: 2px 0 0; font-size: 13px; }
.hero-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; box-shadow: 0 0 0 4px var(--wash); }
.hero-dot.ok { background: var(--good); }
.hero-dot.bad { background: var(--critical); }
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs, .ranges { display: flex; gap: 4px; background: var(--wash); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.tabs button, .ranges button {
  flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
}
.tabs button[aria-selected="true"], .ranges button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head .muted { font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.card .tiles { margin-bottom: 12px; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.card .tile { background: var(--plane); }
.tile-label { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { font-size: 22px; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles-3 .tile-value { font-size: 18px; }
.tiles-3 .tile-label, .tiles-3 .tile-sub { white-space: normal; overflow-wrap: break-word; hyphens: auto; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; background: var(--grid); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--s1); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); min-height: 44px; }
.rows li:first-child { border-top: 0; padding-top: 2px; }
.rows .grow { flex: 1; min-width: 0; }
.rows .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .detail { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .val { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 14px; white-space: nowrap; }

/* Status: immer Symbol + Text, nie nur Farbe */
.st { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; flex: none; font-size: 13px; font-weight: 700; color: #fff; }
.st.good { background: var(--good); }
.st.warning { background: var(--warning); color: #0b0b0b; }
.st.serious { background: var(--serious); color: #fff; }
.st.critical { background: var(--critical); }

/* Diagramme */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series-label { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .today { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .row-label { fill: var(--text-2); font-size: 12px; }
.chart .value-label { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.today-swatch { width: 0; height: 12px; border-radius: 0; border-left: 1px dashed var(--text-2); }
details.table { margin-top: 8px; font-size: 12px; color: var(--text-2); }
details.table summary { cursor: pointer; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
details.table .scroll { max-height: 220px; overflow: auto; }
details.table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
details.table th, details.table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
details.table th:first-child, details.table td:first-child { text-align: left; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 240px;
}
.tooltip .t-head { color: var(--muted); margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tooltip .t-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tooltip strong { font-variant-numeric: tabular-nums; }

.foot { text-align: center; font-size: 12px; margin-top: 4px; }
.error { color: var(--critical); }

@media (forced-colors: active) {
  .st, .meter span, .hero-dot { forced-color-adjust: none; }
}
