/* CoreLogic 360 defaults. brands.js overrides these per client. */
:root {
  --bg: #060E1D; --surface: #0C1729; --surface-2: #132036; --line: #1E2D47;
  --accent: #00C8F5; --text: #E8EDF5; --muted: #8E9DB3;
  --good: #4ADE80; --bad: #FF7A8A; --warn: #F5B740;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, figure { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.bar {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  max-width: 1280px; margin: 0 auto; padding: 20px 24px 16px;
}
.who { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.who img { display: block; height: 40px; width: auto; }
.bar h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.freshness { color: var(--muted); font-size: 13px; }
.live { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.live:empty { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
select, button, input[type="date"] {
  min-height: 44px; padding: 0 14px; font: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  transition: border-color 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
select:hover, button:hover { border-color: var(--muted); }
button { cursor: pointer; }
button:disabled { opacity: 0.6; cursor: progress; }

main { max-width: 1280px; margin: 0 auto; padding: 0 24px 56px; }

/* Numbers */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 32px; }
.metric { padding: 14px 0 16px; border-top: 1px solid var(--line); min-width: 0; }
.metric h3 { font-size: 13px; font-weight: 500; color: var(--muted); }
.num { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0 2px; }
.metric.big .num { font-size: 36px; }
.delta { font-size: 13px; font-weight: 500; display: block; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat, .delta.na { color: var(--muted); }
.of { color: var(--muted); font-weight: 400; }
.note { color: var(--muted); font-size: 13px; display: block; }
.stale { color: var(--warn); font-size: 13px; display: block; margin-top: 4px; }

/* Summary: the answer before the detail */
.summary {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 24px 20px; margin-bottom: 40px;
  border-top: 3px solid var(--accent);
}
.summary .metric { border-top: 0; }
.chart { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.chart svg { display: block; }
.line-now { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; }
.line-ago { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--text); }
.key.ago { border-top: 2px dashed var(--muted); margin-left: 12px; }
.compare-note { margin-top: 12px; }

/* Channel sections: detail on the way down */
.group { margin-top: 40px; }
.group h2 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; margin-top: 16px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 10px; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
th { color: var(--muted); font-weight: 500; font-size: 13px; text-align: left; padding: 4px 0; border-bottom: 1px solid var(--line); }
td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { overflow-wrap: anywhere; padding-right: 16px; }
td:last-child, th:last-child { text-align: right; white-space: nowrap; }

/* Custom date range */
.custom { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: flex-end; }
.custom[hidden] { display: none; }
.custom label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
input[type="date"] { color-scheme: dark; }
.custom-error { color: var(--bad); font-size: 13px; flex-basis: 100%; text-align: right; }
.custom-error:empty { display: none; }

/* Breakdown tables */
.table-wrap.wide { grid-column: 1 / -1; overflow-x: auto; }
.wide td:not(:first-child), .wide th:not(:first-child) { text-align: right; white-space: nowrap; padding-left: 20px; }
.wide td:first-child { min-width: 180px; }
.cell-delta { display: block; font-size: 12px; font-weight: 500; }
.cell-delta.good { color: var(--good); }
.cell-delta.bad { color: var(--bad); }
.cell-delta.flat { color: var(--muted); }

/* Platform tabs */
.tabs { position: relative;
  display: flex; gap: 4px; max-width: 1280px; margin: 0 auto 28px; padding: 0 24px;
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  flex: none; padding: 12px 14px; color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Number tiles that pick the chart metric */
.tiles { display: grid; grid-template-columns: repeat(min(var(--n), 4), minmax(0, 1fr)); gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  min-height: 0; padding: 12px 14px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
}
.tile:hover { background: var(--surface); }
.tile.on { background: var(--surface); border-color: var(--muted); }
.t-label { font-size: 13px; color: var(--muted); }
.tile .num { font-size: 24px; margin: 0; }

.trend { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; }
.trend figcaption { color: var(--muted); margin: 0 0 12px; }
.trend figcaption strong { color: var(--text); font-weight: 600; margin-right: 8px; }
.plot-wrap { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--muted); text-align: right; height: 200px; margin: -6px 0; }
.plot { position: relative; height: 200px; cursor: crosshair; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.x-axis { grid-column: 2; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); pointer-events: none; }
.tip {
  position: absolute; top: 8px; transform: translateX(10px); pointer-events: none; white-space: nowrap;
  display: flex; flex-direction: column; gap: 2px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
.tip[hidden], .guide[hidden] { display: none; }
.tip.flip { transform: translateX(calc(-100% - 10px)); }
.tip .muted { color: var(--muted); }
.banner { margin-bottom: 16px; }
.empty { color: var(--muted); padding: 24px 0; }

.sort { all: unset; cursor: pointer; font: inherit; }
.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more { margin-top: 8px; font-size: 13px; }
caption .note { display: inline; font-weight: 400; margin-left: 6px; }

@media (max-width: 600px) {
  .tabs { padding: 0 16px; margin-bottom: 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar { padding: 16px 16px 12px; }
  main { padding: 0 16px 40px; }
  .summary { padding: 4px 16px 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .metric.big .num { font-size: 28px; }
  .controls, .controls select { flex: 1 1 auto; }
}
