/* Eine gemeinsame Informationshierarchie: Status- und Legendentexte verwenden dieselbe Größe. */
body { --hevi-status-size: 11px; }
body.overview-page #metric-stove-info,
body.overview-page #heating-support,
body.overview-page .system-legend,
body.overview-page .system-legend > span:last-child { font-size: var(--hevi-status-size); line-height: 1.35; }
/* Ein Statuspunkt gehört zur ersten Textzeile, nie allein in eine eigene Flexzeile. */
body.overview-page .support-state { display: block; }
body.overview-page .support-state::before { display: inline-block; vertical-align: .12em; margin: 0 5px 0 0; }
.status-first { white-space: nowrap; }
body.overview-page .system-legend { flex-wrap: wrap; gap: 5px 12px; }
body.overview-page .system-legend > span:last-child { margin-left: auto; }

/* Der bestehende Datenstand aus der Verbrauchsübersicht zieht unverändert in den Seitenkopf. */
.top-actions .data-state { display: flex; font-size: 11px; white-space: nowrap; }
body.overview-page .top-actions .data-state { font-size: 11px; }
@media(max-width:780px) {
    .top-actions .data-state { position: absolute; right: 0; top: 43px; padding: 0; background: transparent; }
    .top-actions .data-state .state-dot { width: 4px; height: 4px; }
}
#infobox { display: none; }
.headerlogo { object-fit: contain; border-radius: 8px; }

/* Gasbilanz: Kopfwerte und Zusatzdaten teilen sich eine einzige Kartenfläche.
   Nur die eigene Schaltfläche klappt auf; ein Klick auf die Hauptwerte öffnet weiterhin Details. */
