/* ══════════════════════════════════════════════════════════
   GLG Kiosk – Designsystem 2.4
   Weiß · Navy #173263 · Rot #b62519 · Maskottchen Griesi
   ══════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Loubag';
  src: url('/files/Loubag-Regular.ttf') format('truetype');
  font-display: swap;
}

@view-transition { navigation: auto; }

:root {
  --navy:      #173263;
  --navy-700:  #0f2449;
  --navy-500:  #2a4a85;
  --navy-100:  #dde5f1;
  --navy-50:   #eef2f8;
  --red:       #b62519;
  --red-700:   #93190f;
  --red-100:   #f6dcd9;
  --red-50:    #fbefed;
  --white:     #ffffff;
  --surface:   #ffffff;
  --brand:     #173263;
  --on-brand:  #ffffff;
  --mist:      #f3f5f9;
  --line:      #dbe2ec;
  --ink:       #173263;
  --ink-soft:  #53627c;
  --ink-mute:  #7d8aa0;

  --font-display: 'Loubag', 'Trebuchet MS', system-ui, sans-serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --r-card: 18px;
  --r-ctl: 12px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(23,50,99,.06), 0 8px 24px -12px rgba(23,50,99,.18);
  --wrap: 1120px;
  --mascot-space: 150px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--mist); }
body {
  margin: 0; min-height: 100vh;
  font: 400 16px/1.5 var(--font-ui);
  color: var(--ink); background: var(--mist);
  padding-bottom: var(--mascot-space);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

h1, h2, h3, .display {
  font-family: var(--font-display); font-weight: 400; color: var(--navy);
  margin: 0; line-height: 1.15; letter-spacing: .005em;
}
h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
p { margin: 0; }
.muted { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }

/* ── App-Leiste ───────────────────────────────────── */
.appbar {
  background: var(--brand); color: var(--on-brand);
  position: sticky; top: 0; z-index: 20;
  view-transition-name: appbar;
}
.appbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; margin-right: auto; white-space: nowrap; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-size: 1.45rem; line-height: 1; }
.brand-sub { display: block; font-size: .75rem; color: rgba(255,255,255,.65); margin-top: 3px; }
.appnav { display: flex; gap: 6px; flex-wrap: wrap; }
.appnav a {
  color: var(--white); text-decoration: none; font-size: .92rem; font-weight: 500;
  padding: 8px 14px; border-radius: var(--r-pill); transition: background .15s;
}
.appnav a:hover { background: rgba(255,255,255,.12); }
.appnav a[aria-current="page"] { background: var(--white); color: var(--brand); }
.appnav a.nav-exit { background: var(--red); }
.appnav a.nav-exit:hover { background: var(--red-700); }

/* ── Seitenrahmen ─────────────────────────────────── */
.page { max-width: var(--wrap); margin: 0 auto; padding: 32px 20px 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .lead { color: var(--ink-soft); margin-top: 6px; text-wrap: pretty; }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 14px; }

/* ── Karten ───────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head p { color: var(--ink-soft); font-size: .9rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; }
.kpi-label { font-size: .88rem; color: var(--ink-soft); }
.kpi-value { font-family: var(--font-display); font-size: 2.1rem; line-height: 1.1; margin-top: 6px; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-note { font-size: .8rem; color: var(--ink-mute); margin-top: 4px; }
.kpi--hero { background: var(--brand); border-color: var(--brand); }
.kpi--hero .kpi-label, .kpi--hero .kpi-note { color: rgba(255,255,255,.72); }
.kpi--hero .kpi-value { color: var(--white); }
.kpi--alert .kpi-value { color: var(--red); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--r-pill);
  font: 600 .95rem/1 var(--font-ui); text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: background .15s, color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--red); color: var(--on-brand); }
.btn-primary:hover { background: var(--red-700); }
.btn-navy { background: var(--brand); color: var(--on-brand); }
.btn-navy:hover { background: var(--navy-500); }
.btn-ghost { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: var(--red-100); }
.btn-danger-ghost:hover { background: var(--red-50); border-color: var(--red); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Formulare ────────────────────────────────────── */
label { font-size: .9rem; font-weight: 600; color: var(--navy); }
input[type=text], input[type=number], input[type=password], select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font: 400 1rem var(--font-ui); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px var(--navy-50); }
.field { display: grid; gap: 6px; }

