/* STANDING CONVENTION -- read before adding a `display:` rule.
   Any selector whose element gets toggled via the `hidden` attribute
   (JS sets `.hidden = true/false`, or the template has `hidden` on it)
   must write its display rule as `.foo:not([hidden]) { display: ...; }`,
   never a bare `.foo { display: ...; }`. A bare rule overrides the
   browser's built-in `[hidden] { display: none }` default, so the
   element renders regardless of the attribute -- it silently defeats
   the hidden toggle instead of erroring. This exact bug has recurred
   three times in this file (#trip-owner-controls, .in-itinerary-badge,
   .itinerary-item-controls/.booked-label) at real cost -- once it broke
   the view/edit permission boundary visually for shared viewers. Before
   adding a new rule for an element that can be hidden from JS, grep this
   file for other `:not([hidden])` examples and match the pattern. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666666;
  --border: #dddddd;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --card-bg: #fafafa;
  --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181a;
    --fg: #e8e8e8;
    --muted: #9aa0a6;
    --border: #3a3f42;
    --accent: #5cb787;
    --accent-fg: #0a0a0a;
    --card-bg: #1f2325;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 0 1rem 3rem;
  max-width: 640px;
  margin-inline: auto;
}
/* The trip page's day-by-day itinerary is a horizontally-scrolling
   layout, not a reading column -- the site-wide 640px cap (right, above)
   is correct for every other page (forms, lists, cards) but starves it
   of real screen width for no reason on a wider window. Widened, not
   removed -- still a real cap so it doesn't stretch to absurd line
   lengths on an ultrawide monitor. */
body.wide-page { max-width: 1400px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.1rem; margin: 0; }
.topbar-left { display: flex; flex-direction: column; gap: 0.4rem; }

.main-nav { display: flex; gap: 1rem; }
.main-nav a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.main-nav a.active { color: var(--accent); font-weight: 600; }
.main-nav a:hover { color: var(--fg); }

#login-form:not([hidden]) { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-end; }
#login-hint { margin: 0; font-size: 0.8rem; color: var(--muted); align-self: flex-start; }
.login-row { display: flex; gap: 0.5rem; }

input[type="tel"], input[type="text"], input[type="number"], input[type="date"] {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
}

button {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; }

.link-btn {
  background: none;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
  font-size: 0.85rem;
}

#logged-in-bar:not([hidden]) { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; color: var(--muted); flex-wrap: wrap; }
#logged-in-bar a { color: var(--accent); }

#verify-phone-prompt:not([hidden]) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--danger);
  border-radius: 10px;
  font-size: 0.82rem;
}
#verify-phone-hint { color: var(--danger); }
#verify-send-btn { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
#verify-code-form:not([hidden]) { display: flex; align-items: center; gap: 0.4rem; }
#verify-code-input {
  width: 90px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}
#verify-code-form button[type="submit"] { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
#verify-error:not([hidden]) { display: block; width: 100%; margin: 0; font-size: 0.78rem; color: var(--danger); }

#progress-section { margin-top: 1.25rem; }
#progress-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
#progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
#progress-text { font-size: 0.85rem; color: var(--muted); margin: 0.5rem 0 0; }

#search-section { margin-top: 1.5rem; position: relative; }
#search-section label { display: block; font-size: 0.95rem; margin-bottom: 0.5rem; }
#search-input { width: 100%; }
#search-hint { font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 0; }

#search-results {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: absolute;
  background: var(--bg);
  width: 100%;
  z-index: 10;
}
#search-results:empty { display: none; border: none; }
#search-results li {
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
#search-results li:last-child { border-bottom: none; }
#search-results li:hover { background: var(--card-bg); }

#card-section { margin-top: 2rem; }

.place-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--card-bg);
}

.place-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.25rem;
}

