@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/public/fonts/inter-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/public/fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/public/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --page: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e2e5ea;
  --grid: #eceef1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fb;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --neutral: #b8bec8;
  --ok: #138a4b;
  --ok-soft: #e7f5ed;
  --warn: #b45309;
  --warn-soft: #fdf3e4;
  --bad: #c2352f;
  --bad-soft: #fcebea;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #111214;
    --surface: #1a1b1e;
    --surface-2: #212226;
    --border: #2e3036;
    --grid: #2a2c31;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9b9a92;
    --accent: #4b8de6;
    --accent-ink: #0b0b0b;
    --accent-soft: #1d2a3d;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --neutral: #5b5f68;
    --ok: #3fb97a;
    --ok-soft: #16281e;
    --warn: #e0a043;
    --warn-soft: #2c2216;
    --bad: #ec6b65;
    --bad-soft: #301a19;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111214;
  --surface: #1a1b1e;
  --surface-2: #212226;
  --border: #2e3036;
  --grid: #2a2c31;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #9b9a92;
  --accent: #4b8de6;
  --accent-ink: #0b0b0b;
  --accent-soft: #1d2a3d;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --neutral: #5b5f68;
  --ok: #3fb97a;
  --ok-soft: #16281e;
  --warn: #e0a043;
  --warn-soft: #2c2216;
  --bad: #ec6b65;
  --bad-soft: #301a19;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 400 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-wide { width: 100%; height: 44px; font-size: 14px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn:focus-visible, .select:focus-visible, .seg button:focus-visible, .lang-btn:focus-visible, .field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 22px; }
.gate-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 22px; }
.gate-loading { display: flex; justify-content: center; padding: 22px 0; }
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--grid);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input {
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}
.field input:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.msg { font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); border: 1px solid transparent; }
.msg.msg-info { background: var(--accent-soft); color: var(--text); }
.msg.msg-ok { background: var(--ok-soft); color: var(--ok); }
.hint { margin: -6px 0 0; font-size: 12px; color: var(--text-3); }
.gate-state { text-align: center; padding: 8px 0 4px; display: grid; gap: 10px; justify-items: center; }
.gate-state h2 { font-size: 18px; }
.gate-state p { margin: 0; color: var(--text-2); }
.state-dot { width: 12px; height: 12px; border-radius: 50%; }
.state-dot-warn { background: var(--warn); }
.gate-langs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.lang-btn {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.lang-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.dash { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.top-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-titles { min-width: 0; }
.top-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.top-region { font-size: 12px; color: var(--text-2); }
.top-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  border: 0;
  background: transparent;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.select {
  height: 38px;
  padding: 0 32px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  appearance: none;
  font-size: 13px;
  font-weight: 600;
  max-width: 240px;
  cursor: pointer;
}
.select-sm { max-width: 150px; }
.range { display: inline-flex; align-items: center; gap: 6px; }
.range-sep { color: var(--text-3); }
.select.date { padding: 0 10px; background-image: none; max-width: 150px; font-variant-numeric: tabular-nums; }
.select.date.bad { border-color: var(--bad); }
.menu { position: relative; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: grid;
}
.menu-org { padding: 8px 10px 10px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-pop button {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.menu-pop button:hover { background: var(--surface-2); }

.body { flex: 1; padding: 20px 24px 28px; display: grid; gap: 16px; align-content: start; transition: opacity 0.2s; }
.body.loading { opacity: 0.55; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 15px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  align-content: start;
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--text-3); }
@supports (grid-template-rows: subgrid) {
  .kpis { grid-auto-rows: auto; }
  .kpi { grid-row: span 3; grid-template-rows: subgrid; row-gap: 4px; align-content: stretch; }
  .kpi-label, .kpi-sub { align-self: start; }
  .kpi-value { align-self: end; }
}

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
@media (max-width: 1500px) {
  .span-3 { grid-column: span 6; }
  .span-6 { grid-column: span 12; }
}
@media (max-width: 1180px) {
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .span-3 { grid-column: span 12; }
  .top { padding: 10px 16px; }
  .body { padding: 16px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 6px; }
  .top-controls { width: 100%; }
  .select { flex: 1; max-width: none; }
  .range { width: 100%; }
  .select.date { max-width: none; }
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.card-head h3 { font-size: 14px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-1 { background: var(--s1); }
.sw-2 { background: var(--s2); }
.sw-3 { background: var(--s3); }
.sw-n { background: var(--neutral); }

.chart { position: relative; height: 230px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .ax { fill: var(--text-3); font-size: 11px; }
.chart .gl { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit.on { fill: var(--grid); fill-opacity: 0.55; }
.f1 { fill: var(--s1); }
.f2 { fill: var(--s2); }
.f3 { fill: var(--s3); }
.fn { fill: var(--neutral); }
.empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-3); font-size: 13px; border: 1px dashed var(--border); border-radius: 10px; }

.emp-block + .emp-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--grid); }
.emp-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.segbar { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; background: var(--grid); }
.segbar span { display: block; height: 100%; min-width: 2px; }
.segbar span.s1 { background: var(--s1); }
.segbar span.s2 { background: var(--s2); }
.segbar span.s3 { background: var(--s3); }
.segbar span.sn { background: var(--neutral); }
.rows { display: grid; gap: 6px; margin-top: 10px; }
.row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; font-size: 13px; }
.row-label { color: var(--text-2); }
.row-val { font-weight: 700; text-align: right; }
.row-pct { color: var(--text-3); font-size: 12px; min-width: 44px; text-align: right; }
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 10px; font-size: 12px; }
.hbar-label { color: var(--text-2); }
.hbar-track { height: 10px; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 0; }
.hbar-val { font-weight: 700; text-align: right; }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; white-space: normal; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--text-3); }
td.name { font-weight: 600; min-width: 180px; }
tr.dim td.name { font-weight: 500; }
.inl { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inl-bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.inl-bar i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-off { background: var(--surface-2); color: var(--text-3); }
.cell-sub { display: block; margin-top: 4px; }

.qlist { display: grid; }
.q { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.q:first-child { padding-top: 2px; }
.q:last-child { border-bottom: 0; }
.q-label { color: var(--text-2); }
.q-val { font-weight: 700; font-size: 15px; white-space: nowrap; }

.foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px; font-size: 12px; color: var(--text-3); padding: 4px 2px 0; }
.dash-error { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14); font-weight: 600; z-index: 40; }

.tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  min-width: 150px;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  font-size: 12px;
}
.tip-title { font-weight: 700; margin-bottom: 5px; }
.tip-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip-row b { font-weight: 700; }

.dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  width: min(400px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog h3 { font-size: 17px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--surface); font-weight: 600; font-size: 13px; z-index: 60; }

@media (min-width: 2200px) {
  body { font-size: 15px; }
  .kpi-value { font-size: 32px; }
  .chart { height: 270px; }
}
