/* ===== Theme tokens ===== */
:root,
[data-theme="day"] {
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --accent-glow: rgba(37, 99, 235, 0.35);
  --bg-base: #e8eef7;
  --bg-gradient-1: #dbeafe;
  --bg-gradient-2: #f0f4fa;
  --bg-gradient-3: #c7d9f5;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(37, 99, 235, 0.08);
  --text: #1e293b;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --surface-hover: rgba(37, 99, 235, 0.08);
  --btn-bg: rgba(255, 255, 255, 0.95);
  --btn-border: rgba(37, 99, 235, 0.28);
  --btn-shadow: 0 1px 4px rgba(37, 99, 235, 0.1);
  --map-filter: saturate(1.05);
  --pin-dim: rgba(148, 163, 184, 0.35);
  --warning-bg: rgba(239, 68, 68, 0.1);
  --warning-border: rgba(239, 68, 68, 0.25);
}

[data-theme="night"] {
  --accent: #f97316;
  --accent-light: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.18);
  --accent-glow: rgba(249, 115, 22, 0.4);
  --bg-base: #0f1419;
  --bg-gradient-1: #1a1520;
  --bg-gradient-2: #121820;
  --bg-gradient-3: #2a1810;
  --glass-bg: rgba(22, 27, 38, 0.62);
  --glass-bg-strong: rgba(28, 34, 48, 0.78);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --surface-hover: rgba(249, 115, 22, 0.12);
  --btn-bg: rgba(28, 34, 48, 0.85);
  --btn-border: rgba(255, 255, 255, 0.12);
  --btn-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  --map-filter: none;
  --pin-dim: rgba(71, 85, 105, 0.5);
  --warning-bg: rgba(251, 146, 60, 0.12);
  --warning-border: rgba(251, 146, 60, 0.3);
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-base);
  overflow-x: hidden;
  max-width: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  width: 100%;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, var(--bg-gradient-1), transparent),
    radial-gradient(ellipse 70% 50% at 80% 90%, var(--bg-gradient-3), transparent),
    var(--bg-gradient-2);
  transition: background 0.5s ease;
}

/* ===== Matte glass ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-inner {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
}

.glass-input {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

/* ===== Header ===== */
.header {
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
  margin: 12px 12px 0;
  padding: 16px 20px 12px;
  border-radius: 16px;
  overflow: visible;
  max-width: calc(100vw - 24px);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px var(--accent-glow));
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.btn-ghost {
  padding: 8px 14px;
  background: var(--btn-bg);
  color: var(--accent);
  border: 1.5px solid var(--btn-border);
  box-shadow: var(--btn-shadow);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-theme {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-size: 1.1rem;
}

.btn-theme:hover {
  box-shadow: 0 0 16px var(--accent-glow);
  border-color: var(--accent);
}

[data-theme="day"] .theme-icon-night { display: none; }
[data-theme="night"] .theme-icon-day { display: none; }

.theme-icon {
  color: var(--accent);
  line-height: 1;
}

/* ===== Month strip ===== */
.month-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
}

.month-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 58px;
  padding: 8px 10px;
  border: 1.5px solid var(--btn-border);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: var(--btn-shadow);
}

.month-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-hover);
}

.month-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

[data-theme="day"] .month-btn:not(.active) .month-count {
  color: var(--text-muted);
}

.month-btn .month-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.month-btn .month-count {
  font-size: 0.7rem;
  opacity: 0.85;
}

.month-btn.active .month-count { opacity: 0.9; }

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  position: relative;
  z-index: 5;
  overflow: visible;
}

.view-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass-bg);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  overflow: visible;
  position: relative;
}

.view-tab {
  padding: 6px 16px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

[data-theme="day"] .view-tab:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--btn-border);
}

.view-tab:hover { color: var(--accent); }

.view-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.toolbar-right {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 200px;
}

/* Filters drawer (desktop: always visible) */
.filters-drawer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-filters {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--btn-bg);
  color: var(--accent);
  border: 1.5px solid var(--btn-border);
  box-shadow: var(--btn-shadow);
  flex-shrink: 0;
}

.filters-chevron {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.header.filters-open .filters-chevron {
  transform: rotate(180deg);
}

.filters-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: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.filters-badge.hidden {
  display: none;
}

.filters-drawer .filter-bar {
  margin-top: 0;
}

.search-wrap input,
.select {
  padding: 8px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  border: 1.5px solid var(--btn-border);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
}

.search-wrap input {
  width: 200px;
  max-width: 100%;
}

.search-wrap input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== Presets ===== */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--btn-shadow);
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.preset-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Transport filters ===== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 88px;
  flex-shrink: 0;
}

