/* Der Einstellungszugang bündelt die bisherigen zwei Symbole, ohne neue Navigationszeile. */
.settings-anchor { position: relative; display: flex; align-items: center; }
/* Der Handbuchzugang teilt Größe und Tastaturfokus mit der benachbarten Einstellungsschaltfläche. */
.help-button { flex:none; font-size:23px; font-weight:700; line-height:1; text-decoration:none; }
.help-button:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.settings-button { position: relative; }
.settings-button::after { content: ""; position: absolute; inset: -4px; }
.settings-button .icon { width: 20px; height: 20px; }
.settings-toast {
    position: absolute; z-index: 60; top: calc(100% + 12px); right: 0;
    width: min(290px,calc(100vw - 32px)); padding: 13px 16px;
    border: 1px solid var(--line); border-radius: 13px; background: var(--surface);
    color: var(--ink); text-align: left; box-shadow: 0 10px 35px #10252d26; cursor: pointer;
    font: inherit; font-size: 12px; line-height: 1.5;
}
.settings-toast::before {
    content: ""; position: absolute; top: -7px; right: 12px; width: 12px; height: 12px;
    transform: rotate(45deg); background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
}
.settings-toast strong { display: block; margin-bottom: 3px; }
/* Der Platz für die Seiten-Scrollleiste bleibt beim Öffnen und Schließen
   des Dialogs erhalten. So behält das Raster der Übersicht seine Breite. */
html[data-appearance="modern"]:has(body.overview-page) { scrollbar-gutter: stable; }

/* Das Einstellungsfenster wird relativ zum sichtbaren Bereich zentriert. */
html[data-appearance="modern"] .settings-dialog:modal { position: fixed; inset: 0; }

