/* TellerPilot – Webseite. Gestaltung wie in der App.
   ALLE Farben, Rundungen, Rahmen und Schatten kommen als CSS-Variablen aus
   /shared/themes.json (= Export der App-Designs, siehe js/theme.js).
   Hier stehen nur Layout und Formen, keine festen Theme-Farben. */

@font-face { font-family: 'Roboto'; src: url('/fonts/Roboto-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('/fonts/Roboto-Medium.ttf') format('truetype'); font-weight: 500 600; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('/fonts/Roboto-Bold.ttf') format('truetype'); font-weight: 700 900; font-display: swap; }

:root {
  /* Rückfall = Design „TellerPilot“, falls themes.json nicht lädt */
  --bg: #262A31; --surface: #2F333A; --surface-raised: #393E46; --outline: #464C55;
  --primary: #E8B84A; --on-primary: #2A1E00; --primary-container: #4A3D1C;
  --secondary: #7FB0EA; --accent: #F1E3C2; --success: #5BD18B; --danger: #FF6B6B;
  --warning: #FF9A5C; --on-warning: #2B1300; --text: #EEF0F3; --text-muted: #A6AFBB;
  --r-s: 8px; --r-m: 16px; --r-l: 22px; --r-sheet: 24px;
  --border-w: 1px; --card-border: var(--outline); --card-shadow: none;
  --heading-weight: 700; --heading-ls: -0.3px; --font-scale: 1; --space: 1; --control-h: 56px;
  --primary-text: #E8B84A; --success-text: #5BD18B; --danger-text: #FF6B6B; --danger-bg: #C62828;
  --g1a: #3B6FB0; --g1b: #203D61;
  color-scheme: dark;
  --maxw: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: calc(16px * var(--font-scale)); line-height: 1.55;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; display: block; }
/* Symbole aus /img/icons.svg (Strichstil, Farbe = Textfarbe) */
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--secondary); text-underline-offset: 3px; }
a:hover { color: var(--primary-text); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: var(--r-s); z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3, h4 { font-weight: var(--heading-weight); letter-spacing: var(--heading-ls); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.35rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.caption { font-size: .78rem; color: var(--text-muted); }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .82rem; word-break: break-all; }

.wrap { width: min(var(--maxw), 100% - 40px); margin-inline: auto; }
section { padding: calc(72px * var(--space)) 0; }
.section-head { max-width: 720px; margin-bottom: calc(32px * var(--space)); }
.eyebrow { color: var(--accent); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; display: block; }

/* ------------------------------------------------------------ Kopfleiste */
.topbar {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: var(--border-w) solid var(--outline);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.3px; }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--text-muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); background: var(--surface-raised); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: var(--border-w) solid var(--outline); background: var(--surface-raised); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn svg { width: 22px; height: 22px; }

/* Unten wie in der App: vier Bereiche (nur Handy) */
.bottomnav { display: none; }
@media (max-width: 820px) {
  .nav { display: none; }
  .topbar .wrap { height: 56px; }
  .theme-btn { margin-left: auto; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: var(--border-w) solid var(--outline); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a { display: grid; justify-items: center; gap: 2px; color: var(--text-muted); text-decoration: none; font-size: .72rem; font-weight: 500; padding: 4px 0; }
  .bottomnav a span.pill { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; }
  .bottomnav a[aria-current="true"] { color: var(--text); }
  .bottomnav a[aria-current="true"] span.pill { background: var(--primary-container); color: var(--primary); }
  .bottomnav svg { width: 22px; height: 22px; }
  body { padding-bottom: 76px; }
  section { padding: calc(52px * var(--space)) 0; }
  .wrap { width: min(var(--maxw), 100% - 32px); }
}

/* ------------------------------------------------------------- Bausteine */
.card {
  background: var(--surface); border: var(--border-w) solid var(--card-border); border-radius: var(--r-l);
  box-shadow: var(--card-shadow); padding: calc(22px * var(--space));
}
.card.raised { background: var(--surface-raised); }
.grid { display: grid; gap: calc(18px * var(--space)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--control-h);
  padding: 0 26px; border-radius: var(--r-m); border: var(--border-w) solid transparent; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 22px; height: 22px; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.07); color: var(--on-primary); }
.btn.tonal { background: var(--primary-container); color: var(--text); }
.btn.outline { background: transparent; color: var(--text); border-color: var(--outline); }
.btn.outline:hover { border-color: var(--primary); color: var(--text); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: .9rem; border-radius: var(--r-s); }
.btn.danger { background: var(--danger-bg); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-raised); color: var(--text); border: var(--border-w) solid var(--outline);
}
.chip.primary { background: var(--primary-container); border-color: transparent; }
.chip.success { color: var(--success-text); }
.chip.warn { background: var(--warning); color: var(--on-warning); border-color: transparent; }
.chip.danger { color: var(--danger-text); }
.chip svg { width: 16px; height: 16px; }

