/* 房市 — 配色跟隨全站 html[data-theme]；各市場頁可覆寫 --h-accent */
.main--housing {
  --h-ink: var(--ink);
  --h-ink-soft: var(--ink-soft);
  --h-mute: var(--ink-faint);
  --h-paper: var(--bg);
  --h-wash: var(--surface-hover);
  --h-line: var(--line);
  --h-surface: var(--surface);
  --h-accent: var(--accent);
  --h-volume: var(--h-accent);
  --h-volume-2: color-mix(in srgb, var(--h-volume) 72%, var(--h-ink));
  --h-price: var(--us);
  --h-warn: var(--accent);
  --h-down: #b54a42;
  --h-on-accent: var(--bg);
  max-width: none;
  padding: 0 0 72px;
  background: var(--h-paper);
  color: var(--h-ink);
}

.h-wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.h-hero {
  position: relative;
  min-height: min(92vh, 760px);
  padding: 36px 0 28px;
  overflow: hidden;
  background:
    radial-gradient(
      900px 420px at 88% 8%,
      color-mix(in srgb, var(--h-volume) 16%, transparent),
      transparent 58%
    ),
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 11px,
      color-mix(in srgb, var(--h-ink) 3%, transparent) 11px,
      color-mix(in srgb, var(--h-ink) 3%, transparent) 12px
    ),
    var(--h-paper);
}

.h-hero-brand {
  font-family: var(--display);
  font-size: clamp(56px, 12vw, 128px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.88;
  margin: 0;
  color: var(--h-ink);
}

.h-hero-kicker {
  margin: 18px 0 0;
  max-width: 28em;
  font-size: 16px;
  line-height: 1.55;
  color: var(--h-ink);
}

.h-hero-lead {
  margin: 8px 0 0;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.6;
  color: var(--h-ink-soft);
}

.h-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px 16px;
  border: 1px solid var(--h-volume);
  background: var(--h-volume);
  color: var(--h-on-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.h-hero-cta:hover {
  background: color-mix(in srgb, var(--h-volume) 82%, var(--h-ink));
  border-color: color-mix(in srgb, var(--h-volume) 82%, var(--h-ink));
}

.h-volume-plane {
  margin-top: 36px;
  min-height: 280px;
}

.h-volume-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 20px 28px;
  align-items: stretch;
}

.h-chart-legend {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 12px 14px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-chart-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.h-chart-filter-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--h-mute);
  font-weight: 600;
}

.h-chart-filter select {
  width: 100%;
  border: 1px solid var(--h-line);
  background: var(--h-paper);
  color: var(--h-ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

.h-chart-filter select:focus-visible {
  outline: 2px solid var(--h-accent, var(--h-volume));
  outline-offset: 1px;
}

.h-legend-row.is-active {
  background: var(--h-wash);
  outline: 1px solid var(--h-accent, var(--h-volume));
  outline-offset: -1px;
}

.h-legend-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--h-mute);
}

.h-legend-head strong {
  color: var(--h-ink);
  font-size: 13px;
}

.h-legend-unit-tag {
  font-size: 11px;
  color: var(--h-volume);
  font-weight: 600;
}

.h-legend-sub {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--h-mute);
}

.h-legend-sub strong {
  color: var(--h-ink);
  font-weight: 700;
}

.h-legend-cols {
  display: grid;
  grid-template-columns: 10px 1.2em 1fr auto auto;
  gap: 8px;
  padding: 0 6px 4px;
  font-size: 10px;
  color: var(--h-mute);
  letter-spacing: 0.04em;
}

.h-legend-cols span:nth-child(4),
.h-legend-cols span:nth-child(5) {
  text-align: right;
}

.h-legend-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.h-legend-row {
  display: grid;
  grid-template-columns: 10px 1.2em 1fr auto auto;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 5px 6px;
  border: 0;
  background: transparent;
  color: var(--h-ink);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
}

.h-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  align-self: center;
}

.h-legend-row:hover,
.h-legend-row.is-active {
  background: var(--h-wash);
}

.h-legend-row--other {
  cursor: default;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--h-line);
  color: var(--h-ink-soft);
}

.h-legend-rank {
  color: var(--h-mute);
}

.h-legend-name {
  font-weight: 600;
}

.h-legend-vol {
  font-weight: 700;
  color: var(--h-volume);
  text-align: right;
}

