/* ==========================================================================
   Stammbauminator — Design-System
   Sommerlich, freundlich, hell. Alle Module verwenden ausschliesslich diese
   Custom Properties und Komponentenklassen — keine Hex-Farben in Modul-CSS.
   ========================================================================== */

:root {
  /* --- Farbpalette: Sommer ------------------------------------------------ */
  --c-sun:        #ffc24b;   /* Sonnengelb  — Primärakzent */
  --c-sun-deep:   #f0a91f;
  --c-peach:      #ff9a76;   /* Pfirsich    — warme Sekundärfarbe */
  --c-coral:      #ef6f5c;   /* Koralle     — Aktion / Gefahr */
  --c-coral-deep: #d5503c;
  --c-mint:       #7ecfa4;   /* Minze       — Erfolg / Blutlinie */
  --c-sage:       #3f9a72;
  --c-sky:        #6ec1e4;   /* Himmelblau  — Info / Partner */
  --c-sky-deep:   #2f92bd;
  --c-lavender:   #a99ce0;   /* Lavendel    — Markierungen */

  /* --- Neutrale Töne (warm) ---------------------------------------------- */
  --c-cream:      #fffaf2;   /* Karten-Hintergrund */
  --c-sand:       #f7ecdb;   /* Seiten-Hintergrund */
  --c-sand-deep:  #ecdcc4;   /* Rahmen, Trennlinien */
  --c-ink:        #3a3230;   /* Haupttext */
  --c-ink-soft:   #7c6f68;   /* Sekundärtext */
  --c-ink-faint:  #a89b93;   /* Hinweise, Platzhalter */
  --c-white:      #ffffff;

  /* --- Semantische Zuweisungen ------------------------------------------- */
  --bg-page:      linear-gradient(170deg, #fff6e6 0%, var(--c-sand) 55%, #f2e4d0 100%);
  --bg-surface:   var(--c-cream);
  --bg-sunken:    #fdf3e5;
  --border:       var(--c-sand-deep);
  --border-soft:  #f2e4d0;
  --text:         var(--c-ink);
  --text-soft:    var(--c-ink-soft);
  --text-faint:   var(--c-ink-faint);
  --accent:       var(--c-sun-deep);
  --danger:       var(--c-coral-deep);
  --success:      var(--c-sage);
  --info:         var(--c-sky-deep);

  /* --- Abstände (4px-Raster) --------------------------------------------- */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;

  /* --- Radien ------------------------------------------------------------ */
  --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;  --r-pill: 999px;

  /* --- Schatten (warm getönt) -------------------------------------------- */
  --sh-sm: 0 1px 2px rgba(88, 62, 40, .08), 0 2px 6px rgba(88, 62, 40, .06);
  --sh-md: 0 2px 6px rgba(88, 62, 40, .09), 0 8px 20px rgba(88, 62, 40, .09);
  --sh-lg: 0 4px 12px rgba(88, 62, 40, .10), 0 18px 44px rgba(88, 62, 40, .14);
  --sh-focus: 0 0 0 3px rgba(240, 169, 31, .40);

  /* --- Typografie -------------------------------------------------------- */
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", "Segoe UI",
          system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --fs-xs: .75rem;  --fs-sm: .875rem;  --fs-md: 1rem;
  --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem;
  --lh-tight: 1.25; --lh-normal: 1.55;

  /* --- Bewegung ---------------------------------------------------------- */
  --ease: cubic-bezier(.2, .8, .3, 1);
  --dur-fast: 120ms;  --dur: 200ms;  --dur-slow: 340ms;

  /* --- Ebenen ------------------------------------------------------------ */
  /* Panel liegt über dem Sticky-Header, aber unter Modals und Toasts. */
  --z-header: 50;  --z-panel: 55;  --z-modal: 60;  --z-toast: 70;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Reset & Basis
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* Muss vor allen Komponenten stehen: eigene display-Regeln (z.B. #gate { display:grid })
   überstimmen sonst die UA-Regel für [hidden], und das Element bliebe sichtbar. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg-page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 700; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p  { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--info); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 3px solid var(--c-sun-deep);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--c-sun); color: var(--c-ink); }

/* Scrollbars — dezent und warm */
* { scrollbar-color: var(--c-sand-deep) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--c-sand-deep); border-radius: var(--r-pill);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--c-ink-faint); background-clip: content-box; }

