/* FIX.T Mitarbeiter - Designsystem "Glas".
 *
 * Apple-nahe Sprache: Systemschrift, ruhige Flächen, durchscheinende Materialien. Der Glas-Effekt ist eine Web-Annäherung
 * (backdrop-filter + Kantenlicht), kein offizielles Apple-Liquid-Glass. Eine Akzentfarbe (Blau), Grün/Gelb/Rot nur für Zustände.
 * Ein Radius-System: Flächen 22px, Bedienelemente 12px, Kapseln voll rund.
 * Themes: [data-theme="dark"] (Standard ohne JavaScript) und [data-theme="light"]; welches gilt, entscheidet design.js
 * (Automatisch nach Sonnenauf-/untergang, oder von Hand).
 */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg-elevated: #14171e;           /* undurchsichtiger Ersatz für Glas (Dialoge ohne Blur, Eingaben) */
  --glass: rgba(255,255,255,.065);
  --card: rgba(23,27,37,.86);
  --glass-strong: rgba(22,26,36,.8);
  --segment-aktiv: rgba(255,255,255,.17);
  --glass-border: rgba(255,255,255,.11);
  --glass-light: rgba(255,255,255,.14);   /* Kantenlicht oben */
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.16);
  --fill: rgba(255,255,255,.07);
  --fill-hover: rgba(255,255,255,.11);
  --text: #f3f5f9;
  --text-dim: #b4bac6;
  --text-faint: #8b93a1;
  --accent: #0a84ff;
  --accent-hover: #3a9bff;
  --accent-2: #0a84ff;
  --accent-text: #66b3ff;
  --accent-soft: rgba(10,132,255,.18);
  --accent-grad: linear-gradient(180deg, #2b95ff 0%, #0a84ff 100%);
  --on-accent: #ffffff;
  --ok: #34d27b;
  --ok-soft: rgba(52,210,123,.16);
  --warn: #ffb02e;
  --warn-soft: rgba(255,176,46,.16);
  --danger: #ff5a52;
  --danger-soft: rgba(255,90,82,.16);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 1px 1px rgba(0,0,0,.25), 0 14px 32px -16px rgba(0,0,0,.65);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 32px 64px -24px rgba(0,0,0,.75);
  --aurora-1: rgba(10,132,255,.24);
  --aurora-2: rgba(48,209,200,.15);
  --aurora-3: rgba(94,92,230,.17);
  --scrollbar: rgba(255,255,255,.14);
  --scrim: rgba(4,6,10,.5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f6;
  --bg-elevated: #ffffff;
  --glass: rgba(255,255,255,.62);
  --card: rgba(255,255,255,.9);
  --glass-strong: rgba(255,255,255,.84);
  --segment-aktiv: #ffffff;
  --glass-border: rgba(255,255,255,.85);
  --glass-light: rgba(255,255,255,.95);
  --border: rgba(15,23,42,.08);
  --border-strong: rgba(15,23,42,.15);
  --fill: rgba(15,23,42,.055);
  --fill-hover: rgba(15,23,42,.09);
  --text: #131820;
  --text-dim: #4e5867;
  --text-faint: #6a7484;
  --accent: #0071e3;
  --accent-hover: #0a84ff;
  --accent-2: #0071e3;
  --accent-text: #0062c4;
  --accent-soft: rgba(0,113,227,.12);
  --accent-grad: linear-gradient(180deg, #1a86f0 0%, #0071e3 100%);
  --on-accent: #ffffff;
  --ok: #178a4c;
  --ok-soft: rgba(23,138,76,.13);
  --warn: #915400;
  --warn-soft: rgba(184,106,0,.15);
  --danger: #d4291f;
  --danger-soft: rgba(212,41,31,.11);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.08);
  --shadow-md: 0 1px 1px rgba(15,23,42,.05), 0 14px 32px -18px rgba(30,50,90,.28);
  --shadow-lg: 0 2px 6px rgba(15,23,42,.08), 0 32px 64px -28px rgba(30,50,90,.38);
  --aurora-1: rgba(0,113,227,.2);
  --aurora-2: rgba(48,209,200,.2);
  --aurora-3: rgba(120,110,240,.15);
  --scrollbar: rgba(15,23,42,.18);
  --scrim: rgba(20,30,50,.32);
}

:root {
  --radius: 22px;
  --radius-sm: 12px;
  --blur: 26px;
  --blur-karte: 18px;
  --ease: cubic-bezier(.23, 1, .32, 1);        /* kräftiges ease-out für Einblendungen */
  --ease-bewegung: cubic-bezier(.77, 0, .175, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-size: 15px; line-height: 1.45; letter-spacing: -.011em;
  font-family: var(--font); font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  background: var(--bg); color: var(--text);
  transition: background-color .3s ease, color .3s ease;
}
/* Hintergrundlicht: ruhige, verwandte Farben (Blau, Türkis, Indigo), fest hinter allem */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(62vmax 46vmax at 10% -12%, var(--aurora-1), transparent 62%),
    radial-gradient(52vmax 40vmax at 104% 6%, var(--aurora-2), transparent 58%),
    radial-gradient(64vmax 52vmax at 72% 112%, var(--aurora-3), transparent 62%);
}
h2 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -.024em; line-height: 1.15; }
h3 { margin: 0 0 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
[hidden] { display: none !important; }

/* Glas: gemeinsames Material für alle schwebenden Flächen */
#topbar, #seitenleiste, dialog, #mobil-leiste, .mobil-mehr-blatt, #einsatz-banner {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-light), var(--shadow-md);
}
#topbar, #seitenleiste, #mobil-leiste, .mobil-mehr-blatt, dialog { background: var(--glass-strong); }
/* Inhaltskarten: fast deckend (Lesbarkeit), nur ein Hauch Tiefe vom Hintergrundlicht */
.karte, .kpi-karte, .liste, .kal-termin, .nachricht.assistant {
  background-color: var(--card);
  -webkit-backdrop-filter: blur(var(--blur-karte)) saturate(150%);
  backdrop-filter: blur(var(--blur-karte)) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-light), var(--shadow-md);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #topbar, #seitenleiste, .karte, .kpi-karte, .liste, .kal-termin, dialog, #mobil-leiste, .mobil-mehr-blatt, .nachricht.assistant, #einsatz-banner { background: var(--bg-elevated); }
}
@media (prefers-reduced-transparency: reduce) {
  #topbar, #seitenleiste, .karte, .kpi-karte, .liste, .kal-termin, dialog, #mobil-leiste, .mobil-mehr-blatt, .nachricht.assistant, #einsatz-banner {
    background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 10px 12px 0; gap: 10px; }