/* Segment (Bar / PayPal, Filter) */
.segmented { display: inline-flex; background: var(--navy-50); border-radius: var(--r-pill); padding: 4px; gap: 4px; flex-wrap: wrap; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label, .segmented a {
  padding: 9px 16px; border-radius: var(--r-pill); cursor: pointer; text-decoration: none;
  font-size: .9rem; font-weight: 600; color: var(--navy); transition: background .15s, color .15s;
}
.segmented input:checked + label, .segmented a[aria-current="true"] { background: var(--brand); color: var(--on-brand); }
.segmented input:focus-visible + label { outline: 3px solid var(--red); outline-offset: 2px; }

/* ── Tabellen ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; font-size: .82rem; font-weight: 600; color: var(--ink-soft); padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--navy-50); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges ───────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: .8rem; font-weight: 600; }
.badge-open { background: var(--red-50); color: var(--red); }
.badge-paid { background: var(--navy-50); color: var(--navy); }
.badge-low { background: var(--red); color: var(--on-brand); }

/* ── Hinweise & Toast ─────────────────────────────── */
.note { padding: 14px 16px; border-radius: var(--r-ctl); background: var(--navy-50); color: var(--navy); font-size: .92rem; }
.note-warn { background: var(--red-50); color: var(--red-700); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; color: var(--navy); margin-bottom: 6px; }

.toast-area { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: var(--brand); color: var(--on-brand); padding: 12px 18px; border-radius: var(--r-pill);
  font-weight: 500; box-shadow: var(--shadow); animation: toast-in .2s ease-out;
}
.toast.is-error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Maskottchen Griesi ───────────────────────────── */
.griesi {
  position: fixed; right: 18px; bottom: 0; z-index: 40; pointer-events: none;
  transition: bottom .45s cubic-bezier(.34,1.56,.64,1);
}
/* translate = Auftritt, rotate = Leerlauf-Wippen, scale = Hover, transform = Klick-Hüpfer (per JS) */
.griesi-img {
  display: block; width: 100px; height: auto; pointer-events: auto; cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(23,50,99,.25));
  transform-origin: 50% 100%; will-change: transform;
  transition: width .45s cubic-bezier(.34,1.4,.64,1), scale .3s cubic-bezier(.34,1.56,.64,1);
  animation: griesi-in .9s cubic-bezier(.22,1.25,.36,1) both, griesi-idle 7s ease-in-out 1.4s infinite;
  -webkit-tap-highlight-color: transparent;
}
.griesi-img:hover { scale: 1.05; }
.griesi-img:active { scale: .97; }
@keyframes griesi-in { 0% { translate: 0 105%; } 65% { translate: 0 -5%; } 85% { translate: 0 1.5%; } 100% { translate: 0 0; } }
@keyframes griesi-idle { 0%, 100% { rotate: 0deg; } 30% { rotate: -1.8deg; } 60% { rotate: .8deg; } }

