/* ============ Дизайн-токены ============ */
:root {
  --bg:            #f4f6fb;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e6e9f0;
  --text:          #1a2233;
  --text-soft:     #5b657a;
  --text-muted:    #98a1b3;
  --primary:       #4f46e5;
  --primary-600:   #4338ca;
  --primary-soft:  #eef0ff;
  --accent:        #0ea5a4;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --shadow-sm:     0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md:     0 4px 16px rgba(16,24,40,.08);
  --shadow-lg:     0 18px 50px rgba(16,24,40,.16);
  --radius:        14px;
  --radius-sm:     10px;
  --sidebar-w:     264px;
}

[data-theme="dark"] {
  --bg:            #0c0f17;
  --surface:       #141823;
  --surface-2:     #1a1f2e;
  --border:        #262c3b;
  --text:          #e7ebf3;
  --text-soft:     #a6afc2;
  --text-muted:    #6b7589;
  --primary:       #6366f1;
  --primary-600:   #818cf8;
  --primary-soft:  #1e2236;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow-md:     0 6px 22px rgba(0,0,0,.45);
  --shadow-lg:     0 20px 60px rgba(0,0,0,.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ Бренд ============ */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand__mark { color: var(--primary); font-size: 20px; }
.brand--light .brand__mark, [data-theme] .brand--light .brand__mark { color: #a9b2ff; }
.brand__accent { color: var(--primary); }
.brand--light .brand__accent { color: #a9b2ff; }

/* ============ Кнопки / поля ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--surface-2); transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--sm { padding: 8px 13px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--primary-600); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-2); }

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 500; color: var(--text-soft); margin-bottom: 6px; }
.field__input {
  width: 100%; padding: 12px 14px; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: .15s ease;
}
.field__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
/* <select> рендерится на 2px выше <input> при одинаковых паддингах — из-за этого в строках
   формы, где поля выровнены по низу, подписи над селектами уезжали вверх. Фиксируем высоту. */
select.field__input:not(.field__input--sm) { height: 42px; padding-top: 0; padding-bottom: 0; }
.field__password { position: relative; }
.field__toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; font-size: 16px; opacity: .55; padding: 6px;
}
.field__toggle:hover { opacity: 1; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.link { color: var(--primary); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ============ Экран логина ============ */
.login-screen { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-aside {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1100px 600px at 0% 0%, #5b54f0 0%, #3b2fc4 42%, #211b78 100%);
  display: flex; align-items: center;
}
.login-aside::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(420px 420px at 88% 18%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(360px 360px at 75% 95%, rgba(14,165,164,.30), transparent 60%);
}
.login-aside__inner { position: relative; z-index: 1; padding: 56px; max-width: 520px; }
.login-aside__title { font-size: 30px; line-height: 1.2; margin: 40px 0 16px; letter-spacing: -.02em; }
.login-aside__text { color: rgba(255,255,255,.82); font-size: 15px; margin-bottom: 26px; }
.login-aside__list { list-style: none; display: grid; gap: 12px; margin-bottom: 40px; }
.login-aside__list li { position: relative; padding-left: 28px; color: rgba(255,255,255,.9); }
.login-aside__list li::before {
  content: '✓'; position: absolute; left: 0; top: -1px; width: 18px; height: 18px;
  display: grid; place-items: center; font-size: 11px; border-radius: 50%;
  background: rgba(255,255,255,.18);
}
.login-aside__stats { display: flex; gap: 34px; border-top: 1px solid rgba(255,255,255,.18); padding-top: 24px; }
.login-aside__stats strong { display: block; font-size: 24px; }
.login-aside__stats span { font-size: 12px; color: rgba(255,255,255,.7); }

.login-main { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card__brand { display: none; margin-bottom: 26px; }
.login-card__title { font-size: 24px; letter-spacing: -.02em; }
.login-card__subtitle { color: var(--text-soft); margin: 6px 0 28px; }
.login-card__row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; }
.login-card__divider { text-align: center; position: relative; margin: 22px 0; color: var(--text-muted); font-size: 12px; }
.login-card__divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.login-card__divider span { position: relative; background: var(--bg); padding: 0 12px; }
.login-card__foot { text-align: center; margin-top: 24px; color: var(--text-soft); font-size: 13px; }

@media (max-width: 880px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-card__brand { display: flex; }
}

/* ============ Каркас приложения ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: #11152099; backdrop-filter: blur(8px);
  background: linear-gradient(180deg, #181d2b 0%, #141823 100%);
  color: #cfd6e6; display: flex; flex-direction: column;
  border-right: 1px solid #00000030; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { padding: 20px 20px 14px; color: #fff; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px; scrollbar-width: thin; scrollbar-color: #ffffff24 transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: #ffffff20; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; transition: background .15s ease; }
.nav::-webkit-scrollbar-thumb:hover { background: #ffffff3d; background-clip: padding-box; }
.nav:not(:hover) { scrollbar-color: #ffffff14 transparent; }
.nav:not(:hover)::-webkit-scrollbar-thumb { background: #ffffff12; background-clip: padding-box; }
.nav__group { margin-bottom: 18px; }
.nav__caption {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #707a90; padding: 8px 12px 6px; font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: #b6bed1; font-weight: 500; cursor: pointer; transition: .14s ease; margin-bottom: 2px;
}
.nav__item:hover { background: #ffffff10; color: #fff; }
.nav__item.is-active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.nav__icon { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.nav__badge {
  margin-left: auto; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #ffffff18; color: #dfe4f0;
}
.nav__badge--accent { background: var(--accent); color: #fff; }
.is-active .nav__badge { background: #ffffff2e; color: #fff; }
.sidebar__foot { padding: 12px; border-top: 1px solid #ffffff12; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.userchip:hover { background: #ffffff10; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 700; font-size: 13px;
}
.userchip__info { display: flex; flex-direction: column; line-height: 1.25; }
.userchip__name { font-size: 13px; font-weight: 600; color: #fff; }
.userchip__role { font-size: 12px; color: #8d96ab; }

/* ============ Основная область ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search__icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search__input {
  width: 100%; padding: 10px 14px 10px 36px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 13px;
}
.search__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.search__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px;
}
.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.iconbtn {
  position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); font-size: 16px; display: grid; place-items: center;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn__dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }

/* IP сервера в шапке (кнопка-копирование) */
.serverip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 11px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap;
}
.serverip:hover { background: var(--surface-2); }
.serverip__key { color: var(--text-soft); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.serverip__val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; font-weight: 600; }
.serverip__ico { color: var(--text-soft); font-size: 14px; }
.serverip.copied { border-color: var(--success, #16a34a); color: var(--success, #16a34a); }
.serverip.copied .serverip__key, .serverip.copied .serverip__ico { color: var(--success, #16a34a); }
@media (max-width: 560px) { .serverip__key { display: none; } }

.content { padding: 26px 24px 48px; overflow-y: auto; }

/* ============ Заголовок страницы ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__title { font-size: 22px; letter-spacing: -.02em; }
.page-head__sub { color: var(--text-soft); margin-top: 4px; font-size: 13px; }

/* ============ Карточки статистики ============ */
/* Дашборд: сетка 12 колонок вместо равных четвертей — так плитке доли можно дать
   двойную ширину и построить иерархию, а не ровный ковёр одинаковых карточек. */
.stats { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-bottom: 18px; }
.stats > .stat { grid-column: span 3; }
/* ширина карточки задаётся модификатором; специфичность должна перебивать правило выше,
   иначе «герой» остаётся в четверть ширины и обрезает сумму */
.stats > .stat--hero { grid-column: span 6; }
.stats > .stat--w4 { grid-column: span 4; }
.stats > .stat--w6 { grid-column: span 6; }
.stat--hero .stat__value { font-size: 42px; }
/* Денежный ряд визуально отделён от рабочего: тонкая подпись-разделитель */
.stats__sep {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; margin: 6px 0 -4px;
}
.stats__sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 1100px) { .stats > .stat, .stat--hero { grid-column: span 6; } }
@media (max-width: 560px) { .stats > .stat, .stat--hero { grid-column: 1 / -1; } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.stat:hover { box-shadow: var(--shadow-md); border-color: #dfe3ee; transform: translateY(-1px); }
[data-theme="dark"] .stat:hover { border-color: #2a3346; }
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; background: var(--primary-soft); color: var(--primary); }
.stat__delta { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.stat__delta--up { color: var(--success); background: #16a34a18; }
.stat__delta--down { color: var(--danger); background: #dc262618; }
.stat__value { font-size: 27px; font-weight: 700; margin-top: 14px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

/* ============ Сетка / панели ============ */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel__title { font-size: 15px; font-weight: 600; }
.panel__body { padding: 6px 8px; }
.panel__body--pad { padding: 18px; }
/* утилитарная карточка-контейнер (linkSites / autobl / AI Writer) */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
/* компактный инпут/селект для инструментов */
.input { width: 100%; padding: 9px 12px; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: .15s ease; box-sizing: border-box; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ============ Таблица ============ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; }
.table td { padding: 12px; border-top: 1px solid var(--border); }
.table tbody tr:hover { background: var(--surface-2); }
/* обёртка для широких таблиц (позиции: 13 колонок) — скролл внутри панели, а не всей страницы */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > .table { min-width: 900px; }
.site-cell { display: flex; align-items: center; gap: 11px; }
.favicon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; }
.site-cell__name { font-weight: 600; }
.site-cell__url { color: var(--text-muted); font-size: 12px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.tag--ok { color: var(--success); background: #16a34a16; }
.tag--warn { color: var(--warning); background: #d9770616; }
.tag--bad { color: var(--danger); background: #dc262616; }
.tag--accent { color: var(--accent); background: #0ea5a416; }
.tag--neutral { color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* форма добавления домена в разделе «Сайты» */
.site-form { display: grid; grid-template-columns: 1fr 1.4fr 140px 140px; gap: 14px; align-items: end; }
.site-form__actions { grid-column: 1 / -1; display: flex; gap: 10px; }
@media (max-width: 720px) { .site-form { grid-template-columns: 1fr 1fr; } }

/* редактор семантики по гео */
.sem-editor__country { display: block; max-width: 320px; margin-bottom: 14px; }
.sem-form__actions { display: flex; gap: 12px; align-items: center; }

/* таблица-редактор ключей: компактные поля внутри ячеек */
.sem-kw-table { table-layout: fixed; }
.sem-kw-table th.sem-col-freq { width: 150px; }
.sem-kw-table th.sem-col-prio { width: 180px; }
.sem-kw-table td:last-child, .sem-kw-table th:last-child { width: 44px; text-align: center; }
.sem-kw-table td { padding: 6px 8px; vertical-align: middle; }
.sem-kw-table .field__input { padding: 8px 10px; }
.sem-row-del { padding: 6px 10px; }

.sem-list { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.geo-row { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.geo-row__head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.geo-row__name { font-weight: 600; }
.geo-row__count { color: var(--text-muted); font-size: 13px; }
.geo-row__act { margin-left: auto; display: flex; gap: 8px; }
/* Каждое гео — карточка, редактируемая на месте: таблица ключей и кнопки живут внутри
   рамки гео. Прежние .sem-editor / .sem-list (одна форма сверху + список снизу) больше
   не используются — правки шли в одном месте, а результат смотрелся в другом. */
.geo-row .sem-kw-table { border-top: 1px solid var(--border); background: var(--surface); margin: 0; }
.geo-row .sem-kw-table th { font-size: 12px; color: var(--text-muted); }
.geo-row > div:last-child { padding-left: 14px; padding-right: 14px; background: var(--surface); }
.geo-row__head { flex-wrap: wrap; }

.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 90px; }
.bar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }

/* список активности / задач */
.feed { display: grid; gap: 4px; padding: 6px; }
.feed__item { display: flex; gap: 12px; padding: 10px; border-radius: 10px; }
.feed__item:hover { background: var(--surface-2); }
.feed__ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.feed__txt { font-size: 13px; }
.feed__time { font-size: 12px; color: var(--text-muted); }

.task { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; }
.task:hover { background: var(--surface-2); }
.task input { width: 17px; height: 17px; accent-color: var(--primary); }
.task__title { font-weight: 500; font-size: 13px; }
.task__meta { font-size: 12px; color: var(--text-muted); }
.task__pri { margin-left: auto; }

/* плитки инструментов */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); transition: .16s ease; cursor: pointer;
}
.tool:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c7ccff; }
.tool__ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--primary-soft); color: var(--primary); margin-bottom: 14px; }
.tool__title { font-size: 15px; font-weight: 600; }
.tool__desc { color: var(--text-soft); font-size: 13px; margin-top: 5px; }

.empty { padding: 60px 20px; text-align: center; color: var(--text-soft); }
.empty__ic { font-size: 40px; opacity: .4; }
.empty__title { font-size: 16px; font-weight: 600; color: var(--text); margin: 12px 0 4px; }

/* ============ Адаптив ============ */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } .tools { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar__menu { display: grid; }
  .search__kbd { display: none; }
}
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } .tools { grid-template-columns: 1fr; } .topbar__actions .btn { display: none; } }

/* ============ Зона загрузки файлов ============ */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: .15s ease;
}
.dropzone:hover { border-color: var(--primary); background: var(--surface-2); }
.dropzone.is-drag { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.005); }
.dropzone__ic { font-size: 34px; color: var(--primary); }
.dropzone__title { font-size: 16px; font-weight: 600; margin-top: 10px; }
.dropzone__hint { color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.dropzone__progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 18px auto 0; max-width: 480px; }
.dropzone__bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s ease; }

/* ============ Ошибка логина ============ */
.login-card__error {
  background: #dc26261a; color: var(--danger); border: 1px solid #dc262633;
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
#google-login { display: flex; align-items: center; justify-content: center; }
#google-login span { color: #4285F4; }
.iconbtn--logout { width: 32px; height: 32px; font-size: 15px; background: transparent; border-color: transparent; color: #8d96ab; margin-left: auto; }
.iconbtn--logout:hover { background: #ffffff14; color: #fff; }

/* ---------- SERP Checker (Google-подобная выдача) ---------- */
.serp-list { padding: 18px 22px 22px; max-width: 680px; }
.serp-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.serp-item { margin-bottom: 26px; }
.serp-item__head { display: flex; align-items: center; gap: 9px; margin-bottom: 3px; }
.serp-item__fav { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); flex: 0 0 auto; }
.serp-item__url { font-size: 12.5px; line-height: 1.3; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serp-item__title { display: block; font-size: 20px; line-height: 1.3; color: #1a0dab; text-decoration: none; margin: 1px 0 3px; font-weight: 400; }
.serp-item__title:hover { text-decoration: underline; }
.serp-item__title:visited { color: #681da8; }
.serp-item__snippet { font-size: 14px; line-height: 1.58; color: #4d5156; }
.serp-item__snippet em, .serp-item__snippet b { font-weight: 700; font-style: normal; }
[data-theme="dark"] .serp-item__title { color: #8ab4f8; }
[data-theme="dark"] .serp-item__title:visited { color: #c58af9; }
[data-theme="dark"] .serp-item__snippet { color: var(--text-soft); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: serp-spin .8s linear infinite; }
@keyframes serp-spin { to { transform: rotate(360deg); } }

/* AI Writer: пульсирующая точка у задач, которые прямо сейчас в работе */
@keyframes aiwc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.aiwc-table td { vertical-align: middle; }
.aiwc-table thead th { white-space: nowrap; }

/* ---------- SERP Checker: 3 колонки рядом ---------- */
.serp-meta--bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--border); }
.serp-meta__hint { margin-left: auto; font-size: 12px; color: var(--accent); cursor: help; white-space: nowrap; }
.serp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* сравнение двух выдач: колонка — жёлоб с позициями и коннекторами — колонка */
.serp-cols--cmp { grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr); position: relative; }
.serp-gutter { position: relative; border-right: 1px solid var(--border); }
.serp-gutter__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.serp-rank { position: absolute; font-size: 12px; line-height: 1; transform: translateY(-50%); color: var(--text-muted); }
.serp-rank--l { left: 10px; }
.serp-rank--r { right: 10px; }
/* позиция изменилась — кружок-бейдж на обоих концах коннектора */
.serp-rank--moved { color: #fff; font-weight: 700; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; }
.serp-col { padding: 16px 18px 20px; border-right: 1px solid var(--border); min-width: 0; }
.serp-col:last-child { border-right: none; }
.serp-col__head { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 16px; display: flex; align-items: baseline; gap: 8px; }
.serp-col__n { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-muted); font-size: 11px; }
.serp-col__wait { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 13px; padding: 20px 0; }
.serp-cols .serp-item { margin-bottom: 20px; }
.serp-cols .serp-item__title { font-size: 16px; line-height: 1.35; }
.serp-cols .serp-item__snippet { font-size: 13px; line-height: 1.5; }
.serp-item__rank { color: var(--text-muted); font-weight: 600; font-size: 13px; }
@media (max-width: 980px) { .serp-cols { grid-template-columns: 1fr; } .serp-col { border-right: none; border-bottom: 1px solid var(--border); } .serp-col:last-child { border-bottom: none; }
  .serp-cols--cmp { grid-template-columns: 1fr; } .serp-gutter { display: none; } }

/* ---------- Склейки доменов (canonical-кластеры) ---------- */
.canon-chip { display: inline-flex; align-items: center; gap: 3px; margin-top: 5px; padding: 2px 8px; border-radius: 11px; font-size: 11px; font-weight: 600; line-height: 1.6; color: #fff; background: var(--cc, #667); white-space: nowrap; cursor: help; max-width: 100%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.canon-chip b { background: rgba(255,255,255,.28); border-radius: 8px; padding: 0 5px; font-size: 10px; margin-left: 3px; font-weight: 700; }

/* ---------- Фильтры таблицы сайтов ---------- */
.sites-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.field__input--sm { width: auto; min-width: 130px; padding: 6px 10px; font-size: 13px; height: auto; }

/* ============ Раздел «Сайты»: плотная таблица, липкая шапка, меню строки ============ */
/* строка была 77px — на ноутбук влезало 12 строк из 863; ужимаем до ~46px */
/* ширины НЕ должны зависеть от содержимого страницы: при auto-раскладке колонки
   прыгали при каждом переходе по пагинации. Сетка задана colgroup + fixed. */
/* .table-scroll > .table задаёт min-width:900px и по специфичности перебивает
   одиночный класс — поэтому селектор такой же «весомый» и объявлен ниже */
.table-scroll > .table--sites { table-layout: fixed; width: 100%; min-width: 1260px; }
/* ниже ~1200px окна включается горизонтальная прокрутка .table-scroll: это лучше,
   чем сжимать колонку домена — там чипы зеркал и склеек, они переносились и строка росла */
.table--sites td { padding: 7px 10px; vertical-align: middle; overflow: hidden; }
.table--sites td:nth-child(2) { text-overflow: ellipsis; }
.table--sites th { padding: 8px 10px; white-space: nowrap; }
.table--sites tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 3%, transparent); }
.table--sites tbody tr:hover { background: color-mix(in srgb, var(--accent, #6c8cff) 8%, transparent); }
.table--sites tr.row-sel { background: color-mix(in srgb, var(--accent, #6c8cff) 14%, transparent) !important; }

/* шапка не должна уезжать: полотно страницы ~4000px */
.table--sites thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface, #fff);
  box-shadow: inset 0 -1px 0 var(--border);
}
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--accent, #6c8cff); }
.th-sort--on { color: var(--accent, #6c8cff); font-weight: 700; }

.col-pick { width: 34px; text-align: center; }
.col-act { width: 44px; text-align: right; }
.site-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.site-domain { font-weight: 600; text-decoration: none; color: inherit; }
.site-domain:hover { color: var(--accent, #6c8cff); text-decoration: underline; }
.site-brand { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
.site-brand--legacy { color: var(--text-muted); font-style: italic; }
.geo-cell { display: inline-flex; align-items: center; gap: 3px; }
.geo-flag { font-size: 17px; line-height: 1; cursor: help; }
.geo-more { font-size: 11px; color: var(--text-muted); cursor: help; }
/* прочерки не должны цеплять взгляд: их в таблице большинство */
.cell-empty { color: var(--text-muted); opacity: .45; }
.cell-muted { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.row-menu-btn { padding: 2px 8px; font-size: 15px; line-height: 1; }

.row-menu {
  position: fixed; z-index: 10000; min-width: 250px;
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28); padding: 5px; display: flex; flex-direction: column;
}
.row-menu__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 10px; border: 0; background: transparent; cursor: pointer;
  text-align: left; border-radius: 7px; font-size: 13px; color: var(--text);
}
.row-menu__item:hover { background: color-mix(in srgb, var(--accent, #6c8cff) 12%, transparent); }
.row-menu__item--danger { color: #c0392b; }
.row-menu__item--danger:hover { background: color-mix(in srgb, #c0392b 12%, transparent); }
.row-menu__hint { font-size: 11px; color: var(--text-muted); }

.sites-bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent, #6c8cff) 8%, transparent);
}
.sites-bulk__count { font-weight: 600; font-size: 13px; }
.sites-filters { flex-wrap: wrap; align-items: center; }
/* чипы не должны переносить строку: из-за «In Progress» высота прыгала 42→59px */
.table--sites .tag { white-space: nowrap; }
.table--sites .site-main .tag { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.spend-cell { display: inline-flex; align-items: center; gap: 6px; }
.prop-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 2px; border: 1px solid var(--border);
  border-radius: 6px; background: transparent; cursor: pointer; opacity: .75;
}
.prop-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.prop-btn:hover { opacity: 1; border-color: #1e88e5; }
.prop-btn--dim { opacity: .35; }
.prop-btn--dim:hover { opacity: 1; }
.rev-cell { display: inline-flex; flex-direction: column; line-height: 1.15; }
.rev-own { font-size: 13.5px; font-weight: 700; }
.rev-own--zero { font-weight: 400; color: var(--text-muted); opacity: .55; }
.rev-group { font-size: 10.5px; color: var(--text-muted); cursor: help; }

/* ============================================================
   Claude-агент — лайвчат в углу экрана
   Панель плавающая (не раздел): нужна из любого вида, поэтому
   живёт над контентом и переживает смену хэша.
   ============================================================ */
.ag-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9998;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 23px; line-height: 1;
  box-shadow: var(--shadow-lg); transition: transform .15s ease;
}
.ag-fab:hover { transform: translateY(-2px) scale(1.04); }
.ag-fab.is-busy { animation: ag-pulse 1.4s ease-in-out infinite; }
@keyframes ag-pulse { 0%,100% { box-shadow: var(--shadow-lg); } 50% { box-shadow: 0 0 0 10px rgba(79,70,229,.16), var(--shadow-lg); } }

.ag-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 9999;
  width: 420px; max-width: calc(100vw - 24px); height: 620px; max-height: calc(100vh - 44px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.ag-panel.hidden { display: none; }
.ag-panel--wide { width: 720px; height: calc(100vh - 44px); }

.ag-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ag-head__t { font-weight: 700; font-size: 14px; flex: 1; display: flex; align-items: center; gap: 7px; }
.ag-head__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.ag-head__dot--busy { background: var(--warning); animation: ag-blink 1s infinite; }
@keyframes ag-blink { 50% { opacity: .25; } }
.ag-head__cost { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ag-ico { border: none; background: transparent; cursor: pointer; color: var(--text-soft); font-size: 15px; padding: 3px 5px; border-radius: 7px; }
.ag-ico:hover { background: var(--primary-soft); color: var(--primary); }

.ag-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ag-msg { max-width: 92%; font-size: 13.5px; line-height: 1.5; }
.ag-msg--user { align-self: flex-end; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.ag-msg--bot { align-self: flex-start; color: var(--text); }
.ag-msg--bot table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; width: 100%; }
.ag-msg--bot th, .ag-msg--bot td { border: 1px solid var(--border); padding: 4px 7px; text-align: left; }
.ag-msg--bot th { background: var(--surface-2); }
.ag-msg--bot code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.ag-msg--bot pre { background: var(--surface-2); padding: 9px 11px; border-radius: 9px; overflow-x: auto; font-size: 12px; }
.ag-msg--bot h3 { font-size: 14px; margin: 10px 0 4px; }
.ag-msg--bot ul, .ag-msg--bot ol { margin: 5px 0 5px 18px; }
.ag-msg--err { align-self: flex-start; color: var(--danger); font-size: 12.5px; background: rgba(220,38,38,.08); padding: 7px 10px; border-radius: 9px; }

.ag-step { align-self: flex-start; max-width: 100%; font-size: 11.5px; color: var(--text-muted); }
.ag-step__h { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 8px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-2); }
.ag-step__h:hover { border-color: var(--primary); color: var(--primary); }
.ag-step__h--bad { border-color: var(--danger); color: var(--danger); }
.ag-step__body { display: none; margin-top: 5px; padding: 8px 10px; background: var(--surface-2); border-radius: 9px; white-space: pre-wrap; word-break: break-word; font-size: 11px; max-height: 260px; overflow: auto; }
.ag-step.is-open .ag-step__body { display: block; }
.ag-think { align-self: flex-start; font-size: 12px; color: var(--text-muted); font-style: italic; border-left: 2px solid var(--border); padding-left: 9px; }

.ag-foot { border-top: 1px solid var(--border); padding: 9px 10px; display: flex; gap: 8px; align-items: flex-end; }
.ag-input { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 11px; padding: 9px 11px; font: inherit; font-size: 13.5px; background: var(--surface); color: var(--text); max-height: 130px; }
.ag-input:focus { outline: none; border-color: var(--primary); }
.ag-send { border: none; border-radius: 11px; background: var(--primary); color: #fff; cursor: pointer; padding: 9px 14px; font-size: 14px; }
.ag-send:disabled { opacity: .45; cursor: default; }
.ag-hint { padding: 0 14px 10px; font-size: 11px; color: var(--text-muted); }
.ag-chip { display: inline-block; margin: 3px 4px 0 0; padding: 4px 9px; border: 1px solid var(--border); border-radius: 20px; font-size: 11.5px; cursor: pointer; color: var(--text-soft); background: var(--surface-2); }
.ag-chip:hover { border-color: var(--primary); color: var(--primary); }
.ag-threads { position: absolute; top: 44px; right: 10px; left: 10px; z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-md); max-height: 320px; overflow: auto; }
.ag-threads.hidden { display: none; }
.ag-thread { display: flex; gap: 8px; align-items: center; padding: 8px 11px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--border); }
.ag-thread:hover { background: var(--surface-2); }
.ag-thread__x { margin-left: auto; color: var(--text-muted); }
@media (max-width: 640px) {
  .ag-panel, .ag-panel--wide { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 70px); }
}
.ag-mode {
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text-soft); font: inherit; font-size: 11px; padding: 2px 4px; cursor: pointer;
}
.ag-mode:focus { outline: none; border-color: var(--primary); }
.ag-note { align-self: flex-start; font-size: 11px; color: var(--text-muted); }

/* карточка подтверждения операции в CMS */
.ag-confirm {
  align-self: stretch; border: 1px solid var(--primary); border-radius: 12px;
  background: var(--primary-soft); padding: 11px 12px; font-size: 12.5px;
}
.ag-confirm.is-done { border-color: var(--border); background: var(--surface-2); opacity: .72; }
.ag-cf__h { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.ag-cf__args { color: var(--text-soft); font-size: 11.5px; margin-bottom: 7px; word-break: break-word; }
.ag-cf__step { padding: 3px 0 3px 12px; border-left: 2px solid var(--border); margin-bottom: 2px; }
.ag-cf__warn { margin-top: 5px; color: var(--warning); font-size: 11.5px; }
.ag-cf__btns { display: flex; gap: 7px; margin-top: 10px; }
.ag-cf__yes, .ag-cf__no {
  flex: 1; border: none; border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.ag-cf__yes { background: var(--primary); color: #fff; }
.ag-cf__no { background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); }
.ag-cf__yes:disabled, .ag-cf__no:disabled { opacity: .5; cursor: default; }

/* полоска «агент работает»: этап + секундомер */
.ag-working {
  align-self: flex-start; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-soft);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 12px;
}
.ag-working__t { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ag-dots { display: inline-flex; gap: 3px; }
.ag-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--primary);
  animation: ag-bounce 1.1s infinite ease-in-out;
}
.ag-dots i:nth-child(2) { animation-delay: .16s; }
.ag-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes ag-bounce { 0%, 70%, 100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* карточка прогона ссылок: таблица целей, итоги, отсеянные */
.ag-cf__t { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 11.5px; }
.ag-cf__t th { text-align: left; font-weight: 600; color: var(--text-soft); padding: 3px 6px 3px 0; border-bottom: 1px solid var(--border); }
.ag-cf__t td { padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.ag-cf__t tr:last-child td { border-bottom: none; }
.ag-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ag-cf__anch { color: var(--text-muted); font-size: 11px; }
.ag-bad { color: var(--danger); }
.ag-cf__ph { font-size: 11.5px; padding: 2px 0 2px 10px; border-left: 2px solid var(--border); margin-top: 2px; }
.ag-cf__ph--main { border-left-color: var(--accent, #2563eb); font-weight: 600; }
.ag-cf__note { margin-top: 6px; font-size: 11.5px; color: var(--text-soft); }
.ag-cf__tot { font-size: 12px; margin-top: 4px; }
.ag-cf__sk { margin-top: 9px; font-size: 11.5px; color: var(--text-soft); }
.ag-cf__skrow { padding: 3px 0 3px 12px; border-left: 2px solid var(--warning); margin-top: 3px; opacity: .9; }
