:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --border: #e4e1da;
  --text: #2b2a27;
  --muted: #6b6860;
  --accent: #2f5d5a;
  --accent-soft: #e4efee;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

h1, h2, h3 { line-height: 1.25; }

/* Header */

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
}

.header-inner h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.header-toggle:hover { background: #d7e7e5; }

.header-toggle-icon {
  display: inline-block;
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.header-toggle[aria-expanded="false"] .header-toggle-icon {
  transform: rotate(180deg);
}

.header-details {
  margin-top: 1.25rem;
}

.header-details.collapsed { display: none; }

.meta-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.4rem;
  margin: 0;
  font-size: 0.92rem;
}

.meta-grid dt {
  color: var(--muted);
  font-weight: 600;
}

.meta-grid dd {
  margin: 0;
}

/* Currency widget */

.currency-widget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--accent-soft);
  border-radius: 10px;
}

.currency-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.currency-row label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

.currency-row input {
  width: 8rem;
  max-width: 40vw;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
}

.currency-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--surface);
}

.currency-swap-hint {
  color: var(--muted);
  font-size: 1.1rem;
}

.currency-rate-line {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
}

.tab-btn {
  flex: none;
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 0.5rem;
  white-space: nowrap;
  cursor: pointer;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Sections */

.section {
  display: none;
  padding: 2.25rem 0;
}

.section.active { display: block; }

.section h2 {
  margin: 0 0 1.1rem;
  font-size: 1.35rem;
}

.muted { color: var(--muted); }

.summary-line {
  margin-top: 0.9rem;
  font-weight: 600;
}

.note-list, .checklist {
  margin: 0;
  padding-left: 1.25rem;
}

.note-list li, .checklist li {
  margin-bottom: 0.5rem;
}

.checklist { list-style: "\2610\0020"; }

/* Overview */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}

.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.overview-card-wide {
  grid-column: 1 / -1;
}

.overview-card-title {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.overview-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem 1.5rem;
}

.overview-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.overview-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.overview-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.overview-route-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.overview-route-arrow { color: var(--muted); }

.overview-today-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.overview-today-activities {
  margin: 0;
  padding-left: 1.1rem;
}

.overview-today-activities li { margin-bottom: 0.3rem; }
.overview-today-activities li:last-child { margin-bottom: 0; }

.overview-card-note { margin: 0; color: var(--muted); }

.overview-preview-list {
  margin: 0;
  padding-left: 1.1rem;
}

.overview-preview-list li { margin-bottom: 0.3rem; }

.overview-card-more {
  display: inline-block;
  margin: 0.4rem 0 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.overview-card-more:hover { text-decoration: underline; }

.overview-card .do-next-list { margin-bottom: 0; }

.overview-leaflet-map {
  height: 280px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-soft);
  margin-bottom: 0.6rem;
}

@media (max-width: 600px) {
  .overview-leaflet-map { height: 220px; }
}

/* Flights */

.flights-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flight-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}

