/* Trends tab: free market charts. Chart colours are roles (dataviz reference palette, validated light and dark). */
#trends { flex: 1; min-width: 0; overflow: auto; padding: 18px 28px 64px; }
.tv { --surface: var(--card); --grid: #e1e0d9; --axis: #c3c2b7; --tick: #898781;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --avg: #0b0b0b;
  --seq: #cde2fb, #9ec5f4, #5598e7, #256abf, #104281; }
:root[data-theme="dark"] .tv { --grid: #2c2c2a; --axis: #383835; --tick: #898781;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --avg: #f0efec; }
.tv .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.tv .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.tv .seg button { border: 0; background: none; border-radius: var(--r-pill); padding: 5px 12px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--ink); }
.tv .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.ziplabel { font: 600 10px/14px var(--font-body); color: #0b0b0b; text-align: center; }
.ziplabel.on-dark { color: #ffffff; }  /* label inside a fill: white or near-black by the fill's lightness */
.tv .kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.tv .kpi { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; background: var(--card); }
.tv .kpi .l { color: var(--muted); font-size: var(--fs-sm); }
.tv .kpi .v { font-size: var(--fs-xl); font-weight: 700; margin-top: 2px; letter-spacing: -0.01em; }
.tv .kpi .d { font-size: var(--fs-xs); color: var(--ink-2); margin-top: 2px; font-weight: 600; }
.tv .kpi .d small { color: var(--muted); font-weight: 400; }
.tv .grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.tv .card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); padding: 16px 16px 12px; margin-bottom: 18px; min-width: 0; }
.tv .card h2 { margin: 0; font-size: var(--fs-lg); }
.tv .card .sub { color: var(--muted); font-size: var(--fs-sm); margin: 2px 0 6px; }
.tv .card .note { color: var(--muted); font-size: var(--fs-xs); margin: -6px 0 10px; }
.tv .card .means { color: var(--ink-2); font-size: var(--fs-sm); margin: 0 0 12px; max-width: 70ch; }
.tv .legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: var(--ink-2); margin: 0 0 6px; }
.tv .legend span { display: inline-flex; align-items: center; gap: 6px; }
.tv .legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.tv .legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.tv .chart { position: relative; width: 100%; }
.tv .chart svg { display: block; width: 100%; overflow: visible; }
.tv .panel + .panel { margin-top: 4px; }
.tv .panel .pl { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin: 6px 0 0; }
.tv .src { color: var(--muted); font-size: var(--fs-xs); margin-top: 8px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tv details { margin-top: 6px; font-size: var(--fs-sm); }
.tv details summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: var(--fs-xs); }
.tv details .tw { max-height: 260px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); }
.tv details table td, .tv details table th { height: 32px; font-variant-numeric: tabular-nums; }
.tv .tip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: var(--fs-xs); min-width: 140px; }
.tv .tip .h { color: var(--muted); margin-bottom: 4px; }
.tv .tip .r { display: flex; align-items: center; gap: 8px; }
.tv .tip .r b { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.tv .tip .r i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tv .tip .r span { color: var(--ink-2); }
#trendsMap { height: 380px; border-radius: var(--r); overflow: hidden; background: var(--map-bg); }
.tv .scale { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-2); margin-top: 8px; }
.tv .scale i { width: 26px; height: 10px; display: inline-block; }
.tv .zipt td, .tv .zipt th { height: 36px; }
.tv table th { position: static; }  /* the page scrolls, not the table: no floating headers */
.tv .zipt tr.on td { background: var(--accent-soft); }
.tv .bar { display: inline-block; height: 6px; border-radius: 0 3px 3px 0; background: var(--s1); vertical-align: middle; margin-right: 6px; }
.tv .empty { padding: 30px; }
.tv.reloading .card, .tv.reloading .kpis { opacity: .55; transition: opacity .2s; }
@media (max-width: 1180px) { .tv .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tv .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  #trends { padding: 12px 12px 32px; }
  .tv .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tv .kpi { padding: 12px; }
  .tv .card { padding: 14px 12px 10px; border-radius: var(--r); }
  #trendsMap { height: 300px; }
}

/* ---------- Trends v2 (mockup approved Nov 4): forest for foreclosure and new, the estate blue for probate, slate for
   resolved, amber only for the week still counting. Counties keep the five categorical hues. ---------- */