.h-legend-unit {
  margin-left: 1px;
  font-size: 10px;
  font-weight: 600;
  color: var(--h-mute);
}

.h-legend-pct {
  color: var(--h-mute);
  min-width: 3.2em;
  text-align: right;
}

.h-volume-plane-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--h-mute);
}

.h-volume-plane-meta strong {
  color: var(--h-volume);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
}

.h-lag-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--h-ink-soft);
  background: color-mix(in srgb, var(--h-accent, var(--h-volume)) 8%, var(--h-surface));
  border: 1px solid color-mix(in srgb, var(--h-accent, var(--h-volume)) 22%, var(--h-line));
}

.h-bars-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  --h-visible-bars: 20;
  padding-bottom: 4px;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
}

.h-bars-scroll:focus-visible {
  outline: 2px solid var(--h-volume);
  outline-offset: 2px;
}

.h-bars {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 280px;
  padding-top: 4px;
  min-width: 100%;
  width: calc(var(--h-bar-count, 60) / var(--h-visible-bars, 20) * 100%);
}

.h-bar {
  flex: 1 1 0;
  scroll-snap-align: end;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  cursor: default;
}

.h-bar-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: calc(100% - 28px);
  gap: 4px;
  width: 100%;
}

.h-bar-value {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--h-ink);
  line-height: 1;
  white-space: nowrap;
}

.h-bars-scroll--compact .h-bar {
  min-width: 40px;
  flex: 1 1 40px;
}

.h-bars-scroll--compact .h-bar-value {
  font-size: 9px;
  letter-spacing: -0.03em;
}

.h-bars-scroll--compact .h-bar-label {
  font-size: 10px;
  letter-spacing: -0.02em;
}

.h-bars-scroll--compact .h-bars {
  gap: 10px;
}

.h-bar-fill-stack {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  height: var(--h, 4%);
  min-height: 4px;
  overflow: hidden;
  transform-origin: bottom;
  animation: h-bar-in 700ms ease both;
  animation-delay: var(--d, 0ms);
}

.h-seg {
  flex-basis: 0;
  min-height: 0;
  width: 100%;
}

.h-seg--empty {
  background: var(--h-wash);
  flex: 1 1 auto;
}

.h-bar.is-partial .h-bar-fill-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 4px,
    color-mix(in srgb, var(--h-surface) 45%, transparent) 4px,
    color-mix(in srgb, var(--h-surface) 45%, transparent) 8px
  );
}

.h-bar.is-active .h-bar-fill-stack {
  outline: 2px solid var(--h-ink);
  outline-offset: 1px;
}

.h-bar-label {
  margin-top: 8px;
  font-size: 11px;
  color: var(--h-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

.h-chart-tip {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 6px 10px;
  background: var(--h-surface);
  color: var(--h-ink);
  border: 1px solid var(--h-line);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.h-hot {
  white-space: normal;
  min-width: 11em;
  max-width: 18em;
  font-size: 12px;
  line-height: 1.35;
  color: var(--h-ink-soft);
}

@keyframes h-bar-in {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.h-section {
  padding: 56px 0 8px;
}

.h-section h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.h-section-lead {
  margin: 0 0 22px;
  max-width: 46em;
  font-size: 14px;
  line-height: 1.65;
  color: var(--h-ink-soft);
}

.h-table-wrap {
  overflow-x: auto;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.h-table th,
.h-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--h-line);
  white-space: nowrap;
}

.h-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--h-mute);
  letter-spacing: 0.04em;
}

.h-table tbody tr {
  cursor: pointer;
}

.h-table tbody tr:hover,
.h-table tbody tr.is-active {
  background: var(--h-wash);
}

.h-table .num {
  text-align: right;
}

.h-up { color: var(--h-volume); }
.h-down { color: var(--h-down); }

.h-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  width: 88px;
}

.h-spark i {
  flex: 1;
  background: var(--h-volume);
  min-height: 2px;
  opacity: 0.85;
}

.h-heat {
  display: inline-block;
  height: 8px;
  background: var(--h-volume);
  vertical-align: middle;
}

.h-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 16px;
}

.h-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--h-mute);
  letter-spacing: 0.04em;
  min-width: 0;
}

.h-filters input,
.h-filters select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  color: var(--h-ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  border-radius: 0;
  min-height: 40px;
}

.h-filter-road {
  grid-column: span 2;
}