.filter-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.85;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--btn-shadow);
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.meta-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 500;
  margin-right: 4px;
  margin-bottom: 4px;
  vertical-align: middle;
}

.transport-tag {
  background: var(--accent-soft);
  color: var(--accent);
}

.card-tags {
  margin-bottom: 8px;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

/* ===== Main layout ===== */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  padding-top: 8px;
}

.main > * {
  min-height: 0;
}

.view-panel {
  display: none;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
}

.view-panel.active { display: flex; flex-direction: column; }

/* ===== Map ===== */
.map-section {
  position: relative;
}

.map-container {
  flex: 1;
  border-radius: 16px;
  overflow: hidden;
  min-height: 300px;
}

.map-container .leaflet-container {
  height: 100%;
  width: 100%;
  background: var(--bg-base);
  filter: var(--map-filter);
  transition: filter 0.5s;
  overflow: hidden;
}

.map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 500;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.75rem;
  max-width: 210px;
  pointer-events: auto;
}

.legend-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.legend-chevron {
  font-size: 0.7rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.map-legend.collapsed .legend-chevron {
  transform: rotate(-90deg);
}

.legend-body {
  margin-top: 6px;
}

.map-legend.collapsed .legend-body {
  display: none;
}

.legend-title {
  display: block;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-toggle .legend-title {
  margin-bottom: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--text);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot-mixed {
  background: #64748b;
  box-shadow: 0 0 0 2px var(--accent-soft);
  border: 1.5px solid var(--accent);
}

.legend-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 6px 0;
}

/* Custom markers */
.custom-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s, opacity 0.3s;
}

.custom-pin.dimmed {
  opacity: 0.25;
  transform: scale(0.75);
}

.custom-pin.highlighted {
  transform: scale(1.4);
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 1000 !important;
}

.custom-pin.selected {
  transform: scale(1.5);
  border-width: 3px;
  border-color: var(--accent);
}

/* ===== List view ===== */
.list-section { overflow: hidden; }

.list-header {
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.list-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  padding-right: 4px;
  align-content: start;
}

.dest-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s;
}

.dest-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.dest-card.dimmed {
  opacity: 0.4;
}

.dest-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.dest-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.dest-card .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dest-card .months-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
}

.cluster-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 500;
  margin-left: 6px;
  vertical-align: middle;
}

/* ===== Calendar matrix ===== */
.calendar-section { overflow: hidden; }

.calendar-wrap {
  flex: 1;
  border-radius: 16px;
  overflow: hidden;
  padding: 12px;
}

.calendar-scroll {
  overflow: auto;
  height: 100%;
}

.cal-table {
  border-collapse: separate;
  border-spacing: 3px;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
}

.cal-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 6px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  min-width: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.cal-table th:hover,
.cal-table th.active-col {
  background: var(--accent);
  color: #fff;
}

.cal-table th.row-header {
  left: 0;
  z-index: 3;
  text-align: left;
  min-width: 200px;
  max-width: 220px;
  cursor: pointer;
}

.cal-table td {
  text-align: center;
  padding: 6px;
  border-radius: 6px;
  background: var(--glass-bg);
}

.cal-table td.active-month {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.cal-table td.active-month::after {
  content: '●';
  color: #fff;
  font-size: 0.6rem;
}

.cal-table tr:hover td.row-label {
  color: var(--accent);
}

.cal-table td.row-label {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  padding: 8px 10px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  font-weight: 500;
  cursor: pointer;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 8px;
}

.cal-table tr.dimmed td { opacity: 0.35; }

/* ===== Sidebar ===== */
.sidebar {
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.sidebar-handle {
  display: none;
}

.sidebar-header {
  display: none;
}

.sidebar-close {
  display: none;
}

.sidebar-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.6; }

.sidebar-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sidebar-content.hidden { display: none; }

#sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scrollbar-width: thin;
}

.detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-country {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.detail-section {
  margin-bottom: 18px;
}

.detail-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}

