/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg:           #0d0d10;
  --surface:      #16161a;
  --surface2:     #1e1e25;
  --border:       #2a2a35;
  --accent:       #d4ff3a;
  --accent-dark:  #a0c820;
  --text:         #eeebe4;
  --muted:        #7a7880;
  --success:      #3dba7b;
  --danger:       #e04444;
  --radius:       8px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

#app { min-height: 100vh; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}
.nav-logo span { color: var(--text); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.nav-user strong { color: var(--text); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary            { background: var(--accent); color: #0a0a0d; }
.btn-primary:hover      { background: var(--accent-dark); }
.btn-primary:disabled   { opacity: 0.5; cursor: default; }

.btn-success            { background: var(--green); color: #0a2300; }
.btn-success:hover      { background: var(--green-dim); }
.btn-success:disabled   { opacity: 0.5; cursor: default; }

.btn-accent-soft            { background: rgba(212,255,58,0.12); color: var(--accent); border: none; }
.btn-accent-soft:hover      { background: rgba(212,255,58,0.22); color: var(--accent-soft); }

.btn-green-soft             { background: rgba(212,255,58,0.13); color: var(--accent); border: none; }
.btn-green-soft:hover       { background: rgba(212,255,58,0.22); color: var(--accent-soft); }

.btn-orange-soft            { background: rgba(212,255,58,0.10); color: var(--orange); border: none; }
.btn-orange-soft:hover      { background: rgba(212,255,58,0.20); color: var(--orange); }

.btn-ghost              { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover        { color: var(--text); border-color: var(--muted); }

.btn-danger             { background: var(--danger); color: #fff; border: none; }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group  { margin-bottom: 18px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 7px;
}

input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
input[type="date"]  { color-scheme: dark; }
select option       { background: var(--surface2); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   TAGS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.tag-accent { background: rgba(212,255,58,0.15); color: var(--accent); }
.tag-muted  { background: var(--surface2); color: var(--muted); }
.tag-past   { background: var(--surface2); color: var(--orange); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.18s;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}

@media (max-width: 800px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-branding { display: none; }
}

.auth-branding {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.auth-branding::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,255,58,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-branding-logo {
  font-family: var(--font-display);
  font-size: 72px;
  letter-spacing: 4px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}
.auth-branding-logo span { color: var(--text); }

.auth-branding-tagline {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 48px;
}

.auth-feature { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.auth-feature-icon { font-size: 22px; margin-top: 2px; }
.auth-feature-text strong { display: block; color: var(--text); font-weight: 500; }
.auth-feature-text span   { font-size: 13px; color: var(--muted); }

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--bg);
}

.auth-form-box  { width: 100%; max-width: 380px; }

.auth-form-title {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.auth-form-sub { color: var(--muted); font-size: 13px; margin-bottom: 32px; }

.auth-toggle {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.auth-toggle a:hover { text-decoration: underline; }

.auth-err {
  background: rgba(224,68,68,0.12);
  border: 1px solid rgba(224,68,68,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #f47;
  margin-bottom: 16px;
}

/* ============================================================
   HOME LAYOUT
   ============================================================ */
.home-wrap { max-width: 1280px; margin: 0 auto; }

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 28px 0;
}

.home-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  padding: 36px 28px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 960px) { .home-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px 16px 28px; } }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title    { font-family: var(--font-display); font-size: 34px; letter-spacing: 1.5px; }
.section-title-sm { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }

.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Tour card */
.tour-card              { cursor: pointer; }
.tour-card-stripe       { height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); }
.tour-card-header       { padding: 18px 22px 0; }
.tour-card-name         { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.5px; margin: 6px 0 10px; line-height: 1.1; }
.tour-card-meta         { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.tour-card-meta span    { display: flex; align-items: center; gap: 7px; }
.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  margin-top: 18px;
}

/* ============================================================
   CALENDAR WIDGET
   ============================================================ */
.calendar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.cal-nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  padding: 2px 8px;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 1;
}
.cal-nav-btn:hover { color: var(--accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-grid-kw {
  grid-template-columns: 18px repeat(7, 1fr);
}
.cal-kw-cell {
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.cal-kw-header { /* empty top-left corner */ }
.cal-dow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  position: relative;
  transition: background 0.1s;
}
.cal-day.other-month { color: var(--border); }
.cal-day.today { font-weight: 700; color: var(--accent); }
.cal-day.has-tour { background: rgba(212,255,58,0.18); color: var(--accent); font-weight: 600; }
.cal-day.has-tour::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.has-tour { font-weight: 600; }
.cal-day.has-tour::after { display: none; } /* dots handled by .cal-day-dots */

/* Per-tour colored dots inside a day cell */
.cal-day-dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  position: absolute;
  bottom: 3px;
  left: 0; right: 0;
}
.cal-day-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Legend list below calendar */
.cal-legend-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}
.cal-legend-swatch {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.cal-legend-kw {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
  flex-shrink: 0;
  min-width: 32px;
}
.cal-legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   PAGE FORM (create / join)
   ============================================================ */
.page-form  { max-width: 660px; margin: 40px auto; padding: 0 28px 60px; }
.page-title { font-family: var(--font-display); font-size: 48px; letter-spacing: 2px; margin-bottom: 6px; }
.page-sub   { color: var(--muted); margin-bottom: 32px; font-size: 14px; }

/* ============================================================
   TOUR DETAIL
   ============================================================ */
.tour-detail { display: flex; flex-direction: column; height: calc(100vh - var(--nav-height, 62px)); }

.tour-detail-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.tour-detail-title { font-family: var(--font-display); font-size: 32px; letter-spacing: 1px; }

.tour-tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 22px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { flex: 1; overflow: hidden; position: relative; }
.tab-scroll  { height: 100%; overflow-y: auto; }

/* Planning polls tab needs its own scroll */
.plan-polls-scroll { height: 100%; overflow-y: auto; }

/* ============================================================
   MAP TAB
   ============================================================ */
#map-container { height: 100%; position: relative; }
#map           { height: 100%; }

.map-controls {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.map-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0;
  /* Collapsed: only icon width */
  max-width: 38px;
  overflow: hidden;
  transition: max-width 0.25s ease, gap 0.25s ease,
              background 0.15s, border-color 0.15s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.map-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
  max-width: 220px;
  gap: 8px;
}
.map-btn-danger         { color: var(--danger); }
.map-btn-danger:hover   { border-color: var(--danger); }

.map-btn-icon  { flex-shrink: 0; font-size: 16px; line-height: 1; }
.map-btn-label { overflow: hidden; }

.map-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(13,13,16,0.92);
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
  z-index: 1000;
  flex-wrap: wrap;
}
.map-info span  { display: flex; align-items: center; gap: 6px; }
.map-info strong { color: var(--text); }

/* Leaflet dark overrides */
.leaflet-container { background: #1a1a20; }
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.leaflet-popup-tip { background: var(--surface); }

/* ============================================================
   CHAT TAB
   ============================================================ */
.chat-layout    { display: flex; flex-direction: column; height: 100%; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg { display: flex; flex-direction: column; max-width: 72%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }

.chat-bubble {
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.mine .chat-bubble       { background: #1a4a6e; color: var(--text); border-bottom-right-radius: 4px; }
.chat-msg:not(.mine) .chat-bubble { background: var(--surface2); border-bottom-left-radius: 4px; }

.chat-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

.chat-input-bar {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface);
}
.chat-input-bar input { flex: 1; }

/* ============================================================
   PARTICIPANTS TAB
   ============================================================ */
.participants-layout { padding: 28px; max-width: 600px; }

.participant-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.participant-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

/* ============================================================
   INFO TAB
   ============================================================ */
.info-layout { padding: 18px 20px; }

/* ── Info tab "new changes" banner ── */
.info-new-banner {
  background: rgba(212,255,58,0.07);
  border: 1px solid rgba(212,255,58,0.3);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.info-new-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.info-new-banner-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.info-new-banner-close:hover { color: var(--text); }
.info-new-banner-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-new-banner-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.info-new-banner-field { color: var(--text); }
.info-new-banner-time  { color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
}
@media (max-width: 720px) { .info-grid { grid-template-columns: 1fr; } }

.info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
}

.plan-date-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 12px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 22px 0; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon  { font-size: 52px; opacity: 0.35; }
.empty-title { font-family: var(--font-display); font-size: 26px; color: var(--text); letter-spacing: 1px; }
.empty-sub   { font-size: 14px; max-width: 300px; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading screens */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 3px;
  color: var(--accent);
  opacity: 0.7;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 14px;
  z-index: 9999;
  animation: slide-up 0.3s ease;
  max-width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.error { border-left-color: var(--danger); }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ============================================================
   MAP LAYOUT WITH SIDEBAR
   ============================================================ */

.map-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* #map-container already has position:relative from earlier rules;
   we just need it to fill the remaining horizontal space */
#map-container {
  flex: 1;
  min-width: 0; /* prevent flex overflow */
  position: relative;
}

/* ---- Sidebar ---- */
.map-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.map-sidebar-section {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.map-sidebar-section:last-child { border-bottom: none; }

.map-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0 4px;
}

.map-sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}
.map-sidebar-item:hover { background: var(--surface2); }
.map-sidebar-item.active {
  background: rgba(240, 120, 0, 0.14);
  outline: 1px solid rgba(240, 120, 0, 0.3);
}

.map-sidebar-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.map-sidebar-label {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.map-sidebar-count {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

@media (min-width: 721px) {
  .map-sidebar-track {
    display: grid;
    grid-template-columns: 11px minmax(0, 1fr);
    align-items: start;
    column-gap: 9px;
    row-gap: 2px;
  }

  .map-sidebar-track .map-sidebar-dot {
    grid-row: 1 / span 2;
    margin-top: 4px;
  }

  .map-sidebar-track-name,
  .map-sidebar-track .map-sidebar-count {
    grid-column: 2;
  }

  .map-sidebar-track .map-sidebar-count {
    white-space: normal;
    line-height: 1.35;
  }
}

.map-sidebar-reset {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.map-sidebar-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

/* Responsive: sidebar moves below map on small screens */
@media (max-width: 720px) {
  .map-layout    { flex-direction: column; }
  .map-sidebar   { width: 100%; height: 180px; border-left: none; border-top: 1px solid var(--border); }
  #map-container { flex: 1; }
}

/* Waypoint toggle button inside sidebar */
.map-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-body);
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.map-sidebar-toggle:hover          { border-color: var(--accent); color: var(--text); }
.map-sidebar-toggle--off           { border-color: var(--danger); color: var(--danger); }
.map-sidebar-toggle--off:hover     { border-color: var(--danger); }

/* Invite link icon button on tour cards */
.btn-copy-link {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-copy-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(212,255,58,0.08);
}

/* Calendar "Alle Touren anzeigen" checkbox */
.cal-show-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.cal-show-all-label input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.cal-show-all-label:hover { color: var(--text); }

/* Divider inside legend for "Andere Touren" */
.cal-legend-divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 4px;
}

/* ============================================================
   CHANGELOG TAB
   ============================================================ */

.cl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cl-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  align-items: center;
  gap: 12px;
}
@media (max-width: 720px) {
  .cl-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.cl-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cl-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.cl-time {
  font-size: 11px;
  color: var(--muted);
}

.cl-field {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.cl-change {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.cl-old {
  color: var(--muted);
  text-decoration: line-through;
  word-break: break-word;
}
.cl-arrow {
  color: var(--muted);
  flex-shrink: 0;
}
.cl-new {
  color: var(--success);
  word-break: break-word;
}

/* ============================================================
   TAB BADGE
   ============================================================ */

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-left: 5px;
  cursor: help;
  /* Tooltip uses native title attribute — style it a bit via cursor */
  flex-shrink: 0;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */

.profile-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

/* iOS-style toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider             { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before     { transform: translateX(20px); }

/* Map fullscreen — CSS-based, works on iOS Safari + all browsers */
#map-container.map-fullscreen-active,
#plan-map-container.map-fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9000;
  border-radius: 0 !important;
}
#map-container.map-fullscreen-active #map,
#plan-map-container.map-fullscreen-active #plan-map {
  height: 100vh !important;
}
#map-container.map-fullscreen-active .map-info {
  display: none;
}
/* Also support native fullscreen on desktop */
#map-container:fullscreen,
#map-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}
#map-container:fullscreen #map,
#map-container:-webkit-full-screen #map {
  height: 100vh;
}
#map-container:fullscreen .map-info,
#map-container:-webkit-full-screen .map-info {
  display: none;
}

/* Tour card home badges */
.tour-card-badges {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.tour-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(212,255,58,0.15);
  color: var(--accent);
  border: 1px solid rgba(212,255,58,0.3);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ============================================================
   COMMUNITY CARDS (landing page)
   ============================================================ */

.community-card {
  margin-bottom: 12px;
  cursor: default;
  transition: border-color 0.15s, opacity 0.15s;
}
.community-card:hover { border-color: var(--accent); }
.community-card-draggable { cursor: grab; }
.community-card-draggable:active { cursor: grabbing; }
.comm-dragging { opacity: 0.4; border-style: dashed; }

/* Drag handle grip dots */
.community-drag-handle {
  font-size: 13px;
  color: var(--muted);
  cursor: grab;
  padding: 0;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}
.community-drag-handle:hover { color: var(--accent); }

.community-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

/* Default community star checkbox */
.community-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  padding-right: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.community-default-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
  margin-left: auto;
}
.community-default-label input[type="checkbox"] { display: none; }
.community-default-star {
  font-size: 13px;
  line-height: 1;
  vertical-align: middle;
  color: var(--muted);
  transition: color 0.15s;
  position: relative;
  top: -1px;
}
.community-default-text {
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  transition: color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.community-default-label:hover .community-default-star,
.community-default-label:hover .community-default-text { color: var(--accent); }
.community-default-label input:checked ~ .community-default-star { color: var(--accent); }
.community-default-label input:checked ~ .community-default-text { color: var(--accent); }
.community-card-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .03em;
}

/* Community Home header */
.home-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-top: 4px;
}

/* ============================================================
   PLANNING PAGE — POLLS
   ============================================================ */

.poll-options { display: flex; flex-direction: column; gap: 8px; }

.poll-option {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.poll-option:hover:not([style*="default"]) { border-color: var(--accent); }
.poll-option-voted { border-color: var(--accent); }

.poll-option-bar {
  position: absolute;
  inset: 0;
  background: rgba(212,255,58,0.12);
  transition: width 0.4s ease;
  pointer-events: none;
}

.poll-option-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
}

.poll-option-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.poll-option-check-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ============================================================
   PLANNING PAGE — MAP
   ============================================================ */

#plan-map-container {
  flex: 1;
  min-height: 0;
  height: 100%;
}
#plan-map { width: 100%; height: 100%; }

/* ============================================================
   PLANNING PAGE — POLLS LAYOUT
   ============================================================ */

.plan-polls-layout {
  display: flex;
  gap: 24px;
  padding: 16px;
  align-items: flex-start;
  min-height: 100%;
}
.plan-polls-main    { flex: 1; min-width: 0; }
.plan-polls-sidebar { width: 420px; flex-shrink: 0; }

@media (max-width: 900px) {
  .plan-polls-layout  { flex-direction: column; }
  .plan-polls-sidebar { width: 100%; }
}

/* ============================================================
   YEAR CALENDAR
   ============================================================ */

.ycal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  position: sticky;
  top: calc(var(--nav-height, 56px) + var(--community-subnav-height, 0px) + 16px);
}

.ycal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ycal-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ycal-month-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 3px;
}

