/* ═══════════════════════════════════════════════════════════════════════════
   Lerngemeinschaft – Dokumentation
   Editorial / Document design system
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Dark UI — neutral grays mit Weiß als Sekundärfarbe */
  --paper:        #18181B;   /* Hauptbackground (zinc-900, gelifted gegenüber pitch-black) */
  --paper-deep:   #101013;   /* leicht tiefer für Header-Bereiche */
  --surface:      #232328;   /* Karten / Tabellen — klar von paper abgesetzt */
  --surface-2:    #2A2A30;   /* Hover-States, hervorgehobene Karten */
  --ink:          #F4F4F5;   /* zinc-100 */
  --ink-soft:     #D4D4D8;
  --ink-mute:     #A1A1AA;   /* heller als zuvor — bessere Lesbarkeit */
  --ink-faint:    #71717A;
  --line:         #3F3F46;   /* zinc-700, sichtbarer */
  --line-soft:    #2D2D32;
  --accent:       #FFFFFF;                          /* Sekundärfarbe: weiß */
  --accent-dark:  #E4E4E7;                          /* Hover (leicht abgedunkelt) */
  --accent-soft:  rgba(255, 255, 255, 0.10);        /* Pills & Chips */
  --accent-tint:  rgba(255, 255, 255, 0.04);        /* sehr subtile Hintergründe */
  --danger:       #F87171;
  --danger-soft:  #2A1414;
  --success:      #4ADE80;

  /* Typography */
  --font-serif:   'Fraunces', 'Playfair Display', Georgia, serif;
  --font-sans:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Sizing */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 1px rgba(0, 0, 0, 0.20);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.40), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55), 0 6px 12px rgba(0, 0, 0, 0.30);
}

/* Color scheme hint für Browser-Controls (Scrollbars, Datepicker etc.) */
html { color-scheme: dark; }

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select, button { font-family: inherit; }
table { border-collapse: collapse; }
ul, ol { padding: 0; margin: 0; list-style: none; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Subtile Textur via radial dots — ganz dezent in cool gray */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle at 25% 25%, rgba(244, 244, 245, 0.025) 1px, transparent 2px);
  background-size: 36px 36px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  letter-spacing: -0.02em;
}

.brand-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 2px;
}

.year-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}

/* Sync-Status-Dot — zeigt Verbindung zu Firebase */
.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: background 200ms ease, box-shadow 200ms ease;
  flex-shrink: 0;
}
.sync-dot[data-status="connecting"] {
  background: #FBBF24;
  animation: syncPulse 1.4s ease-in-out infinite;
}
.sync-dot[data-status="online"] {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.sync-dot[data-status="offline"] {
  background: var(--ink-faint);
}
.sync-dot[data-status="error"] {
  background: var(--danger);
}
@keyframes syncPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

.year-picker-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 600;
}

.year-select {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAB NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
.tabnav {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 2px;
  padding: 0 36px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabnav::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 2px solid transparent;
  color: var(--ink-mute);
  white-space: nowrap;
  transition: all 160ms ease;
  border-radius: 0;
}

.tab:hover { color: var(--ink); }

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

.tab.is-active .tab-num { color: var(--accent); }

.tab-label {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.005em;
}

/* Tab-Icons sind nur auf Mobile sichtbar (siehe Responsive-Block) */
.tab-icon { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT / VIEWS
   ═══════════════════════════════════════════════════════════════════════════ */
.content {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 36px 80px;
}

.view { display: none; }
.view.is-active { display: block; animation: fadeUp 280ms ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-head {
  margin-bottom: 32px;
}

.view-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.page-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(32px, 4.5vw, 48px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}

.page-title-num {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.7em;
  vertical-align: 0.15em;
  margin-left: 8px;
  color: var(--accent);
  letter-spacing: 0;
}

.page-sub {
  margin: 10px 0 0;
  color: var(--ink-mute);
  font-size: 16px;
  max-width: 60ch;
}

/* Kompakter Titel im Monat-View — nur Monatsname, klickbar für Picker */
.page-title--month {
  font-size: clamp(22px, 3.4vw, 28px);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1;
}
.view-head-month { margin-bottom: 14px; }

.month-nav-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.month-nav-inline .icon-btn {
  flex-shrink: 0;
}

/* Klickbarer Titel = Label mit verstecktem <select> dahinter — Tap öffnet
   den nativen Monats-Picker (auf iOS das Wheel, auf Android das Drop-Down). */
.month-title-pick {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 140ms ease;
}
.month-title-pick:hover { background: rgba(255, 255, 255, 0.05); }
.month-title-pick:active { background: rgba(255, 255, 255, 0.08); }

.month-select-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  font: inherit;
  color: transparent;
}

.month-pick-caret {
  font-size: 14px;
  color: var(--ink-mute);
  pointer-events: none;
  position: relative;
  top: -2px;
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  color: var(--ink);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   STAT ROW (Übersicht)
   ═══════════════════════════════════════════════════════════════════════════ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 12px;
}

.stat-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.stat-unit {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MONTH GRID (Übersicht)
   ═══════════════════════════════════════════════════════════════════════════ */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.month-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all 180ms ease;
  position: relative;
  overflow: hidden;
}

.month-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 180ms ease;
}

.month-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.month-card:hover::before { transform: scaleY(1); }

.month-card.is-empty {
  background: var(--paper-deep);
  border-style: dashed;
  border-color: var(--line);
}
.month-card.is-empty .month-card-num { color: var(--ink-faint); }
.month-card.is-empty .month-card-name { color: var(--ink-mute); }

.month-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.month-card-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.month-card-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}

