/* ===== Общие стили сайта «adsrun» ===== */

:root {
    --bg: #f9f9f9;
    --panel: transparent;
    --text: #000000;
    --muted: #000000;
    --border: #000000;
    --accent: #007FFF;
    --accent-dark: #0066cc;
    --secondary: #FF6187;
    --secondary-dark: #e04068;
    --mark: var(--secondary);
    --sidebar-w: 330px;
    --sidebar-w-min: 64px;
    --radius: 6px;
    /* Ширина первой колонки на всех страницах инструментов (≈ 30,8% контейнера); % считается от строки с колонками */
    --first-col-w: calc(100% * 0.3077 - 10px);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.45 "TikTok Sans", sans-serif;
    color: var(--text);
    background: var(--bg);
}

/* ---------- Боковое меню ----------
   В свёрнутом виде (64 px) видны только иконки; при наведении меню раскрывается поверх контента
   и показывает названия. Размеры подобраны так, чтобы иконки не двигались при раскрытии:
   отступ 10 px + внутренний отступ 11 px + иконка 22 px = центр иконки на 32 px. */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w-min);
    transition: width .2s;
    overflow-x: hidden; overflow-y: auto;
    white-space: nowrap;
    background: #222222;
    color: #fff;
    padding: 32px 0 20px;   /* логотип стоит на одной линии с заголовком H1 страницы (см. .content и .heading) */
    z-index: 100;
}
.sidebar:hover { width: var(--sidebar-w); box-shadow: 4px 0 16px rgba(0, 0, 0, .2); }

/* Логотип: квадрат с иконкой + название */
.sidebar .logo {
    display: flex; align-items: center; gap: 12px;
    padding: 0 14px 16px;
    color: #fff; text-decoration: none;
    font-size: 17px; font-weight: 800;
}
.logo-mark {
    flex: 0 0 36px; width: 36px; height: 36px;
    display: grid; place-items: center;
}
.logo-mark svg { width: 34px; height: auto; }
.logo-word { display: block; height: 22px; width: auto; }

/* Заголовок группы: название + тонкая линия. В свёрнутом виде остаётся только линия */
.sidebar .nav-group {
    display: flex; align-items: center; gap: 0;   /* в свёрнутом меню линия строго по центру иконок (x = 32) */
    margin: 12px 20px;                            /* одинаковые отступы до иконок сверху и снизу */
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff;
}
.sidebar .nav-group::after { content: ''; flex: 1; min-width: 12px; height: 1px; background: rgba(255, 255, 255, .22); }
.sidebar .nav-group .label { max-width: 0; overflow: hidden; }
.sidebar:hover .nav-group .label { max-width: 220px; }
.sidebar:hover .nav-group { gap: 10px; }

/* Пункты меню */
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    margin: 2px 10px; padding: 9px 11px;
    border-radius: var(--radius);
    color: #fff; text-decoration: none;
    transition: background .15s;
}
/* Иконки интерфейса — свои SVG (icon() в src/bootstrap.php), цвет берут от текста */
.ico { flex: none; width: 1em; height: 1em; }
.sidebar nav a > .ico { flex: 0 0 22px; width: 22px; height: 19px; }
.ext-mark { display: inline-block; width: 11px; height: 11px; margin-left: 4px; vertical-align: -1px; opacity: .6; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .1); }
.sidebar nav a.active { background: var(--accent); }

/* Названия появляются вместе с раскрытием меню */
.sidebar .label { opacity: 0; transition: opacity .15s; }
.sidebar:hover .label { opacity: 1; transition-delay: .08s; }

.menu-toggle {
    display: none;
    position: fixed; top: 10px; left: 10px; z-index: 110;
    width: 40px; height: 40px;
    border: 0; border-radius: var(--radius);
    background: var(--accent); color: #fff; font-size: 18px; cursor: pointer;
}
.menu-toggle .ico { display: block; width: 22px; height: 22px; margin: auto; }

.content { margin-left: var(--sidebar-w-min); padding: 24px; }

/* ---------- Заголовок страницы и подсказка ---------- */
.heading { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding-left: 16px; /* = внутренний отступ колонок */ }
.heading h1 { margin: 0; font-size: 36px; font-weight: 800; }
.lead { color: var(--muted); margin-top: -6px; padding-left: 16px; }

