/* Travel Mate – Design „Australischer Sommer“. Alle Werte kommen aus DESIGN.md. */

/* ---------- 1. Variablen ---------- */
:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #EFEBE3;
  --text: #14201D;
  --muted: #5B6763;
  --line: #E3DED4;
  --primary: #0B7A75;
  --on-primary: #FFFFFF;
  --accent: #B54A24;
  --success: #2F6B4A;
  --danger: #B42318;
  --primary-soft: rgb(11 122 117 / .12);

  --fs-display: 3.5rem;
  --fs-xl: 1.75rem;
  --fs-lg: 1.25rem;
  --fs-md: 1rem;
  --fs-sm: .875rem;
  --fs-xs: .75rem;

  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgb(20 32 29 / .06), 0 2px 8px rgb(20 32 29 / .06);
  --shadow-2: 0 4px 12px rgb(20 32 29 / .08), 0 12px 32px rgb(20 32 29 / .10);
  --card-border: 1px solid transparent;

  --tabbar-h: 4rem;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

/* Dunkel: automatisch, wenn das Gerät dunkel eingestellt ist, ausser der Schalter steht auf „Hell“.
   Steht er auf „Dunkel“, gilt es immer. Der Schalter setzt data-theme am <html>-Element (js/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1413;
    --surface: #16201E;
    --surface-2: #1F2B28;
    --text: #EEF3F1;
    --muted: #9AA9A4;
    --line: #2A3633;
    --primary: #3CC7BC;
    --on-primary: #06201D;
    --accent: #F08A5D;
    --success: #6FBF8E;
    --danger: #FF8A80;
    --primary-soft: rgb(60 199 188 / .14);
    --shadow-1: none;
    --shadow-2: none;
    --card-border: 1px solid var(--line);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1413;
  --surface: #16201E;
  --surface-2: #1F2B28;
  --text: #EEF3F1;
  --muted: #9AA9A4;
  --line: #2A3633;
  --primary: #3CC7BC;
  --on-primary: #06201D;
  --accent: #F08A5D;
  --success: #6FBF8E;
  --danger: #FF8A80;
  --primary-soft: rgb(60 199 188 / .14);
  --shadow-1: none;
  --shadow-2: none;
  --card-border: 1px solid var(--line);
  color-scheme: dark;
}

/* ---------- 2. Grundlagen ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
button, a, summary, label { touch-action: manipulation; } /* kein Zoom-Verzögern beim Tippen */

body {
  margin: 0;
  font: var(--fs-md)/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 var(--sp-4); }
