/* SEO Rank — светлая «приборная» тема.
   Нейтральный прохладный фон + teal-акцент, глубина тональными слоями (без градиентов),
   дельты как тикер (зелёный рост / красный падение), Inter + табличные цифры.
   Токены по ролям MD3: surface/on-surface, accent(primary), outline/outline-variant. */

/* Inter (вариативный, self-hosted) — латиница + кириллица. Без него весь дизайн
   падал на системный fallback и заголовки выглядели «сжато». */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  /* surface: глубину даём тональными ступенями, а не тенью/градиентом */
  --bg: #f4f6f8;
  --surface-1: #ffffff;
  --surface-2: #eef1f4;
  --surface-3: #e3e7ec;
  --sidebar-bg: #f0f2f5;

  /* outline (интерактив, 3:1) / outline-variant (декор-разделители) */
  --line: rgba(15, 22, 34, 0.10);
  --line-strong: rgba(15, 22, 34, 0.16);

  /* on-surface / on-surface-variant */
  --text: #353d49;
  --text-strong: #0f141c;
  --muted: #5c6470;
  --muted-soft: #8d95a1;

  /* primary = глубокий тил */
  --accent: #0e6b63;
  --accent-strong: #0a544d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(14, 107, 99, 0.10);
  --accent-line: rgba(14, 107, 99, 0.32);

  /* семантика данных: рост / падение позиций */
  --up: #1f9d57;
  --up-soft: rgba(31, 157, 87, 0.12);
  --down: #d8462f;
  --down-soft: rgba(216, 70, 47, 0.12);
  --top10: rgba(31, 157, 87, 0.08);
  --down-line: rgba(216, 70, 47, 0.30);
  --accent-tint: #e7f1f0;
  --topbar-bg: rgba(244, 246, 248, 0.85);

  --radius-pill: 999px;
  --radius-btn: 8px;
  --radius-card: 12px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --shadow-card: 0 1px 2px rgba(15, 22, 34, 0.04), 0 1px 3px rgba(15, 22, 34, 0.06);
  --shadow-lift: 0 2px 10px rgba(15, 22, 34, 0.08);
  --focus: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent-line);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; color: var(--text-strong); font-weight: 700; letter-spacing: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 17px; line-height: 1.25; letter-spacing: 0; }
h3 { font-size: 15px; line-height: 1.3; letter-spacing: 0; }
p { margin: 0; }

a { color: var(--accent); text-decoration: none; transition: color 0.14s ease; }
a:hover { color: var(--accent-strong); }

.num, table, .metric-card strong, .cell-position {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv01" 1;
}

.small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.muted { color: var(--muted-soft); }

/* ---------- shell ---------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 12px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}
.brand-mark {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-logo { width: 30px; height: 30px; border-radius: var(--radius-sm); display: block; }

.side-label {
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.side-nav { display: grid; gap: 4px; }
.side-nav__item, .side-subnav__item {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.14s ease, color 0.14s ease;
}
.side-nav__item:hover, .side-subnav__item:hover { background: var(--surface-1); color: var(--text-strong); }
.side-nav__item.is-active, .side-subnav__item.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.project-context { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.project-switch {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-strong);
}
.project-switch strong { font-size: 13px; }
.project-switch span { font-size: 12px; color: var(--muted); }
.project-switch:hover { background: var(--surface-2); }
.side-subnav { display: grid; gap: 4px; }

/* ---------- main ---------- */
.main-shell { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
  padding: 0 28px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.breadcrumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.breadcrumb .crumb-link { color: var(--muted); font-weight: 500; }
.breadcrumb .crumb-link:hover { color: var(--accent); }
.breadcrumb .crumb-sep { color: var(--muted-soft); font-weight: 400; }
.breadcrumb .crumb-current { color: var(--text-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { display: inline-flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.user-menu a { color: var(--muted); }
.user-menu a:hover { color: var(--text-strong); }
.user-menu__name { font-weight: 600; }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 56px; height: 56px; border-radius: var(--radius-pill); object-fit: cover; }
.profile-avatar--ph { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 22px; }
.profile-form { max-width: 360px; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px; border-radius: var(--radius-btn);
  background: transparent; border: 1px solid var(--line-strong); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted-soft); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--radius-btn);
  background: var(--down); color: #fff; font-family: inherit; font-size: 13px; font-weight: 650;
  cursor: pointer; transition: background 0.14s ease;
}
.btn-danger:hover { background: #c23d28; }
.settings-danger { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.topup-form { max-width: 320px; }

/* меню: аватар + имя */
.user-menu__profile { display: inline-flex; align-items: center; gap: 8px; }
.menu-avatar { width: 26px; height: 26px; border-radius: var(--radius-pill); object-fit: cover; }
.menu-avatar--ph { display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 12px; }

/* админ-шапка с кнопкой справа */
.admin-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.balance-amount { font-size: 24px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }

.btn-link { display: inline; height: auto; background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.btn-link:hover { background: none; color: var(--accent-strong); text-decoration: underline; }
.btn-link:focus-visible { outline: none; box-shadow: none; text-decoration: underline; }

/* модалки (нативный dialog) */
dialog { border: none; border-radius: var(--radius-card); padding: 0; background: var(--surface-1); color: var(--text); box-shadow: var(--shadow-lift); max-width: 460px; width: 92vw; }
dialog::backdrop { background: rgba(15, 22, 34, 0.45); }
.modal-body { padding: 22px; display: grid; gap: 16px; max-height: 84vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 17px; }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--surface-2); color: var(--text-strong); }
.modal-section { border-top: 1px solid var(--line); padding-top: 16px; }

/* подсказка-тултип */
.label-hint { display: inline-flex; align-items: center; gap: 6px; }
.hint {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--muted);
  font-size: 11px; font-weight: 700; cursor: help; position: relative;
}
.hint::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 230px; max-width: 60vw;
  background: var(--text-strong); color: var(--surface-1);
  font-size: 12px; font-weight: 400; line-height: 1.4;
  padding: 8px 10px; border-radius: 8px;
  opacity: 0; visibility: hidden; transition: opacity 0.14s ease;
  z-index: 30; pointer-events: none; box-shadow: var(--shadow-lift);
  white-space: normal; text-align: left;
}
.hint:hover::after, .hint:focus::after { opacity: 1; visibility: visible; }

