/* tools.cetto.ru — стили страниц инструментов. Подключается после styles.css и использует его токены */
:root {
  --ok: #1B7A46;
  --ok-bg: #E6F4EC;
  --bad: #B3261E;
  --bad-bg: #FBEAEA;
  --warn: #6B5A00;
  --warn-bg: #FFF7C2;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

[hidden] { display: none !important; }

/* ---------- Первый экран инструмента ---------- */
.tool-hero { background: var(--night); color: #fff; padding: 28px 0 40px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--on-dark-2); margin-bottom: 20px; }
.crumbs a { color: var(--on-dark); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.tool-hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; font-weight: 800; letter-spacing: -.02em; max-width: 900px; }
.tool-hero__lead { margin-top: 14px; font-size: 18px; line-height: 1.55; color: var(--on-dark); max-width: 780px; }
.tool-hero .badges { margin-top: 20px; }

/* ---------- Рабочая область ---------- */
.tool { padding: 32px 0 56px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.tool-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tool-grid2--wide { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel__title { font-size: 18px; font-weight: 600; }
.panel__meta { font-size: 14px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .field__label { font-size: 14px; font-weight: 500; }
.field small, .hint { font-size: 13px; line-height: 1.45; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff;
  border: 1px solid #CFCFCF; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.textarea { min-height: 240px; resize: vertical; line-height: 1.55; font-size: 14px; }
.textarea--sm { min-height: 96px; }
.textarea--mono, .code { font-family: var(--mono); font-size: 13px; }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.input[type="color"] { padding: 4px; width: 56px; flex: 0 0 auto; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.4; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--night); flex: 0 0 auto; }
.checks { display: flex; flex-direction: column; gap: 10px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn--light { background: #fff; color: var(--ink); border: 1px solid #CFCFCF; font-weight: 500; }
.btn--light:hover { border-color: var(--ink); color: var(--ink); }
.btn--sm { min-height: 36px; padding: 7px 14px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stats:empty { display: none; }
.stat { background: var(--chip); border-radius: 10px; padding: 7px 12px; font-size: 14px; }
.stat b { font-weight: 700; }
.stat--bad { background: var(--bad-bg); color: var(--bad); }
.stat--ok { background: var(--ok-bg); color: var(--ok); }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; background: var(--chip); }
.notice--warn { background: var(--warn-bg); color: var(--warn); }
.notice--bad { background: var(--bad-bg); color: var(--bad); }
.notice--ok { background: var(--ok-bg); color: var(--ok); }
.notice:empty { display: none; }
.empty { color: var(--muted); font-size: 15px; padding: 28px 8px; text-align: center; }

.code { background: var(--night); color: #E9E9E9; border-radius: 12px; padding: 16px; overflow: auto; white-space: pre; max-height: 520px; margin: 0; line-height: 1.55; tab-size: 2; }
.code--wrap { white-space: pre-wrap; word-break: break-word; }

/* ---------- Таблицы и списки результатов ---------- */
.table-wrap { overflow: auto; max-height: 600px; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { position: sticky; top: 0; background: #FAFAFA; font-weight: 600; z-index: 1; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .url { word-break: break-all; min-width: 200px; }
.table small { color: var(--muted); }
.table tr.is-sub td { background: #FCFCFC; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.4; padding: 2px 8px; border-radius: 6px; white-space: nowrap; background: var(--chip); color: var(--ink); }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--bad { background: var(--bad-bg); color: var(--bad); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 999px; border: 0; background: var(--chip); color: var(--ink); cursor: pointer; }
.tab:hover { background: #E4E4E4; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }

.groups { display: flex; flex-direction: column; gap: 8px; }
.group { border: 1px solid var(--line); border-radius: 12px; }
.group summary { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; }
.group summary::-webkit-details-marker { display: none; }
.group summary b { font-weight: 600; }
.group summary span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.group[open] summary { border-bottom: 1px solid var(--line); }
.group ul { margin: 0; padding: 10px 14px 12px 32px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.group li small { color: var(--muted); margin-left: 6px; }

.wordlist { display: flex; flex-wrap: wrap; gap: 6px; max-height: 380px; overflow: auto; padding: 2px; }
.word { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; padding: 5px 10px; border-radius: 8px; background: var(--chip); cursor: pointer; user-select: none; }
.word input { accent-color: var(--bad); margin: 0; }
.word small { color: var(--muted); }
.word.is-on { background: var(--bad-bg); color: var(--bad); }
.word.is-hint { box-shadow: inset 0 0 0 1px #E3A3A0; }

.out-list { margin: 0; padding: 0; list-style: none; font-size: 14px; display: flex; flex-direction: column; }
.out-list li { padding: 7px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.out-list li:last-child { border-bottom: 0; }

/* Типограф: подсветка неразрывных пробелов */
.typo-preview { background: #fff; border: 1px solid var(--line); font-size: 15px; line-height: 1.7; max-height: 320px; overflow: auto; }
.typo-preview mark.nb { background: var(--accent); color: inherit; }

/* Cookie-баннер: сцена предпросмотра */
.cookie-stage { position: relative; min-height: 280px; border-radius: 12px; overflow: hidden; background: var(--chip); border: 1px solid var(--line); }
.cookie-stage__page { padding: 8px 0; }
.cookie-stage__page i { display: block; height: 12px; margin: 16px; border-radius: 6px; background: #DCDCDC; }

/* Превью сниппета */
.serp-stage { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; overflow: hidden; }
.serp { font-family: Arial, sans-serif; overflow-wrap: anywhere; }
.serp__site { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 14px; line-height: 1.3; min-width: 0; }
.serp__site > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.serp__fav { width: 28px; height: 28px; border-radius: 50%; background: #F1F3F4; border: 1px solid #DADCE0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #202124; flex: 0 0 auto; }
.serp__fav--sm { width: 18px; height: 18px; font-size: 10px; }
.serp__name { color: #202124; }
.serp__url { color: #4D5156; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp--google .serp__title { color: #1A0DAB; margin-bottom: 4px; line-height: 1.3; }
.serp--google .serp__desc { color: #4D5156; }
.serp--yandex .serp__title { color: #000; margin-bottom: 6px; }
.serp--yandex .serp__url { color: #707070; font-size: 13px; }
.serp--yandex .serp__desc { color: #333; }
.serp__desc b, .serp__title b { font-weight: 700; color: inherit; }

/* Карточки Open Graph */
.og-stage { background: var(--chip); border-radius: 12px; padding: 20px; }
.og-card__img { display: block; width: 100%; aspect-ratio: 1.91; object-fit: cover; border-radius: 8px; background: #DCDCDC; }
.og-card__img--empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.og-tg { background: #DCE8F3; border-radius: 12px; padding: 16px; }
.og-tg__msg { background: #fff; border-radius: 12px 12px 12px 4px; padding: 10px 12px; max-width: 420px; font-size: 14px; overflow-wrap: anywhere; }
.og-tg__msg > a { color: #168ACD; }
.og-tg__card { margin-top: 6px; border-left: 3px solid #168ACD; padding: 2px 0 2px 10px; display: flex; flex-direction: column; gap: 3px; }
.og-tg__site { color: #168ACD; font-weight: 600; }
.og-tg__card img, .og-tg__card .og-card__img { margin-top: 6px; }
.og-vk { background: #fff; border: 1px solid #DCE1E6; border-radius: 10px; overflow: hidden; max-width: 460px; }
.og-vk .og-card__img { border-radius: 0; }
.og-vk__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.og-vk__body span { color: #818C99; font-size: 13px; }

/* QR-код и комбинатор */
.qr-box { display: flex; justify-content: center; padding: 16px; background: var(--chip); border-radius: 12px; }
.qr-box canvas { width: 320px; max-width: 100%; height: auto; image-rendering: pixelated; }
.combo-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

/* Сравнение текстов */
.diff-out { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; font-size: 15px; line-height: 1.7; max-height: 600px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.diff-del { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.diff-ins { background: var(--ok-bg); color: var(--ok); text-decoration: none; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* Закон Ципфа */
.zipf-legend { display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.zipf-legend span { display: flex; align-items: center; gap: 6px; }
.zipf-key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--night); }
.zipf-key--ideal { border-top: 2px dashed var(--muted-2); }
.zipf-chart { position: relative; }
.zipf-chart svg { display: block; width: 100%; height: auto; }
.zipf-grid { stroke: #EBEBEB; stroke-width: 1; }
.zipf-tick { font: 11px Rubik, sans-serif; fill: var(--muted-2); }
.zipf-fact { fill: none; stroke: var(--night); stroke-width: 2; stroke-linejoin: round; }
.zipf-ideal { fill: none; stroke: var(--muted-2); stroke-width: 2; stroke-dasharray: 6 4; }
.zipf-dot { fill: var(--night); stroke: #fff; stroke-width: 2; }
.zipf-cross { stroke: #BDBDBD; stroke-width: 1; }
.zipf-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-50%); }

/* Предпросмотр Markdown */
.md-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; line-height: 1.6; overflow: auto; max-height: 600px; }
.md-preview > * + * { margin-top: 12px; }
.md-preview h1, .md-preview h2, .md-preview h3 { line-height: 1.25; }
.md-preview ul, .md-preview ol { padding-left: 22px; margin-bottom: 0; }
.md-preview blockquote { margin: 12px 0 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.md-preview pre { background: var(--chip); padding: 12px; border-radius: 8px; overflow: auto; }
.md-preview code { font-family: var(--mono); font-size: 13px; }
.md-preview table { border-collapse: collapse; }
.md-preview th, .md-preview td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md-preview img { max-width: 100%; }

/* Визуальный редактор */
.editor-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--chip); border-radius: 10px; }
.editor-bar button { font: inherit; font-size: 14px; min-height: 34px; min-width: 34px; padding: 4px 10px; border: 0; border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.editor-bar button:hover { background: var(--ink); color: #fff; }
.editor-bar__sep { width: 1px; background: #D6D6D6; margin: 4px 2px; }
.editor { min-height: 380px; max-height: 70vh; overflow: auto; border: 1px solid #CFCFCF; border-radius: 10px; padding: 16px 20px; font-size: 16px; line-height: 1.6; background: #fff; }
.editor:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.editor > * + * { margin-top: 10px; }
.editor h2, .editor h3 { line-height: 1.25; }
.editor ul, .editor ol { padding-left: 24px; margin-bottom: 0; }
.editor blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--accent-line); color: var(--muted); }
.editor table { border-collapse: collapse; }
.editor th, .editor td { border: 1px solid var(--line); padding: 6px 10px; min-width: 60px; }
.editor img { max-width: 100%; }

/* Тестер regex */
.regex-input { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 18px; color: var(--muted); }
.regex-input .input:first-of-type { flex: 1 1 auto; }
.regex-input .input:last-of-type { width: 72px; flex: 0 0 auto; }
.regex-hl { max-height: 260px; font-family: var(--mono); font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.regex-hl mark.hl-a { background: var(--accent); }
.regex-hl mark.hl-b { background: #FFE98A; }

/* Букмарклеты */
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.bm-link { cursor: grab; align-self: flex-start; }

/* Favicon */
.fav-tab { background: #DEE1E6; border-radius: 10px 10px 0 0; padding: 8px 8px 0; }
.fav-tab__item { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 8px 8px 0 0; padding: 8px 14px; font: 13px Arial, sans-serif; max-width: 240px; }
.fav-tab__item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-sizes { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; padding: 12px; background: var(--chip); border-radius: 12px; }
.fav-size { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.fav-size canvas { image-rendering: pixelated; background: repeating-conic-gradient(#E4E4E4 0 25%, #fff 0 50%) 0 0 / 8px 8px; }

/* Зона загрузки файлов */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 220px; padding: 24px; border: 2px dashed #C4C4C4; border-radius: 14px; cursor: pointer; color: var(--muted); }
.drop b { color: var(--ink); font-size: 18px; font-weight: 600; }
.drop:hover, .drop.is-over { border-color: var(--ink); background: var(--chip); }

/* Медиаплан */
.mp-table .mp-in { min-height: 36px; padding: 6px 8px; font-size: 14px; width: 110px; text-align: right; }
.mp-table .mp-in--name { width: 200px; text-align: left; }
.mp-table td { vertical-align: middle; }
.mp-table tfoot th { background: #FAFAFA; position: static; }

/* Генератор объявлений */
.ad-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.ad-card { font-family: Arial, sans-serif; max-width: 560px; }
.ad-card__label { font-size: 12px; color: #707070; }
.ad-card__title { color: #1A0DAB; font-size: 18px; line-height: 1.3; margin: 2px 0 4px; }
.ad-card__url { color: #006621; font-size: 13px; margin-bottom: 4px; }
.ad-card__text { color: #333; font-size: 14px; line-height: 1.45; }

/* Страницы разделов: карточки инструментов, которые ещё в разработке */
.tool-card--soon { background: transparent; border-style: dashed; min-height: 0; color: var(--muted); }
.tool-card--soon .tool-card__name { color: var(--ink); font-size: 16px; }
.tool-card--soon .tool-card__desc { font-size: 14px; }
.tag--soon { background: var(--warn-bg); color: var(--warn); font-weight: 600; }

/* ---------- Текст об инструменте ---------- */
.prose { max-width: 820px; font-size: 16px; line-height: 1.65; overflow-wrap: break-word; }
.prose h2 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; font-weight: 700; margin: 0 0 14px; }
.prose h3 { font-size: 19px; font-weight: 600; margin: 24px 0 8px; }
.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { margin: 10px 0 0; padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose code { font-family: var(--mono); font-size: 14px; background: var(--chip); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; margin-top: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: #FAFAFA; font-weight: 600; }
.prose h2 { margin-top: 32px; }
.prose > :first-child { margin-top: 0; }
.privacy-date { color: var(--muted); font-size: 15px; }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.related a { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.related a:hover { border-color: var(--ink); text-decoration: none; color: var(--ink); }
.related b { font-weight: 600; }
.related span { color: var(--muted); font-size: 14px; line-height: 1.45; }

@media (max-width: 900px) {
  .tool-grid2, .tool-grid2--wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tool-hero { padding: 20px 0 28px; }
  .tool-hero__lead { font-size: 16px; }
  .tool { padding: 20px 0 40px; }
  .panel { padding: 16px; }
}
