/* ===== Lucide SVG Icon Helper ===== */
.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}
.ui-icon path, .ui-icon circle, .ui-icon rect, .ui-icon line,
.ui-icon polyline, .ui-icon polygon, .ui-icon ellipse {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== CSS Custom Properties ===== */
:root {
  /* Dark Mode (Basis) – moh.de: Schwarz + Rot */
  --color-bg-base: #0d0d0d;
  --color-bg-from: #0d0d0d;
  --color-bg-to: #1a1a1a;

  /* Brand-Farben */
  --aurora-cyan: #ff4455;
  --aurora-mint: #e8001f;
  --aurora-violet: #242424;
  --aurora-magenta: #c8000a;

  /* Glass / Cards */
  --glass-bg: rgba(36, 36, 36, 0.75);
  --glass-bg-hover: rgba(36, 36, 36, 0.92);
  --glass-border: rgba(200, 0, 10, 0.18);
  --glass-blur: 24px;
  --glass-border-hover: rgba(232, 0, 31, 0.5);

  /* Primary / Secondary */
  --color-primary: #ff4455;
  --color-primary-glow: rgba(200, 0, 10, 0.25);
  --color-primary-glow-strong: rgba(200, 0, 10, 0.45);
  --color-secondary: #e8001f;

  /* Gradient für Wert-Anzeige */
  --gradient-value: linear-gradient(135deg, #ff4455, #e8001f);

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 12px 48px rgba(200, 0, 10, 0.18), 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-fab: 0 0 20px rgba(200, 0, 10, 0.4), 0 0 40px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(0, 0, 0, 0.3);

  /* Text */
  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.55);

  /* Borders & Surfaces */
  --color-border: rgba(200, 0, 10, 0.18);
  --color-surface-2: rgba(255, 255, 255, 0.04);

  /* Danger / Success */
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #22d3a5;

  /* Radius */
  --radius-card: 24px;
  --radius-btn: 14px;
  --radius-fab: 50%;

  /* Header */
  --header-height: 56px;
  --header-bg-scroll: rgba(13, 13, 13, 0.95);

  /* Transitions */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.2s ease;
  --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="light"] {
  --color-bg-base: #faf7f7;
  --color-bg-from: #faf7f7;
  --color-bg-to: #ede8e8;

  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(200, 0, 10, 0.12);
  --glass-blur: 24px;
  --glass-border-hover: rgba(200, 0, 10, 0.35);

  --color-primary: #c8000a;
  --color-primary-glow: rgba(200, 0, 10, 0.15);
  --color-primary-glow-strong: rgba(200, 0, 10, 0.3);
  --color-secondary: #e8001f;

  --gradient-value: linear-gradient(135deg, #c8000a, #e8001f);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.10);
  --shadow-card-hover: 0 12px 48px rgba(200, 0, 10, 0.12), 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-fab: 0 0 20px rgba(200, 0, 10, 0.3), 0 4px 16px rgba(0, 0, 0, 0.15);

  --color-text: #1a1a1a;
  --color-text-secondary: rgba(26, 26, 26, 0.55);

  --color-border: rgba(200, 0, 10, 0.12);
  --color-surface-2: rgba(0, 0, 0, 0.04);

  --header-bg-scroll: rgba(250, 247, 247, 0.92);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --color-bg-base: #0d0d0d;
    --color-bg-from: #0d0d0d;
    --color-bg-to: #1a1a1a;

    --glass-bg: rgba(36, 36, 36, 0.75);
    --glass-bg-hover: rgba(36, 36, 36, 0.92);
    --glass-border: rgba(200, 0, 10, 0.18);
    --glass-blur: 24px;
    --glass-border-hover: rgba(232, 0, 31, 0.5);

    --color-primary: #ff4455;
    --color-primary-glow: rgba(200, 0, 10, 0.25);
    --color-primary-glow-strong: rgba(200, 0, 10, 0.45);
    --color-secondary: #e8001f;

    --gradient-value: linear-gradient(135deg, #ff4455, #e8001f);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-card-hover: 0 12px 48px rgba(200, 0, 10, 0.18), 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-fab: 0 0 20px rgba(200, 0, 10, 0.4), 0 0 40px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(0, 0, 0, 0.3);

    --color-text: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.55);

    --color-border: rgba(200, 0, 10, 0.18);
    --color-surface-2: rgba(255, 255, 255, 0.04);

    --header-bg-scroll: rgba(13, 13, 13, 0.95);
  }
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --color-bg-base: #faf7f7;
    --color-bg-from: #faf7f7;
    --color-bg-to: #ede8e8;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-bg-hover: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(200, 0, 10, 0.12);
    --glass-blur: 24px;
    --glass-border-hover: rgba(200, 0, 10, 0.35);

    --color-primary: #c8000a;
    --color-primary-glow: rgba(200, 0, 10, 0.15);
    --color-primary-glow-strong: rgba(200, 0, 10, 0.3);
    --color-secondary: #e8001f;

    --gradient-value: linear-gradient(135deg, #c8000a, #e8001f);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.10);
    --shadow-card-hover: 0 12px 48px rgba(200, 0, 10, 0.12), 0 4px 16px rgba(0, 0, 0, 0.10);
    --shadow-fab: 0 0 20px rgba(200, 0, 10, 0.3), 0 4px 16px rgba(0, 0, 0, 0.15);

    --color-text: #1a1a1a;
    --color-text-secondary: rgba(26, 26, 26, 0.55);

    --color-border: rgba(200, 0, 10, 0.12);
    --color-surface-2: rgba(0, 0, 0, 0.04);

    --header-bg-scroll: rgba(250, 247, 247, 0.92);
  }
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg-base);
  color: var(--color-text);
  height: 100%;
  padding-bottom: 0;
  transition: color var(--transition);
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

input {
  font-family: inherit;
  font-size: max(16px, 1em);
}

#online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  transition: background-color var(--transition-fast);
  flex-shrink: 0;
}

