/* ============================================================
   BSC Dashboard — минималистичная тема, светлая и тёмная
   ============================================================ */

:root {
  --bg:            #0b0e14;
  --bg-soft:       #0f1320;
  --surface:       #141927;
  --surface-2:     #1a2133;
  --surface-3:     #212a40;
  --text:          #e9edf6;
  --text-soft:     #aab4c8;
  --muted:         #78839a;
  --border:        rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.14);

  --accent:        #7c8cff;
  --accent-2:      #3ddbd9;
  --accent-soft:   rgba(124,140,255,.14);

  --good:          #35d6a4;
  --bad:           #ff6b7a;
  --warn:          #ffb545;

  --shadow-s: 0 1px 2px rgba(0,0,0,.28);
  --shadow-m: 0 8px 28px -12px rgba(0,0,0,.6);
  --shadow-l: 0 24px 60px -24px rgba(0,0,0,.75);

  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;

  --ease: cubic-bezier(.22,.8,.3,1);
  --fast: .18s var(--ease);
  --med:  .32s var(--ease);
  --slow: .6s  var(--ease);

  --font: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system,
          "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg:            #f4f6fb;
  --bg-soft:       #eef1f8;
  --surface:       #ffffff;
  --surface-2:     #f5f7fc;
  --surface-3:     #eaeefa;
  --text:          #0f1726;
  --text-soft:     #46516a;
  --muted:         #78839a;
  --border:        rgba(15,23,38,.09);
  --border-strong: rgba(15,23,38,.16);

  --accent:        #4f5ee8;
  --accent-2:      #0fb5b1;
  --accent-soft:   rgba(79,94,232,.1);

  --good:          #0faa78;
  --bad:           #e03b52;
  --warn:          #d9880d;

  --shadow-s: 0 1px 2px rgba(18,28,48,.06);
  --shadow-m: 0 10px 30px -16px rgba(18,28,48,.28);
  --shadow-l: 0 28px 64px -28px rgba(18,28,48,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background var(--med), color var(--med);
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.012em; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }

.num { font-variant-numeric: tabular-nums; }

/* ============================================================ Вход */

.login-body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg);
}

.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .42;
  animation: drift 22s var(--ease) infinite alternate;
}
.b1 { width: 46vw; height: 46vw; left: -8vw;  top: -12vw; background: var(--accent); }
.b2 { width: 38vw; height: 38vw; right: -6vw; top: 8vw;   background: var(--accent-2);
      animation-duration: 28s; animation-delay: -6s; }
.b3 { width: 34vw; height: 34vw; left: 28vw;  bottom: -16vw; background: #a855f7;
      opacity: .26; animation-duration: 34s; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(5vw,4vw,0) scale(1.18); }
}

.login-shell { position: relative; width: min(100%, 420px); padding: 24px; }

.login-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 34px 30px 26px;
  border-radius: var(--r-l);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow-l);
  animation: cardIn .6s var(--ease) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.login-mark { color: var(--accent); margin-bottom: 2px; }
.login-card h1 { font-size: 24px; }
.login-sub { margin: -8px 0 8px; color: var(--muted); font-size: 13px; }

.login-error {
  padding: 10px 13px;
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 34%, transparent);
  color: var(--bad);
  font-size: 13px;
  animation: shake .4s var(--ease);
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50%      { transform: translateX(-3px); }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); font-weight: 560; letter-spacing: .01em; }
.field input {
  padding: 11px 13px;
  border-radius: var(--r-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.btn-primary {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--r-s);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 10px 24px -14px var(--accent);
  transition: transform var(--fast), box-shadow var(--fast), filter var(--fast);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06);
                     box-shadow: 0 16px 30px -16px var(--accent); }
.btn-primary:active { transform: translateY(0) scale(.99); }
.btn-primary svg { transition: transform var(--fast); }
.btn-primary:hover svg { transform: translateX(3px); }

.login-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.login-hint code {
  padding: 1px 5px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-soft);
}

