/* Digital Buro — фирменные цвета с buro.digital */
:root {
  --blue: #0055ff;
  --blue-2: #3287ff;
  --blue-soft: #c4d7ff;
  --navy: #142e54;
  --navy-2: #10274a;
  --coral: #ff8562;
  --bg: #f2f3f7;
  --panel: #ffffff;
  --line: #e7e9f0;
  --ink: #142e54;
  --muted: #8c95a3;
  --good: #12a36b;
  --bad: #e5484d;
  --warn: #d98a00;
  --bar: #9fc0ff;
  --bar-strong: #0055ff;
  --grid: #eceef4;
  --shadow: 0 1px 2px rgba(16, 39, 74, .06), 0 8px 24px rgba(16, 39, 74, .06);
  --radius: 14px;
  --font: Manrope, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1424; --panel: #10203a; --line: #1d3254; --ink: #e9eef8; --muted: #8fa0bb;
    --navy: #e9eef8; --bar: #2a5cc4; --bar-strong: #4f86ff; --grid: #182a47; --blue-soft: #1b3870;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
  .brand img, .lock-logo { filter: brightness(0) invert(1); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--blue); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

/* вход */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 80% -10%, rgba(0, 85, 255, .14), transparent), var(--bg); }
.lock-card { width: min(400px, 100%); background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; display: grid; gap: 14px; }
.lock-logo { height: 44px; justify-self: start; }
.lock-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.lock-card p { margin: 0; }
.lock-card input[type=password] { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 15px; }
.lock-card input[type=password]:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.lock-card button { padding: 12px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.lock-card button:disabled { opacity: .6; cursor: progress; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.lock-msg { min-height: 1.2em; color: var(--bad); font-size: 13px; }

/* каркас: проекты слева, содержимое справа */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.brand { display: block; padding: 0 8px; }
.brand img { height: 46px; display: block; }
.yd { display: flex; align-items: center; gap: 10px; margin: 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 12.5px; line-height: 1.25; color: var(--muted); }
.yd b { color: var(--ink); font-size: 14px; }
.yd img, .yd-logo { width: 34px; height: 34px; flex: none; display: block; border-radius: 50%; }
.yd-mark { flex: none; width: 32px; height: 32px; border-radius: 50%; background: #fc3f1d; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.side-cap { padding: 4px 10px 0; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.plist { display: grid; gap: 2px; }
.pitem { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--ink); transition: background .18s ease, color .18s ease, transform .18s ease; }
.pitem:hover { background: var(--bg); }
.pitem:active { transform: scale(.98); }
.pitem[aria-current=page] { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0, 85, 255, .28); }
.pe { flex: none; width: 22px; text-align: center; font-size: 17px; line-height: 1.25; }
.pn { display: grid; gap: 2px; min-width: 0; }
.pt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palert { font-size: 11.5px; font-weight: 800; color: var(--bad); white-space: normal; line-height: 1.25; }
.pitem[aria-current=page] .palert { color: #ffe1e1; }
.side-foot { margin-top: auto; padding: 8px 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.side-foot a { color: var(--muted); text-decoration: none; }
.side-foot a:hover { color: var(--blue); }
.scrim { display: none; }
.main { min-width: 0; max-width: 1720px; width: 100%; padding: 0 28px 40px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 18px; }
.top-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.burger { display: none; flex: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .25s ease, opacity .25s ease; }
.top-title { flex: 1; min-width: 200px; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.top-title h1 { margin: 2px 0 0; font-size: 28px; font-weight: 800; line-height: 1.15; }
.top-meta { font-size: 13px; color: var(--muted); text-align: right; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; transition: background .18s, color .18s, border-color .18s, transform .12s; white-space: nowrap; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn:active { transform: scale(.97); }
.btn-reset { color: var(--bad); border-color: currentColor; background: transparent; padding: 6px 12px; }
.btn-reset:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-top: 14px; background: var(--panel); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .qsel > span { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.field select, .field input[type=date], .qsel select { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 11px; min-width: 0; max-width: 100%; transition: border-color .18s; }
.field select:hover, .field input[type=date]:hover, .qsel select:hover { border-color: var(--blue-soft); }
.period { display: flex; align-items: center; gap: 6px; }
.period .dash { color: var(--muted); }
.seg { position: relative; display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: 0; opacity: 0; border-radius: 8px; background: var(--blue); box-shadow: 0 3px 10px rgba(0, 85, 255, .3); transition: transform .32s cubic-bezier(.3, .9, .3, 1.15), width .32s cubic-bezier(.3, .9, .3, 1.15); }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 700; transition: color .25s; }
.seg button[aria-pressed=true] { color: #fff; }
.switch { display: flex; align-items: center; gap: 10px; padding-bottom: 7px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background .25s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s cubic-bezier(.3, .9, .3, 1.3); }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch span { font-size: 14px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 600; }
.qf { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 10px; padding: 0 2px; }
.qsel { display: grid; gap: 4px; min-width: 0; }
.qsel select { max-width: 340px; }
.qchip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--navy); font-weight: 700; font-size: 13px; animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.tabs { position: relative; display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 11px 16px 12px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 15px; white-space: nowrap; transition: color .2s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); }
.tabs-ink { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; border-radius: 3px 3px 0 0; background: var(--blue); transition: transform .35s cubic-bezier(.3, .9, .3, 1.1), width .35s cubic-bezier(.3, .9, .3, 1.1); }

/* содержимое */
.view { display: grid; gap: 18px; margin-top: 18px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.card .note { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
.grid-main { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.kpi { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; transition: transform .2s ease, box-shadow .2s ease; }
.kpi:hover { transform: translateY(-2px); }
.kpi .k-label { font-size: 13px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val { font-size: 30px; font-weight: 800; line-height: 1.2; margin-top: 4px; color: var(--blue); font-variant-numeric: tabular-nums; }
.kpi.cost .k-val, .kpi.cpa .k-val, .kpi.cpc .k-val { color: var(--coral); }
.kpi .k-delta { font-size: 13px; margin-top: 2px; font-weight: 700; min-height: 1.3em; font-variant-numeric: tabular-nums; }
.up-good, .down-good { color: var(--good); }
.up-bad, .down-bad { color: var(--bad); }
.neutral { color: var(--muted); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font); font-size: 12px; }
.chart text.vlab { fill: var(--ink); font-weight: 800; font-size: 12px; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.chart rect.bar { transition: opacity .2s; }
.chart svg:hover rect.bar { opacity: .9; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* таблицы в стиле DataLens: полоса в ячейке */
.tbox { overflow: auto; max-height: 620px; border: 1px solid var(--line); border-radius: 10px; }
table.t { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.t th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap; cursor: pointer; user-select: none; }
.t th:first-child, .t td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 2; }
.t th:first-child { z-index: 3; }
.t th[aria-sort=ascending]::after { content: ' ↑'; color: var(--blue); }
.t th[aria-sort=descending]::after { content: ' ↓'; color: var(--blue); }
.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; position: relative; }
.t td:first-child { white-space: normal; min-width: 180px; max-width: 360px; }
.t td .b { position: absolute; left: 6px; top: 7px; bottom: 7px; border-radius: 3px; background: var(--bar); opacity: .55; z-index: 0; }
.t td .v { position: relative; z-index: 1; }
.t tr.total td { font-weight: 800; background: var(--bg); border-bottom: 0; }
.t tr.total td:first-child { background: var(--bg); }
.t tbody tr:hover td { background: rgba(0, 85, 255, .04); }
.t tr[data-click] { cursor: pointer; }
.t tr.sel td, .t tr.sel td:first-child { background: rgba(0, 85, 255, .1); font-weight: 800; }
.t tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.t tr.dim td { opacity: .55; }
.t tr.dim:hover td { opacity: 1; }
.t td.wrap { white-space: normal; text-align: left; min-width: 220px; }
.t th.l, .t td.l { text-align: left; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.empty { color: var(--muted); padding: 16px 0; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pills button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); }
.pills button[aria-pressed=true] { color: #fff; background: var(--blue); border-color: var(--blue); }
.tests { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.test { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.test h3 { margin: 0; font-size: 14px; }
.test p { margin: 0; font-size: 12.5px; }
.test .meta { font-size: 11.5px; color: var(--muted); }
.ice { font-weight: 800; color: var(--blue); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; max-width: 320px; }
.tip b { display: block; margin-bottom: 4px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.foot { margin-top: 28px; color: var(--muted); font-size: 12px; text-align: center; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
/* бюджет месяца */
.bgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.bgrid div { display: grid; gap: 2px; }
.bgrid span { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.bgrid b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bgrid b.up-bad { color: var(--bad); }
.bgrid b.warn-t, .warn-t { color: var(--warn); }
.bbar { position: relative; height: 10px; border-radius: 999px; background: var(--bg); margin-top: 14px; overflow: visible; }
.bbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--blue-2), var(--blue)); transition: width .6s cubic-bezier(.3, .9, .3, 1); }
.bbar em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
/* тесты: бюджет и прогноз */
.tmoney { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.tmoney div { display: grid; gap: 2px; }
.tmoney span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.tmoney b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* требует внимания */
.icount { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.ic { display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 12px; border-radius: 10px; background: var(--bg); font-weight: 700; color: var(--muted); }
.ic b { font-size: 20px; color: var(--ink); }
.ic.bad b { color: var(--bad); }
.ic.warn b { color: var(--warn); }
.t td a { font-weight: 700; text-decoration: none; white-space: nowrap; }

/* планшет и телефон: проекты в выдвижной панели */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .3s cubic-bezier(.3, .9, .3, 1); box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .nav-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(10, 20, 40, .45); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-open .burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-open .burger span:nth-child(2) { opacity: 0; }
  .nav-open .burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  .burger { display: flex; }
  .main { padding: 0 16px 32px; }
}
@media (max-width: 720px) {
  .top { position: static; }
  .top-title { min-width: 0; }
  .top-title h1 { font-size: 21px; }
  .top-meta { text-align: left; width: 100%; order: 3; }
  #pdf-btn { padding: 9px 11px; }
  .filters { padding: 12px; }
  .filters .field { flex: 1 1 140px; }
  .filters .field-period, .filters .field-gran { flex: 1 1 100%; }
  .period input[type=date] { flex: 1; min-width: 0; }
  .seg { display: flex; }
  .seg button { flex: 1; padding: 7px 4px; }
  .qsel { flex: 1 1 140px; }
  .qsel select { max-width: none; width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi .k-val { font-size: 21px; }
  .kpi .k-delta { font-size: 11.5px; }
  .card { padding: 14px; }
  .tabs button { padding: 10px 12px; font-size: 14px; }
  .t td:first-child { min-width: 140px; }
}

/* печать / сохранение в PDF: только содержимое текущего вида */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  :root { --bg: #fff; --panel: #fff; --shadow: none; color-scheme: light; }
  html, body { background: #fff; color: #142e54; font-size: 12px; }
  .side, .scrim, .burger, #pdf-btn, .tabs, .qf .btn-reset, .foot, .tip { display: none !important; }
  .app { display: block; }
  .main { max-width: none; padding: 0; }
  .top { position: static; }
  .filters { box-shadow: none; border: 1px solid #e7e9f0; }
  .card, .kpi { box-shadow: none; border: 1px solid #e7e9f0; break-inside: avoid; }
  .grid-main { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; } /* широкие таблицы (регион, посадка, срезы) — каждая на всю ширину страницы, без наложения */
  .tbox { max-height: none; overflow: visible; border: 0; }
  table.t { width: 100%; table-layout: auto; font-size: 10px; }
  .t th, .t td { position: static !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; word-break: break-word; padding: 4px 6px; max-width: none !important; min-width: 0 !important; }
  .t th:not(:first-child), .t td:not(:first-child):not(.wrap):not(.l) { white-space: nowrap !important; } /* числа не переносятся */
  .t th:first-child, .t td:first-child { min-width: 90px !important; background: transparent; }
  .t thead { display: table-header-group; } /* заголовок повторяется на каждой странице */
  .t tr { break-inside: avoid; page-break-inside: avoid; }
  .card:has(table.t) { break-inside: auto; }
  .card > h2 { break-after: avoid; }
  .t td .b { display: none; }
  .tslot, .tbox { width: 100%; }
  .view { animation: none; }
  .brand img, .lock-logo { filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- режим администратора ---------- */
.side-foot { display: flex; flex-direction: column; gap: 6px; }
body.is-admin #admin-link { color: var(--warn); font-weight: 700; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.abar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 10px 0 12px; padding: 10px 12px; border: 1px dashed var(--warn); border-radius: 10px; font-size: 13px; }
.abar > span { margin-right: auto; }
.t td input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--blue); }
.modal { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--panel); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal::backdrop { background: rgba(8, 14, 28, .45); }
.modal form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.modal h2 { margin: 0; font-size: 18px; }
.modal input[type=password] { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 15px; }
.modal .muted { margin: 0; font-size: 13px; }
.mbtn { display: flex; justify-content: flex-end; gap: 8px; }
.mlist { margin: 0; padding-left: 22px; max-height: 42vh; overflow: auto; font-size: 13px; line-height: 1.4; }
.mlist li { margin-bottom: 6px; }
.aadd { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.aadd select { flex: 1 1 260px; min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 8px 11px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
@media print { .abar, .toast, #admin-link { display: none !important; } }

/* ---------- этап 1: период, статус в меню, выводы, выбор кампаний, журнал ---------- */
.dbx-period{display:flex;flex-wrap:nowrap;gap:5px;margin:0 0 0 auto;align-self:flex-end;padding-bottom:6px}.dbx-period button{white-space:nowrap}
.dbx-period button{font:inherit;font-size:13px;padding:5px 12px;border:1px solid var(--line,#dfe3ec);border-radius:999px;background:transparent;color:inherit;cursor:pointer}
.dbx-period button[aria-pressed=true]{background:var(--blue,#0055ff);border-color:var(--blue,#0055ff);color:#fff}
.pstat{display:block;font-size:11px;line-height:1.3;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pstat::before{content:'';display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:5px;background:currentColor}
.pstat.bad{color:var(--bad,#c9302c)}.pstat.warn{color:var(--warn,#b46a00)}
.sig-grid{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr))}
.sig{border:1px solid var(--line,#dfe3ec);border-left:4px solid var(--muted,#9aa3b2);border-radius:10px;padding:12px 14px;display:grid;gap:6px;align-content:start;font-size:13px;line-height:1.45}
.sig.bad{border-left-color:var(--bad,#c9302c)}.sig.warn{border-left-color:var(--warn,#b46a00)}.sig.good{border-left-color:var(--good,#13b38b)}
.sig h3{margin:0;font-size:15px}.sig p{margin:0}
.sig .sig-h{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.sig .sl{font-size:12px;color:var(--muted,#5b6475)}
.sig .hyp{color:var(--muted,#5b6475)}
.sig .sf{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:4px}
.fx-act{display:inline-flex;gap:6px;flex-wrap:wrap}
.cpick{position:relative;display:inline-block;align-self:flex-end}
.cpick>summary{list-style:none;cursor:pointer;font-size:13px;padding:6px 12px;border:1px solid var(--line,#dfe3ec);border-radius:8px;white-space:nowrap}
.cpick>summary::-webkit-details-marker{display:none}
.cpick>summary::after{content:' ▾';color:var(--muted,#5b6475)}
.cpick .cp-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:min(460px,92vw);background:var(--card,var(--bg,#fff));border:1px solid var(--line,#dfe3ec);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.18);padding:10px;display:grid;gap:8px}
.cp-list{max-height:320px;overflow:auto;display:grid;gap:2px}
.cp-list label{display:flex;gap:8px;align-items:center;font-size:13px;padding:4px 6px;border-radius:6px;cursor:pointer}
.cp-list label[hidden]{display:none}
.cp-list label:hover{background:var(--blue-soft,rgba(0,85,255,.08))}
.cp-list label .c{margin-left:auto;color:var(--muted,#5b6475);font-size:12px;white-space:nowrap}
.cp-btns{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.tsearch{font:inherit;font-size:13px;padding:7px 10px;border:1px solid var(--line,#dfe3ec);border-radius:8px;width:min(420px,100%);margin:0 0 10px;background:transparent;color:inherit;box-sizing:border-box}
.vlab2{paint-order:stroke;stroke:var(--card,#fff);stroke-width:3px;stroke-linejoin:round}
.lg-line{height:3px!important;border-radius:2px;vertical-align:middle}
.jmeta{display:block;font-size:12px;color:var(--muted,#5b6475);margin-top:2px}

/* бюджет: компактная таблица «месяц / неделя» и строка лимитов */
.btab { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.btab th, .btab td { padding: 7px 12px; text-align: right; white-space: nowrap; font-size: 14.5px; }
.btab thead th { font-size: 12px; color: var(--muted); font-weight: 700; padding-top: 0; }
.btab tbody th { text-align: left; font-weight: 800; }
.btab tbody th small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.btab tbody tr + tr td, .btab tbody tr + tr th { border-top: 1px solid var(--grid); }
.btab td { font-weight: 700; }
.btab td.dv.up-bad { color: var(--bad); }
.btab td.dv.warn-t { color: var(--warn); }
.bchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bchip { background: var(--bg); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.bchip b { color: var(--ink); font-weight: 800; margin-left: 2px; font-variant-numeric: tabular-nums; }

/* раскрытие срезов аудитории и цветовая оценка CPA / ДРР */
tr.xr[data-click] td:first-child .v::before { content: '▸'; display: inline-block; width: 14px; color: var(--muted, #888); transition: transform .15s; }
tr.xr.xopen td:first-child .v::before { transform: rotate(90deg); }
tr.xrow > td.xtd { padding: 0; background: var(--bg-soft, rgba(127,127,127,.06)); }
.drill { padding: 10px 14px 14px 28px; }
.drillh { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.drillh .jmeta { flex: 1; min-width: 200px; }
.drill .tbox { margin-top: 6px; }
.dname { display: block; font-weight: 500; }
.hint-act { font-size: 12px; }
.hint-act.bad { color: #c0392b; }
.hint-act.good { color: #1e8449; }
td.cell-bad { background: rgba(214, 69, 65, .16); }
td.cell-bad .v { color: #b3261e; font-weight: 600; }
td.cell-warn { background: rgba(240, 173, 40, .18); }
td.cell-warn .v { color: #9a6700; font-weight: 600; }
td.cell-manual { background: rgba(80, 90, 220, .14); box-shadow: inset 0 0 0 1px rgba(80, 90, 220, .45); }
td.cell-manual .v { color: #3a43b8; font-weight: 600; }
.manual-note { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: rgba(80, 90, 220, .10); border: 1px solid rgba(80, 90, 220, .35); color: #2d3499; font-size: 13px; line-height: 1.45; }
td.cell-good { background: rgba(46, 160, 90, .14); }
td.cell-good .v { color: #1e7a45; font-weight: 600; }
.xtd > .drill { position: sticky; left: 0; width: var(--tw, 100%); box-sizing: border-box; white-space: normal; }

/* выбор галочками в панели фильтров */
.mpick>summary{display:flex;gap:4px;align-items:center;min-height:36px;box-sizing:border-box}
.mpick>summary .mlab{color:var(--muted,#5b6475)}
.mpick.on>summary{border-color:var(--blue,#0055ff);background:var(--blue-soft,rgba(0,85,255,.08))}
.mpick .mp-pop{width:max-content;min-width:200px;max-width:92vw}
.drillh3{margin:14px 0 4px;font-size:14px}
.meta-model { color: var(--blue); font-weight: 700; max-width: 360px; }
.meta-model:empty { display: none; }
.meta-dq { position: relative; margin-top: 2px; font-size: 12px; }
.meta-dq.ok .dq-line { color: var(--good, #13b38b); font-weight: 600; }
.meta-dq.warn summary { color: var(--warn, #c77700); font-weight: 700; cursor: pointer; list-style: none; }
.meta-dq.warn summary::-webkit-details-marker { display: none; }
.dq-pop { position: absolute; right: 0; top: 22px; z-index: 30; width: min(560px, 90vw); max-height: 60vh; overflow: auto; text-align: left; background: var(--panel, #fff); border: 1px solid var(--line, #e3e7ef); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 46, 84, .18); padding: 10px 14px; }
.dq-item { padding: 6px 0; border-bottom: 1px solid var(--line, #eef0f5); }
.dq-item:last-child { border-bottom: 0; }
.dq-item b { display: block; font-size: 12.5px; }
.dq-item small { display: block; color: var(--muted, #6b7589); line-height: 1.35; }
@media print { .meta-dq.warn .dq-pop { display: none; } }
.field-model .seg button { padding: 7px 11px; white-space: nowrap; }
@media (max-width: 760px) { .field-model .seg button { white-space: normal; font-size: 12px; line-height: 1.15; } }
/* вкладка «Яндекс.Метрика» */
.mt-note { margin: 0 0 12px; }
.dn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 16px 0; }
.dn-card .dn-box { max-width: 300px; margin: 6px auto 4px; }
.dn-val { font-size: 22px; font-weight: 800; fill: var(--ink, #14233c); }
.dn-cap { font-size: 11.5px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.dn-leg { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.dn-leg li { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 8px; }
.dn-leg li.hl { background: var(--blue-soft); font-weight: 700; }
.dn-leg li i, .legend .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.dn-leg .n { flex: 1; min-width: 0; }
.dn-leg .p { font-variant-numeric: tabular-nums; font-weight: 700; }
.mt-ins ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
tr.hl-row td { background: var(--blue-soft); font-weight: 700; }
tr.sub-row td { font-style: italic; }
.kpis.mini { margin-top: 8px; }

/* компактная шапка (v25e): фильтры и быстрые фильтры в одном белом блоке */
.top { padding-top: 8px; }
.top-row { gap: 12px; }
.top-title { min-width: 160px; }
.eyebrow { font-size: 10.5px; line-height: 1.2; }
.top-title h1 { margin: 0; font-size: 21px; line-height: 1.15; }
.top-meta { font-size: 12px; line-height: 1.3; }
.top-row .btn { padding: 6px 12px; }
.filters { margin-top: 8px; padding: 8px 14px; gap: 6px 18px; align-items: center; }
.filters .qf { flex: 1 1 100%; margin: 0; padding: 6px 0 0; border-top: 1px solid var(--line); gap: 6px 12px; align-items: center; }
.filters .qf:empty { display: none; }
.field select, .field input[type=date], .qsel select { padding: 5px 9px; border-radius: 9px; }
.seg button { padding: 5px 12px; }
.field-model .seg button { padding: 5px 10px; }
.switch { padding-bottom: 0; }
.switch i { width: 38px; height: 22px; }
.switch i::after { top: 3px; left: 3px; width: 16px; height: 16px; }
.switch input:checked + i::after { transform: translateX(16px); }
.tabs { margin-top: 6px; }
.tabs button { padding: 8px 14px 9px; font-size: 14.5px; }
@media (min-width: 761px) {
  .filters .field:not(.switch) { display: flex; align-items: center; gap: 8px; }
  .filters .field > span { white-space: nowrap; }
  .filters .qsel { display: flex; align-items: center; gap: 6px; }
}
@media (max-width: 760px) {
  .top { padding-top: 6px; }
  .filters { padding: 8px 10px; }
  .top-title h1 { font-size: 19px; }
}

/* v25e: порядок — период + быстрые периоды, детализация, сравнение / вторая строка: модель + быстрые фильтры */
.filters .field-period { order: 1; } .filters #qp { order: 2; } .filters .field-gran { order: 3; } .filters .switch { order: 4; margin-left: auto; }
.filters .fbreak { order: 5; flex: 1 1 100%; height: 0; border-top: 1px solid var(--line); margin: 2px 0 0; }
.filters .field-model { order: 6; } .filters .qf { order: 7; flex: 1 1 auto; border-top: 0; padding: 0; }
.filters:has(.qf:empty):has(.field-model[hidden]) .fbreak { display: none; }
.filters #qp { display: flex; gap: 6px; margin: 0; }
.filters #qp button { padding: 4px 10px; }
@media (max-width: 760px) { .filters .switch { margin-left: 0; } .filters .fbreak { margin: 0; } }

/* v25e-2: три плотные строки: [период · быстрые периоды · детализация] [модель · сравнение] [быстрые фильтры] */
.filters .fbreak { display: none; }
.filters .field-model { order: 4; } .filters .switch { order: 5; margin-left: auto; } .filters .qf { order: 6; flex: 1 1 100%; border-top: 1px solid var(--line); padding: 6px 0 0; }
.filters .qf:empty { display: none; }
.filters { row-gap: 6px; }
@media (max-width: 760px) { .filters .field-model, .filters .switch, .filters .field-gran, .filters .field-period { flex: 1 1 100%; } .filters .field-model .seg { display: flex; width: 100%; } .filters .field-model .seg button { flex: 1 1 0; } .filters #qp { flex-wrap: wrap; } }
/* Метрика: график динамики */
.mt-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 8px; }
.mt-bar .pills { margin: 0; }
.mt-bar .qsel { display: flex; align-items: center; gap: 8px; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 6px; }
.mt-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; transition: opacity .15s, background .15s; }
.mt-chip:hover { background: var(--blue-soft); }
.mt-chip.off { opacity: .45; text-decoration: line-through; }

/* выбор канала кликом по срезу, легенде и таблице */
.dn-box path[data-mtk] { transition: opacity .15s; }
.dn-box path.sel { stroke: var(--ink); stroke-width: 2.5px; }
.dn-leg li[data-mtk] { cursor: pointer; }
.dn-leg li[data-mtk]:hover { background: var(--blue-soft); }
.dn-leg li.sel { box-shadow: inset 0 0 0 2px var(--blue); font-weight: 700; }
tr.sel-row td { box-shadow: inset 0 2px 0 var(--blue), inset 0 -2px 0 var(--blue); }
.mt-trend { scroll-margin-top: 140px; }
.mt-reset { background: var(--blue-soft); border-color: var(--blue); }
.mt-dash { margin-top: 10px; }

.fresh-note { font-size: 11px; color: var(--muted); opacity: .75; margin-top: 1px; cursor: help; }

/* форматы рекламы: компактные стрелки изменения к прошлому периоду */
.dlt { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 11.5px; font-weight: 700; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dlt.up::before, .dlt.dn::before { content: ''; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }
.dlt.up::before { border-bottom: 6px solid currentColor; }
.dlt.dn::before { border-top: 6px solid currentColor; }
.dlt.good { color: var(--good); }
.dlt.bad { color: var(--bad); }
.dlt.neu { color: var(--muted); font-weight: 600; }

/* форматы рекламы: компактные диаграммы */
.fm-row { margin: 18px 0 22px; }
.fm-rh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 2px 10px; }
.fm-rh b { font-size: 20px; }
.fm-rh span { color: var(--muted); font-size: 14px; }
.fm-pills { margin-left: auto; margin-bottom: 0; }
.fm-pills button { padding: 5px 12px; font-size: 14px; }
.fm-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fm-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1280px) { .fm-grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .fm-grid, .fm-grid.c3 { grid-template-columns: minmax(0, 1fr); } }
.card.fm-card { padding: 16px 18px; margin: 0; container-type: inline-size; overflow: hidden; min-width: 0; }
.fm-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; flex-wrap: wrap; }
.fm-card h3 .dlt { font-size: 14px; }
.fm-body { display: flex; align-items: center; gap: 18px; min-width: 0; }
.fm-box { flex: none; width: 190px; height: 190px; }
.fm-box svg { width: 190px; height: 190px; display: block; }
.fm-c { font-size: 17px; font-weight: 800; fill: var(--ink, #14233c); }
.fm-c0 { font-size: 14px; fill: var(--muted); }
.fm-leg { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: grid; gap: 3px; font-size: 16px; }
.fm-leg li { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.fm-leg li:hover { background: var(--blue-soft); }
.fm-leg li.sel { box-shadow: inset 0 0 0 2px var(--blue); font-weight: 700; }
.fm-leg li.off { opacity: .55; }
.fm-leg li i { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.fm-leg .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-leg .p { font-variant-numeric: tabular-nums; font-weight: 700; flex: none; white-space: nowrap; }
.fm-leg .dlt { min-width: 64px; margin-left: 0; justify-content: flex-end; font-size: 14px; flex: none; white-space: nowrap; }
@container (max-width: 600px) { .fm-box, .fm-box svg { width: 150px; height: 150px; } .fm-body { gap: 12px; } .fm-leg { font-size: 14px; } .fm-leg li { gap: 7px; padding: 4px 6px; } .fm-leg .dlt { min-width: 0; font-size: 13px; } }
@container (max-width: 420px) { .fm-body { flex-direction: column; align-items: stretch; } .fm-box { align-self: center; } .fm-leg { width: 100%; } }

/* заглушка «данных пока нет» */
.empty.nodata { text-align: center; padding: 22px 14px; }
.nodata .nd-t { font-weight: 700; font-size: 15px; color: var(--ink, #14233c); }
.nodata .nd-h { margin-top: 6px; font-size: 12.5px; color: var(--muted); max-width: 640px; margin-left: auto; margin-right: auto; }

/* календарь периода */
.field input.cal-in { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 5px 9px; min-width: 0; max-width: 100%; width: 112px; cursor: pointer; font: inherit; color: inherit; text-align: center; transition: border-color .18s; }
.field input.cal-in:hover { border-color: var(--blue); }
.cal-pop { position: fixed; z-index: 200; background: var(--panel); color: var(--ink, #14233c); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 36px rgba(10, 25, 60, .22); padding: 10px 12px 12px; max-width: calc(100vw - 16px); }
.cal-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cal-hint { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cal-nav { border: 1px solid var(--line); background: transparent; color: inherit; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.cal-nav:hover { background: var(--blue-soft); }
.cal-ms { display: flex; gap: 22px; }
.cal-m { width: 224px; min-height: 214px; }
.cal-t { font-weight: 800; font-size: 14px; color: var(--blue); margin: 2px 0 8px; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-w { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.cal-w.we { color: #d96a6a; }
.cal-d { border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; height: 28px; border-radius: 8px; cursor: pointer; padding: 0; }
.cal-d:hover:not(:disabled) { background: var(--blue-soft); }
.cal-d.we { color: #d96a6a; }
.cal-d.rng { background: var(--blue-soft); border-radius: 0; }
.cal-d.sel { background: var(--blue); color: #fff; font-weight: 700; }
.cal-d.today { box-shadow: inset 0 0 0 1.5px var(--blue); }
.cal-d.off, .cal-d:disabled { color: var(--muted); opacity: .45; cursor: default; }
.cal-future { display: flex; align-items: center; justify-content: center; min-height: 150px; text-align: center; color: var(--muted); font-size: 13.5px; padding: 0 10px; }

/* бюджет: компактный вид */
.card.budget { padding-top: 10px; padding-bottom: 12px; }
.card.budget h2 { margin-bottom: 6px; font-size: 16px; }
.binfo { margin-left: 6px; color: var(--muted); font-size: 13px; cursor: help; font-weight: 600; }
.card.budget .bnote { margin: 0 0 4px; font-size: 12px; }
.bwrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.bwrap .tbox { flex: 1 1 460px; min-width: 0; }
.bwrap .bchips { flex: 0 1 300px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 0; }
.card.budget .btab th, .card.budget .btab td { padding: 3px 10px; font-size: 13px; }
.card.budget .btab thead th { font-size: 11px; padding-top: 0; padding-bottom: 2px; }
.card.budget .btab tbody th small { display: inline; margin-left: 6px; font-size: 11px; }
.card.budget .bchip { padding: 3px 10px; font-size: 12px; border-radius: 8px; display: flex; justify-content: space-between; gap: 8px; }
.card.budget .bbar { height: 6px; margin-top: 8px; }
.card.budget .bbar em { top: -3px; bottom: -3px; }

/* лист «Форматы рекламы»: панель фильтров, одиночный показатель, динамика по дням */
.fm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; }
.fm-sp { flex: 1; }
.fm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--blue); background: var(--blue-soft); color: inherit; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fm-chip .l { color: var(--muted); font-weight: 500; }
.fm-chip i { font-style: normal; font-size: 17px; line-height: 1; opacity: .7; }
.fm-chip.all { border-color: var(--line, #c9d2e0); background: transparent; color: var(--muted); }
.fm-chip:hover { filter: brightness(1.08); }
.fm-cur { padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--muted); font-size: 13px; font-weight: 600; }
.fm-btn { padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line, #c9d2e0); background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fm-btn:hover, .fm-btn[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }
.fm-solo { width: 190px; height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; border-radius: 18px; background: var(--blue-soft); padding: 12px; box-sizing: border-box; }
.fm-solo .v { font-size: 26px; font-weight: 800; line-height: 1.1; word-break: break-word; }
.fm-solo .l { font-size: 14px; color: var(--muted); font-weight: 600; }
.fm-leg2 { display: flex; gap: 18px; margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.fm-leg2 span { display: inline-flex; align-items: center; gap: 7px; }
.fm-leg2 i.b { width: 14px; height: 14px; border-radius: 4px; background: #0055ff; }
.fm-leg2 i.l { width: 18px; height: 0; border-top: 3px solid #13b38b; border-radius: 2px; }
.fm-trendbox { width: 100%; overflow: hidden; }
.fm-trend { width: 100%; height: auto; display: block; }
.fm-trend .g { stroke: currentColor; stroke-opacity: .12; }
.fm-trend .ax { font-size: 13px; fill: var(--muted); }
.fm-trend .bar { fill: #0055ff; opacity: .85; cursor: pointer; }
.fm-trend .bar:hover { opacity: 1; }
.fm-trend .ln { fill: none; stroke: #13b38b; stroke-width: 3; stroke-linejoin: round; }
.fm-trend .pt { fill: #13b38b; stroke: var(--card, #0e1a30); stroke-width: 1.5; }
@media (max-width: 520px) { .fm-solo { width: 100%; height: auto; padding: 18px 12px; } }

/* ---------- лист «Яндекс.Метрика» (onit): модели, компактная сводка, график, выводы ---------- */
.mt-model { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--blue-soft); font-size: 13px; line-height: 1.45; }
.mt-model-l { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; color: var(--muted); margin-right: 8px; }
.kpis.mt-compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.kpis.mt-compact .kpi { padding: 18px 20px; }
.kpis.mt-compact .k-label { font-size: 14.5px; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.kpis.mt-compact .k-val { font-size: 34px; margin-top: 6px; }
.kpis.mt-compact .k-delta { font-size: 13.5px; margin-top: 4px; min-height: 1.3em; }
.mt-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 16px; padding: 0; background: none; box-shadow: none; }
.mt-strip .ms { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 14px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); white-space: normal; border-left: 3px solid var(--blue-soft); }
.mt-strip .ms i { font-style: normal; color: var(--muted); font-weight: 700; font-size: 12.5px; line-height: 1.25; }
.mt-strip .ms b { font-weight: 800; font-size: 21px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--ink); }
.mt-strip .ms em { font-style: normal; font-size: 12.5px; font-weight: 700; min-height: 1.2em; }
.mt-strip em.up-good { color: var(--good); }
.mt-strip em.up-bad { color: var(--bad, #e5484d); }
.mt-strip em.neutral { color: var(--muted); }
.mt-tools { margin: 4px 0 10px; }
.mt-tgl { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); }
.mt-tgl[aria-pressed=true] { color: #fff; background: var(--blue); border-color: var(--blue); }
.mt-tgl:disabled { opacity: .45; cursor: default; }
.mt-inc-leg { margin: 6px 0 0; }
.mt-inc-k { display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; }
.mt-inc-k i, .mt-inc-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; flex: none; }
.mt-inc-tip { max-width: 320px; white-space: normal; margin-top: 4px; }
.mt-ins .sig p b { font-weight: 700; }
@media print { .mt-tools { display: none !important; } }

.mt-inc-leg { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.mt-inc-leg:empty { display: none; }

/* onit: таблица «кто приводит покупателей, а кто доводит до покупки» */
.mt-how { margin: 4px 0 12px; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.mt-how.warn { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: rgba(240, 173, 40, .16); font-size: 13.5px; }
.rt-sum { margin: 0 0 12px; padding: 11px 14px; border-radius: 10px; font-size: 14.5px; line-height: 1.5; border-left: 4px solid var(--muted); background: var(--bg); }
.rt-sum.open { border-left-color: var(--good); } .rt-sum.close { border-left-color: var(--blue); } .rt-sum.mix { border-left-color: var(--muted); }
table.rt { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.rt th { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: center; font-weight: 800; background: var(--panel); }
.rt th.l { text-align: left; }
.rt th.rt-s { font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 0; }
.rt td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rt-ch { font-weight: 700; white-space: nowrap; }
.rt-num { min-width: 150px; }
.rt-bar { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 8px; border-radius: 6px; overflow: hidden; }
.rt-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue-soft); opacity: .7; border-radius: 6px; z-index: 0; }
.rt-bar b, .rt-bar span { position: relative; z-index: 1; }
.rt-bar b { font-size: 16px; font-weight: 800; }
.rt-bar span { color: var(--muted); font-size: 13px; }
.rt-role { min-width: 260px; }
.rt-role small { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.rt-rub { text-align: right; white-space: nowrap; font-weight: 600; }
.rt-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.rt-chip.open { background: rgba(46, 160, 90, .16); color: #1e7a45; }
.rt-chip.close { background: var(--blue-soft); color: var(--navy); }
.rt-chip.mix { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.rt tfoot td { font-weight: 800; background: var(--bg); border-bottom: 0; }
.rt tr.hl-row td { background: var(--blue-soft); }
.rt-how { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--bg); font-size: 13.5px; line-height: 1.5; }
.rt-how ul { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.rt-how .rt-chip { margin-right: 6px; }
@media print { .rt-how { break-inside: avoid; } }

/* ---------- выгрузка PDF (19.11.2026): крупный читаемый A4, без служебных подписей браузера (ссылка, дата), без обрыва блоков ----------
 * Кнопка «PDF» перед печатью перестраивает лист под ширину страницы A4 (класс body.pdf), чтобы графики и таблицы не уменьшались. */
body.pdf .side, body.pdf .scrim, body.pdf .burger { display: none !important; }
body.pdf .app { display: block; }
body.pdf .main { width: 1040px; max-width: 1040px; padding: 0 0 24px; margin: 0; }
body.pdf .top { position: static; }
@media print {
  @page { size: A4 landscape; margin: 0; } /* нулевое поле страницы — браузер не печатает адрес сайта, дату и заголовок */
  html, body { font-size: 13px; }
  .main { width: auto !important; max-width: none !important; padding: 10mm 11mm !important; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .top-title h1 { font-size: 22px; }
  .top-meta { font-size: 11px; }
  .filters { padding: 6px 10px; }
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .k-label { font-size: 12px; white-space: normal; }
  .kpi .k-val { font-size: 22px; }
  .kpi .k-delta { font-size: 11.5px; }
  .card { padding: 12px 14px; }
  .card h2 { font-size: 16px; }
  .chart text { font-size: 12px; }
  table.t { font-size: 11.5px; }
  .t th, .t td { padding: 5px 7px; }
  .grid-main { grid-template-columns: 1fr; }
  .kpi, .chart, .fm-card, .card.budget, .card:not(:has(table.t)), .sig, .test, .rt-how { break-inside: avoid; page-break-inside: avoid; }
  .card:has(table.t) { break-inside: auto; }
  .card > h2, .fm-rh { break-after: avoid; page-break-after: avoid; }
  .fm-row { break-inside: avoid; page-break-inside: avoid; margin: 10px 0 14px; }
  .fm-leg { font-size: 13.5px; }
  .tsearch, .cp-pop, .mp-pop, .fm-btn, .fm-pills, .pills, .tip, .toast, .cal-pop { display: none !important; }
  .tbox { max-height: none !important; overflow: visible !important; }
  .t td:first-child { max-width: 320px !important; }
  details.cpick > summary { border-color: #e7e9f0; }
}