/* Offline: roter Kreis */
#online-dot.offline {
  background-color: var(--color-danger);
}

/* Banner über der Jobliste im Offline-Zustand */
.offline-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.1);
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.4;
}

.offline-banner[hidden] {
  display: none;
}

#app-version {
  font-size: 0.75rem;
  opacity: 0.6;
  letter-spacing: 0.08em;
}

/* ===== Animations ===== */
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ripple-expand {
  from {
    transform: scale(0);
    opacity: 0.35;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes fab-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(200, 0, 10, 0.5), 0 0 30px rgba(200, 0, 10, 0.25),
                0 0 60px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 15px rgba(200, 0, 10, 0.7), 0 0 45px rgba(200, 0, 10, 0.35),
                0 0 80px rgba(0, 0, 0, 0.5), 0 4px 20px rgba(0, 0, 0, 0.3),
                0 0 0 12px rgba(200, 0, 10, 0);
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  background: rgba(255, 255, 255, 0.4);
  animation: ripple-expand 0.5s ease-out forwards;
  pointer-events: none;
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: transparent;
  border-bottom: 1px solid transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background var(--transition), border-color var(--transition), backdrop-filter var(--transition);
}

header.scrolled {
  background: var(--header-bg-scroll);
  border-bottom-color: var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

header h1 {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--gradient-value);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#btn-settings,
#btn-history {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border-radius: var(--radius-btn);
  color: var(--color-primary);
  transition: background var(--transition-fast);
}

#btn-settings:active,
#btn-history:active {
  background: rgba(0, 0, 0, 0.1);
}

/* ===== Haupt-Content: Upload-Jobs ===== */
#upload-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px calc(76px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
}

/* Leer-Zustand */
.up-main-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px 40px;
  text-align: center;
  color: var(--color-text-secondary);
}

.up-main-empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.up-main-empty-text {
  font-size: 1rem;
  line-height: 1.6;
}

/* ===== Bottom-Bar: Alle hochladen + Neuer Upload ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--header-bg-scroll);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.upload-all-bar {
  flex: 1;
  min-width: 0;
}

.upload-all-bar[hidden] {
  display: none;
}

.upload-all-bar .up-btn-upload-all {
  width: 100%;
}

/* FAB: Neuer Upload — innerhalb der Bottom-Bar, kein fixed mehr */
#fab-new-upload {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-fab);
  background: linear-gradient(135deg, #c8000a, #ff4455);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
  animation: fab-pulse 2.8s ease-in-out infinite;
  /* margin-left: auto schiebt FAB nach rechts wenn keine Upload-All-Bar da */
  margin-left: auto;
}

#fab-new-upload:active {
  transform: scale(0.9);
  filter: brightness(1.4);
  transition: transform 0.1s, filter 0.1s;
}

/* ===== Modals ===== */
dialog {
  border: none;
  border-radius: var(--radius-card);
  background: var(--glass-bg);
  color: var(--color-text);
  padding: 24px;
  width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  animation: dialog-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: fit-content;
}

