/* Kaspi Аналитика — современный финтех-дашборд.
   Серое полотно, белые (или графитовые) панели без обводок, один лаймовый акцент,
   крупные цифры Manrope, пилюльная навигация. Светлая тема по умолчанию, тёмная — по системе или переключателем. */

:root {
  --canvas: #E9ECEF;
  --panel: #FFFFFF;
  --panel-2: #F3F5F7;
  --panel-3: #E6EAEE;
  --ink: #0F1113;
  --ink-2: #555D66;
  --ink-3: #687079;
  --line: #E3E7EB;
  --accent: #F14635;
  --accent-2: #E03A29;
  --accent-ink: #FFFFFF;
  --accent-line: #D9392A;
  --solid: #0F1113;
  --solid-ink: #FFFFFF;
  --up: #11875A; --up-bg: #DDF3E8;
  --down: #D2452E; --down-bg: #FCE6E1;
  --warn: #A86A0C; --warn-bg: #FBEFD5;
  --info: #2B5FC4; --info-bg: #E3EBFA;
  --heat-lo: #F6C2B8; --heat-mid: #F4F6F7; --heat-hi: #B9EB7A;
  --c1: #0F1113; --c2: #1E9E5A; --c3: #F59E2C; --c4: #6D8BA8; --c5: #D2452E; --c6: #A7AFB7; --c7: #2FA58A; --c8: #E3A43B;
  --shadow: 0 1px 2px rgba(15, 17, 19, .04), 0 8px 24px -12px rgba(15, 17, 19, .10);
  --shadow-pop: 0 18px 48px -16px rgba(15, 17, 19, .28), 0 2px 6px rgba(15, 17, 19, .06);
  --inset: inset 0 1px 2px rgba(15, 17, 19, .06);
  --r-panel: 22px; --r-inner: 14px; --r-ctrl: 12px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #090A0B; --panel: #141618; --panel-2: #1C1F22; --panel-3: #24282C;
    --ink: #F1F3F4; --ink-2: #A9B0B7; --ink-3: #8A929A; --line: #23272B;
    --accent: #F14635; --accent-2: #FF5C4A; --accent-ink: #FFFFFF; --accent-line: #FF7A6B;
    --solid: #F1F3F4; --solid-ink: #0F1113;
    --up: #5ED69A; --up-bg: #12301F; --down: #FF8A72; --down-bg: #3A1A14; --warn: #F2BE5C; --warn-bg: #352710;
    --info: #8CB2FF; --info-bg: #15233F;
    --heat-lo: #5A241B; --heat-mid: #1C1F22; --heat-hi: #3E6A16;
    --c1: #F1F3F4; --c2: #4FCB8A; --c3: #F7B254; --c4: #7FA0BF; --c5: #FF8A72; --c6: #5C646C; --c7: #4CC9A8; --c8: #F2BE5C;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .8);
    --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .05);
    --inset: inset 0 1px 2px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #090A0B; --panel: #141618; --panel-2: #1C1F22; --panel-3: #24282C;
  --ink: #F1F3F4; --ink-2: #A9B0B7; --ink-3: #8A929A; --line: #23272B;
  --accent: #F14635; --accent-2: #FF5C4A; --accent-ink: #FFFFFF; --accent-line: #FF7A6B;
  --solid: #F1F3F4; --solid-ink: #0F1113;
  --up: #5ED69A; --up-bg: #12301F; --down: #FF8A72; --down-bg: #3A1A14; --warn: #F2BE5C; --warn-bg: #352710;
  --info: #8CB2FF; --info-bg: #15233F;
  --heat-lo: #5A241B; --heat-mid: #1C1F22; --heat-hi: #3E6A16;
  --c1: #F1F3F4; --c2: #4FCB8A; --c3: #F7B254; --c4: #7FA0BF; --c5: #FF8A72; --c6: #5C646C; --c7: #4CC9A8; --c8: #F2BE5C;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .8);
  --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .05);
  --inset: inset 0 1px 2px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 500 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }
p a, .notice a, .sub a, td a.inline-link { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
h1 { font-size: 30px; line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: 17px; line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 10px; }
small, .muted { color: var(--ink-2); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .88em; font-weight: 500; }
svg.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--canvas);
  transition: opacity .45s var(--ease), visibility .45s; }