.tooltip_head { position: relative; display: inline-flex; align-items: center; color: #000; cursor: help; line-height: 0; }
.tooltip_head:hover { color: var(--accent); }
.tooltip_head > svg { width: 22px; height: 22px; position: relative; top: 2px; }
.tooltip_head .tooltiptext {
    visibility: hidden; opacity: 0; transition: opacity .15s;
    position: absolute; top: 130%; left: 0; z-index: 50;
    width: 420px; max-width: 80vw; padding: 10px 12px;
    background: #f3f3f3; color: #000; box-shadow: 0 4px 14px rgba(0,0,0,.15);
    border-radius: var(--radius); font-size: 13px; line-height: 1.4;
}
.tooltip_head:hover .tooltiptext { visibility: visible; opacity: 1; }

/* ---------- Раскладка колонок ---------- */
.container { display: flex; gap: 20px; align-items: flex-start; }
.column {
    flex: 1 1 0; min-width: 0;
    background: var(--panel);
    border-radius: var(--radius);
    padding: 16px;
}
.column.left-column { flex: 0 0 380px; }

/* ---------- Элементы форм ---------- */
textarea, input[type="text"], input[type="url"], input[type="number"] {
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
textarea { resize: none; margin-bottom: 8px; }
textarea:focus, input:focus { outline: 2px solid #9cc9ff; }

/* Кнопки с заливкой. Цвет — по смыслу действия:
   синий — обычное, зелёный — загрузка/запуск, розовый — удаление (.danger) */
button {
    margin: 2px 2px 2px 0;
    padding: 5px 10px;
    border: 0; border-radius: var(--radius);
    background: var(--accent); color: #fff;
    font: inherit; font-size: 13px; cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button.green { background: #50C878; }
button.green:hover { background: #3fae64; }
.danger button { background: var(--secondary); }
.danger button:hover { background: var(--secondary-dark); }

.button-group { margin-bottom: 18px; }
.button-group label { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }


.form_title { font-weight: 700; margin: 6px 0; }
.message { margin-top: 12px; padding: 10px 12px 10px 0; border-radius: var(--radius); overflow-wrap: anywhere; }

/* ---------- Заголовок результата и кнопка копирования ---------- */
.line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.line .form_title { margin: 0; }
.copy-button { display: inline-flex; cursor: pointer; user-select: none; color: var(--accent); transition: color .15s; }
.copy-button:hover { color: var(--accent-dark); }
.clear-button { color: var(--secondary); }
.clear-button:hover { color: var(--secondary-dark); }
.copy-button svg, .checkmark svg { width: 20px; height: 20px; }
.checkmark { display: none; color: #50C878; }
.checkmark.visible { display: inline-flex; }

/* ---------- Блок результата ---------- */
.text-group {
    border-radius: var(--radius); background: #fff;
    padding: 10px; min-height: 60px;
    max-height: 70vh; overflow: auto;
    word-break: break-word;
}
.text-group.pre { white-space: pre-wrap; }
.line + .text-group { flex-basis: 100%; }

/* ---------- Теги слов и подсветка (чистка и группировка) ---------- */
.tags-container, #wordFrequencyContainer { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    padding: 3px 9px; border-radius: var(--radius);
    background: #ededed; cursor: pointer; font-size: 13px; user-select: none;
}
.tag:hover { background: #dcdcdc; }
.tag.marked { background: var(--mark); color: #fff; }
#phrasesContainer .word { cursor: pointer; }
#phrasesContainer .word.mark { background: var(--mark); color: #fff; padding: 0 4px; }
.phrase-div { padding: 1px 0; }
.phrases-group { margin-bottom: 18px; }
.phrases-group .form_title { display: inline-block; margin-right: 8px; }

.tooltip {
    position: absolute; z-index: 400;
    max-width: 420px; pointer-events: none;
    padding: 8px 10px;
    background: #f3f3f3; border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0,0,0,.15); font-size: 13px;
}

/* ---------- Подсветка кириллицы/латиницы ---------- */
.cyrillic-char { background: #a8cfff; }
.latin-char    { background: #ffc0cf; }

/* ---------- Главная: введение и карточки ---------- */
.home-body { padding-left: 16px; }          /* та же линия, что у заголовка страницы */
.home-body .lead { margin: 0 0 6px; padding-left: 0; max-width: 760px; font-size: 16px; }
.home-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius);
    background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    font-size: 13px; font-weight: 600;
}
.pill .ico { width: 15px; height: 15px; color: var(--accent); }

.group-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 14px; font-size: 20px; font-weight: 800; }
.group-count { font-size: 13px; font-weight: 600; color: #777; }
/* не больше 5 карточек в ряд, одинаковой ширины во всех разделах */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 64px) / 5)), 1fr)); gap: 16px; }
.card {
    display: flex; flex-direction: column;
    padding: 18px;
    background: #fff; border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    color: inherit; text-decoration: none;
    transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, .14); transform: translateY(-2px); }
.card-icon {
    width: 44px; height: 44px; margin-bottom: 14px;
    display: grid; place-items: center;
    border-radius: var(--radius);
    background: #e5f1ff; color: var(--accent); font-size: 19px;
    transition: background .15s, color .15s;
}
.card:hover .card-icon { background: var(--accent); color: #fff; }
.card-icon .ico { width: 22px; height: 22px; }
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.card p { margin: 0; font-size: 13px; line-height: 1.5; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
    .container { flex-direction: column; }
    .column, .column.left-column { flex: 1 1 auto; width: 100%; }
}
@media (max-width: 800px) {
    .menu-toggle { display: block; }
    .sidebar { width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; }
    .sidebar .label { opacity: 1; }
    .sidebar .nav-group .label { max-width: 220px; }
    .sidebar .nav-group { gap: 10px; }
    .content { margin-left: 0; padding: 60px 14px 20px; }
}

/* Шире колонки 1 и 2 в «Чистке фраз» */
.column.left-column.wide { flex: 1 1 0; }
@media (max-width: 1100px) { .column.left-column.wide { flex: 1 1 auto; } }


/* «Чистка фраз»: отступ блока минус-слов */
.minus-block { margin-top: 16px; }


/* Лёгкая тень у белых полей и блоков */
textarea, input[type="text"], input[type="url"], input[type="number"], .text-group {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

/* «Чистка фраз»: заголовки и поля трёх колонок выровнены по горизонтали */
.col-head { display: flex; align-items: center; gap: 10px; min-height: 32px; margin-bottom: 8px; }
.col-head .form_title { margin: 0; }
#phrases { height: 260px; }
#wordFrequencyContainer, #phrasesContainer { min-height: 260px; align-content: flex-start; }


/* Выделенные слова в результате — скруглённые, как кнопки */
#phrasesContainer .word { border-radius: var(--radius); }

/* «Чистка фраз»: размер шрифта полей и результата как у кнопок */
#phrases, #minusWords, #phrasesContainer { font-size: 13px; }

/* «Чистка фраз»: колонка 1 уже на 25%, освободившаяся ширина отдана колонке 3 */
.column.minus-col-1 { flex: 0 0 var(--first-col-w); }
.column.minus-col-3 { flex: 1.25 1 0; }
@media (max-width: 1100px) { .column.minus-col-1, .column.minus-col-3 { flex: 1 1 auto; } }

/* «Выделить слова с частотой меньше N» */
.select-by-freq { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.select-by-freq input { width: 70px; padding: 4px 8px; font-size: 13px; }

.select-by-freq { font-size: 13px; }

/* «Группировка фраз»: шрифт как в «Чистке фраз» */
#inputPhrases, #resultContainer, #tagsContainer, .button-group label { font-size: 13px; }

/* «Группировка фраз»: группы — карточки одинаковой высоты, в ряд не более 5 */
#resultContainer {
    display: grid;
    /* минимальная ширина карточки = max(260px, 1/5 ряда), поэтому больше 5 в строку не влезет */
    grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 64px) / 5)), 1fr));
    grid-auto-rows: 360px;
    gap: 16px;
}
#resultContainer .phrases-group { display: flex; flex-direction: column; margin-bottom: 0; min-width: 0; min-height: 0; }
#resultContainer .text-group { flex: 1; min-height: 0; max-height: none; }
/* заголовок карточки — как «Загружаемые фразы» (шрифт 13px относится только к тексту фраз) */
#resultContainer .form_title { font-size: 15px; }
#resultContainer .col-head .form_title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Иконки копирования/очистки — по центру высоты букв заголовка (оптический центр текста чуть выше центра строки) */
.copy-button, .checkmark { line-height: 0; }
.copy-button svg, .checkmark svg { position: relative; top: -1.5px; }

