/* ============================================================================
   Tourtagebuch Mobil – Design System
   Corporate Identity (siehe Anforderung §9) gepaart mit der Struktur
   aus dem Klickdummy tour_app.html.
   ============================================================================ */

:root {
  /* Primärfarben lt. Anforderung */
  --primary-dark:   #0C447C;
  --primary:        #185FA5;
  --primary-light:  #2E86DE;

  /* Neutrals – dunkles Design als Default */
  --bg:             #0F1823;
  --bg-elevated:    #182433;
  --panel:          #1C2A3C;
  --ink:            #EEF2F7;
  --ink-dim:        #9FB0C2;
  --subtle:         #8097AE;
  --muted:          #6B7E92;
  --line:           #2A3B52;
  --input-bg:       rgba(255,255,255,0.05);

  /* Status lt. Anforderung */
  --success:        #1A7A3A;
  --success-bg:     #E6F9EE;
  --danger:         #A32D2D;
  --danger-bg:      #FDECEA;
  --warning:        #C77A00;
  --warning-bg:     #FFF4E0;

  --radius-card: 16px;
  --radius-pill: 100px;

  --page-bg:
    radial-gradient(ellipse at 20% 0%,   rgba(24,95,165,0.18)  0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(46,134,222,0.12) 0%, transparent 55%),
    #0A111C;
}

/* Light-Theme (nur Mobil, in Web nicht vorhanden – Anforderung §9)
   Selektor sowohl auf <html> (neue Variante, applyTheme setzt
   documentElement.dataset.theme) als auch auf <body> (Rückwärts-
   kompatibilität für gecachte Versionen). */
[data-theme="light"],
html[data-theme="light"],
body[data-theme="light"] {
  --bg:             #F5F5F7;
  --bg-elevated:    #FFFFFF;
  --panel:          #FFFFFF;
  --ink:            #1A2432;
  --ink-dim:        #4A5A70;
  --subtle:         #5D6F84;
  --muted:          #7A8A9C;
  --line:           #E0E0E0;
  --input-bg:       #FFFFFF;

  --page-bg:
    radial-gradient(ellipse at 20% 0%,   rgba(24,95,165,0.08)  0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(46,134,222,0.08) 0%, transparent 55%),
    #F5F5F7;
}

/* ============================================================================
   Reset
   ============================================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* html bekommt EXPLIZIT background-color, damit beim Überscrollen / Bounce
   auf iOS Safari nicht der System-Hintergrund (Dunkelblau im iOS Dark Mode)
   durchschlägt. Reicht background nur auf body, mappt iOS den body-Background
   zwar normal auf den Viewport, aber bei dynamischer Höhe (z.B. fixed footer
   + scrollbarer form-body) bleiben Bereiche darunter auf System-Farbe. */
html {
  background-color: var(--bg);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  /* background-color ZUERST als Fallback, damit selbst bei Gradient-Problem
     auf iOS Safari der Hintergrund sicher die Theme-Farbe annimmt. */
  background-color: var(--bg);
  background-image: var(--page-bg);
  color: var(--ink);
  transition: background 0.25s;
  overscroll-behavior: none;
}

/* .app-shell und .page bekommen ebenfalls explizite background-color,
   damit zwischen den Schichten (page → form-body → footer-gradient) keine
   "Lücke" entsteht, durch die System-Default-Farben sichtbar werden. */
.app-shell,
.page {
  background-color: var(--bg);
}

button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* Mindest-Touch-Target: 44x44 (iOS HIG, Anforderung §9) */
button, .icon-btn, .filter-opt, .tour-card {
  min-height: 44px;
}

/* ============================================================================
   App-Shell: ein voller-Bildschirm-Container, in dem die Seiten gerendert werden
   ============================================================================ */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================================================
   Topbar
   ============================================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 8px;
}

.topbar-greeting {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.topbar-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.05;
}

.topbar-title em {
  font-style: normal;
  color: var(--primary-light);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(46,134,222,0.08); }
.icon-btn svg { width: 20px; height: 20px; }