/* Blase hängt links am Kopf, der Zipfel zeigt auf Griesis Gesicht */
.griesi-bubble {
  position: absolute; right: calc(100% + 12px); bottom: 66%;
  width: max-content; max-width: 250px; pointer-events: auto;
  background: var(--surface); color: var(--navy);
  border: 2px solid var(--navy); border-radius: 18px;
  padding: 12px 36px 12px 14px; font-size: .93rem; line-height: 1.4; font-weight: 500;
  box-shadow: var(--shadow);
  transform-origin: right bottom; will-change: transform, opacity;
  opacity: 1; scale: 1; visibility: visible;
  transition: opacity .28s ease, scale .42s cubic-bezier(.34,1.56,.64,1), visibility 0s;
}
.griesi-bubble::after {
  content: ''; position: absolute; right: -9px; bottom: 16px;
  width: 14px; height: 14px; background: var(--surface);
  border-right: 2px solid var(--navy); border-top: 2px solid var(--navy);
  transform: rotate(45deg); border-radius: 0 3px 0 0;
}
.griesi-bubble button {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--navy-50); color: var(--navy); cursor: pointer; font-size: 14px; line-height: 1;
  transition: background .15s, scale .2s;
}
.griesi-bubble button:hover { background: var(--navy-100); scale: 1.1; }
.griesi-text { display: block; transition: opacity .16s ease; }
.griesi.is-quiet .griesi-bubble {
  opacity: 0; scale: .7; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, scale .25s ease-in, visibility 0s .25s;
}
.griesi.is-min .griesi-img { width: 54px; }
.griesi.is-min { bottom: -30px; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}
@media print { .griesi, .appbar, .toast-area { display: none; } body { padding: 0; background: #fff; } }

/* Angebote */
.badge-sale { background: var(--red); color: var(--on-brand); font-size: .72rem; padding: 3px 8px; vertical-align: middle; }
s.was { color: var(--ink-mute); font-weight: 400; font-size: .85em; white-space: nowrap; }
strong.is-sale { color: var(--red); }

/* ══ Mobil ═════════════════════════════════════════════ */
@media (max-width: 899px) { .nav-desktop { display: none !important; } }

@media (max-width: 640px) {
  :root { --mascot-space: 96px; }
  .appbar { position: static; }
  .appbar-inner { padding: 10px 14px 8px; gap: 8px; }
  .brand { white-space: nowrap; }
  .brand > span { display: flex; align-items: baseline; gap: 8px; }
  .brand-name { font-size: 1.3rem; }
  .brand-sub { margin-top: 0; font-size: .78rem; }
  .appbar-inner { flex-wrap: wrap; row-gap: 0; }
  .page { padding: 20px 14px; }
  .page-head { margin-bottom: 18px; gap: 12px; }
  .page-head > .btn, .page-head > .credit-chip { width: 100%; }
  h1 { font-size: 2rem; }
  .section { margin-top: 22px; }
  .card { padding: 16px; border-radius: 16px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; border-radius: 14px; }
  .kpi-label { font-size: .8rem; }
  .kpi-value { font-size: 1.55rem; }
  .kpi-note { font-size: .74rem; }

  .btn { min-height: 46px; }
  .btn-row .btn { flex: 1 1 auto; }
  .tbl th, .tbl td { padding: 10px 8px; }
  .segmented { max-width: 100%; }
  .segmented a, .segmented label { padding: 9px 13px; }

  .toast-area { bottom: 14px; width: calc(100% - 120px); }
  .toast { text-align: center; }

  .griesi { right: 8px; }
  .griesi-img { width: 62px; }
  .griesi.is-min .griesi-img { width: 44px; }
  .griesi-bubble { right: calc(100% + 8px); max-width: 190px; padding: 10px 32px 10px 12px; font-size: .84rem; }
}

/* ══ Menü-Knopf (Handy) ═════════════════════════════════ */
.nav-toggle { display: none; }
@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
    border: 1.5px solid rgba(255,255,255,.35); border-radius: var(--r-pill);
    background: transparent; color: var(--white); font: 600 .92rem var(--font-ui); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle:active { background: rgba(255,255,255,.12); }
  .nav-toggle-icon { position: relative; width: 16px; height: 12px; }
  .nav-toggle-icon i {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s, top .3s;
  }
  .nav-toggle-icon i:nth-child(1) { top: 0; }
  .nav-toggle-icon i:nth-child(2) { top: 5px; }
  .nav-toggle-icon i:nth-child(3) { top: 10px; }
  .appbar.is-open .nav-toggle { background: var(--white); color: var(--brand); border-color: var(--white); }
  .appbar.is-open .nav-toggle-icon i:nth-child(1) { top: 5px; transform: rotate(45deg); }
  .appbar.is-open .nav-toggle-icon i:nth-child(2) { opacity: 0; }
  .appbar.is-open .nav-toggle-icon i:nth-child(3) { top: 5px; transform: rotate(-45deg); }

  /* Alle Punkte untereinander, weich aufklappend */
  .appnav {
    flex-basis: 100%; display: grid; gap: 6px; margin: 0; padding: 0;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .35s cubic-bezier(.2,.8,.2,1), opacity .2s, padding .35s;
  }
  .appbar.is-open .appnav { max-height: 420px; opacity: 1; padding: 12px 0 6px; }
  .appnav a { padding: 13px 16px; border-radius: 12px; font-size: 1rem; background: rgba(255,255,255,.07); }
  .appnav a[aria-current="page"] { background: var(--white); color: var(--brand); }
  .appnav a.nav-exit { background: var(--red); margin-top: 4px; }
}

/* ══ Skeleton beim Seitenwechsel ═══════════════════════ */
.sk-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; overflow: hidden;
  background: var(--mist); animation: sk-in .18s ease-out;
}
@keyframes sk-in { from { opacity: 0; } }
.sk {
  display: block; border-radius: 8px;
  background: linear-gradient(90deg, var(--navy-50) 0%, var(--navy-100) 40%, var(--navy-50) 80%);
  background-size: 300% 100%; animation: sk-shimmer 1.3s linear infinite;
}
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.sk-mt { margin-top: 10px; }
.sk-mtauto { margin-top: auto; }
.sk-pill { border-radius: var(--r-pill); }
.sk-overlay .kpi, .sk-card, .sk-tile { border-color: var(--line); background: var(--surface); }
.sk-overlay .sk-hero { background: var(--brand); border-color: var(--brand); }
.sk-overlay .sk-hero .sk { background: linear-gradient(90deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.24) 40%, rgba(255,255,255,.12) 80%); background-size: 300% 100%; }
.sk-tile { cursor: default; }
.sk-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: none; }
.sk-chart { height: 220px; margin-top: 16px; border-radius: 12px;
  background: repeating-linear-gradient(90deg, transparent 0 18px, var(--navy-50) 18px 34px) bottom / 100% 60% no-repeat; }