/* ==========================================================================
   Buttons — .btn + Varianten
   .btn .btn--primary | --secondary | --ghost | --danger | --sun
   Grössen: .btn--sm | .btn--lg | .btn--icon (quadratisch)
   ========================================================================== */

.btn {
  --btn-bg: var(--c-white);
  --btn-fg: var(--text);
  --btn-border: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              filter var(--dur) var(--ease);
  box-shadow: var(--sh-sm);
  white-space: nowrap;
  user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: var(--sh-sm); filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.btn--primary   { --btn-bg: var(--c-coral); --btn-fg: var(--c-white); --btn-border: var(--c-coral-deep); }
.btn--sun       { --btn-bg: var(--c-sun);   --btn-fg: var(--c-ink);   --btn-border: var(--c-sun-deep); }
.btn--secondary { --btn-bg: var(--c-white); --btn-fg: var(--text);    --btn-border: var(--border); }
.btn--danger    { --btn-bg: var(--c-coral-deep); --btn-fg: var(--c-white); --btn-border: var(--c-coral-deep); }
.btn--ghost     { --btn-bg: transparent; --btn-fg: var(--text-soft); --btn-border: transparent; box-shadow: none; }
.btn--ghost:hover:not(:disabled) { --btn-bg: rgba(255,255,255,.7); box-shadow: var(--sh-sm); }

.btn--sm   { min-height: 34px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); }
.btn--lg   { min-height: 52px; padding: var(--sp-3) var(--sp-6); font-size: var(--fs-md); }
.btn--icon { min-width: 44px; padding: var(--sp-2); }
.btn--sm.btn--icon { min-width: 34px; }
.btn--block { width: 100%; }

/* Runder Plus-Knopf — zentrales Interaktionselement im Stammbaum */
.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  /* Die Knöpfe tragen Sinnbilder (Fläschchen / Herz) statt eines "+".
     18px füllt den 28-px-Innenraum gut, ohne an den Rand zu stossen. */
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-white);
  background: var(--c-mint);
  border: 2px solid var(--c-white);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur) var(--ease);
}
.btn-add:hover { background: var(--c-sage); transform: scale(1.12); }
.btn-add:active { transform: scale(1); }
.btn-add--partner { background: var(--c-sky); }
.btn-add--partner:hover { background: var(--c-sky-deep); }

/* ==========================================================================
   Karten & Flächen
   ========================================================================== */

.card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: var(--sp-5);
}
.card--flush { padding: 0; overflow: hidden; }
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1.5px solid var(--border-soft);
  background: var(--bg-sunken);
}
.card__body { padding: var(--sp-5); }

.section-title {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-lg);
}

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.small { font-size: var(--fs-sm); }
.tiny  { font-size: var(--fs-xs); }

.stack     { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.row       { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row--end  { justify-content: flex-end; }
.spacer    { flex: 1 1 auto; }
.hidden    { display: none !important; }

.divider { height: 1.5px; background: var(--border-soft); border: 0; margin: var(--sp-4) 0; }

/* ==========================================================================
   Formularfelder — .field > label + input/textarea/select
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field > label { font-size: var(--fs-sm); font-weight: 650; color: var(--text-soft); }

.input, .field input, .field textarea, .field select {
  width: 100%;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--c-white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:hover, .field input:hover, .field textarea:hover, .field select:hover { border-color: var(--c-ink-faint); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--c-sun-deep);
  box-shadow: var(--sh-focus);
}
.field textarea { min-height: 88px; resize: vertical; line-height: var(--lh-normal); }
.field select {
  appearance: none;
  padding-right: var(--sp-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%237c6f68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
}
/* Passwortfeld mit Auge-Knopf: Lange Passwörter lassen sich sonst nicht
   kontrollieren, gerade auf dem Handy. */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 48px; }
.pw-field__eye {
  position: absolute;
  top: 50%;
  right: var(--sp-1);
  transform: translateY(-50%);
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: var(--fs-md);
  line-height: 1;
  box-shadow: none;
}
.pw-field__eye:hover:not(:disabled) { transform: translateY(-50%); box-shadow: none; }
.pw-field__eye:active:not(:disabled) { transform: translateY(-50%); }

.field__hint  { font-size: var(--fs-xs); color: var(--text-faint); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--danger); }