/* Day-of-week header */
.ycal-grid-header {
  display: grid;
  grid-template-columns: 24px repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 1px;
}

.ycal-head {
  font-size: 9px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 0;
}

/* All week rows stacked */
.ycal-rows { display: flex; flex-direction: column; gap: 0; }

/* Numbers row */
.ycal-num-row {
  display: grid;
  grid-template-columns: 24px repeat(7, 1fr);
  gap: 1px;
}

/* KW cell */
.ycal-kw-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--muted);
  line-height: 1;
}

/* Day number cell */
.ycal-day {
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border-radius: 2px;
  color: var(--text);
}
.ycal-day.ycal-out   { color: var(--muted); opacity: 0.3; }
.ycal-day.ycal-today { font-weight: 800; color: var(--accent); outline: 1px solid var(--accent); border-radius: 2px; }

/* Events row — same 8-column grid as numbers row */
.ycal-events-row {
  display: grid;
  grid-template-columns: 24px repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 2px;
}

/* Spanning event bar */
.ycal-event-bar {
  font-size: 7px;
  font-weight: 700;
  border-radius: 2px;
  padding: 1px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  cursor: default;
}



/* ============================================================
   POLL EDIT MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  box-sizing: border-box;
}

/* ============================================================
   TET ATLAS BUTTON + MODAL
   ============================================================ */