/* совместный доступ */
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.share-row:last-of-type { border-bottom: 0; }
.readonly-list { display: grid; gap: 6px; font-size: 13px; color: var(--text); }

/* тосты */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; width: min(340px, calc(100vw - 32px)); }
.toast {
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; line-height: 1.4;
  box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast--ok { border-color: var(--up); }
.toast--error { border-color: var(--down); }

.content { padding: 28px; max-width: 1320px; width: 100%; display: flex; flex-direction: column; gap: 20px; }

.page-header { margin-bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.page-header p { margin-top: 6px; color: var(--muted); max-width: 60ch; }
.back { display: inline-block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.back:hover { color: var(--accent); }

/* ---------- panels ---------- */
.panel {
  background: var(--surface-1);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.panel-head p { margin-top: 4px; overflow-wrap: anywhere; }
.panel-head > div { flex: 1 1 auto; min-width: 0; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 332px; gap: 20px; align-items: start; }
.main-column { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.right-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }

/* ---------- KPI / signature ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.metric-card {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface-1);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.metric-card span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric-card strong { font-size: 30px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.01em; line-height: 1.1; white-space: nowrap; }
.metric-card small { font-size: 12px; color: var(--muted); }
.metric-card:first-child {
  background: var(--accent-tint);
}
.metric-card:first-child strong { color: var(--accent-strong); }

/* ---------- projects list ---------- */
.project-list { display: grid; gap: 10px; }
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-card);
  background: var(--surface-1);
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.14s ease, background 0.14s ease;
}
.project-row:hover { background: var(--surface-2); box-shadow: var(--shadow-lift); }
.project-row__main h3 { color: var(--text-strong); }
.project-card__meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.project-row__stats { display: flex; gap: 24px; }
.project-row__stats > div { display: grid; gap: 1px; text-align: right; }
.project-row__stats span { font-size: 12px; letter-spacing: 0; color: var(--muted); }
.project-row__stats strong { font-size: 18px; color: var(--text-strong); }
.project-row__stats small { font-size: 11px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.ledger-scroll { max-height: 460px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky;
  top: 0;
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  background: var(--surface-1);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
thead th a { color: var(--muted-soft); }
thead th a:hover { color: var(--text-strong); }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.small a { color: var(--muted); }
td.small a:hover { color: var(--accent); }

.keyword-table-wrap { max-height: 560px; overflow: auto; }
.activity-wrap { max-height: 640px; overflow: auto; }
.keyword-table-wrap td:nth-child(2) { font-size: 15px; font-weight: 650; color: var(--text-strong); }
.kw-pri {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  vertical-align: middle;
}

/* delta badges (trading style) */
.delta-up, .delta-down, .delta-flat { font-weight: 650; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }
.delta-flat { color: var(--muted-soft); }

.cell-delta { display: block; font-size: 11px; font-weight: 600; margin-top: 2px; }
.cell-delta-up { color: var(--up); }
.cell-delta-down { color: var(--down); }
.cell-delta-flat { color: var(--muted-soft); }

/* position zones */
.position-top10 { background: var(--top10); box-shadow: inset 2px 0 0 var(--up); }
.position-top30 { background: transparent; }
.position-low { color: var(--muted); }
.position-missing { color: var(--muted-soft); }

/* ---------- sort chips / filters / tabs ---------- */
.sort-toolbar, .filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.sort-toolbar > span { font-size: 12px; color: var(--muted); margin-right: 4px; }
.sort-chip, .filter-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.sort-chip:hover, .filter-chip:hover { color: var(--text-strong); border-color: var(--line-strong); background: var(--surface-2); }
.sort-chip.is-active, .filter-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-strong);
}
.tabs { display: flex; gap: 4px; }
.tab { padding: 8px 14px; border-radius: var(--radius-pill); color: var(--muted); font-weight: 500; }
.tab.is-active { background: var(--surface-2); color: var(--text-strong); }

/* ---------- chart ---------- */
.chart-wrap { position: relative; height: 280px; }
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.form-grid label.checkbox { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  color: var(--text-strong);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--focus); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.06s ease;
}
button:hover, .btn:hover { background: var(--accent-strong); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: var(--focus); }
button[disabled] { background: var(--surface-3); color: var(--muted-soft); cursor: not-allowed; }

/* disclosure panels */
.disclosure summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  padding: 2px 0;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: "+ "; color: var(--accent); font-weight: 700; }
.disclosure[open] summary::before { content: "– "; }
.disclosure[open] summary { margin-bottom: 16px; }
.action-panel h2 { margin-bottom: 4px; }

