/* ============================================================
   HomesteadScout — Field Survey UI
   Earthy/agrarian — paper, stone, ink, brick — surveyor marks.
   ============================================================ */

:root {
  /* Surfaces */
  --paper:        #f3ecda;   /* page bg — warm parchment */
  --paper-2:      #ebe3cd;   /* subtle alt bg, hover */
  --card:         #fbf6e7;   /* card surface */
  --card-2:       #f7f1de;   /* nested card */

  /* Ink */
  --ink:          #1c1a14;
  --ink-soft:     #4a443a;
  --ink-mute:     #8a8270;

  /* Stone (borders, rules) */
  --stone:        #d8cfb6;
  --stone-dark:   #a89c80;

  /* Brick (accent — alerts, primary chrome) */
  --brick:        #9c4727;
  --brick-soft:   #f0d9c8;
  --brick-ink:    #fbf6e7;

  /* Score tiers */
  --green:        #4f6b2a;
  --green-soft:   #d8e0bf;
  --yellow:       #b08a1a;
  --yellow-soft:  #efe2b7;
  --orange:       #b56324;
  --orange-soft:  #f3d8bd;
  --red:          #952f1f;
  --red-soft:     #efc9bd;

  /* Type */
  --font-display: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-body:    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brick); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Typography helpers ---------- */
.t-eyebrow,
.t-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.t-mono { font-family: var(--font-mono); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 304px 1fr;
  min-height: 100vh;
  align-items: stretch;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--stone);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}
.sidebar__inner {
  padding: 24px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar__brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--stone);
  margin-bottom: 4px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.logo .amp { color: var(--brick); margin: 0 2px; font-weight: 500; }
.tag {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* Filter groups */
.section { padding: 0; }
.filter-group { display: flex; flex-direction: column; gap: 10px; }
.filter-group__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.filter-group .label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  letter-spacing: 0.005em;
}
.filter-group .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}

/* Check list */
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px 6px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.check:hover { background: var(--paper-2); }
.check.is-on { color: var(--ink); }
.check__box {
  width: 14px; height: 14px;
  border: 1.2px solid var(--stone-dark);
  background: var(--card-2);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
  color: var(--brick-ink);
}
.check.is-on .check__box {
  background: var(--brick);
  border-color: var(--brick);
}
.check__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
}

/* Range pair */
.range-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.range-pair .sep {
  font-family: var(--font-mono);
  color: var(--ink-mute);
}
.input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--stone-dark);
  background: var(--card-2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  outline: 0;
}
.input:focus { border-color: var(--brick); background: var(--card); }

/* Slider */
.slider-row { display: flex; flex-direction: column; gap: 6px; }
.slider-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--stone);
  border-radius: 2px;
  outline: 0;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--brick);
  border-radius: 50%;
  border: 2px solid var(--card);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--brick);
  border-radius: 50%;
  border: 2px solid var(--card);
  cursor: pointer;
}
.slider-vals {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-mute);
}
.slider-vals .cur { color: var(--ink); font-weight: 500; }

/* Stars */
.star-row { display: flex; gap: 4px; }
.star {
  font-size: 18px;
  color: var(--stone-dark);
  cursor: pointer;
  line-height: 1;
  transition: color .12s ease;
}
.star.on, .star:hover { color: var(--brick); }

/* Toggle */
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--stone);
  cursor: pointer;
  gap: 12px;
}
.toggle:first-child { border-top: 0; }
.toggle > span:first-child {
  display: flex; flex-direction: column; gap: 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}
.toggle .helper {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11.5px;
  color: var(--ink-mute);
}
.toggle .switch {
  width: 32px; height: 18px;
  background: var(--stone-dark);
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  transition: background .15s ease;
}
.toggle .switch::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--card);
  border-radius: 50%;
  transition: transform .15s ease;
}
.toggle.is-on .switch { background: var(--brick); }
.toggle.is-on .switch::after { transform: translateX(14px); }

/* Actions */
.sidebar__actions { margin-top: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--card-2);
  border: 1px solid var(--stone-dark);
  color: var(--ink);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--paper-2); border-color: var(--ink); }
.btn--primary {
  background: var(--brick);
  color: var(--brick-ink);
  border-color: var(--brick);
}
.btn--primary:hover { background: #803818; border-color: #803818; }
.btn--ghost {
  background: transparent;
  border-color: var(--stone-dark);
  color: var(--ink-soft);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 28px 22px;
  border-bottom: 1px solid var(--stone);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.crumbs { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.crumbs .eb {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.crumbs h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex; align-items: baseline; gap: 14px;
}
.crumbs h1 .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: none;
}

.topbar__right { display: flex; gap: 12px; align-items: center; }

.search {
  position: relative;
  display: flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--stone-dark);
  border-radius: 4px;
  padding: 0 10px;
  width: 280px;
}
.search:focus-within { border-color: var(--brick); }
.search__icon { color: var(--ink-mute); display: flex; }
.search__input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  outline: 0;
}
.search__input::placeholder { color: var(--ink-mute); }
.search__clear {
  background: transparent; border: 0;
  color: var(--ink-mute);
  font-size: 12px;
  padding: 4px 2px 4px 4px;
}
.search__clear:hover { color: var(--ink); }