.btn-tet {
  background: #009b97;
  color: #ffffff;
  border: 2px solid #009b97;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn-tet:hover {
  background: #00b3ae;
  border-color: #00b3ae;
  color: #ffffff;
}
.btn-tet:active { transform: translateY(1px); }

.tet-modal-overlay {
  padding: 0;
}
.tet-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 95vw;
  height: 92vh;
  max-width: 1600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 20px;
  box-sizing: border-box;
}
.tet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.tet-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.tet-modal-body {
  flex: 1 1 auto;
  min-height: 0;       /* critical so iframe height:100% works inside flex */
  position: relative;
  background: #fff;    /* white default for the brief moment before iframe paints */
}
.tet-modal-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 600px) {
  .tet-modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
  }

  /* Community action buttons: 2-column grid so all 4 are equal width */
  .community-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .community-actions > button {
    width: 100%;
    min-width: 0;          /* allow shrinking inside grid cell */
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
  }
}

/* Compact calendar grid for multi-month tour view */
.cal-grid-sm {
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-grid-sm .cal-day {
  font-size: 9px;
  min-height: 18px;
  padding: 2px 0;
}
.cal-grid-sm .cal-day.other-month { opacity: 0.25; }
.cal-dow-sm {
  font-size: 8px !important;
  padding: 1px 0 !important;
}

/* ============================================================
   MEDIA TAB
   ============================================================ */

.media-upload-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 20px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.media-card:hover { border-color: var(--accent); }

.media-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--surface2);
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.media-card:hover .media-thumb img { transform: scale(1.04); }

