/* effectSearch — общие стили дашбордов (кабинет владельца и админ-панель).
   Всё, что повторяется в обеих панелях, живёт здесь. Различия конкретной
   панели переопределяются в cabinet.css / admin.css, которые подключаются
   после этого файла. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6eaf2;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #B9001D;
  --accent-soft: #fdeaec;
  --accent-strong: #8f0016;
  --accent-bright: #e23b52;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --orange: #f59e0b;
  --orange-soft: #fef3e2;
  --red: #ef4444;
  --red-soft: #feecec;
  --sidebar: #0b1526;
  --radius: 16px;
  --hover: #f6f8fc;
  --stripe: #f1f5f9;
  --track: #eef2f7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }

svg { flex-shrink: 0; }

/* ---------- Каркас: сайдбар + шапка ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  display: flex; align-items: center; justify-content: center;
}
.brand-logo svg { width: 20px; height: 20px; }
.brand .tag {
  margin-left: auto; font-size: 11px; background: var(--accent); color: #fff;
  border-radius: 6px; padding: 3px 7px; font-weight: 700;
}
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: #94a3b8; cursor: pointer; font-weight: 500; border: none; background: none;
  width: 100%; text-align: left; font-size: 14px; font-family: inherit;
}
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: var(--accent-strong); }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* нижний блок сайдбара: сводка и выход */
.side-foot { margin: 12px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,0.05); font-size: 12.5px; color: #94a3b8; }
.side-foot b { color: #fff; display: block; margin-bottom: 4px; }
.side-foot a { color: #ff97a4; display: inline-block; margin-top: 8px; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: 0 28px; height: 62px;
  display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5;
}
.crumbs { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }
.crumbs .sep { color: #cbd5e1; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; color: var(--ink); font-weight: 600; font-size: 13px;
}
.chip svg { width: 15px; height: 15px; color: var(--muted); }
.user { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--sidebar); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* ---------- Контент и заголовки страниц ---------- */
.content { padding: 26px 28px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); width: 100%; margin-top: -12px; }
.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 13px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: #b45309; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.gray { background: var(--stripe); color: var(--muted); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.small { padding: 3px 9px; font-size: 11.5px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; padding: 11px 18px; font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Сетки и карточки ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: 2fr 1fr; }
.grid.cols-12 { grid-template-columns: 1fr 1fr; }
/* Три колонки страницы «Аналитика»: источники → топ запросов → без результатов */
.grid.cols-3 { grid-template-columns: 1.05fr 1.35fr 1fr; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 16px; font-weight: 800; margin-bottom: 14px; }
.card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card .card-head h3 { margin: 0; }
.card .card-head .link { margin-left: auto; font-weight: 600; font-size: 13px; cursor: pointer; }

.tile { display: flex; gap: 14px; align-items: flex-start; }
.tile-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex: 0 0 44px;
}
.tile-icon svg { width: 22px; height: 22px; }
.tile-icon.green { background: var(--green-soft); color: var(--green); }
.tile-icon.orange { background: var(--orange-soft); color: #b45309; }
.tile .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.tile .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
.delta { font-size: 12.5px; font-weight: 700; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }
.delta small { color: var(--muted); font-weight: 500; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--stripe); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.num { font-variant-numeric: tabular-nums; }
/* ---------- Графики и вспомогательное ---------- */
.bar-track { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.bar-track i.blue { background: var(--accent-bright); }
.bar-track i.orange { background: var(--orange); }

.legend { display: flex; flex-direction: column; gap: 14px; }
.legend.horizontal { margin-left: auto; flex-direction: row; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend .li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: 0 0 10px; }
.legend b { display: block; }
.legend .sub { color: var(--muted); }

.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--track); }
.chart-axis { fill: var(--muted); font-size: 10px; }