.splash.out { opacity: 0; visibility: hidden; }
.splash-mark { display: grid; justify-items: center; gap: 16px; }
.splash-logo { width: 76px; height: 76px; animation: pulse 1.1s var(--ease) infinite alternate; }
.splash-logo img { width: 100%; height: 100%; display: block; }
.splash-name { font-weight: 700; font-size: 15px; color: var(--ink-2); }
@keyframes pulse { from { transform: scale(.92); } to { transform: scale(1.04); } }
html.no-splash .splash { display: none; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; min-height: 100vh; padding: 14px; }
.sidebar { position: sticky; top: 14px; height: calc(100vh - 28px); overflow-y: auto; background: var(--panel); border-radius: var(--r-panel);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; flex: none; display: block; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.nav-section { display: grid; gap: 2px; }
.nav-title { font-size: 12px; color: var(--ink-3); padding: 4px 12px 6px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 600;
  transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease); }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link:hover { background: var(--panel-2); color: var(--ink); }
.nav-link:active { transform: scale(.98); }
.nav-link.active { background: var(--accent); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.sidebar-foot .who { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-foot .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who button { font-size: 12.5px; color: var(--ink-3); }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { min-width: 0; width: 100%; max-width: 1560px; padding: 10px 8px 48px; }
.scrim { display: none; }

@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .sidebar { position: fixed; inset: 10px auto 10px 10px; height: auto; width: 280px; z-index: 40; transform: translateX(-110%);
    transition: transform .35s var(--ease); box-shadow: var(--shadow-pop); padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(9, 10, 11, .4); z-index: 30; backdrop-filter: blur(2px); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--canvas);
    padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px)); }
  .topbar .title { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .main { padding: 6px max(14px, env(safe-area-inset-right, 0px)) 48px max(14px, env(safe-area-inset-left, 0px)); }
}

.icon-btn { border: none; background: var(--panel); color: var(--ink); border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center;
  cursor: pointer; flex: none; box-shadow: var(--shadow); transition: transform .15s var(--ease), background .2s; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: var(--inset); }
.theme-toggle button { border: none; background: none; color: var(--ink-3); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.theme-toggle button svg { width: 17px; height: 17px; }
.theme-toggle button[aria-pressed="true"] { background: var(--solid); color: var(--solid-ink); }

/* ---------- шапка страницы и тулбар ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin: 4px 0 18px; }
.page-head .sub { color: var(--ink-2); font-size: 14px; margin-top: 6px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar, .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar-note, .compare-note { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.sep { display: none; }

.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.pop > summary .chev { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.pop[open] > summary .chev { transform: rotate(180deg); }
.pop-panel { position: absolute; z-index: 25; top: calc(100% + 8px); left: 0; min-width: 260px; background: var(--panel); border-radius: 18px;
  box-shadow: var(--shadow-pop); padding: 8px; display: grid; gap: 6px; transform-origin: top left; animation: pop-in .22s var(--ease); }
.pop-panel.right { left: auto; right: 0; transform-origin: top right; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.pop-item { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: none; background: none; font: inherit; font-weight: 600;
  color: var(--ink); padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.pop-item:hover { background: var(--panel-2); }
.pop-item.on { background: var(--accent); color: var(--accent-ink); }
.pop-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.pop-dates .btn { grid-column: 1 / -1; justify-content: center; }
.pop-grid { display: grid; gap: 8px; padding: 6px; min-width: 300px; }
.pop-grid select { width: 100%; }
.badge-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--solid); color: var(--solid-ink); font-size: 11.5px; font-weight: 800; }

/* ---------- поля и кнопки ---------- */
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], input[type=file], select, textarea {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); background: var(--panel-2); border: 1px solid transparent; border-radius: var(--r-ctrl);
  padding: 9px 12px; min-width: 0; max-width: 100%; box-shadow: var(--inset); transition: border-color .2s, background .2s; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type=file] { padding: 7px; }
