.viz-root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface-1: #ffffff;
  --border: #e3e5df;
  --grid: #eceee9;
  --text-primary: #191919;
  --text-secondary: #666666;
  --accent: #1f4d3a;
  --series-1: #257de0;
  --series-2: #f47230;
  --row-hover: #f3f7f4;
}
@media (prefers-color-scheme: dark) {
  .viz-root {
    color-scheme: dark;
    --bg: #111312;
    --surface-1: #191919;
    --border: #2b2d2b;
    --grid: #262826;
    --text-primary: #efefef;
    --text-secondary: #9c9c9c;
    --accent: #7cc4a0;
    --series-1: #338ced;
    --series-2: #e76624;
    --row-hover: #222523;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text-primary); }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--text-secondary); font-weight: 600; }
.hint { font-size: 12px; color: var(--text-secondary); font-weight: 400; }
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, button { font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 36px; }
button { cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { color: #111; } }
.ghost { background: transparent; }
.logout { color: var(--text-secondary); font-size: 14px; text-decoration: none; padding: 6px; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kpi .label { font-size: 13px; color: var(--text-secondary); }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.legend { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
.key.bar { background: var(--series-1); }
.key.line { height: 2px; background: var(--series-2); border-radius: 0; width: 16px; }
.chart { width: 100%; height: 220px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { fill: var(--text-secondary); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .line { fill: none; stroke: var(--series-2); stroke-width: 2; }
.chart .dot { fill: var(--series-2); stroke: var(--surface-1); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--grid); fill-opacity: .6; }
.grid { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.grid .card { margin-bottom: 0; }
.grid > *, .detail-grid > * { min-width: 0; }
.hint.block { display: block; margin-top: 2px; }
.grid + .card { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
td.path { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#pages tbody tr { cursor: pointer; }
#pages tbody tr:hover, #pages tbody tr.sel { background: var(--row-hover); }
#pages tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mini { display: flex; align-items: center; gap: 6px; min-width: 90px; font-size: 12px; color: var(--text-secondary); }
.mini span { display: block; height: 6px; border-radius: 0 3px 3px 0; background: var(--series-1); }
.devbar { display: flex; gap: 2px; height: 26px; border-radius: 6px; overflow: hidden; }
.devbar div { display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; min-width: 2px; white-space: nowrap; overflow: hidden; }
.devlegend { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.detail-grid { display: grid; grid-template-columns: 2fr 3fr; gap: 22px; }
.scrollbars .row { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.scrollbars .track { height: 14px; background: var(--grid); border-radius: 0 4px 4px 0; }
.scrollbars .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.scrollbars .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.el-sel { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-secondary); display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 8px; }
.heat-head h3 { margin: 0 auto 0 0; }
.heat { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; max-height: 900px; overflow-y: auto; background: var(--grid); }
.heat img { display: block; width: 100%; min-height: 200px; }
.heat canvas { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; }
.heat.mobile { max-width: 390px; margin: 0 auto; }
.heat.tablet { max-width: 560px; margin: 0 auto; }
.heat-msg { position: absolute; top: 10px; left: 10px; right: 10px; font-size: 13px; color: var(--text-secondary); }
.heat-msg:empty { display: none; }
.tip { position: fixed; pointer-events: none; z-index: 20; background: var(--text-primary); color: var(--surface-1); font-size: 12px; padding: 6px 8px; border-radius: 6px; opacity: 0; transition: opacity .1s; white-space: nowrap; }
.foot { text-align: center; font-size: 12px; color: var(--text-secondary); }
.empty { color: var(--text-secondary); font-size: 13px; padding: 10px 0; }
@media (max-width: 900px) {
  .grid, .detail-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 24px; }
  main { padding: 10px; }
  .top { padding: 8px 10px; }
  td.path { max-width: 150px; }
  .seg button { font-size: 13px; padding: 6px 8px; }
  .heat-head h3 { width: 100%; }
  .filters { width: 100%; }
  .filters select { flex: 1; min-width: 0; }
  .hide-sm { display: none; }
}

.heat img:not([src]) { display: none; }
.heat.empty-state { min-height: 120px; }
.heat.empty-state .heat-msg { position: static; padding: 14px; }
