/* MyLando — palette and type matched to the Lovable landing
   (https://mylando.lovable.app / src/styles.css).
   Light-theme tokens; oklch originals converted to hex for this stylesheet. */
:root {
  --background: #f6f9f7;
  --foreground: #15231b;
  --card: #ffffff;
  --card-foreground: #020618;
  --primary: #326234;
  --primary-foreground: #fbf8f1;
  --secondary: #e0ebe3;
  --secondary-foreground: #0f172b;
  --muted-bg: #f1f5f9;
  --muted-foreground: #62748e;
  --accent: #f1f5f9;
  --accent-foreground: #0f172b;
  --destructive: #e7000b;
  --destructive-foreground: #f8fafc;
  --border: #ced7d1;
  --input: #e2e8f0;
  --ring: #90a1b9;
  --map-panel: #06180d;
  --map-ink: #fcfcfc;
  --gold: #ffb900;
  --font-display: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --theme: #326234;
  --theme-ink: #fbf8f1;
  --bg: #f6f9f7;
  --ink: #15231b;
  --muted: #62748e;
  --line: #ced7d1;
  --pass: #326234;
  --pass-bg: #e0ebe3;
  --review: #6b4a12;
  --review-bg: #f6e3b3;
  --fail: #e7000b;
  --fail-bg: #fde8e6;
  --caution: #6b4a12;
  --caution-bg: #f6e3b3;
  --unknown: #62748e;
  --unknown-bg: #f1f5f9;
  --heart: #e7000b;
  --shadow: 0 1px 3px rgba(21, 35, 27, 0.08);
  --radius: 0.5rem;
  --tap: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --header-h: auto;
  --bar-h: 52px;
  --font: var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: 0; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.4;
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--theme); }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* —— Top bar —— */
.topbar {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: calc(8px + var(--safe-t)) max(12px, var(--safe-r)) 10px max(12px, var(--safe-l));
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
  min-height: var(--tap);
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
.search-wrap input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 22px;
  padding: 0 16px 0 40px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--theme); background: #fff; }
.search-wrap .search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  pointer-events: none;
  color: var(--muted);
}
.filters-btn, .icon-btn, .view-btn, .back-btn, .heart-btn, .ghost, .primary {
  min-height: var(--tap);
  min-width: var(--tap);
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  font-weight: 600;
  font-size: 14px;
}
.filters-btn {
  flex: 0 0 auto;
  background: var(--theme);
  color: #fff;
  border-color: var(--theme);
  position: relative;
}
.filters-btn[data-count]:not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute;
  top: 2px; right: 2px;
  background: #fff;
  color: var(--theme);
  border-radius: 10px;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
}
.install-hint {
  margin: 0;
  padding: 8px max(16px, var(--safe-l));
  background: #fff8e8;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.install-hint button { border: 0; background: transparent; font-size: 20px; min-width: 36px; }

/* —— Chip rows + toolbar —— */
.chip-row,
.goal-bar, .budget-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 4px max(12px, var(--safe-r)) 0 max(12px, var(--safe-l));
  background: var(--bg);
  overflow: hidden;
}
.budget-bar { padding-top: 2px; padding-bottom: 6px; }
.chip-row-label,
.budget-bar-label {
  flex: 0 0 4.4em;
  width: 4.4em;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-sans);
  line-height: 30px;
  height: 30px;
}
.chip-scroll {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000, #000);
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll.fade-right {
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
}
.chip-scroll.fade-left {
  mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 100%);
}
.chip-scroll.fade-left.fade-right {
  mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.goal-bar button, .budget-bar button {
  flex: 0 0 auto;
  height: 30px;
  min-height: 30px;
  min-width: auto;
  border-radius: 8px;
  border: 0;
  background: #f1f4ef;
  font-weight: 550;
  font-size: 13px;
  letter-spacing: -0.01em;
  padding: 0 10px;
  color: var(--ink);
  white-space: nowrap;
}
.goal-bar button:hover, .budget-bar button:hover {
  background: #e7ece6;
}
.goal-bar button[aria-pressed="true"],
.budget-bar button[aria-pressed="true"] {
  background: rgba(50, 98, 52, 0.12);
  color: #326234;
  font-weight: 650;
  border: 0;
  box-shadow: none;
}
.budget-seg {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border-radius: 9px;
  background: #f1f4ef;
}
.budget-seg button {
  background: transparent;
  border-radius: 7px;
  height: 26px;
  min-height: 26px;
  padding: 0 9px;
}
.budget-seg button:hover { background: rgba(21, 35, 27, 0.05); }
.budget-seg button[aria-pressed="true"] {
  background: rgba(50, 98, 52, 0.12);
  color: #326234;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px max(12px, var(--safe-r)) 8px max(12px, var(--safe-l));
  background: var(--bg);
  flex: 0 0 auto;
  z-index: 20;
}
.seg {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  background: var(--secondary);
  border-radius: 18px;
  padding: 3px;
  height: 42px;
  box-sizing: border-box;
}
.seg button,
.seg button.table-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-height: 36px;
  min-width: 64px;
  border: 0;
  background: transparent;
  border-radius: 15px;
  font-weight: 600;
  font-size: 13px;
  padding: 0 12px;
  color: var(--muted);
  box-shadow: none;
}
.seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(21, 35, 27, 0.12);
}
.toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.toolbar .count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.sort-wrap select {
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  background-color: #fff;
  border-radius: var(--radius);
  padding: 0 28px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%2362748e' fill='none' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* —— List cards —— */
#list-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.cards {
  list-style: none;
  margin: 0 auto;
  padding: 0 12px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  flex: 0 0 auto;
}
.card-photos {
  position: relative;
  height: 180px;
  background: #d8d2c8;
}
.card-photos > img,
.card-photos > .ph-empty,
.card-photos > .photo-aerial {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  height: 100%;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.photo-track::-webkit-scrollbar { display: none; }
.photo-track img, .photo-track .ph-empty {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  background: #d8d2c8;
}
.ph-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}
.ph-terrain {
  flex-direction: column;
  gap: 4px;
  text-align: center;
  padding: 16px;
  color: #14301c;
  background-color: #8aa882;
  background-image:
    radial-gradient(ellipse 90% 55% at 18% 88%, rgba(21, 70, 40, 0.35), transparent 58%),
    radial-gradient(ellipse 80% 50% at 82% 92%, rgba(50, 98, 52, 0.32), transparent 54%),
    repeating-linear-gradient(120deg, rgba(255,255,255,0.08) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #d5e3d0 0%, #b3c8ad 38%, #7f9d74 72%, #5a7a52 100%);
  background-size: 100% 100%, 100% 100%, 12px 12px, 100% 100%;
}
.ph-terrain-copy {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(246, 249, 247, 0.82);
  box-shadow: 0 1px 4px rgba(21, 35, 27, 0.08);
  max-width: 90%;
}
.ph-terrain-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ph-terrain-copy em {
  display: block;
  margin-top: 2px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground, var(--muted));
}
.heart-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  font-size: 20px;
  line-height: 1;
  color: #333;
  z-index: 2;
}
.heart-btn[aria-pressed="true"] { color: var(--heart); }
.badge-off {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #333;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 2;
}
.dots {
  position: absolute;
  bottom: 10px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
}
.dots span.on { background: #fff; }
.card-body {
  padding: 10px 14px 12px;
  cursor: pointer;
}
.card-price {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}
.card-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.view-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(50, 98, 52, 0.12);
  color: #326234;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.view-more-btn:hover { background: rgba(50, 98, 52, 0.18); }
.view-more-btn.view-more-in-detail {
  width: auto;
  margin: 12px 0 4px;
  padding: 0 14px;
}
.ls-paywall-focus {
  outline: 2px solid var(--theme, #326234);
  outline-offset: 2px;
}
.card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.verdict {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .01em;
}
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.review { background: var(--review-bg); color: var(--review); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.incomplete, .verdict.reference, .verdict.unknown {
  background: var(--unknown-bg); color: var(--unknown);
}
.type-chip {
  font-size: 12px;
  color: var(--muted);
}

/* —— Map —— */
#map-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  z-index: 1;
  isolation: isolate;
}
.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  flex: 1 1 auto;
}
#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: #e8e3da;
}
.price-pin-icon {
  background: none !important;
  border: none !important;
}
.price-pin {
  background: #fff;
  border: 1px solid #cfc8bb;
  border-radius: 16px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  white-space: nowrap;
  color: var(--ink);
  width: max-content;
}
.price-pin.pin-pass { background: #e7f6eb; border-color: #1f7a3a; color: #146c2e; }
.price-pin.pin-review { background: #fff3d6; border-color: #8a5a00; color: #8a5a00; }
.price-pin.pin-fail { background: #fde8e6; border-color: #a12622; color: #a12622; }
.price-pin.pin-incomplete, .price-pin.pin-reference, .price-pin.pin-unknown {
  background: #eeeae3; border-color: #6a726a; color: #3a403a;
}
.price-pin.fav { box-shadow: 0 0 0 2px var(--heart); }
.price-pin.active { box-shadow: 0 0 0 2px var(--theme); }
.map-mini {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: flex;
  gap: 10px;
  overflow: hidden;
  z-index: 800;
  min-height: 88px;
  cursor: pointer;
}
.map-mini img, .map-mini .ph-empty {
  width: 110px;
  height: 88px;
  object-fit: cover;
  flex: 0 0 110px;
  background: #d8d2c8;
}
.map-mini .info { padding: 8px 8px 8px 0; min-width: 0; flex: 1; }
.map-mini .card-price { font-size: 18px; }
.map-mini .close-mini {
  position: absolute;
  top: 4px; right: 4px;
  border: 0; background: transparent;
  width: 36px; height: 36px;
  font-size: 18px;
}

/* —— Detail —— */
#detail {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 2000;
  isolation: isolate;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--safe-t)) 8px 6px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.back-btn, .detail-top .heart-btn {
  position: static;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.detail-top .spacer { flex: 1; }
.carousel-wrap { position: relative; background: #d8d2c8; }
.carousel-wrap .dots { z-index: 1; }
.section-h, .goal-switch { scroll-margin-top: calc(58px + var(--safe-t)); }
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  height: 280px;
  background: #d8d2c8;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img, .carousel .ph-empty {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
}
.detail-body {
  padding: 16px 16px calc(24px + var(--safe-b));
  max-width: 720px;
  margin: 0 auto;
}
.detail-body h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.03em; }
.addr { margin: 0 0 12px; color: var(--muted); }
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.facts div {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 2px; }
.facts dd { margin: 0; font-weight: 600; font-size: 14px; }
.section-h { font-size: 18px; margin: 24px 0 10px; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.check-list .mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex: 0 0 22px;
}
.check-list .pass .mark { background: var(--pass-bg); color: var(--pass); }
.check-list .fail .mark { background: var(--fail-bg); color: var(--fail); }
.check-list .caution .mark, .check-list .review .mark { background: var(--caution-bg); color: var(--caution); }
.check-list .unknown .mark, .check-list .incomplete .mark { background: var(--unknown-bg); color: var(--unknown); }
.check-list .label { font-weight: 650; }
.check-list .note { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.goal-switch { display: flex; gap: 4px; margin: 8px 0 12px; flex-wrap: wrap; }
.goal-switch button {
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #f1f4ef;
  font-size: 13px;
  font-weight: 550;
}
.goal-switch button[aria-pressed="true"] {
  background: rgba(50, 98, 52, 0.12);
  color: #326234;
  border: 0;
  font-weight: 650;
}
#detail-map {
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  margin: 8px 0 16px;
  background: #e8e3da;
}
.detail-foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px max(12px, var(--safe-r)) calc(10px + var(--safe-b)) max(12px, var(--safe-l));
  background: #fff;
  border-top: 1px solid var(--line);
  z-index: 2001;
}
.detail-foot a, .detail-foot button {
  flex: 1;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border-radius: 22px;
  font-weight: 650;
  font-size: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.detail-foot .primary {
  background: var(--theme);
  color: #fff;
  border-color: var(--theme);
}

/* —— Filter sheet —— */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(20,22,20,.45);
  z-index: 3000;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 88vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 3001;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  overflow: hidden;
}
.sheet-handle {
  width: 36px; height: 4px;
  background: #d0cbc3;
  border-radius: 2px;
  margin: 8px auto 0;
}
.sheet-head, .sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  flex: 0 0 auto;
  background: #fff;
}
.sheet-foot { border-top: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 20px;
  -webkit-overflow-scrolling: touch;
}
.sheet label, .field {
  display: block;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}