.month-card-stats {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-mute);
}

.month-card-stat {
  display: flex;
  flex-direction: column;
}
.month-card-stat-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.1;
}
.month-card-stat-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE (Monatsansicht)
   ═══════════════════════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;   /* iOS-Momentum-Scroll */
  margin-top: 8px;
}
/* Schlanker Scrollbar im Dark-Theme */
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

.data-table {
  width: 100%;
  min-width: 580px;            /* erzwingt Horizontal-Scroll auf Mobile */
  font-size: 14px;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--paper-deep);
  white-space: nowrap;
}
.data-table thead th:last-child { border-right: 0; }

.data-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid rgba(255, 255, 255, 0.035);
  vertical-align: top;
}
.data-table tbody td:last-child { border-right: 0; }

.data-table tfoot td {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.data-table tfoot td:last-child { border-right: 0; }

.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table tbody tr {
  transition: background 100ms ease;
}
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

.data-table .col-nr { width: 56px; }
.data-table .col-date { width: 120px; }
.data-table .col-target { width: 220px; }
.data-table .col-anlass { min-width: 240px; }
.data-table .col-km { width: 110px; text-align: right; }
.data-table .col-transport { width: 130px; }
.data-table .col-actions { width: 80px; text-align: right; }

.data-table .num {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
}

.cell-nr {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.cell-date {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.cell-target-name {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.cell-target-addr {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.4;
}
.cell-target-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DATE-PICKER (eigenes UI im App-Design)
   ═══════════════════════════════════════════════════════════════════════════ */
.datepicker-monthnav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.datepicker-title {
  font-size: 18px;
  margin: 0;
  min-width: 160px;
  text-align: center;
}
.datepicker-body { padding-top: 8px; padding-bottom: 8px; }

.datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 4px 0;
  margin-bottom: 4px;
}
.datepicker-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-day {
  display: grid;
  place-items: center;
  height: 40px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, transform 80ms ease;
}
.dp-day:hover  { background: rgba(255, 255, 255, 0.06); }
.dp-day:active { transform: scale(0.94); }
.dp-day.is-other-month {
  color: var(--ink-faint);
  opacity: 0.5;
}
.dp-day.is-today {
  border-color: rgba(255, 255, 255, 0.30);
  font-weight: 700;
}
.dp-day.is-selected {
  background: var(--accent);
  color: var(--paper);
  font-weight: 700;
}
.dp-day.is-selected:hover { background: var(--accent-dark); }

/* Pille für Vorlage-Einträge ohne Datum — Klick öffnet eigenen Date-Picker */
.cell-date-missing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, transform 80ms ease;
  min-height: 30px;
}
.cell-date-missing:hover { background: rgba(248, 113, 113, 0.22); }
.cell-date-missing:active { transform: scale(0.97); }
.cell-date-missing-text { pointer-events: none; }

/* Datum-Button (für bereits gesetzte Daten — Klick öffnet Picker zum Ändern) */
.cell-date-btn {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background 120ms ease;
}
.cell-date-btn:hover { background: rgba(255, 255, 255, 0.06); }

.data-table tbody tr.is-pending { background: rgba(248, 113, 113, 0.04); }
.data-table tbody tr.is-pending:hover { background: rgba(248, 113, 113, 0.10); }
.data-table tbody tr.is-pending .cell-nr { color: var(--danger); }

.cell-anlass {
  color: var(--ink-soft);
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.row-actions-inline {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-mute);
  transition: all 120ms ease;
  font-size: 14px;
}
.icon-btn-sm:hover {
  background: var(--paper-deep);
  color: var(--ink);
}
.icon-btn-sm.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.data-table tfoot td {
  padding: 2px 14px;                 /* sehr kompakt — vorher 14px */
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
  font-weight: 600;
  font-size: 10px;
  line-height: 1.4;
}
.data-table tfoot .num { font-size: 10px; }
.sum-label {
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 64px 32px;
}
.empty-icon { font-size: 36px; margin-bottom: 16px; filter: grayscale(0.2); }
.empty-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 6px;
}
.empty-sub {
  color: var(--ink-mute);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXPORT BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 18px 22px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-md);
}

