:root {
  --ink: #18211f;
  --muted: #65706b;
  --line: #d8ddd6;
  --paper: #fbfaf6;
  --surface: #ffffff;
  --surface-2: #eef3ed;
  --green: #216b57;
  --green-dark: #16493d;
  --coral: #cf5f46;
  --amber: #bf7a1f;
  --blue: #356b9f;
  --shadow: 0 12px 32px rgba(24, 33, 31, 0.12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.4;
}

button, input, select {
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.94);
  position: sticky;
  top: 0;
  z-index: 800;
}

.eyebrow {
  margin: 0 0 0.1rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 0.9rem;
}

h3 {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.topnav a {
  color: var(--green-dark);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.ghost-button,
.primary-button,
.filter-pill,
.discovery-tab,
.icon-button,
.stepper-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.ghost-button,
.primary-button {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  font-weight: 750;
}

.primary-button {
  width: 100%;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.compact-button,
.wide-button {
  width: auto;
}

.wide-button {
  width: 100%;
}

.trip-list-control {
  display: grid;
  gap: 0.18rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trip-list-control select {
  min-width: 150px;
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.save-status {
  min-width: 4.6rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.primary-button[disabled] {
  cursor: default;
  opacity: 0.72;
}

.stepper-button[disabled] {
  cursor: default;
  opacity: 0.42;
}

.icon-button,
.stepper-button {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.icon-button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.ghost-button:hover,
.filter-pill:hover,
.icon-button:hover,
.stepper-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.ghost-button.active {
  border-color: var(--green);
  color: var(--green-dark);
  background: #edf7f0;
}

svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.planner-shell {
  display: grid;
  grid-template-columns: minmax(330px, 440px) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  height: calc(100vh - 73px);
  min-height: 720px;
}

.timeline-pane,
.map-pane {
  min-height: 0;
}

.timeline-pane {
  overflow: auto;
  padding-right: 0.2rem;
}

.date-controls,
.summary-strip,
.warnings-band,
.itinerary-section,
.calendar-section,
.destination-detail,
.map-toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(24, 33, 31, 0.04);
}

.date-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.75rem;
}

.date-controls label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-controls input,
.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 2.35rem;
  padding: 0 0.65rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.75rem;
  margin-top: 0.75rem;
}

.summary-strip div {
  min-width: 0;
  padding: 0.55rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary-strip strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

.warnings-band,
.itinerary-section,
.calendar-section {
  margin-top: 0.75rem;
  padding: 0.8rem;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.view-tab {
  min-height: 2.25rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 800;
}

.view-tab.active {
  background: #fff;
  border-color: var(--line);
  color: var(--green-dark);
  box-shadow: 0 1px 0 rgba(24, 33, 31, 0.04);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: var(--green-dark);
  margin-bottom: 0.7rem;
}

#warningsList {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#warningsList li {
  border-left: 3px solid var(--amber);
  background: #fff8eb;
  color: #654216;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  font-size: 0.84rem;
}

#warningsList li.good {
  border-left-color: var(--green);
  background: #edf7f0;
  color: var(--green-dark);
}

.itinerary-list {
  display: grid;
  gap: 0.65rem;
}

.empty-state {
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.9rem;
}

.stop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.72rem;
}

.stop-card header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 0.55rem;
}

.stop-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.stop-card .dates {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.stop-actions {
  display: flex;
  gap: 0.25rem;
}

.stop-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.mini-score {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--ink);
}

.day-stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.travel-leg {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf7;
  padding: 0.62rem;
  display: grid;
  gap: 0.55rem;
}

.travel-leg.caution {
  border-color: rgba(191, 122, 31, 0.65);
  background: #fff8eb;
}

.travel-leg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.travel-leg-route {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.travel-leg-header strong {
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.86rem;
}

.insert-stop-button {
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.insert-stop-button:hover {
  border-color: var(--green);
  background: #edf7f0;
}

.travel-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.travel-mode-toggle button {
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.45rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.travel-mode-toggle button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.travel-leg p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.48rem;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.legend-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--dot-color);
}

.trip-calendar {
  display: grid;
  gap: 0.55rem;
}

.calendar-week {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.calendar-week-label {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-day {
  min-height: 72px;
  padding: 0.38rem;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 0.32rem;
}

.calendar-day:last-child {
  border-right: 0;
}

.calendar-day.outside-window {
  background: #f5f4ee;
  color: #a0a7a2;
}

.calendar-day-header {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-date {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.calendar-location {
  width: 100%;
  min-height: 1.35rem;
  border: 0;
  border-radius: 6px;
  padding: 0.22rem 0.32rem;
  background: var(--stop-color);
  color: #fff;
  cursor: pointer;
  display: grid;
  gap: 0.16rem;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-align: left;
}

.calendar-location small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.58rem;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-location.locked {
  grid-template-columns: auto 1fr;
  align-items: start;
}

.calendar-location.locked small {
  grid-column: 1 / -1;
}

.calendar-location.unplanned {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--line);
  place-items: center;
  text-align: center;
}

.calendar-location.unplanned span {
  color: var(--green-dark);
}

.map-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
}

.map-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 0.75rem;
  padding: 0.75rem;
  align-items: center;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-wrap input {
  padding-left: 2.15rem;
}

.filter-group {
  display: flex;
  gap: 0.4rem;
}

.filter-pill {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  font-size: 0.86rem;
  font-weight: 750;
}

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

.discovery-toggle {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  padding: 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.discovery-tab {
  min-height: 2.1rem;
  padding: 0 0.65rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.discovery-tab.active {
  background: #fff;
  border-color: var(--line);
  color: var(--green-dark);
  box-shadow: 0 1px 0 rgba(24, 33, 31, 0.04);
}

.map-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0.75rem;
  min-height: 0;
}

#map {
  position: relative;
  width: 100%;
  height: min(68vh, 720px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#map[hidden] {
  display: none;
}

.destination-list-panel {
  height: min(68vh, 720px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.destination-list-panel[hidden] {
  display: none;
}

.list-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  gap: 0.75rem;
  align-items: end;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#favoritesPanel .list-panel-header {
  grid-template-columns: 1fr;
}

.list-panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.sort-control {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-control select {
  width: 100%;
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: none;
}

.destination-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.6rem;
  padding: 0.85rem;
}

.destination-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.75rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 0.55rem;
}

.destination-row:hover,
.destination-row.active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(33, 107, 87, 0.12);
}

.destination-row header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: start;
}

.rank-badge {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--green-dark);
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.destination-row h3 {
  margin: 0;
  font-size: 0.98rem;
}

.planner-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 29, 26, 0.42);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.planner-modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(720px, 92vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(20, 29, 26, 0.22);
  padding: 0.9rem;
  display: grid;
  gap: 0.8rem;
}

.modal-panel.compact {
  width: min(420px, 100%);
}

.modal-panel header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
}

.modal-panel h2 {
  margin: 0.12rem 0 0;
  font-size: 1.1rem;
}

.insert-options {
  min-height: 0;
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}

.insert-option {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0.65rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
}

.insert-option:hover {
  border-color: var(--green);
  background: #f8faf7;
}

.insert-option span,
.insert-option small {
  display: block;
}

.insert-option small {
  color: var(--muted);
  margin-top: 0.12rem;
}

.insert-option b {
  color: var(--green-dark);
  font-size: 0.82rem;
}

.insert-date-controls,
.lock-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.insert-date-controls[hidden] {
  display: none;
}

.insert-date-controls label:not(.toggle-field),
.lock-fields label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insert-date-controls input,
.lock-fields input {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.55rem;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.toggle-field {
  grid-column: 1 / -1;
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--green-dark);
  cursor: pointer;
  padding: 0 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 850;
}

.toggle-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green);
}