.media-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.25);
  pointer-events: none;
  transition: background 0.15s;
}
.media-card:hover .media-play-overlay { background: rgba(0,0,0,0.4); }

.media-card-footer {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.media-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.media-card-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.media-card-date {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.media-card-caption {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 8px;
  right: 8px;
}

.media-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.media-card:hover .media-delete-btn { opacity: 1; }

@media (max-width: 600px) {
  .media-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
  }
}

/* Media pin button & badge */
.media-pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.media-pin-btn.pinned { opacity: 1; }
.media-card:hover .media-pin-btn { opacity: 1; }

.media-pinned-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.7);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 12px;
  z-index: 2;
  pointer-events: none;
}

.media-new-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.5px;
  border-radius: 4px;
  padding: 2px 6px;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* Drag & Drop overlay for media upload */
.media-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 16, 0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.media-drop-overlay-inner {
  border: 3px dashed var(--accent);
  border-radius: 16px;
  padding: 36px 56px;
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: rgba(13, 13, 16, 0.6);
  line-height: 1.5;
}

/* Media drag & drop reorder */
.media-card[draggable="true"] { cursor: grab; }
.media-card[draggable="true"]:active { cursor: grabbing; }
.media-drag-over {
  outline: 2px dashed var(--accent) !important;
  outline-offset: -2px;
}

