/* VIP-панель. Палитра графиков — эталонная из dataviz-гайда (проверена на
   различимость при дальтонизме); светлая и тёмная темы заданы отдельно. */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7873;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e6effb;
  --good: #006300;
  --bad: #b42323;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4a00;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #8f8d87;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #1b2a3d;
    --good: #0ca30c;
    --bad: #e66767;
    --warn-bg: #3a2e10;
    --warn-ink: #f3d58a;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #8f8d87;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-soft: #1b2a3d;
  --good: #0ca30c;
  --bad: #e66767;
  --warn-bg: #3a2e10;
  --warn-ink: #f3d58a;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --shadow: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner, main { max-width: 1200px; margin: 0 auto; padding-inline: 16px; }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.brand small { color: var(--muted); font-weight: 450; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 1200px; margin: 0 auto; padding: 0 12px 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 999px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; font-weight: 500;
}
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--page); }
main { padding-block: 20px 48px; }
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.view-head h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; font-weight: 650; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; min-width: 0;
}
.card-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 620; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- controls ---------- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.input, select.input, textarea.input {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; min-width: 0;
}
.input:focus, .btn:focus-visible, .tab:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea.input { width: 100%; min-height: 160px; resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis .hero { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; justify-content: space-between; }
@media (max-width: 960px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis .hero { grid-row: auto; } }
.tile-label { color: var(--ink-2); font-size: 13px; }
.tile-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }
.hero .tile-value { font-size: 52px; line-height: 1.05; }
.hero-note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.delta { font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .col.hover .mark { filter: brightness(1.12); }
.chart .col.hover .hovershade { fill: var(--surface-2); }
.chart .hovershade { fill: transparent; }
.chart .s-stars { fill: var(--s1); } .chart .s-tribute { fill: var(--s2); } .chart .s-crypto { fill: var(--s3); }
.chart .bar1 { fill: var(--s1); }
.chart .val { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 12.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s-stars, .line.s-stars { background: var(--s1); }
.sw.s-tribute, .line.s-tribute { background: var(--s2); }
.sw.s-crypto, .line.s-crypto { background: var(--s3); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12.5px;
}
.tooltip .t-title { color: var(--muted); margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .t-row .line { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.tooltip .t-name { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.tooltip .t-total { border-top: 1px solid var(--grid); margin-top: 6px; padding-top: 6px; }
.segbar { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.segbar .part { border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; padding-left: 8px; white-space: nowrap; overflow: hidden; min-width: 0; }
.segbar .part.s-stars { background: var(--s1); }
.segbar .part.s-tribute { background: var(--s2); }
.segbar .part.s-crypto { background: var(--s3); }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.chart.loading, .loading-dim { opacity: .5; transition: opacity .15s; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tbody tr.clickable { cursor: pointer; }
.t tbody tr.clickable:hover td { background: var(--surface-2); }
.who b { font-weight: 560; }
.who small { color: var(--muted); display: block; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.chip.off { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.chip.forever { background: var(--accent-soft); color: var(--accent); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.plan h3 { margin: 0 0 2px; font-size: 16px; }
.plan .meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.plan .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.plan .row .input { width: 100%; }
.plan .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; border-radius: 999px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login h1 { font-size: 20px; margin: 14px 0 4px; letter-spacing: -0.02em; }
.login p { color: var(--ink-2); margin: 0 0 18px; }
.login .input { width: 100%; font-size: 22px; letter-spacing: .25em; text-align: center; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.login .btn { width: 100%; justify-content: center; padding: 11px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ---------- dialog & toast ---------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg-body { padding: 20px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; margin-bottom: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--page); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.error { background: var(--bad); color: #fff; }

.mt { margin-top: 16px; }
.legend-row { margin-top: 10px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-top: 14px; border-top: 1px solid var(--grid); margin-top: 18px; }
.hero-small { font-size: 18px; font-weight: 620; margin-top: 2px; }

/* ---------- видео ---------- */
.dropzone {
  border: 2px dashed var(--axis); border-radius: var(--radius); background: var(--surface);
  padding: 36px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dz-icon { font-size: 34px; }
.dz-title { font-size: 16px; font-weight: 620; margin: 6px 0 6px; }
.dz-sub { color: var(--muted); font-size: 13px; max-width: 620px; margin: 0 auto; }
.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.cat-head h3 { margin: 0; font-size: 15px; }
.v-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--grid); }
.v-item > input[type=checkbox] { width: 18px; height: 18px; margin-top: 9px; accent-color: var(--accent); flex: none; }
.v-item.done { opacity: .6; }
.v-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.v-title { font-weight: 600; width: 100%; }
textarea.v-desc { width: 100%; min-height: 64px; height: 64px; resize: vertical; font-size: 13.5px; }
.v-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 12.5px; }
.warn { color: var(--bad); }
.block { display: block; margin-top: 4px; }
.mini-progress { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.mini-progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.pub-bar {
  position: sticky; bottom: 12px; z-index: 6; margin-top: 12px; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 12px 16px;
}
.pub-summary { font-weight: 550; }

.session-timer { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.session-timer.ending { color: #fff; background: var(--bad); }

.wallet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; border-top: 1px solid var(--grid); }
.wallet-name { display: grid; min-width: 150px; }
