/* Webhafen OS – im Stil von iOS / macOS */
:root {
  --grund: #F2F2F7;
  --zelle: #FFFFFF;
  --zelle-druck: #E5E5EA;
  --text: #000000;
  --text-2: rgba(60, 60, 67, .6);
  --text-3: rgba(60, 60, 67, .3);
  --linie: rgba(60, 60, 67, .29);
  --fuell: rgba(118, 118, 128, .12);
  --fuell-2: rgba(120, 120, 128, .16);
  --blau: #007AFF;
  --gruen: #34C759;
  --rot: #FF3B30;
  --orange: #FF9500;
  --gelb-grund: #FFF4D6;
  --leiste: rgba(249, 249, 249, .8);
  --icon-grund: #0B4AA0;
  --schatten: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --sys: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --rund: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #000000;
    --zelle: #1C1C1E;
    --zelle-druck: #2C2C2E;
    --text: #FFFFFF;
    --text-2: rgba(235, 235, 245, .6);
    --text-3: rgba(235, 235, 245, .3);
    --linie: rgba(84, 84, 88, .6);
    --fuell: rgba(118, 118, 128, .24);
    --fuell-2: rgba(120, 120, 128, .32);
    --blau: #0A84FF;
    --gruen: #30D158;
    --rot: #FF453A;
    --orange: #FF9F0A;
    --gelb-grund: rgba(255, 159, 10, .16);
    --leiste: rgba(22, 22, 23, .75);
    --icon-grund: #0B4AA0;
    --schatten: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 400 17px/1.29 var(--sys); letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blau); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blau) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; letter-spacing: inherit; }

/* ---------- Navigationsleiste (Milchglas) ---------- */
.leiste {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(20px, calc((100% - 760px) / 2)); padding-top: max(10px, env(safe-area-inset-top));
  background: var(--leiste);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--linie);
}
.app { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; font-size: 17px; }
.app .icon { width: 28px; height: 28px; }
.tabs {
  position: fixed; top: 0; right: max(20px, calc((100% - 760px) / 2)); z-index: 21;
  display: flex; gap: 4px; height: 49px; align-items: center; padding-top: env(safe-area-inset-top);
}
.leiste { min-height: 49px; }
.tabs a {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  color: var(--text-2); font-size: 15px; font-weight: 500;
}
.tabs a svg { width: 20px; height: 20px; }
.tabs a:hover { background: var(--fuell); color: var(--text); }
.tabs a[aria-current="page"] { color: var(--blau); background: color-mix(in srgb, var(--blau) 12%, transparent); }

/* Am iPhone: Tab-Leiste unten */
@media (max-width: 700px) {
  .leiste { justify-content: center; }
  .tabs {
    top: auto; left: 0; right: 0; bottom: 0; height: auto;
    justify-content: space-around; gap: 0;
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
    background: var(--leiste);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--linie);
  }
  .tabs a { flex-direction: column; gap: 2px; padding: 2px 10px; font-size: 10px; font-weight: 500; letter-spacing: 0.01em; background: none !important; color: #8E8E93; min-width: 72px; }
  .tabs a svg { width: 27px; height: 27px; }
  .tabs a[aria-current="page"] { color: var(--blau); }
  .seite { padding-bottom: calc(110px + env(safe-area-inset-bottom)) !important; }
}

/* ---------- Seite ---------- */
.seite { max-width: 760px; margin: 0 auto; padding: 20px 20px 64px; }
.seite.schmal { max-width: 560px; }
.gross { font: 700 34px/1.2 var(--display); letter-spacing: 0.012em; margin: 6px 0 8px; }
.unter { color: var(--text-2); font-size: 15px; line-height: 1.35; margin-bottom: 20px; max-width: 62ch; }
.zurueck { font-size: 17px; margin-top: 4px; }
.leise { color: var(--text-2); }
.klein { font-size: 13px; }
.fuss { color: var(--text-2); font-size: 13px; text-align: center; margin: 28px 0 0; }

/* ---------- Hinweise ---------- */
.hinweis { border-radius: 12px; padding: 12px 16px; font-size: 15px; line-height: 1.35; margin: 0 0 16px; }
.hinweis.rot { background: color-mix(in srgb, var(--rot) 13%, transparent); color: var(--rot); }
.hinweis.gruen { background: color-mix(in srgb, var(--gruen) 15%, transparent); color: color-mix(in srgb, var(--gruen) 70%, var(--text)); }
.hinweis.gelb { background: var(--gelb-grund); color: color-mix(in srgb, var(--orange) 55%, var(--text)); }