.sheet select, .sheet input[type="search"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--bg);
  font-weight: 500;
  color: var(--ink);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chips button, .event-opts button, #f-favs, #f-favs-m {
  min-height: 40px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  font-weight: 600;
  font-size: 13px;
}
.chips button[aria-pressed="true"],
.event-opts button[aria-pressed="true"],
#f-favs[aria-pressed="true"],
#f-favs-m[aria-pressed="true"] {
  background: var(--theme);
  color: #fff;
  border-color: var(--theme);
}
.event-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sheet-foot .primary { flex: 1; margin-left: 8px; background: var(--theme); color: #fff; border-color: var(--theme); }
.muted { color: var(--muted); font-weight: 500; font-size: 13px; }

/* —— Desktop table (optional, hidden on phone) —— */
#table-view { display: none; flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 16px 24px; }
.table-scroll { overflow: auto; border-radius: 12px; background: #fff; }
table.inv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.inv th, table.inv td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.inv th { position: sticky; top: 0; background: #fff; }
table.inv img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
@media (min-width: 900px) {
  .toolbar .table-opt { display: inline-flex; }
  #table-view.show { display: block; }
  .cards { max-width: 980px; }
  .cards.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 1100px;
  }
}
.toolbar .table-opt { display: none; }
@media (min-width: 900px) {
  .toolbar .table-opt { display: inline-flex; }
}

.lede-mini { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}
/* Prevent horizontal page scroll on phone */
@media (max-width: 899px) {
  #table-view { display: none !important; }
  body { overflow-x: hidden; }
}

/* —— Price fit —— */
.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 4px;
}
.price-row .card-price { margin: 0; }
.fit-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.2;
}
.fit-great { background: #e3f6e8; color: #146c2e; }
.fit-budget { background: #e4eefc; color: #1a4f9c; }
.fit-sba { background: #fff3d6; color: #8a5a00; }
.fit-over { background: #fde8e6; color: #a12622; }
.fit-unknown { background: #eeeae3; color: #4a524a; }
.fit-block { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }

/* —— Utilities —— */
.utils {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 6px;
}
.util-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 10px;
  min-height: 40px;
  font-size: 13px;
}
.util-ico {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #8a8a8a;
  flex: 0 0 10px;
}
.util-well .util-ico, .util-on-site .util-ico, .util-sewer .util-ico { background: #1f7a3a; }
.util-city .util-ico, .util-coop .util-ico, .util-public .util-ico { background: #1a4f9c; }
.util-rainwater .util-ico { background: #0e7490; }
.util-at-road .util-ico { background: #8a5a00; }
.util-septic .util-ico { background: #5b4a2a; }
.util-septic-needed .util-ico { background: #8a5a00; }
.util-unknown .util-ico { background: #8a8a8a; }
.util-lab { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.util-val { font-weight: 650; }
.util-legend { margin: 4px 0 12px; }
.map-mini .utils { margin: 6px 0 0; gap: 4px; }
.map-mini .util-item { padding: 4px 7px; min-height: 0; font-size: 11px; background: var(--bg); }
.map-mini .price-row .card-price { font-size: 18px; }
.map-mini { min-height: 88px; align-items: stretch; }
.map-mini .info { padding-right: 28px; }

/* —— Map layers —— */
.layers-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 900;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  font-weight: 700;
  font-size: 14px;
}
.layers-btn-sm { top: 8px; right: 8px; z-index: 500; }
.layers-panel {
  position: fixed;
  top: calc(12px + var(--safe-t) + 52px);
  right: 12px;
  left: 12px;
  max-width: 360px;
  margin-left: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 14px 16px 12px;
  z-index: 3200;
  max-height: min(88vh, calc(100dvh - 80px));
  overflow: auto;
}
.layers-panel h3 { margin: 0 0 6px; font-size: 16px; }
.layer-group { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.layer-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-weight: 600;
  font-size: 14px;
}
.layer-opt input { width: 20px; height: 20px; accent-color: var(--theme); flex: 0 0 20px; }
.flood-legend, .gas-legend { margin: 4px 0 8px; font-size: 13px; }
.flood-legend div { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.swatch {
  width: 16px; height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,.15);
  flex: 0 0 16px;
}
.swatch-ae { background: rgb(0, 230, 255); }
.swatch-x02 { background: rgb(255, 128, 0); }
.swatch-xmin { background: #f4efe6; }
.zoom-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: rgba(26,29,26,.86);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 16px;
  z-index: 840;
  margin: 0;
  max-width: calc(100% - 140px);
  text-align: center;
  white-space: normal;
}
.detail-map-wrap { position: relative; }
#map-view .leaflet-control-zoom { margin-top: 12px; margin-left: 10px; }

/* —— On-map legend —— */
.map-legend {
  position: absolute;
  left: max(10px, var(--safe-l));
  bottom: calc(12px + var(--safe-b));
  z-index: 850;
  background: rgba(255,255,255,.96);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.16);
  width: min(248px, calc(100% - 24px));
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
}
#map-view.has-mini .map-legend {
  bottom: var(--mini-offset, calc(194px + var(--safe-b)));
}
.map-legend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
}
.map-legend-toggle::after {
  content: "▾";
  font-size: 11px;
  color: var(--muted);
}
.map-legend.collapsed .map-legend-toggle::after { content: "▸"; }
.map-legend.collapsed .map-legend-body { display: none; }
.map-legend-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  padding: 0 10px 8px;
  max-height: min(42vh, 280px);
  overflow: auto;
}
.legend-group { margin: 0; }
.legend-h { font-weight: 700; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 2px; }
.legend-group div { display: flex; align-items: center; gap: 6px; margin: 1px 0; }
.map-legend .swatch { width: 12px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.18); flex: 0 0 12px; }
.map-legend .swatch.pin-pass, .map-legend .swatch.fit-great { background: #e3f6e8; border-color: #1f7a3a; }
.map-legend .swatch.pin-review { background: #fff3d6; border-color: #8a5a00; }
.map-legend .swatch.pin-fail, .map-legend .swatch.fit-over { background: #fde8e6; border-color: #a12622; }
.map-legend .swatch.pin-incomplete { background: #eeeae3; border-color: #6a726a; }
.map-legend .swatch.fit-budget { background: #e4eefc; border-color: #1a4f9c; }
.map-legend .swatch.fit-sba { background: #fff3d6; border-color: #8a5a00; }
.swatch-tpms { background: rgb(145, 109, 0); }
.swatch-l13 { background: rgb(0, 225, 75); }
.util-legend-mini { font-size: 10px; line-height: 1.35; margin: 4px 0 0; color: var(--muted); }

/* —— Desktop hover card —— */
#hover-tip {
  position: fixed;
  z-index: 5000;
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(26, 29, 26, 0.22);
  padding: 12px 14px 14px;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}
#hover-tip[hidden] { display: none !important; }
.ht-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 2px;
}
.ht-name { font-size: 15px; font-weight: 750; letter-spacing: -0.02em; margin: 0; flex: 1; }
.ht-fav { color: var(--heart); font-size: 16px; line-height: 1; }
.ht-addr { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.ht-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ht-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--unknown-bg);
  color: var(--ink);
  font-weight: 650;
  font-size: 11px;
  line-height: 1.3;
}
.ht-chip .ht-k {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 9px;
}
.ht-chip.pass, .ht-chip.great, .ht-chip.close { background: var(--pass-bg); color: var(--pass); }
.ht-chip.review, .ht-chip.ok, .ht-chip.budget, .ht-chip.sba, .ht-chip.caution { background: var(--review-bg); color: var(--review); }
.ht-chip.fail, .ht-chip.over, .ht-chip.toofar { background: var(--fail-bg); color: var(--fail); }
.ht-chip.unknown, .ht-chip.incomplete, .ht-chip.reference { background: var(--unknown-bg); color: var(--unknown); }
.ht-chip.fit-great { background: #e3f6e8; color: #146c2e; }
.ht-chip.fit-budget { background: #e4eefc; color: #1a4f9c; }
.ht-chip.fit-sba { background: #fff3d6; color: #8a5a00; }
.ht-chip.fit-over { background: #fde8e6; color: #a12622; }
.ht-chip.active-goal { box-shadow: 0 0 0 2px var(--theme); }
.ht-chip.off { background: #333; color: #fff; }
.ht-chip.fav { background: #fde8e6; color: var(--heart); }
.card.is-hover, #inv-body tr.is-hover { outline: 2px solid var(--theme); outline-offset: -2px; }
.card.is-selected { box-shadow: 0 0 0 2px var(--theme), var(--shadow); }
#inv-body tr.is-selected { background: #eef5ee; }
.price-pin.pin-hover { box-shadow: 0 0 0 3px var(--theme); transform: scale(1.06); }

/* —— Desktop split (list | map | details) —— */
.desk-only { display: none; }
.pane-bar {
  display: none;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  height: auto;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-sizing: border-box;
}
#detail .pane-bar.detail-chrome,
#detail-chrome {
  display: flex;
}
.pane-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 36px;
  color: var(--ink);
}
.pane-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}
.pane-icon-btn,
.pane-toggle,
.pane-max-btn,
#detail-chrome .back-btn,
#detail-chrome .heart-btn {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pane-icon-btn:hover,
.pane-toggle:hover,
.pane-max-btn:hover {
  border-color: var(--theme);
  background: var(--secondary);
  color: var(--theme);
}
.pane-ico { pointer-events: none; }
.contact-realtor-btn {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.contact-realtor-btn:hover { filter: brightness(0.95); }
#detail-chrome .heart-btn,
.pane-bar .heart-btn,
.pane-actions .heart-btn {
  position: static !important;
  top: auto;
  right: auto;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  box-shadow: none;
  font-size: 15px;
}
.ls-contact-pop {
  position: fixed;
  z-index: 6002;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: min(320px, 92vw);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 24px rgba(21, 35, 27, 0.18);
  font-family: var(--font-sans);
}
.ls-contact-name {
  margin: 0 8px 4px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}
.ls-contact-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.ls-contact-link:hover {
  background: var(--secondary);
  color: var(--theme);
}
.sash { display: none; }
#detail-inner { min-height: 0; }
.detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  font-size: 15px;
}
#workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  body.desk-split #workspace {
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
  }
  body.desk-split .desk-only { display: flex; }
  body.desk-split .pane-bar { display: flex; }
  body.desk-split .sash {
    display: block;
    flex: 0 0 6px;
    width: 6px;
    cursor: col-resize;
    background: var(--line);
    z-index: 6;
  }
  body.desk-split .sash:hover,
  body.desk-split .sash.dragging { background: var(--theme); }
  body.desk-split #list-view,
  body.desk-split #map-view,
  body.desk-split #detail {
    display: flex !important;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  body.desk-split #list-view {
    flex: 0 0 var(--list-w, 30%);
    background: var(--bg);
    border-right: 0;
  }
  body.desk-split #list-view .cards {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    max-width: none;
    padding: 8px 10px 16px;
  }
  body.desk-split #list-view .card-photos { height: 140px; }
  body.desk-split #map-view {
    flex: 1 1 auto;
    position: relative;
  }
  body.desk-split .map-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
  }
  body.desk-split #map { height: 100%; }
  body.desk-split #detail {
    position: relative;
    inset: auto;
    z-index: 3;
    isolation: auto;
    flex: 0 0 var(--detail-w, 28%);
    background: #fff;
    overflow: hidden;
  }
  body.desk-split #detail-inner {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.desk-split .detail-body {
    padding: 12px 14px 24px;
    max-width: none;
  }
  body.desk-split .carousel { height: 180px; }
  body.desk-split .detail-foot {
    position: sticky;
    left: auto;
    right: auto;
    bottom: 0;
    z-index: 4;
  }
  body.desk-split .detail-top {
    position: sticky;
    padding-top: 6px;
  }
  body.desk-split.map-open #detail-map,
  body.desk-split.map-open .detail-map-wrap { display: none; }
  body.desk-split #map-mini { display: none !important; }

  /* Collapsed rails */
  body.desk-split.collapse-list #list-view {
    flex: 0 0 36px;
    width: 36px;
    max-width: 36px;
  }
  body.desk-split.collapse-detail #detail {
    flex: 0 0 36px;
    width: 36px;
    max-width: 36px;
  }
  body.desk-split.collapse-map #map-view {
    flex: 0 0 36px;
    width: 36px;
    max-width: 36px;
    order: 9;
  }
  body.desk-split.collapse-detail #detail {
    order: 8;
  }
  body.desk-split.collapse-list .sash-list-detail { display: none; }
  body.desk-split.collapse-map .sash-detail-map,
  body.desk-split.collapse-detail .sash-detail-map { display: none; }
  body.desk-split.collapse-detail #detail-view-tabs,
  body.desk-split.collapse-detail #detail-send-bar { display: none !important; }
  body.desk-split.collapse-list #list-view .cards,
  body.desk-split.collapse-map .map-stage,
  body.desk-split.collapse-detail #detail-inner { display: none !important; }
  body.desk-split.collapse-list #list-view .pane-bar,
  body.desk-split.collapse-map #map-view .pane-bar,
  body.desk-split.collapse-detail #detail .pane-bar {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 100%;
    width: 36px;
    min-height: 0;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 12px 0;
    justify-content: flex-start;
  }
  body.desk-split.collapse-list #list-view .pane-toggle,
  body.desk-split.collapse-map #map-view .pane-toggle,
  body.desk-split.collapse-detail #detail .pane-toggle {
    writing-mode: horizontal-tb;
    transform: none;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
  }
  body.desk-split.collapse-list #list-view .pane-actions,
  body.desk-split.collapse-map #map-view .pane-actions,
  body.desk-split.collapse-detail #detail .pane-actions {
    margin-left: 0;
  }
  body.desk-split.collapse-list #detail-chrome .contact-realtor-btn,
  body.desk-split.collapse-detail #detail-chrome .contact-realtor-btn,
  body.desk-split.collapse-detail #detail-chrome .heart-btn,
  body.desk-split.collapse-detail #detail-close-btn,
  body.desk-split.collapse-detail #detail-back { display: none !important; }
  body.desk-split.collapse-list #list-view .pane-max-btn,
  body.desk-split.collapse-map #map-view .pane-max-btn,
  body.desk-split.collapse-detail #detail .pane-max-btn,
  body.desk-split.collapse-map .map-corner-max { display: none !important; }

  /* Remaining open panes fill the width a collapsed rail frees */
  body.desk-split.collapse-list.collapse-map:not(.collapse-detail) #detail,
  body.desk-split.collapse-list.collapse-detail:not(.collapse-map) #map-view,
  body.desk-split.collapse-map.collapse-detail:not(.collapse-list) #list-view {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }
  body.desk-split.collapse-map:not(.collapse-list):not(.collapse-detail) #list-view,
  body.desk-split.collapse-map:not(.collapse-list):not(.collapse-detail) #detail {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }
  body.desk-split.collapse-list:not(.collapse-map):not(.collapse-detail) #map-view,
  body.desk-split.collapse-detail:not(.collapse-map):not(.collapse-list) #map-view {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  body.desk-split .seg button[data-view="list"],
  body.desk-split .seg button[data-view="map"] {
    /* Keep both as a way back from Table; they stay visible */
  }
  .toolbar .table-opt { display: inline-flex; }
}

