:root {
  --bg: #0b0b0f; --surface: #16161d; --surface2: #1e1e27;
  --text: #f4f4f6; --muted: #9a9aa8; --border: #2a2a35;
  --accent: #6f5bd6; --accent-bg: #211d3a;
  --green: #43c59e; --green-bg: #102b26;
  --amber: #e0a23a; --amber-bg: #2e2413;
  --red: #e05a5a; --red-bg: #2e1717;
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f2; --surface: #ffffff; --surface2: #fafaf7;
    --text: #16161a; --muted: #6a6a72; --border: #e5e5df;
    --accent: #534ab7; --accent-bg: #eeedfe;
    --green: #0f6e56; --green-bg: #e1f5ee;
    --amber: #854f0b; --amber-bg: #faeeda;
    --red: #a32d2d; --red-bg: #fcebeb;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 520px; margin-inline: auto;
}
.muted { color: var(--muted); }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 16px) 18px 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
}
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; }
.topbar p { font-size: 13px; margin: 2px 0 0; }
.mode-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: var(--surface2); color: var(--muted); border: 0.5px solid var(--border);
}
main { padding: 14px 14px 90px; }

.card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  display: block; width: 100%; text-align: left; color: inherit;
  font: inherit; cursor: pointer;
}
.card.deadline-near { border-color: var(--red); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-id { display: flex; gap: 10px; align-items: flex-start; }
.emoji { font-size: 22px; line-height: 1.2; }
.ev-name { font-size: 15px; font-weight: 600; margin: 0; }
.ev-meta { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.b-booked  { background: var(--green-bg);  color: var(--green); }
.b-planned { background: var(--accent-bg); color: var(--accent); }
.b-sale    { background: var(--amber-bg);  color: var(--amber); }
.b-done    { background: var(--surface2);  color: var(--muted); }
.b-cancel  { background: var(--red-bg);    color: var(--red); }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 9px; border-top: 0.5px solid var(--border);
  font-size: 12px;
}
.tick-yes { color: var(--green); }
.tick-no  { color: var(--muted); }
.deadline { color: var(--red); font-weight: 500; }
.price { font-size: 13px; font-weight: 600; color: var(--text); }

.summary {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding: 14px 16px 0; border-top: 0.5px solid var(--border);
  font-size: 14px;
}
.summary .total { font-size: 17px; font-weight: 600; }

.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 18px));
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); cursor: pointer;
}
.detail-back {
  background: none; border: none; color: var(--accent); font-size: 15px;
  padding: 0 0 12px; cursor: pointer;
}
.detail h2 { font-size: 22px; margin: 4px 0 2px; }
.detail .drow {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 0.5px solid var(--border); font-size: 14px;
}
.detail .drow .k { color: var(--muted); }
.detail .drow .v { text-align: right; }
.warn-box {
  background: var(--red-bg); color: var(--red); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-weight: 500; margin: 10px 0;
}
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.spinner { text-align: center; color: var(--muted); padding: 40px; }