/* ---------- Kacheln (Widgets) ---------- */
.kacheln { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 8px; }
.kachel {
  background: var(--zelle); border-radius: 18px; padding: 14px 16px 16px; box-shadow: var(--schatten);
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 96px; color: var(--text);
}
.kachel span { font-size: 13px; color: var(--text-2); font-weight: 500; line-height: 1.25; }
.kachel strong { font: 700 26px/1 var(--rund); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
a.kachel strong { color: var(--blau); }
a.kachel:active { background: var(--zelle-druck); }
@media (max-width: 700px) { .kacheln { grid-template-columns: 1fr 1fr; } }

/* ---------- Gruppierte Listen (wie die Einstellungen) ---------- */
.gruppen-titel {
  font-size: 13px; font-weight: 400; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.02em;
  margin: 28px 16px 7px;
}
.gruppe { list-style: none; margin: 0; padding: 0; background: var(--zelle); border-radius: 12px; overflow: hidden; box-shadow: var(--schatten); }
.gruppe > li { position: relative; }
.gruppe > li + li::before, .formular .feld + .feld::before, .formular .feld + .aktion::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--linie);
}
.zeile {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px;
  color: var(--text); width: 100%; background: none; border: 0; text-align: left; cursor: default;
}
a.zeile, summary.zeile, button.zeile { cursor: pointer; }
a.zeile:active, summary.zeile:active, button.zeile:active { background: var(--zelle-druck); }
.zeile .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.zeile .text strong { font-weight: 400; }
.zeile .text small { font-size: 15px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wert { color: var(--text-2); font-size: 17px; white-space: nowrap; }
.wert.gruen { color: var(--gruen); }
.wert.blau { color: var(--blau); }
.wert.rot { color: var(--rot); }
.pfeil { width: 8px; height: 14px; color: var(--text-3); flex: none; margin-left: -4px; }
.knopf-zeile { justify-content: center; font-size: 17px; }
.knopf-zeile.rot { color: var(--rot); }

/* Aufklappbare Anfrage */
.anfrage summary { list-style: none; }
.anfrage summary::-webkit-details-marker { display: none; }
.anfrage summary::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg); margin: -4px 4px 0 2px; transition: transform .2s;
}
.anfrage[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.anfrage .inhalt { padding: 2px 16px 16px; }
.anfrage dl { margin: 0 0 12px; display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 8px 16px; }
.anfrage dt { color: var(--text-2); font-size: 15px; text-transform: capitalize; }
.anfrage dd { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.4; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knoepfe form { margin: 0; }

/* ---------- Formulare in Listen ---------- */
.formular { display: block; }
.formular .feld, .formular .aktion { position: relative; }
.feld { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; }
.feld > span { flex: none; width: 118px; color: var(--text); }
.feld input:not([type="checkbox"]) {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; letter-spacing: inherit; padding: 11px 0; outline: none; text-align: left;
}
.feld input::placeholder { color: var(--text-3); }
.formular .aktion { padding: 12px 16px; display: flex; justify-content: flex-end; }
@media (max-width: 500px) { .feld > span { width: 100px; } }

/* iOS-Schalter */
.schalter { justify-content: space-between; }
.schalter input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; margin: 0; flex: none;
  width: 51px; height: 31px; border-radius: 999px; background: var(--fuell-2); position: relative; cursor: pointer;
  transition: background .25s;
}
.schalter input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .25s;
}
.schalter input[type="checkbox"]:checked { background: var(--gruen); }
.schalter input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--blau); color: #fff; font-size: 17px; font-weight: 600;
}
.knopf:active { filter: brightness(.88); }
.knopf.voll { width: 100%; height: 50px; border-radius: 14px; }
.knopf.klein { min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: 15px; }
.knopf.grau { background: var(--fuell); color: var(--blau); }
.knopf.rot { background: color-mix(in srgb, var(--rot) 13%, transparent); color: var(--rot); }
.knopf.rot.ohne { background: none; }
.gefahr { margin-top: 12px; text-align: center; }

