:root {
  color-scheme: light;
  --surface-0: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --grid: #ebeae6;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e68;
  --series-1: #2a78d6;
  --accent-soft: #e3eefc;
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  --critical-text: #b02a2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --surface-2: #242422;
    --border: #2f2f2c;
    --grid: #2a2a28;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #97968d;
    --series-1: #3987e5;
    --accent-soft: #1c2c42;
    --good: #0ca30c;
    --good-text: #4cc04c;
    --critical: #d03b3b;
    --critical-text: #f07a7a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --surface-2: #242422;
  --border: #2f2f2c;
  --grid: #2a2a28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #97968d;
  --series-1: #3987e5;
  --accent-soft: #1c2c42;
  --good-text: #4cc04c;
  --critical-text: #f07a7a;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
a { color: var(--series-1); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
.top { padding: 22px 0 10px; }
.sub { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end;
  padding: 12px 0 16px; position: sticky; top: 0; z-index: 5;
  background: var(--surface-0);
}
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-muted); }
select, input[type="search"] {
  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; max-width: 100%;
}
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--text-secondary);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; min-height: 30px;
}
.seg button[aria-selected="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile, .card, .mv {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.tile { padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--text-muted); }
.tile .v { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 13px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.movers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.movers:empty { display: none; }
.mv { padding: 12px 14px; min-width: 0; }
.mv h3 { font-size: 13px; margin: 0 0 8px; color: var(--text-secondary); font-weight: 600; }
.mv ol { list-style: none; margin: 0; padding: 0; }
.mv li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.mv li:first-child { border-top: 0; }
.mv li button { all: unset; cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv li button:hover { text-decoration: underline; }
.mv .empty { color: var(--text-muted); font-size: 13px; }

.card { padding: 14px 0 6px; margin-bottom: 24px; }
.card-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 0 14px 10px; flex-wrap: wrap; }
.card-head input { width: min(320px, 100%); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-muted); padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.delta, td.delta { white-space: nowrap; width: 72px; }
.app-name { font-weight: 550; }
.app-dev { color: var(--text-muted); font-size: 12px; }
.app-cell { max-width: 380px; }
.app-cell div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); }
.note { color: var(--text-muted); font-size: 13px; padding: 8px 14px 6px; margin: 0; }

.dl { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; font-size: 13px; }
.dl .ar { font-size: 10px; }
.dl.up .ar { color: var(--good); }
.dl.down .ar { color: var(--critical); }
.dl.up { color: var(--good-text); }
.dl.down { color: var(--critical-text); }
.badge-new { font-size: 11px; font-weight: 600; color: var(--series-1); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }

.foot { color: var(--text-muted); font-size: 12px; padding-bottom: 32px; }
.foot p { margin: 4px 0; }

.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 20;
  background: var(--surface-1); border-left: 1px solid var(--border); box-shadow: -8px 0 32px rgba(0,0,0,.12);
  transform: translateX(105%); transition: transform .18s ease; overflow-y: auto;
}
.panel.open { transform: none; }
.panel-inner { padding: 18px 18px 32px; position: relative; }
.close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 8px; border: 0;
  background: var(--surface-2); color: var(--text-primary); font-size: 22px; line-height: 1; cursor: pointer;
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 15; }
.p-title { font-size: 19px; margin: 0 44px 2px 0; }
.p-dev { color: var(--text-secondary); margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 16px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.fact .k { font-size: 11px; color: var(--text-muted); }
.fact .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-box { position: relative; margin: 6px 0 4px; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .axis text { fill: var(--text-muted); font-size: 11px; }
.chart-box .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-box .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.chart-box .xhair { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip {
  position: absolute; pointer-events: none; background: var(--text-primary); color: var(--surface-1);
  font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -115%);
}
.p-h { font-size: 13px; color: var(--text-secondary); margin: 18px 0 6px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; }
.store-link { display: inline-block; margin-top: 16px; font-weight: 600; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .movers { grid-template-columns: 1fr; }
  .hide-m { display: none; }
}
@media (max-width: 600px) {
  h1 { font-size: 19px; }
  .hide-s { display: none; }
  .filters { gap: 8px 10px; }
  .filters label { flex: 1 1 40%; }
  .filters label select { width: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .tile .v { font-size: 19px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-cell { max-width: 52vw; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