a { color: var(--primary); }

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--danger); }
.spacer { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.label {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Symbole (Lucide, icons/LICENSE). Die Form kommt aus der SVG-Datei, die Farbe aus dem Text. */
.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  vertical-align: -.25em;
}
.i-calendar { --i: url(../icons/calendar.svg); }
.i-sun { --i: url(../icons/sun.svg); }
.i-moon { --i: url(../icons/moon.svg); }
.i-sun-moon { --i: url(../icons/sun-moon.svg); }
.i-cloud-sun { --i: url(../icons/cloud-sun.svg); }
.i-map-pin { --i: url(../icons/map-pin.svg); }
.i-plane { --i: url(../icons/plane.svg); }
.i-bed-double { --i: url(../icons/bed-double.svg); }
.i-navigation { --i: url(../icons/navigation.svg); }
.i-clock { --i: url(../icons/clock.svg); }
.i-check { --i: url(../icons/check.svg); }
.i-plus { --i: url(../icons/plus.svg); }
.i-pencil { --i: url(../icons/pencil.svg); }
.i-log-out { --i: url(../icons/log-out.svg); }
.i-droplets { --i: url(../icons/droplets.svg); }
.i-wind { --i: url(../icons/wind.svg); }
.i-sunrise { --i: url(../icons/sunrise.svg); }
.i-locate-fixed { --i: url(../icons/locate-fixed.svg); }
.i-external-link { --i: url(../icons/external-link.svg); }
.i-lock { --i: url(../icons/lock.svg); }
.i-chevron-right { --i: url(../icons/chevron-right.svg); }
.i-chevron-left { --i: url(../icons/chevron-left.svg); }
.i-copy { --i: url(../icons/copy.svg); }
.i-phone { --i: url(../icons/phone.svg); }
.i-link { --i: url(../icons/link.svg); }
.i-x { --i: url(../icons/x.svg); }
.i-car { --i: url(../icons/car.svg); }
.i-banknote { --i: url(../icons/banknote.svg); }
.i-search { --i: url(../icons/search.svg); }
.i-arrow-up-down { --i: url(../icons/arrow-up-down.svg); }

/* ---------- 3. Knöpfe ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms var(--ease), background-color 150ms var(--ease);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.ghost { background: none; color: var(--primary); }
.btn.danger { background: none; color: var(--danger); }
.btn.small { min-height: 40px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn.icon-only { width: 44px; padding: 0; }
.btn.icon-only.small { width: 40px; }
.btn:focus-visible, .tab:focus-visible, .chip:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- 4. Anmelden, kein Zugriff, Laden ---------- */
.center {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-5);
  text-align: center;
}
.center h1 { font-size: 2.5rem; letter-spacing: -.02em; }
.center .btn { margin-top: var(--sp-4); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: var(--sp-3);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, #1A8FB8, #0B7A75);
  color: #FFFFFF;
  font-size: 2rem;
  box-shadow: var(--shadow-2);
}