.modal-actions {
  display: grid;
  gap: 0.55rem;
}

.destination-row .meta {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.list-score {
  color: var(--green-dark);
  font-weight: 900;
  white-space: nowrap;
}

.destination-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.list-score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
}

.list-score-grid span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.32rem 0.36rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.list-score-grid strong {
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
}

.list-row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.list-add-button {
  min-height: 2rem;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 850;
}

.list-add-button[disabled] {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: default;
}

.leaflet-container:focus {
  outline: none;
}

.route-number-icon {
  background: transparent;
  border: 0;
}

.route-number-icon span {
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 16px rgba(24, 33, 31, 0.28);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.route-number-icon-large span {
  width: 42px;
  height: 42px;
  border-width: 3px;
  font-size: 1rem;
  box-shadow: 0 8px 22px rgba(24, 33, 31, 0.32);
}

.route-summary {
  position: absolute;
  z-index: 650;
  top: 0.85rem;
  right: 0.85rem;
  width: min(280px, calc(100% - 1.7rem));
  border: 1px solid rgba(216, 221, 214, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: grid;
  gap: 0.2rem;
  pointer-events: none;
}

.route-summary[hidden] {
  display: none;
}

.route-summary strong {
  font-size: 0.98rem;
}

.route-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.destination-detail {
  overflow: auto;
  min-height: 0;
}

.destination-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(33, 107, 87, 0.22), rgba(207, 95, 70, 0.16)),
    var(--surface-2);
  border-radius: 8px 8px 0 0;
}

