/* =========================================================
   müller+krahmer – IIoT-Dashboard
   (nur auf der Seite iiot-dashboard eingebunden; ergänzt style.css)
   Farben wie Auswahlmatrix (matrix.css): Orange-Stufen, Dunkelgrau, Grautöne
   ========================================================= */
.db {
  --ok: #ff8000; --ok-dk: #c25f00; --soon: #ffb366; --dev: #ffd6ad; --none: #d9d9d9;
  --kopf: #2b2b2b; --text: #1e1e1e; --grau: #6b6b6b; --rand: #e3e3e3; --linie: #ececec;
  font-variant-numeric: tabular-nums;
}

/* ---------- Leiste: Blattumschalter und Status ---------- */
.db-leiste { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: center; justify-content: space-between; margin: 0 0 1.5rem; }
.db-blaetter { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--kopf); }
.db-blatt { font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; padding: .6rem 1.4rem; border: 0; background: #fff; color: var(--text); }
.db-blatt + .db-blatt { border-left: 1px solid var(--kopf); }
.db-blatt:hover { background: #fff4ea; }
.db-blatt[aria-selected="true"] { background: var(--kopf); color: #fff; }
.db-blatt:focus-visible { outline: 3px solid var(--ok); outline-offset: 2px; }
.db-zustand { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--grau); }
.db-punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--none); flex: none; }
.db-punkt.live { background: var(--ok); }
.db-punkt.teil { background: var(--soon); }

/* ---------- Raster ---------- */
.db-reihe { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.db-halb { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.db-zwei-eins { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .db-halb, .db-zwei-eins { grid-template-columns: minmax(0, 1fr); } }
.seite .db h2.db-titel { margin: 2.2rem 0 .9rem; }

/* ---------- Kacheln: dunkle Kopfzeile wie der Tabellenkopf der Auswahlmatrix ---------- */
.db-kachel { border: 1px solid var(--rand); border-radius: 6px; overflow: hidden; background: #fff; min-width: 0; display: flex; flex-direction: column; }
.db-kopf { background: var(--kopf); color: #fff; padding: .65rem 1rem; display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.db-kachel.akzent .db-kopf { border-left: 6px solid var(--ok); }
.seite .db-kopf h3 { margin: 0; font-size: .95rem; font-weight: 600; line-height: 1.3; color: #fff; }
.db-kopf small { display: block; font-weight: 400; color: #c9c9c9; font-size: .74rem; margin-top: .1rem; }
.db-stand { font-size: .74rem; color: #ffb066; white-space: nowrap; }
.db-inhalt { padding: .6rem 1rem .4rem; flex: 1; }
.db-diagramm { width: 100%; height: 300px; }
.db-diagramm.hoch { height: 360px; }
.db-fluss { width: 100%; height: 360px; }

/* ---------- Aktuelle Messwerte ---------- */
/* vier Spalten in der Reihenfolge der Diagramme: Strom | Heizung | Lüftung | Gas + Wasser */
.db-gruppen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1.75rem; padding-top: .3rem; }
@media (max-width: 1000px) { .db-gruppen { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .db-gruppen { grid-template-columns: minmax(0, 1fr); } }
.db-gruppe { margin: .3rem 0 1rem; }
.seite .db-gruppe h4 {
  margin: 0 0 .2rem; padding-bottom: .25rem; border-bottom: 2px solid var(--ok);
  font-size: .85rem; font-weight: 700; color: var(--text); display: flex; justify-content: space-between; gap: .5rem;
}
.db-gruppe h4 span { font-weight: 400; font-size: .72rem; color: var(--grau); white-space: nowrap; }
.db .db-werte { list-style: none; margin: 0; padding: 0; }
.db .db-werte li { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: baseline; margin: 0;
                   padding: .3rem 0; border-bottom: 1px solid var(--linie); font-size: .84rem; line-height: 1.35; }
.db .db-werte li:last-child { border-bottom: 0; }
.db-name { color: var(--grau); }
.db-wert { font-weight: 600; text-align: right; white-space: nowrap; color: var(--text); }
.db-einheit { font-weight: 400; color: var(--grau); margin-left: .2rem; }
.db .db-gross li { padding: .55rem 0; }
.db-gross .db-wert { font-size: 1.3rem; font-weight: 500; }
.db-soc { grid-column: 1 / -1; height: 5px; background: var(--linie); border-radius: 3px; overflow: hidden; }
.db-soc span { display: block; height: 100%; width: 0; background: var(--ok); }

/* ---------- Gas: Einheit und Umrechnung ---------- */
.db-gas-einstellung {
  display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; align-items: center; margin: 0 0 1.25rem;
  padding: .7rem 1rem; border: 1px solid var(--rand); border-left: 6px solid var(--ok); border-radius: 6px; font-size: .88rem;
}
.db-gas-einstellung fieldset { border: 0; margin: 0; padding: 0; display: flex; gap: 1rem; align-items: center; }
.db-gas-einstellung legend { float: left; margin-right: .8rem; font-weight: 600; padding: 0; }
.db-gas-einstellung label { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.db-gas-einstellung input[type="radio"] { accent-color: var(--ok); margin: 0; }
.db-gas-einstellung input[type="text"] { width: 6.5em; font: inherit; text-align: right; padding: .3rem .5rem; border: 1px solid #cfcfcf; border-radius: 3px; }
.db-gas-einstellung input[type="text"]:focus { outline: 2px solid var(--ok); outline-offset: 0; border-color: var(--ok); }
.db-gas-einstellung input[aria-invalid="true"] { border-color: var(--ok-dk); background: #fff4ea; }
.db-gas-faktor { color: var(--grau); }

.db [hidden] { display: none !important; }
.db-fuss { color: var(--grau); font-size: .8rem; margin-top: 1.5rem; max-width: 80ch; }