.latest-job {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.latest-job .muted { font-size: 12px; color: var(--muted); }
.latest-job-error {
  flex-basis: 100%;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--down);
}

/* job badges */
.job-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.job-pending { background: var(--surface-3); color: var(--muted); }
.job-running { background: var(--accent-soft); color: var(--accent-strong); }
.job-done { background: var(--up-soft); color: var(--up); }
.job-error { background: var(--down-soft); color: var(--down); }

/* notices / empty */
.notice {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-strong);
  font-size: 13px;
}
.empty-state { padding: 28px; text-align: center; color: var(--muted-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius-card); }

/* ---------- dynamics matrix ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.filters label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.filters button { height: 40px; }
.dynamics-wrap { overflow: auto; max-height: 600px; }
.dynamics-table th, .dynamics-table td { border: 1px solid var(--line); text-align: center; }
.dynamics-table .sticky-keyword { position: sticky; left: 0; z-index: 2; text-align: left; background: var(--surface-1); min-width: 220px; }
.dynamics-date span { display: block; font-weight: 650; color: var(--text); }
.dynamics-date small { color: var(--muted-soft); font-weight: 500; }
.dynamics-cell { padding: 8px; }
.cell-position { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.keyword-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; color: var(--text-strong); font-size: 13px; }
.kw-del {
  flex-shrink: 0; width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0; background: none; color: var(--muted-soft);
  font-size: 16px; line-height: 1; cursor: pointer; border-radius: var(--radius-sm);
  opacity: 0; transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.dynamics-table tr:hover .kw-del { opacity: 1; }
.kw-del:hover { background: var(--down-soft); color: var(--down); }
.keyword-meta { font-size: 11px; color: var(--muted-soft); margin-top: 2px; }

/* ---------- auth ---------- */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-card {
  width: min(400px, 92vw);
  display: grid;
  gap: 16px;
  padding: 34px 32px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.auth-brand { display: inline-flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 650; color: var(--text-strong); margin-bottom: 4px; }
.auth-card h1 { font-size: 22px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted-soft); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { text-align: center; }
.auth-alt a { font-weight: 600; }
.auth-card p { color: var(--muted); font-size: 13px; }
.login-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--down-soft);
  border: 1px solid var(--down-line);
  color: var(--down);
  font-size: 13px;
}
.btn-yandex {
  width: 100%;
  height: 46px;
  background: #fff;
  color: #1a1a1a;
  font-weight: 600;
  border: 1px solid var(--line-strong);
}
.btn-yandex:hover { background: #f4f6f8; border-color: var(--muted-soft); }
.btn-yandex .ya { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-pill); background: #fc3f1d; color: #fff; font-weight: 800; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }
  .project-context { display: none; }
}
@media (max-width: 620px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 22px; }
  .page-header, .page-header p { text-align: left; }
  .project-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .project-row__stats { gap: 16px; flex-wrap: wrap; }
  .project-row__stats > div { text-align: left; }
}
