/* SEO Monitor — интерфейс сервиса. Дизайн «вариант 4»: колонка иконок слева, светлая и тёмная тема,
   сводка и выбор периода по образцу Topvisor. Шрифты beup: Geist для заголовков, Golos Text для текста. */
:root {
  --font-head: 'Geist', Arial, sans-serif; --font-body: 'Golos Text', Arial, sans-serif;
  --bg: #f2f3f5; --surface: #fff; --panel: #fff; --top-bg: #fff; --ctl-bg: #fff;
  --ink: #16191d; --muted: #6b7280; --muted-2: #b0b5bc; --line: #e5e7eb; --line-strong: #d1d5db;
  --accent: #008c5d; --accent-ink: #fff; --accent-soft: #d6f2e2; --chip-bg: #eef0f2;
  --nav-bg: #0d3b2b; --nav-ink: #e6f4ec; --nav-active: rgba(255,255,255,.12); --nav-w: 64px;
  --radius: 8px; --ctl-radius: 6px; --row-h: 36px;
  --thead: #f7f8fa; --thead-latest: #e9f6ef; --row-hover: #f7f8fa;
  --good: #008c5d; --bad: #d64545; --warn: #e5a800; --warn-soft: #fbf6d9; --bad-soft: #fbe9e5; --yellow: #e5e243;
  --tv-up: #27ae60; --tv-flat: #f2994a; --tv-down: #eb5757; --tv-blue: #2f80ed; --tv-blue-soft: #eef4ff; --tv-range: #e8f0fe; --tv-spark: #9b51e0; --tv-line: #e6e8ec;
  --c-top3: #b4e5cd; --c-top3-ink: #063f2a; --c-top10: #e4f5ec; --c-top10-ink: #0f6b47; --c-top30: #edf3fb; --c-top30-ink: #2a4f7a;
  --s1: #008c5d; --s2: #2a78d6; --s3: #eb6834; --s4: #4a3aa7; --s5: #eda100; --s6: #e87ba4;
  --shadow: 0 8px 30px rgba(0,0,0,.08); --pop-shadow: 0 12px 40px rgba(0,0,0,.18);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418; --surface: #181c21; --panel: #181c21; --top-bg: #14181c; --ctl-bg: #1f242a;
  --ink: #e8eaed; --muted: #8a9199; --muted-2: #4b535c; --line: #262b31; --line-strong: #343a42;
  --accent: #34d399; --accent-ink: #06281a; --accent-soft: rgba(52,211,153,.16); --chip-bg: #23282e;
  --nav-bg: #0d1013; --nav-ink: #c8cdd3; --nav-active: rgba(255,255,255,.08);
  --thead: #1d2126; --thead-latest: #1c2b24; --row-hover: #1e2227;
  --good: #34d399; --bad: #f87171; --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12); --bad-soft: rgba(248,113,113,.14); --yellow: #e5e243;
  --tv-up: #2ecc71; --tv-flat: #f2994a; --tv-down: #eb5757; --tv-blue: #3b8bf5; --tv-blue-soft: rgba(59,139,245,.14); --tv-range: rgba(59,139,245,.22); --tv-spark: #b388f0; --tv-line: #2b3138;
  --c-top3: rgba(52,211,153,.26); --c-top3-ink: #a7f3d0; --c-top10: rgba(52,211,153,.11); --c-top10-ink: #86efac; --c-top30: rgba(96,165,250,.13); --c-top30-ink: #bfdbfe;
  --s1: #34d399; --s2: #60a5fa; --s3: #fb923c; --s4: #a78bfa; --s5: #fbbf24; --s6: #f472b6;
  --shadow: 0 8px 30px rgba(0,0,0,.45); --pop-shadow: 0 12px 40px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); font-size: 13px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); }
.ico { display: inline-grid; place-items: center; } .ico svg { width: 18px; height: 18px; }