/* Чекбоксы: синие, с общим скруглением */
input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    flex: 0 0 18px; width: 18px; height: 18px; margin: 0;
    border-radius: var(--radius);
    background: #fff center / 12px no-repeat;
    box-shadow: inset 0 0 0 1.5px #bdbdbd;
    cursor: pointer; transition: background-color .15s, box-shadow .15s;
}
input[type="checkbox"]:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
input[type="checkbox"]:checked {
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    box-shadow: none;
}
input[type="checkbox"]:focus-visible { outline: 2px solid #9cc9ff; outline-offset: 2px; }

/* «Группировка»: первая колонка той же ширины, что в «Чистке фраз» (см. --first-col-w в начале файла) */
.column.group-col-1 { flex: 0 0 var(--first-col-w); }
@media (max-width: 1100px) { .column.group-col-1 { flex: 1 1 auto; } }

/* Строка фильтра: чекбокс с подписью и значок подсказки */
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row label { margin: 6px 0; }
.check-row .tooltip_head > svg { width: 16px; height: 16px; top: 0; }
.check-row .tooltiptext { width: 300px; }

/* «Группировка»: ручная правка — слияние групп и перенос фраз */
.merge-hint {
    position: fixed; bottom: 24px; left: calc(50% + var(--sidebar-w-min) / 2); transform: translateX(-50%);
    z-index: 150; align-items: center; gap: 12px; padding: 10px 16px;
    border-radius: var(--radius); background: #fff; font-size: 13px; font-weight: 600;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.merge-button { color: #8b5cf6; }
.merge-button:hover { color: #6d3fd9; }
.col-head .merge-button { margin-left: auto; }
.phrase-div[draggable="true"] { cursor: grab; }
.merging .phrases-group { cursor: pointer; }
.merging .phrases-group:hover { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius); }
.phrases-group.merge-source { opacity: .45; }
.phrases-group.drop-target { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius); }
@media (max-width: 800px) { .merge-hint { left: 50%; } }

/* Окно подтверждения (Tools.confirmDialog) */
.modal-overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .4); }
.modal { width: calc(100% - 32px); max-width: 440px; padding: 24px; border-radius: var(--radius); background: #fff; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.modal h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.modal p { margin: 0 0 22px; line-height: 1.5; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal button { padding: 8px 16px; font-size: 14px; }
.modal button.danger-btn { background: var(--secondary); }
.modal button.danger-btn:hover { background: var(--secondary-dark); }

/* «Чистка фраз»: счётчики на кнопках, история, поиск и замена */
.cnt { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--radius); background: rgba(255, 255, 255, .3); font-size: 11px; font-weight: 700; }
.cnt:empty, .cnt.is-empty { display: none; }
button.is-zero { opacity: .45; }
/* «Анализ страниц сайта»: адреса в истории — одна строка, длинные обрезаются многоточием (полный адрес в подсказке) */
#historyList .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-button { color: #000; }
.history-button:hover { color: var(--accent); }
#undoButton { margin-left: auto; }
.copy-button.disabled { opacity: .3; pointer-events: none; }
.check-inline { margin: 4px 0 8px; }
#wordSearch { width: 160px; }
#findText, #replaceText { width: calc(50% - 4px); font-size: 13px; padding: 4px 8px; }
.find-count { margin-left: 8px; font-size: 13px; }
.select-by-freq > span:first-child { min-width: 84px; }