.settings-dialog {
    width: min(430px,calc(100vw - 24px)); max-height: calc(100dvh - 24px);
    margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 18px;
    background: var(--surface); color: var(--ink); box-shadow: 0 18px 70px #10252d40; overflow: auto;
}
.settings-dialog:not([open]), .settings-dialog [hidden], .settings-toast[hidden] { display: none; }
.settings-dialog::backdrop { background: #0b242c66; backdrop-filter: blur(2px); }
.settings-heading { display: flex; gap: 8px; align-items: center; padding: 12px 12px 4px; }
.settings-heading h2 { flex: 1; min-width: 0; margin: 0 4px; font-size: 18px; line-height: 1.3; }
.settings-icon { flex: none; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 25px; cursor: pointer; }
.settings-view { padding: 2px 18px 18px; }
.settings-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.settings-row:is(a) { text-decoration:none; }
/* Der Kopfzeilenpunkt fasst den rein lesenden Anlagenstatus zusammen und zeigt Details bei Bedarf. */
.health-anchor { position:relative; display:flex; align-items:center; }
.health-button { position:relative; }
.health-button-dot { display:block; width:11px; height:11px; border-radius:50%; background:#9aa7aa; box-shadow:0 0 0 4px color-mix(in srgb,#9aa7aa 18%,transparent); }
.health-button[data-state="ok"] .health-button-dot { background:#24b99a; box-shadow:0 0 0 4px color-mix(in srgb,#24b99a 18%,transparent); }
.health-button[data-state="stale"] .health-button-dot { background:#e6a33d; box-shadow:0 0 0 4px color-mix(in srgb,#e6a33d 20%,transparent); }
.health-button[data-state="error"] .health-button-dot { background:#d75c50; box-shadow:0 0 0 4px color-mix(in srgb,#d75c50 20%,transparent); }
.health-popover { position:absolute; z-index:250; top:calc(100% + 10px); right:0; width:min(300px,calc(100vw - 24px)); padding:12px 14px; border:1px solid var(--line); border-radius:16px; background:color-mix(in srgb,var(--surface) 88%,transparent); color:var(--ink); box-shadow:0 14px 38px #10252d30; backdrop-filter:blur(18px); }
.health-popover[hidden] { display:none; }
.health-popover header { display:flex; align-items:center; justify-content:space-between; margin-bottom:5px; font-size:14px; }
.health-popover header button { width:34px; height:34px; border:0; border-radius:10px; background:var(--accent-soft); color:var(--ink); font:inherit; font-size:21px; cursor:pointer; }
.health-row { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:34px; border-top:1px solid var(--line); font-size:13px; }
.health-value { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:12px; font-weight:500; text-align:right; }
.health-value::before { content:""; flex:none; width:7px; height:7px; border-radius:50%; background:#9aa7aa; }
/* Besucherzahlen sind reine Mengenangaben; der allgemeine Statuspunkt wäre hier missverständlich. */
#visitor-today-value::before { content:none; }
.health-value[data-state="ok"] { color:#168d75; }
.health-value[data-state="ok"]::before { background:#24b99a; }
.health-value[data-state="stale"],.health-value[data-state="error"] { color:#bd7540; }
.health-value[data-state="stale"]::before,.health-value[data-state="error"]::before { background:#e6a33d; }
/* Besucherzahlen sind reine Kennzahlen und erhalten keinen künstlichen Statuspunkt. */
#visitor-active-value::before,#visitor-hour-value::before { display:none; }
.health-refreshing { animation:settings-health-turn .7s linear infinite; }
@keyframes settings-health-turn { to { transform:rotate(360deg); } }
.settings-row strong, .settings-choice strong { display: block; font-size: 14px; font-weight: 600; }
.settings-row small, .settings-choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-switch { appearance: none; flex: none; width: 44px; height: 26px; margin: 0; border: 1px solid var(--line); border-radius: 20px; background: #9aabb1; position: relative; cursor: pointer; }
.settings-switch::before { content: ""; display: block; width: 20px; height: 20px; margin: 2px; border-radius: 50%; background: white; transition: transform .15s; }
.settings-switch:checked { background: var(--accent); border-color: var(--accent); }
.settings-switch:checked::before { transform: translateX(18px); }
/* Erscheinungsbild und Farbschalter bilden gemeinsam eine einzige kompakte Einstellungszeile. */
.settings-appearance-row { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.settings-appearance-row .appearance-choice { flex:1; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:10px; cursor:pointer; }
.settings-appearance-row .appearance-choice strong { display:block; font-size:14px; font-weight:600; }
.settings-appearance-row .appearance-choice small { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.settings-appearance-row .appearance-choice select { min-width:0; width:112px; max-width:42%; padding:8px 24px 8px 9px; }
.theme-toggle { flex:none; position:relative; width:58px; height:34px; padding:0; display:flex; align-items:center; justify-content:space-around; border:1px solid var(--line); border-radius:18px; background:var(--accent-soft); color:var(--muted); cursor:pointer; }
.theme-toggle svg { position:relative; z-index:1; width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.theme-toggle::before { content:""; position:absolute; top:3px; left:3px; width:26px; height:26px; border-radius:50%; background:var(--surface); box-shadow:0 1px 4px #0002; transition:transform .18s ease; }
.theme-toggle[aria-pressed="true"]::before { transform:translateX(24px); }
.theme-toggle[aria-pressed="false"] .theme-sun,.theme-toggle[aria-pressed="true"] .theme-moon { color:var(--accent); }
.settings-intro, .settings-status { font-size: 12px; line-height: 1.5; color: var(--muted); }
.settings-choice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.settings-choice input { flex: none; width: 20px; height: 20px; accent-color: var(--accent); margin: 1px 0 0; }
.settings-save, .settings-disable { width: 100%; min-height: 44px; margin-top: 8px; }
/* Desktop-Kompaktanzeige: Auswahl und Öffnen bleiben in einer kurzen Einstellungszeile. */
.settings-compact { padding:14px 0; border-bottom:1px solid var(--line); }
.settings-compact[hidden] { display:none; }
.settings-compact>span strong { display:block; font-size:14px; font-weight:600; }
.settings-compact>span small { display:block; margin-top:4px; color:var(--muted); font-size:11px; }
.settings-compact>div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin-top:10px; }
.settings-compact select { min-width:0; padding:9px 28px 9px 10px; border:1px solid var(--line); border-radius:9px; background:var(--surface); color:var(--ink); font:inherit; }
.settings-compact .button { min-height:40px; padding-inline:14px; }
.settings-compact .settings-status { grid-column:1/-1; margin:4px 0 0; }
/* Die Ja/Nein-Rückfrage ersetzt den Testknopf am selben Platz und bleibt auf schmalen Geräten bedienbar. */
.settings-push-test { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.settings-test-button { width:100%; min-height:44px; }
.settings-testantwort p { margin:0 0 8px; font-size:14px; }
.settings-testaktionen { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.settings-testaktionen .button { min-height:44px; }
.settings-status[data-kind=error] { color: #ad4c36; }
[data-theme=dark] .settings-status[data-kind=error] { color: #f4b29c; }
.settings-dialog :focus-visible, .settings-toast:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media(prefers-reduced-motion: reduce) { .settings-switch::before,.theme-toggle::before { transition: none; } }
@media (max-width: 360px) {
    .settings-heading h2 { font-size: 16px; overflow-wrap: anywhere; }
}

/* Lokal geschützte Eingaben passen sich auch schmalen Menüs ohne horizontales Scrollen an. */
.settings-local { margin-top: 18px; }
.settings-local h3 { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.settings-local label { font-size: 12px; line-height: 1.4; }
.settings-input-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.settings-input-row input { flex: 1; min-width: 0; width: 90px; min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.settings-input-row span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.settings-input-row .button { min-height: 42px; padding: 8px 10px; }