/* ---------- Segment-Umschalter ---------- */
.segmente { display: flex; padding: 2px; border-radius: 9px; background: var(--fuell); margin: 4px 0 16px; }
.segmente a {
  flex: 1; text-align: center; padding: 6px 10px; border-radius: 7px; color: var(--text);
  font-size: 13px; font-weight: 500; letter-spacing: -0.005em;
}
.segmente a[aria-selected="true"] {
  background: var(--zelle); font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) { .segmente a[aria-selected="true"] { background: #636366; } }

/* ---------- Einbau-Code ---------- */
.code { padding: 14px 16px; }
.code p { font-size: 15px; color: var(--text-2); line-height: 1.35; margin-bottom: 12px; }
.code textarea {
  width: 100%; resize: vertical; border: 0; border-radius: 10px; padding: 12px;
  background: var(--grund); color: var(--text); font: 13px/1.5 var(--mono); letter-spacing: 0;
}
.code .aktion { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---------- Anmelden / zentrierte Seiten ---------- */
body.mitte { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 20px; }
.anmelden { width: 100%; max-width: 380px; min-width: 0; text-align: center; }
.anmelden > .icon { width: 84px; height: 84px; margin: 0 auto 18px; display: block; filter: drop-shadow(0 8px 20px rgba(11, 74, 160, .28)); }
.anmelden h1 { font: 700 28px/1.15 var(--display); letter-spacing: 0.01em; margin-bottom: 6px; }
.anmelden .leise { font-size: 15px; margin-bottom: 26px; }
.anmelden form { text-align: left; }
.felder { background: var(--zelle); border-radius: 12px; overflow: hidden; box-shadow: var(--schatten); margin-bottom: 20px; }
.felder .feld { position: relative; }
.felder .feld + .feld::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--linie); }
.felder .feld > span { width: 86px; }
.anmelden .hinweis { text-align: left; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.fuss + .gruppe { margin-top: 24px; }

/* ---------- Telefon ---------- */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.knopf.gruen { background: var(--gruen); color: #fff; }
.knopf.klein.gruen { background: color-mix(in srgb, var(--gruen) 16%, transparent); color: color-mix(in srgb, var(--gruen) 75%, var(--text)); }
.knopf:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.hinweis.blau { background: color-mix(in srgb, var(--blau) 12%, transparent); color: var(--blau); }
.zeile strong.rot, .kachel strong.rot { color: var(--rot); }
.klein-wert { font-size: 15px; }
.mitte-form { text-align: center; margin-top: 4px; }
.fuss.oben { margin-top: 12px; }

.waehlen { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.waehlen input {
  font: 400 34px/1.2 var(--display); letter-spacing: 0.02em; text-align: center; font-variant-numeric: tabular-nums;
  border: 0; border-radius: 14px; padding: 18px 16px; background: var(--zelle); color: var(--text); box-shadow: var(--schatten); width: 100%;
}
.waehlen input::placeholder { color: var(--text-3); font-size: 24px; }
.waehlen input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blau) 35%, transparent); }
.gross-knopf { height: 56px; border-radius: 16px; font-size: 19px; }
.gross-knopf svg, .rund-knopf svg { width: 22px; height: 22px; }

.anrufe .zeile { padding-right: 10px; }
.rueckruf { margin: 0; }
.rund-knopf {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  display: grid; place-items: center; background: color-mix(in srgb, var(--blau) 12%, transparent); color: var(--blau);
}
.rund-knopf:active { filter: brightness(.85); }

/* Anruf-Hinweis oben, wie eine iOS-Mitteilung */
.anruf {
  position: fixed; z-index: 40; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100% - 20px)); display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 22px;
  background: color-mix(in srgb, var(--zelle) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18), 0 0 0 0.5px var(--linie);
  animation: herein .35s cubic-bezier(.2, .9, .3, 1.2);
}
.anruf[hidden] { display: none; }
.anruf-symbol { width: 40px; height: 40px; border-radius: 10px; background: var(--gruen); color: #fff; display: grid; place-items: center; flex: none; }
.anruf-symbol svg { width: 24px; height: 24px; }
.anruf.spricht .anruf-symbol { background: var(--blau); }
.anruf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.anruf-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anruf-text small { color: var(--text-2); font-size: 15px; }
.anruf-zu { border: 0; background: var(--fuell); color: var(--text-2); width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; flex: none; }
@keyframes herein { from { transform: translate(-50%, -120%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