@media (min-width: 900px) {
  body.desk-table #workspace { display: none; }
  body.desk-table #table-view,
  body.desk-table #table-view.show {
    display: block !important;
    flex: 1 1 auto;
    min-height: 0;
  }
}


/* CAL FIRE FHSZ legend */
.swatch-fhsz-mod { background: #ffff66; border: 1px solid #b8a800; }
.swatch-fhsz-high { background: #f5a623; border: 1px solid #c67a00; }
.swatch-fhsz-vh { background: #d0021b; border: 1px solid #8b0000; }
.fhsz-legend { margin-top: 8px; font-size: 12px; }
.fhsz-legend .swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }


/* —— 3D site view —— */
.detail-3d-btn {
  position: static;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: 22px;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.detail-3d-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 2px solid var(--theme);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f3efe4 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  text-align: left;
  color: var(--ink);
  min-height: 56px;
  cursor: pointer;
}
.detail-3d-cta-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--theme);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.detail-3d-cta-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-3d-cta-text strong { font-size: 16px; letter-spacing: -0.02em; }
.detail-3d-cta-text em { font-style: normal; font-size: 12px; color: var(--muted); }
.detail-3d-cta:hover, .detail-3d-cta:focus {
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,.12);
}
.goal-switch-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.goal-switch-wrap button { min-height: 30px; height: 30px; padding: 0 10px; font-size: 13px; }
.fit-writeup {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
.fit-writeup p { margin: 0; font-size: 14px; line-height: 1.45; }
.fit-cites { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.fit-badge.fit-budget { background: #e8f5e9; color: #1b5e20; }
.fit-badge.fit-great { background: #e3f2fd; color: #0d47a1; }
.fit-badge.fit-over { background: #fdecea; color: #8a1c12; }
.fit-badge.fit-miss { background: var(--muted-bg); color: var(--ink); }
#site3d {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  background: #e8efe4;
  color: var(--ink);
}
#site3d[hidden] { display: none !important; }
body.site3d-open #detail { overflow: hidden; }
.site3d-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + var(--safe-t)) 10px 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site3d-head-text { min-width: 0; flex: 1; }
.site3d-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.site3d-fit {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 12px 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  max-height: 6.2em;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}
.site3d-goals { max-width: min(100%, 720px); overflow-x: auto; }
.site3d-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.site3d-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}
.site3d-goals { margin: 0; }
.site3d-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 200px;
  overflow: hidden;
  background: #d7e4ef;
  touch-action: none;
}
.site3d-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.site3d-label {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 8px 4px;
  min-width: 92px;
  max-width: 160px;
  box-shadow: 0 4px 14px rgba(26,29,26,0.12);
  line-height: 1.2;
}
.site3d-label strong { display: block; font-size: 11px; }
.site3d-label span { display: block; font-size: 11px; font-weight: 700; color: var(--theme); }
.site3d-label em { display: block; font-size: 10px; font-style: normal; color: var(--muted); }
.site3d-label.needed { border-color: #8aa08a; background: rgba(244,239,230,0.92); }
.site3d-label.needed span { color: #4a5c40; }
.site3d-label.estimate span { font-weight: 600; color: var(--muted); }
.site3d-legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 6px 12px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.site3d-legend .swatch {
  display: inline-block;
  width: 11px; height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
  border-radius: 2px;
}
.site3d-legend .swatch.solid { background: #7a9a68; border: 1px solid #3d5334; }
.site3d-legend .swatch.ghost {
  background: rgba(244,239,230,0.9);
  border: 1px dashed #2f4a32;
}
.site3d-total {
  flex: 0 0 auto;
  padding: 8px 12px calc(10px + var(--safe-b));
  background: #fff;
  border-top: 1px solid var(--line);
}
.site3d-total-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.site3d-total-copy strong { font-size: 13px; letter-spacing: -0.01em; }
.site3d-bar-track {
  position: relative;
  height: 14px;
  background: linear-gradient(90deg, #e7f6eb 0%, #fff3d6 24.2%, #f5e6c8 30.3%, #fde8e6 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 16px 4px 18px;
}
.site3d-bar-range {
  position: absolute;
  top: 1px; bottom: 1px;
  background: var(--theme);
  border-radius: 6px;
  opacity: 0.85;
  min-width: 4px;
}
.site3d-bar-ask {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
}
.site3d-bar-mark {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 0;
  border-left: 1px dashed rgba(26,29,26,0.45);
}
.site3d-bar-mark span {
  position: absolute;
  top: 16px;
  left: 0;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.site3d-bar-track > .site3d-bar-mark:nth-of-type(2) span {
  top: auto;
  bottom: 16px;
}
.site3d-other { margin: 4px 0 0; font-size: 11px; }

/* Phone: stack the 3D header so the title is readable next to eight goal chips. */
@media (max-width: 1023px) {
  .site3d-head { flex-direction: column; align-items: stretch; }
  .site3d-head-text { flex: 1 1 auto; width: 100%; }
  .site3d-head h3 { font-size: 18px; }
  .site3d-sub {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .site3d-head-actions { width: 100%; align-items: stretch; }
  .site3d-goals { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}

/* Desktop: keep the 3D view as a full-window overlay, not a squeezed details column. */
@media (min-width: 900px) {
  body.desk-split #detail {
    position: relative;
  }
  body.desk-split #reimagine,
  body.desk-split #site3d,
  body.desk-split.site3d-open #site3d,
  body.desk-split.reimagine-open #reimagine {
    position: absolute;
    inset: 0;
    z-index: 30;
    width: auto;
    height: auto;
    max-height: none;
  }
  body.desk-split .site3d-head { padding: 8px 14px; }
  body.desk-split .site3d-head h3 { font-size: 18px; }
  body.desk-split .site3d-fit { max-height: 5.4em; }
  body.desk-split .site3d-sub {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body.desk-split .site3d-total { padding: 8px 14px 12px; }
  body.desk-split .site3d-total-copy { font-size: 13px; margin-bottom: 6px; }
  body.desk-split .site3d-legend { padding: 6px 14px; }
  body.desk-split .site3d-head-actions { flex-direction: column; align-items: flex-end; }
  body.desk-split .site3d-other { font-size: 11px; }
  body.desk-split .site3d-stage { min-height: 420px; }
}

.detail-cta-stack { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 14px; }
.detail-cta-stack .detail-3d-cta { margin: 0; }
.detail-3d-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.detail-3d-secondary:hover, .detail-3d-secondary:focus { border-color: var(--theme); }
.detail-3d-cta[disabled] { opacity: 0.6; cursor: not-allowed; }

#reimagine {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  background: #1b2418;
  color: #f4efe6;
}
#reimagine[hidden] { display: none !important; }
.reim-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + var(--safe-t, 0px)) 14px 8px;
  background: #11180f;
  border-bottom: 1px solid rgba(244,239,230,0.12);
}
.reim-head-text { min-width: 0; flex: 1; }
.reim-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; color: #fff; }
.reim-sub { margin: 2px 0 0; font-size: 12px; color: #c9c2b4; line-height: 1.35; }
.reim-head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.reim-goals { max-width: min(100%, 720px); overflow-x: auto; flex-wrap: nowrap; }
#reimagine .reim-goals button,
#reimagine .reim-goals button.ghost {
  background: var(--secondary);
  color: var(--ink);
  border: 1px solid #6d755c;
  font-weight: 700;
  font-size: 12px;
  min-height: 34px;
  min-width: auto;
  padding: 0 10px;
  white-space: nowrap;
}
#reimagine .reim-goals button[aria-pressed="true"] {
  background: #d4e07a;
  color: #14200f;
  border-color: #1b2418;
}
#reimagine .reim-head-btns .ghost,
#reimagine .reim-head-btns .back-btn {
  background: var(--secondary);
  color: var(--ink);
  border-color: #6d755c;
}

.reim-head-btns { display: flex; gap: 8px; }
.reim-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  overflow: hidden;
  background: #0d120c;
}
#reim-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d120c;
}
.reim-structures, .reim-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.reim-structures .reim-shape { fill: rgba(244,239,230,0.28); stroke: #f4d27a; stroke-width: 0.45; }
.reim-structures .reim-shape.pad { fill: rgba(80,80,80,0.45); stroke: #d9d3c7; }
.reim-structures .reim-shape.drive { fill: rgba(90,90,90,0.55); stroke: none; }
.reim-structures .reim-shape.ceremony { fill: rgba(197,212,161,0.35); stroke: #e8f0c8; }
.reim-leaders line { stroke: var(--gold); stroke-width: 0.4; }
.reim-leaders circle { fill: var(--gold); }
.reim-labels { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.reim-label {
  position: absolute;
  transform: none;
  background: var(--map-panel);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 6px 10px 5px;
  min-width: 104px;
  max-width: 180px;
  color: var(--map-ink);
  line-height: 1.2;
  box-shadow: 0 4px 16px rgba(6, 24, 13, 0.45);
}
.reim-label strong { display: block; font-size: 11px; font-family: var(--font-sans); font-weight: 600; }
.reim-label span { display: block; font-size: 12px; font-weight: 700; color: var(--gold); font-family: var(--font-display); }
.reim-label em { display: block; font-size: 10px; font-style: normal; color: #c9d4cc; }
.reim-busy {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(17,24,15,0.9);
  border: 1px solid rgba(244,210,122,0.4);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: #f4efe6;
}
.reim-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(244,210,122,0.3);
  border-top-color: #f4d27a;
  border-radius: 50%;
  animation: reim-spin 0.8s linear infinite;
}
@keyframes reim-spin { to { transform: rotate(360deg); } }
.reim-fit, .reim-disclaimer {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 16px;
  font-size: 12px;
  line-height: 1.4;
  background: var(--map-panel);
  color: #c9d4cc;
  font-family: var(--font-sans);
}
.reim-fit { max-height: 5.4em; overflow: auto; color: var(--map-ink); border-top: 1px solid rgba(252,252,252,0.1); }
.reim-total {
  flex: 0 0 auto;
  padding: 10px 16px calc(12px + var(--safe-b, 0px));
  background: var(--map-panel);
  border-top: 1px solid rgba(255, 185, 0, 0.35);
  color: var(--map-ink);
}
.reim-bar-meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: #c9d4cc;
  font-family: var(--font-sans);
}
.reim-bar-total {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
  color: var(--map-ink);
}
.reim-bar-band { margin: 6px 0 0; }
.reim-total .fit-badge { font-family: var(--font-sans); }
.reim-other { margin: 4px 0 0; font-size: 11px; color: #c9d4cc; }
.reim-modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.reim-mode {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(252,252,252,0.2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--map-ink);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
}
.reim-mode[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #15231b;
}
#reimagine .reim-goals button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
}
@media (max-width: 899px) {
  .reim-head { flex-direction: column; align-items: stretch; }
  .reim-head-actions { align-items: stretch; width: 100%; }
}

.reset-layout-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.reset-layout-btn svg { display: block; flex: 0 0 auto; }
@media (min-width: 900px) {
  .reset-layout-btn { display: inline-flex; }
}
.reset-layout-btn:hover { background: var(--secondary); color: var(--ink); }


.photo-aerial,
.photo-track img.photo-aerial,
.carousel img.photo-aerial {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1c2a22;
}


/* —— Details maximize + section send —— */
.detail-section { margin: 0; }
.detail-section > .section-h {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 24px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.section-send {
  flex: 0 0 auto;
  margin-left: auto;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted-foreground, var(--muted));
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.section-send:hover {
  border-color: var(--theme);
  color: var(--theme);
  background: var(--secondary);
}
.pane-bar .pane-max-btn,
.pane-bar .detail-max-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  box-shadow: none;
}
body.detail-max .detail-max-btn,
body.pane-max-list .pane-max-btn[data-max-pane="list"],
body.pane-max-map .pane-max-btn[data-max-pane="map"],
body.pane-max-detail .pane-max-btn[data-max-pane="detail"],
body.detail-max .pane-max-btn[data-max-pane="detail"] {
  background: var(--secondary);
  border-color: var(--theme);
  color: var(--theme);
}
body.detail-max #detail-chrome { flex-wrap: wrap; }
.detail-send-bar {
  display: none;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
}
body.detail-max .detail-send-bar { display: flex; }
.detail-send-bar .ls-ai-btn,
.ls-ai-menu .ls-ai-btn {
  flex: 1 1 auto;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}
.detail-send-bar .ls-ai-btn:hover,
.ls-ai-menu .ls-ai-btn:hover {
  border-color: var(--theme);
  background: var(--secondary);
}
.ls-ai-menu {
  position: fixed;
  z-index: 6002;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 24px rgba(21, 35, 27, 0.18);
}
.ls-ai-menu .ls-ai-btn { width: 100%; justify-content: flex-start; }

#ls-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: rgba(21, 35, 27, 0.45);
}
#ls-detail-backdrop[hidden] { display: none !important; }
body.detail-max #ls-detail-backdrop,
body.pane-max #ls-detail-backdrop { z-index: 5000; }

@media (min-width: 900px) {
  body.pane-max-list.desk-split #list-view,
  body.pane-max-list #list-view,
  body.pane-max-map.desk-split #map-view,
  body.pane-max-map #map-view,
  body.pane-max-detail.desk-split #detail,
  body.pane-max-detail #detail,
  body.detail-max.desk-split #detail,
  body.detail-max #detail {
    position: fixed !important;
    top: 5vh !important;
    left: 4vw !important;
    right: auto !important;
    bottom: auto !important;
    width: 92vw !important;
    height: 90vh !important;
    max-height: 90vh !important;
    flex: 0 0 auto !important;
    z-index: 5001;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(21, 35, 27, 0.22);
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    background: #fff;
    max-width: none !important;
  }
  body.pane-max-list #list-view { background: var(--bg); }
  body.pane-max-list #list-view .cards {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 16px;
    max-width: none;
    padding: 16px 20px 24px;
  }
  body.pane-max-list #list-view .card {
    align-self: start;
    height: auto;
    flex: none;
  }
  body.pane-max-list #list-view .card-photos { height: 160px; }
  body.pane-max-map #map-view .map-stage,
  body.pane-max-map #map {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }
  body.detail-max.desk-split #detail-inner,
  body.detail-max #detail-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.detail-max.desk-split .carousel,
  body.detail-max .carousel { height: 280px; }
  body.detail-max.desk-split .detail-body {
    padding: 16px 22px 24px;
    max-width: 920px;
    margin: 0 auto;
  }
  body.detail-max.desk-split #reimagine,
  body.detail-max.desk-split #site3d,
  body.detail-max.desk-split.site3d-open #site3d,
  body.detail-max.desk-split.reimagine-open #reimagine {
    position: absolute;
    inset: 0;
    z-index: 30;
    width: auto;
    height: auto;
    max-height: none;
  }
}