/* ============================================================ Шапка */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--accent); }
.brand div { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { color: var(--text); font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 11.5px; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: all var(--fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong);
                  background: var(--surface-2); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

[data-theme="dark"] .ico-sun,
[data-theme="light"] .ico-moon { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.avatar {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 12px; font-weight: 700;
}
.user-name { font-size: 12.5px; color: var(--text-soft); }
.logout { display: grid; place-items: center; width: 26px; height: 26px;
          border-radius: 50%; color: var(--muted); transition: all var(--fast); }
.logout:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ============================================================ Фильтры */

.filters {
  position: sticky; top: 59px; z-index: 30;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.filter-row { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-group.grow { flex: 1 1 auto; }
.filter-group > label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 650; white-space: nowrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.segmented button {
  padding: 6px 13px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 560;
  cursor: pointer; white-space: nowrap;
  transition: color var(--fast), background var(--fast), transform var(--fast);
}
.segmented button:hover { color: var(--text-soft); }
.segmented button.on {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}
.segmented.small button { padding: 5px 11px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px; font-weight: 560;
  cursor: pointer;
  transition: all var(--fast);
}
.chip:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong);
                             transform: translateY(-1px); }
.chip.on {
  background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.chip:disabled { opacity: .3; cursor: not-allowed; }

.dropdown { position: relative; }
.drop-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--fast);
}
.drop-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.dropdown.open .drop-toggle { border-color: var(--accent); color: var(--accent); }
.dropdown.open .drop-toggle svg { transform: rotate(180deg); }
.drop-toggle svg { transition: transform var(--fast); }

.drop-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  display: none; flex-direction: column; gap: 1px;
  min-width: 228px; max-height: 320px; overflow: auto;
  padding: 6px;
  border-radius: var(--r-m);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-l);
  animation: dropIn .18s var(--ease);
}
.dropdown.open .drop-menu { display: flex; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

.drop-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px;
  font-size: 13px; color: var(--text-soft);
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.drop-item:hover { background: var(--surface-2); color: var(--text); }
.drop-item .box {
  width: 15px; height: 15px; border-radius: 4px; flex: none;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  transition: all var(--fast);
}
.drop-item.on .box { background: var(--accent); border-color: var(--accent); }
.drop-item .box svg { opacity: 0; transform: scale(.6); transition: all var(--fast); color: #fff; }
.drop-item.on .box svg { opacity: 1; transform: none; }
.drop-sep { height: 1px; margin: 4px 2px; background: var(--border); }

.btn-ghost {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px; font-weight: 560;
  cursor: pointer;
  transition: all var(--fast);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong);
                   background: var(--surface); }

/* ============================================================ Вкладки */

.tabs {
  position: relative;
  display: flex; gap: 2px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tabs button {
  position: relative;
  padding: 13px 15px;
  border: 0; background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 570;
  cursor: pointer;
  transition: color var(--fast);
}
.tabs button:hover { color: var(--text-soft); }
.tabs button.on { color: var(--accent); }

.tab-ink {
  position: absolute; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px 2px 0 0;
  transition: left var(--med), width var(--med);
}

/* ============================================================ Сетка */

main { padding: 20px 22px 56px; display: block; }

.tab-panel { display: none; }
.tab-panel.on { display: flex; flex-direction: column; gap: 16px;
                animation: panelIn .36s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

.card {
  border-radius: var(--r-l);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  padding: 18px 20px 20px;
  transition: border-color var(--med), box-shadow var(--med), background var(--med);
}
.card:hover { box-shadow: var(--shadow-m); }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; }
.card-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .split-2 { grid-template-columns: 1fr; } }

/* ============================================================ Карточки KPI */

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1180px) { .hero-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .hero-grid { grid-template-columns: 1fr; } }

.hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px 16px;
  border-radius: var(--r-l);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  animation: riseIn .5s var(--ease) both;
  transition: transform var(--med), box-shadow var(--med), border-color var(--med);
}
.hero:hover { transform: translateY(-3px); box-shadow: var(--shadow-m);
              border-color: var(--border-strong); }
.hero::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--slow);
}
.hero.ready::after { transform: scaleX(1); }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-label { font-size: 12px; color: var(--muted); font-weight: 580;
              letter-spacing: .01em; text-transform: uppercase; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill.up   { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.pill.down { background: color-mix(in srgb, var(--bad)  15%, transparent); color: var(--bad);  }
.pill.flat { background: var(--surface-3); color: var(--muted); }

.hero-value { font-size: 30px; font-weight: 680; letter-spacing: -.028em; line-height: 1.05;
              font-variant-numeric: tabular-nums; }
.hero-value .unit { font-size: 15px; font-weight: 580; color: var(--muted); margin-left: 4px; }
.hero-foot { display: flex; align-items: center; justify-content: space-between;
             gap: 10px; font-size: 12px; color: var(--muted); }
.hero-plan { font-variant-numeric: tabular-nums; }

.hero-bar {
  position: relative; height: 5px; border-radius: 3px;
  background: var(--surface-3); overflow: hidden;
}
.hero-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .9s var(--ease);
}
.hero-bar.good i { background: linear-gradient(90deg, var(--good), var(--accent-2)); }
.hero-bar.bad  i { background: linear-gradient(90deg, var(--bad), var(--warn)); }

.hero-spark { height: 34px; margin: -2px -4px -6px; }

.gauge-wrap { display: flex; align-items: center; gap: 16px; }
.gauge { flex: none; }

.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .mini-grid { grid-template-columns: 1fr; } }