body.overview-page .gas-card { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; flex: none; }
body.overview-page .gas-card .gas-summary { border: 0; border-radius: 0; background: transparent; box-shadow: none; width: 100%; }
body.overview-page .gas-card .summary-label { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.gas-card .summary-label .icon { width: 14px; height: 14px; flex: none; color: var(--accent); }
.gas-expand { display: flex; width: 100%; justify-content: center; align-items: center; gap: 5px; min-height: 32px; padding: 4px 12px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; }
.gas-expand .icon { width: 14px; height: 14px; transition: transform .2s ease; }
.gas-expand[aria-expanded="true"] .icon { transform: rotate(180deg); }
.gas-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.gas-extra[hidden] { display: none; }
.gas-extra dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 16px; margin: 0; padding: 12px; border-top: 1px solid var(--line); }
.gas-extra dt { color: var(--muted); font-size: 12px; line-height: 1.35; }
.gas-extra dd { margin: 3px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gas-extra .detail-unit { font-size: var(--hevi-unit-size); margin-left: var(--hevi-unit-gap); font-weight: 400; color: var(--muted); }
.gas-extra .estimate-prefix { font-size: 10px; margin-right: 3px; color: var(--muted); }
@media(max-width:559px) { .gas-extra dl { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:350px) { body.overview-page .gas-card .summary-label { font-size: 12px; gap: 3px; } .gas-card .summary-label .icon { width: 12px; height: 12px; } }

/* Alle Messwert-Popups verwenden ruhige Wertefelder statt langer, gegeneinander laufender Zeilen.
   Lange Bezeichnungen dürfen umbrechen; die Werte bleiben direkt unter ihrem eigenen Titel. */
body .tile-dialog { width: min(620px,calc(100vw - 24px)); }
body .tile-detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
body .tile-detail-list > div { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
body .tile-detail-list dt { max-width: none; font-size: 13px; line-height: 1.4; }
body .tile-detail-list dd { text-align: left; font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
body .tile-detail-note { font-size: 12px; line-height: 1.45; margin: 10px 0 0; }
body .tile-detail-list .detail-wide { grid-column: 1/-1; }
@media(max-width:350px) { body .tile-detail-list { gap: 7px; } body .tile-detail-list > div { padding: 9px; } body .tile-detail-list dd { font-size: 17px; } }

/* Bei sehr kurzen Displays bleibt das Schema lesbar; nötigenfalls ist normales Scrollen möglich. */
body.overview-page.overview-relaxed .system-card { min-height: 235px; }
body.overview-page.overview-relaxed .system-stage { min-height: 155px; }

.tile-detail-list .detail-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }

/* Installation: kompakter Textbutton unmittelbar links vor dem Zahnrad, nur in kleiner Ansicht. */
.header-install { display: none; }
.header-install[hidden] { display: none !important; }
@media(max-width:780px) {
    .header-install { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }
    .top-actions .header-install .icon { width: 15px; height: 15px; }
}
@media(max-width:350px) { .header-install { font-size: 11px; padding: 7px; min-height: 31px; } }
.header-install:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Rechts schwebende Desktop-Untermenüs mit durchgängiger Hover-Brücke.
   Im aktiven Bereich werden dieselben Links statisch unter dem Hauptpunkt ausgegeben. */
.desktop-nav-group { display: contents; }
.desktop-subnav { display: none; }
@media(min-width:781px) {
    .sidebar { z-index: 70; }
    .desktop-nav-group { display: block; position: relative; }
    .desktop-nav-group:not(.is-active):hover > .desktop-subnav,
    .desktop-nav-group:not(.is-active):focus-within > .desktop-subnav,
    .desktop-nav-group.is-active > .desktop-subnav { display: grid; }
    .desktop-subnav { position: absolute; left: calc(100% + 8px); top: 0; z-index: 90; width: 190px; padding: 6px; gap: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 10px 30px #071b2840; }
    .desktop-subnav::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }
    #navigation .desktop-subnav a { min-height: 40px; padding: 9px 12px; color: var(--ink); font-size: 13px; border-radius: 8px; }
    #navigation .desktop-subnav a:hover, #navigation .desktop-subnav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
    .desktop-nav-group.is-active > .desktop-subnav { position: static; width: auto; margin: 5px 0 3px 21px; border: 0; border-left: 1px solid #315059; border-radius: 0; box-shadow: none; background: transparent; padding: 0 0 0 9px; }
    .desktop-nav-group.is-active > .desktop-subnav::before { display: none; }
    #navigation .desktop-nav-group.is-active .desktop-subnav a { color: #bdd0d4; }
    #navigation .desktop-nav-group.is-active .desktop-subnav a:hover,
    #navigation .desktop-nav-group.is-active .desktop-subnav a.active { color: #b2eee3; background: #173d45; }
}

/* Lange Seitentitel erhalten einen eigenen Bereich neben dem einheitlichen Datenstand.
   Auf sehr schmalen Geräten dürfen sie zweizeilig werden, statt mit der Uhrzeit zu kollidieren. */
@media(max-width:780px) { .topbar > div:first-child { min-width: 0; max-width: calc(100% - 125px); } }
@media(max-width:350px) { .topbar h1, body.overview-page .topbar h1 { font-size: 20px; } }

/* Dezentes Aero-Glas für schwebende Oberflächen. Die hohe Deckkraft erhält den Textkontrast;
   der Hintergrund scheint nur schwach durch. Ohne Filter-Unterstützung bleibt die solide Fläche. */
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
    .tile-dialog, .settings-dialog, .settings-toast, .mobile-subnav,
    .desktop-nav-group:not(.is-active) > .desktop-subnav {
        background-color: color-mix(in srgb,var(--surface) 84%,transparent);
        background-image: linear-gradient(140deg,rgba(255,255,255,.12),rgba(255,255,255,0) 48%);
        -webkit-backdrop-filter: blur(14px) saturate(1.12);
        backdrop-filter: blur(14px) saturate(1.12);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.16),0 12px 36px rgba(3,22,30,.20);
    }
    .settings-toast::before { background: color-mix(in srgb,var(--surface) 84%,transparent); }
}
/* Ein ruhiger Saum ersetzt die verbrauchte Sprechblase, ohne Layout oder Symbolgröße zu ändern. */
.settings-hint-pulse { animation: settings-hint-pulse 3s ease-in-out infinite; }
@keyframes settings-hint-pulse {
    0%,100% { box-shadow: 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent),0 0 10px color-mix(in srgb,var(--accent) 15%,transparent); }
}
@media(prefers-reduced-motion:reduce) { .settings-hint-pulse { animation: none; } }