/* Lightbox navigation */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 48px;
  width: 56px;
  height: 80px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}
.lightbox-nav-btn:hover { background: rgba(212,255,58,0.6); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

/* ============================================================
   COMMUNITY MEDIA PAGE
   ============================================================ */

.cm-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.cm-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.cm-sidebar-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 14px 14px 8px;
}

.cm-tour-list { flex: 1; overflow-y: auto; }

.cm-tour-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.cm-tour-item:hover { background: var(--surface2); }
.cm-tour-item.cm-tour-selected {
  background: rgba(212,255,58,0.12);
  border-left: 3px solid var(--accent);
}
.cm-tour-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-tour-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.cm-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.cm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

@media (max-width: 720px) {
  .cm-layout { flex-direction: column; }
  .cm-sidebar { width: 100%; height: 140px; border-right: none; border-bottom: 1px solid var(--border); }
  .cm-tour-list { display: flex; overflow-x: auto; gap: 0; }
  .cm-tour-item { min-width: 140px; border-bottom: none; border-right: 1px solid var(--border); }
}

.cm-tour-count {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE NAVBAR & COMMUNITY HOME BUTTONS
   ============================================================ */

.nav-logo-img {
  height: 36px;
  vertical-align: middle;
  margin-right: 8px;
}
.nav-logo-text {
  vertical-align: middle;
}
.nav-user-icon {
  vertical-align: middle;
}
.logout-icon { display: none; font-size: 16px; }
.logout-text { display: inline; }

/* Nav icon buttons with optional label (ℹ️ Info, ⚙️ Einstellungen) */
.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-icon-emoji { display: inline-flex; align-items: center; }
.nav-icon-label { font-size: 13px; letter-spacing: .02em; }

/* Mobile: hide logo image and show power icon instead of "Abmelden" */
@media (max-width: 600px) {
  .nav-logo-img  { display: none; }
  .nav-logo      { font-size: 24px !important; }
  .nav-user-icon { display: none; }
  .logout-text   { display: none; }
  .logout-icon   { display: inline; }
  .nav-icon-label { display: none; }   /* icon-only on mobile */
  .nav { padding: 0 12px; }
}

/* Community home buttons: Media + Planung on same row */
.community-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 600px) {
  .home-header { padding: 12px 12px 0; gap: 8px; }
  .tour-detail-title { font-size: 22px !important; }
}