.sort-select {
  padding: 9px 32px 9px 12px;
  background: var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23a89c80' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>") no-repeat right 12px center;
  border: 1px solid var(--stone-dark);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.sort-select:focus { outline: 0; border-color: var(--brick); }

/* ---------- Skeleton ---------- */
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, var(--stone), var(--paper-2), var(--stone));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 0 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Results grid ---------- */
.results {
  padding: 24px 28px 56px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 24px;
  align-items: start;
}
.empty {
  margin: 60px 28px;
  padding: 48px 32px;
  border: 1px dashed var(--stone-dark);
  background: var(--card);
  border-radius: 8px;
  text-align: center;
  color: var(--ink-soft);
}
.empty h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
}
.empty p { margin: 0; font-size: 14px; max-width: 50ch; margin-inline: auto; }

/* ============================================================
   PROPERTY CARD
   ============================================================ */
.pc {
  background: var(--card);
  border: 1px solid var(--stone);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.pc:hover {
  border-color: var(--stone-dark);
  box-shadow: 0 4px 18px rgba(28, 26, 20, 0.06);
}
.pc.is-flagged { border-color: var(--orange); }
.pc.is-flagged:hover { box-shadow: 0 4px 18px rgba(149, 47, 31, 0.12); }

/* ---- Hero ---- */
.pc__hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper-2);
  overflow: hidden;
}
.pc__hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc__hero-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, var(--paper-2) 0 10px, var(--card-2) 10px 20px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.pc__hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

/* Score badge */
.score-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--card);
  border: 1px solid var(--stone-dark);
  border-radius: 5px;
  padding: 6px 10px 7px;
  display: flex; flex-direction: column; gap: 3px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-width: 84px;
}
.score-badge__num {
  display: flex; align-items: baseline; gap: 3px;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
}
.score-badge__num .n { font-size: 24px; }
.score-badge__num .over {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
  font-weight: 400;
}
.score-badge__num.score--green  .n { color: var(--green); }
.score-badge__num.score--yellow .n { color: var(--yellow); }
.score-badge__num.score--orange .n { color: var(--orange); }
.score-badge__num.score--red    .n { color: var(--red); }

.score-badge__meta {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stars { font-size: 11px; letter-spacing: 0; color: var(--brick); }
.tier { color: var(--ink-soft); }

/* Hero chip stack — top-right */
.pc__hero-chips {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  z-index: 2;
  max-width: 60%;
}

/* Address bar at bottom of hero */
.pc__address {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 14px 12px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px;
  color: var(--brick-ink);
  z-index: 2;
}
.pc__address .place {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: #fbf6e7;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pc__address .sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(251, 246, 231, 0.85);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pc__address .price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  color: #fbf6e7;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pc__address .price .pp {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10.5px;
  color: rgba(251, 246, 231, 0.85);
  letter-spacing: 0.04em;
}

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--stone-dark);
  white-space: nowrap;
}
.chip__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.chip--viab-excellent { background: var(--green-soft);  color: var(--green);  border-color: var(--green); }
.chip--viab-good      { background: var(--yellow-soft); color: var(--yellow); border-color: var(--yellow); }
.chip--viab-marginal  { background: var(--orange-soft); color: var(--orange); border-color: var(--orange); }
.chip--viab-poor      { background: var(--red-soft);    color: var(--red);    border-color: var(--red); }
.chip--flood-x        { background: var(--green-soft);  color: var(--green);  border-color: var(--green); }
.chip--flood-ae       { background: var(--orange-soft); color: var(--orange); border-color: var(--orange); }
.chip--dq             { background: var(--red);  color: var(--brick-ink); border-color: var(--red); }
.chip--warn           { background: var(--yellow-soft); color: var(--yellow); border-color: var(--yellow); }
.chip--new {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.14em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  padding: 4px 9px;
}
.chip--new .chip__pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #6fbf4e;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(111, 191, 78, 0.7);
  animation: newPulse 1.8s ease-out infinite;
}
@keyframes newPulse {
  0%   { box-shadow: 0 0 0 0 rgba(111, 191, 78, 0.7); }
  70%  { box-shadow: 0 0 0 6px rgba(111, 191, 78, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 191, 78, 0); }
}

