/* Air — App-Styles auf Basis von Dock (tokens.css + dock.css). */

html {
  background: var(--wall-base);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
/* Tapete: Verlauf und Filmkorn als feste Ebenen, body selbst ohne Hintergrund */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  z-index: -2;
  background-color: var(--wall-base);
  background-image:
    radial-gradient(110% 80% at 88% -5%, var(--wall-c) 0%, transparent 55%),
    radial-gradient(90% 80% at -5% 105%, var(--wall-b) 0%, transparent 60%),
    linear-gradient(160deg, var(--wall-a) 0%, var(--wall-base) 100%);
}
body::after {
  z-index: -1;
  opacity: var(--grain, 0.32);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
[data-theme="papier"] body::after { opacity: var(--grain-light, 0.16); }
@media (prefers-color-scheme: light) { [data-theme="system"] body::after { opacity: var(--grain-light, 0.16); } }

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--a-time); outline-offset: 2px; }

/* ---------- Seite ---------- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(7.5rem + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
@media (min-width: 640px) { .page { padding-left: var(--space-6); padding-right: var(--space-6); } }

.greeting {
  margin: 8px 2px 18px;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.greeting small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--ink-2);
}
@media (min-width: 640px) { .greeting { font-size: 40px; } }

.dock-grid { --dock-cols: 2; }
@media (min-width: 640px) { .dock-grid { --dock-cols: 4; } }
@media (min-width: 1024px) { .dock-grid { --dock-cols: 6; } }

.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-col { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.bleed { position: absolute; left: 0; right: 0; bottom: 0; }
.unit { font-size: 0.5em; font-weight: 700; margin-left: 2px; color: var(--ink-2); letter-spacing: 0; }
.label { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink-2); }
.caption { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--ink-2); }
.body { font-size: 14px; font-weight: 600; line-height: 1.35; }
.sentence {
  font-family: var(--font-display);
  font-size: 22px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em;
  color: var(--ink-2); margin: 0;
}
.sentence b { color: var(--ink); }
.dock-round { --round: 44px; width: var(--round); height: var(--round); padding: 0; touch-action: manipulation; }
.round-pair { display: flex; gap: 8px; }
.dock-round[disabled], .dock-pill[disabled] { opacity: 0.4; pointer-events: none; }
.dock-tile > .tap { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; border-radius: inherit; }
.dock-tile .over { position: relative; pointer-events: none; }
.dock-tile .over button, .dock-tile .over input, .dock-tile .over a { pointer-events: auto; }

/* Status-Punkt */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex-shrink: 0; }
.dot.ok { background: var(--a-plus); }
.dot.bad { background: var(--a-minus); }
.dot.warn { background: var(--a-warn); }

/* Listen */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 2px;
  border-bottom: 1px solid var(--edge); font-size: 14px; font-weight: 600;
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { font-size: 12px; color: var(--ink-2); font-weight: 600; }

.glass-soft {
  border-radius: var(--radius-panel);
  padding: 6px 16px;
  background-color: rgba(15, 15, 20, 0.42);
  -webkit-backdrop-filter: var(--backdrop-soft);
  backdrop-filter: var(--backdrop-soft);
  box-shadow: var(--shadow-soft-edge);
}
[data-theme="papier"] .glass-soft { background-color: rgba(255, 255, 255, 0.42); }
@media (prefers-color-scheme: light) { [data-theme="system"] .glass-soft { background-color: rgba(255, 255, 255, 0.42); } }