@media (max-width: 899px) {
  #list-view > .pane-bar.desk-only,
  #map-view > .pane-bar.desk-only {
    display: flex;
  }
  #list-view .pane-toggle,
  #map-view .pane-toggle { display: none; }

  body.detail-open:not(.detail-max):not(.pane-max-detail) #detail {
    top: auto;
    height: 92vh;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(21, 35, 27, 0.2);
    z-index: 2000;
  }
  body.phone-map-open:not(.pane-max-map) #map-view {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: 92vh;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(21, 35, 27, 0.2);
    z-index: 2000;
    display: flex !important;
    flex-direction: column;
    background: var(--map-panel, #06180d);
    overflow: hidden;
  }
  body.phone-map-open:not(.pane-max-map) #map-view .map-stage,
  body.phone-map-open:not(.pane-max-map) #map {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
  body.detail-max #detail,
  body.pane-max-detail #detail,
  body.pane-max-map #map-view,
  body.pane-max-list #list-view {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    max-height: none;
    width: auto;
    border-radius: 0;
    z-index: 5001;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
  }
  body.pane-max-list #list-view { background: var(--bg); }
  body.pane-max-map #map-view { background: var(--map-panel, #06180d); }
  body.pane-max-map #map-view .map-stage,
  body.pane-max-map #map,
  body.pane-max-list #list-view .cards {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  body.detail-max #ls-detail-backdrop,
  body.pane-max #ls-detail-backdrop { z-index: 5000; }
  .detail-send-bar .ls-ai-btn { flex: 1 1 calc(50% - 8px); }
}