.export-bar-label {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--accent-dark);
}

.export-bar-actions {
  display: flex;
  gap: 8px;
}

.btn-icon { margin-right: 6px; }

/* ═══════════════════════════════════════════════════════════════════════════
   PEOPLE GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.person-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  transition: all 180ms ease;
}

.person-card:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.person-card.is-self {
  background: var(--accent-tint);
  border-color: var(--accent-soft);
}

.person-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.person-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  flex-shrink: 0;
}
.person-card.is-self .person-avatar {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.person-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.person-role {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 2px;
  font-weight: 600;
}

.person-info {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.5;
  margin-bottom: 14px;
  white-space: pre-line;
}

.person-stats {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  margin-top: auto;
}

.person-stat {
  display: flex;
  flex-direction: column;
}
.person-stat-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}
.person-stat-label {
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.person-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARD (settings)
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 28px 32px;
  margin-bottom: 20px;
}

.card .section-title { margin-bottom: 6px; }

.card-sub {
  margin: 0 0 22px;
  color: var(--ink-mute);
  font-size: 14px;
}

/* Collapsible-Cards (details/summary) */
details.card {
  padding: 0;
  overflow: hidden;
}
.card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease;
}
.card-summary::-webkit-details-marker { display: none; }
.card-summary::marker { content: ''; }
.card-summary:hover { background: rgba(255, 255, 255, 0.02); }
.card-summary .section-title { margin: 0; }
.card-chevron {
  display: inline-block;
  font-size: 14px;
  color: var(--ink-mute);
  transition: transform 220ms ease;
  flex-shrink: 0;
}
details[open] > .card-summary .card-chevron { transform: rotate(180deg); }
.card-body {
  padding: 0 24px 22px;
  animation: cardBodyIn 200ms ease;
}
@keyframes cardBodyIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-body .card-sub:first-child { margin-top: 0; }

.card-sub code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--paper-deep);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--accent-dark);
}

.card-danger {
  border-color: rgba(248, 113, 113, 0.25);   /* var(--danger) mit alpha */
  background: var(--danger-soft);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .field-wide { grid-column: 1 / -1; }
.form-grid .form-actions { grid-column: 1 / -1; }

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-grow { flex: 1; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  font-style: italic;
}

.input {
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: all 140ms ease;
  width: 100%;
}

.input:hover { border-color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.textarea {
  resize: vertical;
  font-family: var(--font-sans);
  min-height: 56px;
  line-height: 1.5;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%238B8B91' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: all 140ms ease;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover {
  border-color: var(--ink);
  background: var(--paper-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-mute);
}
.btn-ghost:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.btn-danger {
  background: var(--danger);
  color: #1A0A0A;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #FB8B8B;       /* etwas heller statt dunkler im Dark-Theme */
  border-color: #FB8B8B;
  color: #1A0A0A;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-mute);
  transition: all 140ms ease;
  font-size: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--surface);
}

.select {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%238B8B91' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  cursor: pointer;
}
.select:hover { border-color: var(--ink-faint); }
.select:focus { outline: none; border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 250;          /* über dem Login-Screen (200) */
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}

#confirmModal { z-index: 260; }   /* Confirm-Dialog immer ganz oben */

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 240ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.modal-panel-narrow { max-width: 420px; }
.modal-panel-wide   { max-width: 640px; }

.modal-sub {
  margin: 6px 0 0;
  color: var(--ink-mute);
  font-size: 13px;
  max-width: 50ch;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
}

.modal-foot-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.confirm-msg {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABWESENHEITEN
   ═══════════════════════════════════════════════════════════════════════════ */
.absences-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.absence-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.absence-row.is-current {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--surface-2);
}

.absence-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  flex-shrink: 0;
}
.absence-info { flex: 1; min-width: 0; }
.absence-name { font-weight: 600; font-size: 15px; }
.absence-range {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.absence-note {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  font-style: italic;
}
.absence-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.absences-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--ink-mute);
}
.absences-empty-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP-INFO / HILFE
   ═══════════════════════════════════════════════════════════════════════════ */
