:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #627184;
  --line: #d7dde5;
  --panel: #ffffff;
  --soft: #f3f6f8;
  --brand: #116a5c;
  --brand-dark: #0a4a40;
  --accent: #c84630;
  --gold: #b98518;
  --shadow: 0 18px 40px rgba(29, 43, 58, 0.13);
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.planner {
  padding: 28px clamp(18px, 4vw, 56px) 18px;
  background:
    linear-gradient(135deg, rgba(17, 106, 92, 0.98), rgba(18, 61, 78, 0.96)),
    url("https://images.unsplash.com/photo-1525625293386-3f8f99389edd?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
  color: white;
}

.title-block {
  max-width: 1180px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbe9df;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 1;
  letter-spacing: 0;
}

.search-panel {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 2.2fr) repeat(4, minmax(120px, 1fr)) minmax(130px, auto) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #425160;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 106, 92, 0.16);
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.primary-action {
  height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.primary-action:hover {
  background: #a83221;
}

.is-loading .primary-action {
  opacity: 0.7;
  pointer-events: none;
}

.status {
  min-height: 22px;
  max-width: 1180px;
  margin: 10px auto 0;
  color: #e8f7f2;
  font-size: 0.92rem;
}

.status[data-state="error"] {
  color: #ffd7d2;
}

.status[data-state="ok"] {
  color: #d6ffe8;
}

.workspace {
  min-height: 0;
  max-width: 1180px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.results-pane {
  min-height: 0;
  background: var(--soft);
}

.summary {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 248, 0.96);
  backdrop-filter: blur(10px);
}

.summary p {
  margin: 0;
  color: var(--muted);
}

.summary p:first-child {
  margin-bottom: 3px;
  color: var(--ink);
  font-weight: 800;
}

.summary p + p {
  margin-top: 4px;
}

.results {
  display: grid;
  gap: 12px;
  padding: 14px 0 28px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.result-card:hover,
.result-card:focus {
  transform: translateY(-2px);
  border-color: rgba(17, 106, 92, 0.45);
  box-shadow: 0 12px 24px rgba(25, 44, 59, 0.12);
  outline: none;
}

.result-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.operator {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  text-align: right;
}

.result-card h2 {
  margin: 12px 0 4px;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.address,
.note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.category {
  display: inline-flex;
  width: fit-content;
  margin: 2px 0 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f7ede3;
  color: #7d3d22;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.note {
  font-size: 0.88rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
  background: #fafbfc;
}

.metrics dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics dd {
  margin: 4px 0 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.navigate-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.navigate-action:hover,
.navigate-action:focus {
  background: var(--brand-dark);
  outline: none;
}

.navigation-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.raw-rates {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 0.9rem;
}

.raw-rates p {
  margin: 0;
  line-height: 1.4;
}

.availability {
  width: fit-content;
  margin-bottom: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f5ef;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.source-details {
  margin-top: 10px;
  color: var(--muted);
}

.source-details summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 800;
}

.source-details ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.source-details li {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(80px, 0.4fr) 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
  background: #ffffff;
}

.source-details span,
.source-details strong {
  color: var(--ink);
}

.source-details em {
  font-style: normal;
  line-height: 1.35;
}

.source-details a {
  color: var(--accent);
  font-weight: 800;
}

@media (max-width: 1050px) {
  .search-panel {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .field-wide {
    grid-column: 1 / -1;
  }

  .primary-action {
    grid-column: 1 / -1;
  }

  .toggle-field {
    justify-content: center;
  }

  .workspace {
    width: min(100% - 28px, 760px);
  }

  .results-pane {
    border-right: 0;
  }

  .source-details li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .planner {
    padding: 22px 14px 14px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

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