*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: #f8fafc; color: #1e293b; display: flex; flex-direction: column; min-height: 100vh; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
header { background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 10; }
.nav-wrap { max-width: 1024px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 800; color: #4f46e5; letter-spacing: -0.02em; }
.logo span { color: #1e293b; }
.nav-links { display: flex; gap: 20px; font-size: 14px; font-weight: 500; color: #475569; }
.nav-links a:hover { color: #4f46e5; }
main { flex-grow: 1; max-width: 1024px; width: 100%; margin: 0 auto; padding: 32px 16px; }
main.narrow { max-width: 768px; }
h1 { font-size: 28px; font-weight: 800; color: #0f172a; margin-bottom: 8px; line-height: 1.2; }
.subtitle { color: #475569; font-size: 16px; margin-bottom: 24px; }
.hero { text-align: center; max-width: 672px; margin: 0 auto 32px; }
.hero h1 { font-size: 34px; margin-bottom: 12px; }

/* Сетка карточек на главной */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; margin: 32px 0; }
.card { background: #fff; padding: 24px; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgba(0,0,0,0.04); transition: 0.2s; display: flex; flex-direction: column; justify-content: space-between; }
.card:hover { border-color: #818cf8; box-shadow: 0 4px 12px rgba(79,70,229,0.08); transform: translateY(-2px); }
.card-icon { width: 48px; height: 48px; background: #eef2ff; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }
.card h2 { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.card p { font-size: 14px; color: #475569; }
.card-link { margin-top: 16px; font-size: 14px; font-weight: 600; color: #4f46e5; }

/* Рабочие блоки инструментов */
.box { background: #fff; padding: 24px; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 170px; border: 2px dashed #a5b4fc; border-radius: 12px; background: #eef2ff50; cursor: pointer; text-align: center; padding: 20px; transition: 0.2s; }
.dropzone:hover, .dropzone.dragover { background: #e0e7ff; border-color: #4f46e5; }
.dropzone-icon { font-size: 36px; margin-bottom: 8px; }
.dropzone-title { font-size: 15px; font-weight: 600; color: #1e293b; }
.dropzone-sub { font-size: 12px; color: #64748b; margin-top: 4px; }

.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }

.file-info { display: flex; align-items: center; justify-content: space-between; background: #f1f5f9; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
label.field-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 6px; letter-spacing: 0.02em; }
select, input[type="number"], input[type="text"] { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; font-size: 14px; background: #fff; color: #1e293b; }
input[type="range"] { width: 100%; accent-color: #4f46e5; margin-top: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; color: #334155; }

.btn { display: inline-block; width: 100%; background: #4f46e5; color: #fff; font-weight: 600; font-size: 15px; padding: 13px 20px; border: none; border-radius: 12px; cursor: pointer; text-align: center; transition: 0.2s; margin-top: 20px; }
.btn:hover { background: #4338ca; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-green { background: #059669; width: auto; margin-top: 0; padding: 10px 22px; border-radius: 8px; }
.btn-green:hover { background: #047857; }

.result-box { margin-top: 24px; padding: 16px 20px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.result-title { font-size: 15px; font-weight: 700; color: #064e3b; }
.result-sub { font-size: 13px; color: #047857; }

/* Списки файлов для PDF */
.file-list { list-style: none; margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; justify-content: space-between; background: #f1f5f9; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.file-actions { display: flex; gap: 6px; }
.mini-btn { padding: 4px 10px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; font-size: 13px; }
.mini-btn:hover { background: #f8fafc; }
.mini-btn.del { color: #e11d48; }

/* SEO-блок и футер */
.seo-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; margin-top: 32px; font-size: 14px; color: #475569; }
.seo-box h2 { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 12px; }
.seo-box p { margin-bottom: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 16px; }
.features h3 { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }

footer { background: #fff; border-top: 1px solid #e2e8f0; margin-top: 48px; }
.footer-wrap { max-width: 1024px; margin: 0 auto; padding: 24px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #64748b; flex-wrap: wrap; gap: 12px; }
/* Ссылки подвала переносятся на вторую строку: на телефоне четыре подписи
   (включая «Политика конфиденциальности») шире экрана на 12 px и дают
   горизонтальную прокрутку всей странице. */
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 20px; min-width: 0; }
.footer-links a:hover { color: #0f172a; }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 26px; }
}

/* ==== Общие компоненты утилит (добавлено 01.12.2026) ====
   Меню на телефоне не прячем: посетитель должен переключаться между
   инструментами одним движением, поэтому строка меню прокручивается. */
.nav-links { overflow-x: auto; white-space: nowrap; scrollbar-width: none; -ms-overflow-style: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { flex: 0 0 auto; }

@media (max-width: 720px) {
    .nav-wrap { height: auto; min-height: 56px; padding: 10px 16px; flex-direction: column; align-items: flex-start; gap: 8px; }
    .nav-links { width: 100%; gap: 16px; font-size: 13px; padding-bottom: 2px; }
    main { padding: 24px 14px; }
    .box { padding: 18px; }
}

/* Строка файла в списках: имя, размер, состояние, кнопки */
.file-item { gap: 12px; }
.file-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: #64748b; }
.status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-ok { color: #059669; }
.status-err { color: #e11d48; }
.status-wait { color: #64748b; }

/* Полоса хода обработки: показывает, что браузер не завис на большом файле */
.progress-line { height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress-line > i { display: block; height: 100%; width: 0; background: #4f46e5; transition: width 0.2s ease; }
.progress-text { font-size: 13px; color: #475569; margin-top: 8px; }

.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; }
.btn-inline { display: inline-block; width: auto; padding: 10px 18px; font-size: 14px; margin-top: 0; }

.steps { display: grid; gap: 14px; margin-top: 16px; counter-reset: step; }
.steps > div { position: relative; padding-left: 42px; font-size: 14px; color: #475569; }
.steps > div::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: #eef2ff; color: #4f46e5; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }

.faq { display: grid; gap: 10px; margin-top: 16px; }
.faq details { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 600; color: #0f172a; font-size: 14px; }
.faq p { margin-top: 8px; font-size: 14px; color: #475569; }

.notice { font-size: 13px; color: #64748b; margin-top: 12px; }
.error-box { margin-top: 16px; padding: 14px 18px; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 12px; font-size: 14px; color: #9f1239; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #4f46e5; background: #eef2ff; padding: 3px 8px; border-radius: 6px; }

/* Место под блок РСЯ: пустой контейнер не занимает высоту, пока не вставлен код */
.ad-slot { margin: 24px 0; min-height: 0; display: flex; justify-content: center; }

.range-hint { font-size: 12px; color: #64748b; margin-top: 6px; }
.radio-row { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.radio-row label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #334155; cursor: pointer; }
.radio-row input[type="radio"] { margin-top: 3px; accent-color: #4f46e5; }
.mode-panel { margin-top: 12px; }
.input-narrow { max-width: 220px; }

/* Предпросмотр PNG с прозрачностью: шахматка показывает, что фон действительно убран */
.preview-checker { margin-top: 16px; border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0;
    background-color: #e2e8f0;
    background-image: linear-gradient(45deg, #cbd5e1 25%, transparent 25%), linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #cbd5e1 75%), linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    display: flex; align-items: center; justify-content: center; padding: 8px; }
.preview-checker img { max-width: 100%; max-height: 70vh; display: block; }

/* Хлебные крошки на узких страницах: показывают место в структуре и посетителю, и поиску */
.crumbs { font-size: 12px; color: #64748b; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: #4f46e5; }
.crumbs span { color: #94a3b8; }

/* Список частых ошибок: маркеры и отступы, чтобы блок не сливался с текстом */
.tips { margin: 12px 0 0; padding-left: 22px; font-size: 14px; color: #475569; }
.tips li { margin-bottom: 8px; }

/* Два окна загрузки рядом: паспорт (главная страница + прописка) */
.two-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two-slots { grid-template-columns: 1fr; } }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 150px; border: 2px dashed #a5b4fc; border-radius: 12px; background: #eef2ff50;
    cursor: pointer; text-align: center; padding: 14px; transition: 0.2s; }
.slot:hover, .slot.dragover { background: #e0e7ff; border-color: #4f46e5; }
.slot.filled { border-style: solid; border-color: #a7f3d0; background: #ecfdf5; }
.slot-title { font-size: 14px; font-weight: 700; color: #1e293b; }
.slot-hint { font-size: 12px; color: #64748b; }
.slot-file { font-size: 12px; color: #475569; word-break: break-all; }
.slot-preview { max-width: 100%; max-height: 110px; border-radius: 8px; }
.inline-fields { display: flex; align-items: center; gap: 8px; }
.inline-fields input { max-width: 110px; }

/* ==== Вторая волна инструментов (02.12.2026): поля ввода, предпросмотры, палитра ==== */

/* Многострочные поля: этикетки (строки из Excel) и очистка текста */
textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 12px;
    font-size: 14px; font-family: inherit; color: #1e293b; background: #fff; resize: vertical; line-height: 1.5; }
textarea.code-like { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
textarea[readonly] { background: #f8fafc; }

/* Выбор цвета: нативный input[type=color] без стилей выглядит как дырка в макете */
input[type="color"] { width: 100%; height: 40px; padding: 2px; border: 1px solid #cbd5e1;
    border-radius: 8px; background: #fff; cursor: pointer; }

/* Пятиколоночная панель QR-кода на широком экране, две колонки на телефоне */
.qr-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 16px; }
.qr-preview { margin-top: 16px; min-height: 220px; display: flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; }
.qr-preview canvas { max-width: 100%; height: auto; display: block; }
.qr-empty { color: #94a3b8; font-size: 14px; }
.qr-logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #475569; }

/* Предпросмотры фото: документы, аватарка, кусочки панорамы */
.photo-preview { max-width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; border-radius: 8px; }
.avatar-preview { width: 200px; height: 200px; display: block; border-radius: 8px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 16px; }
.tile-preview { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; }

/* Палитра: исходник сверху, образцы цветов кнопками */
.palette-source { max-width: 100%; max-height: 240px; display: block; margin: 0 auto; border-radius: 10px; border: 1px solid #e2e8f0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.swatch { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; min-height: 82px; cursor: pointer;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 2px; text-align: left; }
.swatch:hover { border-color: #818cf8; }
.swatch-label { font-weight: 700; font-size: 13px; color: #0f172a; background: rgba(255,255,255,0.88);
    border-radius: 4px; padding: 1px 4px; }
.swatch-sub { font-size: 11px; color: #334155; background: rgba(255,255,255,0.88); border-radius: 4px; padding: 1px 4px; }

/* Две колонки «текст до / текст после» на широком экране */
@media (max-width: 720px) {
    .qr-controls { grid-template-columns: 1fr 1fr; }
    .swatches { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Каталог на главной: группы по задачам, а не сплошная стена карточек */
.catalog { margin-top: 8px; }
.catalog-title { font-size: 18px; font-weight: 700; color: #1e293b;
    margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }
.catalog-title:first-child { margin-top: 12px; }
.text-output { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; min-height: 60px; }
.label-preview canvas { max-width: 100%; height: auto; border: 1px solid #e2e8f0; border-radius: 6px; }
.qr-preview { display: flex; justify-content: center; padding: 8px; }
.qr-preview canvas, .qr-preview img { max-width: 320px; width: 100%; height: auto; }
.grid-preview { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); margin-top: 12px; }
.grid-preview img { width: 100%; border-radius: 4px; }

/* Счётчик слов и калькулятор дат: плитки с числами и «чипсы» частых слов.
   Плитки, а не строка: восемь чисел в строке на телефоне не читаются. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.stat-cell { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; color: #64748b; }
.stat-value { font-size: 20px; color: #0f172a; line-height: 1.2; }
.stat-hint { font-size: 11px; color: #94a3b8; }
.top-words { margin-top: 14px; font-size: 13px; color: #475569; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.dates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .dates-grid { grid-template-columns: 1fr; } }
