/* Balu – TrailPlaner Pro — Styles (aus index.html ausgelagert) */
:root {
  /* Palette aus dem App-Logo: Waldgrün #2A392E · Amber #D28E2E · Creme #F9F4EF */
  --bg:      #faf6ef;   /* Creme-Canvas */
  --surface: #efe8da;   /* Creme-Panels */
  --border:  #d9d0be;
  --accent:  #2f4633;   /* Waldgrün (Struktur/Primär) */
  --amber:   #d28e2e;   /* Amber (Akzent) */
  --cream:   #f9f4ef;
  --text:    #243121;
  --muted:   #8b8470;
  --red:     #ef4444;
  --green:   #22c55e;
  --blue:    #3b82f6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
/* System-Schrift (professioneller Look); Mono nur noch als Akzent für Zahlen (.num / Stats). */
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; display: flex; flex-direction: column; }
.stats strong, .num { font-family: ui-monospace, 'SF Mono', 'Menlo', 'Courier New', monospace; }
/* Inline-SVG-Icons (Sprite oben im body): erben die Textfarbe, überall gleich gerendert */
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; }
.ico-lg { width: 1.5em; height: 1.5em; vertical-align: -0.3em; }
.locating .ico { animation: icoSpin 1s linear infinite; }
@keyframes icoSpin { to { transform: rotate(360deg); } }

/* ── HTTPS warning ── */
#https-warn { background: #fef3c7; border-bottom: 2px solid #f59e0b; padding: 6px 14px; font-size: 10px; color: #92400e; text-align: center; display: none; }

/* ── Header ── */
header {
  background: var(--accent); border-bottom: 1px solid var(--accent);
  padding: 0 14px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; z-index: 1000;
}
header h1 { font-size: 19px; letter-spacing: 1px; color: var(--cream); text-transform: uppercase; display: flex; align-items: center; white-space: nowrap; }
header #version-badge { color: var(--amber) !important; }
.phase-badge { font-size: 10px; padding: 2px 8px; border: 1px solid var(--amber); color: var(--amber); border-radius: 9px; letter-spacing: 1px; }

/* ── Nav ── */
nav { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); height: 38px; flex-shrink: 0; }
nav button {
  flex: 1; padding: 0 3px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--accent); opacity: .55; font-family: inherit; font-size: 10px; font-weight: bold; letter-spacing: .2px;
  cursor: pointer; transition: all .2s; -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
nav button.active { color: var(--accent); opacity: 1; border-bottom-color: var(--amber); }

/* ── Countdown vor Aufzeichnung ── */
#countdown-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: none; align-items: center; justify-content: center;
  background: rgba(36,49,33,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.cd-num {
  font-family: inherit; font-weight: bold; color: var(--cream);
  font-size: 120px; line-height: 1; text-shadow: 0 4px 18px rgba(0,0,0,.5);
  animation: cdPop .8s ease-out;
}
.cd-num.cd-go { color: var(--amber); font-size: 80px; letter-spacing: 3px; }
.gps-warmup-card {
  width:min(88vw,340px); padding:22px 18px; border-radius:14px;
  background:var(--bg); color:var(--text); text-align:center;
  box-shadow:0 10px 34px rgba(0,0,0,.3);
}
.gps-warmup-title { color:var(--accent); font-size:14px; font-weight:800; letter-spacing:1px; }
.gps-warmup-status { min-height:42px; margin:10px 0 14px; color:var(--muted); font-size:12px; line-height:1.5; }
.gps-warmup-card .btn { min-height:44px; }

/* ── Installations-Gate: App nur als installierte PWA (LIZENZ.md §1) ── */
#install-gate {
  position: fixed; inset: 0; z-index: 100002;
  display: none; align-items: center; justify-content: center;
  background: var(--accent); text-align: center; padding: 32px 26px;
  overflow-y: auto;
}
#install-gate.open { display: flex; }
.gate-card { max-width: 330px; }
.gate-card h2 { font-size: 16px; letter-spacing: 1.5px; color: var(--amber); margin-bottom: 14px; }
.gate-card p  { font-size: 13px; line-height: 1.7; color: var(--cream); opacity: .92; }
.gate-steps {
  text-align: left; font-size: 13px; line-height: 1.9; color: var(--cream);
  margin: 6px 0 0 20px;
}
.gate-steps li { margin-bottom: 6px; }
.gate-inline-icon {
  width: 1.2em; height: 1.2em; margin: 0 .16em; vertical-align: -.2em;
  color: var(--amber); stroke-width: 2.2; flex: 0 0 auto;
}
.gate-dots-icon { width: 1.3em; height: 1.3em; stroke-width: 4; }
.gate-icon-horizontal { transform: rotate(90deg); }
.gate-symbol-note {
  display: inline-flex; align-items: center; gap: 2px; color: var(--cream);
  opacity: .86; font-size: 12px; white-space: nowrap;
}
.gate-subnote { opacity: .78; font-size: 12px; }
.install-inline-icon { color: var(--amber); margin-right: 3px; }