/* ---------- каркас: колонка иконок + страница ---------- */
#root { display: flex; min-height: 100vh; }
.nav { flex: none; width: var(--nav-w); background: var(--nav-bg); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 12px 6px; overflow: hidden; }
.nav-logo { display: flex; justify-content: center; padding: 4px 0 14px; text-decoration: none; }
.nav-logo .mark, .brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); flex: none; box-shadow: inset 0 0 0 3px rgba(255,255,255,.2); display: block; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 8px; opacity: .8; white-space: nowrap; border: 0; background: transparent; width: 100%; cursor: pointer; color: inherit; font-size: 10px; text-decoration: none; }
.nav-item .ico svg { width: 19px; height: 19px; }
.nav-item:hover { opacity: 1; background: var(--nav-active); }
.nav-item.active { opacity: 1; background: var(--nav-active); box-shadow: inset 3px 0 0 var(--accent); border-radius: 0; margin: 0 -6px; width: calc(100% + 12px); }
.nav-item.disabled { opacity: .35; cursor: default; pointer-events: none; }
.nav-bottom { margin-top: auto; }
.ava { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; font-family: var(--font-head); }
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 24px; background: var(--top-bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; text-decoration: none; }
.brand small { color: var(--muted); font-family: var(--font-body); font-weight: 400; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.crumbs a { text-decoration: none; padding: 4px 10px; border-radius: 8px; } .crumbs a:hover { background: var(--chip-bg); }
.crumbs a[aria-current], .crumbs .cur { color: var(--ink); background: var(--chip-bg); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); background: var(--ctl-bg); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--muted); }
.account { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.account .who { display: flex; flex-direction: column; line-height: 1.15; }
.account .who b { font-size: 13px; } .account .who small { color: var(--muted); font-size: 11px; }
footer.foot { color: var(--muted); font-size: 12px; padding: 18px 24px 24px; display: flex; gap: 16px; align-items: center; margin-top: auto; }
/* Контент использует всю доступную ширину окна с боковыми отступами. */
.project-bar, #app > .wrap, footer.foot { width: 100%; margin-left: auto; margin-right: auto; }

/* ---------- общие элементы ---------- */
.wrap { padding: 16px 24px 32px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--ctl-radius); border: 1px solid var(--line-strong); background: var(--ctl-bg); font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.green { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.green:hover { filter: brightness(.95); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn[aria-pressed="true"], .btn.on { background: var(--chip-bg); border-color: var(--line-strong); }
.btn .progress { font-variant-numeric: tabular-nums; }
.btn .ico svg { width: 15px; height: 15px; }
.ctl, select.ctl, input.ctl { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); background: var(--ctl-bg); min-width: 0; }
select.ctl:focus, input.ctl:focus, textarea:focus, .search:focus-within { outline: 2px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--chip-bg); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--chip-bg); border: 1px solid var(--line); white-space: nowrap; }
.chip.green { background: var(--accent-soft); border-color: transparent; }
.chip.yellow { background: var(--warn-soft); border-color: transparent; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.run-cost:not(:empty) { padding: 10px 12px; border-radius: 8px; background: var(--chip-bg); font-size: 13px; line-height: 1.45; margin-top: 4px; }
.note { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); border: 1px solid transparent; margin-bottom: 16px; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.danger { color: var(--bad); }
kbd { font-family: var(--font-body); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--chip-bg); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- сайты: таблица по образцу списка проектов Topvisor ---------- */
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions .ctl { width: 260px; }
.sites-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: auto; }
table.sites { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.sites th, table.sites td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
table.sites tbody tr:last-child td { border-bottom: 0; }
table.sites th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--thead); position: sticky; top: 0; z-index: 1; }
table.sites th.sortable { cursor: pointer; user-select: none; }
table.sites th.sortable:hover, table.sites th[aria-sort] { color: var(--ink); }
table.sites .num { text-align: right; }
table.sites tbody tr:hover > td { background: var(--row-hover); }
table.sites td b { font-family: var(--font-head); font-size: 14px; }
.s-site { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.s-ava { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); flex: none; }
.s-title { font-weight: 600; font-size: 14px; text-decoration: none; }
.s-title:hover { color: var(--accent); }
.s-line { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.s-domain { color: var(--muted); font-size: 12px; text-decoration: none; }
.s-domain:hover { color: var(--accent); text-decoration: underline; }
.s-mods { display: inline-flex; gap: 1px; opacity: .45; }
tr:hover .s-mods { opacity: 1; }
.s-mods a { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: var(--muted); }
.s-mods a:hover { background: var(--chip-bg); color: var(--ink); }
.s-mods svg { width: 14px; height: 14px; }
.s-check small { color: var(--muted); font-size: 12px; }
.s-check small.s-partial { display: block; }
.s-run { color: var(--accent); font-weight: 600; }
.s-count { text-decoration: none; font-weight: 600; }
.s-count:hover { color: var(--accent); }
.s-main { display: block; font-size: 12px; }
.s-expand { font-size: 12px; font-weight: 500; }
.sdl { font-size: 11px; font-weight: 600; margin-left: 5px; }
.sdl.up { color: var(--good); } .sdl.down { color: var(--bad); }
.s-dyn { display: inline-flex; gap: 12px; }
.s-dyn i { font-style: normal; font-weight: 600; }
.s-dyn .up { color: var(--tv-up); } .s-dyn .flat { color: var(--muted); } .s-dyn .down { color: var(--tv-down); }
.s-tops { display: grid; grid-template-columns: repeat(3, 62px); gap: 10px; }
.s-top .v { display: block; font-weight: 600; }
.s-top .bar { display: block; height: 4px; border-radius: 2px; background: var(--chip-bg); margin-top: 4px; overflow: hidden; }
.s-top .bar i { display: block; height: 100%; border-radius: 2px; }
.s-top.t0 .bar i { background: var(--tv-up); } .s-top.t1 .bar i { background: var(--tv-blue); } .s-top.t2 .bar i { background: var(--muted-2); }
tr.s-row.open > td { border-bottom-color: transparent; }
tr.s-sub > td { background: var(--thead); padding-top: 7px; padding-bottom: 7px; }
tr.s-sub .s-reg { display: inline-block; padding-left: 42px; font-size: 12px; text-decoration: none; }
tr.s-sub .s-reg:hover { color: var(--accent); text-decoration: underline; }
.sites-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.sites-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sites-bar .seg button small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.sites-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sites-bar select.ctl { min-width: 180px; color: var(--ink); }
.s-fav { border: 0; background: none; padding: 0; width: 18px; font-size: 16px; line-height: 1; color: var(--muted-2); cursor: pointer; flex: none; }
.s-fav:hover, .s-fav.on { color: var(--warn); }
.s-team-btn { display: grid; gap: 2px; border: 0; background: none; padding: 3px 6px; margin: -3px -6px; border-radius: 6px; text-align: left; cursor: pointer; font-size: 12px; color: var(--ink); max-width: 240px; }
.s-team-btn:hover { background: var(--chip-bg); }
.s-team-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-team-btn small { color: var(--muted); font-size: 11px; margin-right: 5px; }
.s-team-btn .none { color: var(--muted-2); font-style: normal; }
.s-unarchive { font-size: 12px; font-weight: 500; }
.project-admin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 12px; color: var(--muted); }
.project-admin > div { flex: 1; min-width: 240px; display: grid; gap: 2px; }
.project-admin b { color: var(--ink); font-size: 13px; }
.project-bar .title h1 .s-fav { font-size: 19px; width: 24px; vertical-align: 1px; }
.project-bar .title h1 .badge { font-size: 11px; vertical-align: 3px; font-family: var(--font-body); font-weight: 500; }
.project-bar .s-team-link { font-size: 13px; font-weight: 500; }
.sub-toggle { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; }
.sub-toggle b { color: var(--ink); font-size: 13px; }
.sub-toggle input { margin-top: 2px; }
@media (max-width: 800px) { .page-head { flex-wrap: wrap; } .head-actions { width: 100%; } .head-actions .ctl { flex: 1; width: auto; } }

