/* 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(--primary); color: var(--primary-ink); }
.tv .samplebar { background: var(--warn-soft); color: var(--warn); border: 1px solid currentColor; border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: var(--fs-sm); }
.tv .samplebar b { font-size: var(--fs-lg); margin-right: 4px; }
.tv .card.is-sample { background-image: repeating-linear-gradient(135deg, transparent 0 18px, color-mix(in srgb, var(--warn) 5%, transparent) 18px 19px); }
.tv .card.is-sample .src span:first-child { color: var(--warn); font-weight: 600; }
.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; }
}