.photo-attribution {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.photo-attribution a { color: inherit; }

.place-name { margin: 0 0 0.25rem; font-size: 1.25rem; }
.place-address { margin: 0 0 0.4rem; color: var(--muted); }
.place-hours { margin: 0 0 1rem; font-size: 0.85rem; }
.place-hours .open-now { font-weight: 600; }
.place-hours .open-now.open { color: var(--accent); }
.place-hours .open-now.closed { color: var(--danger); }

.place-status {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.rate-row, .action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.rate-label { font-size: 0.85rem; color: var(--muted); margin-right: 0.25rem; }
.rate-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}
.rate-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

.action-row { margin-top: 1rem; }
.action-row button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}

.action-feedback {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0.75rem 0 0;
}

/* --- Predictions (top picks), on the merged home screen --- */

#neighbors-section, #botz-section { margin-top: 2.5rem; }
#neighbors-section h2, #botz-section h2 { font-size: 1rem; margin: 0 0 0.35rem; }
#botz-subheading { font-size: 0.78rem; color: var(--muted); font-style: italic; margin: 0 0 0.75rem; }
#botz-stale-notice { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.75rem; }
#botz-locked-notice { font-size: 0.82rem; color: var(--muted); font-style: italic; margin: 0 0 0.75rem; }
#botz-loading { font-size: 0.85rem; color: var(--muted); font-style: italic; margin: 0 0 0.75rem; }
#neighbors-empty, #botz-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.prediction-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.prediction-row:last-child { border-bottom: none; }
.prediction-row.clickable { cursor: pointer; }
.prediction-row.clickable:hover { background: var(--border); }

.prediction-photo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--border);
}

.prediction-info { flex: 1; min-width: 160px; }
.prediction-name { font-weight: 600; }
.prediction-address { font-size: 0.8rem; color: var(--muted); }
.prediction-explanation { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }

.prediction-value { text-align: right; flex-shrink: 0; }
.prediction-value .likeness-percent { font-weight: 600; font-size: 1.05rem; }
.prediction-value .insufficient { font-size: 0.78rem; color: var(--muted); font-style: italic; }

.rerate-buttons { display: flex; gap: 0.4rem; flex-shrink: 0; }
.rerate-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}
.rerate-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

.remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.remove-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

#category-tabs, #candidate-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.category-tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.category-tab-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* --- Trip planning --- */

#new-trip-form, #edit-trip-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1.5rem;
}
#new-trip-form input, #edit-trip-form input { flex: 1; min-width: 120px; }

.destination-field { position: relative; flex: 1; min-width: 120px; }
.destination-field input { width: 100%; }
.autocomplete-dropdown {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: absolute;
  background: var(--bg);
  width: 100%;
  z-index: 10;
}
.autocomplete-dropdown:empty { display: none; border: none; }
.autocomplete-dropdown li { padding: 0.55rem 0.7rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-dropdown li:last-child { border-bottom: none; }
.autocomplete-dropdown li:hover { background: var(--card-bg); }

#suggestions-section { margin-bottom: 2rem; }
#suggestions-list { display: flex; flex-direction: column; gap: 0.5rem; }
.suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--accent);
  border-radius: 8px;
}
.suggestion-text { font-size: 0.9rem; }
.suggestion-plan-btn { flex-shrink: 0; }

#trips-list { display: flex; flex-direction: column; gap: 0.5rem; }
.trip-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.trip-row:hover { background: var(--card-bg); }
.trip-row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
}
.trip-row-destination { font-weight: 600; }
.trip-row-meta { font-size: 0.82rem; color: var(--muted); }
.trip-row-badge {
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  flex-shrink: 0;
}
.trip-delete-btn { flex-shrink: 0; }

#trip-header-section { margin-bottom: 2rem; }
#trip-destination-heading { margin: 0 0 0.25rem; }
#trip-meta { margin: 0 0 1rem; color: var(--muted); }
#location-warning { margin: 0 0 1rem; color: var(--danger); font-size: 0.85rem; }
#trip-owner-controls:not([hidden]) { display: flex; flex-direction: column; gap: 0.75rem; }
#trip-owner-controls > div { display: flex; gap: 0.5rem; }
#trip-edit-controls:not([hidden]) { display: flex; margin-bottom: 0.75rem; }