.destination-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.destination-media img[hidden] {
  display: none;
}

.image-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(22, 73, 61, 0.3);
  font-size: clamp(3rem, 9vw, 5rem);
  font-weight: 900;
}

.image-fallback[hidden] {
  display: none;
}

.detail-content {
  padding: 0.95rem;
}

#destinationName {
  font-size: 1.28rem;
  margin: 0 0 0.35rem;
}

#destinationSummary {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.score-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem;
  background: #fff;
}

.score-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-tile strong {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.social-breakdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  margin-bottom: 0.9rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 112px 1fr 24px;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.bar-track {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
}

.weather-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  margin-bottom: 0.9rem;
  background: linear-gradient(135deg, rgba(33, 107, 87, 0.06), rgba(255, 255, 255, 0.94));
}

.weather-panel h3 {
  margin-bottom: 0.65rem;
}

.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.weather-card {
  border: 1px solid rgba(216, 221, 214, 0.9);
  border-radius: 8px;
  background: #fff;
  padding: 0.6rem;
}

.weather-card span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.weather-card strong {
  display: block;
  margin: 0.15rem 0 0.25rem;
  color: var(--ink);
  font-size: 0.96rem;
}

.weather-card p,
.weather-advice {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.weather-advice {
  margin-top: 0.65rem;
}

.score-rationales {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-bottom: 0.9rem;
}

.score-rationales h3 {
  margin-bottom: 0.65rem;
}

#scoreRationales {
  display: grid;
  gap: 0.65rem;
}

.rationale-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.7rem;
}

.rationale-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.rationale-card h4 {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.84rem;
}

.rationale-card strong {
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
}

.rationale-card p {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.popup-title {
  margin: 0 0 0.2rem;
  font-weight: 800;
}

.popup-meta {
  color: var(--muted);
  margin: 0;
  font-size: 0.78rem;
}

.mobile-app-header,
.mobile-bottom-nav,
.mobile-preview,
.mobile-list-toggle {
  display: none;
}

@media (max-width: 1100px) {
  .planner-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .timeline-pane {
    overflow: visible;
  }

  .map-detail-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: min(64vh, 560px);
    min-height: 460px;
  }

  .destination-list-panel {
    height: min(64vh, 560px);
    min-height: 460px;
  }
}