#topbar {
  position: relative; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 10px 16px; border-radius: 20px; overflow: hidden;
}
#top-budget-leiste { position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--border); overflow: hidden; border-radius: 2px; }
#top-budget-leiste-fuellung { display: block; height: 100%; width: 0%; background: var(--ok); transition: width .5s var(--ease), background-color .3s ease; }
#brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.015em; }
#brand-logo {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #3aa0ff 0%, #0a84ff 45%, #30d1c8 140%); color: #fff; font-size: 11.5px; font-weight: 800; letter-spacing: -.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 14px -6px rgba(10,132,255,.7);
}
#brand .dim { color: var(--text-dim); font-weight: 500; margin-left: 2px; }
#top-status { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#top-budget-mini { color: var(--text-dim); font-variant-numeric: tabular-nums; }

#shell { flex: 1 1 auto; display: flex; min-height: 0; overflow: hidden; gap: 10px; }
#seitenleiste {
  flex: 0 0 auto; width: 212px; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
  border-radius: var(--radius); margin-bottom: 12px;
}
#seitenleiste a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none;
  color: var(--text-dim); font-size: 14px; font-weight: 500; position: relative;
  transition: background-color .16s ease, color .16s ease;
}
#seitenleiste a svg { flex: 0 0 auto; opacity: .8; }
#seitenleiste a.aktiv { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
#seitenleiste a.aktiv svg { opacity: 1; }

