@font-face { font-family: 'Golos Text'; font-weight: 400; font-display: swap; src: url('../fonts/golos-text-cyrillic-400-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 400; font-display: swap; src: url('../fonts/golos-text-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'Golos Text'; font-weight: 500; font-display: swap; src: url('../fonts/golos-text-cyrillic-500-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 500; font-display: swap; src: url('../fonts/golos-text-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'Golos Text'; font-weight: 600; font-display: swap; src: url('../fonts/golos-text-cyrillic-600-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 600; font-display: swap; src: url('../fonts/golos-text-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'Golos Text'; font-weight: 700; font-display: swap; src: url('../fonts/golos-text-cyrillic-700-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 700; font-display: swap; src: url('../fonts/golos-text-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }

:root {
  --bg: #f2f2f2;
  --card: #ffffff;
  --line: #e7e7e7;
  --line-strong: #d6d6d6;
  --ink: #1a1a1a;
  --ink-2: #5c5c5c;
  --ink-3: #8f8f8f;
  --accent: #ffdb4d;
  --accent-hover: #ffd21e;
  --accent-ink: #1a1a1a;
  --link: #1f6fd6;
  --good: #1a9b4b;
  --bad: #d9363e;
  --hover: #f7f7f7;
  --sel: #fff6cc;
  --c1: #4d8fe8; --c2: #ffb000; --c3: #3dbd7d; --c4: #f05c5c; --c5: #9b6bd9; --c6: #2fc2d1; --c7: #ff8a3d; --c8: #8a8f99;
  --radius: 12px;
  --font: 'Golos Text', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; background: #fff; border-color: var(--line-strong); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none !important; color: var(--ink); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #c4c4c4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-lg { height: 48px; padding: 0 24px; font-size: 16px; border-radius: 10px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.input { height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; width: 100%; outline: none; }
.input:focus, textarea.input:focus { border-color: #b8a33a; box-shadow: 0 0 0 3px rgba(255, 219, 77, .45); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.error-text { color: var(--bad); font-size: 13px; }
.ok-text { color: var(--good); font-size: 13px; }
code, .code { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }
.code-block { background: #1f1f1f; color: #f2f2f2; border-radius: 8px; padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.6; }

/* ---------- логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none !important; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 18px; height: 18px; }

/* ---------- каркас кабинета ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 20px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--ink-2); font-size: 13px; }
.site-switch { position: relative; }
.site-switch select { appearance: none; height: 34px; padding: 0 32px 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; max-width: 280px; cursor: pointer; }

.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; text-decoration: none; }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--sel); font-weight: 600; }
.nav a svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.nav .nav-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 14px 12px 6px; }
.main { padding: 20px 24px 48px; min-width: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--ink-3); font-size: 13px; }
.periods { display: inline-flex; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 2px; flex-wrap: wrap; }
.periods button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.periods button:hover { background: var(--hover); }
.periods button.on { background: var(--accent); font-weight: 500; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.custom-range input { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; background: #fff; }

/* ---------- карточки и виджеты ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); min-width: 0; }
.card h2 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .more { margin-left: auto; font-size: 13px; font-weight: 400; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line); margin: -4px -20px 14px; }
.kpi { padding: 4px 20px 14px; border-right: 1px solid var(--line); cursor: pointer; border-bottom: 3px solid transparent; }
.kpi:last-child { border-right: 0; }
.kpi.on { border-bottom-color: var(--accent); }
.kpi .label { color: var(--ink-2); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -0.02em; }
.kpi .delta { font-size: 12.5px; margin-top: 2px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }

.chart { width: 100%; height: 300px; }
.chart-sm { height: 220px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- таблицы отчётов ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; }
table.report { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.report th { text-align: right; font-weight: 500; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
table.report th:first-child, table.report td:first-child { text-align: left; padding-left: 20px; }
table.report th:last-child, table.report td:last-child { padding-right: 20px; }
table.report td { text-align: right; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.report tbody tr:hover { background: var(--hover); }
table.report tr.total td { font-weight: 600; background: #fafafa; }
td.dim { max-width: 460px; overflow: hidden; text-overflow: ellipsis; position: relative; }
td.dim .bar { position: absolute; left: 0; top: 4px; bottom: 4px; background: rgba(255, 219, 77, .35); border-radius: 0 4px 4px 0; z-index: 0; }
td.dim .txt { position: relative; z-index: 1; }
td.dim .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f2f2f2; font-size: 13.5px; position: relative; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .k { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .v { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.mini-list .p { width: 48px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -20px 4px; padding: 0 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 9px 10px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

.empty { text-align: center; color: var(--ink-3); padding: 36px 12px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.notice { background: var(--sel); border-radius: 10px; padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.notice.info { background: #eaf2fd; }
.notice b { font-weight: 600; }
.badge { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #f0f0f0; color: var(--ink-2); font-weight: 500; }
.badge.live { background: #e3f6ea; color: var(--good); }
.badge.ai { background: #f1eafc; color: #7244c4; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; box-shadow: 0 0 0 0 rgba(26, 155, 75, .5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(26, 155, 75, .45); } 70% { box-shadow: 0 0 0 8px rgba(26, 155, 75, 0); } 100% { box-shadow: 0 0 0 0 rgba(26, 155, 75, 0); } }

.big-number { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { width: 36px; height: 20px; appearance: none; background: #d4d4d4; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: #2b2b2b; }
.switch input:checked::after { transform: translateX(16px); }

.public-banner { background: #1f1f1f; color: #f2f2f2; padding: 10px 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.public-banner a { color: var(--accent); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f1f1f; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; font-size: 13.5px; }

/* ---------- список счётчиков ---------- */
.counters td.dim a { font-weight: 500; }

/* ---------- адаптив ---------- */
.menu-toggle { display: none; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-right: 0; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; height: auto; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0, 0, 0, .08); }
  body.menu-open .sidebar { transform: none; }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 40px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .user { display: none; }
  .site-switch select { max-width: 170px; }
  .table-wrap { margin: 0 -16px; }
  .card { padding: 16px; }
  .kpis { margin: -4px -16px 14px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-right: 0; padding: 4px 16px 12px; }
  .kpi .value { font-size: 20px; }
  .topbar .logo span:not(.logo-mark) { display: none; }
}

/* ---------- переключатель языка ---------- */
.lang-switch { display: inline-flex; align-items: center; justify-content: center; height: 30px; min-width: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink); text-decoration: none !important; letter-spacing: .03em; background: #fff; }
.lang-switch:hover { background: var(--hover); }

/* ---------- AI-разбор ---------- */
.ai-card { background: linear-gradient(180deg, #fffbea 0%, #fff 60%); }
.ai-card .ai-text { font-size: 15.5px; line-height: 1.6; margin: 10px 0 8px; max-width: 900px; }
.ai-card .ai-text.muted { color: var(--ink-2); }

/* ---------- инструменты (генератор UTM) ---------- */
.tool { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin: 8px 0 36px; display: grid; gap: 18px; font-size: 14px; line-height: 1.45; box-shadow: 0 16px 40px -28px rgba(0,0,0,.25); }
.tool .input { font-size: 15px; }
.tool .req { color: var(--ink-3); font-size: 11.5px; margin-left: 4px; }
.tool-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tool-presets .btn.on { background: var(--sel); border-color: #e8cf5c; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.tool-check input { accent-color: #1a1a1a; width: 16px; height: 16px; }
.tool-check { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.tool-out { background: #fffbea; border-radius: 12px; padding: 16px; display: grid; gap: 10px; }
.tool-result { font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; color: var(--ink); user-select: all; }
.tool-result.is-empty { font-family: inherit; color: var(--ink-3); user-select: auto; }
.tool-out .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-warn { margin: 0; padding-left: 18px; color: #8a5a00; font-size: 13px; }
.tool-warn:empty { display: none; }
.tool-warn li { margin: 2px 0; color: inherit; }
@media (max-width: 640px) {
  .tool { padding: 16px; }
  .tool-grid { grid-template-columns: 1fr; }
}
.calc h3 { margin: 0; font-size: 18px; }
.calc-big { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.calc-big.is-empty { font-size: 15px; font-weight: 400; color: var(--ink-3); }
.calc-need { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.calc-need:empty { display: none; }
