/* GetStars Admin — дизайн-система. Светлая и тёмная темы, системный шрифт Apple. */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: #ffffff;
  --card-2: #fafafc;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --grid: #ededf0;
  --axis: #d2d2d7;
  --line: rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.04);
  --seg: rgba(118, 118, 128, 0.12);
  --accent: #0071e3;
  --accent-ink: #0066cc;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --gold: #f5a623;
  --good-ink: #1a7f37;
  --bad-ink: #d70015;
  --warn-ink: #b25000;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --muted-series: #c7c7cc;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.02), 0 6px 24px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --card: #161618; --card-2: #1c1c1e; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
    --grid: #262629; --axis: #3a3a3d; --line: rgba(255, 255, 255, 0.08); --hover: rgba(255, 255, 255, 0.05);
    --seg: rgba(118, 118, 128, 0.24); --accent: #2997ff; --accent-ink: #4aa8ff; --accent-soft: rgba(41, 151, 255, 0.16);
    --good-ink: #30d158; --bad-ink: #ff453a; --warn-ink: #ff9f0a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --muted-series: #48484a;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --card: #161618; --card-2: #1c1c1e; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
  --grid: #262629; --axis: #3a3a3d; --line: rgba(255, 255, 255, 0.08); --hover: rgba(255, 255, 255, 0.05);
  --seg: rgba(118, 118, 128, 0.24); --accent: #2997ff; --accent-ink: #4aa8ff; --accent-soft: rgba(41, 151, 255, 0.16);
  --good-ink: #30d158; --bad-ink: #ff453a; --warn-ink: #ff9f0a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --muted-series: #48484a;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; letter-spacing: -0.005em;
}
a { color: var(--accent-ink); text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ── Каркас ── */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px 16px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 8px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, #ffd56b, #f5a623 45%, #ef6f2e); box-shadow: 0 6px 18px rgba(245, 166, 35, 0.35);
}
.brand-mark svg { width: 19px; height: 19px; fill: #fff; }
.brand b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand span { font-size: 12px; color: var(--ink-3); }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group h6 { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 10px;
  color: var(--ink); font-size: 13.5px; transition: background 0.15s;
}
.nav a svg { width: 18px; height: 18px; stroke: var(--ink-2); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a.on svg { stroke: var(--accent-ink); }
.nav a .live-dot { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.sync { display: flex; gap: 8px; align-items: flex-start; }
.sync .dot { margin-top: 5px; }
.sync small { display: block; color: var(--ink-3); }
.progress { height: 4px; border-radius: 4px; background: var(--seg); margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.6s; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--good); }
.dot.warn { background: var(--warning); }
.dot.bad { background: var(--critical); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); position: relative; flex: none; }
.live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }

.main { min-width: 0; padding: 26px 34px 60px; }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.top-row > div:first-child { min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.top h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -0.028em; }
.top p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.seg { position: relative; display: inline-flex; padding: 2px; border-radius: 10px; background: var(--seg); }
.seg button {
  position: relative; z-index: 1; border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap;
}
.seg .pill {
  position: absolute; top: 2px; bottom: 2px; border-radius: 8px; background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: left 0.28s cubic-bezier(0.3, 0.7, 0.2, 1), width 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
:root[data-theme="dark"] .seg .pill { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg .pill { background: #636366; } }

.icon-btn {
  width: 32px; height: 32px; border-radius: 10px; border: 0; background: var(--seg); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--hover); box-shadow: 0 0 0 1px var(--line) inset; }
.icon-btn svg { width: 17px; height: 17px; stroke: var(--ink); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sync-btn {
  display: inline-flex; align-items: center; gap: 9px; height: 32px; padding: 0 12px 0 9px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.sync-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent); }
.sync-btn:active { transform: none; }
.sync-btn:disabled { cursor: progress; background: color-mix(in srgb, var(--accent) 75%, var(--ink-3)); }
.sync-ic { display: grid; place-items: center; }
.sync-ic svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sync-btn.busy .sync-ic svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.sync-txt small { font-size: 10.5px; font-weight: 500; opacity: 0.85; }
.linkish { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--accent-ink); font-size: 12px; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 11px; border-radius: 10px; border: 0;
  background: var(--seg); color: var(--ink-2); font-size: 13px; cursor: pointer; min-width: 200px;
}
.search-btn svg { width: 15px; height: 15px; stroke: var(--ink-2); fill: none; stroke-width: 2; }
.search-btn kbd { margin-left: auto; font-family: var(--font); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }

/* ── Сетка и карточки ── */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.grid + .grid { margin-top: 16px; }
.c-2 { grid-column: span 2; } .c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; }
.c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 22px; min-width: 0;
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h > div:first-child { flex: 1 1 240px; min-width: 0; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.012em; }
.card-h p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); max-width: 60ch; }
.card-h .aside { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.section-title { grid-column: 1 / -1; margin: 18px 2px -2px; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.section-title small { display: block; font-size: 13px; color: var(--ink-2); font-weight: 400; letter-spacing: 0; margin-top: 2px; }
.loading .card { opacity: 0.55; transition: opacity 0.2s; }
.partial { display: flex; align-items: center; gap: 10px; margin: -8px 0 18px; padding: 10px 14px; border-radius: 14px; font-size: 13px; color: var(--ink-2);
  background: color-mix(in srgb, var(--warning) 12%, var(--card)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent) inset; }
.partial b { color: var(--ink); }

/* ── Плитки ── */
.tile { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.tile .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; white-space: nowrap; }
.tile .value small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 2px; letter-spacing: 0; }
.tile .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); min-height: 18px; flex-wrap: wrap; }
.tile .spark { margin-top: 8px; height: 30px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 1px 7px 1px 6px; border-radius: 20px; }
.delta.up { color: var(--good-ink); background: color-mix(in srgb, var(--good) 13%, transparent); }
.delta.down { color: var(--bad-ink); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.delta.flat { color: var(--ink-2); background: var(--seg); }
.info { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink-3); color: var(--ink-3); font-size: 9px; display: inline-grid; place-items: center; cursor: help; font-weight: 700; }

/* ── Герой ── */
.hero { position: relative; overflow: hidden; padding: 28px 30px; display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(0, 2fr); gap: 28px; }
.hero::before {
  content: ""; position: absolute; inset: -40%; z-index: 0; pointer-events: none; opacity: 0.9;
  background:
    radial-gradient(40% 50% at 15% 25%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%),
    radial-gradient(35% 45% at 85% 15%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(40% 40% at 60% 95%, color-mix(in srgb, var(--s7) 12%, transparent), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate3d(-3%, -2%, 0) rotate(0deg); } to { transform: translate3d(3%, 2%, 0) rotate(6deg); } }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; gap: 8px; align-items: center; }
.hero .big { font-size: 60px; line-height: 1.02; font-weight: 700; letter-spacing: -0.045em; margin: 10px 0 10px; white-space: nowrap; }
.hero .big small { font-size: 26px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.02em; margin-left: 4px; }
.hero .sub { color: var(--ink-2); font-size: 13px; max-width: 34ch; }
.hero .minis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-top: 22px; }
.mini .l { font-size: 12px; color: var(--ink-2); }
.mini .v { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }

/* ── Таблицы ── */
.tbl-wrap { overflow: auto; margin: 0 -22px -22px; padding: 0 22px 14px; max-height: var(--max-h, none); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--card); text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-2);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arr { opacity: 0.5; font-size: 10px; margin-left: 3px; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.click { cursor: pointer; }
.tbl td.name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tbl td .sub { color: var(--ink-3); font-size: 11.5px; margin-left: 6px; font-weight: 400; }
.tbl td.bar { min-width: 90px; }
.cellbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cellbar i { display: block; height: 6px; border-radius: 3px; background: var(--s1); opacity: 0.85; }
.neg { color: var(--bad-ink); }
.pos { color: var(--good-ink); }
.muted { color: var(--ink-3); }
.tbl-more { display: block; margin: 10px auto 0; border: 0; background: var(--seg); border-radius: 9px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--seg); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.badge.bad { background: color-mix(in srgb, var(--critical) 13%, transparent); color: var(--bad-ink); }
.badge.warn { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warn-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge svg { width: 11px; height: 11px; }

/* ── Графики ── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .grid-l { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-l { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .x-hair { stroke: var(--ink-3); stroke-width: 1; opacity: 0.5; shape-rendering: crispEdges; }
.chart .band { fill: var(--hover); }
.chart .end-label { fill: var(--ink); font-weight: 600; font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.ln { height: 2px; width: 14px; border-radius: 2px; }

.tip {
  position: fixed; z-index: 300; pointer-events: none; min-width: 150px; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-pop); border: 1px solid var(--line); font-size: 12px; opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
}
.tip.on { opacity: 1; transform: none; }
.tip .t { color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.tip .row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip .row i { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.tip .row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tip .row span { color: var(--ink-2); margin-left: auto; padding-left: 10px; }

.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.hbar .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .l small { color: var(--ink-3); margin-left: 4px; }
.hbar .track { height: 8px; border-radius: 4px; background: var(--seg); position: relative; overflow: visible; }
.hbar .fill { height: 100%; border-radius: 4px; background: var(--s1); transform-origin: left; animation: grow 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hbar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--ink); opacity: 0.55; }
.hbar .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbar .v small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.funnel { display: flex; flex-direction: column; gap: 8px; }
.fstep { display: grid; grid-template-columns: 160px 1fr 92px; gap: 12px; align-items: center; font-size: 13px; }
.fstep .bar { height: 30px; border-radius: 8px; background: var(--accent-soft); position: relative; overflow: hidden; }
.fstep .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: linear-gradient(90deg, var(--s1), color-mix(in srgb, var(--s1) 70%, var(--s7))); animation: grow 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; transform-origin: left; }
.fstep .bar b { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #fff; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fstep .bar b.out { color: var(--ink); }
.fstep .c { text-align: right; font-variant-numeric: tabular-nums; }
.fstep .c b { display: block; font-size: 13px; }
.fstep .c small { color: var(--ink-3); font-size: 11.5px; }

.heat { border-collapse: separate; border-spacing: 3px; font-size: 11.5px; width: 100%; }
.heat th { color: var(--ink-3); font-weight: 500; padding: 2px 4px; text-align: center; white-space: nowrap; }
.heat th.rl { text-align: left; color: var(--ink-2); position: sticky; left: 0; z-index: 1; background: var(--card); }
.hscroll { overflow-x: auto; }
.heat td { height: 30px; min-width: 38px; border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; transition: transform 0.12s; }
.heat td.empty { background: transparent; }
.heat td.hv:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--ink-3); }
.heat td.size { color: var(--ink-2); text-align: right; padding-right: 8px; min-width: 50px; }

.matrix { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 11px; color: var(--ink-3); align-items: center; }
.matrix .cell { aspect-ratio: 1; border-radius: 5px; min-height: 12px; transition: transform 0.12s; }
.matrix .cell:hover { transform: scale(1.18); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--ink-3); }
.matrix .hl { text-align: center; }

.stack100 { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--card); }
.stack100 i { display: block; height: 100%; min-width: 2px; }
.stack100 i:first-child { border-radius: 7px 0 0 7px; }
.stack100 i:last-child { border-radius: 0 7px 7px 0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-size: 13px; align-items: baseline; }
.kv .k { color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.kv .k i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.kv .v small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.bigstat { font-size: 36px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.bigstat small { font-size: 16px; color: var(--ink-2); font-weight: 500; letter-spacing: 0; }
.note { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.note b { color: var(--ink); }
.callout { border-radius: 14px; padding: 12px 14px; background: var(--card-2); box-shadow: 0 0 0 1px var(--line) inset; font-size: 12.5px; color: var(--ink-2); }
.callout.warn { background: color-mix(in srgb, var(--warning) 10%, var(--card)); }
.callout.bad { background: color-mix(in srgb, var(--critical) 8%, var(--card)); }

.feed { display: flex; flex-direction: column; }
.feed .it { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed .it:last-child { border-bottom: 0; }
.feed .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.feed .ic svg { width: 15px; height: 15px; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.feed .ic.in { background: color-mix(in srgb, var(--good) 14%, transparent); } .feed .ic.in svg { stroke: var(--good-ink); }
.feed .ic.out { background: var(--accent-soft); } .feed .ic.out svg { stroke: var(--accent-ink); }
.feed .ic.bad { background: color-mix(in srgb, var(--critical) 12%, transparent); } .feed .ic.bad svg { stroke: var(--bad-ink); }
.feed .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .who small { display: block; color: var(--ink-3); font-size: 11.5px; }
.feed .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.feed .amt small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }

.tabs { display: inline-flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.tabs button.on { background: var(--seg); color: var(--ink); }

/* ── Игрок ── */
.phead { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; flex: none; }
.phead h2 { margin: 0; font-size: 26px; letter-spacing: -0.025em; }
.phead .meta { color: var(--ink-2); font-size: 13px; margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.phead .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.searchbox { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 0 16px; height: 54px; max-width: 640px; }
.searchbox svg { width: 19px; height: 19px; stroke: var(--ink-3); fill: none; stroke-width: 2; flex: none; }
.searchbox input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); }
.results { margin-top: 12px; max-width: 640px; }

/* ── Командная палитра ── */
.palette-bg { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.25); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette-bg.on { display: flex; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.palette { width: min(620px, calc(100vw - 32px)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1.1); }
@keyframes pop { from { transform: scale(0.97) translateY(-6px); opacity: 0; } }
.palette .in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); }
.palette .in svg { width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.palette input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 17px; color: var(--ink); }
.palette .list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette .grp { font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 8px 10px 4px; }
.palette .opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.palette .opt.sel { background: var(--accent); color: #fff; }
.palette .opt.sel small, .palette .opt.sel .muted { color: rgba(255, 255, 255, 0.8); }
.palette .opt small { margin-left: auto; color: var(--ink-3); }
.palette .opt svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ── Скелетон ── */
.skel { border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, var(--hover) 50%, transparent 80%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.empty-state { text-align: center; padding: 30px 10px; color: var(--ink-3); font-size: 13px; }
.err { color: var(--bad-ink); }

/* ── Адаптив: сетка на средних экранах ── */
@media (max-width: 1280px) {
  .c-3 { grid-column: span 6; } .c-4 { grid-column: span 6; } .c-8 { grid-column: span 12; } .c-5, .c-7 { grid-column: span 12; }
  .c-2 { grid-column: span 4; }
}
/* Вход */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); color: var(--ink); font: inherit; font-size: 16px; min-height: 44px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card button {
  padding: 11px; min-height: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; cursor: default; }
.login-error { min-height: 18px; margin: 0; font-size: 13px; color: var(--bad-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Пользователи: live-поток ── */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border: 0; border-radius: 9px; background: var(--seg); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--ink); }
.chip:hover { background: var(--hover); box-shadow: 0 0 0 1px var(--line) inset; }
.chip small { color: var(--ink-3); font-weight: 400; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); margin: 0; }
.console { border-radius: 14px; background: var(--card-2); box-shadow: 0 0 0 1px var(--line) inset; overflow: hidden; font-family: var(--mono); font-size: 12px; }
.console-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--font); font-size: 12px; color: var(--ink-2); }
.console-body { height: 520px; overflow-y: auto; padding: 6px 0; scroll-behavior: smooth; }
.console .ln { display: grid; grid-template-columns: 66px 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 12px; border-left: 3px solid transparent; font-variant-numeric: tabular-nums; }
.console .ln:hover { background: var(--hover); }
.console .ln.new { animation: flash 1.6s ease-out both; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.console .t { color: var(--ink-3); }
.console .k { font-weight: 700; letter-spacing: 0.04em; font-size: 11px; color: var(--ink-2); }
.console .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.console .m small { color: var(--ink-3); }
.console .a { text-align: right; white-space: nowrap; color: var(--ink-2); }
.console .a b { color: var(--ink); font-weight: 600; }
.console .a small { color: var(--ink-3); }
.console .ln.bet.win { border-left-color: var(--good); } .console .ln.bet.win .a b { color: var(--good-ink); }
.console .ln.bet:not(.win):not(.open) .a b { color: var(--ink-3); }
.console .ln.open { border-left-color: var(--accent); }
.console .ln.led.plus .a b { color: var(--good-ink); }
.console .ln.led:not(.plus) .a b { color: var(--bad-ink); }
.console .ln.pay.in { border-left-color: var(--good); } .console .ln.pay.out { border-left-color: var(--accent); } .console .ln.pay.bad { border-left-color: var(--critical); }
.console .ln.fb { border-left-color: var(--warning); }
.console .badge { height: 16px; font-size: 10px; padding: 0 6px; }

/* ── Мобильная версия ── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, label, th.sortable, tr.click, .cell, .hv { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.app { min-height: 100dvh; }
html.lock, html.lock body { overflow: hidden; }
.info { position: relative; }
.info::after { content: ""; position: absolute; inset: -15px; } /* зона нажатия 44 px вокруг значка 14 px */
.pbal { margin-left: auto; text-align: right; }
.seg .sm, .fresh, .tabbar, .sheet-bg, .sheet-head, .sheet-tools, .sync-mini, .pal-cancel { display: none; }

.offline {
  position: fixed; z-index: 120; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
  padding: 9px 14px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-pop); font-size: 13px; color: var(--ink-2);
  transform: translate(-50%, 12px); opacity: 0; visibility: hidden; transition: opacity 0.2s, transform 0.2s;
}
.offline.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.card.err .tbl-more { margin: 12px 0 0; }