.tv { --c-fore: var(--forest); --c-prob: var(--sig-estate); }
.tv .head { display: flex; align-items: flex-start; gap: 20px; margin: 6px 0 4px; }
.tv .head .grow { flex: 1; min-width: 0; }
.tv .eyebrow { font: 500 11px/1.4 var(--font-num); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tv h1 { font-weight: 300; font-size: 38px; letter-spacing: -0.035em; line-height: 1.14; margin: 10px 0 6px; max-width: 780px; }
.tv .lede { color: var(--ink-2); margin: 0; font-size: var(--fs-sm); }
.tv > .seg button { white-space: nowrap; }
.tv > .seg { margin: 20px 0 18px; background: var(--card); border-color: var(--line); max-width: 100%; overflow-x: auto; }
.tv .kpi .v { font-weight: 300; font-size: 34px; letter-spacing: -0.04em; line-height: 1.15; margin-top: 6px; font-feature-settings: "tnum" 1; }
.tv .kpi .d { font-weight: 400; margin-top: 6px; }
.tv .up { color: var(--hot); font-weight: 600; } .tv .down { color: var(--ok); font-weight: 600; }
.tv .card { border-radius: var(--r-xl); padding: 20px 22px 14px; }
.tv .card h2 { font-weight: 500; letter-spacing: -0.015em; }
.tv .legend { margin: 12px 0 6px; }
.tv .legend i.dash { width: 10px; height: 10px; background: none !important; border: 1.5px dashed var(--muted); }
.tv .legend i.dash.amber { border-color: var(--amber); }
.tv .src { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.tv .src .go { color: var(--link); font-weight: 500; text-decoration: none; }
.tv .src .go:hover { text-decoration: underline; }
.tv .tip .n { color: var(--ink-2); margin-top: 6px; max-width: 220px; }
.tv .tip .cta { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 500; color: var(--link); }
.tv table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tv .card > div > table th, .tv .zipt th { text-align: left; font: 500 11px var(--font-num); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); }
.tv .card > div > table td, .tv .zipt td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-feature-settings: "tnum" 1; }
.tv table th.num, .tv table td.num { text-align: right; }
.tv .zipt .barcol { width: 32%; }
.tv tr.total td { font-weight: 600; }
.tv tr.click { cursor: pointer; }
.tv tr.click:hover td, .tv tr.click:focus-visible td { background: var(--bg); }
.tv tr.click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tv td.arrow { color: var(--muted); text-align: right; width: 24px; }
.tv td.rank { color: var(--muted); width: 28px; }
.tv .zipt .bar { height: 8px; border-radius: 4px; background: var(--c-fore); margin: 0; }
.tv .pillr { display: inline-block; font-size: var(--fs-xs); padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.tv .stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; min-width: 110px; }
.tv .stack span { display: block; height: 100%; }
.tv .share { position: relative; flex: none; }
.tv .share .btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; }
.tv .share .pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; }
.tv .share .pop .row { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font: inherit; font-size: var(--fs-sm); color: var(--ink); text-decoration: none; cursor: pointer; }
.tv .share .pop .row:hover, .tv .share .pop .row:focus-visible { background: var(--bg); }
.tv[aria-busy] .kpi, .tv[aria-busy] .card { min-height: 0; }
@media (max-width: 820px) { .tv h1 { font-size: 28px; } .tv .head { flex-direction: column; gap: 12px; } .tv .hide-sm { display: none; } }
.tv .share .pop form.sub { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.tv .share .pop form.sub .l, .tv .share .pop form.sub .msg { grid-column: 1 / -1; font-size: var(--fs-sm); }
.tv .share .pop form.sub .msg { color: var(--ink-2); font-size: var(--fs-xs); }
.tv .share .pop form.sub .msg:empty { display: none; }
.tv .share .pop input { min-width: 0; height: 36px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: var(--fs-sm); }
.tv .share .pop form.sub .btn { height: 36px; }
.tv td.spark { white-space: nowrap; vertical-align: bottom; }
.tv td.spark i { display: inline-block; width: 6px; margin-right: 2px; background: var(--c-fore); border-radius: 2px 2px 0 0; vertical-align: bottom; }
.tv td.spark i.gap { height: 2px; background: var(--line-strong); }