.h-filter-road input {
  width: 100%;
}

.h-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  margin: 0 0 14px;
}

.h-filter-actions-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.h-broker-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1 1 12rem;
  min-width: 0;
}

.h-filter-actions a,
.h-filter-actions button,
.h-broker-link {
  border: 1px solid var(--h-ink);
  background: transparent;
  color: var(--h-ink);
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.h-broker-link {
  padding: 6px 10px;
  font-size: 11px;
  border-color: var(--h-line);
  color: var(--h-ink-soft);
}

.h-filter-actions a:hover,
.h-filter-actions button:hover,
.h-broker-link:hover {
  background: var(--h-ink);
  color: var(--h-surface);
  border-color: var(--h-ink);
}

.h-count {
  font-size: 12px;
  color: var(--h-ink-soft);
  line-height: 1.4;
}

.h-source {
  margin-top: 28px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--h-mute);
}

.h-source--footer {
  margin-top: 32px;
  margin-bottom: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--h-line);
}

.h-source--footer strong {
  display: inline;
  margin-right: 0.35em;
  color: var(--h-ink-soft);
  font-weight: 600;
}

.h-source a {
  color: var(--h-volume);
}

.h-empty {
  padding: 24px;
  color: var(--h-ink-soft);
}

/* ── District volume chart ── */
.h-bar--out-window .h-bar-fill-stack .h-seg {
  opacity: 0.22;
}

.h-bar--out-window .h-bar-value {
  color: var(--h-mute);
}

.h-bar--in-window .h-bar-fill-stack .h-seg {
  opacity: 1;
}

.h-bar--in-window .h-bar-value {
  color: var(--h-ink);
}

.h-section--districts {
  padding-top: 28px;
}

.h-market-lead {
  margin: -6px 0 0;
  max-width: 40em;
  font-size: 13px;
  line-height: 1.55;
  color: var(--h-mute);
}

.h-fresh-badge {
  display: inline-block;
  margin-left: 0.35em;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--h-accent, var(--h-volume)) 28%, var(--h-line));
  border-radius: 3px;
  background: color-mix(in srgb, var(--h-accent, var(--h-volume)) 8%, transparent);
  color: color-mix(in srgb, var(--h-accent, var(--h-volume)) 55%, var(--h-mute));
  font-family: var(--sans, inherit);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.4;
  vertical-align: middle;
  white-space: normal;
  max-width: min(100%, 18em);
}

.h-page-title .h-fresh-badge {
  font-size: 11px;
  font-weight: 500;
  transform: translateY(-0.15em);
}