@media (max-width: 720px) {
  html,
  body {
    min-height: 100%;
  }

  body.mobile-shell-active {
    padding-bottom: calc(4.65rem + env(safe-area-inset-bottom));
    background: #f7f8f3;
  }

  body.mobile-shell-active .topbar {
    display: none;
  }

  body.mobile-shell-active .mobile-app-header {
    position: sticky;
    top: 0;
    z-index: 850;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    min-height: 4.55rem;
    padding: 0.72rem 0.9rem 0.65rem;
    border-bottom: 1px solid rgba(216, 221, 214, 0.92);
    background: rgba(251, 250, 246, 0.96);
    backdrop-filter: blur(12px);
  }

  body.mobile-shell-active .mobile-app-header h1 {
    font-size: 1.08rem;
  }

  .mobile-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
  }

  .mobile-header-actions .icon-button {
    background: #fff;
  }

  .mobile-trip-name {
    display: block;
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 750;
  }

  .mobile-readonly-badge {
    display: none;
    border: 1px solid rgba(33, 107, 87, 0.22);
    border-radius: 999px;
    background: #edf7f0;
    color: var(--green-dark);
    padding: 0.3rem 0.58rem;
    font-size: 0.72rem;
    font-weight: 850;
    white-space: nowrap;
  }

  body.mobile-readonly .mobile-readonly-badge {
    display: inline-flex;
  }

  body.mobile-shell-active .planner-shell {
    display: block;
    min-height: 0;
    height: auto;
    padding: 0.65rem;
  }

  body.mobile-shell-active .timeline-pane,
  body.mobile-shell-active .map-pane {
    display: none;
    overflow: visible;
  }

  body.mobile-view-route .map-pane,
  body.mobile-view-map .map-pane,
  body.mobile-view-list .map-pane,
  body.mobile-view-info .map-pane {
    display: grid;
    gap: 0.55rem;
  }

  body.mobile-view-calendar .timeline-pane {
    display: block;
  }

  body.mobile-shell-active .date-controls,
  body.mobile-shell-active .warnings-band,
  body.mobile-shell-active .view-tabs,
  body.mobile-shell-active .itinerary-section {
    display: none;
  }

  body.mobile-shell-active .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
    margin: 0 0 0.65rem;
    padding: 0.55rem;
  }

  body.mobile-shell-active .summary-strip div {
    padding: 0.5rem;
  }

  body.mobile-shell-active .summary-strip strong {
    font-size: 0.82rem;
  }

  body.mobile-shell-active .map-toolbar {
    display: none;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.6rem;
    box-shadow: none;
  }

  body.mobile-view-map .map-toolbar,
  body.mobile-view-list .map-toolbar {
    display: grid;
  }

  body.mobile-shell-active .discovery-toggle {
    display: none;
  }

  body.mobile-shell-active .filter-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.mobile-shell-active .filter-pill {
    min-height: 2.15rem;
    padding: 0 0.45rem;
    font-size: 0.78rem;
  }

  body.mobile-shell-active .map-detail-grid {
    display: block;
    min-height: 0;
  }

  body.mobile-shell-active #map {
    display: none;
    height: calc(100dvh - 10rem);
    min-height: 430px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(24, 33, 31, 0.13);
  }

  body.mobile-view-route #map,
  body.mobile-view-map #map {
    display: block;
  }

  body.mobile-view-route .map-toolbar,
  body.mobile-view-route .destination-list-panel,
  body.mobile-view-route .destination-detail,
  body.mobile-view-map .destination-list-panel,
  body.mobile-view-map .destination-detail,
  body.mobile-view-list #map,
  body.mobile-view-list .destination-detail,
  body.mobile-view-info #map,
  body.mobile-view-info .destination-list-panel,
  body.mobile-view-info .map-toolbar {
    display: none;
  }

  body.mobile-view-list .mobile-list-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
  }

  .mobile-list-toggle button {
    min-height: 2.25rem;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 850;
  }

  .mobile-list-toggle button.active {
    border-color: var(--line);
    background: #fff;
    color: var(--green-dark);
  }

  body.mobile-shell-active .destination-list-panel {
    height: auto;
    min-height: calc(100dvh - 14.5rem);
    max-height: none;
    border-radius: 12px;
    box-shadow: none;
  }

  body.mobile-shell-active .list-panel-header {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.72rem;
  }

  body.mobile-shell-active .destination-list {
    padding: 0.7rem;
  }

  body.mobile-shell-active .destination-row {
    padding: 0.68rem;
  }

  body.mobile-shell-active .list-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.mobile-shell-active .destination-detail {
    display: none;
    height: auto;
    min-height: calc(100dvh - 6.2rem);
    border-radius: 12px;
    box-shadow: none;
  }

  body.mobile-view-info .destination-detail {
    display: block;
  }

  body.mobile-shell-active .destination-media {
    border-radius: 12px 12px 0 0;
  }

  body.mobile-shell-active .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.mobile-shell-active .weather-grid {
    grid-template-columns: 1fr;
  }

  body.mobile-view-route .mobile-preview,
  body.mobile-view-map .mobile-preview {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(4.95rem + env(safe-area-inset-bottom));
    z-index: 780;
    display: block;
  }

  .mobile-preview-main {
    width: 100%;
    min-height: 4.15rem;
    border: 1px solid rgba(216, 221, 214, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(24, 33, 31, 0.18);
    padding: 0.65rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
    text-align: left;
  }

  .mobile-preview-main strong,
  .mobile-preview-main small {
    display: block;
    min-width: 0;
  }

  .mobile-preview-main strong {
    font-size: 0.94rem;
  }

  .mobile-preview-main small {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 750;
  }

  .mobile-preview-main b {
    color: var(--green-dark);
    font-size: 0.84rem;
    white-space: nowrap;
  }

  body.mobile-shell-active .route-summary {
    top: 0.65rem;
    right: 0.65rem;
    width: min(230px, calc(100% - 1.3rem));
    padding: 0.62rem;
  }

  body.mobile-shell-active .route-summary strong {
    font-size: 0.88rem;
  }

  body.mobile-shell-active .route-summary span {
    font-size: 0.72rem;
  }

  body.mobile-view-calendar .calendar-section {
    margin-top: 0;
    padding: 0.65rem;
    border-radius: 12px;
    box-shadow: none;
  }

  body.mobile-shell-active .calendar-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.12rem;
  }

  body.mobile-shell-active .legend-chip {
    white-space: nowrap;
  }

  body.mobile-shell-active .calendar-week {
    border-radius: 12px;
    overflow: hidden;
  }

  body.mobile-shell-active .calendar-days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-width: 0;
  }

  body.mobile-shell-active .calendar-day {
    min-width: 0;
    min-height: 78px;
    padding: 0.24rem;
  }

  body.mobile-shell-active .calendar-day-header {
    align-items: baseline;
    gap: 0.12rem;
    font-size: 0.52rem;
    letter-spacing: 0.02em;
  }

  body.mobile-shell-active .calendar-date {
    font-size: 0.78rem;
  }

  body.mobile-shell-active .calendar-location {
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.22rem 0.18rem;
    font-size: 0.54rem;
    line-height: 1.06;
    text-align: center;
  }

  body.mobile-shell-active .calendar-location span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.mobile-shell-active .calendar-location.locked {
    grid-template-columns: 1fr;
  }

  body.mobile-shell-active .calendar-location.locked svg {
    display: none;
  }

  body.mobile-readonly .calendar-location {
    cursor: pointer;
  }

  body.mobile-readonly .calendar-location.unplanned {
    cursor: default;
  }

  body.mobile-readonly .calendar-location small {
    display: none;
  }

  body.mobile-readonly #addDestination,
  body.mobile-readonly #favoriteDestination,
  body.mobile-readonly .list-row-actions,
  body.mobile-readonly .stop-actions,
  body.mobile-readonly .day-stepper,
  body.mobile-readonly .insert-stop-button,
  body.mobile-readonly .travel-mode-toggle,
  body.mobile-readonly #resetPlanner,
  body.mobile-readonly #savePlanner,
  body.mobile-readonly #newTripList,
  body.mobile-readonly #renameTripList,
  body.mobile-readonly #mobileRenameTripList {
    display: none;
  }

  body.mobile-shell-active .travel-leg-header,
  body.mobile-shell-active .travel-leg-route {
    align-items: flex-start;
  }

  body.mobile-shell-active .travel-mode-toggle {
    grid-template-columns: 1fr;
  }

  body.mobile-shell-active .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.15rem;
    padding: 0.42rem 0.5rem calc(0.42rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(216, 221, 214, 0.96);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 24px rgba(24, 33, 31, 0.1);
    backdrop-filter: blur(12px);
  }

  .mobile-bottom-nav button {
    min-width: 0;
    min-height: 3.15rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.18rem;
    font-size: 0.66rem;
    font-weight: 850;
  }

  .mobile-bottom-nav button.active {
    background: #edf7f0;
    color: var(--green-dark);
  }

  .mobile-bottom-nav svg {
    width: 1.16rem;
    height: 1.16rem;
  }
}