/* ---- Body ---- */
.pc__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--stone);
  border-radius: 5px;
  overflow: hidden;
  background: var(--card-2);
}
.stat-row .cell {
  padding: 10px 12px;
  border-right: 1px solid var(--stone);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-row .cell:last-child { border-right: 0; }
.stat-row .cell .v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.1;
}
.stat-row .cell .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* Signals row */
.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.signal {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--stone);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--card-2);
}
.signal__icon { width: 13px; height: 13px; display: inline-flex; }
.signal__icon svg { width: 100%; height: 100%; }
.signal--on { color: var(--ink); border-color: var(--stone-dark); background: var(--card); }
.signal--off { opacity: 0.45; }

/* Pros / Cons */
.proscons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  padding-top: 4px;
}
.proscons .col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.proscons .col li {
  display: flex; gap: 6px; align-items: flex-start;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.proscons .col .glyph {
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}
.proscons .pros .glyph { color: var(--green); }
.proscons .cons .glyph { color: var(--orange); }

/* ---- Toggle row ---- */
.pc__toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: var(--card-2);
  border: 0;
  border-top: 1px solid var(--stone);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}
.pc__toggle:hover { background: var(--paper-2); }
.pc__toggle .caret { font-size: 12px; transition: transform .2s ease; }
.pc.is-open .pc__toggle .caret { transform: rotate(180deg); }

/* ---- Expanded ---- */
.pc__expand {
  border-top: 1px solid var(--stone);
  background: var(--paper);
}
.pc__expand-inner {
  padding: 18px 16px 18px;
  display: flex; flex-direction: column;
  gap: 22px;
}
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--stone);
  padding-bottom: 6px;
}
.section-h h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  letter-spacing: 0;
}
.section-h .hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* Categories */
.cat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
}
.cat-row {
  display: grid;
  grid-template-columns: 1fr 60px auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.cat-row .name { color: var(--ink); }
.cat-row .bar {
  height: 4px;
  background: var(--stone);
  border-radius: 2px;
  overflow: hidden;
}
.cat-row .bar i {
  display: block; height: 100%;
  background: var(--brick);
  border-radius: 2px;
}
.cat-row .val {
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Habitat */
.habitat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.hab {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--stone);
  border-radius: 4px;
}
.hab__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hab__val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  line-height: 1;
}
.hab__dots { display: flex; gap: 3px; margin-top: 2px; }
.hab__dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--stone);
}
.hab__dots span.on { background: var(--brick); }

/* Drive list */
.drive-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.drive-row {
  display: flex; justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dotted var(--stone-dark);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.drive-row .label { color: var(--ink); }
.drive-row .mins {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
}
.drive-row .u {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  margin-left: 2px;
}

/* Slope strip */
.slope-strip {
  display: flex;
  height: 10px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--stone);
}
.slope-strip .flat  { background: var(--green); }
.slope-strip .roll  { background: var(--yellow); }
.slope-strip .steep { background: var(--orange); }

.topo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--stone);
  border-radius: 4px;
  overflow: hidden;
  background: var(--card);
}
.topo .t {
  padding: 8px 10px;
  border-right: 1px solid var(--stone);
}
.topo .t:last-child { border-right: 0; }
.topo .t .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.topo .t .v {
  margin-top: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

/* Data note */
.data-note {
  padding: 10px 12px;
  background: var(--card-2);
  border-left: 3px solid var(--stone-dark);
  border-radius: 0 4px 4px 0;
  font-size: 11.5px;
  color: var(--ink-mute);
  line-height: 1.5;
}

/* Actions */
.pc__actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 264px 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--stone); }
  .topbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .topbar__right { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
  .results { grid-template-columns: 1fr; padding: 18px; }
  .habitat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-list, .drive-list { grid-template-columns: 1fr; }
  .edp__fields { grid-template-columns: 1fr; }
}

/* ============================================================
   HERO PHOTO COUNT — small "📷 N" indicator on list cards
   ============================================================ */