#inhalt { flex: 1 1 auto; overflow-y: auto; padding: 18px 18px 48px; border-radius: var(--radius); }
#inhalt.inhalt-chat { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 14px; }
.ansicht { display: none; max-width: 1000px; margin: 0 auto; }
.ansicht.aktiv { display: block; animation: einblenden .26s var(--ease); }
#inhalt.inhalt-chat #view-chat.aktiv { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-width: 760px; width: 100%; }
@keyframes einblenden { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.ansicht-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.neben { color: var(--text-dim); font-size: 13px; }
.hinweis { color: var(--text-faint); font-size: 13px; line-height: 1.5; margin-top: 10px; }
.zeile-spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.leer-hinweis { color: var(--text-faint); padding: 40px 20px; text-align: center; font-size: 13.5px; }

.karte { border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; transition: box-shadow .2s ease, border-color .2s ease; }

/* Buttons: gefüllt (Hauptaktion), getönt (Aktion in Zeilen, "klein"), neutral ("sekundaer"), destruktiv (rot getönt). Kein Leuchten. */
button {
  padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent); cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit; letter-spacing: -.011em; box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .16s var(--ease), filter .16s ease, background-color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(.97); filter: brightness(.95); }
button.klein { padding: 6px 14px; font-size: 13px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
button.sekundaer { background: var(--fill); border-color: transparent; color: var(--text); box-shadow: none; }
button.gefahr { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
button:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  button:hover { filter: brightness(1.07); }
  button.klein:hover { filter: none; background: color-mix(in srgb, var(--accent) 24%, transparent); }
  button.sekundaer:hover { background: var(--fill-hover); filter: none; }
  button.gefahr:hover { filter: none; background: color-mix(in srgb, var(--danger) 24%, transparent); }
  #seitenleiste a:hover { background: var(--fill); color: var(--text); }
  .kpi-karte:hover { transform: translateY(-2px); }
  .liste-zeile:hover { background: var(--fill); }
}

input, textarea, select {
  padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--fill); color: var(--text); font-size: 14px; font-family: inherit; letter-spacing: -.011em;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
textarea { resize: vertical; }

.badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }
.badge.test, .badge.warnung { background: var(--warn-soft); color: var(--warn); }
.badge.echt, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.gedrosselt { background: var(--danger-soft); color: var(--danger); }

.fortschritt { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; margin-top: 12px; }
.fortschritt-fuellung { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .5s var(--ease), background-color .3s ease; }

/* Übersicht */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-karte { border-radius: var(--radius); padding: 18px 20px; transition: transform .22s var(--ease), box-shadow .2s ease; }
.kpi-karte.ok { background-image: linear-gradient(180deg, var(--ok-soft), transparent 75%); }
.kpi-karte.warnung { background-image: linear-gradient(180deg, var(--warn-soft), transparent 75%); }
.kpi-karte.gedrosselt, .kpi-karte.danger { background-image: linear-gradient(180deg, var(--danger-soft), transparent 75%); }
.kpi-karte.accent { background-image: linear-gradient(180deg, var(--accent-soft), transparent 75%); }
.kpi-label { color: var(--text-dim); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-wert { font-size: 28px; font-weight: 700; letter-spacing: -.026em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--text-faint); font-size: 13px; margin-top: 5px; }
.kpi-sub.warnung { color: var(--warn); }
.kpi-sub.danger { color: var(--danger); }
.kpi-sub.ok { color: var(--ok); }

