/* enviro-pi Dashboard - Farben nach validierter Palette */
:root {
  color-scheme: light;
  --plane:          #f9f9f7;
  --surface:        #fcfcfb;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --muted:          #898781;
  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --s1: #2a78d6;  --s2: #eb6834;  --s3: #1baf7a;  --s4: #eda100;
  --good:     #0ca30c;
  --warning:  #fab219;
  --critical: #d03b3b;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:   #0d0d0d;
    --surface: #1a1a19;
    --ink:     #ffffff;
    --ink-2:   #c3c2b7;
    --muted:   #898781;
    --grid:    #2c2c2a;
    --axis:    #383835;
    --border:  rgba(255,255,255,0.10);
    --s1: #3987e5;  --s2: #d95926;  --s3: #199e70;  --s4: #c98500;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:   #0d0d0d;
  --surface: #1a1a19;
  --ink:     #ffffff;
  --ink-2:   #c3c2b7;
  --muted:   #898781;
  --grid:    #2c2c2a;
  --axis:    #383835;
  --border:  rgba(255,255,255,0.10);
  --s1: #3987e5;  --s2: #d95926;  --s3: #199e70;  --s4: #c98500;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 18px 64px; }

/* ---- Kopf ---- */
header.top {
  display: flex; flex-wrap: wrap; gap: 14px 20px;
  align-items: baseline; justify-content: space-between;
  margin-bottom: 22px;
}
h1 { font-size: 21px; margin: 0; letter-spacing: -0.01em; }
h1 .host { color: var(--ink-2); font-weight: 400; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live   { background: var(--good); }
.dot.stale  { background: var(--warning); }
.dot.dead   { background: var(--critical); }

/* ---- Bedienleiste ---- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; }
.controls .spacer { flex: 1; }
button.chip {
  font: inherit; font-size: 13.5px;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  cursor: pointer;
}
button.chip:hover { border-color: var(--axis); color: var(--ink); }
button.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--plane); border-color: var(--ink);
}

/* ---- Kachelraster ---- */
.tiles {
  display: grid; gap: 12px; margin-bottom: 30px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px 14px;
}
.tile .label { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.tile .value { font-size: 25px; line-height: 1.15; letter-spacing: -0.02em; }
.tile .value .unit { font-size: 14px; color: var(--ink-2); margin-left: 3px; letter-spacing: 0; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.swatch { width: 100%; height: 30px; border-radius: 6px; border: 1px solid var(--border); margin-top: 6px; }

/* ---- Diagramme ---- */
h2.section {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 600;
  margin: 34px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 10px; position: relative;
}
.card h3 { font-size: 14px; margin: 0 0 1px; font-weight: 600; }
.card .cur { font-size: 12.5px; color: var(--ink-2); margin-bottom: 9px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 7px 0 2px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.plot { position: relative; }
.plot svg { display: block; width: 100%; }
.tip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--surface); border: 1px solid var(--axis); border-radius: 7px;
  padding: 7px 9px; font-size: 12px; color: var(--ink); white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,.13); z-index: 5;
}
.tip .t { color: var(--muted); margin-bottom: 3px; }
.tip .row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tip i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.empty { color: var(--muted); font-size: 13px; padding: 26px 0 30px; text-align: center; }

/* ---- Tabelle ---- */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data caption { text-align: left; color: var(--muted); font-size: 12.5px; padding-bottom: 8px; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th { color: var(--ink-2); font-weight: 600; }
footer.foot { margin-top: 40px; font-size: 12.5px; color: var(--muted); }
footer.foot code { font-size: 12px; }

/* Farbband ueber die volle Breite */
.card.wide { grid-column: 1 / -1; }
