/* Temperatur-Dashboard – dunkles Marineblau nach Entwurf V1 */
:root {
  --grund: #0b1324;
  --karte: #16213b;
  --karte-hell: #1c2a4a;
  --linie: #26365c;
  --text: #e8eefc;
  --leise: #8f9fc2;
  --gruen: #4ade80;
  --gelb: #fbbf24;
  --rot: #f87171;
  --blau: #60a5fa;
  --akzent: #6ea8ff;
  --radius: 16px;
  --schrift: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--grund); color: var(--text); font-family: var(--schrift); }
body { min-height: 100vh; display: flex; flex-direction: column; }
button, select { font: inherit; color: inherit; }

/* Kopf */
.kopf {
  display: flex; align-items: center; gap: 24px; padding: 18px 24px;
  border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .18em; font-size: 18px; }
.logo { width: 30px; height: 30px; color: var(--text); }
.logo-fuell { fill: #ff8a3d; }
.kopf h1 { flex: 1; text-align: center; font-weight: 400; font-size: 24px; margin: 0; }
.werkzeuge { display: flex; align-items: center; gap: 10px; }
.zeitraum { display: flex; border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; }
.zeitraum button {
  background: transparent; border: 0; padding: 8px 14px; cursor: pointer; color: var(--leise);
}
.zeitraum button.an { background: var(--karte-hell); color: var(--text); box-shadow: inset 0 0 0 1px var(--akzent); }
.knopf {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--linie); background: transparent;
  cursor: pointer; display: grid; place-items: center;
}
.knopf svg { width: 20px; height: 20px; }
.knopf:hover, .zeitraum button:hover { background: var(--karte-hell); color: var(--text); }
.live { display: flex; align-items: center; gap: 8px; color: var(--leise); font-size: 14px; min-width: 120px; }
.live .punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--leise); }
.live.an .punkt { background: var(--gruen); box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: puls 2s infinite; }
.live.an { color: var(--gruen); }
@keyframes puls { 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.uhr { font-variant-numeric: tabular-nums; font-size: 20px; color: var(--leise); min-width: 64px; text-align: right; }

/* Raster */
.raster {
  flex: 1; display: grid; gap: 14px; padding: 14px 18px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
}
.kennzahlen { grid-column: 1 / -1; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.verlauf { grid-column: span 8; }
.stunden { grid-column: span 4; }
.tabelle { grid-column: span 8; }
.bereich { grid-column: span 4; }
.quellen-karte { grid-column: span 4; }
.meldungen { grid-column: span 8; }

/* Quellen */
.quelle-schild {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--qf); border: 1px solid color-mix(in srgb, var(--qf) 45%, transparent);
  background: color-mix(in srgb, var(--qf) 12%, transparent); border-radius: 6px; padding: 2px 6px; white-space: nowrap;
}
.kachel-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.quelle-zelle { display: inline-flex; vertical-align: -3px; }
.quellen-filter button { display: inline-flex; align-items: center; gap: 5px; }
.quellen-filter button.an { box-shadow: inset 0 0 0 1px var(--qf, var(--akzent)); color: var(--qf, var(--text)); }
.quellenliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.quellenliste li {
  display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; background: var(--karte-hell); border-left: 3px solid var(--qf);
}
.quelle-gross { color: var(--qf); display: grid; place-items: center; }
.quelle-text, .quelle-zahlen, .quelle-zeit { display: flex; flex-direction: column; min-width: 0; }
.quelle-text small, .quelle-zahlen small, .quelle-zeit small { color: var(--leise); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quelle-zahlen, .quelle-zeit { text-align: right; font-variant-numeric: tabular-nums; }
.quelle-zeit { flex-direction: column; align-items: flex-end; }
.geraet-zustand {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--linie, rgba(255,255,255,.08));
}
.geraet-zustand div { display: flex; flex-direction: column; min-width: 0; font-variant-numeric: tabular-nums; }
.geraet-zustand small { color: var(--leise); font-size: 12px; }
.geraet-zustand b { font-size: 15px; }
.quelle-zeit .punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.legende small { font-size: 11px; font-weight: 600; }

.karte {
  background: var(--karte); border-radius: var(--radius); padding: 18px 20px; min-width: 0;
  border: 1px solid rgba(255, 255, 255, .03);
}
.karten-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.karte h2 { margin: 0; font-size: 20px; font-weight: 600; }
.unter { margin: 4px 0 0; color: var(--leise); font-size: 14px; }
select {
  background: var(--karte-hell); border: 1px solid var(--linie); border-radius: 8px; padding: 6px 10px; max-width: 50%;
}

/* Kennzahl-Kacheln */
.kachel {
  background: var(--karte); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .03); min-height: 168px; display: flex; flex-direction: column;
}
.kachel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--kennfarbe, var(--akzent)); }
.kachel.alarm { border-color: var(--rot); box-shadow: 0 0 0 1px var(--rot) inset; }
.kachel.stumm { opacity: .65; }
.kachel-kopf { min-width: 0; }
/* Name über die volle Breite, notfalls umbrechen statt abschneiden */
.kachel h3 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.kachel-info { display: flex; align-items: center; justify-content: space-between; gap: 4px 8px; margin-top: 8px; min-height: 22px; flex-wrap: wrap; }
.kachel-info .empfang { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.kachel-info .empfang small { color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.kachel .ort { color: var(--leise); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kachel .wert {
  font-size: 48px; font-weight: 600; line-height: 1; margin: 10px 0 6px; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px;
}
.kachel .wert small { font-size: 18px; color: var(--leise); font-weight: 500; }
.kachel .trend { font-size: 22px; }
.kachel .mini { height: 40px; margin: 10px -4px 8px; }
.kachel .mini svg { width: 100%; height: 100%; display: block; }
.kachel .fuss-zeile { margin-top: auto; display: flex; gap: 14px; font-size: 13px; color: var(--leise); flex-wrap: wrap; }
.kachel .fuss-zeile b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.marke-rot {
  display: inline-block; background: var(--rot); color: #1b0b0b; font-weight: 700; font-size: 12px;
  border-radius: 6px; padding: 2px 8px; margin-left: 6px;
}
.status-symbol { font-size: 12px; padding: 3px 8px; border-radius: 6px; height: fit-content; white-space: nowrap; }

/* Diagramme */
.diagramm { position: relative; width: 100%; height: 300px; }
.stunden .diagramm { height: 300px; }
svg.dia { width: 100%; height: 100%; overflow: visible; }
.dia .gitter { stroke: var(--linie); stroke-width: 1; }
.dia .achse { fill: var(--leise); font-size: 12px; }
.dia .linie { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.dia .band { opacity: .14; }
.dia .grenze { stroke-dasharray: 5 5; stroke-width: 1.2; }
.dia .balken { rx: 3; }
.dia .zeiger { stroke: var(--leise); stroke-dasharray: 3 3; }
.legende { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; font-size: 13px; color: var(--leise); }
.legende span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.legende span.aus { opacity: .35; }
.legende i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.leer { color: var(--leise); display: grid; place-items: center; height: 100%; font-size: 15px; }

/* Tabelle */
.tabellen-rahmen { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--leise); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 10px; }
td { padding: 10px; border-top: 1px solid var(--linie); white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .02); }
.r { text-align: right; }
.name-zelle { display: flex; align-items: center; gap: 10px; }
.name-zelle i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.name-zelle small { color: var(--leise); display: block; }
.pille { display: inline-block; padding: 4px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; color: #06210f; }
.pille.gruen { background: var(--gruen); }
.pille.gelb { background: var(--gelb); color: #2b1d00; }
.pille.rot { background: var(--rot); color: #2a0808; }
.pille.grau { background: #3a4a6e; color: var(--text); }
.wert-pille { padding: 4px 10px; border-radius: 6px; font-weight: 600; }

/* Ring */
.ring-zeile { display: flex; align-items: center; gap: 22px; height: calc(100% - 50px); min-height: 230px; }
.ring { width: 200px; height: 200px; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-legende { list-style: none; margin: 0; padding: 0; flex: 1; font-size: 15px; display: grid; gap: 8px; }
.ring-legende li { display: flex; align-items: center; gap: 8px; }
.ring-legende i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.ring-legende b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Meldungen */
.meldungsliste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px 18px; }
.meldungsliste li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--linie); font-size: 14px; }
.meldungsliste time { color: var(--leise); font-variant-numeric: tabular-nums; flex: none; }
.meldungsliste .kanal { font-size: 11px; text-transform: uppercase; color: var(--leise); border: 1px solid var(--linie); border-radius: 4px; padding: 0 5px; flex: none; }

.fuss { display: flex; justify-content: space-between; gap: 12px; padding: 10px 24px 16px; color: var(--leise); font-size: 13px; flex-wrap: wrap; }

/* Kacheln sind anklickbar → Großansicht */
.kachel[role="button"] { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kachel[role="button"]:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.kachel[role="button"]:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Großansicht eines Thermometers */
.gross {
  width: min(1100px, 94vw); max-height: 92vh; padding: 0; border: 1px solid var(--linie); border-radius: 22px;
  background: var(--karte); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.gross::backdrop { background: rgba(4, 8, 18, .72); backdrop-filter: blur(4px); }
.gross-innen { padding: 22px 26px 26px; border-top: 6px solid var(--kennfarbe, var(--akzent)); }
.gross-kopf { display: flex; align-items: flex-start; gap: 14px; }
.gross-kopf h2 { margin: 0; font-size: 28px; }
.gross-kopf .ort { color: var(--leise); margin-top: 4px; font-size: 16px; }
.gross-kopf .rechts { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.gross-haupt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 26px; margin: 18px 0 8px; align-items: center; }
.gross-wert { font-size: clamp(72px, 11vw, 150px); font-weight: 600; line-height: .95; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 10px; }
.gross-wert small { font-size: .28em; color: var(--leise); font-weight: 500; }
.gross-zusatz { font-size: 18px; margin-top: 10px; }
.gross-zahlen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gross-zahlen div { background: var(--karte-hell); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.gross-zahlen small { display: block; color: var(--leise); font-size: 12px; margin-bottom: 2px; }
.gross-zahlen b { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gross-verlauf .diagramm { height: 340px; }
.gross-verlauf .karten-kopf { margin-top: 14px; }
.gross-leer { color: var(--leise); padding: 30px 0; font-size: 18px; }
@media (max-width: 760px) {
  .gross-haupt { grid-template-columns: 1fr; }
  .gross-zahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gross-verlauf .diagramm { height: 240px; }
}

/* Anzeige-Leiste mit Schaltern */
.anzeige {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100vw); z-index: 20; overflow-y: auto;
  background: #0f1a33; border-left: 1px solid var(--linie); box-shadow: -12px 0 40px rgba(0, 0, 0, .45);
  padding: 18px 20px 28px;
}
.anzeige-kopf { display: flex; justify-content: space-between; align-items: center; }
.anzeige h2 { margin: 0; font-size: 20px; }
.anzeige h3 { margin: 20px 0 6px; font-size: 13px; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; }
.schalterliste { display: grid; }
.schalter {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--linie); cursor: pointer;
}
.schalter .text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schalter .text small { color: var(--leise); margin-left: 6px; }
.schalter input { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #3a4a6e; position: relative;
  cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.schalter input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.schalter input:checked { background: var(--gruen); }
.schalter input:checked::after { transform: translateX(18px); }
.schalter input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.schalter i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.zuruecksetzen { margin-top: 18px; width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--karte-hell); cursor: pointer; }
.zuruecksetzen:hover { box-shadow: inset 0 0 0 1px var(--akzent); }
[data-teil][hidden] { display: none !important; }
.voll { grid-column: 1 / -1 !important; }

.hinweis {
  position: fixed; pointer-events: none; background: #0f1a33; border: 1px solid var(--linie); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); z-index: 10; line-height: 1.5;
}

/* Schmale Bildschirme */
@media (max-width: 1100px) {
  .verlauf, .stunden, .tabelle, .bereich, .quellen-karte, .meldungen { grid-column: 1 / -1; }
  .kopf h1 { display: none; }
}
@media (max-width: 640px) {
  .kopf { flex-wrap: wrap; padding: 14px 16px; gap: 12px; }
  .werkzeuge { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .uhr { display: none; }
  .raster { padding: 12px 16px; }
  .kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kachel { padding: 12px 12px 12px 16px; min-height: 0; }
  .kachel .wert { font-size: 34px; margin: 8px 0 4px; }
  .kachel .wert small { font-size: 14px; }
  .kachel .fuss-zeile { gap: 8px; font-size: 12px; }
  .ring-zeile { flex-direction: column; }
}

/* Thingy-Kachel: Sendetakt + Countdown bis zum nächsten Paket */
.uebertragung {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--linie); font-size: 13px; color: var(--leise); font-variant-numeric: tabular-nums;
}
.uebertragung b { color: var(--text); }
.uebertragung { flex-wrap: wrap; row-gap: 2px; }
.uebertragung span { white-space: nowrap; }
