:root {
  --ink: #1e2422;
  --muted: #66706b;
  --soft: #f3f1ea;
  --paper: #fffdf8;
  --line: #ddd5c8;
  --green: #3f6f57;
  --green-2: #dfeadd;
  --gold: #b8893b;
  --gold-2: #f6ead2;
  --blue: #466f91;
  --blue-2: #dce8f1;
  --rose: #a95b63;
  --rose-2: #f4dee0;
  --clay: #b76646;
  --shadow: 0 18px 46px rgba(34, 39, 35, 0.09);
  --shadow-soft: 0 8px 24px rgba(34, 39, 35, 0.07);
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, rgba(63, 111, 87, 0.16), transparent 28rem),
    radial-gradient(circle at 96% 8%, rgba(184, 137, 59, 0.14), transparent 24rem),
    linear-gradient(180deg, #faf8f1 0%, var(--soft) 34%, #ece9e0 100%);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(63, 111, 87, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 111, 87, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 72%);
}

body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

button {
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(70, 111, 145, 0.28);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background: rgba(255, 253, 248, 0.9);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(34, 39, 35, 0.05);
  backdrop-filter: blur(18px) saturate(1.25);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 188px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--green), #294b3b);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 10px 24px rgba(63, 111, 87, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.nav-btn,
.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.nav-btn svg,
.nav-link-btn svg,
.primary-action svg,
.secondary-action svg,
.card-title svg,
.tag-btn svg,
.persona-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.nav-btn:hover,
.nav-btn.active,
.nav-link-btn:hover {
  background: var(--green-2);
  color: var(--green);
}

.nav-link-btn.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

.nav-btn.active {
  box-shadow: inset 0 0 0 1px rgba(63, 111, 87, 0.18);
}

.app-shell {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(520px, 1fr) minmax(260px, 330px);
  gap: 18px;
  align-items: start;
}

.control-panel,
.result-stage,
.insight-rail,
.view-stack {
  min-width: 0;
}

.control-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
}

.panel-head {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(246, 234, 210, 0.34));
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--gold-2);
  color: #7b5a26;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.panel-head h1,
.view-head h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.12;
}

.panel-head p,
.view-head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.control-block,
.rail-card,
.summary-strip,
.timeline-wrap,
.boundary-panel,
.resource-filter {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.control-block,
.rail-card,
.summary-strip,
.timeline-wrap,
.boundary-panel,
.resource-filter,
.map-card,
.live-card,
.village-card,
.resource-row,
.booking-row,
.market-card,
.evidence-row,
.view-head,
.village-map-section {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.rail-card:hover,
.village-card:hover,
.resource-row:hover,
.booking-row:hover,
.market-card:hover,
.evidence-row:hover {
  transform: translateY(-2px);
  border-color: rgba(63, 111, 87, 0.34);
  box-shadow: 0 22px 54px rgba(34, 39, 35, 0.12);
}

.control-block {
  padding: 14px;
}

.block-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.persona-grid,
.tag-grid {
  display: grid;
  gap: 8px;
}

.persona-btn {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 3px 9px;
  align-items: start;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.persona-btn span {
  font-weight: 850;
}

.persona-btn small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.persona-btn.active,
.persona-btn:hover {
  border-color: var(--green);
  background: var(--green-2);
}

.persona-btn.active {
  box-shadow: inset 0 0 0 1px rgba(63, 111, 87, 0.16);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(63, 111, 87, 0.14);
}

textarea {
  padding: 10px;
  resize: vertical;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.lucide-loader-circle {
  animation: spin 0.8s linear infinite;
}

.range-field {
  margin: 10px 0;
}

input[type="range"] {
  min-height: 28px;
  accent-color: var(--green);
  padding: 0;
}

.tag-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.tag-btn.active,
.tag-btn:hover {
  border-color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 13%, white);
  color: var(--tag-color);
}

.tag-btn.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-color) 16%, transparent);
}

.primary-action,
.secondary-action,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
}