/* Connection indicator */
.connection-indicator {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
body[data-conn="offline"] .conn-dot { background: var(--warning); }
body[data-conn="syncing"] .conn-dot {
  background: var(--primary-light);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 8px;
}
.back-btn svg { width: 18px; height: 18px; }

/* ============================================================================
   Offline-Banner
   ============================================================================ */
.offline-banner {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 4px 16px 8px;
  padding: 10px 14px;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 12px;
  border: 1px solid rgba(199,122,0,0.3);
  font-size: 13px;
  font-weight: 500;
}
.offline-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
body[data-conn="offline"] .offline-banner { display: flex; }

/* ============================================================================
   Login
   ============================================================================ */
.login-page {
  padding: 64px 28px 32px;
  justify-content: space-between;
}

.brand {
  margin-top: 24px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.brand-mark {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(12,68,124,0.4);
}
.brand-mark svg { width: 28px; height: 28px; }

.brand-name { display: flex; flex-direction: column; gap: 2px; }
.brand-app {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}
.brand-version {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.brand h1 {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand h1 em {
  font-style: normal;
  color: var(--primary-light);
}
.brand p {
  font-size: 15px;
  color: var(--ink-dim);
  margin-top: 12px;
}

.login-form { display: flex; flex-direction: column; gap: 14px; margin: 24px 0; }

.field { display: flex; flex-direction: column; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.field input {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 15px;
}
.field input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.forgot {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 0;
}

.btn-primary {
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* .btn-secondary: konsolidierte Definition steht weiter unten (~Zeile 1031),
   damit sie nicht von einer doppelten überschrieben wird. */

.btn-danger {
  padding: 14px 16px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 16px 0;
}
.legal-links button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border-radius: 8px;
  margin-top: 4px;
}

/* ============================================================================
   Quick-Stats (Tourübersicht)
   ============================================================================ */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 20px 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 12px;
  text-align: center;
}
.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-num.primary { color: var(--primary-light); }
.stat-lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ============================================================================
   Tour-Liste
   ============================================================================ */
.tour-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tour-list::-webkit-scrollbar { display: none; }

.tour-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}
.tour-card:active { transform: scale(0.99); }
.tour-card.pending { border-left: 3px solid var(--warning); }

.tour-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.tour-card-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tour-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.tour-card-chevron svg {
  width: 18px; height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
.tour-card-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-dim);
}
.tour-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tour-card-meta svg { width: 14px; height: 14px; }

.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.pending-badge svg { width: 11px; height: 11px; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================================
   FAB – Neue Tour
   ============================================================================ */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 8px 24px rgba(12,68,124,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.1s;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 26px; height: 26px; }

/* ============================================================================
   Filter
   ============================================================================ */
.filter-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 120px;
}
.filter-body::-webkit-scrollbar { display: none; }

.filter-section { margin-bottom: 24px; }
.filter-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.filter-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-opt {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-opt.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.filter-empty, .filter-loading {
  padding: 8px 4px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.filter-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  display: flex;
  gap: 10px;
  z-index: 40;
}

/* ============================================================================
   Tour-Formular
   ============================================================================ */
.form-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-body::-webkit-scrollbar { display: none; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Wichtig: erlaubt dem flex/grid-Item, kleiner zu werden als die intrinsische
     Inhaltsbreite. Ohne dies sprengen <input type="date"> (iOS-Native) oder
     lange <option>-Texte die Grid-Spalte nach rechts raus. */
  min-width: 0;
}
.form-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.form-field input,
.form-field textarea,
.form-field select {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--ink);
  font-size: 15px;
  resize: none;
  /* Verhindert, dass intrinsische Element-Mindestbreiten (insbesondere
     <input type="date"> auf iOS, oder <select> mit langen <option>-Texten)
     das Grid sprengen und die rechte Spalte aus dem Viewport schieben. */
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-computed {
  font-size: 13px;
  color: var(--ink-dim);
  padding: 8px 12px;
  background: rgba(46,134,222,0.08);
  border-radius: 8px;
  display: inline-flex;
  gap: 14px;
  flex-wrap: wrap;
}
.form-computed b { color: var(--primary-light); font-weight: 600; }

.form-checkboxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  cursor: pointer;
  font-size: 14px;
}
.form-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
}

.form-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  display: flex;
  gap: 10px;
  z-index: 40;
}
.form-footer .btn-primary { flex: 1; }

/* ============================================================================
   Impressum / Datenschutz
   ============================================================================ */
.legal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px 40px;
}
.legal-body::-webkit-scrollbar { display: none; }
.legal-body h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 12px 0 16px;
  color: var(--ink);
}
.legal-body h2 em { font-style: normal; color: var(--primary-light); }
.legal-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--ink);
}
.legal-body p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-dim);
  margin-bottom: 12px;
}

/* ============================================================================
   Toast
   ============================================================================ */
.toast {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast.kind-info    { background: var(--primary-dark); color: white; border: 1px solid var(--primary); }
.toast.kind-success { background: var(--success);      color: white; }
.toast.kind-warning { background: var(--warning);      color: white; }
.toast.kind-error   { background: var(--danger);       color: white; }

/* ============================================================================
   Foto-Grid (für Tour-Formular)
   ============================================================================ */
.photo-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 8px;
}
.photo-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}
.photo-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  position: relative;
  background-color: var(--input-bg);
}
.photo-cell.add {
  border: 2px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}
.photo-cell.add svg { width: 26px; height: 26px; }
.photo-cell .remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  color: white;
}
.photo-cell .remove svg { width: 12px; height: 12px; }

/* ============================================================================
   Dialog / Modal
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  animation: slideUp 0.25s cubic-bezier(0.2, 0, 0, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.modal p {
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal-buttons { display: flex; gap: 10px; }
/* =============================================================================
   ERGÄNZUNG für wwwroot/css/app.css
   Nach dem Block "Offline-Banner" einfügen (ungefähr Zeile 230).
   =============================================================================
   Die Klasse .filter-chip-row wird auf der Tourübersicht angezeigt, wenn
   ein Filter aktiv ist, und zeigt eine kompakte Zusammenfassung.
*/

.filter-chip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 16px 8px;
    padding: 10px 14px;
    background: rgba(46,134,222,0.10);
    color: var(--primary-light);
    border-radius: 12px;
    border: 1px solid rgba(46,134,222,0.25);
    font-size: 13px;
    font-weight: 500;
}

.filter-chip-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip-edit {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    flex-shrink: 0;
}
/* ============================================================================
   Benutzer-Menü (Bottom-Sheet) + Bestätigungs-Dialog
   Am Ende von wwwroot/css/app.css einfügen.
   ============================================================================ */

/* Overlay hinter dem Sheet/Dialog (dimmt den Rest der App ab) */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: sheet-fade-in 0.15s ease-out;
}

@keyframes sheet-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Bottom-Sheet */
.user-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 101;
    background: var(--panel);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    animation: sheet-slide-up 0.2s ease-out;
}

@keyframes sheet-slide-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Kleiner "Griff" am oberen Rand des Sheets */
.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    margin: 8px auto 16px;
}

/* Kopfbereich: Avatar + Name */
.user-sheet-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 4px 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-sheet-info {
    min-width: 0;
    flex: 1;
}

