/* Gemeinsame Gestaltung der internen LUNA-Tools (Vorlage: luna-standards/assets/intern.css).
   Werte 1:1 aus dem Reservierungs-Tool (Grundton „Neutral“, Akzent „Standard“, gemessen 21.10.2026), ohne Glas-Effekte
   (globale Regel). Gehört zu gemeinsam-intern.js; Aufbau und Regeln je Baustein: references/bausteine.md.
   Nur Variablen und color-mix, keine festen Farben in Bausteinen. Dunkel doppelt: prefers-color-scheme ohne
   data-theme="light" UND data-theme="dark" (Umschalter pro Gerät, gesetzt vor dem ersten Zeichnen aus einer Datei). */

:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --ink: #1f1d1a;
  --muted: #6b6b70;          /* 4,8 : 1 auf --bg */
  --line: #e4e4e7;
  --accent: #0a6ad8;         /* Links, Auswahl, Fokus: 5,2 : 1 auf Weiß */
  --accent-fill: #0a6ad8;    /* Fläche hinter weißer Schrift */
  --accent-ink: #ffffff;
  --ok: #2f7a4b; --ok-text: #2a6e43;
  --warn: #b7791f; --warn-text: #8a5a12; --warn-deep: #8f5f16;
  --bad: #b42318; --bad-text: #b42318;
  --info: #2563eb; --info-text: #1f58d8;
  --radius: 14px; --btn-r: 10px;
  --shadow-sm: 0 1px 2px rgba(28, 22, 12, 0.06);
  --shadow: 0 1px 2px rgba(28, 22, 12, 0.04), 0 8px 24px -8px rgba(28, 22, 12, 0.1);
  --dp: 24px;                /* Innenabstand der Fenster */
  --seg-an: var(--panel);    /* gewähltes Segment (dunkel heller, sonst kaum zu sehen) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #141416; --panel: #1e1e21; --ink: #ece8e1; --muted: #a1a1aa; --line: #333338;
    --accent: #4aa3ff; --accent-fill: #0a6ad8; --seg-an: color-mix(in srgb, var(--ink) 24%, var(--panel));
    --ok-text: #5fb97f; --warn-text: #e0a640; --bad: #d4443a; --bad-text: #f0786a; --info: #60a5fa; --info-text: #7fb2ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #141416; --panel: #1e1e21; --ink: #ece8e1; --muted: #a1a1aa; --line: #333338;
  --accent: #4aa3ff; --accent-fill: #0a6ad8; --seg-an: color-mix(in srgb, var(--ink) 24%, var(--panel));
  --ok-text: #5fb97f; --warn-text: #e0a640; --bad: #d4443a; --bad-text: #f0786a; --info: #60a5fa; --info-text: #7fb2ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --dp: 18px; } }

/* ---------- Grundlage ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
h1 { font-size: 18px; } h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); font-size: 13px; }
a { color: var(--accent); }
.zahl, table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { animation: none !important; transition: none !important; } }

/* ---------- Karte ---------- */
.karte { background: var(--panel); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
@media (max-width: 640px) { .karte { padding: 14px 10px; } }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 15px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, var(--ink)); border-radius: var(--btn-r);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 500; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}
.btn:active { transform: scale(0.96); }
@media (hover: hover) { .btn:hover { background: color-mix(in srgb, var(--ink) 9%, var(--panel)); border-color: color-mix(in srgb, var(--ink) 22%, transparent); } }
.btn-haupt { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
@media (hover: hover) { .btn-haupt:hover { background: color-mix(in srgb, var(--accent-fill) 90%, #fff); border-color: var(--accent-fill); } }
.btn-rot { color: var(--bad-text); }                                        /* Abmelden u. Ä. */
.btn-gefahr { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: transparent; color: var(--bad-text); font-weight: 600; box-shadow: none; }
.btn-klein { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled, .btn[aria-disabled='true'] { color: var(--muted); background: color-mix(in srgb, var(--ink) 6%, var(--panel));
  border-color: var(--line); box-shadow: none; cursor: wait; }        /* über die Farbe, nie über Deckkraft */
.icon-btn { width: 38px; height: 38px; min-height: 0; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .icon-btn { width: 36px; height: 36px; } }

/* ---------- Felder ---------- */
input:not([type='checkbox'], [type='radio'], [type='file'], [type='color'], [type='range']), select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--line) 85%, var(--ink));
  border-radius: var(--btn-r); background: var(--panel); color: var(--ink); font: inherit; font-size: 16px;   /* 16 px: kein Zoom am iPhone */
}
@media (min-width: 901px) and (pointer: fine) {
  input:not([type='checkbox'], [type='radio'], [type='file'], [type='color'], [type='range']), select, textarea { font-size: 15px; }
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }
::placeholder { color: var(--muted); }
.feld { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 4px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.feld > input, .feld > select, .feld > textarea { flex: 1 0 100%; }   /* Name, „*“ und „(optional)“ in einer Zeile, das Feld darunter */
.feld .zusatz { font-weight: 400; }
.feld .zusatz::before { content: '('; } .feld .zusatz::after { content: ')'; }
.pflicht { color: var(--muted); }
/* Fehlerfeld (alle LUNA-Formulare): 1 px Rand + 2 px innen in Rot, kein zweiter Ring, darunter „!“ und was fehlt */
[aria-invalid='true'], [aria-invalid='true']:focus { border: 1px solid var(--bad) !important; box-shadow: inset 0 0 0 2px var(--bad) !important; }
.fehlertext { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0; color: var(--bad-text); font-size: 13px; font-weight: 500; scroll-margin: 16px 0 96px; }
.fehlertext::before { content: '!'; flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bad); color: var(--panel); font-size: 11px; font-weight: 700; line-height: 1; }
.fehlertext:empty, .fehlertext[hidden] { display: none; }

/* Schalter (46 × 28, Knopf 22) – aus: muted 70 % (3,2 : 1 hell, 4,3 : 1 dunkel), an: --ok */
input.schalter { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0;
  border-radius: 99px; background: color-mix(in srgb, var(--muted) 70%, var(--line)); cursor: pointer; transition: background 0.2s; }
input.schalter::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1); }
input.schalter:checked { background: var(--ok); }
input.schalter:checked::after { transform: translateX(18px); }