.h-fresh-badge--row {
  margin-left: 4px;
  padding: 0 4px;
  font-size: 9px;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.h-proj-embed-lead .h-fresh-badge {
  margin-left: 0.25em;
}

.h-tabs-sticky {
  position: sticky;
  top: 57px;
  z-index: 40;
  margin: 18px 0 0;
  padding: 0 0 0;
  background: color-mix(in srgb, var(--h-paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--h-line);
}

.h-tabs {
  display: flex;
  gap: 0;
  align-items: stretch;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.h-tabs::-webkit-scrollbar {
  display: none;
}

.h-tab {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 16px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--h-mute);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.h-tab:hover {
  color: var(--h-ink);
}

.h-tab:focus-visible {
  outline: 2px solid var(--h-accent, var(--h-volume));
  outline-offset: -2px;
}

.h-tab.is-active {
  color: var(--h-ink);
  border-bottom-color: var(--h-accent, var(--h-volume));
  font-weight: 600;
}

.h-tab-label--short {
  display: none;
}

.h-tab-panel {
  padding: 18px 0 8px;
}

.h-tab-panel[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .h-tabs-sticky {
    top: 52px;
  }

  .h-tab {
    padding: 12px 12px 10px;
    font-size: 13px;
  }

  .h-tab-label--full {
    display: none;
  }

  .h-tab-label--short {
    display: inline;
  }
}

.h-page-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: var(--h-accent, var(--h-volume));
}

.h-market .h-page-title {
  margin-bottom: 8px;
}

.h-district-unified {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.h-district-trend {
  padding: 12px 14px 10px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-district-trend .h-volume-plane-meta {
  margin-bottom: 6px;
}

.h-volume-chart--wide {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.h-volume-chart--wide .h-bars-scroll {
  min-height: 220px;
  overflow-y: visible;
}

.h-district-meta {
  display: none;
}

.h-district-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin-bottom: 12px;
}

.h-district-days-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--h-mute);
  letter-spacing: 0.04em;
}

.h-district-days-label select {
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  color: var(--h-ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  min-width: 9em;
}

.h-district-reset {
  align-self: flex-end;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  color: var(--h-ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.h-district-reset:hover {
  border-color: var(--h-accent, var(--h-volume));
  color: var(--h-ink);
}

.h-district-reset.is-active {
  background: var(--h-accent, var(--h-volume));
  border-color: var(--h-accent, var(--h-volume));
  color: var(--h-on-accent, #fff);
}

.h-district-detail-back {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--h-accent, var(--h-volume));
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.h-district-detail-back:hover {
  color: var(--h-ink);
}

.h-district-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 12px;
  align-items: stretch;
}

.h-district-chart {
  display: grid;
  grid-template-columns: repeat(var(--h-dist-cols, 6), minmax(0, 1fr));
  grid-template-rows: repeat(var(--h-dist-rows, 5), minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  height: clamp(280px, 34vw, 360px);
  padding: 10px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-dist-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: 6px 7px 5px;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  color: var(--h-ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.h-dist-tile:hover,
.h-dist-tile.is-active {
  border-color: var(--c, var(--h-volume));
  box-shadow: inset 0 0 0 1px var(--c, var(--h-volume));
}

.h-dist-tile.is-active .h-dist-tile-fill {
  opacity: 0.34;
}

.h-dist-tile-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--heat, 0.2) * 100%);
  background: var(--c, var(--h-volume));
  opacity: 0.2;
  pointer-events: none;
  transition: height 240ms ease, opacity 120ms ease;
}

.h-dist-tile-rank,
.h-dist-tile-name,
.h-dist-tile-val {
  position: relative;
  z-index: 1;
}

.h-dist-tile-rank {
  font-size: 9px;
  line-height: 1;
  color: var(--h-mute);
}

.h-dist-tile-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-dist-tile-val {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--h-accent, var(--h-volume));
}

.h-dist-tile-unit {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--h-ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-district-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  height: clamp(280px, 34vw, 360px);
  padding: 14px 16px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
  overflow: auto;
}

.h-district-detail-hint {
  margin: 0;
  font-size: 13px;
  color: var(--h-mute);
}

.h-district-detail-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
}

.h-district-detail-sub {
  margin: 0;
  font-size: 12px;
  color: var(--h-mute);
}

.h-district-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 12px 0 0;
}

.h-district-detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.h-district-detail-grid dt {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--h-mute);
}

.h-district-detail-grid dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.h-district-detail-hot {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--h-ink-soft);
}

/* ── Deals infinite scroll ── */
.h-deals-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h-deals-scroll {
  max-height: min(520px, 62vh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
}

.h-deals-scroll:focus-visible {
  outline: 2px solid var(--h-accent, var(--h-volume));
  outline-offset: 2px;
}

.h-table--deals thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--h-surface);
  box-shadow: 0 1px 0 var(--h-line);
}

.h-table--deals tbody tr:not(.h-deals-sentinel) {
  cursor: default;
}

.h-deals-row--has-note td {
  border-bottom: 0;
  padding-bottom: 4px;
}