.umsatz-chart { display: flex; align-items: flex-end; gap: 14px; height: 156px; padding: 10px 4px 0; }
.umsatz-balken-wrap { flex: 1 1 auto; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.umsatz-balken-betrag { font-size: 11px; color: var(--text-dim); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.umsatz-balken { width: 100%; max-width: 42px; border-radius: 10px 10px 5px 5px; background: linear-gradient(180deg, #4aa8ff 0%, #0a84ff 60%, #30b8c8 130%); min-height: 3px; transition: height .5s var(--ease); }
.umsatz-balken.jetzt { background: linear-gradient(180deg, #5ee59b 0%, #30d27b 100%); }
.umsatz-balken-monat { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.uebersicht-abschnitt { margin-top: 26px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.uebersicht-abschnitt h3 { margin: 0; }
.mini-liste-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* Treffer der Gerätesuche über der Kundenliste */
#geraete-treffer .karte { margin-bottom: 14px; }

/* Chat */
#chat-verlauf { flex: 1 1 auto; overflow-y: auto; padding: 8px 4px 18px; display: flex; flex-direction: column; }
#chat-formular { flex: 0 0 auto; display: flex; gap: 9px; padding-top: 14px; border-top: 1px solid var(--border); }
#chat-eingabe { flex: 1; }
.nachricht { margin-bottom: 11px; max-width: 80%; padding: 11px 16px; border-radius: 20px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; animation: einblenden .24s var(--ease); }
.nachricht.user { background: var(--accent-grad); color: var(--on-accent); margin-left: auto; border-bottom-right-radius: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.nachricht.assistant { border-bottom-left-radius: 6px; box-shadow: inset 0 1px 0 var(--glass-light), var(--shadow-sm); }
a.datei { color: var(--accent-text); font-weight: 600; }

/* Kunden-Liste: eingefasste Gruppe wie in iOS */
#kunden-suche { width: 270px; }
.liste { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; }
.liste-zeile { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 18px; text-decoration: none; color: inherit; cursor: pointer; transition: background-color .15s ease; }
.liste-zeile + .liste-zeile { border-top: 1px solid var(--border); }
.liste-zeile .avatar { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 650; }
.liste-zeile .zeile-text { flex: 1 1 auto; min-width: 0; }
.liste-zeile .haupt { font-weight: 600; }
.liste-zeile .pfeil { color: var(--text-faint); font-size: 20px; line-height: 1; transition: transform .16s var(--ease); }
.kontakt-zeile { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 7px 0; align-items: baseline; }
.kontakt-zeile .leer { color: var(--text-faint); }
@media (hover: hover) and (pointer: fine) { .liste-zeile:hover .pfeil { transform: translateX(3px); } }

/* Kunden-Detail */
.zurueck { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--accent-text); text-decoration: none; font-size: 14px; font-weight: 500; }
.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.formular-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 14px; }
.feld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mini-karte { width: 100%; height: 210px; border: 0; border-radius: var(--radius-sm); display: block; }
.karte-platzhalter { background: var(--fill); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 28px; text-align: center; color: var(--text-dim); font-size: 13px; }
.link-extern { display: inline-flex; align-items: center; gap: 5px; margin-top: 11px; color: var(--accent-text); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.link-extern:hover { text-decoration: underline; }
.unterzeile { padding: 10px 0; border-bottom: 1px solid var(--border); }
.unterzeile:last-child { border-bottom: none; }
.notiz-formular { margin-top: 14px; gap: 8px; }
.notiz-formular input { flex: 1; }

/* Einsatz-Stoppuhr */
#einsatz-banner { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 18px; background-image: linear-gradient(90deg, var(--ok-soft), transparent 70%); }
.einsatz-puls { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: puls 1.8s infinite; flex: 0 0 auto; }
@keyframes puls { 0% { box-shadow: 0 0 0 0 rgba(52,210,123,.55); } 70% { box-shadow: 0 0 0 9px rgba(52,210,123,0); } 100% { box-shadow: 0 0 0 0 rgba(52,210,123,0); } }
.einsatz-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.einsatz-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.einsatz-hinweis { color: var(--warn); font-size: 13px; }
#einsatz-zeit { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Kalender */
.kal-navi { margin-bottom: 6px; }
.kal-heute-zeile { text-align: center; margin-bottom: 14px; }
.kal-tag { margin-top: 18px; }
.kal-tag > h3 { margin-bottom: 8px; }
.kal-tag.heute > h3 { color: var(--accent-text); }
.kal-termin { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px; border-radius: 16px; border-left: 3px solid var(--accent); }
.kal-termin.ganztag { border-left-color: var(--ok); }
.kal-zeit { flex: 0 0 74px; color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; line-height: 1.4; }
.kal-text { flex: 1 1 auto; min-width: 0; }
.kal-text strong { display: block; overflow-wrap: anywhere; }
.kal-feld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.kal-feld label { color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.kal-ganztag label { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14px; }
.kal-ganztag input { width: 20px; height: 20px; min-height: 0; }
.kal-zeiten { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kal-zeiten.versteckt { display: none; }
.kal-zeiten > .kal-feld { min-width: 0; }
.kal-feld input, .kal-feld select { width: 100%; min-width: 0; }
a.kal-kunde, a.kunde-link { color: var(--accent-text); font-weight: 600; text-decoration: none; }
a.kal-kunde:hover, a.kunde-link:hover { text-decoration: underline; }
a.kal-kunde { display: inline-block; margin-top: 6px; font-size: 13px; }
.kunde-termin-zeile { margin-top: 2px; color: var(--accent-text); font-size: 12.5px; font-weight: 600; }

/* Dialoge: schweben als Glasblatt (deckender, damit Eingabefelder lesbar bleiben) über abgedunkeltem, weichgezeichnetem Hintergrund */
dialog { color: var(--text); padding: 22px; width: min(92vw, 500px); max-height: 92vh; overflow-y: auto; border-radius: 26px; box-shadow: inset 0 1px 0 var(--glass-light), var(--shadow-lg); }
dialog[open] { animation: dialog-ein .22s var(--ease); }
@keyframes dialog-ein { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog h2 { margin-bottom: 8px; font-size: 22px; }
#profil-dialog input, #benutzer-dialog input:not([type=checkbox]) { min-width: 0; width: 100%; }
#alt-dialog .kal-zeiten, #geraet-dialog .kal-zeiten, #sammel-dialog .kal-zeiten, #rechnung-dialog .kal-zeiten { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#alt-dialog input, #alt-dialog select, #geraet-dialog input:not([type=radio]), #geraet-dialog select, #geraet-dialog textarea, #sammel-dialog input, #sammel-dialog select, #rechnung-dialog input, #rechnung-dialog select { min-width: 0; width: 100%; }

/* Theme-Schalter (Hell / Dunkel / Automatisch) */
#theme-knopf { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
#top-status > * { white-space: nowrap; }
#theme-knopf svg { width: 18px; height: 18px; }
.theme-wahl { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-sm); background: var(--fill); }
.theme-wahl button { flex: 1; background: transparent; color: var(--text-dim); box-shadow: none; padding: 7px 8px; font-size: 13px; border-radius: 9px; min-height: 0; }
.theme-wahl button.aktiv { background: var(--segment-aktiv); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-theme="light"] .theme-wahl button.aktiv { box-shadow: 0 1px 3px rgba(15,23,42,.14); }

/* Mobile Navigation: schwebende Glasleiste unten + "Mehr"-Blatt (per JS aus #seitenleiste gebaut) */
#mobil-leiste, #mobil-mehr { display: none; }

@media (max-width: 760px) {
  #seitenleiste { display: none; }
  .zwei-spalten { grid-template-columns: 1fr; }
  #app { padding: 8px 8px 0; gap: 8px; }
  #topbar { padding: 8px 10px 8px 12px; border-radius: 18px; }
  #brand .dim { display: none; }
  #top-status { gap: 8px; font-size: 12px; }
  #top-budget-mini { display: none; }
  #inhalt { padding: 12px 6px calc(112px + env(safe-area-inset-bottom)); border-radius: 0; }
  #inhalt.inhalt-chat { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  h2 { font-size: 25px; }
  .ansicht-kopf { flex-wrap: wrap; margin-bottom: 16px; }
  .karte { padding: 16px 17px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-karte { padding: 15px 16px; }
  .kpi-wert { font-size: 23px; }
  .mini-liste-grid { grid-template-columns: 1fr; }
  .umsatz-chart { gap: 6px; }
  .umsatz-balken-betrag { font-size: 9.5px; }

  /* Touch: mindestens 44px Zielgröße; 16px Schrift verhindert den Zoom beim Fokus (iOS) */
  input, textarea, select { font-size: 16px; min-height: 44px; }
  button { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  button.klein { min-height: 40px; padding: 7px 14px; font-size: 14px; }
  #theme-knopf { min-height: 0; width: 40px; height: 40px; padding: 0; }
  #kunden-suche { width: 100%; }
  .liste-zeile { padding: 14px; }
  .karte { margin-bottom: 16px; }
  .unterzeile { padding: 12px 0; }
  .zeile-spread { flex-wrap: wrap; }
  .nachricht { max-width: 92%; font-size: 15px; }
  #chat-formular { padding-top: 10px; }
  .mini-karte { height: 180px; }
  #view-chat > .zeile-spread { justify-content: flex-end; }
  #view-chat > .zeile-spread .neben { display: none; }

  #mobil-leiste {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 30;
    padding: 4px; border-radius: 28px;
  }
  #mobil-leiste a, #mobil-leiste button {
    flex: 1 1 0; min-width: 0; min-height: 54px; padding: 7px 2px 6px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 22px; background: none; box-shadow: none;
    color: var(--text-dim); font-size: 10.5px; font-weight: 600; text-decoration: none; font-family: inherit; letter-spacing: 0;
    -webkit-tap-highlight-color: transparent; transition: background-color .18s ease, color .18s ease;
  }
  #mobil-leiste a.aktiv, #mobil-leiste button.aktiv { color: var(--accent-text); background: var(--accent-soft); }
  #mobil-leiste svg { width: 22px; height: 22px; }

  #mobil-mehr { position: fixed; inset: 0; z-index: 40; }
  #mobil-mehr.offen { display: block; }
  .mobil-mehr-hintergrund { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .mobil-mehr-blatt {
    position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 78vh; overflow-y: auto;
    padding: 10px 10px 12px; border-radius: 28px; box-shadow: inset 0 1px 0 var(--glass-light), var(--shadow-lg); animation: dialog-ein .22s var(--ease);
  }
  .mobil-mehr-griff { width: 38px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: 2px auto 10px; }
  .mobil-mehr-blatt a {
    display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 14px; border-radius: 14px;
    color: var(--text); text-decoration: none; font-size: 16px; font-weight: 500;
  }
  .mobil-mehr-blatt a svg { color: var(--accent-text); flex: 0 0 auto; }
  .mobil-mehr-blatt a.aktiv { background: var(--accent-soft); font-weight: 650; }
}

/* iPhone-App im Hell-Modus: Die Statusleiste hat feste weiße Schrift - ein dunkler Verlauf hinter ihr hält sie lesbar */
@media (display-mode: standalone) {
  :root[data-theme="light"] body::after {
    content: ""; position: fixed; top: 0; left: 0; right: 0; height: calc(env(safe-area-inset-top) + 10px); z-index: 60; pointer-events: none;
    background: linear-gradient(180deg, rgba(20,28,45,.55), rgba(20,28,45,0));
  }
}

/* Weniger Bewegung: nur Einblenden/Farben, keine Verschiebungen */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