/* Community header responsive */
.back-icon { display: none; }

@media (max-width: 600px) {
  .back-full { display: none; }
  .back-icon { display: inline; }
  /* Prevent map-btn hover expand on touch */
  .home-header .map-btn {
    max-width: 38px !important;
  }
  .home-header .map-btn:hover {
    max-width: 38px !important;
    gap: 0 !important;
  }
  .home-header .map-btn .map-btn-label {
    display: none !important;
  }
}

/* ============================================================
   EMOJI PICKER
   ============================================================ */

.emoji-toggle-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: transform 0.15s;
  line-height: 1;
}
.emoji-toggle-btn:hover { transform: scale(1.2); }

.emoji-picker {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  max-height: 220px;
  overflow-y: auto;
}

.emoji-cat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 8px 0 4px;
}
.emoji-cat-label:first-child { margin-top: 0; }

.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.emoji-item {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.emoji-item:hover {
  background: var(--surface2);
  transform: scale(1.15);
}

/* ============================================================
   PWA – Install Banner (iOS & Android)
   ============================================================ */
#ios-install-banner,
#android-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
#ios-install-banner.visible,
#android-install-banner.visible {
  transform: translateY(0);
}
.ios-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}
.ios-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}
.ios-banner-text {
  flex: 1;
  min-width: 0;
}
.ios-banner-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ios-banner-text span {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.ios-banner-text svg {
  flex-shrink: 0;
  stroke: var(--accent);
}
.ios-banner-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
  line-height: 1;
}
.ios-banner-close:hover { color: var(--text); }


/* PWA Update Banner — erscheint oben */
#pwa-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
#pwa-update-banner.visible {
  transform: translateY(0);
}