/* ── Onboarding (Erststart-Tour) ── */
#onboarding {
  position: fixed; inset: 0; z-index: 100001;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: var(--accent); padding: 30px 26px; text-align: center;
}
#onboarding.open { display: flex; }
.ob-card { max-width: 340px; width: 100%; display: flex; flex-direction: column; align-items: center; }
.ob-icon {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--amber); background: rgba(210,142,46,.13);
  border: 1px solid rgba(210,142,46,.55); align-self: center; flex: 0 0 auto;
}
.ob-icon-svg { width: 38px; height: 38px; fill: currentColor; }
.ob-logo { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.ob-card h2 { font-size: 18px; letter-spacing: 1px; color: var(--amber); margin-bottom: 12px; }
.ob-card p  { font-size: 13.5px; line-height: 1.75; color: var(--cream); opacity: .92; }
.ob-card p strong { color: #fff; }
.ob-steps { font-size: 13px; line-height: 1.9; color: var(--cream); opacity: .92; text-align: left; margin: 4px auto 0; max-width: 290px; }
.ob-steps li { margin-bottom: 4px; }
.ob-dots { display: flex; gap: 8px; justify-content: center; margin: 22px 0 18px; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(249,244,239,.3); transition: background .2s, width .2s; }
.ob-dot.active { background: var(--amber); width: 22px; border-radius: 11px; }
.ob-nav { display: flex; gap: 10px; width: 100%; max-width: 340px; }
.ob-nav .btn { flex: 1; }
.ob-body { min-height: 232px; display: flex; flex-direction: column; justify-content: center; }

/* ── Handlungsgeführte Tour V2 ────────────────────────────────
   Vier Flächen bilden einen echten Ausschnitt um das aktuelle Ziel. Dadurch
   werden versehentliche Taps außerhalb abgefangen, während Eingabefeld,
   Auswahl oder Karte im Ausschnitt normal bedienbar bleiben. */
#tour-layer {
  position: fixed; left: 0; top: 0; width: 100vw; height: 100vh;
  z-index: 100020; display: none; pointer-events: none;
}
#tour-layer.open { display: block; }
.tour-block {
  position: absolute; background: rgba(20,30,23,.70); pointer-events: auto;
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
.tour-target-guard { position: absolute; display: none; pointer-events: auto; background: transparent; }
.tour-card {
  position: absolute; left: 14px; right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 2; max-width: 430px; margin: 0 auto; padding: 14px;
  border: 1px solid var(--amber); border-radius: 14px; background: var(--bg);
  color: var(--text); box-shadow: 0 8px 30px rgba(0,0,0,.38); pointer-events: auto;
  max-height:calc(100% - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y:auto; -webkit-overflow-scrolling:touch;
}
.tour-card.tour-card-top { top: calc(76px + env(safe-area-inset-top)); bottom: auto; }
.tour-progress { color: var(--amber); font-size: 9.5px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; }
.tour-card h3 { margin: 5px 0 7px; color: var(--accent); font-size: 14px; letter-spacing: .5px; }
.tour-copy { color: var(--text); font-size: 11.5px; line-height: 1.55; }
.tour-copy strong { color: var(--accent); }
.tour-do {
  margin-top: 9px; padding: 8px 9px; border-radius: 9px; background: rgba(210,142,46,.13);
  color: var(--accent); font-size: 11px; line-height: 1.45; font-weight: bold;
}
.tour-do:empty { display: none; }
.tour-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tour-actions:empty { display: none; }
.tour-actions .btn { flex: 1 1 130px; min-height: 44px; }
.tour-focus {
  outline: 3px solid var(--amber) !important; outline-offset: 3px;
  border-radius: 9px; animation: tourPulse 1.4s ease-in-out infinite;
}
.tour-focus:is(input, select, textarea) {
  animation: none; box-shadow: 0 0 0 6px rgba(210,142,46,.28) !important;
}
/* Der Spotlight-Ausschnitt bleibt exakt am Eingabefeld. Die danebenliegende
   Commit-Aktion muss dennoch per Touch erreichbar sein. */
body[data-tour-step="day-name"] .training-day-name-done {
  position:relative; z-index:100021;
}
body[data-tour-step="routing-mode"] #plan-routing-toggle-max button {
  min-height:44px;
}
.tour-card.tour-card-editing { padding: 10px 12px; }
.tour-card.tour-card-editing h3 { margin-bottom: 0; }
.tour-card.tour-card-editing .tour-copy,
.tour-card.tour-card-editing .tour-do { display: none; }

@keyframes tourPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(210,142,46,.20); }
  50% { box-shadow: 0 0 0 7px rgba(210,142,46,.30); }
}
.tour-inline-tip {
  display: none; flex-shrink: 0; margin: -2px 0 10px; padding: 9px 10px;
  border: 1px solid var(--amber); border-radius: 9px; background: rgba(210,142,46,.12);
  color: var(--text); font-size: 10.5px; line-height: 1.5;
}
.tour-inline-tip.open { display: block; }
.tour-inline-tip strong { color: var(--accent); }
.tour-form-pause { display:none; margin-top:8px; flex-shrink:0; }
body[data-tour-step="profile-form"] #client-edit-modal .tour-form-pause,
body[data-tour-step="group-form"] #team-edit-modal .tour-form-pause { display:block; }
body[data-tour-step="location-check"] #btn-return-plan,
body[data-tour-step="routing-mode"] #btn-return-plan,
body[data-tour-step="map-point-1"] #btn-return-plan,
body[data-tour-step="map-point-2"] #btn-return-plan { display:none !important; }

