:root {
  --bg: #efe8dc;
  --ink: #1c2430;
  --muted: #5d6878;
  --line: #ddd3c3;
  --paper: #fffdf8;
  --green: #0e6b4f;
  --green-dark: #084635;
  --chip: #f3eee4;
  --shadow: 0 16px 40px rgba(40, 32, 18, 0.08);
  --sidebar: 340px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 400px at 10% -10%, #f7f1e6, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

button, input, select { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 22px 28px 14px;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.eyebrow {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(160deg, #1b8f6a, #0e6b4f 55%, #083d2e);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  width: 20px;
  height: 14px;
  background: #f4efe4;
  clip-path: polygon(50% 0, 100% 42%, 82% 42%, 82% 100%, 18% 100%, 18% 42%, 0 42%);
}
.tagline {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.top-nav { display: flex; gap: 14px; align-items: center; }
.top-nav a, .text-button {
  color: var(--green-dark);
  font-weight: 750;
  text-decoration: none;
}
.top-nav a { border-bottom: 2px solid #b7d7cb; }
.watch-button, .text-button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}
.sponsors { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ad {
  text-align: left;
  border: 1px dashed #c8b89a;
  background: #fffaf2;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.ad strong { display: block; }
.ad small, .fine { color: var(--muted); font-weight: 500; line-height: 1.4; }
.ad-kicker {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a6a32;
  font-weight: 750;
}
.watch-dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(440px, calc(100% - 24px));
  box-shadow: var(--shadow);
}
.watch-dialog form { padding: 18px; }
.watch-dialog h2 { font-family: Palatino, Georgia, serif; margin: 0 0 6px; }
.plan-list { border: 0; padding: 0; margin: 8px 0; }
.plan { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; }
.plan small { display: block; color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; align-items: center; }
.dialog-actions .text-button { width: auto; margin: 0; border: 0; background: transparent; }
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 20px 48px;
}
.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate, .sheet {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.rate h2, .sheet h2 { font-family: Palatino, Georgia, serif; margin: 0 0 6px; }
.sheet { margin-top: 16px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th, .sheet td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 800px) { .rate-grid { grid-template-columns: 1fr; } }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: 16px;
  padding: 0 16px 16px;
  height: calc(100vh - 104px);
  min-height: 560px;
}

.filters {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 16px 16px;
  overflow: auto;
  box-shadow: var(--shadow);
}

fieldset {
  border: 0;
  margin: 12px 0 0;
  padding: 0;
}
legend {
  font-family: Palatino, Georgia, serif;
  font-size: 18px;
  padding: 0;
  margin-bottom: 8px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  font-size: 13px;
  font-weight: 650;
}
input[type="text"], input[type="search"], select, input:not([type="range"]):not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
}
select:focus, input:focus { outline: 2px solid #b7d7cb; border-color: var(--green); }

.city-field { position: relative; }
.city-menu {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow: auto;
}
.city-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.city-menu button:hover, .city-menu button[aria-selected="true"] { background: #eef6f2; }
.city-menu small { color: var(--muted); font-weight: 500; }

.radius-field input { accent-color: var(--green); }
.radius-field span { display: flex; justify-content: space-between; }
output { font-weight: 700; color: var(--green-dark); }

.segmented { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.segmented label {
  margin: 0;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 6px;
  font-size: 13px;
  background: #fff;
}
.segmented input { margin-right: 4px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.source-tools { display: flex; gap: 8px; }
.source-tools button, .back {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.sources { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.source {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-radius: 12px;
  background: var(--chip);
}
.source input { margin-top: 3px; }
.source p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; }
.source a { color: inherit; }
.source .count {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-dark);
  white-space: nowrap;
}
.source .count.error { color: #8d2d2d; font-weight: 600; white-space: normal; max-width: 120px; text-align: right; }
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.search-button {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--green);
  color: white;
  font-weight: 750;
  cursor: pointer;
}
.search-button:disabled { opacity: 0.65; cursor: progress; }
.search-button:hover:not(:disabled) { background: var(--green-dark); }
.form-status { min-height: 1.2em; color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  min-width: 0;
  min-height: 0;
  gap: 12px;
}
.list-pane, .map {
  min-height: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list-pane { position: relative; display: flex; flex-direction: column; }
#list-view { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.results-bar { padding: 16px 16px 8px; }
.results-time {
  margin: 0 0 4px;
  font-weight: 750;
  color: var(--green-dark);
}
.results-sources { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.results-bar h2 {
  margin: 0;
  font-family: Palatino, Georgia, serif;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.results-bar p { margin: 6px 0 0; color: var(--muted); }
.cards { overflow: auto; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 10px; }

.card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
}
.card.selected { border-color: var(--green); box-shadow: 0 0 0 2px #cfe5db; }
.card img, .photo-fallback {
  width: 112px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  background: #e7e0d4;
}
.photo-fallback { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.card h3 { margin: 0; font-size: 18px; }
.card p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pill {
  background: var(--chip);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 650;
}
.empty {
  padding: 28px 12px;
  color: var(--muted);
}

.detail {
  position: absolute;
  inset: 0;
  background: var(--paper);
  overflow: auto;
  padding: 16px;
  z-index: 2;
}
.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.detail h2 { margin: 8px 0 4px; font-family: Palatino, Georgia, serif; font-size: 30px; letter-spacing: -0.03em; }
.address { margin: 0; color: var(--muted); }
.photos { display: flex; gap: 8px; overflow: auto; margin: 12px 0; }
.photos img { height: 180px; width: auto; max-width: 280px; object-fit: cover; border-radius: 12px; background: #e7e0d4; }
.description { line-height: 1.5; }
.facts { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 10px; margin: 14px 0 20px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.original {
  display: inline-block;
  margin: 8px 0 16px;
  background: var(--ink);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}
.leaflet-container { font-family: inherit; height: 100%; width: 100%; background: #d9e2dc; }

@media (max-width: 1100px) {
  .top { flex-direction: column; align-items: start; padding-bottom: 8px; }
  .layout, .workspace { grid-template-columns: 1fr; height: auto; }
  .map { height: 420px; }
  .filters { max-height: none; }
  .list-pane { min-height: 480px; }
}