#lodging-section { margin-bottom: 2.5rem; }
#lodging-heading-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
#lodging-heading-row h2 { margin: 0; }
#add-stay-form-container:empty { display: none; }
.add-stay-form { margin-bottom: 1.25rem; }
.add-stay-mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; }
.add-stay-mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.add-stay-mode-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.add-stay-search-row, .add-stay-custom-row { margin-bottom: 0.6rem; }
.add-stay-custom-row input { width: 100%; }
.add-stay-dates-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.75rem; }
.add-stay-dates-row label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; color: var(--muted); }

#lodging-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 0.25rem; }
.lodging-cell {
  flex: 1 1 0;
  min-width: 110px;
  border-radius: var(--radius, 8px);
  padding: 0.6rem 0.5rem;
  text-align: center;
}
.lodging-cell-empty { border: 1px dashed var(--border); }
.lodging-cell-stay { background: var(--card-bg); border: 1px solid var(--accent); text-align: left; }
.lodging-cell-label { font-size: 0.72rem; color: var(--muted); }
.lodging-cell-stay .lodging-cell-label, .lodging-cell-stay .lodging-cell-date { color: var(--accent); }
.lodging-cell-date { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.4rem; }
.lodging-cell-status { font-size: 0.8rem; color: var(--muted); }
.lodging-cell-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.lodging-cell-name { font-size: 0.85rem; font-weight: 600; overflow-wrap: anywhere; }
.lodging-cell-toggle {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.lodging-cell.draggable { cursor: grab; }
.lodging-cell.draggable:active { cursor: grabbing; }
.lodging-cell-details:not([hidden]) { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.lodging-cell-photo { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.lodging-cell-address { font-size: 0.78rem; color: var(--muted); }
.lodging-cell-controls:not([hidden]) { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.lodging-cell-through-label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.75rem; color: var(--muted); }
.lodging-cell-booked-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.lodging-cell-notes:not([hidden]) {
  display: block;
  width: 100%;
  min-height: 45px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.78rem;
  font-family: inherit;
  resize: vertical;
}

#itinerary-layout { display: flex; gap: 1.25rem; align-items: flex-start; }

#ideas-panel {
  flex: 0 0 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  max-height: 560px;
  overflow-y: auto;
}
#ideas-panel h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.ideas-hint { font-size: 0.75rem; color: var(--muted); margin: 0 0 0.75rem; }
#add-idea-controls { margin-bottom: 0.75rem; }
#add-idea-btn { width: 100%; }
#add-idea-form-container:empty { display: none; }
.add-idea-form { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.add-idea-form .destination-field { width: 100%; }
.add-idea-form input { width: 100%; }
#ideas-items { display: flex; flex-direction: column; gap: 0.75rem; min-height: 2rem; }
#ideas-empty { font-size: 0.8rem; color: var(--muted); font-style: italic; margin: 0; }

#itinerary-days:not([hidden]) { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; flex: 1 1 auto; min-width: 0; }
.day-column {
  flex: 0 0 270px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}
.day-column-heading { margin: 0 0 0.5rem; font-size: 0.95rem; }

.time-lane { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.time-lane:first-child { border-top: none; padding-top: 0; }
.time-lane-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.time-lane-items { display: flex; flex-direction: column; gap: 0.6rem; min-height: 1.75rem; }

.day-notes {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 2px dashed var(--border);
}
.day-notes-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.day-notes-items { display: flex; flex-direction: column; gap: 0.6rem; }

.itinerary-item { display: flex; flex-direction: column; gap: 0.4rem; }
.itinerary-item-summary { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.itinerary-item-name { font-weight: 600; font-size: 0.9rem; }
.itinerary-item-toggle {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.itinerary-item-details:not([hidden]) { display: flex; flex-direction: column; gap: 0.4rem; }
.itinerary-item-photo { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; background: var(--border); }
.itinerary-item-address { font-size: 0.78rem; color: var(--muted); }
.itinerary-item-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.15rem; }
.source-badge {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.closed-warning-badge {
  font-size: 0.7rem;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.in-itinerary-badge:not([hidden]) {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  margin-top: 0.3rem;
}
.booked-badge {
  font-size: 0.7rem;
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.itinerary-item-controls:not([hidden]) { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.importance-select {
  flex: 1;
  min-width: 90px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
}
.booked-label:not([hidden]) { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.notes-textarea {
  width: 100%;
  min-height: 50px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.78rem;
  font-family: inherit;
  resize: vertical;
}

.trip-note {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 1.6rem 0.6rem 0.6rem;
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.trip-note-display { font-size: 0.82rem; cursor: text; white-space: pre-wrap; word-break: break-word; }
.trip-note-body {
  width: 100%;
  min-height: 45px;
  background: transparent;
  color: var(--fg);
  border: none;
  padding: 0;
  font-size: 0.82rem;
  font-family: inherit;
  resize: vertical;
}
.trip-note-remove-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}
.trip-note-remove-btn:hover { color: var(--danger); }
.add-note-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.4rem;
  margin-top: 0.5rem;
  width: 100%;
}
.add-note-form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.add-note-textarea {
  width: 100%;
  min-height: 50px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.78rem;
  font-family: inherit;
}
#candidates-section, #share-section { margin-top: 2.5rem; }
#candidates-empty { font-size: 0.85rem; color: var(--muted); }

#search-new-place-section { position: relative; margin-bottom: 1.25rem; }
#search-new-place-section label { display: block; font-size: 0.85rem; margin-bottom: 0.4rem; }
#search-new-place-section input { width: 100%; }

.itinerary-item.draggable, .trip-note.draggable { cursor: grab; }
.itinerary-item.draggable:active, .trip-note.draggable:active { cursor: grabbing; }
.day-column.drop-zone { transition: background 0.15s; }
.displaced-badge {
  font-size: 0.7rem;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.trip-note.displaced { border-color: var(--danger); }
#share-hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.75rem; }

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.share-row:last-child { border-bottom: none; }
.share-row-phone { font-size: 0.85rem; }

/* --- Trip page: "Rate it" on an item's expanded view, and its dialog ---
   No `display:` on #rate-dialog on purpose -- <dialog> is display:none
   until open by the browser default, and a bare display rule would keep it
   on screen permanently (same trap as the standing convention above). */
/* Rate button + the viewer's own rating, in an item's expanded view only
   (never the collapsed row -- that stays name-only). The wrapper is never
   toggled with `hidden`; the chip inside is, hence :not([hidden]). */
.item-rate-row { display: flex; align-items: center; gap: 0.5rem; align-self: flex-start; }
/* Small chip showing the viewer's own rating. */
.my-rating-badge:not([hidden]) {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  white-space: nowrap;
}

.rate-it-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
}

#rate-dialog {
  width: min(92vw, 460px);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  overflow: auto;
}
#rate-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
#rate-dialog-body { padding: 2.25rem 1.25rem 1.25rem; }
#rate-dialog .place-card { border: none; padding: 0; background: none; }
#rate-dialog-close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.1rem 0.5rem;
}

/* --- Narrow screens: day columns first, Ideas below them ---
   On a phone the side-by-side layout leaves the Ideas panel (220px) and a
   sliver of days, and Ideas dominates the screen. Stack instead, days on
   top (they scroll sideways within their own row, unchanged), Ideas after.
   Only `order`/direction/sizing here, never `display`, so the hidden
   toggles on #itinerary-days keep working (see the standing convention). */
@media (max-width: 700px) {
  #itinerary-layout { flex-direction: column; align-items: stretch; }
  #itinerary-days { order: 1; }
  #ideas-panel { order: 2; flex: none; max-height: none; overflow-y: visible; }
}