.section-title {
  margin: 26px 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Dock unten ---------- */
.dock-float {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
}
.dock-app .dock-icon { pointer-events: none; }
.dock-metric-value { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1; letter-spacing: -0.02em; }
.dock-metric-label { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Formulare ---------- */
.form-tile { padding: 18px; border-radius: var(--radius-tile); background: var(--tile); margin-bottom: var(--tile-gap); }
.form-tile h3 {
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
}
.form-tile > p.hint { margin: 0 0 12px; }
.fields { display: grid; gap: 8px; margin-top: 12px; }
@media (min-width: 640px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.field {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 6px 6px 6px 14px; box-sizing: border-box;
  border-radius: var(--radius-inner); background: var(--row);
}
.field > label, .field > .flabel { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.field .flabel small, .field > label small { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.field.col { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 8px; }
.input, .select {
  height: 36px; padding: 0 12px; box-sizing: border-box; min-width: 0;
  border: 1px solid var(--edge-strong); border-radius: var(--radius-cell);
  background: var(--control); color: var(--ink);
  font-size: 15px; font-weight: 600;
}
.input:focus, .select:focus { outline: 2px solid var(--a-time); outline-offset: 0; border-color: transparent; }
.input.num { width: 84px; text-align: right; }
.input.time { width: 112px; text-align: center; }
.input.wide { width: 100%; }
.field:not(.col) .input:not(.num):not(.time) { width: min(60%, 320px); }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.select option { background: var(--tile-raised); color: var(--ink); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Schalter */
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--track);
  transition: background 0.2s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
.switch input:checked + span { background: var(--a-plus); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--a-time); outline-offset: 2px; }

.secret-state { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.secret-state.set { color: var(--a-plus); }

/* ---------- Detail-Sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.2s ease-out;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; box-sizing: border-box;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--tile); box-shadow: var(--shadow-sheet);
  animation: up 0.32s cubic-bezier(.2, .9, .25, 1);
}
@media (min-width: 640px) {
  .scrim { align-items: center; }
  .sheet { border-radius: var(--radius-sheet); animation: grow 0.42s cubic-bezier(.2, .9, .25, 1); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes grow { from { transform: scale(0.9); opacity: 0; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: var(--radius-pill);
  background-color: var(--dock); -webkit-backdrop-filter: var(--backdrop-glass); backdrop-filter: var(--backdrop-glass);
  box-shadow: var(--shadow-glass);
  font-size: 14px; font-weight: 600; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  animation: fade 0.2s ease-out;
}
.toast.error { color: var(--a-minus); }

/* ---------- Diagramm ---------- */
.chart { width: 100%; height: 260px; display: block; }
.chart text { font-family: var(--font-mono); font-size: 10px; font-weight: 600; fill: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: currentColor; }

.code-box {
  margin: 12px 0; padding: 16px; border-radius: var(--radius-inner); background: var(--row);
  font-family: var(--font-mono); font-size: clamp(14px, 4.4vw, 20px); font-weight: 700; letter-spacing: 0.04em; text-align: center;
  white-space: nowrap; overflow-x: auto;
  user-select: all; -webkit-user-select: all;
}

@media (prefers-reduced-motion: reduce) {
  .scrim, .sheet, .toast { animation: none !important; }
  .switch span, .switch span::after { transition: none !important; }
}

/* Segmente in Formularen dürfen umbrechen (z. B. sechs Paletten auf dem Handy) */
.field .dock-seg, .form-tile .dock-seg { flex-wrap: wrap; border-radius: var(--radius-inner); background: var(--control); }
a.dock-pill { text-decoration: none; }
.page { overflow-x: clip; }
.code-box.link { white-space: normal; word-break: break-all; font-size: 13px; letter-spacing: 0; text-align: left; }

/* Schalter-Zeilen: ganze Zeile tippbar, sofortige Rückmeldung, kein Doppeltipp-Zoom */
.toggle-row { cursor: pointer; -webkit-user-select: none; user-select: none; transition: background 0.15s; }
.toggle-row:active { background: var(--control); }
button, label, input, select, a { touch-action: manipulation; }

/* Nichts darf breiter als die Karte werden (iOS macht <select> so breit wie die längste Option) */
.form-tile { min-width: 0; overflow: hidden; }
.fields > *, .field > *, .field .flabel { min-width: 0; }
.select { max-width: 100%; text-overflow: ellipsis; }
.field.col .select, .field.col .input { width: 100%; }
.field.col > div { min-width: 0; }

/* Stufe wird gesetzt: betroffene Balken pulsieren, bis der Karl bestätigt */
@keyframes seg-pulse { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.75; } }

/* Auswahl-Karten (Radio) */
.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px;
  border-radius: var(--radius-cell); background: var(--control); cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.15s, background 0.15s;
  -webkit-user-select: none; user-select: none;
}
.choice:has(input:checked) { border-color: var(--a-time); }
.choice input { appearance: none; -webkit-appearance: none; margin: 2px 0 0; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-content: center; }
.choice input:checked { border-color: var(--a-time); }
.choice input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--a-time); }
.choice input:focus-visible { outline: 2px solid var(--a-time); outline-offset: 2px; }
.choice-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.choice-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.choice-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--row); color: var(--ink-2); }
.choice-text { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }

/* ---------- Einstellungen: Übersicht und Unterseiten ---------- */
[hidden] { display: none !important; }
.form-tile > .fields:first-child { margin-top: 0; }
.explain { margin: 0; padding: 0 4px; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--ink-2); }
.fields > .explain { margin: -2px 0 4px; }
.tag { margin-left: 8px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--row);
  font-size: 11px; font-weight: 600; color: var(--ink-2); vertical-align: 1px; }

/* Zurück-Zeile mit Speicher-Rückmeldung */
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 -6px -6px; }
.back-link { display: inline-flex; align-items: center; gap: 0; min-height: 44px; padding: 0 10px 0 2px; border: 0;
  border-radius: var(--radius-pill); background: transparent; color: var(--a-time); font-size: 16px; font-weight: 600; cursor: pointer; }
.back-link:active { background: var(--row); }
.save-mark { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  opacity: 0; transition: opacity 0.25s; }
.save-mark.show { opacity: 1; }
.save-mark.ok { color: var(--a-plus); }

/* Navigationsliste der Übersicht */
.form-tile.nav-list { padding: 4px 0; }
.nav-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 10px 14px 10px 16px;
  box-sizing: border-box; border: 0; border-bottom: 1px solid var(--edge); background: transparent; color: var(--ink);
  text-align: left; cursor: pointer; transition: background 0.15s; }
.nav-row:last-child { border-bottom: 0; }
.nav-row:active { background: var(--row); }
.nav-row > .dock-icon:last-child { color: var(--ink-3); }
.nav-ic { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--row); }
.nav-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nav-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.nav-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.nav-sum { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; }
.overview-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 28px; }

/* Hinweis-Banner (etwas fehlt) */
.banners { display: grid; gap: 8px; margin-bottom: 8px; }
.banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 12px 10px 14px;
  box-sizing: border-box; border: 0; border-radius: var(--radius-inner); background: var(--tile); color: var(--ink);
  box-shadow: inset 3px 0 0 var(--a-warn); font-size: 14px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer;
  margin-bottom: var(--tile-gap); }
.banners .banner { margin-bottom: 0; }
.banner .grow { flex: 1; min-width: 0; }
.banner-action { display: inline-flex; align-items: center; color: var(--a-time); white-space: nowrap; }