/* ---------- 5. Kopfzeile und Inhalt ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  padding-top: calc(var(--sp-2) + env(safe-area-inset-top));
  background: var(--bg);
}
.topbar strong { font-size: var(--fs-lg); white-space: nowrap; }
#user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 var(--sp-4);
  padding-bottom: calc(var(--tabbar-h) + var(--sp-7) + env(safe-area-inset-bottom));
}
main > section:not([hidden]) { animation: fade-in 150ms var(--ease); }
.section-head { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-4); }
.section-head:first-child { margin-top: var(--sp-2); }

/* ---------- 6. Uhr (Kopfkarte) ---------- */
.hero {
  position: relative;
  margin-top: var(--sp-2);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  color: #FFFFFF;
  background: linear-gradient(160deg, #1A8FB8, #0B7A75);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.hero[data-phase="morning"] { background: linear-gradient(160deg, #0E8C86 0%, #3E8E7E 55%, #A7703F 100%); }
.hero[data-phase="day"] { background: linear-gradient(160deg, #1A8FB8, #0B7A75); }
.hero[data-phase="evening"] { background: linear-gradient(160deg, #B54A24 0%, #8A3B5C 55%, #4B3A7A 100%); }
.hero[data-phase="night"] { background: linear-gradient(160deg, #2A3D66, #1B2A4A); }
.hero p { margin: 0; }
.hero-top { display: flex; align-items: center; gap: var(--sp-2); }
.hero .label { opacity: .85; }
.hero-badge {
  margin-left: auto;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / .2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.clock-time {
  margin-top: var(--sp-2) !important;
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.clock-date { opacity: .9; text-transform: capitalize; }
.hero-home {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid rgb(255 255 255 / .25);
  font-size: var(--fs-sm);
}
.hero-home strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.hero-home .hero-dim { opacity: .85; }

/* Heute auf einen Blick (unter der Uhr) */
.glance { margin: var(--sp-3) 0 0; padding-bottom: var(--sp-2); }
.glance-head .label { margin-bottom: var(--sp-2); color: var(--muted); }
.glance-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.glance-row { display: flex; align-items: flex-start; gap: var(--sp-3); margin: 0; overflow-wrap: anywhere; }
.glance-row .icon { margin-top: .15em; color: var(--primary); }
.glance-row.strong { font-weight: 600; }
.glance-row.warn { font-weight: 600; }
.glance-row.warn .icon { color: #C98A12; }
.glance-empty { margin: 0; }
.glance-jump { display: flex; margin: var(--sp-1) calc(-1 * var(--sp-2)) 0 auto; flex-direction: row-reverse; }
.tl-day { scroll-margin-top: calc(4rem + env(safe-area-inset-top)); }

/* ---------- 7. Karten ---------- */
.card {
  margin-bottom: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card-head { display: flex; align-items: flex-start; gap: var(--sp-2); }
.card-head strong { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: 600; overflow-wrap: anywhere; }
.card-head .btn { margin: -.5rem -.5rem 0 0; color: var(--muted); background: none; }
.card .line { display: flex; gap: var(--sp-2); margin: var(--sp-1) 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.card .line .icon { margin-top: .15em; color: var(--muted); vertical-align: 0; }
.time { margin-right: var(--sp-2); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Suche in der Reiseroute */
.search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: 0 var(--sp-1) 0 var(--sp-4);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.search:focus-within { border-color: var(--primary); }
.search > .icon { color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* verhindert das automatische Zoomen auf iPhones */
}
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { display: none; } /* eigener Knopf zum Löschen */
.search-info { margin: 0 0 var(--sp-3); }

/* ---------- 8. Tagesplan als Zeitleiste ---------- */
.tl-day { position: relative; padding-left: 1.75rem; padding-bottom: var(--sp-2); }
.tl-day::before { /* senkrechte Linie */
  content: "";
  position: absolute;
  left: .4rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.tl-day:last-child::before { bottom: auto; height: 1.5rem; }
.tl-dot {
  position: absolute;
  left: calc(.4rem + 1px);
  top: .5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: var(--bg);
  transform: translateX(-50%);
}
.tl-day.past .tl-dot { background: var(--muted); }
.tl-day.past .card { opacity: .7; }

.day {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-md);
  font-weight: 600;
}
.day-date { text-transform: capitalize; }
.day-nr { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.badge {
  padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
}

/* Heute: grösser, Punkt mit sanftem Puls, Karte hervorgehoben. */
.tl-day.today { padding-top: var(--sp-2); }
.tl-day.today .tl-dot {
  top: 1rem;
  width: 16px;
  height: 16px;
  border: 0;
  background: var(--primary);
  box-shadow: 0 0 0 0 var(--primary-soft);
  animation: pulse 2s ease-out infinite;
}
.tl-day.today .day { align-items: center; font-size: var(--fs-xl); font-weight: 700; }
.card.today { padding: 1.25rem; border: 2px solid var(--primary); box-shadow: var(--shadow-2); }
.card.today .card-head strong { font-size: var(--fs-lg); }

.past-toggle { margin: var(--sp-2) 0 var(--sp-4); }
.past-toggle > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

/* Kopfbild des Ortes ganz oben im ersten Kasten jedes Tages (Bild aus Wikipedia). */
.day-banner {
  position: relative;
  display: block;
  width: calc(100% + 2 * var(--sp-4));
  height: 88px;
  margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-3);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--surface-2);
  cursor: pointer;
}
.card.today .day-banner {
  width: calc(100% + 2.5rem);
  height: 120px;
  margin: -1.25rem -1.25rem var(--sp-3);
  border-radius: 14px 14px 0 0;
}
.day-banner img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 250ms var(--ease); }
.day-banner.loaded img { opacity: 1; }

/* Ort als Knopf, öffnet die Infoseite */
.card .place-link {
  width: 100%;
  min-height: 40px;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.place-link span:not(.icon) { flex: 1; min-width: 0; }
.card .place-link .icon:first-child { margin-top: 0; color: var(--primary); }
.card .place-link .icon:last-child { margin-top: 0; }

/* ---------- 9. Flug (Bordkarte) und Unterkunft ---------- */
.pass, .stay {
  position: relative;
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
}
.stay { border-left-color: var(--primary); }
.pass p, .stay p { margin: 0; }
.pass .btn, .stay .btn { margin-top: var(--sp-3); background: var(--surface); }
.pass-head { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); }
.pass-head .label { flex: 1; }
.pass-head .icon { color: var(--accent); }
.pass-route { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.pass-end { display: flex; flex-direction: column; min-width: 0; }
.pass-end:last-child { text-align: right; }
.pass-code { font-size: var(--fs-lg); font-weight: 700; letter-spacing: .04em; overflow-wrap: anywhere; }
.pass-code.long { font-size: var(--fs-md); letter-spacing: 0; }
.pass-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.pass-line { flex: 1; display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); }
.pass-line .icon { transform: rotate(45deg); } /* Lucide-Flugzeug zeigt schräg nach oben */
.pass-line::before, .pass-line::after { content: ""; flex: 1; border-top: 2px dotted var(--line); }
.pass-cut { /* gestrichelte Trennlinie mit halbrunden Aussparungen */
  position: relative;
  height: 1px;
  margin: var(--sp-4) calc(-1 * var(--sp-4)) var(--sp-3) calc(-1 * var(--sp-4) - 4px);
  border-top: 2px dashed var(--line);
}
.pass-cut::before, .pass-cut::after {
  content: "";
  position: absolute;
  top: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
}
.pass-cut::before { left: -4px; }
.pass-cut::after { right: -8px; }
.flight-at { color: var(--accent); font-weight: 700; }
.countdown { display: block; color: var(--text); font-weight: 500; font-size: var(--fs-sm); }
.stay-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; }
.stay-times { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1) !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.stay-times .icon { color: var(--primary); }
.stay-note { margin-top: var(--sp-1) !important; }
.stay .muted { margin-top: var(--sp-1); }

/* Zeitzonen-Hinweis (Wechsel der Uhrzeit gegenüber dem Vortag) */
.tz-note {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, #E2B33B 22%, var(--surface));
  border-left: 4px solid #E2B33B;
}
.tz-note p { margin: 0; }
.tz-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; }
.tz-text { margin-top: var(--sp-1) !important; font-size: var(--fs-sm); color: var(--muted); }

/* Fahrt zwischen zwei Orten (gleicher Aufbau wie Flug und Unterkunft) */
.drive {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border-left: 4px solid var(--muted);
}
.drive p { margin: 0; }
.drive-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; }
.drive-title .icon { color: var(--muted); }
.drive-result { margin-top: var(--sp-1) !important; font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.drive-result.muted { font-size: var(--fs-md); font-weight: 400; }
.drive .btn { margin-top: var(--sp-3); background: var(--surface); }
.stay-title .icon { color: var(--primary); }

/* ---------- 10. Wetter ---------- */
.weather {
  margin-bottom: var(--sp-3);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  color: #FFFFFF;
  background: linear-gradient(160deg, #1A8FB8, #0E6E8C);
  box-shadow: var(--shadow-2);
}
.weather.wx-cloud { background: linear-gradient(160deg, #6B8796, #4E6673); }
.weather.wx-rain { background: linear-gradient(160deg, #5D6E7A, #4A5A66); }
.weather.wx-storm { background: linear-gradient(160deg, #4B4A7A, #2E2D52); }
.weather.wx-night { background: linear-gradient(160deg, #2A3D66, #1B2A4A); }
.weather.wx-none { color: var(--text); background: var(--surface); border: var(--card-border); box-shadow: var(--shadow-1); }
.weather p { margin: 0; }
.weather-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.weather-head .label { opacity: .9; }
.weather-date { opacity: .85; font-size: var(--fs-sm); text-transform: capitalize; }
.weather-main { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-4) 0; }
.weather-icon { font-size: 4rem; line-height: 1; }
.weather-temp { font-size: var(--fs-display); font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.weather-temp small { font-size: var(--fs-lg); font-weight: 500; opacity: .8; }
.weather-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.tile { padding: var(--sp-3); border-radius: var(--r-sm); background: rgb(255 255 255 / .15); }
.tile .label { display: flex; align-items: center; gap: var(--sp-1); opacity: .85; }
.tile strong { display: block; margin-top: var(--sp-1); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.tile.wide { grid-column: 1 / -1; }
.uv-bar {
  position: relative;
  height: 8px;
  margin: var(--sp-3) 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, #3F9B4F 0%, #E2B33B 27%, #E07B2E 50%, #C8382B 68%, #7D3C98 100%);
}
.uv-mark {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  background: rgb(0 0 0 / .35);
  transform: translate(-50%, -50%);
}
.uv-warn { font-weight: 700; }
.weather.compact { padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-1); }
.weather.compact .weather-main { margin: var(--sp-3) 0 0; }
.weather.compact .weather-icon { font-size: 2.5rem; }
.weather.compact .weather-temp { font-size: var(--fs-xl); }
.weather-loading { margin-top: var(--sp-3) !important; opacity: .85; }
.weather .error { color: inherit; font-weight: 600; }
.source { margin-top: var(--sp-4); }
.source a { color: inherit; }

/* ---------- 11. In der Nähe ---------- */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-1);
  padding: var(--sp-1);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }
.chips {
  display: flex;
  gap: var(--sp-2);
  margin: var(--sp-3) calc(-1 * var(--sp-4)) 0;
  padding: 0 var(--sp-4) var(--sp-1);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  white-space: nowrap;
  scroll-snap-align: start;
  cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; }
.near-info { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; margin: var(--sp-2) 0 0; }
.near-info p { flex: 1; margin: 0; }

.toggle { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; margin: var(--sp-2) 0; cursor: pointer; }
.toggle input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--primary); }

.poi { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); transition: opacity 200ms var(--ease); }
.poi.visited { opacity: .6; }
.poi-head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.poi-text { flex: 1; min-width: 0; }
.poi-text strong { display: block; overflow-wrap: anywhere; }
.poi-text .addr { display: block; overflow: hidden; color: var(--muted); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.poi-note { margin: 0; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.distance {
  flex: none;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.poi-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.visit-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-1) 0 var(--sp-3);
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.visit-circle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: transparent;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
}
.visit-btn[aria-pressed="true"] { color: var(--success); font-weight: 600; }
.visit-btn[aria-pressed="true"] .visit-circle { border-color: var(--success); background: var(--success); color: var(--surface); }
#btn-near-more { width: 100%; margin-bottom: var(--sp-4); }

.import { margin-top: var(--sp-5); }
.import summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; }
.import ol { padding-left: 1.25rem; }
.import input[type="file"] { max-width: 100%; margin-bottom: var(--sp-2); }
.preview-list { list-style: none; max-height: 50dvh; margin: var(--sp-2) 0; padding: 0; overflow-y: auto; }
.preview-list li { border-bottom: 1px solid var(--line); }
.check { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: 44px; padding: var(--sp-2) 0; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; margin: .125rem 0 0; flex: none; accent-color: var(--primary); }
.check span { display: flex; flex-direction: column; overflow-wrap: anywhere; }

/* ---------- 12. Formular (Fenster vom unteren Rand) ---------- */
dialog {
  width: min(32rem, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
  padding: var(--sp-5);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
dialog[open] { animation: sheet-up 250ms var(--ease); }
dialog::backdrop { background: rgb(13 20 19 / .5); }
.sheet-grip { width: 36px; height: 4px; margin: calc(-1 * var(--sp-2)) auto var(--sp-3); border-radius: var(--r-pill); background: var(--line); }

.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form h2 { font-size: var(--fs-lg); }
.form label { display: flex; flex-direction: column; gap: var(--sp-1); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.form input, .form textarea, .form select {
  min-height: 48px;
  padding: var(--sp-3);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* verhindert das automatische Zoomen auf iPhones */
}
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--primary); }
.form .row { display: flex; gap: var(--sp-3); }
.form .row .grow { flex: 1; min-width: 0; }
.form-actions { display: flex; align-items: center; gap: var(--sp-2); padding-top: var(--sp-2); }
.flight-form summary { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; font-weight: 600; cursor: pointer; }
.flight-form summary .icon { color: var(--accent); }
.flight-form > .form { padding-top: var(--sp-2); }

/* ---------- 12a. Infoseite zum Ort ---------- */
.place-hero {
  height: 220px;
  margin-bottom: var(--sp-4);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
}
.place-hero img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 250ms var(--ease); }
.place-hero.loaded img { opacity: 1; }
#place-content h2 { margin-bottom: var(--sp-1); }
.place-desc { margin-bottom: var(--sp-4); }
.place-text { font-size: 1.0625rem; line-height: 1.6; }
.place-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.place-days .label { margin-bottom: var(--sp-2); color: var(--muted); }
.place-day { display: flex; gap: var(--sp-2); margin: 0; padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.place-day .time { flex: none; }

/* ---------- 12a2. Währungsrechner ---------- */
.fx-sheet { padding-top: var(--sp-5); }
.fx-head { display: flex; align-items: center; margin-bottom: var(--sp-4); }
.fx-head h2 { flex: 1; font-size: var(--fs-lg); }
.fx-field { display: flex; flex-direction: column; gap: var(--sp-1); color: var(--muted); }
.fx-field input {
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xl); /* gross und mindestens 16 px, damit das iPhone nicht zoomt */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fx-field input:focus { outline: none; border-color: var(--primary); }
.fx-swap {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: var(--sp-2) auto;
  border: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  transition: transform 200ms var(--ease);
}
.fx-swap:active { transform: rotate(180deg); }
.fx-swap .icon { width: 22px; height: 22px; }
.fx-rate { margin: var(--sp-4) 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.fx-sheet .muted { margin: 0; }

/* ---------- 12b. Profil ---------- */
.avatar-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.avatar-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 56px; height: 56px; font-size: var(--fs-lg); }

.profile-sheet { padding-top: var(--sp-5); }
.profile-head:focus { outline: none; } /* bekommt beim Öffnen den Fokus, damit kein Knopf umrandet ist */
.profile-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.profile-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-who strong { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.profile-who span { overflow-wrap: anywhere; }
.profile-menu { display: flex; flex-direction: column; gap: var(--sp-2); }
.profile-menu p { margin: 0; }
.menu-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-row > .icon:first-child { color: var(--primary); }
.menu-row > .icon:last-child { color: var(--muted); }
.menu-text { flex: 1; display: flex; flex-direction: column; font-weight: 600; }
.menu-text .small { font-weight: 400; }

/* ---------- 12c. Wichtige Dokumente ---------- */
.back-btn { margin-left: calc(-1 * var(--sp-3)); }
#view-docs .section-head + .section-head { margin-top: 0; }
.vault-hint { display: flex; align-items: center; gap: var(--sp-2); }
.vault-group { margin: var(--sp-5) 0 var(--sp-2); color: var(--muted); }
.vault-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.vault-number, .vault-phone { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.vault-row .btn { background: var(--surface); }
.vault-link { margin-top: var(--sp-3); }

/* ---------- 13. Tab-Leiste (schwebend) ---------- */
.tabbar {
  position: fixed;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  gap: var(--sp-1);
  max-width: 28rem;
  height: var(--tabbar-h);
  margin: 0 auto;
  padding: var(--sp-2);
  border: var(--card-border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .tabbar {
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
  }
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.tab .icon { width: 24px; height: 24px; }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

/* ---------- 14. Bewegung ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 15. Handy ---------- */
@media (max-width: 480px) {
  .clock-time { font-size: 3rem; }
  dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
  }
}
@media (min-width: 481px) { .sheet-grip { display: none; } }