.ls-toast {
  position: fixed;
  z-index: 6000;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(420px, 92vw);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--map-panel, #06180d);
  color: var(--map-ink, #fcfcfc);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(21, 35, 27, 0.28);
  pointer-events: none;
}

/* Unified details header lives in #detail-chrome; never show a second toolbar row. */
.detail-top { display: none !important; }
@media (max-width: 899px) {
  #detail-chrome { padding-top: var(--safe-t); min-height: calc(36px + var(--safe-t)); }
  #detail-chrome .pane-toggle { display: none; }
}

/* Report | Reimagine | 3D + overlay back bar */
.detail-view-tabs {
  display: none;
  flex: 1 1 100%;
  align-items: center;
  gap: 2px;
  margin: 0 0 8px;
  padding: 3px;
  border-radius: 10px;
  background: var(--secondary);
}
.detail-view-tabs:not([hidden]) { display: flex; }
.detail-view-tabs button {
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
}
.detail-view-tabs button[aria-selected="true"] {
  background: #fff;
  box-shadow: 0 1px 3px rgba(21, 35, 27, 0.12);
}
.view-back-bar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
#reimagine .view-back-bar {
  background: #11180f;
  border-bottom-color: rgba(244, 239, 230, 0.12);
}
.view-back-btn {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.view-back-btn:hover { filter: brightness(0.95); }

/* Keep Report / Reimagine / 3D chrome visible; fill the rest of the details panel */
#detail {
  display: flex;
  flex-direction: column;
}
#detail-chrome { flex: 0 0 auto; position: relative; z-index: 40; }
#detail > #reimagine,
#detail > #site3d,
body.desk-split #detail > #reimagine,
body.desk-split #detail > #site3d,
body.desk-split.reimagine-open #detail > #reimagine,
body.desk-split.site3d-open #detail > #site3d,
body.detail-max #detail > #reimagine,
body.detail-max #detail > #site3d,
body.detail-max.desk-split #detail > #reimagine,
body.detail-max.desk-split #detail > #site3d,
body.pane-max-detail #detail > #reimagine,
body.pane-max-detail #detail > #site3d {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  flex: 1 1 auto !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  z-index: 6;
}
body.reimagine-open #detail-inner,
body.site3d-open #detail-inner {
  display: none !important;
}