/* Segment-Umschalter (iOS) mit aria-pressed */
.segment { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.segment button { border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.segment button[aria-pressed='true'] { background: var(--seg-an); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.05); }

/* ---------- Einstellungen als Zeilen ---------- */
.f-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding: 14px 0; border-top: 1px solid var(--line); }
h2 + .f-row, .f-row:first-child { border-top: 0; }
.set-text { display: flex; flex: 1 1 0; flex-direction: column; gap: 2px; min-width: 0; }
.set-text b { font-size: 15px; font-weight: 600; }
.set-text small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.set-text em.scope { font-family: inherit; font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.f-row > input:not(.schalter), .f-row > select { flex: 0 0 min(340px, 46%); width: auto; }
.f-ctl { display: flex; flex: 0 0 min(400px, 52%); gap: 8px; }
.f-row.stack { flex-direction: column; align-items: stretch; }
.f-row.stack .f-ctl { flex: none; width: 100%; flex-wrap: wrap; }
@media (max-width: 640px) { .f-row:not(.sw) { flex-direction: column; align-items: stretch; } .f-row > input:not(.schalter), .f-row > select, .f-ctl { flex: none; width: 100%; } }

/* Speicherleiste (erscheint nur bei echten Änderungen; ohne Änderungen inert, damit Tab sie nicht erreicht) */
.speicherleiste { position: fixed; left: 50%; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px;
  transform: translate(-50%, 140%); border: 1px solid color-mix(in srgb, var(--line) 85%, transparent); border-radius: 18px; background: var(--panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1); transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.05); }
.speicherleiste.sichtbar { transform: translate(-50%, 0); }
.speicherleiste .zahl::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }

/* ---------- Fenster: Computer mittig, Handy Blatt von unten mit Griff ---------- */
dialog { max-width: calc(100vw - 32px); width: min(600px, calc(100vw - 32px)); max-height: min(88dvh, 880px); padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 22px; background: var(--panel); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px color-mix(in srgb, #fff 4%, transparent) inset; overscroll-behavior: contain; }
dialog:focus { outline: none; }                                  /* Fokus liegt beim Öffnen auf dem Fenster, ohne Rahmen */
dialog::backdrop { background: rgba(10, 8, 6, 0.45); }
dialog[open] { animation: fenster-ein 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.05); }
@keyframes fenster-ein { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.dialog-kopf { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px var(--dp) 12px; background: var(--panel); }
.dialog-kopf h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.dialog-x { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); cursor: pointer; }
.dialog-x svg { width: 18px; height: 18px; }
.dialog-inhalt { padding: 0 var(--dp) var(--dp); }
/* Fuß: links Nebenaktionen, rechts „Abbrechen“ (normaler Knopf) und der Hauptknopf */
.dialog-fuss { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 12px var(--dp) 14px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: var(--panel); }
.dialog-fuss .rechts { display: flex; gap: 8px; margin-left: auto; }
.dialog-fuss .btn { min-width: 100px; }
.loeschen-zeile { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }    /* Löschen: eigener Block ganz unten */
.loeschen-zeile .btn { width: 100%; min-height: 48px; border-radius: 12px; font-size: 16px; }
@media (max-width: 640px) {
  dialog[open] { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 94dvh; border-bottom: 0; border-radius: 24px 24px 0 0;
    animation: blatt-ein 0.36s cubic-bezier(0.22, 1, 0.36, 1); }
  dialog::before { content: ''; display: block; width: 38px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
  .dialog-fuss { display: grid; grid-template-columns: 1fr 1.6fr; padding: 12px var(--dp) calc(14px + env(safe-area-inset-bottom)); }
  .dialog-fuss .rechts { display: contents; }
  .dialog-fuss .btn { min-width: 0; min-height: 48px; font-size: 16px; }
}
@keyframes blatt-ein { from { transform: translateY(100%); } }

/* ---------- Rückfrage-Karte (rueckfrage()): eigenes modales Fenster, mittig, Knöpfe untereinander ---------- */
dialog.rf-wirt, dialog.rf-wirt[open] { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; animation: none; }
dialog.rf-wirt::before { display: none; }
dialog.rf-wirt::backdrop { background: rgba(0, 0, 0, 0.28); }
.rueckfrage { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; }
.rf-karte { width: min(320px, 100%); padding: 22px 18px 16px; border-radius: 20px; text-align: center; background: var(--panel); color: var(--ink);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45), 0 0 0 0.5px color-mix(in srgb, var(--ink) 12%, transparent); animation: fenster-ein 0.26s cubic-bezier(0.2, 1.25, 0.4, 1); }
.rf-karte:focus { outline: none; }
.rf-ic { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%;
  color: var(--warn-text); background: color-mix(in srgb, var(--warn) 15%, transparent); }                 /* Verwerfen: orange */
.rf-ic.gefahr { color: var(--bad-text); background: color-mix(in srgb, var(--bad) 12%, transparent); }    /* Löschen: rot */
.rf-ic svg { width: 22px; height: 22px; }
.rf-karte h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.rf-karte p { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.rf-karte .rf-feld { margin: 0 0 14px; }
.rf-karte .btn { display: flex; width: 100%; height: 44px; margin: 0; border-radius: 12px; font-size: 15px; font-weight: 600; }
.rf-karte .btn + .btn { margin-top: 8px; }
.rf-karte .rf-gefahr { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: transparent; color: var(--bad-text); box-shadow: none; }
.rf-karte .rf-abbrechen { background: none; border-color: transparent; color: var(--muted); box-shadow: none; }

/* ---------- Meldung unten (meldung()): deckend, Aktion in Meldungsfarbe unterstrichen ---------- */
.meldung { position: fixed; inset: auto auto 20px 50%; margin: 0; transform: translate(-50%, 12px); display: flex; align-items: center; gap: 14px;
  width: max-content; max-width: calc(100vw - 32px); padding: 11px 16px; border: 0; border-radius: 14px; background: var(--ink); color: var(--bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; overflow: visible;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.meldung.sichtbar { opacity: 1; transform: translate(-50%, 0); }
.meldung button { border: 0; background: none; color: var(--bg); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.meldung.sichtbar button { pointer-events: auto; }
.meldung button:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; border-radius: 6px; }

/* ---------- Listen, Abzeichen, leerer Zustand ---------- */
.pill { display: inline-block; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 1.45; white-space: nowrap;
  color: var(--muted); background: color-mix(in srgb, currentColor 12%, transparent); }
.pill::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.pill.ok { color: var(--ok-text); } .pill.hinweis { color: var(--warn-text); } .pill.info { color: var(--info-text); } .pill.fehler { color: var(--bad-text); }
.leer { padding: 28px 12px; text-align: center; }
.leer .symbol { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); }
.leer b { display: block; font-size: 16px; margin-bottom: 6px; }
.leer p { margin: 0; color: var(--muted); font-size: 14px; }