.flight-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.flight-direction {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flight-route { font-weight: 600; }
.flight-times, .flight-date { color: var(--muted); font-size: 0.9rem; }
.flight-date { text-align: right; }

/* Day timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.day-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.day-title {
  margin: 0.1rem 0 0.6rem;
  font-size: 1.05rem;
}

.day-activities {
  margin: 0;
  padding-left: 1.3rem;
}

.day-activities li { margin-bottom: 0.35rem; }
.day-activities li:last-child { margin-bottom: 0; }

.good-to-know {
  margin-top: 0.75rem;
  background: #fbf3e7;
  border: 1px solid #ecdcbe;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}

.good-to-know-heading {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a5a20;
}

.good-to-know ul {
  margin: 0;
  padding-left: 1.1rem;
}

.good-to-know li { margin-bottom: 0.3rem; }
.good-to-know li:last-child { margin-bottom: 0; }

/* Pills (city tags) */

.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.c0 { background: var(--accent-soft); color: var(--accent); }
.c1 { background: #e4efee; color: #2f5d5a; }
.c2 { background: #f3e8d8; color: #8a5a20; }
.c3 { background: #ece3f4; color: #5f3b8c; }
.c4 { background: #fde3e3; color: #a13c3c; }
.c5 { background: #e1efe0; color: #3d7a3a; }
.c6 { background: #dfeaf7; color: #2b5f97; }
.c7 { background: #f7e6ef; color: #99406e; }
.c8 { background: #f0ece1; color: #6b5b2e; }

.status-booked { background: #e1efe0; color: #3d7a3a; }
.status-pending { background: #fde3e3; color: #a13c3c; }

.priority-urgent { background: #fde3e3; color: #a13c3c; }
.priority-soon { background: #f3e8d8; color: #8a5a20; }
.priority-waiting { background: #e4efee; color: #2f5d5a; }

/* "Do next" priority panel, above the grouped bookings tables */

#bookings-priority:empty { display: none; }

.do-next-heading {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.do-next-list {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.do-next-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
}

.do-next-list .pill { flex-shrink: 0; }

/* Tables */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:last-child td { border-bottom: none; }

#accommodation-table td:not(:first-child), #accommodation-table th:not(:first-child),
#budget-table td:not(:first-child), #budget-table th:not(:first-child) { text-align: right; }

#accommodation-table td:last-child, #accommodation-table th:last-child { text-align: left; }

.bookings-table td, .bookings-table th { text-align: left; }

.booking-group { margin-bottom: 1.75rem; }
.booking-group:last-child { margin-bottom: 0; }

.booking-group-title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: var(--accent);
}

/* Booking tracker table: fixed layout + wrapping so long URLs/labels
   never force the page wider — the .table-wrap scrollbar is the only
   thing allowed to grow, and only below the min-width breakpoint. */

.bookings-table {
  table-layout: fixed;
  min-width: 960px;
}

.bookings-table th {
  white-space: nowrap;
}

.bookings-table td {
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bookings-table th:nth-child(1), .bookings-table td:nth-child(1) { width: 16%; }
.bookings-table th:nth-child(2), .bookings-table td:nth-child(2) { width: 9%; }
.bookings-table th:nth-child(3), .bookings-table td:nth-child(3) { width: 13%; }
.bookings-table th:nth-child(4), .bookings-table td:nth-child(4) { width: 16%; }
.bookings-table th:nth-child(5), .bookings-table td:nth-child(5) { width: 13%; }
.bookings-table th:nth-child(6), .bookings-table td:nth-child(6) { width: 13%; }
.bookings-table th:nth-child(7), .bookings-table td:nth-child(7) { width: 20%; }

/* Links cell */

.links-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.links-cell a {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.links-cell a::before {
  content: "↗";
  display: inline-block;
  margin-right: 0.3rem;
  font-weight: 400;
  color: var(--muted);
}

.links-cell a:hover { text-decoration: underline; }

/* Candidates cell */

.candidates-cell {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.candidate-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.candidate-row a, .candidate-name {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.candidate-name { color: var(--text); }

.candidate-row a:hover { text-decoration: underline; }

.candidate-price {
  font-size: 0.8rem;
  color: var(--muted);
}

.row-subtotal td { font-weight: 600; border-top: 2px solid var(--border); }
.row-total td { font-weight: 700; color: var(--accent); font-size: 1.02rem; }
.row-note td { color: var(--muted); font-style: italic; }

/* Food */

.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.food-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.food-card p { margin: 0.5rem 0 0; font-size: 0.92rem; }

/* Footer */

.page-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1.25rem 3rem;
}

.page-footer code {
  background: var(--accent-soft);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.load-error {
  background: #fde3e3;
  color: #a13c3c;
  border: 1px solid #f0b8b8;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-top: 1.5rem;
}

@media (max-width: 600px) {
  .header-inner { padding: 2rem 1.25rem 1.25rem; }
  .header-inner h1 { font-size: 1.55rem; }
  .meta-grid { grid-template-columns: 1fr; row-gap: 0.15rem; margin-bottom: 0.4rem; }
  .meta-grid dt { margin-top: 0.5rem; }
  th, td { padding: 0.55rem 0.6rem; font-size: 0.86rem; }
}

/* Map */

.map-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

#map-day-select {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

#map-day-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.map-nav-btn {
  flex: none;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.map-nav-btn:hover:not(:disabled) { background: var(--accent-soft); }

.map-nav-btn:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.5;
}

#leaflet-map {
  height: 480px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--accent-soft);
}

.map-pin-list {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  #leaflet-map { height: 360px; }
}