.primary-action {
  border: 1px solid #2d513e;
  background: linear-gradient(135deg, var(--green), #315744);
  color: #fff;
  box-shadow: var(--shadow);
}

.primary-action:hover {
  background: #345d49;
  transform: translateY(-1px);
}

.primary-action.compact {
  min-height: 42px;
  padding: 0 14px;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
}

.secondary-action:hover {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.secondary-action.full {
  width: 100%;
}

.action-bar {
  z-index: 4;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.action-bar .primary-action {
  width: 100%;
}

.action-bar small {
  color: var(--muted);
  font-size: 12px;
}

.result-stage {
  display: grid;
  gap: 14px;
}

.loading-state {
  display: grid;
  min-height: 58vh;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.loading-mark {
  width: 46px;
  height: 46px;
  border: 4px solid var(--green-2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.runtime-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.runtime-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.runtime-row svg {
  width: 14px;
  height: 14px;
}

.visual-band {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #26332d;
  box-shadow: var(--shadow);
}

.visual-band img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-band::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 26, 23, 0.82), rgba(20, 26, 23, 0.28) 62%, rgba(20, 26, 23, 0.08)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.28), transparent 46%);
}

.visual-overlay {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  min-height: 310px;
  max-width: 720px;
  padding: 26px;
  color: #fff;
}

.visual-overlay span {
  width: fit-content;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
  font-weight: 800;
}

.visual-overlay strong {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
}

.visual-overlay small {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 15px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  max-width: 640px;
}

.hero-metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.hero-metrics svg {
  width: 16px;
  height: 16px;
  margin-bottom: 7px;
}

.hero-metrics span,
.hero-metrics strong {
  display: block;
}

.hero-metrics span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 760;
}

.hero-metrics strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(84px, 1fr));
  gap: 10px;
  padding: 12px;
  align-items: stretch;
}

.summary-strip > div {
  padding: 10px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(222, 217, 205, 0.72);
}

.summary-strip .secondary-action {
  min-width: 0;
}

#savePlan {
  grid-column: span 2;
}

#openBooking {
  grid-column: span 3;
}

.route-health {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.route-health.good {
  grid-template-columns: 42px 1fr;
  align-items: center;
  border-color: rgba(63, 111, 87, 0.24);
  background: linear-gradient(135deg, #fffdf8, rgba(223, 234, 221, 0.78));
}

.route-health.good > svg,
.route-health-item > svg {
  width: 28px;
  height: 28px;
  color: var(--green);
}

.route-health-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

.route-health-item.high > svg {
  color: var(--rose);
}

.route-health-item.medium > svg {
  color: var(--gold);
}

.route-health strong,
.route-health span {
  display: block;
}

.route-health span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 14px;
}

.map-card,
.live-card,
.village-map-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px;
}

.map-surface {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe8dc;
}

.map-surface::before {
  content: "正在加载动态地图";
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: #486450;
  font-size: 13px;
  font-weight: 850;
}

.leaflet-stage,
.amap-static {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 280px;
}

.leaflet-stage {
  background: #dfe8dc;
}

.leaflet-stage .leaflet-control-zoom {
  border: 1px solid rgba(57, 64, 58, 0.16);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(34, 39, 35, 0.14);
}

.leaflet-stage .leaflet-control-zoom a {
  color: var(--ink);
  border-color: var(--line);
}

.amap-static {
  object-fit: cover;
}

.map-provider {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 8px;
  border-radius: 6px;
  z-index: 2;
  background: rgba(255, 253, 248, 0.92);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.map-hint {
  position: absolute;
  left: 58px;
  top: 10px;
  z-index: 450;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(420px, calc(100% - 20px));
  padding: 7px 9px;
  border: 1px solid rgba(63, 111, 87, 0.16);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.94);
  color: #486052;
  box-shadow: 0 10px 24px rgba(34, 39, 35, 0.1);
  font-size: 12px;
  font-weight: 820;
}

.map-hint svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--green);
}

.map-fallback {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  font-weight: 760;
  text-align: center;
}

.map-surface.large {
  min-height: 380px;
}

.map-surface.large .leaflet-stage,
.map-surface.large .amap-static {
  height: 380px;
}