/* ---------- шапка проекта и вкладки ---------- */
.project-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 18px 24px 0; }
.project-bar .title h1 { font-size: 21px; line-height: 1.2; }
.project-bar .title .domain { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-color: var(--accent); }

/* ---------- вкладка «Запросы» ---------- */
.kw-layout { display: grid; grid-template-columns: 250px 260px 1fr; gap: 12px; min-height: 60vh; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.panel .panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 12px; border-bottom: 1px solid var(--line); }
.panel .panel-head h3 { font-size: 13px; }
.panel .panel-body { overflow: auto; flex: 1; padding: 6px; }
.tree button, .glist button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; }
.tree button:hover, .glist button:hover { background: var(--chip-bg); }
.tree button[aria-current], .glist button[aria-current] { background: var(--accent-soft); font-weight: 600; }
.tree .count, .glist .count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tree .lvl1 { padding-left: 22px; } .tree .lvl2 { padding-left: 36px; } .tree .lvl3 { padding-left: 50px; }
.tree .caret { color: var(--muted); font-size: 11px; width: 10px; }
.kw-main { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .spacer, .spacer { flex: 1; }
.toolbar input.ctl { flex: 1 1 160px; min-width: 140px; max-width: 260px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--thead); position: sticky; top: 0; z-index: 2; }
table.grid tbody tr:hover { background: var(--row-hover); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.selected { background: var(--accent-soft); }
.row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .1s; }
tr:hover .row-actions { opacity: 1; }
.row-actions button, .row-actions a.serp { border: 1px solid var(--line-strong); background: var(--ctl-bg); border-radius: 6px; padding: 2px 6px; font-size: 12px; text-decoration: none; line-height: 1.3; color: var(--muted); }
.row-actions button:hover, .row-actions a.serp:hover { border-color: var(--muted); color: var(--ink); }
.breadcrumb { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }

/* ---------- вкладка «Позиции»: панель фильтров ---------- */
.pos-toolbar { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 12px; }
.toolbar-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.toolbar-row .toolbar-actions { margin-left: auto; }
.toolbar-row .actions { display: flex; gap: 8px; }
.pos-toolbar select.ctl { max-width: 190px; }
.pos-toolbar #f-folder, .pos-toolbar #f-group { width: 160px; }
.pos-toolbar #f-tag { width: 130px; } .pos-toolbar #region { width: 210px; max-width: 210px; }
.pos-toolbar input.ctl { width: 300px; }
.seg { display: inline-flex; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); overflow: hidden; background: var(--ctl-bg); }
.seg button { border: 0; background: transparent; padding: 0 12px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.seg.tabs-seg button { height: 30px; }

/* ---------- выбор периода (по образцу Topvisor) ---------- */
.period-wrap { position: relative; }
.period-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); background: var(--ctl-bg); cursor: pointer; white-space: nowrap; }
.period-btn .ico svg { width: 16px; height: 16px; color: var(--muted); } .period-btn .chev svg { width: 12px; height: 12px; color: var(--muted); }
.period-btn.open { border-color: var(--tv-blue); background: var(--tv-blue-soft); }
.picker { position: absolute; z-index: 50; top: calc(100% + 6px); left: 12px; width: min(1040px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop-shadow); display: grid; grid-template-columns: 1fr 236px; text-align: left; }
.pk-left { padding: 14px 16px 12px; min-width: 0; }
.pk-presets { display: flex; background: var(--chip-bg); border-radius: 6px; padding: 3px; }
.pk-presets button { flex: 1; height: 30px; border: 0; background: transparent; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.pk-presets button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.pk-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 16px; }
.cal-head { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 30px; font-size: 15px; margin-bottom: 8px; }
.cal-nav { position: absolute; top: 0; width: 30px; height: 30px; border: 0; background: transparent; color: var(--tv-blue); cursor: pointer; display: grid; place-items: center; padding: 0; }
.cal-nav svg { width: 18px; height: 18px; }
.cal-head.first .cal-nav { left: -8px; } .cal-head.last .cal-nav { right: -8px; }
.cal-sel { position: relative; display: inline-flex; align-items: center; }
.cal-sel select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-size: 15px; padding: 0 16px 0 0; cursor: pointer; }
.cal-sel svg { width: 12px; height: 12px; position: absolute; right: 0; pointer-events: none; color: var(--muted); }
.cal-year { color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-dow { color: var(--muted); font-size: 12px; text-align: center; height: 24px; line-height: 24px; }
.cal-day { height: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 13px; border-radius: 6px; cursor: pointer; user-select: none; }
.cal-day:not(.blank):not(.future):hover { background: var(--chip-bg); }
.cal-day .dots { display: flex; gap: 2px; height: 4px; } .cal-day .dots i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.dot-check { background: var(--tv-blue); }
.cal-day.future { color: var(--muted-2); cursor: default; }
.cal-day.in { background: var(--tv-range); border-radius: 0; }
.cal-day.edge { background: var(--tv-blue); color: #fff; } .cal-day.edge .dots i { background: #fff; }
.cal-day.from { border-radius: 6px 0 0 6px; } .cal-day.to { border-radius: 0 6px 6px 0; }
.pk-legend { margin-top: 12px; display: flex; gap: 24px; font-size: 12px; }
.pk-legend span { display: inline-flex; align-items: center; gap: 6px; } .pk-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.pk-right { border-left: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.pk-right label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.pk-right .ctl, .pos-toolbar .pk-right input.ctl, .pos-toolbar .pk-right select.ctl { width: 100%; max-width: none; height: 36px; }
.sel-wrap { position: relative; display: block; }
.inp { position: relative; display: block; } .inp input { padding-right: 32px; } .inp .ico { position: absolute; right: 9px; top: 9px; color: var(--muted); } .inp .ico svg { width: 16px; height: 16px; }
.pk-max { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; } .pk-max .sel-wrap { width: 72px; flex: none; }
.pk-apply { height: 42px; background: var(--tv-blue); color: #fff; border: 0; border-radius: 6px; font-weight: 600; font-size: 14px; cursor: pointer; }

/* ---------- графики ---------- */
.charts { margin-bottom: 12px; padding: 12px 16px 10px; }
.charts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.charts-actions { display: flex; gap: 6px; }
.charts-body { display: grid; grid-template-columns: 1fr 190px; gap: 16px; align-items: center; }
.chart-main { position: relative; min-height: 240px; }
.chart-main svg { display: block; width: 100%; height: auto; }
.chart-main .empty { padding: 100px 20px; }
.chart-tip { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); pointer-events: none; min-width: 150px; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; } .chart-tip div b { margin: 0 0 0 auto; }
.chart-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-donut { text-align: center; border-left: 1px solid var(--line); }
.chart-donut svg { display: block; margin: 0 auto 4px; }
.charts-legend { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px; border: 0; background: transparent; font-size: 12px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.legend-item:hover { background: var(--chip-bg); }
@media (max-width: 1100px) { .charts-body { grid-template-columns: 1fr; } .chart-donut { border-left: 0; } }

/* ---------- сводка (по образцу Topvisor) ---------- */
.tv-summary { display: grid; grid-template-columns: 196px 1fr 1fr 1fr 420px; gap: 10px; margin-bottom: 12px; }
.tv-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-height: 96px; }
.tv-dyn { display: flex; align-items: center; gap: 14px; }
.tv-ring { width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--tv-up) 0 var(--up), var(--tv-flat) var(--up) var(--flat), var(--tv-down) var(--flat) 100%); position: relative; flex: none; }
.tv-ring::after { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.tv-dyn ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.tv-dyn li { display: grid; grid-template-columns: 16px 36px 36px; gap: 8px; align-items: center; font-size: 12px; border-radius: 4px; }
.tv-dyn li.pick { cursor: pointer; margin: -2px -4px; padding: 2px 4px; } .tv-dyn li.pick:hover { background: var(--chip-bg); } .tv-dyn li.sel { background: var(--tv-blue-soft); box-shadow: 0 0 0 1px var(--tv-blue); }
.tv-dyn li b { font-weight: 600; } .tv-dyn li span { color: var(--muted); text-align: right; }
.ic { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; } .ic svg { width: 12px; height: 12px; }
.ic.up { background: var(--tv-up); } .ic.flat { background: var(--tv-flat); } .ic.down { background: var(--tv-down); }
.tv-metric { display: flex; flex-direction: column; justify-content: space-between; }
.tv-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.d { font-weight: 600; font-variant-numeric: tabular-nums; } .d.up { color: var(--tv-up); } .d.down { color: var(--tv-down); } .d.flat { color: var(--muted); font-weight: 400; }
.tv-foot { display: flex; justify-content: space-between; align-items: flex-end; }
.tv-foot .warn svg { width: 16px; height: 16px; display: block; }
.tv-foot .val { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; } .tv-foot .val b { font-weight: 600; font-size: 13px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; }
.spark.bars i { width: 5px; background: var(--tv-spark); border-radius: 1px; display: block; opacity: .55; } .spark.bars i.cur { opacity: 1; }
.spark.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--tv-blue); display: block; }
.tv-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 0; padding: 8px 12px; }
.tv-buckets .col { display: grid; gap: 6px; padding: 0 10px; } .tv-buckets .col + .col { border-left: 1px solid var(--line); }
.tv-b { display: grid; grid-template-columns: 44px 44px 40px 34px; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-size: 12px; height: 26px; }
.tv-b.pick { cursor: pointer; } .tv-b.pick:hover { border-color: var(--line-strong); background: var(--chip-bg); } .tv-b.sel { border-color: var(--tv-blue); box-shadow: 0 0 0 1px var(--tv-blue); }
.tv-b > * { text-align: center; } .tv-b > * + * { border-left: 1px solid var(--tv-line); }
.tv-b .badge { color: #fff; border-radius: 3px; padding: 1px 0; font-size: 11px; font-weight: 600; margin-right: 6px; background: var(--chip-bg); }
.tv-b .pct { color: var(--muted); } .tv-b b { font-weight: 600; } .tv-b .d { font-size: 12px; }
@media (max-width: 1280px) { .tv-summary { grid-template-columns: 196px 1fr 1fr 1fr; } .tv-buckets { grid-column: 1 / -1; grid-template-columns: 1fr 1fr 1fr; } }
.engine-note { font-size: 12px; color: var(--muted); background: var(--warn-soft); border-radius: 6px; padding: 7px 12px; margin: -4px 0 12px; }
.table-filter { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }

/* ---------- таблица позиций ---------- */
/* Таблица шириной по содержимому, как в Topvisor: при нескольких проверках колонки не растягиваются и не оставляют пустоты. */
.pos-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: auto; max-height: calc(100vh - 200px); position: relative; width: fit-content; max-width: 100%; }
table.pos { border-collapse: separate; border-spacing: 0; width: max-content; font-variant-numeric: tabular-nums; }
table.pos th, table.pos td { border-bottom: 1px solid var(--line); padding: 0; }
table.pos th { position: sticky; top: 0; background: var(--thead); z-index: 3; font-weight: 600; font-size: 12px; text-align: left; }
table.pos th.date { width: 84px; min-width: 84px; max-width: 84px; text-align: center; }
table.pos th.date .h { display: block; padding: 7px 6px 6px; cursor: pointer; user-select: none; position: relative; line-height: 1.25; }
table.pos th.date .h:hover { background: var(--chip-bg); }
table.pos th.date .h b { display: block; font-size: 12px; }
table.pos th.date .h .sub { color: var(--muted); font-size: 11px; font-weight: 400; }
table.pos th.date .h .sub .pct { color: var(--ink); font-weight: 600; }
table.pos th.date:first-of-type { background: var(--thead-latest); } table.pos th.date:first-of-type .h b { color: var(--accent); }
table.pos th.date[aria-sort] .h { background: var(--accent-soft); }
table.pos th.date .del { position: absolute; top: 3px; right: 4px; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 0 3px; opacity: 0; border-radius: 4px; }
table.pos th.date .h:hover .del { opacity: 1; }
table.pos th.date .del:hover { background: var(--bad-soft); color: var(--bad); }
table.pos th.date.running .h b::after { content: ' ⟳'; color: var(--accent); }
table.pos td.kw, table.pos th.kw { position: sticky; left: 0; background: var(--surface); z-index: 2; width: 300px; min-width: 300px; max-width: 300px; }
table.pos th.kw { z-index: 4; background: var(--thead); }
table.pos td.kw { padding: 0 12px; height: var(--row-h); }
/* Запрос — на всю ширину колонки и до двух строк, как в Topvisor; кнопки строки появляются поверх текста при наведении. */
table.pos td.kw .text { display: flex; align-items: center; gap: 8px; position: relative; }
table.pos td.kw .text > span:first-child { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; }
table.pos td.kw .tags { display: inline-flex; gap: 3px; }
table.pos td.kw .tags i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
table.pos td.kw .tags i.green { background: var(--accent); } table.pos td.kw .tags i.yellow { background: var(--yellow); }
table.pos td.freq, table.pos th.freq { position: sticky; left: 300px; background: var(--surface); z-index: 2; width: 76px; min-width: 76px; text-align: right; }
table.pos th.freq { z-index: 4; background: var(--thead); }
table.pos td.freq { padding: 0 10px; color: var(--muted); }
table.pos td.p { text-align: center; width: 84px; min-width: 84px; max-width: 84px; height: var(--row-h); padding: 0 6px; cursor: default; white-space: nowrap; font-weight: 600; }
table.pos td.p a { text-decoration: none; display: block; color: inherit; }
table.pos td.p.top3 { background: var(--c-top3); color: var(--c-top3-ink); }
table.pos td.p.top10 { background: var(--c-top10); color: var(--c-top10-ink); }
table.pos td.p.top30 { background: var(--c-top30); color: var(--c-top30-ink); }
table.pos td.p.none { color: var(--muted); font-weight: 400; }
table.pos td.p.unknown { color: var(--warn); background: var(--warn-soft); }
.checks-row label.disabled { opacity: .5; cursor: not-allowed; }
table.pos td.p.pending { background: repeating-linear-gradient(90deg, var(--chip-bg) 0 6px, var(--surface) 6px 12px); color: transparent; }
table.pos td.p sup { font-size: 9px; margin-left: 3px; font-weight: 600; vertical-align: top; position: relative; top: 2px; }
table.pos td.p sup.up { color: var(--good); } table.pos td.p sup.down { color: var(--bad); } table.pos td.p sup.new { color: var(--good); }
table.pos td.p:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
table.pos tbody tr:hover td { background-color: var(--row-hover); }
table.pos tbody tr:hover td.p.top3 { background: var(--c-top3); } table.pos tbody tr:hover td.p.top10 { background: var(--c-top10); } table.pos tbody tr:hover td.p.top30 { background: var(--c-top30); }
table.pos td.kw .row-actions { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); padding: 2px 6px 2px 14px; background: linear-gradient(90deg, transparent, var(--row-hover) 12px); pointer-events: none; }
table.pos tr:hover td.kw .row-actions { pointer-events: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }

/* ---------- модалки и тосты ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 70; overflow: auto; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 560px; max-width: 100%; box-shadow: var(--pop-shadow); }
.modal header { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal .body { padding: 16px 20px; display: grid; gap: 12px; }
.modal .body p { margin: 0; }
.modal .field .ctl, .modal .field input:not([type=checkbox]):not([type=radio]), .modal .field select { width: 100%; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal textarea { width: 100%; min-height: 140px; padding: 10px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); resize: vertical; background: var(--ctl-bg); }
.modal .close { border: 0; background: none; font-size: 18px; color: var(--muted); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; animation: pop .15s ease-out; }
.toast.ok { border-left: 4px solid var(--accent); }
.toast.warn { border-left: 4px solid var(--warn); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.history-list { display: grid; gap: 4px; max-height: 300px; overflow: auto; font-size: 13px; }
.history-list div { display: grid; grid-template-columns: 90px 60px 1fr; gap: 10px; align-items: center; }
.history-list a { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark.hist { height: 40px; } .spark.hist i { display: block; width: 10px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 1; } .spark.hist i.none { background: var(--warn); }
.checks-row { display: flex; gap: 8px; flex-wrap: wrap; }
.checks-row label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--ctl-radius); white-space: nowrap; cursor: pointer; }
.checks-row label:hover { border-color: var(--muted); }
@media (max-width: 1100px) { .kw-layout { grid-template-columns: 1fr; } }

/* Платные запросы к Яндексу: состояние и (пока заблокированный) переключатель на странице «Мои сайты». */
.paid-card { display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.paid-card p { margin: 4px 0 0; font-size: 12px; color: var(--muted); max-width: 900px; }
.paid-card .paid-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 6px; font-size: 13px; }
.paid-card .paid-row b { min-width: 64px; font-weight: 600; }
.paid-card .paid-note { font-size: 12px; color: var(--muted); }
.paid-card .paid-state { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--chip-bg); color: var(--muted); }
.paid-card .paid-state.on { background: var(--accent-soft); color: var(--accent); }
.paid-card .btn { margin-left: auto; flex: none; display: inline-flex; gap: 6px; align-items: center; }
.paid-card .btn svg { width: 16px; height: 16px; }
.paid-card .btn:disabled { opacity: .55; cursor: not-allowed; }

/* Тур по интерфейсу: затемнение с «окном» над элементом и карточка с шагом (tour.js). */
.tour-btn { font-weight: 700; font-family: var(--font-head); }
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-shade { position: absolute; inset: 0; }
.tour.centered .tour-shade { background: rgba(0,0,0,.5); }
.tour-spot { position: fixed; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); outline: 2px solid var(--accent); pointer-events: none; transition: all .2s ease; }
.tour.centered .tour-spot { display: none; }
.tour-card { position: fixed; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--pop-shadow); padding: 18px 20px 14px; transition: top .2s ease, left .2s ease; }
.tour-card.loading { opacity: .6; }
.tour-card h3 { margin: 0 24px 6px 0; font-size: 16px; }
.tour-card .tour-text { margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.tour-card footer { display: flex; align-items: center; gap: 8px; }
.tour-card .tour-count { color: var(--muted); font-size: 12px; }
.tour-card .tour-btns { margin-left: auto; display: flex; gap: 8px; }
.tour-close { position: absolute; top: 10px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