.h-deals-note-row td {
  padding: 2px 10px 12px;
  border-bottom: 1px solid var(--h-line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--h-ink-soft);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.h-deals-note-label {
  font-weight: 600;
  color: var(--h-mute);
  margin-right: 4px;
}

.h-deals-sentinel td {
  height: 1px;
  padding: 0;
  border: 0;
}

.h-deals-hint {
  margin: 0;
  font-size: 12px;
  color: var(--h-mute);
  text-align: center;
}

.h-hero-cta {
  margin-top: 8px;
}

.h-hero:not([data-housing-chart]) .h-hero-cta {
  margin-bottom: 8px;
}

.h-hero:not([data-housing-chart]) {
  min-height: auto;
  padding-bottom: 8px;
}

@media (max-width: 800px) {
  .h-wrap { width: calc(100% - 28px); }
  .h-hero { min-height: auto; padding-top: 24px; }
  .h-hero-brand { font-size: 56px; }
  .h-hero-brand--market { font-size: clamp(40px, 14vw, 72px); }
  .h-volume-chart { grid-template-columns: 1fr; }
  .h-chart-legend { min-height: 0; }
  .h-bars { height: 200px; gap: 4px; }
  .h-bar-label { font-size: 10px; }
  .h-bar-value { font-size: 10px; }
  .h-bars-scroll--compact .h-bars {
    height: 220px;
    gap: 10px;
  }
  .h-filters {
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
  }
  .h-filter-road {
    grid-column: 1 / -1;
  }
  .h-filters input,
  .h-filters select {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* avoid iOS focus zoom */
  }
  .h-section-lead {
    font-size: 12px;
    line-height: 1.5;
  }
  .h-filter-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .h-filter-actions-main {
    width: 100%;
  }
  .h-filter-actions-main #h-reset {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .h-broker-links {
    flex: none;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 2px 2px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .h-broker-link {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .h-count {
    margin-left: 0;
  }
  .h-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-hub-grid { grid-template-columns: 1fr; }
  .h-market-nav { gap: 6px; }
  .h-market-pill { min-width: calc(50% - 6px); }
  .h-sub-nav { margin-top: 0; overflow-x: auto; flex-wrap: nowrap; }
  .h-district-panel {
    grid-template-columns: 1fr;
  }
  .h-district-chart {
    height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(72px, auto);
  }
  .h-district-detail {
    height: auto;
    min-height: 120px;
  }
  .h-deals-scroll {
    max-height: min(420px, 55vh);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .h-table--deals {
    min-width: 580px;
  }
  .h-table--deals th,
  .h-table--deals td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .h-proj-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px;
  }
  .h-proj-chip {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 12px;
  }
  .h-proj-filter-row {
    align-items: flex-start;
  }
  .h-proj-filter-label {
    padding-top: 8px;
  }
}

/* ── Hub landing ── */
.housing-page--hub .h-hero-brand {
  font-size: clamp(56px, 12vw, 112px);
}

.h-hub {
  padding: 40px 0 72px;
}

.h-hub-lead {
  max-width: 36em;
  margin-bottom: 32px;
}

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

.h-hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 20px 18px;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  text-decoration: none;
  color: var(--h-ink);
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 3px 0 0 var(--hub-accent, var(--h-volume));
}

.h-hub-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 3px 0 0 var(--hub-accent, var(--h-volume)),
    var(--shadow);
}

.h-hub-card-region {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--h-mute);
  text-transform: uppercase;
}

.h-hub-card-name {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--hub-accent, var(--h-volume));
}

.h-hub-card-tag {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--h-ink-soft);
  flex: 1;
}

.h-hub-card-stat {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--h-ink);
}

.h-hub-card-arrow {
  position: absolute;
  top: 18px;
  right: 16px;
  font-size: 18px;
  color: var(--hub-accent, var(--h-volume));
  opacity: 0.7;
}

.h-hub-more {
  margin: 28px 0 0;
  font-size: 13px;
}

.h-hub-more a {
  color: var(--h-ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--h-line);
}

.h-hub-more a:hover {
  color: var(--h-volume);
  border-color: var(--h-volume);
}

/* ── Market switcher ── */
.h-market-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.h-market-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 72px;
  padding: 8px 14px;
  border: 1px solid var(--h-line);
  background: var(--h-surface);
  text-decoration: none;
  color: var(--h-ink-soft);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.h-market-pill:hover {
  border-color: var(--pill-accent, var(--h-volume));
  color: var(--h-ink);
}

.h-market-pill.is-active {
  background: var(--pill-accent, var(--h-volume));
  border-color: var(--pill-accent, var(--h-volume));
  color: var(--h-on-accent);
}

.h-market-pill.is-active .h-market-pill-region {
  color: color-mix(in srgb, var(--h-on-accent) 72%, transparent);
}

.h-market-pill-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.h-market-pill-region {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--h-mute);
}

/* ── Sub tabs (e.g. 新北 → 全市 | 板橋) ── */
.h-sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: -8px 0 18px;
  border-bottom: 1px solid var(--h-line);
}

.h-sub-tab {
  position: relative;
  margin: 0;
  padding: 10px 16px 9px;
  border: 0;
  background: transparent;
  color: var(--h-ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 120ms ease;
}

.h-sub-tab:hover {
  color: var(--h-ink);
}

.h-sub-tab.is-active {
  color: var(--h-accent, var(--h-volume));
}

.h-sub-tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--h-accent, var(--h-volume));
}