.pc__photo-count {
  position: absolute;
  top: 12px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 3px;
  background: rgba(28, 26, 20, 0.6);
  color: #fbf6e7;
  border: 1px solid rgba(216, 207, 182, 0.35);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

/* ============================================================
   AI SYNOPSIS — 3-line preview on list cards
   ============================================================ */
.pc__synopsis {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   SEPTIC / PERC chip
   ============================================================ */
.chip--septic {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green);
  font-weight: 600;
}

/* ============================================================
   PHOTO GALLERY — detail view (main photo + thumbs + lightbox)
   ============================================================ */
.gallery { display: flex; flex-direction: column; gap: 8px; }
.gallery__main {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--paper-2);
  border: 1px solid var(--stone);
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(216, 207, 182, 0.5);
  background: rgba(28, 26, 20, 0.6);
  color: #fbf6e7;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 2px;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background .12s ease, transform .12s ease;
}
.gallery__arrow--prev { left: 10px; }
.gallery__arrow--next { right: 10px; }
.gallery__arrow:hover {
  background: rgba(28, 26, 20, 0.88);
  transform: translateY(-50%) scale(1.06);
}
.gallery__count {
  position: absolute;
  bottom: 10px; left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 3px;
  background: rgba(28, 26, 20, 0.6);
  color: #fbf6e7;
  border: 1px solid rgba(216, 207, 182, 0.3);
}
.gallery__expand {
  position: absolute;
  bottom: 10px; right: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  background: rgba(28, 26, 20, 0.6);
  color: #fbf6e7;
  border: 1px solid rgba(216, 207, 182, 0.3);
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.gallery__main:hover .gallery__expand { opacity: 1; }
.gallery__thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.gallery__thumb {
  flex: 0 0 auto;
  width: 72px; height: 54px;
  padding: 0;
  background: var(--paper-2);
  border: 1.5px solid var(--stone);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .12s ease;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__thumb:hover { border-color: var(--stone-dark); }
.gallery__thumb.is-active {
  border-color: var(--brick);
  box-shadow: 0 0 0 1px var(--brick);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(18, 16, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 6vw;
  cursor: zoom-out;
  animation: lbFade .15s ease;
}
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
.lightbox__img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox__close {
  position: absolute;
  top: 18px; right: 22px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(216, 207, 182, 0.35);
  background: rgba(28, 26, 20, 0.6);
  color: #fbf6e7;
  font-size: 16px;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(28, 26, 20, 0.9); }
.lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(216, 207, 182, 0.35);
  background: rgba(28, 26, 20, 0.55);
  color: #fbf6e7;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 3px;
  cursor: pointer;
}
.lightbox__arrow--prev { left: 22px; }
.lightbox__arrow--next { right: 22px; }
.lightbox__arrow:hover { background: rgba(28, 26, 20, 0.9); }
.lightbox__count {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(251, 246, 231, 0.85);
  padding: 4px 12px;
  border-radius: 3px;
  background: rgba(28, 26, 20, 0.5);
}

/* ============================================================
   EDIT DETAILS PANEL — admin manual-entry form
   ============================================================ */
.edp {
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--brick);
  border-radius: 6px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(156, 71, 39, 0.08);
}
.edp__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stone);
}
.edp__title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.edp__close {
  background: transparent;
  border: 0;
  font-size: 14px;
  color: var(--ink-mute);
  padding: 4px 6px;
  cursor: pointer;
  line-height: 1;
}
.edp__close:hover { color: var(--ink); }
.edp__sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.edp__sub code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

.edp__banner {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid;
}
.edp__banner code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.04);
  padding: 1px 5px;
  border-radius: 3px;
}
.edp__banner--warn {
  background: var(--yellow-soft);
  border-color: var(--yellow);
  color: oklch(35% 0.07 80);
}
.edp__banner--ok {
  background: var(--green-soft);
  border-color: var(--green);
  color: oklch(30% 0.07 130);
}
.edp__banner--err {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.edp__groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.edp__group {
  margin: 0;
  padding: 12px 12px 10px;
  border: 1px solid var(--stone);
  background: var(--card-2);
  border-radius: 4px;
}
.edp__group legend {
  padding: 0 6px;
  margin-left: -2px;
}
.edp__fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
  margin-top: 6px;
}

.edp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink);
}
.edp-row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  grid-column: 1 / -1;
}
.edp-row__label {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.edp-row__val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.edp-row--bool { cursor: pointer; }

.edp-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.edp-input {
  padding: 6px 8px;
  border: 1px solid var(--stone-dark);
  background: var(--card);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  outline: 0;
  width: 110px;
}
.edp-input:focus { border-color: var(--brick); }
.edp-input--select { width: 150px; padding-right: 24px; cursor: pointer; }
.edp-input--textarea {
  width: 100%;
  resize: vertical;
  font-family: var(--font-body);
  min-height: 56px;
}
.edp-unit {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  pointer-events: none;
}
.edp-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--stone);
  border-radius: 2px;
  outline: 0;
}
.edp-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--brick);
  border-radius: 50%;
  border: 2px solid var(--card);
  cursor: pointer;
}
.edp-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--brick);
  border-radius: 50%;
  border: 2px solid var(--card);
  cursor: pointer;
}

.edp-bool {
  width: 30px; height: 17px;
  background: var(--stone-dark);
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s ease;
}
.edp-bool__dot {
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  background: var(--card);
  border-radius: 50%;
  transition: transform .15s ease;
}
.edp-bool.is-on { background: var(--brick); }
.edp-bool.is-on .edp-bool__dot { transform: translateX(13px); }

.edp-hint {
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.edp__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--stone);
}
.edp__diff {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