/* --- edit mode --- */
.detail-bar { display: flex; justify-content: space-between; align-items: center; }
.btn-edit {
  background: var(--accent-bg); color: var(--accent); border: none;
  border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 500;
  cursor: pointer; margin-bottom: 12px;
}
.frow { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.frow label { font-size: 13px; color: var(--muted); }
.frow input[type="text"], .frow input[type="number"], .frow input[type="date"], .frow select {
  width: 100%; box-sizing: border-box; font-size: 15px; padding: 10px 12px;
  border: 0.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); -webkit-appearance: none; appearance: none;
}
.frow select { background-image: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.edit-actions { margin-top: 18px; }
.btn-save {
  width: 100%; background: var(--accent); color: #fff; border: none;
  border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-save:disabled { opacity: .6; }
.small { font-size: 12px; margin-top: 12px; }

/* --- accommodation block on cards --- */
.acc-block {
  margin-top: 10px; padding-top: 9px; border-top: 0.5px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.acc-line { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.acc-name { color: var(--text); }
.acc-sep { color: var(--border-strong, var(--muted)); margin: 0 2px; }
.storno-near { color: var(--red); font-weight: 500; }
.storno-far { color: var(--muted); }
.storno-missing { color: var(--amber); font-weight: 500; }

/* --- screenshot intake --- */
.intake-sec { margin-bottom: 20px; }
.intake-sec h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; }
.doc-chip { background: var(--surface); border: 0.5px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 6px; }
.matched { background: var(--surface); border: 0.5px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; padding: 8px 0 0; cursor: pointer; }
.cand { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  background: var(--surface); border: 0.5px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; color: inherit; font: inherit; cursor: pointer; }
.cand-score { font-size: 12px; color: var(--muted); background: var(--surface2); border-radius: 6px; padding: 3px 8px; }
.diff-row { display: flex; gap: 12px; align-items: flex-start; background: var(--surface);
  border: 0.5px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.diff-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin-top: 2px; }
.diff-body { flex: 1; min-width: 0; }
.diff-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.diff-vals { font-size: 14px; word-break: break-word; }
.diff-from { color: var(--muted); text-decoration: line-through; }
.diff-arrow { color: var(--muted); margin: 0 4px; }
.diff-to { color: var(--text); font-weight: 500; }
.tag-new { background: var(--green-bg); color: var(--green); font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.tag-fix { background: var(--amber-bg); color: var(--amber); font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.warn-amber { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.btn-ghost { width: 100%; background: none; border: 0.5px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 12px; font-size: 15px; margin-top: 8px; cursor: pointer; }
.detail-actions { display: flex; gap: 8px; }

/* --- PIN-Anmeldung --- */
.login-box { max-width: 300px; margin: 12vh auto 0; text-align: center; }
.login-lead { font-size: 16px; margin: 0 0 14px; }
.login-box input {
  width: 100%; box-sizing: border-box; font-size: 20px; letter-spacing: .25em;
  text-align: center; padding: 14px; margin-bottom: 12px;
  border: 0.5px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
}
.login-err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }

/* --- Kopfzeile rechts / Einstellungen --- */
.top-right { display: flex; align-items: center; gap: 8px; }
.gear { background: none; border: none; color: var(--muted); font-size: 19px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.gear:hover { color: var(--text); }

/* --- Datumsfeld mit Leeren-Knopf --- */
.with-clear { display: flex; gap: 8px; align-items: center; }
.with-clear input { flex: 1; }
.clear-btn {
  flex: none; background: var(--surface2); border: 0.5px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 9px 12px; font-size: 13px; cursor: pointer;
}
.clear-btn:hover { color: var(--text); }
.hint-box { background: var(--accent-bg); color: var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }

/* --- Kartenlinks --- */
.maps-link { color: var(--accent); text-decoration: none; display: inline-block; padding: 2px 0; }
.maps-link:active { opacity: .6; }
.detail .drow .v .maps-link + br + .maps-link { margin-top: 2px; }

/* --- Werkzeugleiste: Zeitraum, Suche, Filter --- */
.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 0.5px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }
#search {
  width: 100%; box-sizing: border-box; font-size: 15px; padding: 10px 12px;
  border: 0.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); -webkit-appearance: none;
}
.offline-bar {
  background: var(--amber-bg); color: var(--amber); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px;
}

/* --- Status direkt in der Karte änderbar --- */
.badge-select {
  -webkit-appearance: none; appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 11px; padding: 3px 8px; border-radius: 6px;
  max-width: 120px; text-align: center; text-align-last: center;
}
.badge-select:disabled { opacity: .5; }
.card[role="button"] { cursor: pointer; }
.chip-new { border-color: var(--accent); color: var(--accent); font-weight: 500; }

/* --- Bewertung, Mehrfachauswahl, Abschnitte --- */
.sec-head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 18px 0 4px; }
.multi { display: flex; flex-wrap: wrap; gap: 8px; }
.multi-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px;
  background: var(--surface); border: 0.5px solid var(--border); border-radius: 999px; padding: 7px 12px; }
.multi-opt input { width: 17px; height: 17px; accent-color: var(--accent); }

/* --- Hinweise unten am Rand --- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 88px); z-index: 50;
  max-width: 88%; padding: 11px 16px; border-radius: 12px; font-size: 14px;
  background: var(--surface2); color: var(--text); border: 0.5px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,.28); opacity: 1; transition: opacity .35s;
}
.toast-err { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.toast-out { opacity: 0; }

/* --- Ziehen zum Aktualisieren --- */
.pull-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  text-align: center; font-size: 12.5px; padding: 6px;
  background: var(--accent); color: #fff; transform: translateY(-100%); transition: transform .18s;
}
.pull-bar.pull-on { transform: translateY(0); }
#eventurl {
  width: 100%; box-sizing: border-box; font-size: 15px; padding: 11px 12px;
  border: 0.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); -webkit-appearance: none;
}