@media (max-height: 670px) {
  .tour-card { padding: 11px; }
  .tour-copy { font-size: 10.5px; line-height: 1.45; }
  .tour-do { margin-top: 7px; padding: 6px 8px; }
  .tour-actions { margin-top: 7px; }
}
@media (orientation: landscape) and (max-height: 500px) and (min-width:560px) {
  .tour-card, .tour-card.tour-card-top {
    top:calc(6px + env(safe-area-inset-top));
    bottom:calc(6px + env(safe-area-inset-bottom));
    left:auto; right:8px; width:calc(48% - 12px); max-width:320px; margin:0;
  }
  body[data-tour-step="location-check"] .tour-card,
  body[data-tour-step="map-collapse"] .tour-card { left:8px; right:auto; }
  /* Bei den drei Formularschritten bleibt rechts Platz für die scrollbare
     Tourkarte. So überdeckt sie weder FERTIG noch die nativen Auswahlen. */
  body[data-tour-step="day-name"] #view-plan .plan-top,
  body[data-tour-step="team-choice"] #view-plan .plan-top,
  body[data-tour-step="dog-choice"] #view-plan .plan-top {
    width:calc(52% - 8px);
  }
  #onboarding {
    overflow-y:auto; -webkit-overflow-scrolling:touch;
    align-items:flex-start; justify-content:flex-start;
    box-sizing:border-box; padding:6px 8px;
  }
  .ob-card { min-height:max-content; margin:0 auto; }
  .ob-body { min-height:0; }
}
@keyframes cdPop { 0%{transform:scale(.4);opacity:0;} 30%{opacity:1;} 100%{transform:scale(1.15);opacity:.9;} }

.field-flash { animation: fieldFlash 1.6s ease-out; border-color: var(--amber) !important; }
@keyframes fieldFlash {
  0%,100% { box-shadow: 0 0 0 0 rgba(210,142,46,0); }
  20%     { box-shadow: 0 0 0 3px rgba(210,142,46,.55); }
  60%     { box-shadow: 0 0 0 3px rgba(210,142,46,.3); }
}

/* ── Views ── */
#app { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.view { display: none; flex-direction: column; position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.view.active { display: flex; }

/* ── Map ── */
.map-wrap { flex: 1; display: flex; flex-direction: column; position: relative; min-height: 0; overflow: hidden; }
.leaflet-map {
  flex: 1 1 auto;
  min-height: 240px;
  height: var(--map-h, 60vh);
  width: 100%;
}

/* ── Map crosshair ── */
.map-crosshair {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px; color: var(--accent);
  pointer-events: none; z-index: 500;
  text-shadow: 0 0 4px white, 0 0 4px white;
  line-height: 1;
}

