:root {
  --rot: #c8102e;
  --rot-dunkel: #9b0c23;
  --bg: #f7f5f2;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e2dd;
  --gruen: #1a7f37;
  --gelb: #9a6700;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214; --card: #1e1e21; --text: #f2f2f4; --muted: #9b9ba1;
    --line: #333338; --gruen: #4ac26b; --gelb: #d4a72c;
  }
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9em; }
a { color: var(--rot); }
@media (prefers-color-scheme: dark) { a { color: #ff6b81; } }

/* Login */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-box { text-align: center; max-width: 340px; width: 100%; }
.login-flag, .flag-mini {
  display: inline-block; background: var(--rot); position: relative; border-radius: 6px;
}
.login-flag { width: 90px; height: 66px; margin-bottom: 16px; }
.login-flag::before, .flag-mini::before {
  content: ""; position: absolute; background: #fff; top: 0; bottom: 0; left: 30%; width: 14%;
}
.login-flag::after, .flag-mini::after {
  content: ""; position: absolute; background: #fff; left: 0; right: 0; top: 43%; height: 14%;
}
.flag-mini { width: 34px; height: 25px; border-radius: 4px; flex-shrink: 0; }
.login-box h1 { margin: 4px 0; }
.login-box form { margin-top: 20px; display: grid; gap: 10px; }
input, textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 16px; font-family: inherit;
}
.btn {
  padding: 12px 18px; border: none; border-radius: 10px; font-size: 16px; cursor: pointer;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
}
.btn.primary { background: var(--rot); color: #fff; border: none; font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: 14px; min-width: 44px; min-height: 44px; }
.btn.ghost { background: transparent; border: none; color: var(--muted); }
.error { color: var(--rot); font-size: 14px; }

/* Layout */
header {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top)); max-width: 760px; margin: 0 auto;
}
.header-inner > div { flex: 1; display: flex; flex-direction: column; }
.countdown { font-size: 13px; color: var(--muted); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 32px); }

nav#nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; overflow-x: auto; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); -webkit-overflow-scrolling: touch;
}
nav#nav button {
  flex: 1 0 62px; min-width: 62px; height: var(--nav-h); border: none; background: none;
  font-size: 20px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
nav#nav button span { font-size: 11px; }
.seg { display: flex; gap: 6px; margin-bottom: 14px; }
.seg button {
  flex: 1; padding: 10px 6px; min-height: 44px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer;
}
.seg button.aktiv { background: var(--rot); border-color: var(--rot); color: #fff; font-weight: 600; }
nav#nav button.active { color: var(--rot); font-weight: 600; }
nav#nav svg {
  width: 22px; height: 22px; stroke: currentColor;
  fill: color-mix(in srgb, currentColor 18%, transparent);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
svg.ico {
  width: 20px; height: 20px; vertical-align: -3px; margin-right: 7px;
  stroke: var(--rot); fill: color-mix(in srgb, var(--rot) 18%, transparent);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
#voice-btn svg, #logout svg {
  width: 22px; height: 22px; vertical-align: middle; stroke: var(--muted);
  fill: color-mix(in srgb, var(--muted) 18%, transparent);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* Cards & Inhalte */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 19px; margin-bottom: 8px; }
.card h3 { font-size: 16px; margin: 12px 0 6px; }
.card.warn { border-left: 4px solid var(--gelb); }
.card.alert { border-left: 4px solid var(--rot); }
.card.ok { border-left: 4px solid var(--gruen); }
.kv { display: grid; grid-template-columns: 1fr; gap: 6px; }
.kv div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv div:last-child { border: none; }
.kv b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; background: var(--line); }

/* Timeline */
.timeline { list-style: none; padding-left: 0; }
.timeline li {
  display: grid; grid-template-columns: 58px 20px 1fr; gap: 8px; align-items: start;
  min-height: 44px;
}
.timeline .zeit { font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 1px; }
.timeline .dot { position: relative; display: flex; justify-content: center; }
.timeline .dot::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--rot); margin-top: 5px;
}
.timeline li:not(:last-child) .dot::after {
  content: ""; position: absolute; top: 20px; bottom: -4px; width: 2px; background: var(--line);
}
.timeline .pause .dot::before { background: var(--gelb); }
.timeline .faehre .dot::before { background: #0a66c2; }
.timeline .inhalt { padding-bottom: 14px; }
.timeline .inhalt small { color: var(--muted); display: block; }
.startzeit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.startzeit input { width: auto; flex: 1; min-width: 210px; }

/* Verkehr */
.traffic-banner {
  background: var(--rot); color: #fff; padding: 8px 16px; font-size: 14px; cursor: pointer;
}
.meldung { border-left: 3px solid var(--gelb); padding: 8px 12px; margin: 8px 0; background: var(--bg); border-radius: 0 8px 8px 0; }
.meldung.sperrung { border-color: var(--rot); }
.meldung b { font-size: 14px; }
.meldung p { font-size: 13px; color: var(--muted); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gruen); margin-right: 6px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* Packliste */
.check { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.check input { width: 20px; height: 20px; flex-shrink: 0; }
.check.done label { text-decoration: line-through; color: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 12px; }
.progress i { display: block; height: 100%; background: var(--gruen); transition: width 0.3s; }

/* Tagebuch */
.eintrag img { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.eintrag .meta { font-size: 13px; color: var(--muted); }
.foto-grid img { width: 100%; }
form.stack { display: grid; gap: 10px; }

/* Kontakte */
.kontakt { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.kontakt:last-child { border: none; }
.kontakt a.tel {
  white-space: nowrap; background: var(--rot); color: #fff; text-decoration: none;
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.doc { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.doc:last-child { border: none; }
.doc .name { flex: 1; }

/* Sprachassistent */
.voice-overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 24px; text-align: center;
}
.voice-mic {
  width: 110px; height: 110px; border-radius: 50%; border: none; font-size: 46px;
  background: var(--rot); color: #fff; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 6px 24px rgba(200, 16, 46, 0.35);
}
.voice-mic.hoert { animation: pulsieren 1.2s infinite; background: var(--gruen); }
@keyframes pulsieren { 50% { transform: scale(1.08); } }
.voice-log {
  flex: 1; overflow-y: auto; width: 100%; max-width: 560px; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
}
.voice-log .frage { align-self: flex-end; background: var(--rot); color: #fff; padding: 8px 14px; border-radius: 16px 16px 4px 16px; max-width: 85%; }
.voice-log .antwort { align-self: flex-start; background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 16px 16px 16px 4px; max-width: 85%; }
.voice-text { display: flex; gap: 8px; width: 100%; max-width: 560px; }
.voice-text input { flex: 1; }

/* Kontakte-Editor */
.kontakt .aktion { display: flex; gap: 6px; align-items: center; }
.kontakt-form { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.kontakt-form input:nth-child(1), .kontakt-form input:nth-child(4), .kontakt-form button { grid-column: span 2; }