@media (max-width: 600px) {
  dialog {
    margin-top: auto;
    margin-bottom: 0;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    width: 100vw;
    max-width: 100%;
    bottom: var(--keyboard-offset, 0px) !important;
    transition: bottom 0.22s ease;
  }
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdrop-in 0.22s ease;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-body {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-body strong {
  color: var(--color-text);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--color-text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-secondary:active {
  background: rgba(0, 0, 0, 0.08);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  box-shadow: 0 4px 20px var(--color-primary-glow);
}

.btn-primary:active {
  box-shadow: 0 2px 12px var(--color-primary-glow);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:active {
  background: var(--color-danger-hover);
}

/* Modal Input */
.modal-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  height: 48px;
  padding: 8px 0;
  font-size: 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--color-border);
  border-radius: 0;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-input:focus {
  border-bottom-color: var(--color-primary);
  box-shadow: 0 1px 0 0 var(--color-primary);
}


/* ===== Accessibility: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #bg-canvas {
    display: none;
  }
}

/* ===== Install Wall ===== */

.install-wall {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.install-wall[hidden] {
  display: none;
}

.iw-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 36px 28px 32px;
  width: min(400px, 100%);
  text-align: center;
  animation: dialog-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.iw-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.iw-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-value);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.iw-subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Platform step containers – alle hidden bis Plattform-Klasse gesetzt wird */
.iw-steps {
  display: none;
  text-align: left;
}

.install-wall.iw-ios     #iw-steps-ios     { display: block; }
.install-wall.iw-android #iw-steps-android { display: block; }
.install-wall.iw-desktop #iw-steps-desktop { display: block; }

.iw-note {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.iw-note--alt {
  margin-top: 24px;
}

.iw-note--alt[hidden] {
  display: none;
}

.iw-note strong {
  color: var(--color-text);
}

.iw-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.iw-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-text);
}

.iw-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 10px;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--color-primary-glow);
}

.iw-install-btn {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--color-primary-glow);
  transition: opacity 0.15s ease;
}

.iw-install-btn:active {
  opacity: 0.8;
}

.iw-install-btn[hidden] {
  display: none;
}

.iw-skip-btn {
  margin-top: 20px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.iw-skip-btn:hover {
  opacity: 1;
}

@media (hover: none) and (pointer: coarse) {
  .iw-skip-btn {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .iw-card {
    animation: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --header-height: 48px;
  }

  .iw-card {
    padding: 20px 24px;
  }

  .iw-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
  }

  .iw-title {
    font-size: 1.3rem;
  }
}

/* ===== First-Run-Wizard (nutzt das Install-Wall-Layout) ===== */
.ob-step {
  text-align: center;
}

.ob-field {
  text-align: left;
  margin-bottom: 16px;
}

.ob-secondary-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-btn);
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.ob-secondary-btn:active {
  opacity: 0.7;
}

.ob-qr-reader {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: 16px;
  border-radius: var(--radius-btn);
  overflow: hidden;
  background: #000;
}

.ob-qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: var(--radius-btn);
}

.ob-msg {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: rgba(220, 38, 38, 0.12);
  color: var(--color-danger);
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
}

.ob-msg[hidden] {
  display: none;
}

.ob-spinner {
  width: 36px;
  height: 36px;
  margin: 8px auto 16px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ob-spin 0.8s linear infinite;
}

.ob-spinner[hidden] {
  display: none;
}

@keyframes ob-spin {
  to { transform: rotate(360deg); }
}

.ob-test-status {
  margin-bottom: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text);
}

.ob-test-status.is-error   { color: var(--color-danger); }
.ob-test-status.is-success { color: var(--color-success); }

/* ===== Onboarding: Theme-Auswahl ===== */

.ob-theme-seg {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 28px;
}

.ob-theme-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-bg);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.ob-theme-btn[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-glow);
}

.ob-theme-btn-label {
  font-size: 1rem;
  font-weight: 600;
  display: block;
}

.ob-theme-btn-desc {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  display: block;
  line-height: 1.3;
}

.ob-theme-btn .ui-icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
  .ob-spinner {
    animation: none;
    border-top-color: var(--glass-border);
  }
}

/* ===== Toasts ===== */
/* Überschreibt die UA-Popover-Defaults (inset/margin/border/background).
   Display immer flex: ohne Popover-Support dient das als Fixed-Fallback,
   leerer Container ist unsichtbar (pointer-events: none). */
#toast-container {
  position: fixed;
  inset: auto;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)); /* Bottom-Bar-Höhe + Abstand */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100vw - 32px), 420px);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  pointer-events: none;
  z-index: 1000;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-btn);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-card);
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.4;
  /* Einblend-Animation wird von animations.js (anime.js) gesteuert */
}

.toast--success { border-left-color: var(--color-success); }
.toast--warning { border-left-color: #f59e0b; }
.toast--error   { border-left-color: var(--color-danger); }

.toast-text {
  flex: 1;
}

.toast-action {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.toast--out {
  animation: toast-out 0.25s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast--out {
    animation: none;
  }
}

/* ===== Debug-Panel ===== */
#sheet-debug {
  width: min(780px, 95vw);
  max-height: 90dvh;
  padding: 0;
  display: none;
  flex-direction: column;
}

#sheet-debug[open] {
  display: flex;
  height: auto;
}

.debug-section {
  margin-bottom: 4px;
}

.debug-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin: 0 0 10px;
}

.debug-info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 0.875rem;
}

.debug-info-grid dt {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.debug-info-grid dd {
  margin: 0;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--color-text);
}

.debug-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.debug-action-row:last-child {
  margin-bottom: 0;
}

.debug-action-row strong {
  font-size: 0.9rem;
}

.debug-action-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-btn);
}

.debug-toast-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.debug-toast-row button {
  flex: 1;
  min-width: 60px;
  height: 38px;
  font-size: 0.85rem;
}