.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--surface-raised);
  border-left: 4px solid var(--secondary); font-size: .94rem;
}
.note.warn { border-left-color: var(--warning); }
.note.danger { border-left-color: var(--danger); }
.note.ok { border-left-color: var(--success); }
.note svg { flex: none; width: 22px; height: 22px; color: var(--secondary); margin-top: 1px; }
.note.warn svg { color: var(--warning); }
.note p:last-child { margin: 0; }

/* Gerichtsbild-Fläche wie in der App: Farbverlauf + Symbol */
.dish { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-m); color: #fff; flex: none;
  background: linear-gradient(135deg, var(--ga, var(--g1a)), var(--gb, var(--g1b))); }
.dish svg { width: 28px; height: 28px; }

/* ------------------------------------------------------------------ Hero */
.hero { padding-top: calc(56px * var(--space)); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 .accent { color: var(--primary-text); }
.hero .lead { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; }
.hero .badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 26px; }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 480px; }
.hero-visual .halo { position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 30%, transparent), transparent 68%); }
.hero-visual .mascot { position: absolute; width: 150px; left: 0; bottom: 18px; border-radius: 50%;
  box-shadow: 0 12px 30px rgba(0,0,0,.35); border: 4px solid var(--surface); }
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-visual { min-height: 400px; }
  .hero-visual .mascot { width: 110px; left: 4%; }
}