.h-hero-region {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--h-mute);
}

.h-hero-brand--market {
  font-size: clamp(48px, 10vw, 96px);
  color: var(--h-accent, var(--h-volume));
}

/* ── KPI strip ── */
.h-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 4px;
  padding: 14px 16px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.h-kpi-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--h-mute);
}

.h-kpi-val {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--h-ink);
  line-height: 1.1;
}

.h-kpi-unit {
  margin-left: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--h-mute);
}

/* ── Street legend (single-district markets) ── */
.h-chart-legend--streets .h-street-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.h-street-row {
  display: grid;
  grid-template-columns: 1.5em 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.h-street-rank {
  color: var(--h-mute);
}

.h-street-name {
  font-weight: 600;
  color: var(--h-ink);
}

.h-street-vol {
  font-weight: 700;
  color: var(--h-accent, var(--h-volume));
}

.h-street-note {
  margin: 10px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--h-mute);
}

.h-street-row--empty {
  color: var(--h-mute);
  grid-template-columns: 1fr;
}

/* —— 新建案（併入新北各區） —— */
.h-proj-embed {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.h-proj-embed-head {
  margin-bottom: 14px;
}

.h-proj-embed-lead {
  margin: 0;
  max-width: 44em;
  font-size: 13px;
  line-height: 1.55;
  color: var(--h-ink-soft);
}

.h-proj-workspace {
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 640px);
  max-height: min(78vh, 760px);
  border: 1px solid var(--h-line);
  background: var(--h-paper);
  overflow: hidden;
}

.h-proj-filters {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  background: var(--h-surface);
  border: 0;
  border-bottom: 1px solid var(--h-line);
  z-index: 2;
}

.h-proj-filter-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.h-proj-filter-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--h-mute);
}

.h-proj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.h-proj-results {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.h-proj-count {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--h-ink-soft);
  background: var(--h-surface);
  border-bottom: 1px solid var(--h-line);
}

.h-proj-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 16px;
}

.h-proj-list-scroll:focus-visible {
  outline: 2px solid var(--h-accent, var(--h-volume));
  outline-offset: -2px;
}

.h-proj-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.h-proj-foot {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--h-mute);
}

.h-proj-chip {
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--h-line);
  background: var(--h-paper);
  color: var(--h-ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.h-proj-chip:hover {
  border-color: var(--h-accent);
  color: var(--h-ink);
}

.h-proj-chip.is-active {
  border-color: var(--h-accent);
  background: color-mix(in srgb, var(--h-accent) 14%, var(--h-paper));
  color: var(--h-ink);
  box-shadow: inset 0 0 0 1px var(--h-accent);
}

@media (max-width: 640px) {
  .h-proj-filter-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .h-proj-workspace {
    min-height: min(78vh, 680px);
    max-height: min(88vh, 820px);
  }

  .h-proj-filters {
    padding: 10px 12px;
    gap: 8px;
  }

  .h-proj-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 2px;
  }

  .h-proj-chip {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 12px;
  }
}

.h-proj-empty {
  margin: 0;
  padding: 28px 0;
  font-size: 13px;
  color: var(--h-mute);
  text-align: center;
}

.h-proj-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 14px 14px 12px;
  background: var(--h-surface);
  border: 1px solid var(--h-line);
}

.h-proj-row-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  padding-bottom: 10px;
}

.h-proj-idx {
  flex: 0 0 auto;
  margin-top: 2px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--h-accent) 55%, var(--h-mute));
  line-height: 1.3;
}

.h-proj-main {
  min-width: 0;
  flex: 1 1 auto;
}

.h-proj-badge {
  display: inline-block;
  margin: 0 0 4px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--h-accent);
  background: color-mix(in srgb, var(--h-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--h-accent) 28%, transparent);
}

.h-proj-name {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.h-proj-dev {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--h-ink-soft);
}

.h-proj-note {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--h-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.h-proj-meta {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--h-line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.h-proj-meta dt {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--h-mute);
}

.h-proj-meta dd {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--h-ink);
}

.h-proj-price {
  font-weight: 700;
  color: var(--h-accent);
}

.h-proj-layout-raw {
  margin-left: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--h-mute);
}

@media (max-width: 720px) {
  .h-proj-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .h-proj-row {
    animation: none;
  }
}