.village-map-marker {
  display: grid;
  place-items: center;
}

.village-map-marker span {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid #fffdf8;
  border-radius: 50% 50% 50% 6px;
  background: #3f6f57;
  box-shadow: 0 10px 22px rgba(23, 47, 34, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 950;
  transform: rotate(-45deg);
}

.village-map-marker span::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.village-map-marker span {
  line-height: 1;
}

.village-map-marker span > * {
  transform: rotate(45deg);
}

.map-popup {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

.map-popup span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.map-popup strong {
  color: var(--ink);
  font-size: 16px;
}

.map-popup p,
.map-popup small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.map-popup a {
  width: fit-content;
  margin-top: 4px;
  padding: 6px 9px;
  border: 1px solid rgba(63, 111, 87, 0.2);
  border-radius: 6px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.map-route-list {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 450;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 96px 0 0;
  pointer-events: none;
}

.map-route-list button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(63, 111, 87, 0.2);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 10px 24px rgba(34, 39, 35, 0.12);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
}

.map-route-list button span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.map-route-list button strong {
  font-size: 13px;
  white-space: nowrap;
}

.village-card.is-map-active {
  border-color: rgba(63, 111, 87, 0.68);
  box-shadow: 0 24px 58px rgba(63, 111, 87, 0.22);
}

.weather-list,
.transfer-list {
  display: grid;
  gap: 8px;
}

.transfer-list {
  margin-top: 10px;
}

.weather-item,
.transfer-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.weather-item strong,
.transfer-item strong {
  font-size: 14px;
}

.weather-item span,
.transfer-item span,
.weather-item small,
.transfer-item small {
  color: var(--muted);
  font-size: 12px;
}

.summary-strip div,
.impact-grid div,
.market-card {
  min-width: 0;
}

.summary-strip span,
.impact-grid span,
.market-card span,
.resource-side span,
.meter-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.summary-strip strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
}

.timeline-wrap {
  padding: 18px;
}

.section-title {
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 24px;
  line-height: 1.2;
}

.section-title p {
  margin-top: 8px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 12px;
}

.day-panel {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.day-index {
  display: grid;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

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

.day-heading h3 {
  font-size: 19px;
}

.day-heading span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}

.activity-item time {
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.activity-item h4 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.activity-item h4 em {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--gold-2);
  color: #7b5a26;
  font-size: 11px;
  font-style: normal;
}

.ai-note {
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: var(--blue-2);
  color: #35556f;
  font-size: 13px;
}

.activity-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.activity-meta,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.activity-meta span,
.pill-row span {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.spot-preview {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.spot-preview strong {
  color: var(--green);
  font-size: 13px;
}

.spot-preview div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spot-preview span {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--green-2);
  color: #38573d;
  font-size: 12px;
  font-weight: 760;
}

.insight-rail {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
}

.rail-card,
.boundary-panel {
  padding: 15px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.card-title h2 {
  font-size: 17px;
}

.budget-total {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius);
}

.budget-total.within {
  background: var(--green-2);
}

.budget-total.near {
  background: var(--gold-2);
}

.budget-total.over {
  background: var(--rose-2);
}

.budget-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.budget-total strong {
  font-size: 30px;
}

.meter-row {
  margin-top: 10px;
}

.meter-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.meter-row strong {
  font-size: 13px;
}

.meter {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--soft);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.impact-grid div {
  padding: 10px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

.impact-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.risk-list,
.saved-list {
  display: grid;
  gap: 8px;
}

.check-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.etiquette-title {
  margin-top: 14px;
}

.risk-item {
  padding: 10px;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: #fff;
}

.risk-item.high {
  border-left-color: var(--rose);
}

.risk-item.medium {
  border-left-color: var(--gold);
}

.risk-item strong,
.risk-item span {
  display: block;
}

.risk-item strong {
  font-size: 14px;
}

.risk-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.saved-plan {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.saved-plan strong,
.saved-plan span {
  display: block;
}

.saved-plan strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-plan span,
.empty-note {
  color: var(--muted);
  font-size: 12px;
}

.storage-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(70, 111, 145, 0.15);
  border-radius: var(--radius);
  background: var(--blue-2);
  color: #35556f;
  font-size: 12px;
  line-height: 1.5;
}

.storage-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.view-stack {
  display: grid;
  gap: 18px;
}

.view-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(223, 234, 221, 0.34));
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.compact-select {
  width: min(220px, 100%);
}

.view-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.view-metrics div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-soft);
}

.view-metrics span,
.view-metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.view-metrics strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-metrics small {
  margin-top: 3px;
}

.village-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.village-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.village-card {
  position: relative;
}

.village-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.village-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--green-2);
  transition: transform 0.35s ease;
}