/* ============================================================
   APP MODAL BASE (shared by Site-Info, Profile, Community Settings)
   ============================================================ */

.site-info-overlay,
.settings-modal-overlay { padding: 0; }

.site-info-content,
.settings-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 95vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 20px;
  box-sizing: border-box;
}
.site-info-content     { max-width: 800px; }
.settings-modal-content { max-width: 640px; }

.site-info-header,
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}

.settings-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.site-info-body,
.settings-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
}

/* ============================================================
   SITE INFO MODAL (Info / Changelog) — variant-specific
   ============================================================ */

.site-info-tabs {
  display: flex;
  gap: 4px;
}
.site-info-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color .15s, background .15s;
}
.site-info-tab:hover { color: var(--text); }
.site-info-tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--accent);
}

/* Markdown rendering inside view */
.site-info-view { color: var(--text); line-height: 1.55; font-size: 14px; }
.site-info-view h1 { font-family: var(--font-display); font-size: 28px; letter-spacing: 1px; margin: 0 0 16px; }
.site-info-view h2 { font-family: var(--font-display); font-size: 22px; letter-spacing: .5px; margin: 24px 0 10px; color: var(--accent); }
.site-info-view h3 { font-size: 16px; margin: 18px 0 8px; }
.site-info-view p  { margin: 0 0 12px; }
.site-info-view ul, .site-info-view ol { margin: 0 0 14px; padding-left: 22px; }
.site-info-view li { margin-bottom: 4px; }
.site-info-view a  { color: var(--accent); text-decoration: underline; }
.site-info-view code {
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.site-info-view pre {
  background: var(--surface2);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.site-info-view pre code { background: transparent; padding: 0; }
.site-info-view blockquote {
  margin: 0 0 14px;
  padding: 6px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.site-info-view hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.site-info-updated {
  margin-top: 28px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

/* Edit mode — split editor + live preview */
.site-info-edit-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.site-info-edit-split {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}
.site-info-edit-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.site-info-pane-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.site-info-edit-pane textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 240px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: none;
  box-sizing: border-box;
}
.site-info-edit-pane textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.site-info-preview {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 240px;
  box-sizing: border-box;
}
.site-info-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .site-info-content,
  .settings-modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
  }
  .site-info-tab { font-size: 13px; padding: 7px 10px; }
  .site-info-body,
  .settings-modal-body { padding: 16px; }
  /* Stack editor and preview vertically on mobile */
  .site-info-edit-split {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

/* ============================================================
   SETTINGS MODAL (Profile, Community Settings)
   ============================================================ */

.settings-modal-overlay { padding: 0; }
.settings-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 95vw;
  height: 90vh;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 20px;
  box-sizing: border-box;
}
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.settings-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-body);
}
.settings-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
}

@media (max-width: 600px) {
  .settings-modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
  }
  .settings-modal-body { padding: 16px; }
}

/* ============================================================
   Tour Overview Dashboard
   ============================================================ */

.tov-wrap {
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1200px;
}

/* Top row: map (large) + info (medium) */
.tov-row-main {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 12px;
  align-items: stretch;
}

/* Bottom row: 4 small cards */
.tov-row-mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Base card */
.tov-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.tov-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  transform: translateY(-1px);
}

/* Specific min-heights */
.tov-card-map  { min-height: 340px; }
.tov-card-info { min-height: 340px; }
.tov-card-mini { min-height: 150px; }