/* Окно выбора слова (Tools.chooseDialog) */
.modal.modal-wide { max-width: 640px; }
.choose-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 50vh; overflow: auto; margin-bottom: 20px; }

/* «Группировка»: панель результата, поиск, сортировка, переименование */
select { padding: 5px 8px; border: 0; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font: inherit; font-size: 13px; cursor: pointer; }
.result-head { flex-wrap: wrap; }
.result-head input[type="text"] { width: 200px; padding: 5px 8px; font-size: 13px; }
.result-head .spacer { flex: 1; }
/* Отмена/возврат стоят в одной строке с полем и списком: без оптического сдвига иконок вверх и с большим отступом до поиска */
.result-head .history-button svg { top: 0; }
.result-head #redoButton { margin-right: 10px; }
.edit-button { color: #f59e0b; }
.edit-button:hover { color: #d97706; }
.split-button { color: #14b8a6; }
.split-button:hover { color: #0d9488; }
.col-head .copy-button + .copy-button { margin-left: 0; }
.rename-input { flex: 1; min-width: 0; padding: 3px 8px; font: inherit; font-weight: 700; }
.phrase-div.hit { background: #e5f1ff; border-radius: var(--radius); }
.num-label { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: default; }
.num-label input { width: 64px; padding: 3px 8px; font-size: 13px; }
.disband-button { color: var(--secondary); }
.disband-button:hover { color: var(--secondary-dark); }

/* «Сравнение списков»: шрифт полей как в «Чистке фраз», одинаковая высота блоков результата */
#phrases1, #phrases2, .compare-result { font-size: 13px; }
#phrases1, #phrases2 { height: 260px; }
.compare-result { height: 260px; max-height: none; }
/* Одна сетка 3 × 2: слева исходные списки (ширина как у первой колонки на других страницах), справа результаты.
   Колонки считаются так же, как у .container/.column (отступы 16 px внутри колонок), поэтому линии совпадают с остальными страницами. */
.compare-layout {
    display: grid; align-items: start; padding: 0 16px;
    grid-template-columns: calc((100% + 32px) * 0.3077 - 42px) minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px 20px;
}
.cmp-form { display: contents; }
.compare-cell { min-width: 0; }
.compare-cell .form_title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-l1 { grid-column: 1; grid-row: 1; }
.cmp-l2 { grid-column: 1; grid-row: 2; }
.cmp-actions { grid-column: 1; grid-row: 3; }
.cmp-both, .cmp-second { grid-column: 2; margin-left: 32px; }   /* 32 px = внутренние отступы колонок на других страницах */
.cmp-first, .cmp-union { grid-column: 3; }
.cmp-both, .cmp-first { grid-row: 1; }
.cmp-second, .cmp-union { grid-row: 2; }
#phrases1, #phrases2 { display: block; margin-bottom: 0; }
.cmp-actions .button-group { margin-bottom: 14px; }
.compare-sort { margin-top: 10px; }
@media (max-width: 1100px) {
    .compare-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cmp-l1, .cmp-l2, .cmp-actions, .cmp-both, .cmp-first, .cmp-second, .cmp-union { grid-column: auto; grid-row: auto; margin-left: 0; }
}
@media (max-width: 800px) { .compare-layout { grid-template-columns: 1fr; } }
.download-button { color: #50C878; }
.download-button:hover { color: #3fae64; }

/* «Перемножение фраз» */
.phrases-input { height: 120px; font-size: 13px; }
.multiply-result { min-height: 260px; font-size: 13px; }
.combo-info { margin: 0 0 6px; font-size: 13px; }
.combo-info:empty { display: none; }
.combo-info.over { color: var(--secondary-dark); font-weight: 600; }
.multiply-list + .multiply-list { margin-top: 14px; }
.list-remove { margin-left: auto; }
#addListButton { margin-top: 10px; }

/* «Размножение фраз» */
#phrases1.copies-field { height: 260px; }
#phrases1.copies-field, #copyNumber { font-size: 13px; }
.copies-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.copies-row .form_title { margin: 0; }
/* высота поля — как у кнопок (шрифт 13px, отступы 5px 10px) */
#copyNumber { width: 90px; padding: 5px 10px; line-height: 1.45; }
#copyMode { max-width: 100%; }

/* «Анализ страниц сайта» */
#text1 { font-size: 13px; padding: 7px 10px; }

/* «Анализ страниц сайта»: сообщения, мета-данные, статистика */
.message.error { color: var(--secondary-dark); font-weight: 600; }
.message.warn { color: #b45309; font-weight: 600; }
.site-text-col { flex: 1.4 1 0; }
#metaBox, #statsBox { font-size: 13px; }
#metaBox { min-height: 200px; }
.meta-row + .meta-row { margin-top: 12px; }
.meta-label { font-weight: 700; margin-bottom: 2px; }
.meta-value.empty, .meta-row.empty .meta-value { color: #777; }
.h-row { padding: 2px 0; }
.h-tag { display: inline-block; min-width: 26px; padding: 0 5px; margin-right: 4px; border-radius: var(--radius); background: #e5f1ff; font-size: 11px; font-weight: 700; text-align: center; }
.stat-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.stat-row b { font-weight: 700; white-space: nowrap; }
#mode { max-width: 100%; }

/* «Проверка кириллицы / латиницы»: смешанные слова, скрытые символы, легенда */
.mixed-word { background: #ffd166; border-radius: var(--radius); padding: 0 2px; }
.mixed-word .latin-char { background: var(--secondary); color: #fff; }
.odd-space { background: #ffd166; }
.hidden-char { background: var(--secondary); display: inline-block; width: 4px; height: 1em; vertical-align: text-bottom; overflow: hidden; color: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 18px; height: 12px; border-radius: 4px; }
.swatch.mixed-word { padding: 0; }
.swatch.hidden-char { width: 4px; height: 12px; vertical-align: baseline; }
.stats-lines { font-size: 13px; }
.cyr-field { height: 260px; font-size: 13px; }
#exceptions { font-size: 13px; }

/* «Проверка кириллицы / латиницы»: смешанные слова, скрытые символы, легенда */
.mixed-word { background: #ffd166; border-radius: var(--radius); padding: 0 2px; }
.mixed-word .latin-char { background: var(--secondary); color: #fff; }
.odd-space { background: #ffd166; }
.hidden-char { background: var(--secondary); display: inline-block; width: 4px; height: 1em; vertical-align: text-bottom; overflow: hidden; color: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 18px; height: 12px; border-radius: 4px; }
.swatch.mixed-word { padding: 0; }
.swatch.hidden-char { width: 4px; height: 12px; vertical-align: baseline; }
.stats-lines { font-size: 13px; }
#exceptions { font-size: 13px; }

/* «Замена кириллицы на латиницу» */
.zamena-field { height: 260px; font-size: 13px; }
#replace_count { width: 90px; padding: 5px 10px; line-height: 1.45; font-size: 13px; }
.replaced-char { background: #ffd166; border-radius: 4px; }
.letters-box { display: flex; flex-wrap: wrap; gap: 6px; }
.letter-chip { padding: 3px 8px; border-radius: var(--radius); background: #ededed; font-size: 13px; cursor: pointer; user-select: none; opacity: .6; }
.letter-chip.on { background: var(--accent); color: #fff; opacity: 1; }
#mode { max-width: 100%; }

/* Капча */
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.captcha-img { border-radius: var(--radius); background: #f1f1f1; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
/* .modal button задаёт отступы кнопок окна, поэтому здесь селектор не слабее */
.modal .captcha-refresh { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; margin: 0; padding: 0; }
.modal .captcha-refresh svg { width: 18px; height: 18px; display: block; }
.captcha-input { font-size: 18px; letter-spacing: .25em; text-transform: uppercase; text-align: center; }
.captcha-note { min-height: 20px; margin: 8px 0 14px; font-size: 13px; color: var(--secondary-dark); font-weight: 600; }

/* ---------- Подвал, SEO-блок, юридическая страница ---------- */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 36px 0 8px; padding: 18px 0 0 16px; border-top: 1px solid #e3e3e3; font-size: 13px; }
.site-footer a { color: #000; text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--accent); }
.link-button { margin: 0; padding: 0; background: none; color: #000; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { background: none; color: var(--secondary-dark); }

.seo-block { max-width: 860px; margin-top: 40px; padding-left: 16px; font-size: 14px; line-height: 1.65; }
.seo-block h2 { margin: 26px 0 8px; font-size: 20px; font-weight: 800; }
.seo-block p { margin: 0 0 10px; }
.seo-block ol, .seo-block ul { margin: 0 0 12px; padding-left: 22px; }
.seo-block h3 { margin: 18px 0 6px; font-size: 16px; font-weight: 800; }
.seo-block strong { font-weight: 700; }
.seo-block code { padding: 1px 6px; border-radius: var(--radius); background: #ededed; font-size: .92em; }
.seo-block a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.seo-block a:hover { color: var(--accent-dark); }
.seo-pre { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font: 13px/1.6 Consolas, "Courier New", monospace; white-space: pre-wrap; overflow-x: auto; }   /* моноширинный: колонки в примерах не съезжают */
.seo-note { padding: 10px 14px; border-radius: var(--radius); background: #e5f1ff; }

/* Текст о сервисе на главной: линия уже задана отступом .home-body */
.home-body .seo-block { padding-left: 0; margin-top: 36px; }
.group-title a { color: inherit; text-decoration: none; }
.group-title a:hover { color: var(--accent); }

/* Статьи: список, хлебные крошки, оглавление, блок «Попробуйте» */
.home-body .lead + .cards { margin-top: 24px; }   /* список статей: воздух между вводным текстом и карточками */
/* Карточка статьи с обложкой: картинка во всю ширину, текст под ней */
.card.card-article { padding: 0; overflow: hidden; }
.card-cover { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; background: #eee; }
.card-article .card-body { padding: 16px 18px 18px; }
.article-cover { display: block; width: 100%; max-width: 100%; height: auto; margin: 0 0 18px; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.card-meta { margin-top: 10px !important; color: #777; font-size: 12px !important; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; font-size: 13px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span[aria-hidden] { color: #999; }
.article { max-width: 1120px; }
.article-meta { margin: 0 0 14px; color: #777; font-size: 13px; }
.article .lead { max-width: none; font-size: 16px; }
.toc { margin: 18px 0 8px; padding: 14px 18px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font-size: 14px; }
.toc-title { margin-bottom: 6px; font-weight: 800; }
.toc ol { margin: 0; padding-left: 22px; }
.toc li { margin: 3px 0; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.article-body { max-width: none; padding-left: 0; margin-top: 0; font-size: 15px; }
.article-body h2 { scroll-margin-top: 20px; }
.seo-block a.article-cta { display: flex; align-items: center; gap: 16px; margin: 24px 0; padding: 16px 18px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); color: inherit; text-decoration: none !important; transition: box-shadow .15s, transform .15s; }
.seo-block a.article-cta:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, .14); transform: translateY(-2px); color: inherit; }
.article-cta .card-icon { margin: 0; flex: none; }
.article-cta:hover .card-icon { background: var(--accent); color: #fff; }
.article-cta-text { display: flex; flex-direction: column; gap: 2px; flex: 1; font-size: 14px; }
.article-cta-text strong { font-size: 16px; }
.article-cta-go { display: grid; place-items: center; color: var(--accent); }
.article-cta-go .ico { width: 20px; height: 20px; }
.seo-block li { margin-bottom: 4px; }
.seo-block details { margin-bottom: 8px; padding: 10px 14px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seo-block summary { cursor: pointer; font-weight: 700; }
.seo-block details p { margin: 8px 0 0; }

.legal { max-width: 820px; font-size: 14px; line-height: 1.65; }
.legal h2 { margin: 24px 0 8px; font-size: 18px; font-weight: 800; }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0 0 12px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }

/* «Подсчёт символов и слов»: плитки с числами */
.count-field { height: 320px; font-size: 13px; }
/* по 4 плитки в ряд на широких экранах: восемь показателей = два ровных ряда */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(190px, calc((100% - 42px) / 4)), 1fr)); gap: 14px; }
.metric { padding: 16px 18px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.metric-value { font-size: 30px; font-weight: 800; line-height: 1.15; }
.metric-label { margin-top: 4px; font-size: 13px; }
.metric.primary { background: var(--accent); color: #fff; }

/* «Минус-площадки для РСЯ» */
.rsya-cat { margin-bottom: 14px; }
.rsya-row { display: flex; align-items: center; gap: 8px; }
.rsya-row label { display: flex; flex: 1; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.rsya-count { padding: 1px 8px; border-radius: var(--radius); background: #ededed; font-size: 12px; font-weight: 600; }
.rsya-desc { margin: 4px 0 0 26px; font-size: 12px; line-height: 1.45; }
.sites-output { height: 480px; margin: 0; font-size: 13px; line-height: 1.5; white-space: pre; overflow: auto; }

/* «Города и регионы для Директа» */
.geo-regions { max-height: 300px; overflow: auto; padding: 8px 10px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.geo-region { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.geo-region-name { flex: 1; }
.geo-notes { margin-top: 10px; font-size: 13px; line-height: 1.5; }
.geo-note { margin-bottom: 6px; padding: 8px 12px; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.geo-source { margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
.part-head { margin-top: 14px; }
.part-head:first-child { margin-top: 0; }
#geoParts textarea { margin-bottom: 0; }
#geoParts .sites-output { white-space: pre-wrap; }
#regionSearch { padding: 7px 10px; font-size: 13px; }

/* «Города и регионы»: кнопка-переключатель */
button.is-active { background: #50C878; }
button.is-active:hover { background: #3fae64; }

/* «Города и регионы»: переключатель «выбранные / невыбранные», население региона */
.view-switch { display: flex; gap: 8px; }
.view-switch button { flex: 1; margin: 0; }
.geo-pop { color: #000; opacity: .6; font-size: 12px; white-space: nowrap; }

/* «Города и регионы»: раскрываемые регионы со списком городов */
.geo-region-wrap { border-radius: var(--radius); }
.geo-region { gap: 6px; }
.geo-region-label { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; cursor: pointer; }
.geo-arrow { width: 16px; height: 16px; flex: none; position: relative; cursor: pointer; }
.geo-arrow::before { content: ""; position: absolute; left: 4px; top: 3px; border: solid transparent; border-width: 5px 0 5px 7px; border-left-color: #000; opacity: .55; transition: transform .15s; transform-origin: 30% 50%; }
.geo-arrow:hover::before { opacity: 1; }
.geo-arrow.open::before { transform: rotate(90deg); }
.geo-cities { margin: 2px 0 6px 22px; padding-left: 10px; border-left: 2px solid #ededed; }
.geo-city { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 13px; cursor: pointer; }
.geo-city-name { flex: 1; }
.geo-regions .rsya-count { cursor: pointer; }
.geo-empty { padding: 6px 0; font-size: 13px; opacity: .6; }

/* «Таргетинги для Директа»: таблица таргетингов, вкладки, фильтры столбцов */
.column.int-main { flex: 1 1 0; min-width: 0; }
.column.int-selected { flex: 0 0 var(--first-col-w); }
@media (max-width: 1100px) { .column.int-selected { flex: 1 1 auto; } }
.int-date { margin-left: auto; font-size: 12px; opacity: .6; }
#intSections { margin-bottom: 12px; }
#intSections button { flex: 0 1 auto; }
.int-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.int-search { position: relative; flex: 1 1 auto; }
.int-search input { margin: 0; padding: 7px 34px 7px 10px; font-size: 13px; }
.int-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); line-height: 0; cursor: pointer; opacity: .6; }
.int-search-clear[hidden] { display: none; }
.int-search-clear:hover { opacity: 1; color: var(--secondary); }
.int-search-clear svg { width: 16px; height: 16px; }
.int-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.int-table-wrap { max-height: 62vh; overflow: auto; border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.int-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.int-table th { position: sticky; top: 0; z-index: 2; padding: 9px 12px; background: #f3f3f3; text-align: left; font-weight: 700; box-shadow: 0 1px 0 #e3e3e3; }
.int-table td { padding: 8px 12px; border-bottom: 1px solid #efefef; vertical-align: top; }
.int-th { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.int-filter { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius); font-size: 12px; cursor: pointer; opacity: .55; }
.int-filter .ico { width: 13px; height: 13px; }
.int-filter:hover { background: #e3e3e3; opacity: 1; }
.int-filter.is-active { background: var(--accent); color: #fff; opacity: 1; }
.int-row { cursor: pointer; }
.int-row:hover td { background: #f6f9ff; }
.int-row.is-selected td { background: rgba(80, 200, 120, .2); }
.int-row.is-selected td:first-child { box-shadow: inset 4px 0 0 #50C878; }
.int-name { font-weight: 700; }
.int-empty { padding: 24px; text-align: center; opacity: .6; }
.int-status { margin-top: 8px; font-size: 12px; opacity: .7; }
#intSelected { height: 560px; }
.int-menu { position: fixed; z-index: 1000; min-width: 220px; max-width: 360px; border-radius: var(--radius); background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); font-size: 13px; }
.int-menu[hidden] { display: none; }
.int-menu-actions { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid #eee; }
.int-menu-actions button { flex: 1; padding: 5px 8px; font-size: 12px; }
.int-menu-list { max-height: 280px; overflow: auto; padding: 8px 10px; }
.int-menu-list label { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 7px; cursor: pointer; line-height: 1.35; }
.int-menu-list input { flex: none; margin-top: 2px; }
