:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #65727f;
  --line: #d9e0e6;
  --panel: #ffffff;
  --soft: #f4f7f9;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --gold: #b7791f;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(31, 41, 51, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 480px) minmax(0, 1fr);
  min-height: calc(100vh - 36px);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.suggestions {
  position: absolute;
  z-index: 8;
  display: grid;
  max-height: 260px;
  overflow: auto;
  padding: 5px;
  background: #fff;
  border: 1px solid #c9d3db;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(31, 41, 51, 0.18);
}

.suggestions button {
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  background: transparent;
  border-radius: 5px;
}

.suggestions button:hover,
.suggestions button.active {
  background: #eaf6f4;
}

.suggestions strong {
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestions span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.brand-lockup img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 12ch;
  margin-bottom: 0;
  font-size: clamp(2rem, 8vw, 3.25rem);
  line-height: 0.98;
  letter-spacing: 0;
}

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

.search-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #364452;
  font-size: 0.86rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d3db;
  border-radius: 6px;
  outline: none;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.location-grid {
  display: grid;
  gap: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.filter-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filter-group legend {
  padding: 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: #405161;
  font-size: 0.84rem;
}

.fuel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button {
  min-height: 44px;
  padding: 10px 15px;
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.hidden {
  display: none !important;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: #e8eef2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mode-tabs button {
  min-height: 38px;
  color: #52606d;
  font-size: 0.84rem;
  background: transparent;
  border-radius: 5px;
}

.mode-tabs button.active {
  color: #fff;
  background: var(--accent);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-tabs button {
  min-height: 36px;
  padding: 8px 9px;
  color: var(--muted);
  font-size: 0.82rem;
  background: transparent;
  border-radius: 5px;
}

.category-tabs button.active {
  color: #fff;
  background: #334e68;
}

.status {
  min-height: 46px;
  padding: 12px;
  color: #34495e;
  background: #eef7f6;
  border: 1px solid #c5e5e1;
  border-radius: 6px;
}

.status.error {
  color: var(--danger);
  background: #fff2f0;
  border-color: #ffd1cc;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

#result-count {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.results-list {
  display: grid;
  gap: 10px;
}

.place-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  min-height: 142px;
  overflow: hidden;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.place-photo {
  position: relative;
  min-height: 122px;
  overflow: hidden;
  background: #dbe4ea;
  border-radius: 6px;
}

.place-photo img {
  width: 100%;
  height: 100%;
  min-height: 122px;
  object-fit: cover;
  display: block;
}

.place-photo span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 7px;
  overflow: hidden;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(31, 41, 51, 0.78);
  border-radius: 5px;
}

.place-content {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.place-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.place-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.place-title-row strong {
  padding: 4px 6px;
  color: #73510d;
  font-size: 0.74rem;
  white-space: nowrap;
  background: #fff6df;
  border-radius: 5px;
}

.place-address {
  margin: 0;
  color: #405161;
  font-size: 0.83rem;
  line-height: 1.35;
}

.place-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.place-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.place-tags span {
  padding: 4px 7px;
  color: #334e68;
  font-size: 0.74rem;
  font-weight: 750;
  background: var(--soft);
  border: 1px solid #e2e8ee;
  border-radius: 5px;
}

.place-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.place-actions a {
  min-height: 34px;
  padding: 8px 10px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  background: #eaf6f4;
  border-radius: 6px;
}

.place-actions a.secondary {
  color: #73510d;
  background: #fff6df;
}

.trip-actions {
  align-items: center;
}

.affiliate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding: 8px;
  background: #f7fafc;
  border: 1px solid #e2e8ee;
  border-radius: 8px;
}

.affiliate-actions a {
  min-height: 30px;
  padding: 6px 8px;
  color: #334e68;
  font-size: 0.76rem;
  background: #fff;
  border: 1px solid #e2e8ee;
}

.affiliate-actions a:hover {
  color: #fff;
  background: #334e68;
  border-color: #334e68;
}

.trip-summary {
  display: grid;
  gap: 6px;
  padding: 12px;
  color: #334e68;
  background: #eef7f6;
  border: 1px solid #c5e5e1;
  border-radius: 8px;
}

.trip-summary strong {
  color: var(--accent-dark);
  font-size: 1.1rem;
}

.trip-summary span {
  color: #52606d;
  font-size: 0.84rem;
}

.day-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-number {
  display: grid;
  min-height: 64px;
  place-items: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  background: #334e68;
  border-radius: 6px;
}

.day-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.day-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.day-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.lock-stop {
  min-height: 30px;
  padding: 6px 8px;
  color: #52606d;
  font-size: 0.74rem;
  background: var(--soft);
  border: 1px solid var(--line);
}

.lock-stop.active {
  color: #fff;
  background: #73510d;
  border-color: #73510d;
}

.day-body p {
  margin: 0;
  color: #52606d;
  font-size: 0.84rem;
  line-height: 1.35;
}

.fuel-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fuel-summary div {
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.fuel-summary strong {
  color: var(--accent-dark);
  font-size: 1.45rem;
  line-height: 1;
}

.alternate-stops {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.alternate-stops button {
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 8px 9px;
  color: #334e68;
  text-align: left;
  white-space: normal;
  background: #f7fafc;
  border: 1px solid #e2e8ee;
  border-radius: 6px;
}

.alternate-stops button.active {
  color: #fff;
  background: #334e68;
  border-color: #334e68;
}

.alternate-stops strong {
  font-size: 0.82rem;
}

.alternate-stops span {
  color: inherit;
  font-size: 0.73rem;
  opacity: 0.82;
}

.disclosure {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.disclosure a {
  display: inline-block;
  margin-left: 8px;
  color: var(--accent-dark);
  font-weight: 800;
}

.legal-page {
  width: min(760px, calc(100% - 32px));
  margin: 48px auto;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.legal-page h1 {
  max-width: none;
  margin-bottom: 18px;
  font-size: 2rem;
  line-height: 1.1;
}

.legal-page p {
  color: #405161;
  line-height: 1.55;
}

.legal-page a {
  color: var(--accent-dark);
  font-weight: 800;
}

.map-panel {
  position: relative;
  min-height: 520px;
}

#map {
  position: absolute;
  inset: 0;
}

.mapboxgl-popup-content {
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(31, 41, 51, 0.18);
}

.marker {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  background: #334e68;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.25);
}

.marker.midpoint {
  background: var(--gold);
}

.marker.place {
  width: 20px;
  height: 20px;
  background: var(--accent);
}

.marker.stop {
  background: #73510d;
}

@media (max-width: 880px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    max-width: 14ch;
    font-size: 2.4rem;
  }

  .map-panel {
    min-height: 56vh;
  }
}

@media (max-width: 560px) {
  .control-panel {
    padding: 18px;
  }

  .toolbar,
  .category-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .mode-tabs {
    grid-template-columns: 1fr;
  }

  .toolbar button {
    grid-column: 1 / -1;
  }

  .brand-lockup {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
  }

  .brand-lockup img {
    width: 58px;
    height: 58px;
  }

  .place-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .place-photo,
  .place-photo img {
    min-height: 116px;
  }

  .day-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

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

  .fuel-summary {
    grid-template-columns: 1fr;
  }
}