.searchbox .sync-btn { height: 38px; flex: none; }
.chip small, .console-head small { font-size: 12px; }

/* Всё, чем управляют пальцем: цели нажатия не меньше 44 px */
@media (max-width: 960px), (pointer: coarse) {
  .searchbox .sync-btn { height: 44px; }
  .phead .meta a, .phead .badges a { display: inline-block; padding-block: 12px; margin-block: -12px; }
  .seg button { height: 44px; }
  .icon-btn { width: 44px; height: 44px; border-radius: 12px; }
  .sync-btn, .search-btn { height: 44px; }
  .tabs button { min-height: 44px; padding: 0 12px; }
  .chip { min-height: 44px; }
  .toggle { min-height: 44px; }
  .linkish { min-height: 44px; margin-top: 2px; }
  .tbl th { padding: 14px 10px; }
  .tbl td { padding: 13px 10px; }
  .tbl td a { display: inline-block; padding-block: 6px; margin-block: -6px; }
  .tbl-more { min-height: 44px; padding: 0 18px; }
  .searchbox input { height: 100%; min-width: 0; }
  .palette .opt { min-height: 48px; }
}

/* Планшет и телефон: нижнее меню, шторка вместо боковой панели, период закреплён */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main {
    padding: calc(14px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(84px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .top { display: contents; }
  .top-row { margin-bottom: 10px; }
  .top h1 { font-size: 28px; }
  .top p { margin-top: 3px; font-size: 13px; }
  .fresh { display: block; color: var(--ink-3); }
  .top p.fresh { font-size: 12px; margin-top: 2px; }
  .sync-mini { display: grid; flex: none; }
  .sync-mini .sync-ic svg { stroke: var(--ink); }
  .sync-mini.busy .sync-ic svg { animation: spin 0.9s linear infinite; }
  .controls {
    position: sticky; top: 0; z-index: 40; margin: 0 -16px 12px; padding: calc(4px + env(safe-area-inset-top)) 16px 6px;
    background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  }
  .controls > :not(.period) { display: none; }
  .no-period .controls { display: none; }
  .controls .seg.period { display: flex; width: 100%; }
  .controls .seg.period button { flex: 1; padding: 0 6px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 0; border: 0; border-radius: 12px;
    background: none; color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer;
  }
  .tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab.on { color: var(--accent-ink); font-weight: 600; }
  .tab:active { background: var(--hover); }
  .offline { bottom: calc(72px + env(safe-area-inset-bottom)); }

  .side {
    position: fixed; z-index: 150; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: 560px; margin-inline: auto; height: auto; max-height: 88dvh;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom)); gap: 14px; overflow-y: auto; overscroll-behavior: contain;
    border: 0; border-radius: 22px 22px 0 0; background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: var(--shadow-pop);
    transform: translateY(105%); visibility: hidden; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.28s;
  }
  .side.open { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .side.drag { transition: none; }
  .side .brand { display: none; }
  .sheet-bg { display: block; position: fixed; inset: 0; z-index: 140; background: rgba(0, 0, 0, 0.42); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .sheet-bg.on { opacity: 1; pointer-events: auto; }
  .sheet-head {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 2; padding: 16px 0 6px;
    background: var(--card); font-size: 17px; touch-action: none; cursor: grab;
  }
  .sheet-head .grip { position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--axis); }
  .nav { display: flex; flex-direction: column; gap: 12px; }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .nav-group h6 { grid-column: 1 / -1; padding: 0 2px; font-size: 12px; }
  .nav a { height: 48px; font-size: 14px; }
  .sheet-tools { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
  .sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
  .sheet-row .seg button { padding: 0 10px; }
  .sheet-exit {
    display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px;
    background: var(--seg); color: var(--bad-ink); font-size: 14px; font-weight: 600; cursor: pointer;
  }
  .sheet-exit small { color: var(--ink-3); font-weight: 400; }
  .side-foot { margin-top: 0; padding: 12px 0 0; }

  .more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .more-left .tbl th:first-child, .more-left .tbl td:first-child, .more-left .heat th.rl { box-shadow: 1px 0 0 var(--line), 8px 0 10px -8px rgba(0, 0, 0, 0.4); }
  .tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; background: var(--card); }
  .tbl th:first-child { z-index: 3; }
  .tbl td:first-child { z-index: 1; }
}

/* Телефон */
@media (max-width: 640px) {
  .seg .lg { display: none; }
  .seg .sm { display: inline; }
  .grid { gap: 10px; }
  .grid + .grid { margin-top: 10px; }
  .c-2, .c-3 { grid-column: span 6; }
  .c-4, .c-5, .c-6, .c-7, .c-8 { grid-column: span 12; }
  .card { padding: 16px; border-radius: 18px; }
  .card-h { margin-bottom: 12px; }
  .card-h .aside { justify-content: flex-start; width: 100%; }
  .tile { padding: 14px; }
  .tile .value { font-size: 21px; white-space: normal; overflow-wrap: anywhere; }
  .tile .value small { font-size: 13px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px 16px; }
  .hero::before { animation: none; }
  .hero .big { font-size: clamp(34px, 11.5vw, 46px); }
  .bigstat { font-size: 28px; overflow-wrap: anywhere; }
  .tbl-wrap { margin: 0 -16px -16px; padding: 0 16px 10px; }
  .tbl td.name, .tbl td:first-child { max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
  .cellbar i { display: none; }
  .hbar { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .fstep { grid-template-columns: 104px minmax(0, 1fr) 62px; gap: 8px; }
  .heat td { min-width: 34px; height: 34px; }
  .matrix.tall { grid-template-columns: 26px repeat(7, minmax(0, 1fr)); font-size: 12px; }
  .matrix.tall .cell { aspect-ratio: auto; height: 24px; }
  .tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; }
  .phead { gap: 12px; }
  .phead > div:nth-child(2) { flex: 1 1 0; }
  .avatar { width: 52px; height: 52px; border-radius: 16px; font-size: 22px; }
  .phead h2 { font-size: 22px; overflow-wrap: anywhere; }
  .pbal { width: 100%; margin-left: 0; text-align: left; }
  .pbal .sync-btn { display: flex; width: 100%; justify-content: center; }
  .searchbox { height: 56px; padding: 0 6px 0 14px; }
  .console-head { flex-wrap: wrap; overflow-wrap: anywhere; }
  .console-head .note { flex: 1 1 0; min-width: 0; }
  .console-head > span:last-child { margin-left: 0 !important; flex-basis: 100%; }
  .console-body { height: min(60dvh, 520px); }
  .console .ln { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; padding: 7px 10px; }
  .console .k, .console .a small { display: none; }
  .console .badge { height: 18px; font-size: 11px; }
  .palette-bg { padding: 0; background: var(--bg); }
  .palette { display: flex; flex-direction: column; width: 100%; height: 100dvh; border-radius: 0; background: var(--card); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .palette .list { flex: 1; max-height: none; }
  .palette input { min-width: 0; }
  .pal-cancel { display: block; flex: none; min-height: 44px; padding: 0 2px 0 8px; border: 0; background: none; color: var(--accent-ink); font-size: 15px; cursor: pointer; }
}

/* Лёжа на телефоне экран низкий: закреплённый период съел бы его треть */
@media (max-height: 480px) and (orientation: landscape) {
  .controls { position: static; }
  .console-body { height: 70dvh; }
}

/* Наведения нет: подсветки «залипают» после касания, вместо них отклик на нажатие */
@media (hover: none) {
  .tbl tbody tr:hover, .console .ln:hover, .nav a:hover { background: none; }
  .nav a.on:hover { background: var(--accent-soft); }
  .matrix .cell:hover, .heat td.hv:hover { transform: none; box-shadow: none; }
  .sync-btn:hover { transform: none; }
  .icon-btn:hover { background: var(--seg); box-shadow: none; }
  .chip:hover { background: var(--seg); box-shadow: none; }
  .tbl tbody tr.click:active { background: var(--hover); }
  .icon-btn:active, .chip:active, .sync-btn:active, .tbl-more:active, .nav a:active { opacity: 0.65; }
}