/* Send-to-AI controls omitted from this release */
#detail-send-bar,
.detail-send-bar,
.section-send,
.ls-ai-menu { display: none !important; }

#detail-inner .ls-paywall,
#detail .ls-paywall { margin-bottom: 12px; }
#detail-inner:has(.ls-paywall) .detail-body { padding-bottom: calc(24px + var(--safe-b, 0px)); }

/* Logical Details sections */
.overview-h,
.detail-section-overview > .overview-h {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--ink);
}
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 12px;
}
.kv-grid div {
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 10px;
}
.kv-grid dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 2px;
}
.kv-grid dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}
.overview-actions,
.notes-partners-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 8px;
}
.overview-action {
  flex: 1 1 calc(50% - 8px);
  min-width: 120px;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.overview-action.primary,
a.overview-action.primary {
  background: var(--theme);
  border-color: var(--theme);
  color: #fff;
}
.overview-action:hover {
  border-color: var(--theme);
  background: var(--secondary);
  color: var(--theme);
}
.overview-action.primary:hover,
a.overview-action.primary:hover {
  background: #2a5430;
  border-color: #2a5430;
  color: #fff;
}
.detail-section {
  margin: 0 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.detail-section-overview {
  border-bottom: 0;
  margin-bottom: 8px;
}
.detail-section > .section-h {
  margin: 16px 0 8px;
}
.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.section-chevron {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.section-toggle[aria-expanded="false"] .section-chevron {
  transform: rotate(-45deg);
  margin-top: 2px;
}
.detail-section.is-collapsed .section-body { display: none; }
.sub-h {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 6px;
  color: var(--ink);
}
.fit-verdict-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.fit-goal-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.fit-why { margin: 0 0 8px; }
.fit-harms {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
}
.must-intro { margin: 0 0 8px; }
.js-clamp.is-clamped {
  max-height: 7.25em;
  overflow: hidden;
  position: relative;
}
.js-clamp.is-clamped::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2.2em;
  background: linear-gradient(to bottom, transparent, #fff);
}
.show-more-btn {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  color: #326234;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.venue-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 8px;
}
.venue-cta-stack .detail-3d-cta { margin: 0; }
.venue-events { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.view-more-in-detail { margin: 8px 0 10px; width: auto; }
.detail-foot { display: none !important; }
body.desk-split .detail-foot { display: none !important; }

/* ---- Business plan (per goal) ---- */
.detail-goal-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.detail-goal-pick label { font-weight: 650; font-size: 14px; }
.detail-goal-pick select { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; max-width: 100%; }
.detail-goal-pick .muted { flex-basis: 100%; font-size: 12px; }
.bp-host > p { margin: 0 0 10px; }
.bp { font-size: 14px; line-height: 1.5; }
.bp-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 8px; }
.bp-toolbar .bp-goal { flex: 1 1 100%; font-size: 13px; color: var(--muted); }
.bp-disclaimer { font-size: 12px; color: var(--muted); background: var(--muted-bg, #f1f5f9); border-radius: 8px; padding: 8px 10px; margin: 0 0 6px; }
.bp-h { font-size: 15px; margin: 20px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.bp-sub { font-weight: 650; margin: 10px 0 4px; }
.bp-kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 12px; margin: 0 0 8px; }
.bp-kv dt { color: var(--muted); font-size: 13px; }
.bp-kv dd { margin: 0; overflow-wrap: anywhere; }
.bp-kv dd .muted { display: block; font-size: 12px; }
.bp-est, .bp-tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); vertical-align: 1px; }
.bp-est { background: var(--caution-bg); border-color: transparent; color: #6b4e00; }
.bp-missing { background: #fff6e0; border-left: 3px solid #e0a800; padding: 6px 10px; margin: 6px 0; font-size: 13px; border-radius: 0 6px 6px 0; }
.bp-missing span { color: var(--muted); }
.bp-loading { color: var(--muted); font-style: italic; }
.bp-source { font-size: 12px; color: var(--muted); }
.bp-table-wrap { overflow-x: auto; margin: 6px 0 8px; }
.bp-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.bp-table th, .bp-table td { border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: right; white-space: nowrap; }
.bp-table th:first-child, .bp-table td:first-child { text-align: left; }
.bp-table tr.bp-peak td:last-child { color: var(--pass, #2f6b3a); font-weight: 650; }
.bp-table tr.bp-off td { color: var(--muted); }
.bp-assume-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.bp-assume { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; background: var(--card); }
.bp-assume.is-edited { border-style: solid; border-color: #9bb8a2; }
.bp-assume label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.bp-assume .bp-inputs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.bp-assume input { width: 84px; font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; }
.bp-assume p.muted { font-size: 11.5px; margin: 4px 0 0; }
.bp-plan, .bp-risks, .bp-steps, .bp-check { padding-left: 18px; margin: 4px 0 8px; }
.bp-plan li, .bp-risks li, .bp-steps li { margin: 3px 0; }
.bp-risks li.fail strong { color: var(--fail, #a3342b); }
.bp-risks li.caution strong { color: #8a5a00; }
.bp-risks .muted { display: block; font-size: 12px; }
.bp-check { list-style: none; padding-left: 2px; }
.bp-check li { margin: 3px 0; }
@media (max-width: 600px) { .bp-kv { grid-template-columns: 1fr; gap: 0 0; } .bp-kv dt { margin-top: 6px; } }

/* ---- "Open full plan in new tab" buttons ---- */
.plan-tab-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 14px; line-height: 1.25; border-radius: 10px; padding: 11px 14px; background: var(--primary, #326234); color: var(--primary-foreground, #fbf8f1); box-shadow: 0 2px 6px rgba(21, 35, 27, .18); }
.plan-tab-btn:hover { filter: brightness(1.08); }
.plan-tab-ico { font-size: 16px; line-height: 1; }
.detail-goal-pick .plan-tab-btn-top { flex-basis: 100%; margin-top: 4px; }
.plan-tab-btn-section { width: 100%; margin: 4px 0 12px; }
.detail-view-tabs .plan-tab-btn-tabs { flex: 0 0 auto; height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; box-shadow: none; gap: 4px; white-space: nowrap; }

/* ---- Full plan page (/?plan=<id>&goal=<G>) ---- */
body.plan-page > *:not(#plan-page):not(#toast):not(.ls-contact-popover) { display: none !important; }
body.plan-page { overflow: auto !important; background: var(--bg); }
#plan-page { display: block; min-height: 100vh; }
.plan-top { position: sticky; top: 0; z-index: 50; background: rgba(246, 249, 247, .96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); padding: 8px 16px 0; }
.plan-top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 980px; margin: 0 auto; }
.plan-back { color: var(--ink); text-decoration: none; font-weight: 650; font-size: 14px; }
.plan-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-goal-label { font-weight: 650; font-size: 13px; }
#plan-goal-select { font: inherit; font-size: 14px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; max-width: 60vw; }
.plan-nav { display: flex; gap: 4px; max-width: 980px; margin: 6px auto 0; overflow-x: auto; }
.plan-nav a { padding: 7px 10px; font-size: 13px; font-weight: 650; color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.plan-nav a:hover { border-bottom-color: var(--primary); }
.plan-wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 80px; }
.plan-head h1 { font-family: var(--font-display); font-size: 26px; line-height: 1.15; margin: 2px 0 4px; }
.plan-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); }
.plan-addr { margin: 0 0 12px; color: var(--muted); }
.plan-photos { border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.plan-photos img { width: 100%; height: clamp(220px, 42vw, 420px); object-fit: cover; }
#plan-print { width: auto; flex: 0 0 auto; padding: 8px 14px; }
h2.plan-part { font-family: var(--font-display); font-size: 20px; margin: 28px 0 6px; padding-top: 12px; border-top: 2px solid var(--primary); scroll-margin-top: 96px; }
#plan-page .detail-section { scroll-margin-top: 96px; }
.plan-embed { position: relative; min-height: 120px; border-radius: 12px; overflow: hidden; }
#plan-page #reimagine, #plan-page #site3d { position: relative !important; inset: auto !important; z-index: 1 !important; width: 100% !important; border-radius: 12px; }
#plan-page #site3d { height: min(78vh, 760px); min-height: 460px; }
#plan-page #reimagine { min-height: min(82vh, 820px); }
#plan-page .view-back-bar { display: none !important; }
@media (max-width: 600px) {
  .plan-head h1 { font-size: 21px; }
  .plan-wrap { padding: 12px 12px 60px; }
  #plan-page #site3d { height: 72vh; min-height: 420px; }
}
@media print {
  .plan-top, .plan-tab-btn, #plan-page .view-back-bar, #plan-page .section-chevron, .bp-toolbar button { display: none !important; }
  #plan-page .detail-section.is-collapsed .section-body { display: block !important; }
  h2.plan-part { break-before: page; }
  #plan-page #site3d, #plan-page #reimagine { height: auto; min-height: 0; }
}
@media (max-width: 700px) {
  #plan-page .site3d-head, #plan-page .reim-head { flex-wrap: wrap; }
  #plan-page .site3d-head-actions, #plan-page .reim-head-actions { flex: 1 1 100%; min-width: 0; }
  /* The page's own Goal picker (top bar) drives these on phones. */
  #plan-page .site3d-goals, #plan-page .reim-goals { display: none !important; }
}

/* EC-24 goal-tailored list + details */
.goal-hide-note { list-style: none; font-size: 13px; color: var(--muted, #555); background: var(--muted-bg, #f1f5f9); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent, #2f6b3a); font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }
.lc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.lc-table th, .lc-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border, #e5e7eb); }
.lc-table td:nth-child(n+2), .lc-table th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.lc-lead { margin: 0 0 4px; }
.lc-eco { font-size: 13px; margin: 8px 0 0; }
.lc-slot .muted { margin: 4px 0; }
.check-list .note .lc-slot { margin-top: 6px; }
.plan-brand-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.plan-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.plan-brand img { border-radius: 7px; }

/* Due diligence evidence layer (staging-gated) */
.ddb{display:inline-block;font-size:11px;line-height:16px;padding:0 6px;border-radius:8px;font-weight:600;white-space:nowrap;vertical-align:1px}
.ddb-verified{background:#e3f4e8;color:#1b6b34}
.ddb-seller{background:#e6eefb;color:#2450a0}
.ddb-needs{background:#fdf1d8;color:#8a5a00}
.ddb-risk{background:#fde4e1;color:#a3261a}
.ddb-unknown{background:#eceef0;color:#555}
.dd-ready{margin:4px 0 8px}
.dd-score{font-size:14px}
.dd-risktxt{color:#a3261a;font-weight:600}
.dd-bar{height:6px;background:#eceef0;border-radius:3px;margin:4px 0 6px;overflow:hidden}
.dd-bar span{display:block;height:100%;background:#2e8b57}
.dd-pop summary,.dd-bdet summary{cursor:pointer;font-size:13px;font-weight:600;color:#2450a0 !important;opacity:1 !important}
.dd-pop ul{margin:4px 0 0;padding-left:18px;font-size:12px}
.dd-mm{font-size:12px;margin:4px 0}
.dd-budget{border:1px solid #e3e5e8;border-radius:8px;padding:6px 8px;margin:6px 0;font-size:13px}
.dd-bline{margin:2px 0}
.dd-btab{font-size:12px;margin-top:4px}
.dd-brow{display:flex;gap:8px;padding:2px 0;border-top:1px solid #f0f1f3}
.dd-blab{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
.dd-brow .num{flex:0 0 auto;text-align:right;white-space:nowrap}
.dd-bnote{color:#888}
.dd-btot{font-weight:700}
.dd-slot,.dd-budget,.dd-row{min-width:0;max-width:100%;overflow-wrap:anywhere}
.dd-bline{display:flex;flex-wrap:wrap;gap:4px;align-items:center}
.dd-h{font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:#666;margin:10px 0 2px}
.dd-list{list-style:none;margin:0;padding:0}
.dd-row{padding:5px 0;border-top:1px solid #f0f1f3}
.dd-top{display:flex;gap:6px;align-items:center}
.dd-lab{font-weight:600;font-size:13px}
.dd-val{font-size:13px;margin:1px 0}
.dd-src{font-size:11px;color:#777}
.dd-src a{color:inherit;text-decoration:underline}
.dd-meth{color:#999}
.dd-legend{margin-top:8px;display:flex;flex-wrap:wrap;gap:4px}
