/* ===== Дизайн-система парсера Beoma ===== */
:root {
  --ground: #FFF6FA; --ground-2: #F7E6EF; --surface: #FFFFFF; --surface-2: #F9EEF4; --surface-3: #F3E3EA;
  --ink: #241A21; --ink-soft: #6B5A64; --ink-faint: #98858F; --line: #EDDAE4; --line-strong: #DDC3D0;
  --accent: #C92D63; --accent-hover: #B02454; --accent-soft: #FFE4EC; --accent-ink: #8D1A44;
  --good: #1B6B45; --good-soft: #DEF0E6; --warn: #8A5300; --warn-soft: #F7EEDE; --bad: #9A2432; --bad-soft: #F6E2E5;
  --info: #2A4E9C; --info-soft: #E3EAF8;
  --shadow: 0 1px 2px rgba(36,26,33,.06), 0 6px 20px rgba(36,26,33,.08);
  --shadow-lg: 0 10px 40px rgba(36,26,33,.18);
  --sans: "Golos Text", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px; --radius-sm: 6px;
  --row-h: 40px; --cell-py: 8px;
  --sidebar-w: 232px; --panel-w: 560px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ground: #1B1219; --ground-2: #241424; --surface: #241722; --surface-2: #2D1D2A; 
  --surface-3: #362433; --ink: #F3E8EE; --ink-soft: #C4ABB8; --ink-faint: #8F7684; --line: #3C2938; --line-strong: #4E3648;
  --accent: #FF84A5; --accent-hover: #FF9AB6; --accent-soft: #452132; --accent-ink: #FFB3C8;
  --good: #6FCB98; --good-soft: #16301F; --warn: #E9A94A; --warn-soft: #2C2418; --bad: #F08A96; --bad-soft: #3A1C21;
  --info: #8FB0F5; --info-soft: #1E2A44;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --ground: #1B1219; --ground-2: #241424; --surface: #241722; --surface-2: #2D1D2A; --surface-3: #362433;
  --ink: #F3E8EE; --ink-soft: #C4ABB8; --ink-faint: #8F7684; --line: #3C2938; --line-strong: #4E3648;
  --accent: #FF84A5; --accent-hover: #FF9AB6; --accent-soft: #452132; --accent-ink: #FFB3C8;
  --good: #6FCB98; --good-soft: #16301F; --warn: #E9A94A; --warn-soft: #2C2418; --bad: #F08A96; --bad-soft: #3A1C21;
  --info: #8FB0F5; --info-soft: #1E2A44;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}
:root[data-density="compact"] { --row-h: 34px; --cell-py: 4px; }
:root { --row-h: 44px; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--ink-soft); } .faint { color: var(--ink-faint); }
.small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; } .wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Каркас ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.15; }
.brand-sub { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-faint); }
.brand .sidebar-close { display: none; margin-left: auto; }
.nav { padding: 4px 10px 10px; overflow-y: auto; flex: 1; }
.nav-group { margin: 10px 6px 3px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; line-height: 1.3; border-radius: 8px; color: var(--ink-soft); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a .ico { width: 22px; font-size: 17px; text-align: center; opacity: .85; }
.nav a .badge { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ground-2); color: var(--accent-ink); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px 0; }
.page-title { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar .menu-btn { display: none; }
.content { padding: 14px 24px 40px; min-width: 0; }
.scrim, .panel-scrim { position: fixed; inset: 0; background: rgba(20,10,16,.35); z-index: 30; }

/* ===== Кнопки и поля ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 34px; min-width: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.sm.ghost { font-size: 20px; padding: 0 10px; min-width: 40px; height: 40px; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn { width: 42px; height: 42px; font-size: 20px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-soft); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.input, .select, textarea.input { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--ink-faint); }
.input.sm { height: 34px; font-size: 13.5px; }
.search { position: relative; }
.search .input { padding-left: 30px; width: 260px; }
.search::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%) scaleX(-1); color: var(--ink-faint); font-size: 16px; pointer-events: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { height: 32px; padding: 0 11px; border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-weight: 500; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent-soft); color: var(--accent-ink); }
.seg button:hover:not(.active) { background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--ink-faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 40px; height: 24px; appearance: none; background: var(--line-strong); border-radius: 10px; position: relative; transition: background .15s; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); } .switch input:checked::after { left: 18px; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* ===== Тулбар и чипы ===== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; min-height: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 500; }
.chip b { font-weight: 600; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 24px; height: 24px; font-size: 14px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; line-height: 1; }
.chip button:hover { background: rgba(0,0,0,.08); }
.chip.neutral { background: var(--surface-2); color: var(--ink-soft); }

/* ===== Карточки, плашки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card-b { padding: 16px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.good { background: var(--good-soft); color: var(--good); }
.notice.info { background: var(--info-soft); color: var(--info); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.info { background: var(--info-soft); color: var(--info); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stat .k { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.empty .actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ===== Таблица ===== */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow: auto; max-height: calc(100vh - 230px); position: relative; }
table.tbl { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: var(--cell-py) 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; height: var(--row-h); vertical-align: middle; }
.tbl th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--ink-soft); font-weight: 600; font-size: 12px; user-select: none; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--ink); }
.tbl th .th-in { display: inline-flex; align-items: center; gap: 4px; }
.tbl th .arrow { font-size: 12px; opacity: .55; } .tbl th[aria-sort] .arrow { opacity: 1; color: var(--accent); }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th.grp-start, .tbl td.grp-start { border-left: 1px solid var(--line); }
.tbl th.sticky-col, .tbl td.sticky-col { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.tbl th.sticky-col { z-index: 4; background: var(--surface-2); }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.selected td { background: var(--accent-soft); }
.tbl tbody tr.selected td.sticky-col { background: var(--accent-soft); }
.tbl tbody tr:hover td.sticky-col { background: var(--surface-2); }
.tbl tfoot td { position: sticky; bottom: 0; z-index: 3; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl tfoot td.sticky-col { z-index: 4; background: var(--surface-2); }
.tbl td .sub { display: block; font-size: 11.5px; color: var(--ink-faint); line-height: 1.2; font-weight: 400; }
.tbl td.dim { color: var(--ink-faint); }
.tbl .neg { color: var(--bad); }
.tbl td.est { color: var(--ink-soft); font-style: italic; }
.tbl th.est { color: var(--warn); }
.tbl.static tbody tr { cursor: default; }
.tbl.static tbody tr:hover td { background: transparent; }
.cell-acc { display: flex; align-items: center; gap: 8px; max-width: 260px; }
.cell-acc .avatar { width: 32px; height: 32px; font-size: 12px; }
.cell-acc .txt { min-width: 0; } .cell-acc .h { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; font-weight: 500; }
.plat { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; vertical-align: -5px; font-size: 11px; font-weight: 700; flex: none; }
.plat svg { width: 14px; height: 14px; display: block; }
.plat.youtube { background: #FF0000; }
.plat.tiktok { background: #00A9B5; }
.plat.instagram { background: radial-gradient(circle at 30% 107%, #FDF497 0%, #FDF497 5%, #FD5949 45%, #D6249F 60%, #285AEB 90%); }
.plat-lbl { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn svg { width: 22px; height: 22px; display: block; }
.theme-btn { flex: none; }
.card { min-width: 0; }
.card-b:has(> table), .card:has(> table) { overflow-x: auto; }
.stack { min-width: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.gray { background: var(--ink-faint); }
.spark { vertical-align: middle; margin-left: 8px; }
.spark .bar { fill: var(--accent); opacity: .75; } .spark .bar.miss { fill: var(--line-strong); opacity: 1; } .spark .bar.neg { fill: var(--bad); }
.tbl-foot { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); flex-wrap: wrap; }
.pager { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; }
.pager .btn { min-width: 36px; padding: 0 10px; }
.skeleton td > span { display: inline-block; height: 12px; width: 70%; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.rowcards { display: none; }

/* ===== Выпадающие панели ===== */
.pop { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 240px; max-width: min(92vw, 720px); }
.pop-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.pop-b { padding: 12px 14px; max-height: 60vh; overflow: auto; }
.pop-b.pop-b-open { overflow: visible; max-height: none; }
.pop-b-open .combo-list { max-height: 220px; }
.pop-f { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); justify-content: flex-end; }
.col-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; }
.col-group h4 { margin: 0 0 4px; font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.col-group h4.est { color: var(--warn); }
.menu { padding: 6px; min-width: 200px; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .k { margin-left: auto; color: var(--ink-faint); font-size: 12px; }

/* комбобокс с поиском */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px; }
.combo-list .opt { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.combo-list .opt:hover, .combo-list .opt.focus { background: var(--surface-2); }
.combo-list .opt.sel { color: var(--accent-ink); font-weight: 500; }
.combo-list .opt .sub { margin-left: auto; color: var(--ink-faint); font-size: 12px; }
.combo-list .none { padding: 8px 10px; color: var(--ink-faint); }
.combo-sel { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ===== Боковая панель ===== */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 35; display: flex; flex-direction: column; transform: translateX(0); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .6 } to { transform: none; opacity: 1 } }
.panel-h { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.panel-h h2 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.panel-b { padding: 14px 18px 28px; overflow: auto; flex: 1; }
.panel-sec { margin-bottom: 18px; }
.panel-sec h3 { margin: 0 0 8px; font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
.kv .k { font-size: 11.5px; color: var(--ink-faint); } .kv .v { font-weight: 600; font-size: 15px; }
.chart { width: 100%; height: 150px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .bar { fill: var(--accent); opacity: .8; } .chart .bar.miss { fill: var(--line-strong); }
.chart .bar2 { fill: var(--info); opacity: .75; }
.chart text { font: 10.5px var(--mono); fill: var(--ink-faint); }
.chart .tick { stroke: var(--line-strong); }
.caption-box { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.caption-box mark { background: var(--accent-soft); color: var(--accent-ink); padding: 0 3px; border-radius: 3px; font-weight: 600; }
.hist { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.hist th, .hist td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.hist th { color: var(--ink-faint); font-weight: 500; font-size: 11.5px; }
.hist td.num, .hist th.num { text-align: right; }

/* ===== Модальные окна ===== */
.modal-root:empty { display: none; }
.modal-scrim { position: fixed; inset: 0; background: rgba(20,10,16,.45); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; animation: pop .15s ease-out; }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-h { display: flex; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; }
.modal-b { padding: 16px 20px; overflow: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.modal-f .left { margin-right: auto; }
.code { font-family: var(--mono); background: var(--surface-2); padding: 8px 10px; border-radius: 6px; word-break: break-all; font-size: 12.5px; user-select: all; }

/* ===== Тосты ===== */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: center; animation: pop .15s ease-out; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; } .toast.good { background: var(--good); color: #fff; }

/* ===== Вход ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, var(--ground-2), var(--ground)); }
.login { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login h1 { margin: 12px 0 4px; font-size: 22px; }
.login p { margin: 0 0 18px; color: var(--ink-soft); }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; justify-content: center; height: 40px; margin-top: 6px; }
.login .err { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ===== Сетки страниц ===== */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.settings-group { margin-bottom: 18px; }
.settings-group h3 { margin: 0 0 8px; font-size: 14px; }
.setting { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
.setting .name { font-weight: 500; } .setting .desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.setting .key { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.setting .ctl { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.setting .ctl .input { width: 100%; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.step .n { font-size: 11.5px; color: var(--ink-faint); font-family: var(--mono); }
.step .t { font-weight: 600; font-size: 13px; margin: 2px 0; }
.step .m { font-size: 11.5px; color: var(--ink-soft); white-space: normal; }
.step.ok { border-color: color-mix(in srgb, var(--good) 40%, transparent); } .step.error { border-color: var(--bad); background: var(--bad-soft); }
.step.running { border-color: var(--warn); } .step.skipped { opacity: .7; }
.bar-h { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.bar-h span { display: block; height: 100%; }
.bar-h .ok { background: var(--good); } .bar-h .nd { background: var(--warn); } .bar-h .er { background: var(--bad); }
.share { font-weight: 600; } .share.good { color: var(--good); } .share.bad { color: var(--bad); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--ink-soft); }
.diff { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.diff .old { color: var(--bad); } .diff .new { color: var(--good); }
.inline-edit { display: inline-flex; gap: 6px; align-items: center; }

/* ===== Адаптив ===== */
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } .setting { grid-template-columns: 1fr; } .setting .ctl { justify-content: flex-start; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 31; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .18s; }
  .sidebar.open { transform: none; }
  .brand .sidebar-close { display: inline-grid; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 14px 0; } .content { padding: 12px 14px 60px; }
  .page-title { font-size: 17px; }
  .search .input { width: 160px; }
  .toolbar .flex { flex-wrap: wrap; }
  .rowcard .top .faint { white-space: nowrap; }
  .panel { width: 100vw; }
  .table-scroll { max-height: none; }
  .tbl.responsive { display: none; }
  .rowcards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px; }
  .rowcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); cursor: pointer; min-width: 0; overflow: hidden; }
  .rowcard .kv > div { min-width: 0; } .rowcard .kv .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rowcard .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .rowcard .kv { grid-template-columns: repeat(2, 1fr); }
  .rowcard .kv .v { font-size: 14px; }
  .rowcard .more { margin-top: 6px; display: none; } .rowcard.open .more { display: grid; }
  .pager { margin-left: 0; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media print { .sidebar, .topbar, .toolbar, .tbl-foot, .panel { display: none !important; } .app { grid-template-columns: 1fr; } .table-scroll { max-height: none; overflow: visible; } }

/* ===== Дашборд ===== */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 12px; align-items: start; }
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.toplist { display: flex; flex-direction: column; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.top-row:last-child { border-bottom: 0; }
.top-row:hover { background: var(--surface-2); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.top-row .rank { width: 18px; color: var(--ink-faint); font-size: 12px; text-align: right; }
.top-row .avatar { width: 30px; height: 30px; overflow: hidden; }
.top-row .avatar img, .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.top-row .ttl { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-wide .chart { height: 180px; }
/* раскрывающиеся строки */
.tbl tr.child td { background: var(--surface-2); font-size: 12.5px; height: 32px; padding-top: 4px; padding-bottom: 4px; }
.tbl tr.child td:first-child { padding-left: 34px; }
.tbl tr.child td.sticky-col { background: var(--surface-2); }
.expander { display: inline-block; width: 22px; font-size: 20px; color: var(--ink-faint); transition: transform .12s; }
.expander.open { transform: rotate(90deg); }
.avatar-group { display: flex; }
.avatar-group .avatar { width: 24px; height: 24px; font-size: 10px; margin-left: -6px; border: 2px solid var(--surface); overflow: hidden; }
.avatar-group .avatar:first-child { margin-left: 0; }
.inline-select { height: 34px; font-size: 13.5px; max-width: 220px; }