/* Live-Zeile, Status */
.form-tile.live .stack { min-width: 0; gap: 4px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.status-line .dot { margin-top: 1px; }

/* Stepper − Wert + */
.stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.stepper .dock-round { --round: 36px; }
.stepper-value { min-width: 66px; text-align: center; font-family: var(--font-display); font-size: 19px; font-weight: 700;
  letter-spacing: -0.01em; }

/* Abhängige Felder: eingerückt unter ihrem Schalter */
.fields.deps { margin: 0 0 4px 14px; padding-left: 10px; border-left: 2px solid var(--edge); gap: 8px; }
.alert-block { display: grid; gap: 8px; }
.alert-block + .alert-block { margin-top: 6px; }

/* Zeiträume, Bereiche, Zeilen mit Knopf */
.time-range { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.time-range .input.time { width: 92px; padding: 0 6px; }
.range { display: flex; align-items: center; gap: 8px; }
.range .select { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline .select { flex: 1; min-width: 0; }
.seg-wrap .dock-seg { width: 100%; }
.seg-wrap .dock-seg button { flex: 1; }

/* Erweitert (aufklappbar) */
details.more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 12px 0 14px;
  border-radius: var(--radius-inner); background: var(--row); font-size: 14px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; list-style: none; -webkit-user-select: none; user-select: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .dock-icon { transition: transform 0.2s; }
details.more[open] > summary .dock-icon { transform: rotate(180deg); }
details.more > .fields { margin-top: 8px; }

/* Geheimnisse */
.flabel small.is-set { color: var(--a-plus); }
.secret-form { display: grid; gap: 8px; }
.secret-form .form-actions { margin-top: 0; }
.input[aria-invalid="true"] { border-color: var(--a-minus); }

/* Personen */
button.list-row.person { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; color: inherit;
  text-align: left; cursor: pointer; padding-left: 2px; }
button.list-row.person > .dock-icon { color: var(--ink-3); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dock-pill--danger { background: var(--control); color: var(--a-minus); }
@media (prefers-reduced-motion: reduce) { details.more > summary .dock-icon, .save-mark, .nav-row { transition: none !important; } }
/* Zeilen mit langem Hinweis: Hinweis über die ganze Breite unter Label und Bedienelement */
.field.wrap { flex-wrap: wrap; row-gap: 2px; }
.field.wrap > .row-hint { flex-basis: 100%; order: 3; padding: 0 8px 4px 0; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }
.field.col .time-range { justify-content: flex-start; }
/* „Anpassen“ unter einem Hinweis: dezenter als „Erweitert“ */
.fields.deps details.more > summary { min-height: 40px; background: transparent; padding-left: 4px; font-size: 13px; color: var(--a-time); justify-content: flex-start; gap: 2px; }
.fields.deps { margin-top: -6px; }
.field .flabel { font-size: 14px; font-weight: 600; }

/* ---------- Verlauf: Kacheln ---------- */
/* Kennzahl-Kacheln: Kopf, Zahl, Bildunterschrift oben ausgerichtet, antippbar oder nicht */
.dock-tile.stat { display: flex; flex-direction: column; justify-content: flex-start; gap: 8px; }
.dock-tile.stat > .tile-col { height: auto; justify-content: flex-start; gap: 8px; }
.dock-tile.stat .dock-header__value { display: inline-flex; align-items: center; color: var(--ink-2); }
.dock-tile.stat .caption { margin-top: 0; }

/* Laufzeit je Stufe: 2 Zeilen hoch, Stufenzeilen gleichmäßig verteilt */
.dock-tile.stat-runtime { display: flex; flex-direction: column; gap: 10px; }
.stat-levels { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; min-height: 0; }
.stat-level { display: grid; grid-template-columns: 54px minmax(0, 1fr) 44px; align-items: center; column-gap: 10px; }
.stat-level-name { white-space: nowrap; }
.stat-level-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-level-bar .dock-level { height: 10px; }

/* Daten: füllt die Lücke neben dem Laufzeit-Block */
.dock-tile.stat-data { display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  grid-column: span 2; grid-row: span 1; }
.dock-tile.stat-data .dock-pill { flex-shrink: 0; }
@media (min-width: 640px) { .dock-tile.stat-data { grid-row: span 2; } }
@media (min-width: 1024px) { .dock-tile.stat-data { grid-column: span 4; grid-row: span 1; } }

/* ---------- Verlauf: Chart (echte Pixelbreite, Zeiger) ---------- */
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; cursor: crosshair; outline: none; }
.chart:focus-visible { outline: 2px solid var(--a-time); outline-offset: 4px; border-radius: 8px; }
.chart text { font-family: var(--font-mono); font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.chart-grid { stroke: var(--edge); stroke-width: 1; }
.chart-grid.faint { stroke-dasharray: 2 4; }
.chart-cursor { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: currentColor; stroke: var(--tile); stroke-width: 2; }
.chart-dot.karl { fill: var(--ink-2); }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; top: 2px; left: 0; z-index: 2; min-width: 150px; box-sizing: border-box; padding: 8px 10px;
  border-radius: var(--radius-cell); background: var(--tile-raised); box-shadow: var(--shadow-soft-edge);
  pointer-events: none; font-size: 12px; font-weight: 600; color: var(--ink); }
.chart-tip-head { margin-bottom: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.chart-tip-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; line-height: 1.6; }
.chart-tip-row i { width: 12px; height: 3px; border-radius: 2px; }
.legend i.dash { background: none !important; height: 0; border-top: 2px dashed currentColor; }

/* ================= Startseite: Klima-Hero ================= */
/* Kopf: Gruß und Status-Chip (führt immer zum Logbuch) */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin: 8px 2px 18px; }
.home-head h1 { margin: 0; font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
@media (min-width: 640px) { .home-head h1 { font-size: 38px; } }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 12px; border: 0; border-radius: var(--radius-pill);
  background-color: var(--dock); -webkit-backdrop-filter: var(--backdrop-soft); backdrop-filter: var(--backdrop-soft);
  box-shadow: var(--shadow-soft-edge); font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
  transition: transform 0.15s;
}
.status-chip:active { transform: scale(0.96); }
.status-chip > .dock-icon { color: var(--ink-3); }
.status-chip .dot.ok { box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-plus) 22%, transparent); }
.status-chip .dot.warn { box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-warn) 25%, transparent); }
.status-chip .dot.bad { box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-minus) 25%, transparent); }