/* Handy-Rahmen für echte Screenshots */
.phone {
  position: relative; width: 250px; aspect-ratio: 9 / 19.5; border-radius: 36px; padding: 9px; background: #0d0f12;
  box-shadow: 0 30px 60px rgba(0,0,0,.35), 0 0 0 2px color-mix(in srgb, var(--outline) 80%, #000);
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 28px; background: var(--surface); }
.phone.big { width: 280px; }

/* ----------------------------------------------------------- Schritte */
.steps { counter-reset: step; }
.step { position: relative; }
.step .num { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 800; margin-bottom: 14px; }
.feature { display: flex; flex-direction: column; gap: 12px; }
.feature .head { display: flex; align-items: center; gap: 14px; }
.feature h3 { margin: 0; }
.feature ul { margin: 0; padding-left: 1.1em; color: var(--text-muted); font-size: .95rem; }
.feature li { margin: 3px 0; }

/* -------------------------------------------------------- Screenshots */
/* Festes Raster: Desktop 3 × 2, Handy 2 Spalten. Anklicken öffnet die große Ansicht. */
.shots {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(36px * var(--space)) calc(28px * var(--space));
  max-width: 900px; margin-inline: auto;
}
.shots figure { margin: 0; display: grid; gap: 12px; justify-items: center; align-content: start; }
.shots figcaption { font-size: .9rem; color: var(--text-muted); text-align: center; max-width: 240px; }
.shot-link { display: block; width: min(100%, 250px); border-radius: 36px; cursor: zoom-in; transition: transform .15s ease; }
.shot-link:hover { transform: translateY(-4px); }
.shot-link:focus-visible { outline-offset: 4px; border-radius: 36px; }
.shots .phone { width: 100%; }
@media (max-width: 600px) {
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .shots .phone { border-radius: 24px; padding: 6px; }
  .shots .phone img { border-radius: 19px; }
  .shot-link, .shot-link:focus-visible { border-radius: 24px; }
  .shots figcaption { font-size: .82rem; }
}
/* Große Ansicht */
dialog.zoom { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.zoom::backdrop { background: rgba(0, 0, 0, .86); }
dialog.zoom .zoom-body { height: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px; }
dialog.zoom figure { margin: 0; display: grid; gap: 10px; justify-items: center; min-height: 0; }
dialog.zoom img { max-height: calc(100vh - 110px); max-width: 100%; width: auto; height: auto; border-radius: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.5); background: var(--surface); }
dialog.zoom figcaption { color: #fff; font-weight: 600; text-align: center; }
dialog.zoom .count { color: rgba(255,255,255,.7); font-weight: 400; margin-left: 8px; }
dialog.zoom .zoom-close { position: absolute; top: 14px; right: 14px; }
@media (max-width: 600px) {
  dialog.zoom .zoom-body { grid-template-columns: 1fr; padding: 56px 10px 70px; }
  dialog.zoom .zoom-nav { position: absolute; bottom: 14px; }
  dialog.zoom .zoom-nav.prev { left: calc(50% - 56px); }
  dialog.zoom .zoom-nav.next { right: calc(50% - 56px); }
  dialog.zoom img { max-height: calc(100vh - 170px); }
}

/* ------------------------------------------------------- Designauswahl */
.theme-group h3 { display: flex; align-items: center; gap: 10px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.theme-tile {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 8px; padding: 10px; border-radius: var(--r-m);
  background: var(--surface); border: 2px solid var(--outline); transition: border-color .15s, transform .1s;
}
.theme-tile:hover { transform: translateY(-2px); border-color: var(--text-muted); }
.theme-tile:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.theme-tile[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.theme-tile .name { font-weight: 700; font-size: .92rem; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-tile .desc { font-size: .75rem; color: var(--text-muted); line-height: 1.3; }
.theme-tile .check { width: 20px; height: 20px; color: var(--primary); visibility: hidden; }
.theme-tile[aria-checked="true"] .check { visibility: visible; }
/* Mini-Bildschirm: nutzt die Farben des JEWEILIGEN Designs (per Inline-Variablen) */
.mini { height: 112px; border-radius: 10px; padding: 9px; display: grid; grid-template-rows: auto 1fr auto; gap: 6px; background: var(--t-bg); border: 1px solid var(--t-outline); overflow: hidden; }
.mini .m-card { background: var(--t-surface); border-radius: var(--t-r); border: 1px solid var(--t-card-border); padding: 7px; display: grid; gap: 5px; box-shadow: var(--t-shadow); }
.mini .m-line { height: 5px; border-radius: 3px; background: var(--t-text); opacity: .85; width: 70%; }
.mini .m-line.s { width: 45%; background: var(--t-muted); opacity: .9; }
.mini .m-accent { height: 5px; border-radius: 3px; background: var(--t-accent); width: 35%; }
.mini .m-btn { height: 14px; border-radius: calc(var(--t-r) * .7); background: var(--t-primary); }
.mini .m-nav { display: flex; justify-content: space-around; background: var(--t-surface); border-radius: 6px; padding: 4px; }
.mini .m-nav i { width: 14px; height: 6px; border-radius: 3px; background: var(--t-muted); opacity: .7; }
.mini .m-nav i:first-child { background: var(--t-primary); opacity: 1; }

/* Blatt (Sheet) für die Designauswahl */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); display: none; }
.sheet-backdrop.open { display: block; }
.sheet {
  position: fixed; z-index: 61; left: 50%; bottom: 0; transform: translate(-50%, 105%); width: min(860px, 100%);
  max-height: 88vh; overflow: auto; background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  border: var(--border-w) solid var(--outline); padding: 10px 22px 28px; transition: transform .25s ease;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--outline); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

/* ----------------------------------------------------------- Download */
.download-card { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.download-card .logo { width: 96px; height: 96px; border-radius: 24px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; margin: 14px 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
@media (max-width: 600px) { .download-card { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 26px 10px; }
.empty img { width: 110px; height: 110px; border-radius: 50%; }

/* ---------------------------------------------------------- Changelog */
.timeline { display: grid; gap: 14px; }
.release { display: grid; grid-template-columns: 120px 1fr; gap: 18px; }
.release .when { color: var(--text-muted); font-size: .9rem; }
.release .ver { font-weight: 800; font-size: 1.25rem; color: var(--text); }
.release ul { margin: 6px 0 0; padding-left: 1.1em; }
@media (max-width: 600px) { .release { grid-template-columns: 1fr; gap: 4px; } }

/* -------------------------------------------------------------- Formulare */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .8rem; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-raised); border: var(--border-w) solid var(--outline);
  border-radius: var(--r-s); padding: 13px 14px; min-height: 48px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: grid; justify-items: center; gap: 4px; text-align: center; padding: 12px 8px; border-radius: var(--r-m); cursor: pointer;
  background: var(--surface-raised); border: 2px solid var(--outline); font-size: .9rem;
}
.segmented label svg { width: 24px; height: 24px; color: var(--secondary); }
.segmented input:checked + label { border-color: var(--primary); background: var(--primary-container); }
.segmented input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { min-height: 1.4em; font-weight: 600; }
.form-msg.ok { color: var(--success-text); }
.form-msg.err { color: var(--danger-text); }

/* ---------------------------------------------------------------- Fußzeile */
footer { border-top: var(--border-w) solid var(--outline); background: var(--surface); padding: 34px 0 40px; font-size: .9rem; color: var(--text-muted); }
footer .wrap { display: grid; gap: 14px; }
footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
footer a { color: var(--text); }

/* Rechtstexte */
.legal { max-width: 820px; }
.legal h2 { font-size: 1.25rem; margin-top: 1.6em; }
.legal p { white-space: pre-line; }
.ph { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--text); border-bottom: 2px dashed var(--warning); padding: 0 3px; border-radius: 3px; }

/* Werkzeug: sichtbar nur für Screenreader-Hinweise in Listen */
.stack { display: grid; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hidden, [hidden] { display: none !important; }
.m0 { margin: 0; }
.mt1 { margin-top: 8px; }
.mt2 { margin-top: 16px; }
.mt3 { margin-top: 28px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