textarea { width: 100%; min-height: 80px; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C949C' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); background-color: var(--panel); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-line); }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 700; border-radius: 999px; padding: 10px 18px;
  border: none; background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
  transition: transform .15s var(--ease), background .2s, filter .2s; }
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--solid); color: var(--solid-ink); }
.btn-primary:hover { background: var(--solid); filter: brightness(1.15); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-2); }
.btn-soft { background: var(--panel); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--down); }
.btn svg { width: 16px; height: 16px; }
.link-btn { border: none; background: none; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
.link-btn:hover { color: var(--ink); }
.inline { display: inline; }
label.check { display: inline-flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; color: var(--ink); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.form-grid label, .field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-row label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-2); font-weight: 600; }

/* ---------- панели ---------- */
.panel { background: var(--panel); border-radius: var(--r-panel); padding: 22px; box-shadow: var(--shadow); min-width: 0; position: relative; }
.panel + .panel, .stack > * + * { margin-top: 14px; }
/* в сетке отступы задаёт gap: соседи в одном ряду не должны съезжать */
.dash > *, .dash > .panel { margin-top: 0; }
.col-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-stack > .panel { margin-top: 0; }
.col-stack > .panel:last-child { flex: 1; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.panel-head > .muted, .panel-head > a { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.panel h2 { margin-bottom: 0; }
.panel > h2:first-child { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
@media (min-width: 1180px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

.flash { border-radius: 16px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; font-weight: 600; animation: pop-in .3s var(--ease); }
.flash.ok { background: var(--up-bg); color: var(--up); }
.flash.bad { background: var(--down-bg); color: var(--down); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 16px; padding: 12px 16px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.notice a { color: inherit; }
.notice.info { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- блоки показателей (одна панель, разделение пространством) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 28px; background: var(--panel); border-radius: var(--r-panel); padding: 22px 24px; box-shadow: var(--shadow); }
.kpi { display: grid; gap: 3px; min-width: 0; align-content: start; }
.kpi .label { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.kpi .sub { font-size: 12.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .cmp { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; font-weight: 600; margin-top: 2px; }
.delta { display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta svg { width: 11px; height: 11px; }
.delta.good { background: var(--up-bg); color: var(--up); }
.delta.bad { background: var(--down-bg); color: var(--down); }
.delta.flat { background: var(--panel-2); color: var(--ink-3); }
.delta-inline { font-size: 12px; font-weight: 700; display: block; }
.delta-inline.good { color: var(--up); } .delta-inline.bad { color: var(--down); } .delta-inline.flat { color: var(--ink-3); }
.info-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); color: var(--ink-3); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; cursor: help; flex: none; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 6px 10px 10px; }
.panel .table-wrap { box-shadow: none; padding: 0; border-radius: 0; background: none; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.data th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 12px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; background: var(--panel); border-bottom: 1px solid var(--line); }
table.data td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-weight: 500; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover td { background: var(--panel-2); }
table.data tbody tr:hover td:first-child { border-radius: 12px 0 0 12px; }
table.data tbody tr:hover td:last-child { border-radius: 0 12px 12px 0; }
table.data tr.total td { font-weight: 800; background: var(--panel-2); border-bottom: none; }
table.data tr.total td:first-child { border-radius: 12px 0 0 12px; }
table.data tr.total td:last-child { border-radius: 0 12px 12px 0; }
table.data .sticky-col { position: sticky; left: 0; background: var(--panel); z-index: 2; }
table.data th.sticky-col { z-index: 3; }
table.data tr.total .sticky-col, table.data tbody tr:hover .sticky-col { background: var(--panel-2); }
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]:hover { color: var(--ink); }
table.sortable th.asc::after { content: " ↑"; } table.sortable th.desc::after { content: " ↓"; }
td .name { display: block; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 700; }
td .meta { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.thumb { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--ink); background: var(--panel-2); flex: none; position: relative; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #FFFFFF; padding: 2px; }
.thumb.lg { width: 96px; height: 96px; border-radius: 18px; font-size: 32px; }
.thumb.xl { width: 132px; height: 132px; border-radius: 20px; font-size: 40px; }
.prod-cell { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill.ok, .pill.good { background: var(--up-bg); color: var(--up); }
.pill.bad { background: var(--down-bg); color: var(--down); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.flat { background: var(--panel-2); color: var(--ink-2); }
.empty { text-align: center; color: var(--ink-3); padding: 40px 16px; font-weight: 600; }
.pager { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; font-weight: 600; }

.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; margin-bottom: 18px; background: var(--panel); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); max-width: 100%; }
.tab { padding: 8px 16px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; transition: background .2s, color .2s; white-space: nowrap; }
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.on { background: var(--solid); color: var(--solid-ink); }
.tab .count { font-size: 12px; opacity: .7; }

/* ---------- графики ---------- */
.chart { width: 100%; height: 320px; }
.chart.small { height: 230px; }
.chart.tall { height: 360px; }
.spark-line { stroke: var(--ink); stroke-width: 1.8; }
.spark-area { fill: var(--accent); opacity: .45; }
.spark-dot { fill: var(--ink); }
.bars .bar { fill: var(--ink); } .bars .bar.zero { fill: var(--panel-3); }

/* разложение и прогресс */
.structure { display: grid; gap: 14px; }
.structure .row { display: grid; gap: 7px; }
.structure .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.structure .top b { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.track { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; box-shadow: var(--inset); }
.track > i { display: block; height: 100%; border-radius: 99px; transform-origin: left; animation: fill 1s var(--ease) both; }
@keyframes fill { from { transform: scaleX(0); } }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; vertical-align: 0; }
.c-profit { background: var(--c2); } .c-commission { background: var(--c3); } .c-delivery { background: var(--c4); }
.c-cost { background: var(--ink); } .c-ads { background: var(--c7); } .c-tax { background: var(--c8); }
.c-pack { background: var(--c6); } .c-opex { background: var(--ink-3); } .c-fault { background: var(--c5); }
.progress { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; position: relative; box-shadow: var(--inset); }
.progress > i { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 99px; }
.progress > i.pace { background: var(--accent); }

/* тепловая карта */
table.data.heat { border-spacing: 3px; }
table.heat td { border-bottom: none; }
table.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; min-width: 56px; padding: 10px 6px; font-size: 13.5px; font-weight: 700; border-radius: 8px; }
table.heat td.cell.zero { color: var(--ink-3); font-weight: 500; }

/* РНП */
.rnp-card { display: grid; grid-template-columns: 270px minmax(0, 1fr); background: var(--panel); border-radius: var(--r-panel); overflow: hidden; box-shadow: var(--shadow); }
.rnp-card + .rnp-card { margin-top: 14px; }
.rnp-side { padding: 20px; display: grid; gap: 10px; align-content: start; background: var(--panel-2); }
.rnp-side .title { font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.rnp-side .facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 13px; margin: 0; }
.rnp-side .facts dt { color: var(--ink-2); font-weight: 600; } .rnp-side .facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rnp-table { overflow-x: auto; padding: 6px 10px; }
.rnp-table table.data th, .rnp-table table.data td { padding: 8px 10px; font-size: 13px; }
.rnp-table table.data td.metric { color: var(--ink-2); white-space: nowrap; font-weight: 600; }
.star { border: none; background: none; cursor: pointer; font-size: 0; padding: 0; color: var(--ink-3); transition: transform .2s var(--ease), color .2s; }
.star::before { content: ""; display: block; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.7 6 6.5.6-4.9 4.3 1.5 6.4L12 16.8l-5.8 3.3 1.5-6.4-4.9-4.3 6.5-.6z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.7 6 6.5.6-4.9 4.3 1.5 6.4L12 16.8l-5.8 3.3 1.5-6.4-4.9-4.3 6.5-.6z'/%3E%3C/svg%3E") center/contain no-repeat; }
.star:hover { transform: scale(1.15); }
.star.on { color: var(--c8); }
@media (max-width: 760px) { .rnp-card { grid-template-columns: minmax(0, 1fr); } }

/* воронка */
.funnel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; background: var(--panel); border-radius: var(--r-panel); padding: 8px; box-shadow: var(--shadow); }
.funnel a { display: grid; gap: 2px; padding: 14px 16px; border-radius: 16px; color: var(--ink); transition: background .2s; }
.funnel a:hover { background: var(--panel-2); }
.funnel a.on { background: var(--solid); color: var(--solid-ink); }
.funnel a.on .t, .funnel a.on .s { color: inherit; opacity: .75; }
.funnel .t { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; font-weight: 600; }
.funnel .v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.funnel .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.tone-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tone-dot.ok { background: var(--up); } .tone-dot.bad { background: var(--down); } .tone-dot.warn { background: var(--warn); } .tone-dot.info { background: var(--ink-3); }

/* индекс качества */
.qi { display: grid; gap: 10px; padding: 18px; border-radius: 18px; background: var(--panel-2); }
.qi .v { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.qi.bad { background: var(--down-bg); }
.qi .bar { height: 8px; border-radius: 99px; background: var(--panel); position: relative; box-shadow: var(--inset); }
.qi .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.qi.good .bar i { background: var(--up); } .qi.warn .bar i { background: var(--warn); } .qi.bad .bar i { background: var(--down); } .qi.flat .bar i { background: var(--ink-3); }
.qi .bar b { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 2px; }

/* логин */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login { width: 100%; max-width: 400px; background: var(--panel); border-radius: 28px; padding: 34px 30px; display: grid; gap: 16px; box-shadow: var(--shadow-pop); }
.login h1 { font-size: 26px; }
.login label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.login input { width: 100%; font-size: 16px; padding: 13px 14px; }
.login .btn { justify-content: center; padding: 14px; font-size: 15px; }
.error-text { color: var(--down); font-size: 14px; font-weight: 600; }

details.more > summary { cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 700; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg) translateY(-2px); transition: transform .25s var(--ease); }
details.more[open] > summary::after { transform: rotate(225deg); }
details.more[open] > summary { margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 10px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-2); font-weight: 600; } .kv dd { margin: 0; font-weight: 700; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; }
.timeline li { display: flex; gap: 12px; align-items: baseline; }
.timeline time { color: var(--ink-3); font-size: 13px; min-width: 96px; font-variant-numeric: tabular-nums; font-weight: 600; }
code.url { display: block; padding: 10px 12px; background: var(--panel-2); border-radius: 12px; word-break: break-all; font-size: 12.5px; font-family: var(--mono); box-shadow: var(--inset); }
.check { list-style: none; padding: 0; margin: 0; }
.hide-sm { }

/* ---------- дашборд ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.span-6 { grid-column: span 6; } .span-3 { grid-column: span 3; }
@media (max-width: 1280px) { .dash .t-half { grid-column: span 6; } .dash .t-full { grid-column: span 12; } }
@media (max-width: 860px) { .dash > * { grid-column: span 12 !important; } }

.hero { display: grid; gap: 22px; padding: 26px; align-content: space-between; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hero-label { font-size: 15px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.hero-value { font-size: clamp(40px, 5.4vw, 68px); font-weight: 700; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-value .cur { font-size: .5em; font-weight: 600; color: var(--ink-3); margin-left: .12em; letter-spacing: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.hero-meta b { color: var(--ink); font-weight: 800; }
.comp-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 3px; }
.comp-bar i { display: block; height: 100%; border-radius: 3px; min-width: 3px; transform-origin: left; animation: fill 1.1s var(--ease) both; }
.comp-bar i:first-child { border-radius: 99px 3px 3px 99px; } .comp-bar i:last-child { border-radius: 3px 99px 99px 3px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.comp-legend span { display: inline-flex; align-items: center; white-space: nowrap; }
.comp-legend b { color: var(--ink); margin-left: 6px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* боковая плашка с ключевой метрикой: нейтральная, как остальные; цвет несут только изменения (зелёный/красный) */
.accent-panel { overflow: hidden; isolation: isolate; display: grid; gap: 18px; align-content: space-between; padding: 26px; }
.accent-panel .hero-value { font-size: clamp(40px, 4.6vw, 60px); }
.accent-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.accent-stats div { display: grid; gap: 2px; }
.accent-stats span { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.accent-stats b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.exp-list { display: grid; gap: 16px; }
.exp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.exp-row .nm { font-size: 14px; font-weight: 700; display: flex; align-items: center; }
.exp-row .vl { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.exp-row .vl small { color: var(--ink-3); font-weight: 700; margin-left: 6px; }
.exp-row .track { grid-column: 1 / -1; height: 10px; }

.list { display: grid; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 8px; border-radius: 14px; transition: background .15s, transform .15s var(--ease); }
.list-row + .list-row { margin-top: 2px; }
.list-row:hover { background: var(--panel-2); }
.list-row:active { transform: scale(.99); }
.list-row .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .r { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-row .r small { display: block; font-size: 12.5px; font-weight: 700; }
.ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); color: var(--ink); box-shadow: var(--inset); flex: none; }
.ico svg { width: 18px; height: 18px; }
.ico.accent { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.ico.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.ico.solid { background: var(--solid); color: var(--solid-ink); box-shadow: none; }

.donut-wrap { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: center; }
.donut-wrap .chart { height: 180px; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: minmax(0, 1fr); } }
.legend { display: grid; gap: 10px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.legend div { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.legend span { display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend span .dot { vertical-align: 0; }
.legend b { font-variant-numeric: tabular-nums; font-weight: 800; flex: none; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px 28px; }
.metric { display: grid; gap: 3px; }
.metric .l { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.metric .v { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .d { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-3); font-weight: 600; flex-wrap: wrap; }

.seg { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 4px; gap: 2px; box-shadow: var(--inset); }
.seg button, .seg a { border: none; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.seg button[aria-pressed="true"], .seg a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* появление панелей — один раз при загрузке */
@media (prefers-reduced-motion: no-preference) {
  .reveal > * { animation: rise .6s var(--ease) both; }
  .reveal > *:nth-child(2) { animation-delay: .05s; } .reveal > *:nth-child(3) { animation-delay: .1s; }
  .reveal > *:nth-child(4) { animation-delay: .15s; } .reveal > *:nth-child(5) { animation-delay: .2s; }
  .reveal > *:nth-child(6) { animation-delay: .25s; } .reveal > *:nth-child(n+7) { animation-delay: .3s; }
}
@keyframes rise { from { transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .hide-sm { display: none !important; }
  .panel, .hero, .accent-panel { padding: 18px; border-radius: 20px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; padding: 18px; }
  .kpi .value { font-size: 19px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .metric .v { font-size: 18px; }
  .pop-panel { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); min-width: 0; transform-origin: bottom center; }
  .toolbar, .filters { gap: 8px; }
  .tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; }
}

/* ---------- компоненты разделов ---------- */
.tabs.sm { margin: 0; box-shadow: none; background: var(--panel-2); padding: 4px; }
.tabs.sm .tab { padding: 6px 12px; font-size: 13px; }
.tabs.sm .tab.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.panel-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* лидер с крупным фото */
.leader { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: center; }
.leader .ph { width: 112px; height: 136px; border-radius: 18px; background: #FFFFFF; overflow: hidden; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: var(--ink-3); position: relative; }
.leader .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.leader .nm { font-weight: 800; font-size: 15px; line-height: 1.3; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.leader .big { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.leader .sm { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }

/* ABC */
.abc { display: grid; gap: 14px; }
.abc-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.abc-row .k { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--panel-2); }
.abc-row .k.a { background: var(--accent); color: var(--accent-ink); }
.abc-row .k.b { background: var(--ink); color: var(--panel); }
.abc-row .t { font-weight: 700; font-size: 14px; } .abc-row .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.abc-row .v { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.abc-tag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 11.5px; font-weight: 800; background: var(--panel-2); color: var(--ink-2); }
.abc-tag.a { background: var(--accent); color: var(--accent-ink); } .abc-tag.b { background: var(--ink); color: var(--panel); }

/* полоска доли в ячейке таблицы */
.cell-bar { display: grid; gap: 5px; min-width: 90px; }
.cell-bar .track { height: 6px; }

/* экономика одной штуки и чек заказа */
.unit-list { display: grid; gap: 2px; }
.unit-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.unit-row + .unit-row { border-top: 1px dashed var(--line); }
.unit-row b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit-row.head { color: var(--ink); font-size: 15px; }
.unit-row.total { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 12px; color: var(--ink); font-size: 16px; }
.unit-row.total b { font-size: 22px; letter-spacing: -0.02em; }
.unit-row .neg { color: var(--ink-2); }

/* воронка заказов полосой */
.stage-bar { display: flex; height: 12px; gap: 3px; border-radius: 99px; overflow: hidden; margin-top: 16px; }
.stage-bar i { display: block; height: 100%; min-width: 4px; border-radius: 3px; transform-origin: left; animation: fill 1s var(--ease) both; }
.st-accept { background: var(--warn); } .st-accepted { background: var(--c4); } .st-transit { background: var(--ink-3); }
.st-done { background: var(--c2); } .st-cancel { background: var(--down); } .st-return { background: var(--c3); }
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; }
.stages a { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; color: var(--ink); transition: background .2s; }
.stages a:hover { background: var(--panel-2); }
.stages a.on { background: var(--solid); color: var(--solid-ink); }
.stages a.on .t, .stages a.on .s { color: inherit; opacity: .75; }
.stages .t { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stages .v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stages .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.stages .sw { width: 10px; height: 10px; border-radius: 3px; }

/* мини-индекс качества */
.qmini { display: grid; gap: 14px; }
.qmini-row { display: grid; gap: 6px; }
.qmini-row .top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; }
.qmini-row .top b { font-variant-numeric: tabular-nums; }
.qmini-row .bar { height: 8px; border-radius: 99px; background: var(--panel-2); position: relative; box-shadow: var(--inset); }
.qmini-row .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.qmini-row .bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.qmini-row.good .bar i { background: var(--up); } .qmini-row.warn .bar i { background: var(--warn); } .qmini-row.bad .bar i { background: var(--down); } .qmini-row.flat .bar i { background: var(--ink-3); }

/* РНП */
.rnp-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.rnp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.rnp-stats div { display: grid; gap: 1px; }
.rnp-stats span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.rnp-stats b { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rnp-table table.data tr.key td { font-weight: 800; }
.rnp-table table.data tr.key td.metric { color: var(--ink); }
.rnp-table table.data th.today, .rnp-table table.data td.today { background: var(--panel-2); }
.rnp-table table.data td.tot, .rnp-table table.data th.tot { font-weight: 800; }

/* финансы */
.balance-big { font-size: clamp(36px, 4.4vw, 56px); font-weight: 700; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance-big .cur { font-size: .5em; color: var(--ink-3); margin-left: .12em; font-weight: 600; letter-spacing: 0; }
.kv-inline { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.kv-inline b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
table.data tr.group td { font-weight: 800; background: var(--panel-2); border-bottom: none; }
table.data tr.group td:first-child { border-radius: 12px 0 0 12px; } table.data tr.group td:last-child { border-radius: 0 12px 12px 0; }
table.data td.sub-row { padding-left: 26px; }
.amount-in { color: var(--up); } .amount-out { color: var(--ink); }
.cal { display: grid; gap: 2px; }
.cal-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-radius: 12px; }
.cal-row:hover { background: var(--panel-2); }
.cal-row .d { font-weight: 800; font-size: 13px; text-align: center; line-height: 1.1; }
.cal-row .d small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 700; }
.cal-row .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-row .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.cal-row .r { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-row .r small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.cal-row.gap .r small { color: var(--down); }

/* ---------- качество, склад, конкуренты, настройки ---------- */
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 760px) { .meters { grid-template-columns: minmax(0, 1fr); } }
.meter { display: grid; gap: 8px; }
.meter .l { font-size: 13.5px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.meter .v { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.meter .bar { height: 10px; border-radius: 99px; background: var(--panel-2); position: relative; box-shadow: var(--inset); }
.meter .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; transform-origin: left; animation: fill 1s var(--ease) both; }
.meter .bar b { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 2px; }
.meter.good .bar i { background: var(--up); } .meter.warn .bar i { background: var(--warn); } .meter.bad .bar i { background: var(--down); } .meter.flat .bar i { background: var(--ink-3); }
.meter .s { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }

.best { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 28px; }

.coverage { display: grid; gap: 10px; }
.coverage .progress { height: 14px; }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.side-menu { position: sticky; top: 14px; background: var(--panel); border-radius: var(--r-panel); padding: 10px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.side-menu a { padding: 9px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background .2s, color .2s; }
.side-menu a:hover { background: var(--panel-2); color: var(--ink); }
@media (max-width: 1080px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .side-menu { position: static; display: flex; overflow-x: auto; border-radius: 999px; padding: 5px; }
  .side-menu a { white-space: nowrap; border-radius: 999px; padding: 8px 14px; }
}
.settings-layout .panel { scroll-margin-top: 16px; }
.toggle-list { display: grid; gap: 4px; }
.toggle-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row .t { font-weight: 700; } .toggle-row .s { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--panel-3); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.cost-input { width: 110px; text-align: right; }
.rank { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank.first { background: var(--up-bg); color: var(--up); } .rank.other { background: var(--warn-bg); color: var(--warn); } .rank.none { background: var(--panel-2); color: var(--ink-3); }
.panel-head > *, .panel-tools, .panel-tools > * { min-width: 0; max-width: 100%; }
@media (max-width: 640px) { .panel-tools { width: 100%; } .panel-tools .tabs { width: 100%; } }

/* рейтинг карточки */
.rate { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.rate svg.i { width: 13px; height: 13px; fill: var(--c3); stroke: var(--c3); }

/* согласие на доступ приложения (OAuth) */
.consent { max-width: 460px; }
.levels { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.levels legend { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.level { display: grid !important; grid-template-columns: auto minmax(0, 1fr); gap: 12px !important; align-items: start; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); cursor: pointer; }
.level input { width: 18px !important; height: 18px; margin: 2px 0 0; padding: 0 !important; accent-color: var(--accent); }
.level .t { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.level .s { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.level:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent-actions .btn { justify-content: center; }
.token-once { display: grid; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--warn-bg); }
.token-once code, .mcp-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--panel); padding: 8px 10px; border-radius: 10px; user-select: all; display: block; }

/* сводный отчёт */
.col-hidden { display: none !important; }
.summary-table td.num b { display: block; font-weight: 700; }
.summary-table tr.total td.num b { font-weight: 800; }
.summary-table th.num { white-space: normal; min-width: 104px; vertical-align: bottom; }
.summary-table .sticky-col { min-width: 168px; }
.cols-panel { display: grid; gap: 6px; max-height: min(420px, 70vh); overflow: auto; min-width: 250px; }
.cols-panel .check { font-size: 13.5px; }
.cols-actions { display: flex; gap: 14px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }

/* пошаговые подсказки в настройках (бот Telegram, накладные) */
.steps-list { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
/* привязка рекламной кампании к товарам */
.camp-link { display: grid; gap: 3px; font-size: 13px; line-height: 1.35; white-space: normal; }
.camp-sku { display: block; color: var(--ink); }
.camp-actions { font-size: 12.5px; }
.camp-dialog { border: 0; padding: 22px; width: min(620px, calc(100vw - 32px)); border-radius: var(--r-panel); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop); }
.camp-dialog::backdrop { background: rgba(9, 10, 11, .5); }
.camp-dialog h3 { margin: 0 0 6px; font-size: 17px; }
.camp-dialog p { margin: 0 0 14px; font-size: 13px; }
.camp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; max-height: 55vh; overflow: auto; }
.camp-grid .check { font-size: 13px; line-height: 1.35; align-items: flex-start; }
.camp-grid .check input { flex: none; }
@media (max-width: 640px) { .camp-grid { grid-template-columns: 1fr; } }
/* конкуренты в поиске kaspi.kz */
.search-ours { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 14px; }
.search-our { display: grid; gap: 6px; align-content: start; padding: 12px 14px; border-radius: var(--r-inner); background: var(--panel-2); }
.search-our .name { font-weight: 700; font-size: 13.5px; line-height: 1.3; color: var(--ink); }
.search-our .s { font-size: 12.5px; color: var(--ink-2); }
.search-our .pill { justify-self: start; }
.search-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--ink-2); margin: 4px 0 10px; }
.search-stats b { color: var(--ink); }
.search-img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #FFFFFF; flex: none; }
tr.ours-row td { background: var(--up-bg); }