.info-body { padding-top: 16px; }
.info-section + .info-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.info-h {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 8px;
  color: var(--ink);
}
.info-section p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}
.info-section ul {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}
.info-section li {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 6px;
}
.info-section strong { color: var(--ink); font-weight: 600; }
.info-section em { color: var(--ink); font-style: italic; }

/* ═══════════════════════════════════════════════════════════════════════════
   USER-MANAGER LIST
   ═══════════════════════════════════════════════════════════════════════════ */
.manager-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manager-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  transition: opacity 160ms ease, background 140ms ease;
}
.manager-row.is-archived {
  opacity: 0.5;
}

.manager-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  flex-shrink: 0;
}

.manager-info { flex: 1; min-width: 0; }
.manager-name { font-weight: 600; font-size: 15px; }
.manager-meta { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.manager-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: center;
}

/* iOS-style switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease;
}
.switch-track::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--ink);
  border-radius: 50%;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
.switch input:checked + .switch-track {
  background: rgba(255, 255, 255, 0.30);
}
.switch input:checked + .switch-track::before {
  transform: translateX(20px);
  background: #FFFFFF;
}
.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 240ms ease;
}
.toast.is-success { background: var(--success); }
.toast.is-error { background: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — iPhone-/Smartphone-optimiert
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* TOPBAR — sticky, translucent, mit safe-area-Inset */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 16px 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    gap: 10px;
    flex-wrap: nowrap;
    background: rgba(24, 24, 27, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid var(--line);
  }
  .brand-mark { width: 36px; height: 36px; font-size: 22px; }
  .brand-title { font-size: 17px; }
  .brand-sub { display: none; }
  .topbar-right { gap: 6px; flex-shrink: 0; }
  .year-picker { padding: 4px 8px; }
  .year-picker-label { display: none; }
  .year-select { font-size: 13px; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; }
  .user-chip-caret { display: none; }

  /* TAB-BAR — am unteren Rand wie eine native iPhone-App */
  .tabnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    background: rgba(24, 24, 27, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 0.5px solid var(--line);
    border-bottom: 0;
    z-index: 50;
    justify-content: space-around;
  }
  .tab {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 2px 6px;
    min-width: 0;                  /* nicht über die flex-1 Breite hinaus */
    min-height: 56px;
    margin: 0 2px;
    border-bottom: 0;
    border-radius: 14px;
    text-align: center;
    color: var(--ink-mute);
    transition: background 160ms ease, color 160ms ease, transform 80ms ease;
    position: relative;
  }
  .tabnav { padding: 6px 2px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .tab:active { transform: scale(0.94); }
  .tab-icon {
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    color: inherit;
    transition: color 160ms ease, transform 160ms ease;
  }
  .tab-num { display: none; }
  .tab-label {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.02em;
    line-height: 1;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  .tab.is-active {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 0;
  }
  .tab.is-active .tab-icon {
    transform: translateY(-1px);
  }
  .tab.is-active .tab-label { font-weight: 700; }
  .tab.is-active::after { content: none; }     /* alter Punkt-Indikator entfällt */

  /* CONTENT — Platz für Bottom-Tabbar lassen + Puffer für Export-Bar */
  .content {
    padding: 24px 16px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
    max-width: 100%;
  }

  /* GROßZÜGIGE TOUCH-TARGETS */
  .btn { min-height: 44px; padding: 11px 18px; font-size: 15px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .icon-btn-sm { min-width: 36px; min-height: 36px; font-size: 16px; }
  .input { min-height: 44px; padding: 11px 14px; font-size: 16px; /* iOS no-zoom */ }
  .select { min-height: 38px; }
  .switch { width: 50px; height: 28px; }
  .switch-track::before { height: 22px; width: 22px; }
  .switch input:checked + .switch-track::before { transform: translateX(22px); }

  /* GRÖSSERE RUNDUNGEN AUF MOBILE — wirkt iPhone-mäßig */
  .stat, .month-card, .person-card, .card, .login-user, .table-wrap,
  .modal-panel, .dist-row, .manager-row, .export-bar, .empty-state,
  .login-empty {
    border-radius: 14px;
  }
  .brand-mark, .login-mark { border-radius: 10px; }

  /* HEADER-ROW (View Title + Actions) — vertikal gestapelt */
  .view-head-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .view-actions { justify-content: stretch; flex-wrap: wrap; gap: 8px; }
  .view-actions .btn { flex: 1; }
  .page-title { font-size: 32px; }
  .page-title--month { font-size: 22px; }

  /* TABELLE — vereinfacht auf Mobile */
  .data-table .col-target { display: none; }
  .data-table .col-anlass { display: none; }
  .data-table .col-transport { display: none; }
  .data-table thead th,
  .data-table tbody td { padding: 14px 10px; font-size: 14px; }

  /* FORMS — Vollbreite, mehr Luft */
  .form-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .field-label { font-size: 11px; }
  .card { padding: 20px; }

  /* Einstellungen-Karten kompakter (collapsible details) */
  #view-settings .card { padding: 0; margin-bottom: 10px; }
  #view-settings .card-summary { padding: 12px 14px; }
  #view-settings .card-body { padding: 0 14px 12px; }
  #view-settings .section-title { font-size: 15px; margin-bottom: 4px; }
  #view-settings .card-sub { font-size: 12px; margin-bottom: 12px; line-height: 1.4; }
  #view-settings .form-grid,
  #view-settings .form-stack { gap: 8px; }
  #view-settings .field { gap: 3px; }
  #view-settings .field-label { font-size: 10px; }
  #view-settings .input { min-height: 36px; padding: 7px 10px; font-size: 14px; }
  #view-settings .form-actions { margin-top: 4px; }
  #view-settings .form-actions .btn { min-height: 36px; padding: 8px 14px; font-size: 13px; }
  #view-settings .page-title { font-size: 26px; }
  #view-settings .page-sub { font-size: 13px; margin-top: 4px; }
  #view-settings .eyebrow { font-size: 10px; }
  #view-settings .view-head { margin-bottom: 16px; }
  /* Distanzen-Editor auch kompakter */
  #view-settings .dist-row { padding: 10px 12px; gap: 10px; }
  #view-settings .dist-avatar { width: 32px; height: 32px; font-size: 13px; }
  #view-settings .dist-name { font-size: 13px; }
  #view-settings .dist-addr { font-size: 11px; }

  /* MODAL — Bottom-Sheet-Style */
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel {
    border-radius: 18px 18px 0 0;
    max-height: 90vh;
    width: 100%;
    max-width: 100%;
    animation: sheetIn 320ms cubic-bezier(0.2, 0.85, 0.35, 1.05);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-panel-narrow { max-width: 100%; }
  .modal-panel-wide { max-width: 100%; }
  .modal-head { padding: 18px 20px 12px; }
  .modal-body { padding: 18px 20px; }
  .modal-foot { padding: 14px 20px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  /* Login-Screen mit safe-area */
  .login-screen { padding-top: max(32px, env(safe-area-inset-top)); padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .login-users { grid-template-columns: 1fr; }

  /* Stats grid: 2 columns */
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 16px 18px; }
  .stat-value { font-size: 30px; }

  /* Month grid: 1 column for big tap targets */
  .month-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .month-card { padding: 16px 18px; }
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media (max-width: 480px) {
  .month-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 28px; }
  .stat-value { font-size: 28px; }
}

@media print {
  .topbar, .tabnav, .view-actions, .export-bar, .row-actions-inline, .person-actions,
  .login-screen, .modal, .toast {
    display: none !important;
  }
  body { background: white; color: #000; }
  body::before { display: none; }
  .card, .table-wrap, .stat, .month-card, .person-card {
    background: white !important;
    color: #000 !important;
    border-color: #ccc !important;
    box-shadow: none !important;
  }
  .data-table thead th, .data-table tfoot td {
    background: #f3f3f3 !important;
    color: #000 !important;
    border-color: #ccc !important;
  }
  .page-title, .section-title, .stat-value, .month-card-name { color: #000 !important; }
  .eyebrow, .cell-nr, .month-card-num { color: #B45309 !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.04), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(255, 255, 255, 0.02), transparent 55%),
    var(--paper);
  overflow-y: auto;
  animation: fadeIn 280ms ease both;
}

.login-inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 4px;
}

.login-mark {
  width: 64px;
  height: 64px;
  font-size: 38px;
  border-radius: var(--r-lg);
}

.login-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.login-sub {
  margin-top: 6px;
  color: var(--ink-mute);
  font-size: 15px;
  max-width: 50ch;
}

.login-users {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.login-user {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all 180ms ease;
  position: relative;
  overflow: hidden;
}

.login-user::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 200ms ease;
}

.login-user:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.login-user:hover::before { transform: scaleY(1); }

.login-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent-dark);
  flex-shrink: 0;
}

.login-user-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.login-user-meta {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
}

.login-foot {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.login-empty {
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--ink-mute);
}
.login-empty-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.login-empty-sub { font-size: 13px; max-width: 38ch; margin: 0 auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   USER CHIP (TOPBAR) + USER MENU
   ═══════════════════════════════════════════════════════════════════════════ */
.topbar-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: all 140ms ease;
}
.user-chip:hover {
  border-color: var(--ink);
  background: var(--paper-deep);
}

.user-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);              /* dunkle Schrift auf weißem Avatar */
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  text-align: left;
}

.user-chip-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

.user-chip-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.user-chip-caret {
  font-size: 10px;
  color: var(--ink-mute);
  margin-left: 2px;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  overflow: hidden;
  animation: menuIn 180ms ease;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-menu-head {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.user-menu-list {
  display: flex;
  flex-direction: column;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-align: left;
  border-radius: 0;
  transition: background 100ms ease;
}
.user-menu-item:hover { background: var(--paper-deep); }
.user-menu-item.is-current {
  background: var(--accent-tint);
}

.user-menu-item-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-menu-item.is-current .user-menu-item-avatar {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

/* Archivierte User im Dropdown: ausgegraut, nicht klickbar wirkend */
.user-menu-item.is-archived {
  opacity: 0.45;
  cursor: not-allowed;
}
.user-menu-item.is-archived:hover { background: transparent; }
.user-menu-item.is-archived .user-menu-item-avatar {
  background: var(--paper-deep);
  border-color: var(--line-soft);
}
.user-menu-item-mark--archived {
  color: var(--ink-mute) !important;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 7px;
  border-radius: 999px;
}

.user-menu-item-name {
  font-weight: 600;
  font-size: 14px;
}

.user-menu-item-mark {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent-dark);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.user-menu-foot {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  padding: 6px;
}

.user-menu-action {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 120ms ease;
}
.user-menu-action:hover {
  background: var(--surface);
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DISTANCES EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */
.distances-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  transition: border-color 120ms ease;
}
.dist-row:hover { border-color: var(--ink-faint); background: var(--surface); }

.dist-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  flex-shrink: 0;
}

.dist-info { flex: 1; min-width: 0; }
.dist-name { font-weight: 600; font-size: 14px; }
.dist-addr { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.dist-input {
  width: 110px;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  text-align: right;
}
.dist-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.dist-unit {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-mute);
  margin-left: -6px;
}

.dist-warn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PEOPLE — current user marker
   ═══════════════════════════════════════════════════════════════════════════ */
.person-card.is-current {
  background: var(--accent-tint);
  border-color: var(--accent-soft);
}
.person-card.is-current .person-avatar {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE additions (für Distanzen-Editor + Login auf engen Screens)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dist-row { flex-wrap: wrap; }
  .dist-input { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE-OVERRIDES — am Datei-Ende, damit sie nach den allgemeinen Regeln
   greifen (Cascade-Reihenfolge schlägt Specificity bei gleicher Selektor-Stärke).
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .user-chip-text { display: none; }
  .user-chip-caret { display: none; }
  .user-chip { padding: 4px; }
  .year-picker-label { display: none; }
  .brand-sub { display: none; }

  /* Tab-Bar muss am Ende stehen, damit die fixed-position-Regeln durchkommen */
  .tabnav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 0.5px solid var(--line);
    border-bottom: 0;
  }
  .tab.is-active { border-bottom: 0; }
}