.sk-chips { display: flex; gap: 8px; margin-top: 10px; }
.sk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.sk-grid .sk-wide { grid-column: 1 / -1; }
.sk-overlay .orders { margin-top: 18px; }
body.is-navigating .griesi-bubble { opacity: 0; }
@media (max-width: 640px) { .sk-grid { grid-template-columns: 1fr; } .sk-chart { height: 170px; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-overlay .page-head > div { flex: 1; min-width: 0; }


/* ══ Themes (pro Nutzer unter „Einstellungen“) ═════════════
   --navy = starke Text-/Akzentfarbe, --brand = Markenflächen,
   --surface = Karten, --mist = Seitenhintergrund              */
html { color-scheme: light; }
[data-theme="grieshaber"] {
  color-scheme: light;
  --navy:      #173263;
  --navy-700:  #0f2449;
  --navy-500:  #2a4a85;
  --navy-100:  #dde5f1;
  --navy-50:   #eef2f8;
  --red:       #b62519;
  --red-700:   #93190f;
  --red-100:   #f6dcd9;
  --red-50:    #fbefed;
  --white:     #ffffff;
  --surface:   #ffffff;
  --brand:     #173263;
  --on-brand:  #ffffff;
  --mist:      #f3f5f9;
  --line:      #dbe2ec;
  --ink:       #173263;
  --ink-soft:  #53627c;
  --ink-mute:  #7d8aa0;
  --font-display: 'Loubag', 'Trebuchet MS', system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(23,50,99,.06), 0 8px 24px -12px rgba(23,50,99,.18);
}
[data-theme="klassik"] {
  --navy:      #3e2712;
  --navy-700:  #2c1b0c;
  --navy-500:  #7a5c3e;
  --navy-100:  #e8dcc8;
  --navy-50:   #f2ead9;
  --red:       #a65a22;
  --red-700:   #84461a;
  --red-100:   #f5d9a8;
  --red-50:    #fbf1df;
  --surface:   #fffaf3;
  --mist:      #f6f0e6;
  --line:      #e3d6c0;
  --ink:       #3e2712;
  --ink-soft:  #7a5c3e;
  --ink-mute:  #9b7d5e;
  --brand:     #5a6e3d;
  --on-brand:  #ffffff;
  --shadow: 0 1px 2px rgba(62,39,18,.06), 0 8px 24px -12px rgba(62,39,18,.2);
}

[data-theme="nacht"] {
  color-scheme: dark;
  --navy:      #f1efe9;
  --navy-700:  #ffffff;
  --navy-500:  #c9c4b8;
  --navy-100:  #3a3b40;
  --navy-50:   #2a2b30;
  --red:       #f0a868;
  --red-700:   #e39352;
  --red-100:   #4a3624;
  --red-50:    #2e261d;
  --surface:   #232428;
  --mist:      #1a1b1e;
  --line:      #34363c;
  --ink:       #ecebe7;
  --ink-soft:  #b7b3aa;
  --ink-mute:  #8c897f;
  --brand:     #8fc9ad;
  --on-brand:  #16231d;
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 10px 28px -12px rgba(0,0,0,.55);
}
/* Nacht: warmes Grau, Salbei und Apricot statt Navy/Rot */
html[data-theme="nacht"] .appbar { background: #232428; color: var(--ink); border-bottom: 1px solid var(--line); }
html[data-theme="nacht"] .brand, html[data-theme="nacht"] .appnav a, html[data-theme="nacht"] .nav-toggle { color: var(--ink); }
html[data-theme="nacht"] .appnav a:hover { background: rgba(255,255,255,.06); }
html[data-theme="nacht"] .appnav a[aria-current="page"],
html[data-theme="nacht"] .appbar.is-open .nav-toggle { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
html[data-theme="nacht"] .appnav a.nav-exit { background: var(--red); color: #2a1a0c; }
html[data-theme="nacht"] .btn-primary, html[data-theme="nacht"] .page-admin .btn-primary,
html[data-theme="nacht"] .badge-low, html[data-theme="nacht"] .badge-sale { color: #2a1a0c; }
html[data-theme="nacht"] .kpi--hero .kpi-label, html[data-theme="nacht"] .kpi--hero .kpi-note,
html[data-theme="nacht"] .stat-card:first-child .stat-label, html[data-theme="nacht"] .stat-card:first-child small { color: rgba(22,35,29,.72); }
html[data-theme="nacht"] .sk-overlay .sk-hero .sk { background: linear-gradient(90deg, rgba(22,35,29,.12) 0%, rgba(22,35,29,.22) 40%, rgba(22,35,29,.12) 80%); background-size: 300% 100%; }

/* Vorschau-Flächen bekommen die Farben ihres Themes */
[data-theme] .theme-preview, .theme-card[data-theme] { color: var(--ink); }

/* Maskottchen nur im Grieshaber-Theme: anderer Platzbedarf unten */
html:not([data-theme="grieshaber"]) { --mascot-space: 32px; }
html:not([data-theme="grieshaber"]) .griesi { display: none; }
html[data-theme="nacht"] .kpi--hero .kpi-value, html[data-theme="nacht"] .stat-card:first-child strong { color: var(--on-brand); }

/* ══ Untermenü (Admin) ═════════════════════════════════════ */
.nav-group { position: relative; }
.nav-group-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-pill);
  border: none; background: transparent; color: var(--white); cursor: pointer;
  font: 500 .92rem var(--font-ui); -webkit-tap-highlight-color: transparent; transition: background .15s;
}
.nav-group-btn:hover, .nav-group.is-open .nav-group-btn { background: rgba(255,255,255,.12); }
.nav-group.is-current .nav-group-btn { background: var(--white); color: var(--brand); }
.nav-caret { width: 12px; height: 12px; transition: transform .2s; }
.nav-group.is-open .nav-caret { transform: rotate(180deg); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--brand); }
.nav-sub {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 210px;
  display: grid; gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility 0s .16s;
}
.nav-group.is-open .nav-sub { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
.appnav .nav-sub a { color: var(--ink); background: none; border-radius: 10px; padding: 10px 12px; }
.appnav .nav-sub a:hover { background: var(--navy-50); }
.appnav .nav-sub a[aria-current="page"] { background: var(--navy-50); color: var(--navy); font-weight: 700; }
html[data-theme="nacht"] .nav-group-btn { color: var(--ink); }
html[data-theme="nacht"] .nav-group.is-current .nav-group-btn { background: var(--brand); color: var(--on-brand); }
html[data-theme="nacht"] .nav-dot { box-shadow: 0 0 0 2px #232428; }

@media (max-width: 640px) {
  .nav-group { display: grid; }
  .nav-group-btn { justify-content: space-between; width: 100%; padding: 13px 16px; border-radius: 12px; font-size: 1rem; background: rgba(255,255,255,.07); }
  .nav-group.is-current .nav-group-btn { background: rgba(255,255,255,.07); color: var(--white); }
  html[data-theme="nacht"] .nav-group.is-current .nav-group-btn { background: rgba(255,255,255,.07); color: var(--ink); }
  .nav-sub {
    position: static; min-width: 0; margin: 6px 0 0 14px; padding: 0; gap: 6px;
    background: none; border: none; box-shadow: none; transform: none;
    display: none; opacity: 1; visibility: visible;
  }
  .nav-group.is-open .nav-sub { display: grid; }
  .appnav .nav-sub a { color: var(--white); background: rgba(255,255,255,.07); padding: 12px 16px; }
  .appnav .nav-sub a[aria-current="page"] { background: var(--white); color: var(--brand); }
  html[data-theme="nacht"] .appnav .nav-sub a { color: var(--ink); }
  html[data-theme="nacht"] .appnav .nav-sub a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }
  .appbar.is-open .appnav { max-height: 640px; }
}
.nav-group.is-current .nav-dot { box-shadow: 0 0 0 2px var(--white); }
@media (max-width: 640px) {
  .nav-group-btn { justify-content: flex-start; }
  .nav-caret { margin-left: auto; }
  .nav-group.is-current .nav-dot { box-shadow: none; }
}

/* ══ Scrollbars passend zum Theme (Seite und alle Container) ══ */
* { scrollbar-width: thin; scrollbar-color: var(--navy-100) transparent; }
*:hover { scrollbar-color: var(--ink-mute) transparent; }
html { scrollbar-color: var(--navy-100) var(--mist); }
/* ältere Safari-Versionen ohne scrollbar-width */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-100); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-mute); }
::-webkit-scrollbar-corner, ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Hinweis vor automatischer Abmeldung */
.idle-warn { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(15,20,30,.45); animation: toast-in .2s ease-out; }
.idle-card { width: min(420px, 100%); background: var(--surface); color: var(--ink); border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.idle-card strong { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; color: var(--navy); }
.idle-card p { color: var(--ink-soft); }
.idle-sec { font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.idle-card .btn-row { margin-top: 6px; }