/* ── PUNKT-SETZEN Button ── */
.btn-add-wp {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  z-index: 500; background: var(--amber); color: #fff;
  border: none; border-radius: 20px; padding: 8px 20px;
  font-family: inherit; font-size: 11px; letter-spacing: 1px; font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.btn-add-wp:active { opacity: .8; }

/* ── Plan-Tab: Ablauf von oben nach unten (Trainingstag→Gruppe→Hund→Chips→Karte→…) ── */
#view-plan .plan-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; min-height: 0; }
#view-plan .plan-top    { padding: 12px max(20px, env(safe-area-inset-right)) 4px max(20px, env(safe-area-inset-left)); flex-shrink: 0; }
#view-plan .plan-bottom { padding: 4px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); flex-shrink: 0; }
#view-plan .map-wrap    { height: 48vh; min-height: 300px; flex-shrink: 0; }
.training-day-card {
  margin-bottom: 8px; padding: 9px; border: 1px solid var(--border);
  border-radius: 11px; background: rgba(239,232,218,.45);
}
.training-day-row { display: flex; gap: 8px; align-items: stretch; }
.training-day-row .plan-select { flex: 1; min-width: 0; }
.training-day-row .training-day-new { flex: 0 0 auto; width: auto; min-width: 112px; padding: 0 12px; }
.training-location-label {
  display:block; margin-top:7px; margin-bottom:3px;
  color:var(--muted); font-size:9px; font-weight:bold; letter-spacing:.8px;
}
.training-day-name { margin-top: 0; }
.training-day-name-row {
  display:grid; grid-template-columns:minmax(0,1fr) clamp(82px,24vw,105px);
  gap:8px; align-items:stretch; min-width:0;
}
.training-day-name-row > .training-day-name { min-width:0; width:100%; }
.training-day-name-row > .training-day-name-done.btn {
  width:100%; min-width:0; height:44px; margin-top:0; padding:0 10px;
  white-space:nowrap;
}
.plan-assignment-grid {
  display: grid; grid-template-columns: minmax(0,3fr) minmax(0,2fr); gap: 8px;
  align-items: end;
}
.plan-assignment-grid select { min-width: 0; width: 100%; }
.plan-assignment-grid > .field:last-child { grid-column: 1 / -1; }
@media (max-width:350px) {
  .plan-assignment-grid { grid-template-columns: 1fr; gap: 0; }
}
.plan-delete-zone { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-select {
  width: 100%; box-sizing: border-box; background: var(--surface); color: var(--text);
  -webkit-text-fill-color: var(--text); -webkit-appearance: none; border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none; min-height: 38px;
}
/* Karte groß/klein: Max-Modus blendet oben/unten aus, Karte füllt alles */
#view-plan.plan-map-max .plan-scroll { overflow: hidden; }
#view-plan.plan-map-max .plan-top,
#view-plan.plan-map-max .plan-bottom { display: none; }
#view-plan.plan-map-max .map-wrap    { height: auto; flex: 1; min-height: 0; }
/* GENERELLES KARTEN-KONZEPT: kleine Karte = reine Vorschau. Die Schutzschicht
   (.map-veil) fängt alle Gesten ab: vertikales Wischen scrollt die SEITE
   (touch-action: pan-y), ein Tipp öffnet das Vollbild. Zoomen/Schieben und
   alle Kartenwerkzeuge gibt es NUR im Vollbild. Gilt für alle Tabs + Archiv. */
.map-veil {
  position: absolute; inset: 0; z-index: 950;
  cursor: pointer; touch-action: pan-y;
  display: flex; align-items: flex-end; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.map-veil:focus-visible, #install-banner:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: -3px;
}
.map-veil-hint {
  margin-bottom: 34px; background: rgba(20,20,20,.72); color: #fff;
  border-radius: 20px; padding: 8px 16px; font-size: 11px; font-weight: bold;
  letter-spacing: .5px; display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none;
}
#view-plan.plan-map-max .map-veil,
.view.map-max .map-veil { display: none; }

/* Vollbild-Modus für Runner/Trailer/Auswertung: Panel weg, Karte füllt alles */
.view.map-max .panel { display: none; }
.view.map-max .map-wrap { flex: 1; height: auto; min-height: 0; }

/* Einklapp-Button: nur im Vollbild sichtbar */
.map-max-close { display: none !important; }
.view.map-max .map-max-close { display: flex !important; }

/* Planungs-Werkzeuge nur im Vollbild: in der kleinen Vorschau ausblenden */
#view-plan:not(.plan-map-max) .map-search,
#view-plan:not(.plan-map-max) #locate-plan,
#view-plan:not(.plan-map-max) #plan-max-undo,
#view-plan:not(.plan-map-max) #map-crosshair,
#view-plan:not(.plan-map-max) .leaflet-control-zoom,
#view-plan:not(.plan-map-max) #btn-add-waypoint { display: none; }

/* Runner/Trailer/Auswertung: Werkzeuge + Zoom nur im Vollbild */
#view-runner:not(.map-max) #locate-runner,
#view-runner:not(.map-max) #compass-runner,
#view-runner:not(.map-max) .leaflet-control-zoom,
#view-hund:not(.map-max) #locate-hund,
#view-hund:not(.map-max) #compass-hund,
#view-hund:not(.map-max) .leaflet-control-zoom,
#view-auswertung:not(.map-max) .leaflet-control-zoom { display: none; }

/* Archiv-Detail: Karten-Vorschau (200px) → Tipp vergrößert auf 65vh */
.archive-map-wrap { position: relative; margin-bottom: 10px; }
.archive-map-wrap #archive-map { height: 200px; border-radius: 9px; overflow: hidden; }
.archive-map-wrap.max #archive-map { height: 65vh; }
.archive-map-wrap.max .map-veil { display: none; }
.archive-map-wrap:not(.max) .leaflet-control-zoom { display: none; }
.archive-map-wrap .map-veil-hint { margin-bottom: 16px; padding: 6px 12px; font-size: 10px; }
.archive-map-wrap .map-max-close { position: absolute; top: 8px; right: 8px; z-index: 960; }
.archive-map-wrap.max .map-max-close { display: flex !important; }

/* Punkte/Länge + Wege/Freihand als Overlay — nur im Karten-Vollbild sichtbar,
   damit man dafür nicht mehr die Karte einklappen muss. */
.plan-map-overlay {
  display: none;
  position: absolute; left: 10px; right: 10px; bottom: 78px; z-index: 900;
  background: rgba(20,20,20,.78); border-radius: 11px; padding: 8px 10px;
  flex-direction: column; gap: 6px;
}
#view-plan.plan-map-max .plan-map-overlay { display: flex; }
.plan-map-overlay .stats { color: #ddd; }
.plan-map-overlay .stats strong { color: #fff; }
.plan-map-overlay .routing-toggle { border-color: rgba(255,255,255,.3); }
.plan-map-overlay .routing-toggle button { color: #ddd; }

/* ── Map overlays ── */
.map-search {
  position: absolute; top: 10px; left: 10px; right: 56px; z-index: 900;
}
.map-search-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px;
}
.map-search input {
  width: 100%; min-width: 0; height: 42px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 11px;
  font-family: inherit; font-size: 16px; background: var(--bg); color: var(--text);
  -webkit-text-fill-color: var(--text); -webkit-appearance: none; outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.map-search input::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; }
.map-search input:focus { border-color: var(--accent); }
.map-search input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 1000px var(--bg) inset; }
.map-search-button {
  min-width: 72px; height: 42px; padding: 0 10px; border: 1px solid var(--accent);
  border-radius: 11px; background: var(--accent); color: #fff; font-family: inherit;
  font-size: 10px; font-weight: bold; letter-spacing: .6px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); -webkit-tap-highlight-color: transparent;
}
.map-search-button:disabled { opacity: .5; cursor: default; }
.search-results {
  margin-top: 5px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.15); display: none;
}
.search-result-item {
  padding: 10px 14px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--border); min-height: 44px;
  display: flex; flex-direction: column; justify-content: center;
  -webkit-user-select: none; user-select: none;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:active { background: var(--surface); }
.result-name { font-weight: bold; font-size: 13px; color: var(--text); }
.result-detail { font-size: 10px; color: var(--muted); margin-top: 2px; }

.locate-btn {
  position: absolute; top: 10px; right: 10px; z-index: 900;
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--bg); border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.locate-btn.locating { animation: spin .8s linear infinite; }
.locate-btn.map-overview-action {
  width:auto; min-width:154px; height:44px; padding:0 12px;
  white-space:nowrap; font-family:inherit; font-size:10px; font-weight:bold;
  letter-spacing:.45px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.compass-btn.active { background: var(--amber); border-color: var(--amber); }

/* ── Panel ── */
.panel {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 12px; overflow-y: auto; flex-shrink: 0;
  max-height: 48vh;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 0 14px; height: 44px; border: none; border-radius: 9px;
  font-family: inherit; font-size: 11px; letter-spacing: 1px;
  cursor: pointer; transition: opacity .15s; width: 100%;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: #fff; font-weight: bold; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-green     { background: var(--green); color: #fff; font-weight: bold; }
.btn-outline   { background: none; border: 1px solid var(--accent); color: var(--accent); }
.btn-row       { display: flex; gap: 8px; }
.btn-row .btn  { flex: 1; }
.btn-sm        { height: 34px; font-size: 10px; }

/* ── Form elements ── */
.field { margin-bottom: 8px; }
.field label { font-size: 10.5px; color: var(--muted); letter-spacing: 1px; display: block; margin-bottom: 3px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); -webkit-text-fill-color: var(--text); -webkit-appearance: none;
  padding: 8px 10px; font-family: inherit; font-size: 14px; border-radius: 9px; outline: none;
  min-height: 40px;
}
.field textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 1000px var(--bg) inset; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239e8472' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}

/* ── Route tabs ── */
.route-tabs { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.route-tab {
  flex-shrink: 0; padding: 0 12px; height: 32px; border-radius: 14px; border: 2px solid;
  font-family: inherit; font-size: 10px; cursor: pointer; background: none;
  transition: all .15s; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.route-tab.active { color: #fff !important; }
.route-tab-add {
  flex-shrink: 0; padding: 0 14px; height: 32px; border-radius: 14px;
  border: 2px dashed var(--muted); font-family: inherit; font-size: 16px;
  cursor: pointer; background: none; color: var(--muted);
  -webkit-tap-highlight-color: transparent; display: flex; align-items: center;
}

/* ── Routing toggle ── */
.routing-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; flex-shrink: 0;
}
.routing-toggle button {
  padding: 0 10px; height: 32px; background: none; border: none;
  font-family: inherit; font-size: 9px; cursor: pointer; color: var(--muted);
  letter-spacing: .5px; transition: all .15s; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.routing-toggle button.active { background: var(--accent); color: #fff; }

/* ── Stats ── */
.stats { display: flex; gap: 12px; font-size: 10px; color: var(--muted); margin-bottom: 7px; flex-wrap: wrap; align-items: center; }
.stats strong { color: var(--text); }

/* Offene Profi-Planung: Ein aufgezeichneter Trail darf zunächst ohne Hund
   existieren, wird aber in der Auswertung sichtbar und verbindlich zugeordnet. */
.eval-dog-assignment {
  margin: 2px 0 9px; padding: 9px 10px; border: 1.5px solid var(--border);
  border-radius: 10px; background: var(--bg);
}
.eval-dog-assignment.required { border-color: var(--amber); background: rgba(217,143,31,.08); }
.eval-dog-assignment.assigned { border-color: rgba(34,197,94,.55); }
.eval-dog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.eval-dog-head strong { color: var(--accent); font-size: 10.5px; letter-spacing: .7px; }
.eval-dog-head span { color: var(--muted); font-size: 8px; letter-spacing: .5px; text-align: right; }
.eval-dog-assignment > p { margin: 4px 0 7px; color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.eval-dog-assignment select,
.eval-dog-assignment input {
  width: 100%; min-height: 40px; padding: 8px 30px 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; outline: none;
  background: var(--surface); color: var(--text); -webkit-text-fill-color: var(--text);
  font-family: inherit; font-size: 14px;
}
.eval-dog-assignment select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239e8472' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.eval-dog-assignment select:focus,
.eval-dog-assignment input:focus { border-color: var(--accent); }
.eval-dog-manual { margin-top: 7px; }
.eval-dog-manual label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8.5px; letter-spacing: .7px; }
.eval-dog-status { min-height: 14px; margin-top: 5px; font-size: 9.5px; line-height: 1.35; color: var(--muted); }
.eval-dog-assignment.required .eval-dog-status { color: var(--amber); font-weight: bold; }
.eval-dog-assignment.assigned .eval-dog-status { color: var(--green); }

/* ── Recording ── */
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; margin-right: 4px; }
@keyframes blink { 0%,100%{opacity:1;}50%{opacity:.15;} }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ── Hint text ── */
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-top: 5px; }

/* ── Form fields (Steckbriefe/Gruppen) ── */
.fld-label { display:block; font-size:11px; color:var(--muted); letter-spacing:.5px; margin:9px 0 3px; }
.fld {
  width:100%; box-sizing:border-box; background:var(--surface); color:var(--text);
  -webkit-text-fill-color:var(--text); border:1px solid var(--border); border-radius:9px;
  padding:8px 10px; font-family:inherit; font-size:13px; outline:none; min-height:38px; -webkit-appearance:none;
}
.fld:focus { border-color:var(--accent); }
/* Listenzeile in Steckbrief-/Gruppen-Liste */
.row-card {
  display:flex; align-items:center; gap:10px; background:var(--surface);
  border:1px solid var(--border); border-radius:11px; padding:9px 11px; margin-bottom:7px; cursor:pointer;
}
.row-card:active { background:var(--bg); }
.row-card .avatar {
  width:38px; height:38px; border-radius:50%; flex-shrink:0; object-fit:cover;
  background:var(--accent); color:var(--cream); display:flex; align-items:center; justify-content:center;
  font-size:15px; font-weight:bold;
}
.row-card .row-main { flex:1; min-width:0; }
.row-card .row-title { font-size:13px; font-weight:bold; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-card .row-sub { font-size:10px; color:var(--muted); margin-top:1px; }
.directory-toolbar { flex-shrink:0; margin:0 0 9px; }
.directory-toolbar .fld { padding-right:10px; }
.directory-count { min-height:14px; margin-top:4px; color:var(--muted); font-size:9.5px; letter-spacing:.2px; }
.client-group-badges { display:flex; flex-wrap:wrap; gap:3px; margin-top:4px; }
.client-group-badges span {
  display:inline-block; max-width:100%; padding:1px 6px; border-radius:8px;
  background:rgba(47,70,51,.10); color:var(--accent); font-size:8.5px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.client-level-hint { display:inline-flex; align-items:center; gap:3px; margin-left:5px; }
.client-level-hint i { display:inline-block; width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.client-groups-hint {
  margin:6px 0 2px; padding:7px 8px; border:1px solid var(--border);
  border-radius:8px; background:rgba(239,232,218,.32);
}
.client-groups-label { display:block; margin-bottom:3px; color:var(--muted); font-size:8.5px; letter-spacing:.8px; }
.client-groups-empty { color:var(--muted); font-size:9.5px; }
.team-member-readonly { cursor:default; }
.team-member-readonly:active { background:var(--surface); }
.member-row { display:flex; align-items:center; gap:9px; padding:7px 4px; border-bottom:1px solid var(--border); }
.member-row:last-child { border-bottom:none; }
.member-row input { width:18px; height:18px; accent-color:var(--accent); flex-shrink:0; }
.member-row label { font-size:13px; color:var(--text); flex:1; }
.training-level-row { cursor:pointer; }
.training-level-dot { width:16px; height:16px; border-radius:50%; flex-shrink:0; border:1px solid rgba(0,0,0,.12); }
.training-level-order-actions { display:flex; gap:4px; flex-shrink:0; }
.training-level-order-actions button {
  width:28px; height:28px; padding:0; border:1px solid var(--border); border-radius:7px;
  background:var(--bg); color:var(--accent); font-size:15px; cursor:pointer;
}
.training-level-order-actions button:disabled { opacity:.28; cursor:default; }
.training-level-color-input {
  width:100%; height:42px; box-sizing:border-box; padding:4px; border:1px solid var(--border);
  border-radius:9px; background:var(--surface); cursor:pointer;
}
.training-level-active-row {
  display:flex; align-items:center; gap:9px; margin-top:12px; padding:9px 10px;
  border:1px solid var(--border); border-radius:9px; color:var(--text); font-size:12px;
}
.training-level-active-row input { width:18px; height:18px; accent-color:var(--accent); }

/* Mehrfach-Schlagwörter: echte Buttons statt nativer Mehrfach-Selects, damit
   Android-/iOS-Picker keine Auswahl verlieren und alle fünf Werte sichtbar sind. */
.tag-choice-list, .tag-filter-list {
  display:flex; flex-wrap:wrap; gap:6px; min-height:36px; align-items:center;
  padding:5px; border:1px solid var(--border); border-radius:9px; background:var(--bg);
}
.tag-choice, .tag-filter-chip {
  width:auto; min-height:34px; padding:6px 10px; border:1px solid var(--border);
  border-radius:17px; background:var(--surface); color:var(--text); font:600 10px/1.2 inherit;
  letter-spacing:.25px; touch-action:manipulation; cursor:pointer;
}
.tag-choice.active, .tag-filter-chip.active {
  border-color:var(--accent); background:var(--accent); color:var(--cream);
}
.tag-choice:disabled { opacity:.42; cursor:default; }
.tag-empty-hint { color:var(--muted); font-size:10px; padding:4px 3px; }
.tag-filter-list { margin-top:7px; min-height:0; border:none; padding:0; background:none; }
.hide-location-pin {
  display:flex; width:28px; height:28px; align-items:center; justify-content:center;
  border-radius:50%; color:#fff; background:#8b5cf6; border:3px solid #fff;
  box-shadow:0 1px 6px rgba(0,0,0,.35); font-size:14px;
}

/* ── Archiv-Untertabs ── */
.arch-subtab {
  flex:1; background:none; border:none; border-bottom:2px solid transparent;
  color:var(--muted); font-family:inherit; font-size:11px; font-weight:bold; letter-spacing:1px;
  padding:10px 0; cursor:pointer;
}
.arch-subtab.active { color:var(--accent); border-bottom-color:var(--amber); }
/* ── Statistik ── */
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:11px; padding:10px 12px; }
.stat-card .val { font-size:22px; font-weight:bold; color:var(--accent); }
.stat-card .lbl { font-size:10px; color:var(--muted); letter-spacing:.5px; margin-top:2px; }
.stat-filter { display:flex; gap:6px; margin-top:8px; }
.stat-filter button { flex:1; background:var(--surface); border:1px solid var(--border); color:var(--muted);
  font-family:inherit; font-size:10px; font-weight:bold; letter-spacing:.5px; padding:7px 0; border-radius:9px; cursor:pointer; }
.stat-filter button.active { background:var(--accent); color:var(--cream); border-color:var(--accent); }

/* ── Archive cards ── */
.archiv-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.archive-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  margin: 8px 12px; padding: 12px; cursor: pointer;
}
.archive-card h3 { font-size: 12px; color: var(--accent); margin-bottom: 3px; letter-spacing: .5px; }
.archive-card .meta { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.route-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.route-tag { font-size: 9px; padding: 2px 7px; border-radius: 9px; border: 1px solid; letter-spacing: .3px; }
.empty { text-align: center; padding: 32px 20px; color: var(--muted); font-size: 12px; }

/* ── Modal ── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 9999; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: var(--bg); border: 1px solid var(--border); padding: 18px 16px; width: 90%; max-width: 360px; border-radius: 11px; max-height: 85vh; overflow-y: auto; position: relative; }
.hide-location-dialog { max-width: 430px; width: min(94%, 430px); }
.hide-location-dialog > h3 { color: var(--accent); letter-spacing: 1px; margin-bottom: 7px; }
.hide-location-choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 9px; }
.hide-location-choice-row .btn { min-width: 0; padding-inline: 8px; font-size: 9.5px; letter-spacing: .45px; }
#hide-location-map {
  width: 100%; height: min(38vh, 260px); min-height: 190px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface);
}
.hide-location-status { min-height: 34px; margin: 8px 1px 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.hide-location-status.ready { color: var(--accent); font-weight: bold; }
.hide-location-status.error { color: var(--red); }
.hide-location-final-actions #hide-location-ok { flex: 1.45; }
@media (max-width: 350px) {
  .hide-location-dialog { padding-inline: 12px; }
  .hide-location-choice-row { grid-template-columns: 1fr; }
  #hide-location-map { min-height: 160px; height: 30vh; }
  .hide-location-final-actions { flex-direction: column-reverse; }
}
.modal h3 { font-size: 12px; margin-bottom: 12px; color: var(--accent); letter-spacing: 1px; padding-right: 30px; }
/* Schließen-X oben rechts in jedem Modal */
.modal-x {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.modal-x:active { background: var(--border); }

/* Trial-/Ablauf-Banner unter der Nav (dezent, tippbar → Freischalt-Dialog) */
#trial-banner {
  flex-shrink: 0; cursor: pointer; text-align: center;
  padding: 7px 14px; font-size: 11px; font-weight: bold; letter-spacing: .3px;
  background: var(--amber); color: #3a2410; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
#trial-banner.archive { background: var(--accent); color: var(--cream); font-weight: normal; }
#trial-banner .tb-strong { font-weight: bold; }

/* Gesperrte Trial-Funktion: ausgegraut + Erklärtext (nicht versteckt) */
.locked-feature { opacity: .45; pointer-events: none; filter: grayscale(.4); }
.locked-note { font-size: 10px; color: var(--muted); text-align: center; margin: 2px 0 6px; font-style: italic; }
/* Nav-Tab im Archiv-Modus gesperrt */
nav button.tab-locked { opacity: .5; }

/* Bei pausierter Tour bleibt nur ein kompakter Fortsetzen-Streifen sichtbar. */
#guide-strip {
  flex-shrink: 0; display: none; align-items: center; gap: 5px;
  padding: 6px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-bottom: 2px solid var(--amber);
  white-space: nowrap;
}
#guide-strip.open { display: flex; }
.gs-title { font-size: 10px; font-weight: bold; color: var(--muted); letter-spacing: .4px; flex-shrink: 0; }
.gs-resume { margin-left:auto; border:0; border-radius:12px; padding:4px 10px; background:var(--amber); color:#3a2410; font:inherit; font-size:10px; font-weight:bold; cursor:pointer; }
.gs-step {
  flex-shrink: 0; border: 1px solid var(--border); border-radius: 14px;
  background: none; color: var(--muted); font-family: inherit; font-size: 10.5px;
  padding: 4px 10px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gs-step small { font-size: 9px; }
.gs-step.gs-cur { background: var(--amber); border-color: var(--amber); color: #3a2410; font-weight: bold; }
.gs-step.gs-ok  { border-color: var(--green); color: var(--green); }
.gs-arrow { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.gs-close {
  flex-shrink: 0; margin-left: auto; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: none; color: var(--muted);
  font-size: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gs-done { font-size: 11.5px; color: var(--text); }

/* Auf schmalen Handys nur den aktuellen Schritt zeigen. So bleiben der
   Fortschritt und das Schließen-X ohne horizontales Wischen erreichbar. */
@media (max-width: 520px) {
  #guide-strip.open {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    overflow: hidden; white-space: nowrap;
  }
  #guide-strip .gs-step,
  #guide-strip .gs-arrow { display: none; }
  #guide-strip .gs-step.gs-cur {
    display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  }
  #guide-strip .gs-close { margin-left: 0; }
  #guide-strip .gs-done {
    grid-column: 1 / -1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  }
}

/* Aufzeichnungs-Hinweis (Bildschirm anlassen) — nur während der Aufnahme sichtbar */
.rec-warn {
  display: none; margin: 10px 0 18px; padding: 9px 10px; border-radius: 11px;
  background: rgba(239,68,68,.10); border: 1.5px solid var(--red);
  color: var(--red); text-align: center;
}
/* Sichtbar im normalen Inhaltsfluss: zwischen START/STOP-Zeile und dem
   „RUNNER FERTIG"-Button (DOM-Reihenfolge). Bewusst NICHT position:fixed —
   zwei Feld-Versuche auf iPhone scheiterten an Stacking-Kontexten
   (Header/Nav bzw. Leaflet-Karte überdeckten das Banner). Entschieden 17.07.2026. */
.rec-warn.show { display: block; }
.rec-warn-main {
  display: block; white-space: nowrap; color: var(--red); font-weight: bold;
  font-size: clamp(10.5px, 3vw, 12px); line-height: 1.35; letter-spacing: -.1px;
}
/* Zusatzzeile bleibt sekundär: gedämpft + normal, damit die rote Hauptzeile führt. */
.rec-warn-sub { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.35; color: var(--muted); font-weight: normal; }
/* Ein Warnsymbol genügt und hält die Hauptzeile auch auf schmalen iPhones kompakt. */
.rec-blink { display: inline-block; font-size: 13px; animation: recBlink 1s steps(1) infinite; }
@keyframes recBlink { 0%,50% { opacity: 1; } 51%,100% { opacity: .12; } }

.track-status { font-size: 10px; }
.track-status-rec { color: var(--red); }
.track-status-saved { color: var(--green); }
.track-status-paused { color: var(--amber); }

/* Zahlwege im Freischalt-Dialog klar trennen: Überweisung mit Referenz oder
   persönliche Revolut-Rechnung mit weiteren Bezahlmöglichkeiten. */
.license-pay-card {
  margin-top: 8px; padding: 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface);
}
.license-pay-card > strong { display: block; font-size: 12px; color: var(--accent); }
.license-pay-card > p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.license-ref-row { display: flex; gap: 6px; align-items: stretch; margin-top: 7px; }
.license-ref-row code {
  flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--accent);
  font-size: 12px; font-weight: bold; text-align: center;
}
.license-ref-row .btn { width: auto; padding: 0 10px; flex-shrink: 0; }
.license-detail-item { margin-top: 7px; }
.license-detail-item > span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9.5px; }
.license-detail-item .license-ref-row { margin-top: 0; }
.license-detail-item code { font-size: 10.5px; }
.license-detail-long {
  overflow-wrap: anywhere; white-space: normal; text-align: left !important;
  line-height: 1.35;
}
.license-bank-extra {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border);
}
.license-bank-extra summary {
  color: var(--muted); cursor: pointer; font-size: 10px; font-weight: bold;
  letter-spacing: .2px;
}
.license-pay-btn { width: 100%; margin-top: 8px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
  background: #2c1a0e; color: #fff; padding: 10px 16px; border-radius: 6px;
  font-size: 12px; z-index: 100001; max-width: 85vw; text-align: center;
  line-height: 1.5; pointer-events: none; opacity: 0; transition: opacity .25s;
  white-space: pre-line;
}

/* ── PWA Install Banner ── */
#install-banner {
  display: none; background: var(--accent); color: #fff;
  padding: 8px 14px; font-size: 10px; letter-spacing: .5px;
  text-align: center; flex-shrink: 0; cursor: pointer;
}