.field-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-grid--2 { grid-template-columns: 1fr 1fr; } }

.checkline { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); cursor: pointer; }
.checkline input[type="checkbox"], .checkline input[type="radio"] {
  width: 20px; height: 20px; min-height: 0; accent-color: var(--c-sage); cursor: pointer; flex: none;
}

/* ==========================================================================
   Pills, Badges, Avatare
   ========================================================================== */

.pill {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px var(--sp-3);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.6;
  color: var(--text-soft);
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pill--sun  { background: #fff2d4; border-color: var(--c-sun); color: #8a6200; }
.pill--mint { background: #e2f6ec; border-color: var(--c-mint); color: #216048; }
.pill--sky  { background: #e0f2fa; border-color: var(--c-sky);  color: #175f7e; }
.pill--coral{ background: #ffe8e3; border-color: var(--c-peach); color: #a5341f; }
.pill--lav  { background: #eeeafb; border-color: var(--c-lavender); color: #4f3f96; }

.avatar {
  display: grid; place-items: center; flex: none;
  width: 46px; height: 46px;
  font-size: var(--fs-md); font-weight: 700; letter-spacing: .5px;
  color: var(--c-white);
  background: var(--c-peach);
  border: 2px solid var(--c-white);
  border-radius: 50%;
  box-shadow: var(--sh-sm);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  user-select: none;
}
.avatar--sm { width: 34px; height: 34px; font-size: var(--fs-xs); }
.avatar--lg { width: 76px; height: 76px; font-size: var(--fs-xl); }
/* Farbvarianten werden per .avatar--c0 … --c5 zyklisch aus der ID abgeleitet */
.avatar--c0 { background-color: var(--c-peach); }
.avatar--c1 { background-color: var(--c-mint); }
.avatar--c2 { background-color: var(--c-sky); }
.avatar--c3 { background-color: var(--c-lavender); }
.avatar--c4 { background-color: var(--c-sun-deep); }
.avatar--c5 { background-color: var(--c-coral); }

/* ==========================================================================
   Leerzustände & Ladeanzeigen
   ========================================================================== */

.empty {
  display: grid; place-items: center; gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
  color: var(--text-soft);
}
.empty__icon { font-size: 44px; line-height: 1; }

.spinner {
  width: 22px; height: 22px; flex: none;
  border: 3px solid var(--border);
  border-top-color: var(--c-sun-deep);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, #fff 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ==========================================================================
   Modal — von App.modal() erzeugt
   ========================================================================== */

.modal-backdrop {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  display: grid; place-items: center;
  padding: var(--sp-4);
  background: rgba(58, 50, 48, .42);
  backdrop-filter: blur(3px);
  animation: fade var(--dur) var(--ease);
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(560px, 100%);
  max-height: calc(100dvh - var(--sp-7));
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  animation: pop var(--dur-slow) var(--ease);
  overflow: hidden;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.modal__header {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}
.modal__header h2 { flex: 1; }
.modal__body { padding: 0 var(--sp-5) var(--sp-4); overflow-y: auto; }
.modal__footer {
  display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  border-top: 1.5px solid var(--border-soft);
  background: var(--bg-sunken);
}
.modal__close {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  font-size: 20px; color: var(--text-soft);
  background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.modal__close:hover { background: var(--bg-sunken); color: var(--text); }

/* ==========================================================================
   Toasts
   ========================================================================== */

#toasts {
  position: fixed; left: 50%; bottom: var(--sp-5);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  width: min(440px, calc(100vw - var(--sp-6)));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--c-white);
  background: var(--c-ink);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  animation: toast-in var(--dur-slow) var(--ease);
  pointer-events: auto;
}
.toast--success { background: var(--c-sage); }
.toast--error   { background: var(--c-coral-deep); }
.toast--info    { background: var(--c-sky-deep); }
.toast--out     { animation: toast-out var(--dur) var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   App-Shell
   ========================================================================== */

#app { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
  position: sticky; top: 0;
  z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255, 250, 242, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border-soft);
}
.app-header__brand { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
/* Ohne min-width:0 greift text-overflow im Flex-Kind nicht — der Titel würde
   auf schmalen Geräten hart abgeschnitten statt mit Auslassungspunkten. */
.app-header__brand > div { min-width: 0; }
.app-header__mark { font-size: 26px; line-height: 1; flex: none; }
.app-header__title {
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header__sub { display: none; }
@media (min-width: 768px) {
  .app-header { padding: var(--sp-3) var(--sp-6); }
  .app-header__sub { display: block; font-size: var(--fs-xs); color: var(--text-faint); }
}

.tabs {
  display: flex; gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--r-pill);
}
.tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-4);
  font: inherit; font-size: var(--fs-sm); font-weight: 650;
  color: var(--text-soft);
  background: transparent; border: 0; border-radius: var(--r-pill);
  cursor: pointer;
  /* Ohne nowrap bricht "Namen lernen" um und macht die Kopfzeile hoeher. */
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .7); }
.tab[aria-selected="true"] {
  color: var(--c-ink); background: var(--c-white); box-shadow: var(--sh-sm);
}
.tab__label { display: none; }
@media (min-width: 620px) { .tab__label { display: inline; } }

.app-main { flex: 1; min-height: 0; }

.app-footer {
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-align: center;
  border-top: 1.5px solid var(--border-soft);
}
.app-footer a { color: var(--text-soft); text-decoration-color: var(--border); }
.app-footer a:hover { color: var(--info); }
.app-footer__sep { margin: 0 var(--sp-1); }
.app-footer__license { white-space: nowrap; }
.tabpanel { display: none; }
.tabpanel[data-active="true"] { display: block; }

.page { max-width: 1100px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-8); }
@media (min-width: 768px) { .page { padding: var(--sp-6) var(--sp-6) var(--sp-8); } }

/* ==========================================================================
   Login-Gate
   ========================================================================== */

#gate {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  display: grid; place-items: center;
  padding: var(--sp-4);
  background: var(--bg-page);
  background-attachment: fixed;
  overflow-y: auto;
}
.gate-card {
  width: min(420px, 100%);
  padding: var(--sp-6);
  text-align: center;
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  animation: pop var(--dur-slow) var(--ease);
}
.gate-card__mark { font-size: 56px; line-height: 1; margin-bottom: var(--sp-2); }
.gate-card__title { font-size: var(--fs-2xl); margin-bottom: var(--sp-1); }
.gate-card__text { color: var(--text-soft); font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.gate-card form { display: flex; flex-direction: column; gap: var(--sp-3); text-align: left; }

.shake { animation: shake 400ms var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ==========================================================================
   Seitliches Detailpanel (Personen)
   ========================================================================== */

.panel-backdrop {
  position: fixed; inset: 0;
  z-index: var(--z-panel);
  background: rgba(58, 50, 48, .32);
  backdrop-filter: blur(2px);
  animation: fade var(--dur) var(--ease);
}
.panel {
  position: fixed; z-index: calc(var(--z-panel) + 1);
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  box-shadow: var(--sh-lg);
  /* Mobil: Bottom-Sheet */
  left: 0; right: 0; bottom: 0;
  max-height: 88dvh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  animation: sheet-up var(--dur-slow) var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (min-width: 768px) {
  .panel {
    left: auto; top: 0; right: 0; bottom: 0;
    width: min(440px, 100%);
    max-height: none;
    border-radius: var(--r-xl) 0 0 var(--r-xl);
    animation: sheet-in var(--dur-slow) var(--ease);
  }
  @keyframes sheet-in { from { transform: translateX(100%); } }
}

/* ==========================================================================
   Hilfsklassen
   ========================================================================== */

.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;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }  .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--sp-4); }  .mb-4 { margin-bottom: var(--sp-4); }