.village-card:hover img {
  transform: scale(1.035);
}

.village-content {
  padding: 14px;
}

.village-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.village-topline span {
  color: var(--muted);
  font-size: 12px;
}

.village-topline strong {
  display: grid;
  width: 40px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--green-2), #eef5eb);
  color: var(--green);
}

.village-content h2 {
  font-size: 22px;
}

.village-content p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.address-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: #486052;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.address-line svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--green);
}

.mini-facts {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.mini-facts div {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 8px;
}

.mini-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.mini-facts dd {
  margin: 0;
  font-size: 13px;
  font-weight: 760;
}

.resource-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
}

.resource-filter {
  position: sticky;
  top: 84px;
  padding: 14px;
}

.filter-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.resource-filter .control-block {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.resource-list {
  display: grid;
  gap: 12px;
}

.resource-row {
  display: grid;
  grid-template-columns: 58px 1fr minmax(150px, 220px);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.resource-score {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--blue-2), #eef4f8);
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
}

.resource-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.resource-title h2 {
  margin-top: 3px;
  font-size: 21px;
}

.resource-main p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.resource-side {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

.resource-side strong {
  font-size: 19px;
}

.resource-side small {
  color: var(--muted);
  font-size: 12px;
}

.stat-chip {
  display: grid;
  gap: 3px;
  min-width: 150px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(63, 111, 87, 0.18);
  background: linear-gradient(135deg, var(--green-2), #f2f7ef);
}

.stat-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.stat-chip strong {
  font-size: 26px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.market-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.market-card {
  position: relative;
  overflow: hidden;
}

.market-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--green);
  opacity: 0.72;
}

.market-card.gold::before {
  background: var(--gold);
}

.market-card.blue::before {
  background: var(--blue);
}

.market-card.rose::before {
  background: var(--rose);
}

.market-card strong {
  display: inline-block;
  margin-top: 8px;
  font-size: 36px;
  line-height: 1;
}

.market-card small {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 800;
}

.market-card.green strong {
  color: var(--green);
}

.market-card.gold strong {
  color: var(--gold);
}

.market-card.blue strong {
  color: var(--blue);
}

.market-card.rose strong {
  color: var(--rose);
}

.evidence-table {
  display: grid;
  gap: 10px;
}

.evidence-row {
  display: grid;
  grid-template-columns: 1fr minmax(210px, 300px) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.evidence-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.evidence-row h2 {
  margin-top: 4px;
  font-size: 19px;
}

.evidence-row p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.evidence-row > strong {
  font-size: 18px;
  line-height: 1.3;
}

.evidence-row a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--green);
  text-decoration: none;
  font-weight: 850;
}

.evidence-row a svg {
  width: 16px;
  height: 16px;
}

.boundary-panel p {
  color: var(--muted);
}

.api-box {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.api-box span {
  color: var(--muted);
  font-size: 13px;
}

.booking-list {
  display: grid;
  gap: 12px;
}

.booking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto) minmax(180px, auto);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.booking-row span,
.booking-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.booking-row h2 {
  font-size: 20px;
}

.booking-row p {
  color: var(--muted);
  font-size: 13px;
}

.empty-panel {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 190px;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  text-align: center;
}

.empty-panel svg {
  width: 34px;
  height: 34px;
  color: var(--green);
}

.empty-panel strong {
  color: var(--ink);
  font-size: 18px;
}

.empty-panel span {
  max-width: 360px;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 27, 25, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  animation: modalIn 0.18s ease both;
}

@keyframes modalIn {
  from {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-card.narrow {
  width: min(620px, 100%);
}

.modal-card.intake-modal {
  width: min(860px, 100%);
}

.icon-button {
  width: 40px;
  border: 1px solid var(--line);
  background: #fff;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.modal-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.modal-body {
  padding: 22px;
}

.modal-body h2 {
  font-size: 28px;
}

.modal-body > p {
  margin-top: 8px;
  color: var(--muted);
}

.image-credit {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.location-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.location-panel div {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 3px 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.location-panel svg {
  grid-row: span 2;
  width: 18px;
  height: 18px;
  color: var(--green);
}

.location-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.location-panel strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.modal-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.list-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.list-block h3 {
  font-size: 15px;
}

.list-block ul {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.spot-list {
  margin-top: 18px;
}

.spot-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.spot-list-head h3 {
  font-size: 18px;
}

.spot-list-head span {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

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

.spot-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.spot-card strong,
.spot-card span {
  display: block;
}

.spot-card strong {
  font-size: 15px;
}

.spot-card div span,
.spot-card p,
.spot-card footer span {
  color: var(--muted);
  font-size: 12px;
}

.spot-card p {
  line-height: 1.65;
}

.spot-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spot-card footer span {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--soft);
  font-weight: 760;
}

.source-note {
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.form-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.form-stack .primary-action {
  margin-top: 4px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.tag-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tag-check {
  position: relative;
  cursor: pointer;
}

.tag-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-check span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
}

.tag-check input:checked + span {
  border-color: var(--green);
  background: var(--green-2);
  color: var(--green);
}

.tag-check svg {
  width: 16px;
  height: 16px;
}

.modal-hint {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--blue-2);
  color: #35556f;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: var(--radius);
  max-width: min(420px, calc(100vw - 32px));
  background: linear-gradient(135deg, var(--ink), #101412);
  color: #fff;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1220px) {
  .planner-grid {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }

  .insight-rail {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .village-grid,
  .market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .summary-strip .secondary-action {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 14px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-btn,
  .nav-link-btn {
    min-width: 0;
    padding: 0 6px;
  }

  .nav-btn span,
  .nav-link-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell {
    width: min(100% - 24px, 760px);
    padding-top: 14px;
  }

  .planner-grid,
  .resource-layout {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .insight-rail,
  .resource-filter {
    position: static;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-strip .secondary-action {
    grid-column: 1 / -1;
  }

  .view-head,
  .day-heading {
    align-items: start;
    flex-direction: column;
  }

  .view-head {
    display: flex;
  }

  .village-grid,
  .market-grid,
  .insight-rail,
  .hero-metrics,
  .view-metrics,
  .location-panel,
  .modal-columns,
  .spot-grid,
  .tag-check-grid {
    grid-template-columns: 1fr;
  }

  .resource-row,
  .evidence-row {
    grid-template-columns: 1fr;
  }

  .resource-score {
    width: 100%;
    height: 42px;
  }
}

@media (max-width: 560px) {
  .brand {
    min-width: 0;
  }

  .main-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-row,
  .tag-grid,
  .tag-check-grid,
  .summary-strip,
  .hero-metrics,
  .view-metrics,
  .impact-grid {
    grid-template-columns: 1fr;
  }

  .visual-band,
  .visual-overlay {
    min-height: 260px;
  }

  .visual-overlay {
    padding: 18px;
  }

  .visual-overlay strong {
    font-size: 34px;
  }

  .summary-strip .secondary-action {
    width: 100%;
  }

  .day-panel,
  .activity-item {
    grid-template-columns: 1fr;
  }

  .day-index {
    width: 50px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-image {
    height: 190px;
  }

  .modal-body {
    padding: 16px;
  }

  .map-hint {
    left: 54px;
    right: 10px;
    font-size: 11px;
  }

  .map-provider {
    max-width: calc(100% - 20px);
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