.mini {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-m);
  border: 1px solid var(--border);
  background: var(--surface);
  animation: riseIn .5s var(--ease) both;
  transition: transform var(--med), border-color var(--med);
}
.mini:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.mini-label { font-size: 12px; color: var(--muted); }
.mini-value { font-size: 19px; font-weight: 650; letter-spacing: -.02em;
              font-variant-numeric: tabular-nums; margin-top: 2px; }
.mini-right { text-align: right; }

/* ============================================================ Графики */

.chart-card .chart-host { width: 100%; }
.chart-host { position: relative; min-height: 60px; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; }

.c-grid     { stroke: var(--border); stroke-width: 1; }
.c-axis     { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-plan     { stroke: var(--muted); stroke-width: 2; fill: none;
              stroke-dasharray: 5 5; opacity: .85; }
.c-fact     { stroke-width: 2.6; fill: none;
              stroke-linecap: round; stroke-linejoin: round; }
.c-dot      { fill: var(--surface); stroke: var(--accent); stroke-width: 2.4; }
.c-dot-plan { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.c-hit      { fill: transparent; cursor: crosshair; }
.c-guide    { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0; }

.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
        animation: draw 1.1s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.fade-in { opacity: 0; animation: fadeIn .6s var(--ease) .35s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

.bar-rect { transition: opacity var(--fast); }
.bar-rect:hover { opacity: .82; }
.grow-x { transform-origin: left center; animation: growX .8s var(--ease) both; }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.grow-y { transform-box: fill-box; transform-origin: bottom center;
          animation: growY .8s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.chart-tip {
  position: absolute; z-index: 20; pointer-events: none;
  padding: 9px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-m);
  font-size: 12px;
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--fast), transform var(--fast);
  white-space: nowrap;
}
.chart-tip.on { opacity: 1; transform: none; }
.chart-tip b { display: block; margin-bottom: 4px; font-size: 12.5px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; color: var(--text-soft);
                  font-variant-numeric: tabular-nums; }
.chart-tip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; }

/* ============================================================ Списки */

.rank-list, .gap-list, .mover-list { display: flex; flex-direction: column; gap: 2px; }

.rank-row {
  display: grid; grid-template-columns: 24px 1fr 112px 56px;
  align-items: center; gap: 12px;
  padding: 9px 8px;
  border-radius: var(--r-s);
  cursor: default;
  animation: riseIn .45s var(--ease) both;
  transition: background var(--fast);
}
.rank-row:hover { background: var(--surface-2); }
.rank-pos { font-size: 12px; color: var(--muted); font-weight: 650; text-align: center; }
.rank-name { font-size: 13.5px; font-weight: 560; }
.rank-name small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.rank-track { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rank-track i { display: block; height: 100%; width: 0; border-radius: 4px;
                transition: width .9s var(--ease); }
.rank-val { text-align: right; font-size: 13px; font-weight: 650;
            font-variant-numeric: tabular-nums; }

.mover-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px;
  border-radius: var(--r-s);
  animation: riseIn .45s var(--ease) both;
  transition: background var(--fast), transform var(--fast);
}
.mover-row:hover { background: var(--surface-2); transform: translateX(2px); }
.mover-main { flex: 1 1 auto; min-width: 0; }
.mover-name { font-size: 13.2px; font-weight: 560; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.mover-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.mover-nums { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.mover-fact { font-size: 13px; font-weight: 620; }
.mover-plan { font-size: 11.5px; color: var(--muted); }

.tagdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tagdot.ok   { background: var(--good); }
.tagdot.fail { background: var(--bad); }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em;
  background: var(--surface-3); color: var(--muted);
}
.badge.stom { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge.mc   { background: color-mix(in srgb, var(--accent-2) 18%, transparent);
              color: var(--accent-2); }

.gap-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 8px; border-radius: var(--r-s);
  animation: riseIn .45s var(--ease) both;
}
.gap-row:hover { background: var(--surface-2); }
.gap-amount { font-size: 14px; font-weight: 680; color: var(--bad);
              font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================ Таблицы */

.table-wrap { overflow: auto; margin: 0 -6px; padding: 0 6px; max-height: 70vh; }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 10px;
  text-align: right;
  font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.grid thead th:first-child,
table.grid thead th.left { text-align: left; }
table.grid thead th.sortable { cursor: pointer; user-select: none; }
table.grid thead th.sortable:hover { color: var(--text); }
table.grid thead th .arr { opacity: .4; margin-left: 3px; }
table.grid thead th.sorted .arr { opacity: 1; color: var(--accent); }

table.grid tbody td {
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}
table.grid tbody td:first-child,
table.grid tbody td.left { text-align: left; color: var(--text); }
table.grid tbody tr { transition: background var(--fast); }
table.grid tbody tr:hover > td { background: var(--surface-2); }
table.grid tbody tr.row-in { animation: rowIn .4s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

td.strong { color: var(--text); font-weight: 620; }
td.good { color: var(--good); font-weight: 620; }
td.bad  { color: var(--bad);  font-weight: 620; }

.cell-name { display: flex; align-items: center; gap: 8px; }
.cell-name small { color: var(--muted); }

.mini-track { display: inline-block; width: 70px; height: 6px; border-radius: 3px;
              background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.mini-track i { display: block; height: 100%; width: 0; border-radius: 3px;
                transition: width .8s var(--ease); }

tr.kpi-row { cursor: pointer; }
tr.kpi-detail > td { background: var(--surface-2); padding: 0; }
.detail-box { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px;
              animation: panelIn .25s var(--ease); }
.detail-chip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 11px; min-width: 128px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
}
.detail-chip b { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.detail-chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.detail-note { width: 100%; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }

/* ============================================================ Тепловая карта */

.heat-wrap { overflow: auto; }
.heat {
  display: grid; gap: 4px; min-width: 520px;
  justify-content: start;
  font-size: 12px;
}
.heat-h { font-size: 11px; color: var(--muted); font-weight: 650;
          text-align: center; padding-bottom: 2px; }
.heat-r { font-size: 12px; color: var(--text-soft); display: flex; align-items: center;
          padding-right: 8px; white-space: nowrap; }
.heat-c {
  position: relative;
  display: grid; place-items: center;
  height: 36px; border-radius: 8px;
  font-weight: 620; font-variant-numeric: tabular-nums;
  color: #fff;
  cursor: default;
  animation: popIn .4s var(--ease) both;
  transition: transform var(--fast), box-shadow var(--fast);
}
.heat-c:hover { transform: scale(1.06); box-shadow: var(--shadow-m); z-index: 2; }
.heat-c.empty { background: var(--surface-2); color: var(--muted); font-weight: 400; }
@keyframes popIn { from { opacity: 0; transform: scale(.88); } to { opacity: 1; } }

.heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 12px;
               font-size: 11.5px; color: var(--muted); }
.heat-scale { width: 160px; height: 8px; border-radius: 4px;
              background: linear-gradient(90deg, #e0455c, #e8a33d, #2fbf8f); }

/* ============================================================ Прочее */

.search {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; background: transparent; outline: none; width: 220px;
                font-size: 12.5px; }

.files-list { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
}
.file-row b { font-weight: 600; }
.file-row span { color: var(--muted); font-size: 11.5px; }

.note-card .notes { margin: 0; padding-left: 18px; color: var(--text-soft);
                    font-size: 13px; line-height: 1.75; }
.note-card .notes b { color: var(--text); }

.empty-state { padding: 34px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state svg { opacity: .35; margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border-radius: var(--r-m);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-l);
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--med), transform var(--med);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }

.loading-bar {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: width .4s var(--ease), opacity .2s;
}
.loading-bar.on { opacity: 1; }

.skeleton {
  border-radius: var(--r-s);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%,
                                      var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }

main.busy { opacity: .55; transition: opacity var(--fast); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px;
                            border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 760px) {
  .topbar, .filters, .tabs, main { padding-left: 14px; padding-right: 14px; }
  .user-name { display: none; }
  .filters { position: static; }
  .filter-row { gap: 12px; }
  .search input { width: 140px; }
}