.user-sheet-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-sheet-login {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Aktionsliste */
.user-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
}

.sheet-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 52px;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.1s;
}

    .sheet-action:hover,
    .sheet-action:active {
        background: rgba(46, 134, 222, 0.08);
    }

    .sheet-action svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
        color: var(--primary-light);
    }

    .sheet-action.danger {
        color: var(--danger);
    }

        .sheet-action.danger svg {
            color: var(--danger);
        }

/* Bestätigungsdialog (Abmelden mit Pending-Touren) */
.confirm-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 101;
    background: var(--panel);
    border-radius: 16px;
    padding: 24px 20px 16px;
    width: min(360px, calc(100vw - 40px));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: sheet-fade-in 0.15s ease-out;
}

.confirm-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 10px;
}

.confirm-body {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-dim);
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* btn-secondary
   Wichtig: explizit -webkit-appearance: none, sonst überschreibt iOS Safari
   bei <button>-Elementen die color-Eigenschaft mit einem System-Default
   (häufig hellgrau / hellblau) und der Buttontext wird im Light-Theme
   praktisch unlesbar. Außerdem expliziter Hintergrund auf var(--input-bg)
   statt "none", damit der Kontrast in beiden Themes garantiert passt. */
.btn-secondary {
    -webkit-appearance: none;
    appearance: none;
    padding: 10px 16px;
    min-height: 44px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

    .btn-secondary:hover,
    .btn-secondary:active {
        background: var(--bg-elevated);
    }

.btn-danger {
    padding: 10px 16px;
    min-height: 44px;
    background: var(--danger);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

    .btn-danger:hover,
    .btn-danger:active {
        filter: brightness(1.1);
    }
/* ============================================================================
   Mussfeld-Markierung
   Am Ende von wwwroot/css/app.css einfügen.
   ----------------------------------------------------------------------------
   Nutzung: <label class="required">Feldname</label>
   Der Stern wird automatisch per CSS ergänzt, in kräftigem Rot-Orange,
   damit er auch im Dunkelmodus sofort auffällt.
   ============================================================================ */

.form-field label.required::after {
    content: " *";
    color: #FF6B3D; /* Rot-orange, leuchtet auf dunklem Grund */
    font-size: 14px; /* Größer als das 11-px-Label */
    font-weight: 700;
    letter-spacing: 0; /* Label hat uppercase-Spacing, Stern ohne */
    vertical-align: middle;
    margin-left: 2px;
}

/* Im hellen Theme etwas dunkler, damit der Kontrast auch auf Weiß stimmt */
[data-theme="light"] .form-field label.required::after {
    color: #D9441F;
}
/* ============================================================================
   Lösch-Button im Formular-Footer
   Am Ende von wwwroot/css/app.css einfügen.
   ----------------------------------------------------------------------------
   Icon-only-Button neben "Änderungen speichern". Der eigentliche rote .btn-danger
   (für den Bestätigungsdialog) ist bereits im Block "Benutzer-Menü" definiert.
   ============================================================================ */

.btn-danger-outline {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 0;
    background: transparent;
    border: 1.5px solid var(--danger);
    border-radius: 14px;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

    .btn-danger-outline:hover:not(:disabled) {
        background: rgba(163, 45, 45, 0.08);
    }

    .btn-danger-outline:active:not(:disabled) {
        transform: scale(0.95);
    }

    .btn-danger-outline:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .btn-danger-outline svg {
        width: 22px;
        height: 22px;
    }
/* ---- Dauer-Eingabe: 3 Felder (Std/Min/Sek) ---- */
.dauer-grid {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.dauer-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.dauer-input {
    width: 100%;
    text-align: center;
    font-size: 22px;
    font-weight: 500;
    height: 52px;
    padding: 0;
    box-sizing: border-box;
}

.dauer-sub {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 4px;
}

.dauer-sep {
    font-size: 22px;
    color: #888;
    padding-bottom: 22px;
    user-select: none;
}

/* ---- Temperatur-Eingabe ----
   Bewusst schmal gehalten (max ~5 Zeichen, z.B. "-12,5"). Eine volle Zeilen-
   breite wirkt für so kurze Werte überdimensioniert. Die feste Breite ist
   ähnlich dem Stunden-Feld der Dauer-Eingabe, damit das Erscheinungsbild
   konsistent bleibt. width-overrides die generelle width:100%-Regel der
   form-field-Inputs. */
.grad-input {
    width: 6.5em !important;
    max-width: 6.5em !important;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

    .picker-trigger:hover,
    .picker-trigger:active {
        border-color: var(--primary);
    }

.picker-trigger-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-trigger-chevron {
    width: 18px;
    height: 18px;
    color: #888;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ---- Bottom-Sheet mit Suche + scrollbarer Liste ---- */
.picker-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 101;
    background: var(--panel);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    animation: sheet-slide-up 0.2s ease-out;
    /* Höhe begrenzen, damit auf kleinen Geräten der Overlay nicht den
       gesamten Bildschirm einnimmt; ca. 80% der Viewport-Höhe. */
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Sticky Header mit Titel und Suchfeld */
.picker-sheet-head {
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--line);
}

.picker-sheet-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 12px;
}

.picker-search {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    font-size: 15px;
    box-sizing: border-box;
    /* iOS Search-Field schöner machen: Aufheben der Default-Stile */
    -webkit-appearance: none;
    appearance: none;
}

    .picker-search:focus {
        outline: none;
        border-color: var(--primary);
    }

/* Scrollbare Auswahlliste */
.picker-sheet-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
}

/* Einzelne Auswahlzeile */
.picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--ink);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}

    .picker-row:hover,
    .picker-row:active {
        background: var(--bg);
    }

    .picker-row.selected {
        background: rgba(46, 134, 222, 0.12); /* leicht eingefärbtes Primary */
        color: var(--primary);
        font-weight: 600;
    }

.picker-row-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.picker-row-check {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.picker-empty {
    padding: 24px 12px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* Footer mit Abbrechen/Übernehmen */
.picker-sheet-footer {
    display: flex;
    gap: 12px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--line);
}

    .picker-sheet-footer .btn-secondary,
    .picker-sheet-footer .btn-primary {
        flex: 1;
    }
/* ---- Foto-Icon auf der Tour-Karte ---- */
.tour-card-photo {
    display: inline-flex;
    align-items: center;
    color: var(--ink-dim);
    margin-left: auto;          /* Schiebt das Icon nach rechts */
    opacity: 0.7;
}

.tour-card-photo svg {
    width: 16px;
    height: 16px;
}

/* ---- Bilder-Block im Tour-Formular ---- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 18px;
}

/* "offline"-Badge oben links auf Pending-Bildern */
.photo-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--warning);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* X-Button rechts oben zum Entfernen */
.photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-remove:hover,
.photo-remove:active {
    background: var(--danger);
}

.photo-add-btn {
    width: 100%;
    margin-top: 4px;
}

/* ============================================================================
   Foto-Galerie (Vollbild-Lightbox) – Klick auf ein Tour-Bild
   ============================================================================ */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.img-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.img-lightbox-close {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: 14px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-lightbox-nav.prev { left: 12px; }
.img-lightbox-nav.next { right: 12px; }

.img-lightbox-close:hover,
.img-lightbox-close:active,
.img-lightbox-nav:hover,
.img-lightbox-nav:active {
    background: rgba(255, 255, 255, 0.3);
}

.img-lightbox-counter {
    position: absolute;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 999px;
}

/* ============================================================================
   Sharecard für Bild-Export (Instagram-Karussell)
   Normal unsichtbar und off-screen; nur während des html2canvas-Rendervorgangs
   (Klasse .sharecard-render) "aktiv", bleibt aber außerhalb des Viewports.
   Feste 1080px-Breite → quadratische/teilbare Bilder.
   ============================================================================ */
.sharecard {
    position: fixed;
    left: -10000px;       /* außerhalb des Viewports, aber im Layout messbar */
    top: 0;
    width: 1080px;
    height: 1350px;       /* FIX: festes 4:5-Verhältnis (Instagram-Feed, max. Größe).
                             Alle Sharecards identisch → Karussell wird nicht beschnitten. */
    overflow: hidden;     /* nichts ragt über die Leinwand hinaus */
    box-sizing: border-box;
    background: #ffffff;
    color: #0C447C;       /* Corporate-Blau */
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    z-index: -1;
    pointer-events: none;
}
.sharecard.sharecard-render { z-index: 0; }

/* ---- Seite 1: Übersicht ---- */
.sharecard-uebersicht {
    /* Höhe kommt aus .sharecard (fix 1350px). Footer wird per Flex unten gepinnt. */
    padding: 72px;                 /* Safe Area: nichts klebt am Rand */
    display: flex;
    flex-direction: column;
}
.sharecard-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.sharecard-titel {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 10px;
    color: #0C447C;
}
.sharecard-datum {
    font-size: 32px;
    color: #185FA5;
    margin-bottom: 40px;
}
.sharecard-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 48px;
    margin-bottom: 40px;
}
.sharecard-stat { min-width: 220px; }
.sharecard-stat-wert { font-size: 52px; font-weight: 700; color: #0C447C; line-height: 1.1; }
.sharecard-stat-label { font-size: 26px; color: #185FA5; margin-top: 2px; }

.sharecard-karte {
    width: 100%;
    height: 520px;
    object-fit: cover;
    border-radius: 28px;
    margin-bottom: 36px;
    background: #e9eef5;   /* Platzhalter, falls Karte fehlt */
}
.sharecard-bemerkung {
    font-size: 30px;
    line-height: 1.4;
    color: #2E86DE;
    margin-bottom: 8px;
}

.sharecard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 3px solid #2E86DE;
    padding-top: 28px;
    margin-top: 28px;
}
.sharecard-brand { font-size: 36px; font-weight: 800; color: #0C447C; white-space: nowrap; }
.sharecard-brand-claim { font-size: 26px; color: #185FA5; white-space: nowrap; }
.sharecard-brand-domain { font-weight: 700; color: #0C447C; }

/* ---- Folgeseiten: je ein Foto formatfüllend (4:5) ---- */
.sharecard-foto {
    width: 1080px;
    height: 1350px;
    padding: 0;
    position: relative;
    overflow: hidden;
    background: #0C447C;   /* Corporate-Blau als Fallback-Füllung, falls der
                              Blur-Layer (filter) nicht rendert – nie schwarz/weiß. */
}
/* Variante A: ganzes Motiv sichtbar (contain); freie Ränder mit unscharf
   vergrößerter Kopie desselben Fotos gefüllt → randlos, kein Motivverlust.
   WICHTIG: html2canvas 1.4.1 kann weder `object-fit` noch `filter: blur()`.
   Daher background-size (wird unterstützt); der Blur wird in share.js per
   Canvas2D vorgerechnet und als background-image gesetzt. */
.sharecard-foto-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;          /* formatfüllender (vorab unscharfer) Hintergrund */
    background-position: center;
    background-repeat: no-repeat;
}
.sharecard-foto-img {
    position: absolute;
    inset: 0;
    z-index: 1;                      /* scharfes Bild über dem Blur-Hintergrund */
    width: 100%;
    height: 100%;
    background-size: contain;        /* ganzes Motiv sichtbar, kein Beschnitt */
    background-position: center;
    background-repeat: no-repeat;
}
/* Branding UNTEREINANDER (Titel oben, Hinweis darunter auf eigener Zeile):
   So wird der Hinweis „erstellt mit Tourtagebuch.online" nie vom Titel
   verdrängt/abgeschnitten und ist auf Instagram immer komplett lesbar.
   Kräftigerer Verlauf + Textschatten sichern den Kontrast über jedem Foto. */
.sharecard-foto-footer {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 2;                         /* über Foto (z-index:1) und Blur-Hintergrund */
    padding: 150px 72px 72px;           /* Safe Area: Text klebt nirgends am Rand */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    background: linear-gradient(to top,
        rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0) 100%);
    color: #ffffff;
}
.sharecard-foto-titel {
    font-size: 40px; font-weight: 700; color: #ffffff;
    line-height: 1.15;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.sharecard-foto-footer .sharecard-brand-claim {
    font-size: 28px; font-weight: 600;
    color: #ffffff;
    white-space: normal;              /* darf umbrechen statt abzuschneiden */
    overflow-wrap: anywhere;
    max-width: 100%;
    text-shadow: 0 2px 8px rgba(0,0,0,0.75);
}

/* ============================================================================
   Bemerkung-Sheet (Vollbild) – Phase A
   ============================================================================ */

/* Klickbarer Trigger im Tour-Formular, der das Sheet öffnet.
   Sieht aus wie ein Textarea (Border, Padding, Hintergrund), ist aber ein
   <div role="button">, damit der Tap das Sheet öffnet statt eine native
   Tastatur. */
.bemerkung-trigger {
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    color: var(--ink);
    font-size: 15px;
    min-height: 80px;
    /* Begrenzt die Höhe der Trigger-Vorschau, damit lange Bemerkungen die
       darunterliegende Übersichtskarte (marker-overview-map) nicht vom Bildschirm
       schieben. Bei Überlauf scrollt der Inhalt innerhalb der Vorschau. */
    max-height: 120px;
    overflow-y: auto;
    cursor: text;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.bemerkung-trigger.empty {
    color: var(--muted);
}
.bemerkung-trigger:focus,
.bemerkung-trigger:active {
    outline: none;
    border-color: var(--primary-light);
}

/* Vollbild-Overlay. position:fixed mit inset:0 deckt die ganze Viewport-Fläche
   ab. Hintergrund-Gradient wie der page-bg, damit es im Look identisch wirkt. */
.bemerkung-sheet {
    position: fixed;
    inset: 0;
    background-color: var(--bg);
    background-image: var(--page-bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: bemerkung-slide-up 0.2s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}
@keyframes bemerkung-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.bemerkung-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 8px;
    gap: 12px;
    flex-shrink: 0;
}
.bemerkung-header-title {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.bemerkung-header-tour {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bemerkung-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.bemerkung-cancel {
    background: none;
    border: none;
    color: var(--ink-dim);
    font-size: 15px;
    padding: 8px 4px;
    cursor: pointer;
}
.bemerkung-done {
    -webkit-appearance: none;
    appearance: none;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
}

/* Aktionsleiste: drei nebeneinander liegende Buttons mit Icon + Label. */
.bemerkung-actions {
    display: flex;
    gap: 8px;
    padding: 8px 20px 12px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.bem-action {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    position: relative;
}
.bem-action svg {
    width: 22px;
    height: 22px;
}

/* "BALD"-Badge für Phase-B/C-Buttons, die noch nicht funktionieren.
   Visuelle Erwartungshaltung: Funktion ist geplant, aktuell deaktiviert. */
.bem-action.disabled {
    opacity: 0.45;
}
.bem-action.disabled::after {
    content: 'BALD';
    position: absolute;
    top: 4px;
    right: 6px;
    background: var(--warning);
    color: white;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 8px;
    letter-spacing: 0.05em;
    font-weight: 700;
    opacity: 1;
}

/* Aktiver Recording-Zustand (Mikrofon läuft). Roter Hintergrund + Pulse. */
.bem-action.recording {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    animation: bem-rec-pulse 1.2s infinite;
}
@keyframes bem-rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(163, 45, 45, 0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(163, 45, 45, 0); }
}

/* Textbereich: nimmt den verbleibenden Platz ein. Anwender hat gemeldet, dass
   Textarea + Karte + Marker-Liste fest verankert sein sollen — daher fixe Hoehen
   und nur die Memos-/Anlagen-Liste fuellt den verbleibenden Platz und scrollt
   intern. */
.bemerkung-textarea-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 20px 20px;
    min-height: 0;
    gap: 10px;
}
.bemerkung-textarea {
    flex: 0 0 auto;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    padding: 0;
    font-family: inherit;
    height: 140px;
    min-height: 140px;
    max-height: 30vh;
}
.bemerkung-textarea::placeholder {
    color: var(--muted);
}

/* Status-Hinweis (z.B. "Höre zu …" oder Fehlermeldung). */
.bemerkung-status {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--input-bg);
    border-radius: 8px;
    font-size: 12px;
    color: var(--ink-dim);
}
.bemerkung-status.show { display: block; }
.bemerkung-status.error {
    color: var(--danger);
    background: var(--danger-bg);
}

.bemerkung-counter {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    margin-top: 0;
    flex: 0 0 auto;
}

/* Marker-Block innerhalb des BemerkungSheet: feste Uebersichtskarte (innerhalb
   ihres Frames pan- und zoombar) ueber einer scrollenden Marker-Liste.
   Tap auf einen Listeneintrag schwenkt die Karte auf die Position. */
.bem-marker-block {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.bem-marker-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
}
.bem-marker-head-icon { font-size: 13px; }
.bem-marker-head-title { flex: 1; }
.bem-marker-head-count {
    background: var(--primary-tint, rgba(46, 134, 222, 0.12));
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 100px;
    font-size: 11px;
}
.bem-marker-map {
    width: 100%;
    height: 180px;
    flex: 0 0 180px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--input-bg);
    border: 1px solid var(--line);
    /* Touch-Action so beschraenken, dass das Pan-Gesten nicht versehentlich
       die Seite scrollen — Leaflet uebernimmt das Pan/Zoom innerhalb des Frames. */
    touch-action: none;
    /* Eigener Stacking-Context, damit die Leaflet-Panes innerhalb des Rahmens
       bleiben und nicht über andere Elemente hinausgezeichnet werden. */
    position: relative;
    z-index: 0;
}
.bem-marker-map .leaflet-container { font-family: inherit; }
.bem-marker-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}
.bem-marker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-elevated, #ffffff);
    border-radius: 8px;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.bem-marker-item:hover,
.bem-marker-item:active {
    background: var(--input-bg);
    border-color: var(--primary);
}
.bem-marker-item.pending {
    border-style: dashed;
}
.bem-marker-pin {
    color: var(--primary);
    flex-shrink: 0;
    display: flex;
}
.bem-marker-body {
    flex: 1;
    min-width: 0;
}
.bem-marker-coords {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bem-marker-acc {
    color: var(--muted);
    font-weight: 400;
    font-size: 11px;
    margin-left: 6px;
}
.bem-marker-time {
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bem-marker-pending-badge {
    background: var(--warning-bg);
    color: var(--warning);
    padding: 1px 6px;
    border-radius: 100px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bem-marker-del {
    background: none;
    border: none;
    color: var(--ink-dim);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.bem-marker-del:hover,
.bem-marker-del:active {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Confirm-Dialog "Verwerfen?" – Overlay mit zentriertem Dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.confirm-dialog {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 20px;
    max-width: 320px;
    width: 100%;
    border: 1px solid var(--line);
}
.confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
}
.confirm-body {
    font-size: 14px;
    color: var(--ink-dim);
    margin-bottom: 16px;
    line-height: 1.5;
}
.confirm-actions {
    display: flex;
    gap: 8px;
}
.confirm-actions button {
    flex: 1;
    min-height: 44px;
}

/* ============================================================================
   Marker-Block (Phase B - Position-Marker)
   ============================================================================ */

.marker-section {
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
}

.marker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.marker-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
}

.marker-add-btn {
    /* btn-secondary erbt schon Padding/Border/etc. – hier nur kompakter machen */
    padding: 8px 14px !important;
    min-height: 36px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}

.marker-hinweis {
    font-size: 12px;
    color: var(--warning);
    background: var(--warning-bg);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.marker-empty {
    font-size: 13px;
    color: var(--ink-dim);
    font-style: italic;
    padding: 4px 0;
}

.marker-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.marker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
}
.marker-item:last-child {
    border-bottom: none;
}
.marker-item.pending {
    /* leichter Akzent für Pending-Marker */
}

.marker-item-pin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-tint, rgba(46, 134, 222, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
}
.marker-item-pin svg {
    width: 16px;
    height: 16px;
}

.marker-item-body {
    flex: 1;
    min-width: 0;
}
.marker-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent, #0C447C);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 1px;
}
.marker-item-coords {
    font-size: 13px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Namens-Eingabe im Setzen-Dialog */
.marker-name-input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border, #ccc);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-elevated, #fff);
    color: var(--ink, #1a1a1a);
}
.marker-name-input:focus {
    outline: none;
    border-color: var(--accent, #185FA5);
}
/* Umbenennen-Feld im Marker-Detail-Sheet */
.marker-detail-rename {
    flex-shrink: 0;
    padding: 12px 16px 0;
}
.marker-detail-rename-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted, #888);
    margin-bottom: 4px;
}
.marker-detail-rename-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.marker-detail-rename-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border, #ccc);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-elevated, #fff);
    color: var(--ink, #1a1a1a);
}
.marker-detail-rename-input:focus {
    outline: none;
    border-color: var(--accent, #185FA5);
}
.marker-acc {
    color: var(--muted);
    font-size: 11px;
    margin-left: 8px;
}
.marker-item-time {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.marker-pending-badge {
    background: var(--warning-bg);
    color: var(--warning);
    padding: 1px 6px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.marker-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-dim);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.marker-remove:hover,
.marker-remove:active {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============================================================================
   Karten-Anzeige (Phase B.2 - Leaflet + OpenStreetMap)
   ============================================================================ */

/* Uebersichts-Karte oberhalb der Marker-Liste im Tour-Formular.
   Feste Hoehe ist Pflicht, sonst kollabiert Leaflet auf 0px. */
.marker-overview-map {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--input-bg);
    /* Leichter Schatten/Border, damit die Karte sich vom Hintergrund abhebt */
    border: 1px solid var(--line);
    /* Eigener Stacking-Context: Leaflet vergibt seinen Panes/Controls hohe
       z-index-Werte (200–1000). Ohne Stacking-Context entkommen diese aus dem
       Karten-Container und zeichnen sich über darüberliegende Overlays wie das
       Bemerkungs-Sheet (z-index 100) – die Karte "blutet" rahmenlos durch.
       position:relative + z-index hält die Panes innerhalb des Containers. */
    position: relative;
    z-index: 0;
}

/* Tap-bare Vorschaukarte: umschließt die statische .marker-overview-map und
   öffnet bei Tap die interaktive Vollbildansicht. Der Hinweis-Chip oben rechts
   signalisiert die Tap-Funktion. */
.map-preview {
    position: relative;
    margin-bottom: 12px;
    cursor: pointer;
}
.map-preview .marker-overview-map {
    margin-bottom: 0;
}
.map-preview-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;                 /* über den Leaflet-Panes (Karte ist z-index:0) */
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.map-preview-hint svg { width: 14px; height: 14px; }

/* Rundes „×" zum Beenden der Vollbild-Kartenansicht. */
.map-fullscreen-x {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--input-bg);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-fullscreen-x:active { background: var(--line); }

/* Klickbare Marker-Items: Hover-Feedback und Cursor */
.marker-item.clickable {
    cursor: pointer;
    transition: background 0.12s;
}
.marker-item.clickable:hover,
.marker-item.clickable:active {
    background: var(--input-bg);
    border-radius: 8px;
}

/* Marker-Detail-Sheet (Vollbild mit grosser Karte) */
.marker-detail-sheet {
    position: fixed;
    inset: 0;
    background-color: var(--bg);
    background-image: var(--page-bg);
    z-index: 105;
    display: flex;
    flex-direction: column;
    animation: bemerkung-slide-up 0.2s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.marker-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--line);
}
.marker-detail-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.marker-detail-map {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: var(--input-bg);
}

.marker-detail-footer {
    flex-shrink: 0;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.marker-detail-coords {
    font-size: 14px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.marker-detail-acc {
    color: var(--muted);
    font-size: 12px;
    margin-left: 8px;
}
.marker-detail-actions {
    display: flex;
    gap: 8px;
}
.marker-detail-extlink {
    flex: 1;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Leaflet ueberschreibt die font-family per default mit serif-Stack -
   wir wollen ueberall Inter haben. */
.leaflet-container,
.leaflet-popup-content,
.leaflet-control-attribution {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
    font-size: 12px;
}
.leaflet-popup-content b {
    color: var(--ink);
}
.marker-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100; /* gleicher Level wie .bemerkung-sheet */
    display: none;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

    .marker-detail-sheet.open {
        display: flex;
    }

/* Header: Schließen-Button links, Titel mittig */
.marker-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    flex: 0 0 auto;
}

.marker-detail-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5rem;
}

/* Karten-Bereich: füllt den verfügbaren Platz zwischen Header und Footer.
   min-height:0 ist auf flex-Children unter Safari/iOS zwingend, sonst dehnt
   sich der Container über den Viewport hinaus. */
.marker-detail-map {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background: var(--surface, #e5e3df);
}

/* Footer: Koordinaten + Karten-App-Button */
.marker-detail-footer {
    flex: 0 0 auto;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    /* Safe-Area für iPhone-Home-Indikator */
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.marker-detail-coords {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.marker-detail-acc {
    margin-left: 0.5rem;
    color: var(--text-muted, #777);
    font-size: 0.85rem;
}

.marker-detail-actions {
    display: flex;
    justify-content: center;
}

.marker-detail-extlink {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}

    .marker-detail-extlink:hover,
    .marker-detail-extlink:active {
        background: var(--surface, rgba(0,0,0,0.04));
    }

/* Header-Spacer: gleiche Breite wie der "Schließen"-Button rechts vom Titel,
   damit der Titel optisch mittig steht. Falls .bemerkung-cancel im Projekt
   eine andere Breite hat, hier identisch ziehen. */
.marker-detail-header-spacer {
    flex: 0 0 auto;
    width: 64px; /* ≈ Breite des "Schließen"-Buttons */
    height: 1px; /* Platzhalter, unsichtbar */
}
.tour-card-anlage {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    /* leichter Abstand zu den anderen Meta-Items, falls .tour-card-meta keinen
       gap definiert hat. Wenn dort schon flex-gap gesetzt ist, schadet das nicht. */
    color: var(--text-muted, #666);
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
}
 
.tour-card-anlage svg {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}
/* ============================================================================
   Marker-Detail-Sheet (Vollbild-Overlay mit großer Karte)
   ----------------------------------------------------------------------------
   Behebt N2 vom 06.05.2026:
     Beim Tap auf einen Marker im TourFormular wurde die Karte gleichzeitig
     mit der Tour-Übersichtskarte angezeigt (zwei Karten übereinander im
     Dokumentenfluss), weil .marker-detail-sheet keinen Layout-Effekt hatte.

   Pattern analog zu .bemerkung-sheet.open: position:fixed; inset:0; z-index hoch.

   Diese Regeln ergänzend zur bestehenden Mobil-App-Stylesheet einfügen
   (z.B. ans Ende von wwwroot/css/app.css).
   ============================================================================ */

.marker-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;             /* gleicher Level wie .bemerkung-sheet */
    display: none;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

.marker-detail-sheet.open {
    display: flex;
}

/* Header: Schließen-Button links, Titel mittig */
.marker-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    flex: 0 0 auto;
}

.marker-detail-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5rem;
}

/* Karten-Bereich: füllt den verfügbaren Platz zwischen Header und Footer.
   min-height:0 ist auf flex-Children unter Safari/iOS zwingend, sonst dehnt
   sich der Container über den Viewport hinaus. */
.marker-detail-map {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background: var(--surface, #e5e3df);
}

/* Footer: Koordinaten + Karten-App-Button */
.marker-detail-footer {
    flex: 0 0 auto;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    /* Safe-Area für iPhone-Home-Indikator */
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.marker-detail-coords {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.marker-detail-acc {
    margin-left: 0.5rem;
    color: var(--text-muted, #777);
    font-size: 0.85rem;
}

.marker-detail-actions {
    display: flex;
    justify-content: center;
}

.marker-detail-extlink {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}

.marker-detail-extlink:hover,
.marker-detail-extlink:active {
    background: var(--surface, rgba(0,0,0,0.04));
}

/* Header-Spacer: gleiche Breite wie der "Schließen"-Button rechts vom Titel,
   damit der Titel optisch mittig steht. Falls .bemerkung-cancel im Projekt
   eine andere Breite hat, hier identisch ziehen. */
.marker-detail-header-spacer {
    flex: 0 0 auto;
    width: 64px;        /* ≈ Breite des "Schließen"-Buttons */
    height: 1px;        /* Platzhalter, unsichtbar */
}
.tour-card-anlage {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    /* leichter Abstand zu den anderen Meta-Items, falls .tour-card-meta keinen
       gap definiert hat. Wenn dort schon flex-gap gesetzt ist, schadet das nicht. */
    color: var(--text-muted, #666);
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
}

.tour-card-anlage svg {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}
/* ============================================================================
   Marker-Detail-Sheet (Vollbild-Overlay mit großer Karte)
   ----------------------------------------------------------------------------
   Behebt N2 vom 06.05.2026:
     Beim Tap auf einen Marker im TourFormular wurde die Karte gleichzeitig
     mit der Tour-Übersichtskarte angezeigt (zwei Karten übereinander im
     Dokumentenfluss), weil .marker-detail-sheet keinen Layout-Effekt hatte.

   Pattern analog zu .bemerkung-sheet.open: position:fixed; inset:0; z-index hoch.

   Diese Regeln ergänzend zur bestehenden Mobil-App-Stylesheet einfügen
   (z.B. ans Ende von wwwroot/css/app.css).
   ============================================================================ */

.marker-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;             /* gleicher Level wie .bemerkung-sheet */
    display: none;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

.marker-detail-sheet.open {
    display: flex;
}

/* Header: Schließen-Button links, Titel mittig */
.marker-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    flex: 0 0 auto;
}

.marker-detail-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5rem;
}

/* Karten-Bereich: füllt den verfügbaren Platz zwischen Header und Footer.
   min-height:0 ist auf flex-Children unter Safari/iOS zwingend, sonst dehnt
   sich der Container über den Viewport hinaus. */
.marker-detail-map {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background: var(--surface, #e5e3df);
}

/* Footer: Koordinaten + Karten-App-Button */
.marker-detail-footer {
    flex: 0 0 auto;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated, var(--bg));
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    /* Safe-Area für iPhone-Home-Indikator */
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.marker-detail-coords {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.marker-detail-acc {
    margin-left: 0.5rem;
    color: var(--text-muted, #777);
    font-size: 0.85rem;
}

.marker-detail-actions {
    display: flex;
    justify-content: center;
}

.marker-detail-extlink {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}

.marker-detail-extlink:hover,
.marker-detail-extlink:active {
    background: var(--surface, rgba(0,0,0,0.04));
}

/* Header-Spacer: gleiche Breite wie der "Schließen"-Button rechts vom Titel,
   damit der Titel optisch mittig steht. Falls .bemerkung-cancel im Projekt
   eine andere Breite hat, hier identisch ziehen. */
.marker-detail-header-spacer {
    flex: 0 0 auto;
    width: 64px;        /* ≈ Breite des "Schließen"-Buttons */
    height: 1px;        /* Platzhalter, unsichtbar */
}
/* ============================================================================
   PATCH 09.05.2026 - Phase C: Anlagen-Liste im Bemerkung-Sheet
                                + Stat-Leiste im Tour-Formular

   Diesen Block ans Ende der bestehenden app.css einfuegen (oder logisch nach
   dem Bereich .bemerkung-counter, je nach Geschmack).

   Verwendet die gleichen CSS-Variablen wie der Rest der App
   (--bg-elevated, --line, --ink, --primary-light, --warning, --danger),
   damit hell/dunkel automatisch funktionieren.
   ============================================================================ */

/* ----- Anlagen-Liste im Bemerkung-Sheet ------------------------------- */

.bem-anlagen {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    /* Anlagen-/Memo-Liste fuellt den verbleibenden Platz im Sheet und scrollt
       intern, damit Textarea, Karte und Marker-Liste fest verankert bleiben. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.bem-anlagen-titel {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 8px;
}

.bem-anlage {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 6px;
}

    .bem-anlage.memo {
        /* Memos heben sich leicht durch Akzent-Farbe links ab */
        border-left: 3px solid var(--primary-light);
    }

    .bem-anlage.pending {
        /* Pending-Memos: dezent warning-getoent */
        border-left-color: var(--warning);
    }

.bem-anlage-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.bem-anlage-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bem-anlage-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bem-anlage-meta {
    font-size: 11px;
    color: var(--muted);
}

.bem-anlage-pending-badge {
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Play- und Loesch-Buttons - quadratisch, Touch-Target 36x36 */
.bem-anlage-play,
.bem-anlage-del {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

    .bem-anlage-play:hover {
        background: var(--input-bg);
        border-color: var(--primary-light);
        color: var(--primary-light);
    }

.bem-anlage-del {
    color: var(--danger);
    font-size: 18px;
    line-height: 1;
}

    .bem-anlage-del:hover {
        background: var(--danger-bg);
        border-color: var(--danger);
    }

/* ----- Stat-Leiste unter Bemerkung-Trigger im Tour-Formular ----------- */

.bem-stat-leiste {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    color: var(--muted);
}

    .bem-stat-leiste.empty {
        display: none;
    }

.bem-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .bem-stat-item.active {
        color: var(--primary-light);
        font-weight: 600;
    }

.bem-stat-item-icon {
    font-size: 14px;
}