/* Кольцо-диаграмма: общий размер 156px, .ring--sm — 150px в предпросмотрах */
.ring { position: relative; width: 156px; height: 156px; flex: 0 0 156px; }
.ring.ring--sm { width: 150px; height: 150px; flex: 0 0 150px; margin: 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring.ring--sm svg { width: 150px; height: 150px; }
.ring .txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .txt b { font-size: 27px; font-weight: 800; }
.ring .txt span { color: var(--muted); font-size: 12px; }
.ring.md { width: 150px; height: 150px; flex: 0 0 150px; margin: 0 auto; }
.ring.md svg { width: 150px; height: 150px; }

/* Строка простого списка с разделителем (без таблиц) */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--stripe); }
.list-row.gap14 { gap: 14px; }
.list-row.tight { padding: 10px 0; }
.row-kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--stripe); font-size: 13.5px; }

.dark-muted { color: #94a3b8; }

/* ---------- Страница «Аналитика» ---------- */
.clegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.clegend .ln { display: inline-block; width: 16px; border-top: 2px solid currentColor; vertical-align: middle; margin-right: 6px; }
.clegend .ln.dash { border-top-style: dashed; }
.clegend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.f-step { display: flex; gap: 10px; align-items: flex-start; }
.f-step .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: 0 0 10px; }
.f-step .g { flex: 1; min-width: 0; }
.f-step b { display: block; font-size: 15px; }
.f-step .lab { font-weight: 700; }
.f-step .n { color: var(--muted); font-size: 12.5px; white-space: nowrap; align-self: center; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--stripe); }
.rank-row .name { flex: 0 0 130px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .bar-track { flex: 1; }
.rank-row .v { flex: 0 0 66px; text-align: right; color: var(--muted); }
/* Цвета серий графиков аналитики — должны совпадать с константой CH в JS */
.clegend .sw.q { background: var(--accent); }
.clegend .sw.c { background: var(--green); }
.clegend .ln.q { color: var(--accent); }
.clegend .ln.c { color: var(--green); }
.clegend .ln.dq { color: #f0a3ad; }
.clegend .ln.dc { color: #9be7b3; }
.f-step .dot.d1 { background: var(--accent); }
.f-step .dot.d2 { background: #f0a3ad; }
.f-step .dot.d3 { background: #cbd5e1; }
.f-step .dot.d4 { background: #e2e8f0; }
.f-step .sub { color: var(--muted); font-size: 11.5px; }
.donut-v { flex-direction: column; align-items: stretch; }
.donut-v .legend { width: 100%; }
.bar-track i.brand { background: var(--accent); }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.big-stat { font-size: 38px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0; }
.legend-inline { display: flex; gap: 6px; align-items: center; color: #94a3b8; }
.badge-accent { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 6px; padding: 3px 7px; }
.my-tight { margin: 6px 0 2px; }

.empty { color: var(--muted); text-align: center; padding: 28px 10px; }
.hint { color: var(--muted); font-size: 12.5px; }
.d { color: var(--muted); font-size: 12.5px; }

/* ---------- Формы ---------- */
.form-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.form-row label { font-weight: 600; color: var(--muted); font-size: 13px; min-width: 160px; }
.form-row .hint { font-weight: 500; }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=tel], select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f6b9c2; border-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin-top: 2px; }
.check b { display: block; }
.check span { color: var(--muted); font-size: 12.5px; }

/* ---------- Модальные окна и тосты ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 19px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--sidebar); color: #fff; border-radius: 12px;
  padding: 13px 18px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: .25s; z-index: 99; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Выпадающие меню шапки ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 14px 34px rgba(15,23,42,.14); padding: 6px; min-width: 210px;
  display: none; z-index: 40; max-height: 380px; overflow: auto;
}
.menu.open { display: block; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.on { color: var(--accent); font-weight: 700; }
.menu .hd { padding: 8px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.menu .it { padding: 9px 10px; border-radius: 8px; font-size: 13px; }
.menu .it b { display: block; }
.menu .it span { color: var(--muted); font-size: 12px; }

/* ---------- Постраничная навигация ---------- */
.pager { display: flex; gap: 6px; align-items: center; }
.pager button { min-width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.pager button.on { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .gap { color: var(--muted); padding: 0 2px; }
.sortbtn { border: none; background: none; padding: 0; font: inherit; color: var(--muted); font-weight: 700; cursor: pointer; }
.sortbtn.on { color: var(--accent); }
.sortbtn:hover { text-decoration: underline; }

/* ---------- Утилиты разметки ----------
   Заменяют повторявшиеся inline-style в разметке обеих панелей. */
.mt  { margin-top: 18px; }
.mt2 { margin-top: 14px; }
.mt3 { margin-top: 12px; }
.mt4 { margin-top: 10px; }
.mt5 { margin-top: 8px; }
.mt6 { margin-top: 6px; }
.mb  { margin-bottom: 14px; }
.mb2 { margin-bottom: 16px; }
.mauto { margin-left: auto; }
.note { color: var(--muted); margin: 14px 0 6px; }
.flex1 { flex: 1; }
.off { display: none !important; }
.row { display: flex; gap: 10px; }
.row-c { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 18px; }
.nowrap { white-space: nowrap; }
.pointer { cursor: pointer; }
.scroll-x { overflow-x: auto; }
.w-full { width: 100%; }
.w74 { width: 74px; } .w80 { width: 80px; } .w90 { width: 90px; } .w100 { width: 100px; }
.w110 { width: 110px; } .w120 { width: 120px; } .w130 { width: 130px; } .w140 { width: 140px; }
.w150 { width: 150px; } .w160 { width: 160px; } .w170 { width: 170px; } .w180 { width: 180px; }
.w200 { width: 200px; } .w220 { width: 220px; } .w240 { width: 240px; }
.w520 { width: 520px; } .w420 { width: 420px; } .w560 { width: 560px; } .w640 { width: 640px; }
.w760 { width: 760px; }
.w60 { width: 60px; } .w96 { width: 96px; } .w36 { width: 36px; }

/* Текст */
.muted { color: var(--muted); }
.t-ok { color: var(--green); }
.t-bad { color: var(--red); }
.f11 { font-size: 11px; } .f115 { font-size: 11.5px; } .f12 { font-size: 12px; }
.f125 { font-size: 12.5px; } .f13 { font-size: 13px; } .f135 { font-size: 13.5px; }
.f16 { font-size: 16px; } .f17 { font-size: 17px; } .f19 { font-size: 19px; }
.b500 { font-weight: 500; } .b600 { font-weight: 600; } .b700 { font-weight: 700; } .b800 { font-weight: 800; }
.tac { text-align: center; } .tar { text-align: right; }
.lh15 { line-height: 1.5; } .lh155 { line-height: 1.55; } .lh16 { line-height: 1.6; }
.break-all { word-break: break-all; }
.ls-tight { letter-spacing: -.03em; }

/* Раскладка */
.min0 { min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.jc-center { justify-content: center; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; }
.gap12 { gap: 12px; } .gap14 { gap: 14px; } .gap18 { gap: 18px; } .gap20 { gap: 20px; }
.mt1 { margin-top: 4px; }
.mb4 { margin-bottom: 4px; } .mb6 { margin-bottom: 6px; } .mb8 { margin-bottom: 8px; } .mb10 { margin-bottom: 10px; }
.ml8 { margin-left: 8px; }
.my1 { margin: 4px 0; } .my8 { margin: 8px 0; } .my16 { margin: 16px 0; }
.under { margin-top: -8px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.mw640 { max-width: 640px; } .mw760 { max-width: 760px; } .mw60 { max-width: 60%; }
.min110 { min-width: 110px; } .min130 { min-width: 130px; } .min180 { min-width: 180px; } .min220 { min-width: 220px; }
.w34 { width: 34px; } .w44 { width: 44px; }
.abs-fill { position: absolute; inset: 0; }
.i13 { width: 13px; height: 13px; } .i15 { width: 15px; height: 15px; } .i18 { width: 18px; height: 18px; }

/* ---------- Карточка результата теста поиска ---------- */
.res-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; gap: 12px; margin-bottom: 10px; }
.res-card img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #f8fafc; flex: 0 0 64px; }
.result-price { color: var(--accent); font-weight: 800; }

@media (max-width: 1200px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2, .grid.cols-12 { grid-template-columns: 1fr; }
  .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