.detail-desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.highlights-hint {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.highlights-list {
  list-style: none;
}

.highlights-list li,
.highlights-list .highlight-item {
  display: block;
  padding: 0 0 0 16px;
  position: relative;
  font-size: 0.88rem;
}

.highlights-list li::before,
.highlights-list .highlight-item::before {
  content: '→';
  position: absolute;
  left: 0;
  top: 10px;
  color: var(--accent);
}

.highlight-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.highlight-trigger {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}

.highlight-trigger:not(.no-blurb):hover,
.highlight-trigger:not(.no-blurb):focus-visible {
  color: var(--accent);
}

.highlight-trigger.no-blurb {
  cursor: default;
  font-weight: 500;
}

.highlight-chevron {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.highlight-item.highlight-open .highlight-chevron {
  transform: rotate(180deg);
}

.highlight-blurb {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
  font-weight: 400;
}

.highlight-text {
  flex: 1;
  line-height: 1.4;
}

.highlight-photo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--btn-shadow);
}

.highlight-photo:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.highlight-photo svg {
  display: block;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.mini-cal-month {
  padding: 6px 4px;
  text-align: center;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
}

.mini-cal-month.recommended {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.constraints-box {
  padding: 12px;
  border-radius: 10px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.travel-alert-box {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
}

.travel-alert-box strong {
  display: block;
  margin-bottom: 4px;
  color: #ef4444;
}

.travel-alert-box p {
  margin: 0;
  color: var(--text-muted);
}

.budget-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #16a34a;
  font-size: 0.72rem;
  font-weight: 600;
}

[data-theme="night"] .budget-badge {
  color: #4ade80;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.budget-section .budget-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.budget-item {
  padding: 10px;
  border-radius: 10px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  text-align: center;
}

.budget-item.budget-typical {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
}

.budget-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.budget-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.budget-assumptions,
.budget-meta,
.budget-verdict,
.budget-tips {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.budget-verdict {
  font-weight: 500;
  color: var(--text);
}

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

.sidebar-month-header {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.month-list-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s;
}

.month-list-top {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.month-list-item:hover {
  border-color: var(--accent);
}

.month-list-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.month-list-item .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sidebar-sort {
  margin-top: 12px;
}

.sort-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sort-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sort-chip {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1.5px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sort-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.score-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-block.compact {
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.score-row.compact {
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.score-label {
  min-width: 72px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.score-row.compact .score-label {
  min-width: 0;
  font-size: 0.65rem;
}

.score-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.score-fill.score-diversity { background: linear-gradient(90deg, #22c55e, #4ade80); }
.score-fill.score-mustSee { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.score-fill.score-cost { background: linear-gradient(90deg, #f59e0b, #ef4444); }

.score-num {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--text);
  min-width: 28px;
  text-align: right;
}

.score-row.compact .score-num {
  min-width: 0;
  font-size: 0.7rem;
}

.score-legend {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-soft);
}

.sidebar-month-header h2 {
  font-size: 1.2rem;
  color: var(--accent);
}

.sidebar-month-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Leaflet overrides ===== */
.leaflet-control-zoom a {
  background: var(--glass-bg-strong) !important;
  color: var(--text) !important;
  border-color: var(--glass-border) !important;
  backdrop-filter: blur(8px);
}

.leaflet-control-attribution {
  background: var(--glass-bg) !important;
  color: var(--text-soft) !important;
  backdrop-filter: blur(8px);
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: var(--accent-soft) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--accent) !important;
  color: #fff !important;
}

/* Custom cluster bubbles (month-aware) */
.custom-cluster-icon {
  background: transparent !important;
}

.cluster-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.78rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.25s, opacity 0.25s;
}

.cluster-bubble span {
  line-height: 1;
}

.cluster-bubble.cluster-active {
  background: var(--accent);
  color: #fff;
}

.cluster-bubble.cluster-dimmed {
  background: #94a3b8;
  color: #f8fafc;
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: none;
}

.cluster-bubble.cluster-mixed {
  background: #64748b;
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 10px rgba(0, 0, 0, 0.2);
  font-size: 0.68rem;
}

[data-theme="night"] .cluster-bubble.cluster-dimmed {
  background: #475569;
  opacity: 0.5;
}

[data-theme="night"] .cluster-bubble.cluster-mixed {
  background: #334155;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .header {
    margin: 8px 8px 0;
    padding: 10px 12px 8px;
    max-width: calc(100vw - 16px);
    overflow-x: hidden;
  }

  .header-top {
    margin-bottom: 8px;
  }

  .month-strip {
    padding-bottom: 6px;
  }

  .btn-filters {
    display: inline-flex;
  }

  .filters-drawer {
    display: none;
    gap: 8px;
    padding-top: 2px;
    max-height: min(42dvh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
  }

  .header.filters-open .filters-drawer {
    display: flex;
  }

  .filters-drawer .filter-bar {
    padding: 8px 10px;
  }

  .main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    padding: 8px;
    position: relative;
  }

  .main > .view-panel.active {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
  }

  .view-panel#view-map.active {
    min-height: 0;
    height: 100%;
  }

  .map-section {
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100%;
  }

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

  .map-container .leaflet-container {
    min-height: 0;
    height: 100%;
    width: 100%;
  }

  .view-panel#view-list.active,
  .view-panel#view-calendar.active {
    min-height: 0;
    max-height: none;
  }

  .sidebar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 900;
    flex: none;
    width: auto;
    height: auto;
    max-height: min(44dvh, 340px);
    min-height: 0;
    order: unset;
    overflow: hidden;
    transform: translateY(calc(100% - 52px));
    transition: transform 0.28s ease, max-height 0.28s ease, border-radius 0.28s ease, left 0.28s ease, right 0.28s ease, bottom 0.28s ease, top 0.28s ease;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  }

  .sidebar.sidebar-expanded {
    transform: translateY(0);
  }

  .sidebar.sidebar-fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    height: 100dvh;
    width: 100%;
    border-radius: 0;
    transform: none !important;
    z-index: 5001;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    isolation: isolate;
  }

  body.mobile-sheet-fullscreen {
    overflow: hidden;
  }

  body.mobile-sheet-fullscreen .header {
    z-index: 0;
    pointer-events: none;
  }

  body.mobile-sheet-fullscreen .main {
    z-index: 5000;
  }

  body.mobile-sheet-fullscreen .leaflet-control-container,
  body.mobile-sheet-fullscreen .map-legend {
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar.sidebar-fullscreen .sidebar-header {
    padding-top: max(8px, env(safe-area-inset-top));
    flex-shrink: 0;
  }

  .sidebar.sidebar-expanded:not(.sidebar-fullscreen) .detail-title,
  .sidebar.sidebar-fullscreen .detail-title {
    display: none;
  }

  .sidebar-header {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg-strong);
  }

  .sidebar-handle {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 8px 14px 10px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
  }

  .sidebar-drag-pill {
    align-self: center;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-soft);
    opacity: 0.55;
    flex-shrink: 0;
  }

  .sidebar-handle-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-handle-chevron {
    display: none;
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    border: none;
    border-left: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .sidebar-close:hover,
  .sidebar-close:focus-visible {
    color: var(--accent);
    background: var(--surface-hover);
  }

  .sidebar-close.hidden {
    display: none;
  }

  .sidebar-empty,
  .sidebar-content {
    max-height: calc(min(44dvh, 340px) - 52px);
  }

  .sidebar.sidebar-expanded .sidebar-content,
  .sidebar.sidebar-expanded .sidebar-empty {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .sidebar.sidebar-fullscreen .sidebar-empty,
  .sidebar.sidebar-fullscreen .sidebar-content {
    flex: 1;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar.sidebar-fullscreen #sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar.sidebar-expanded:not(.sidebar-fullscreen) #sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-empty {
    padding: 16px;
    font-size: 0.85rem;
  }

  .sidebar-empty .empty-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
  }

  #sidebar-body {
    padding: 14px 16px;
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 6px;
    padding: 6px 10px;
  }

  .view-tabs {
    flex: 1;
    min-width: 0;
    justify-content: stretch;
  }

  .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: stretch;
  }

  .search-wrap {
    flex: 1;
    min-width: 0;
  }

  .search-wrap input {
    width: 100%;
    max-width: 100%;
  }

  .select {
    width: 100%;
    max-width: 100%;
  }

  .presets {
    max-height: none;
    overflow: visible;
  }

  .map-legend {
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    max-width: min(200px, calc(100% - 88px));
    padding: 8px 10px;
    font-size: 0.68rem;
  }

  .legend-toggle {
    display: flex;
  }

  .map-legend.collapsed {
    padding-bottom: 8px;
  }

  .map-legend:not(.collapsed) .legend-body {
    max-height: 110px;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .leaflet-top.leaflet-left {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
  }

  .leaflet-bottom.leaflet-right {
    right: max(4px, env(safe-area-inset-right));
    bottom: max(4px, env(safe-area-inset-bottom));
  }

  .leaflet-control-attribution {
    font-size: 0.62rem !important;
    max-width: 55vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 600px) {
  .header-top {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .subtitle {
    display: none;
  }

  .header-actions {
    margin-left: auto;
    flex-shrink: 0;
  }

  .btn-ghost {
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .btn-theme {
    width: 36px;
    height: 36px;
  }

  .month-btn {
    min-width: 44px;
    padding: 5px 6px;
  }

  .month-btn .month-label {
    font-size: 0.78rem;
  }

  .month-btn .month-count {
    font-size: 0.58rem;
  }

  .view-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .btn-filters {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .map-legend {
    max-width: min(160px, calc(100% - 64px));
  }

  .detail-title {
    font-size: 1.1rem;
  }

  .list-grid {
    grid-template-columns: 1fr;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-label {
    min-width: 0;
  }

  .sidebar {
    left: 6px;
    right: 6px;
    bottom: max(6px, env(safe-area-inset-bottom, 0px));
    max-height: min(48dvh, 320px);
  }
}

@media (min-width: 961px) {
  .filters-drawer {
    display: contents;
  }

  .header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "head head"
      "months months"
      "tabs search"
      "presets presets"
      "transport transport";
  }

  .header-top { grid-area: head; }
  .month-strip { grid-area: months; }
  .toolbar {
    grid-area: tabs;
    margin-bottom: 0;
  }

  .filters-drawer .toolbar-right {
    grid-area: search;
    align-self: center;
    margin-bottom: 10px;
  }

  .presets { grid-area: presets; }
  .filters-drawer .filter-bar { grid-area: transport; }

  .map-legend .legend-toggle {
    display: none;
  }

  .map-legend .legend-body {
    display: block !important;
  }

  .map-legend .legend-body::before {
    content: 'Legendă hartă';
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
  }
}

.hidden { display: none !important; }

/* ===== Tooltips ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  width: max-content;
  max-width: min(240px, 70vw);
  text-align: center;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 10000;
}

[data-tooltip]:hover,
[data-tooltip]:focus-visible {
  z-index: 10001;
}

@media (hover: hover) and (pointer: fine) {
  [data-tooltip]:hover::after,
  [data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
  }
}

/* Touch: tooltips via JS (.touch-tooltip), not CSS pseudo-elements */
.touch-device [data-tooltip]::after {
  display: none !important;
}

.touch-tooltip {
  position: fixed;
  z-index: 10050;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  max-width: min(240px, calc(100vw - 24px));
  text-align: center;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.touch-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

[data-theme="day"] .touch-tooltip {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1e293b;
}

[data-theme="night"] .touch-tooltip {
  background: rgba(28, 34, 48, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
}

.view-tab[data-tooltip]::after {
  max-width: min(220px, 85vw);
  font-size: 0.75rem;
  padding: 7px 11px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

[data-theme="day"] [data-tooltip]::after {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1e293b;
}

[data-theme="night"] [data-tooltip]::after {
  background: rgba(28, 34, 48, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
}

[data-tooltip-pos="bottom"]::after {
  top: calc(100% + 8px);
  bottom: auto;
}

[data-tooltip-pos="top"]::after {
  bottom: calc(100% + 8px);
  top: auto;
}

[data-tooltip-pos="right"]::after {
  left: calc(100% + 8px);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

[data-tooltip-pos="left"]::after {
  left: auto;
  right: calc(100% + 8px);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

/* Default: bottom (most header buttons) */
[data-tooltip]:not([data-tooltip-pos])::after,
[data-tooltip][data-tooltip-pos="bottom"]::after {
  top: calc(100% + 8px);
}

/* Footer: vizual ascuns via .seo-crawler-content; linkuri rămân pentru crawlere */

.noscript-notice {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 2rem;
  background: var(--bg-base);
  color: var(--text);
  overflow: auto;
}

.noscript-notice ul {
  margin: 1rem 0 0 1.25rem;
}

.noscript-notice a {
  color: var(--accent);
}

.seo-crawler-content {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.seo-crawler-content:focus-within {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  white-space: normal;
  padding: 1rem;
}

.seo-dest-list {
  list-style: none;
  padding: 0;
}

.seo-dest-list li {
  margin-bottom: 0.5rem;
}