/* Eyebrow label */
.tov-card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Map card inner */
.tov-map-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}
.tov-map-leaflet {
  flex: 1;
  min-height: 220px;
  border-radius: 8px;
  overflow: hidden;
  /* Leaflet needs explicit height — set via flex + min-height */
  height: 100%;
}
.tov-map-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: 8px;
  min-height: 200px;
  text-align: center;
  padding: 24px;
}
.tov-map-stats {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tov-stat         { font-size: 12px; color: var(--muted-strong); }
.tov-stat strong  { color: var(--text); font-family: var(--font-display); }

/* Info card */
.tov-info-rows {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 4px;
}
.tov-info-row   { display: flex; flex-direction: column; gap: 1px; }
.tov-info-label { font-size: 10px; font-weight: 600; text-transform: uppercase;
                  letter-spacing: 0.07em; color: var(--muted); }
.tov-info-value { font-size: 13px; color: var(--text); }
.tov-info-desc  { font-size: 12px; color: var(--muted); line-height: 1.5; font-style: italic;
                  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.tov-plan-dates { display: flex; flex-direction: column; gap: 5px; }
.tov-plan-row   { font-size: 12px; color: var(--text); display: flex; align-items: center;
                  gap: 5px; flex-wrap: wrap; }
.tov-plan-label { color: var(--muted); }
.tov-plan-maps  { color: var(--accent); font-size: 11px; text-decoration: none; }
.tov-plan-maps:hover { text-decoration: underline; }

/* Chat card */
.tov-chat-row        { display: flex; flex-direction: column; gap: 1px;
                       padding: 5px 0; border-bottom: 1px solid var(--border); }
.tov-chat-row:last-child { border-bottom: none; }
.tov-chat-user       { font-size: 11px; font-weight: 600; color: var(--accent); }
.tov-chat-text       { font-size: 12px; color: var(--muted-strong); line-height: 1.4; }

/* Media card */
.tov-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 6px;
  overflow: hidden;
  flex: 1;
  min-height: 80px;
}
.tov-media-thumb {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  background-color: var(--surface3);
}
.tov-media-yt {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
}

/* Participants card */
.tov-avatars { display: flex; flex-wrap: wrap; gap: 4px; }
.tov-avatar  {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* Changelog card */
.tov-log-row  { display: flex; gap: 8px; align-items: baseline;
                padding: 4px 0; border-bottom: 1px solid var(--border); }
.tov-log-row:last-child { border-bottom: none; }
.tov-log-date { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.tov-log-text { font-size: 12px; color: var(--muted-strong);
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Weather card */
.tov-weather-body { display: flex; flex-direction: column; gap: 7px; }
.tov-weather-location {
  color: var(--accent); font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tov-weather-main { display: flex; align-items: center; gap: 8px; }
.tov-weather-icon { font-size: 24px; line-height: 1; }
.tov-weather-temp {
  font-family: var(--font-mono); font-size: 18px; font-weight: 800; color: var(--text);
}
.tov-weather-rain {
  font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--muted);
}
.tov-weather-na {
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  color: var(--muted); letter-spacing: .4px;
}
.tov-weather-na-hint {
  font-size: 11px; line-height: 1.35; color: var(--muted);
}
.tov-weather-index {
  border-top: 1px solid var(--border); padding-top: 7px;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
.tov-weather-index strong {
  display: block; font-family: var(--font-display); font-size: 18px;
  letter-spacing: .4px; text-transform: uppercase;
}
.tov-weather-index.offroad-wetness-dry strong { color: #4ade80; }
.tov-weather-index.offroad-wetness-damp strong { color: var(--accent); }
.tov-weather-index.offroad-wetness-wet strong { color: #ffb020; }
.tov-weather-index.offroad-wetness-heavy strong { color: #e04444; }

/* Badge in overview eyebrow */
.tov-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--orange); color: #000;
  font-size: 9px; font-weight: 700; padding: 0 4px;
}

/* Empty state hint */
.tov-empty-hint { font-size: 12px; color: var(--muted); }

/* Responsive */
@media (max-width: 900px) {
  .tov-row-main { grid-template-columns: 1fr; }
  .tov-card-map, .tov-card-info { min-height: 280px; }
}
@media (max-width: 640px) {
  .tov-row-mini { grid-template-columns: 1fr 1fr; }
  .tov-wrap     { padding: 14px 14px 28px; gap: 10px; }
}

/* ⊞ overview tab — slightly wider so the icon fits neatly */
.tab-btn[data-tab="overview"] {
  font-size: 16px;
  padding-left: 10px;
  padding-right: 10px;
}