/* Raster: Hero über die ganze Breite, am Desktop 4 von 6 Spalten */
.home-grid .card-hero { grid-column: 1 / -1; }
@media (min-width: 640px) and (max-width: 1023px) { .home-grid:not(.calm) .card-trend { grid-column: 1 / -1; } }
@media (min-width: 1024px) {
  .home-grid .card-hero { grid-column: span 4; }
  .home-grid.calm .card-trend { grid-row: span 2; }
}

/* Hero: Farbe folgt der Lage */
.dock-tile.card-hero { --mood: var(--a-time); padding: 0; isolation: isolate; overflow: clip; }  /* clip: Karte darf nie scrollen (Fokus, Wellen) */
.card-hero[data-mood="dry"] { --mood: var(--a-leave); }
.card-hero[data-mood="wet"] { --mood: var(--a-plan); }
.card-hero[data-mood="idle"] { --mood: var(--ink-3); }
.card-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--mood) 16%, transparent), transparent 62%);
}
.hero {
  position: relative; z-index: 1; height: 100%; box-sizing: border-box; padding: calc(var(--tile-pad) + 3px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0;
}

/* Wasser: Höhe = Raumfeuchte, Wellentempo = Stufe (per WAAPI), Farbe = Stimmung */
.wave { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; border-radius: inherit; color: var(--mood); opacity: 0.2;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%); transition: color 1.2s ease; }
.wave-water {
  position: absolute; left: 0; right: 0; bottom: -6px; height: var(--fill, 50%); background: currentColor;
  transition: height 1.8s cubic-bezier(.3, .8, .25, 1); animation: bob 6s ease-in-out infinite;
}
/* Kämme laufen nach oben wie Nebel aus (Verlauf statt harter Kante) */
.wave-crest { position: absolute; left: 0; bottom: calc(100% - 1px); display: block; width: 200%; height: 26px; }
.wave-crest.back { height: 38px; opacity: 0.55; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* Kopfzeile im Hero */
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.mode-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; height: 34px; padding: 0 14px 0 10px;
  border: 0; border-radius: var(--radius-pill); background: var(--control); color: var(--ink);
  font-family: var(--font-display); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.3s, color 0.3s, transform 0.15s;
}
.mode-chip:active { transform: scale(0.96); }
.mode-chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-chip[data-state="on"] { background: var(--tone-lilac); color: var(--tone-ink); }
.mode-chip[data-state="on"] .dock-icon { color: #7d2fb0; }
.mode-chip[data-state="hold"] { background: var(--tone-cream); color: var(--tone-ink); }
.mode-chip[data-state="hold"] .dock-icon { color: #b56500; }
.mode-chip:focus-visible { outline: 2px solid var(--a-time); outline-offset: 2px; }
.hero-fresh { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }

/* Wert und Lage */
.hero-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-reading { display: flex; align-items: center; gap: 10px; }
.hero-num { font-family: var(--font-display); font-weight: 700; font-size: 72px; letter-spacing: -0.045em; }
@media (min-width: 1024px) { .hero-num { font-size: 96px; } }
.hero-num .unit { font-size: 0.4em; }
.hero-trend { color: var(--mood); transition: color 1.2s; }
.hero-src { align-self: flex-end; margin-bottom: 0.6em; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.hero-cond { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.hero-cond::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mood); transition: background 1.2s; }
.hero-story { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }

/* Rollende Ziffern */
.odo { display: inline-flex; align-items: flex-end; line-height: 1; font-variant-numeric: tabular-nums; }
.odo-digits { display: inline-flex; }
.odo-col { position: relative; display: inline-block; height: 1em; overflow: hidden; }
.odo-strip { display: flex; flex-direction: column; transition: transform 0.75s cubic-bezier(.2, .9, .25, 1.12); }
.odo-strip > span { display: block; height: 1em; line-height: 1; text-align: center; }
.odo-glyph { display: none; line-height: 1; }
.odo-col[data-kind="char"] .odo-strip { display: none; }
.odo-col[data-kind="char"] .odo-glyph { display: inline-block; }
.odo .unit { margin-bottom: 0.08em; line-height: 1; }

/* Bedienung im Hero: ein Raster, keine Kästen. Spalten: Wert | Skala bzw. Balken | Knöpfe bzw. Lüfter.
   Lesbar über dem Wasser durch DECKENDE Flächen (--hero-solid), nicht durch einen Hintergrund. */
.card-hero { --hero-solid: color-mix(in srgb, var(--ink) 13%, var(--tile)); --hero-solid-2: color-mix(in srgb, var(--ink) 20%, var(--tile)); }
.hero-controls {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center;
  column-gap: 16px; row-gap: 14px; padding-top: 4px;
}
.hero-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hero-metric small {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 66%, transparent);
}
.hero-metric .odo, .hero-metric__value { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.hero-metric .odo .unit { font-size: 0.6em; }
.hero-metric[data-pending] .odo, .hero-metric[data-pending] .hero-metric__value { color: var(--a-week); }
.hero-metric[data-pending] .hero-metric__value { animation: seg-pulse 1.1s ease-in-out infinite; }
.hero-pair { display: flex; gap: 8px; }
.card-hero { --hero-button: color-mix(in srgb, var(--ink) 22%, var(--tile)); }
[data-theme="papier"] .card-hero { --hero-button: #ffffff; }
@media (prefers-color-scheme: light) { [data-theme="system"] .card-hero { --hero-button: #ffffff; } }
.hero-pair .dock-round {
  --round: 38px; background: var(--hero-button); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 6px 14px -6px rgba(0, 0, 0, 0.22);
}
.hero-pair .dock-round:hover { filter: brightness(1.06); }
.hero-fan { display: inline-block; transform-origin: 50% 50%; }
.hero-hint { grid-column: 2 / -1; margin-top: -8px; font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.hero-hint:empty { display: none; }
@media (max-width: 420px) { .hero-hint { display: none; } .hero-controls { column-gap: 12px; grid-template-columns: 56px minmax(0, 1fr) auto; } }

/* Skala 30–60 % als Schieberegler: Füllung = Raum jetzt (Stimmungsfarbe), weißer Knopf = Ziel */
.scale { position: relative; min-width: 0; height: 40px; margin: 0 12px;  /* Platz, damit der Knopf an den Enden nicht übersteht */ cursor: pointer; touch-action: pan-y; outline: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.scale-track { position: absolute; left: 0; right: 0; top: 9px; height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: var(--hero-solid); }
.scale-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, color-mix(in srgb, var(--mood) 30%, transparent), var(--mood));
  transition: width 1.4s cubic-bezier(.3, .8, .25, 1), background 1.2s;
}
.scale-now {
  position: absolute; top: 13px; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--mood);
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--mood) 60%, transparent);
  transition: left 1.4s cubic-bezier(.3, .8, .25, 1), background 1.2s;
}
.scale-now::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--mood); animation: ping 2.8s ease-out infinite; }
.scale-band {
  position: absolute; top: 5px; height: 16px; min-width: 12px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ink) 12%, transparent); transition: left 0.35s ease, width 0.35s ease, opacity 0.3s;
}
.scale-knob {
  position: absolute; top: 13px; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 6px 14px -4px rgba(0, 0, 0, 0.3), inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  transition: left 0.35s cubic-bezier(.3, .8, .25, 1), transform 0.15s, opacity 0.3s; cursor: grab;
}
.card-hero[data-dragging] .scale-knob { transition: transform 0.15s; transform: scale(1.12); cursor: grabbing; }
.card-hero[data-dragging] .scale-band { transition: none; }
.scale:focus-visible .scale-knob { outline: 2px solid var(--a-time); outline-offset: 3px; }
.scale-lo, .scale-hi { position: absolute; bottom: 0; font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.scale-lo { left: 0; }
.scale-hi { right: 0; }
.card-hero[data-smart="off"] .scale-band, .card-hero[data-smart="off"] .scale-knob, .card-hero[data-smart="off"] .is-target { opacity: 0.5; }

/* Abstand zum Ziel neben dem Zustand */
.hero-cond__delta { font-family: var(--font-sans); font-size: 14px; font-weight: 600; letter-spacing: 0; color: color-mix(in srgb, var(--ink) 62%, transparent); }
.hero-cond__delta:empty { display: none; }
.hero-metric small { display: flex; align-items: center; gap: 4px; }

/* Stufenbalken: so breit wie die Skala darüber, steigende Höhe, direkt antippbar */
.level-bars { display: grid; grid-auto-columns: minmax(0, 48px); grid-auto-flow: column; justify-content: space-between; align-items: end; gap: 6px; height: 38px; min-width: 0; }
.level-bar { display: flex; align-items: flex-end; height: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.level-bar > span { display: block; width: 100%; height: var(--h); border-radius: 8px; background: var(--hero-solid); transform-origin: bottom; transition: background 0.35s, transform 0.15s; }
.level-bar[data-state="on"] > span { background: currentColor; }
.level-bar[data-state="pending"] > span { background: currentColor; animation: seg-pulse 1.1s ease-in-out infinite; }
.level-bar:active > span { transform: scaleY(0.9); }
.level-bar:disabled { cursor: default; opacity: 0.4; }
.level-bar:focus-visible { outline: 2px solid var(--a-time); outline-offset: 2px; border-radius: 8px; }

/* Hinweise */
.dock-tile.card-alerts { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--a-warn) 45%, transparent); }
.card-alerts .over { justify-content: flex-start; gap: 10px; }
.issue-list { display: flex; flex-direction: column; gap: 8px; }
.issue { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.issue-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-meta { font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* Gerät: Steuerknöpfe; aktiv = invertiert */
.dock-tile.card-karl { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.ctl-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 1; min-height: 0; max-height: 68px; }
.ctl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 6px 4px;
  border: 0; border-radius: var(--radius-inner); background: var(--control); color: var(--ink); cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.15s;
}
.ctl:active { transform: scale(0.95); }
.ctl[aria-pressed="true"] { background: var(--ink); color: var(--tile); }
.ctl:disabled { opacity: 0.4; cursor: default; }
.ctl:focus-visible { outline: 2px solid var(--a-time); outline-offset: 2px; }
.ctl-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.ctl--info { cursor: default; background: var(--row); }
.ctl--info[data-low] .ctl-label { color: var(--a-minus); }
.ctl-ring { display: block; width: 24px; height: 24px; }

/* Verlauf 6 Std. */
.card-trend .over { gap: 6px; }
.card-trend .dock-header__value { display: inline-flex; align-items: center; font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.trend-body { flex: 1; min-height: 0; margin: 2px calc(-1 * var(--tile-pad)) calc(-1 * var(--tile-pad)); }
.dock-spark-wrap { position: relative; width: 100%; height: 100%; }
.dock-spark__band { opacity: 0.07; }
.dock-spark__band-stop { stop-color: var(--ink); }
.dock-spark__dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px 1px currentColor; }
.dock-spark__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; animation: ping 2.4s ease-out infinite; }
@keyframes ping { from { transform: scale(0.5); opacity: 0.8; } to { transform: scale(2.2); opacity: 0; } }

/* Beim Öffnen gestaffelt einblenden */
.enter { animation: rise 0.6s cubic-bezier(.2, .9, .25, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
  .enter, .wave-water, .scale-now::after, .dock-spark__dot::after, .level-bar > span { animation: none !important; }
  .odo-strip, .wave, .wave-water, .scale-now, .scale-fill, .scale-band, .scale-knob, .mode-chip, .ctl, .hero-trend, .hero-cond::before,
  .status-chip, .level-bar > span { transition: none !important; }
  .hero-metric[data-pending] .hero-metric__value { animation: none !important; }
}

/* Text über dem Wasser etwas kräftiger */
.hero-story { color: color-mix(in srgb, var(--ink) 78%, transparent); }
.hero-src, .hero-fresh { color: color-mix(in srgb, var(--ink) 70%, transparent); }
@media (min-width: 640px) { .level-bars { justify-content: start; gap: 8px; } }
