/* Верстак — единый стиль. Тёмная/светлая тема, без внешних шрифтов и библиотек. */
:root {
  --bg: #0e1013; --surface: #161a1f; --surface2: #1d2229; --line: #2a313a;
  --text: #e8ecf0; --muted: #909ba8; --accent: #c8f560; --accent-ink: #11160a;
  --good: #5ee0a0; --warn: #ffb454; --bad: #ff7b7b; --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -18px #000;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --r: 14px; color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg:#f4f1ea; --surface:#fffdf8; --surface2:#efebe1; --line:#ddd6c6; --text:#1b1d1f; --muted:#666c73; --accent:#1f6f4a; --accent-ink:#fff; --good:#12805a; --warn:#b26a00; --bad:#c22f2f; --shadow:0 12px 28px -20px rgba(60,50,20,.5); color-scheme: light; }
}
:root[data-theme="light"] { --bg:#f4f1ea; --surface:#fffdf8; --surface2:#efebe1; --line:#ddd6c6; --text:#1b1d1f; --muted:#666c73; --accent:#1f6f4a; --accent-ink:#fff; --good:#12805a; --warn:#b26a00; --bad:#c22f2f; --shadow:0 12px 28px -20px rgba(60,50,20,.5); color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background: radial-gradient(900px 400px at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: .5rem .8rem; border-radius: 8px; z-index: 99; }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 1rem; min-height: 58px; }
.logo { display: flex; align-items: center; gap: .6rem; font: 700 1.25rem var(--serif); color: var(--text); text-decoration: none; white-space: nowrap; }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); position: relative; }
.logo i::before, .logo i::after { content: ""; position: absolute; background: var(--accent-ink); border-radius: 2px; }
.logo i::before { left: 7px; top: 6px; width: 3px; height: 16px; } .logo i::after { left: 7px; top: 6px; width: 14px; height: 3px; box-shadow: 0 6px 0 var(--accent-ink); }
.nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: .45rem .75rem; border-radius: 999px; font-size: .93rem; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface2); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.icon-btn { flex: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.05rem; }
.icon-btn:hover { border-color: var(--accent); }
@media (max-width: 760px) { .top .wrap { flex-wrap: wrap; padding-block: .4rem; } .nav { order: 3; width: 100%; margin: 0; } .icon-btn { margin-left: auto; } }

main { flex: 1; padding: 2rem 0 3rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; } .crumbs a { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 62ch; }

/* главная */
.hero { padding: 1.5rem 0 2rem; }
.hero .kicker { font: 600 .8rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1.5rem 0 2.5rem; }
.card { display: flex; flex-direction: column; gap: .4rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card .n { font: 700 .8rem var(--mono); color: var(--accent); }
.card h3 { margin: 0; font-size: 1.25rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; }
.card .go { color: var(--accent); font-weight: 600; margin-top: .6rem; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.points div { border-left: 2px solid var(--accent); padding-left: 1rem; } .points b { display: block; margin-bottom: .2rem; }
.points span { color: var(--muted); font-size: .93rem; }

/* страница инструмента */
.tool { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin: 1.5rem 0; }
@media (max-width: 880px) { .tool { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; box-shadow: var(--shadow); }
.result { position: sticky; top: 76px; } @media (max-width: 880px) { .result { position: static; } }
.panel h2 { font-size: 1.05rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 1rem; }
.field { margin-bottom: 1rem; } .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; } @media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
label.l, .field > .l { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .35rem; }
.hint { display: block; color: var(--muted); font-size: .8rem; margin-top: .3rem; font-weight: 400; }
input[type=text], input[type=number], input[type=url], input[type=search], textarea, select {
  width: 100%; padding: .65rem .8rem; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; min-height: 44px; }
textarea { font: 14px/1.45 var(--mono); min-height: 150px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .seg input:focus-visible + span, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=number] { font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg label { flex: 1 1 auto; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: .5rem .6rem; border-radius: 8px; font-size: .9rem; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .45rem; }
.chip, .btn { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); padding: .3rem .8rem; font-size: .85rem; }
.chip:hover { border-color: var(--accent); }
.btn { border-radius: 10px; padding: .65rem 1.1rem; font-weight: 600; font-size: .95rem; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; } .btn.primary:hover { filter: brightness(1.08); }
.btn:hover { border-color: var(--accent); } .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; margin-bottom: .6rem; font-size: .93rem; cursor: pointer; } .check input { margin-top: .3rem; accent-color: var(--accent); width: 17px; height: 17px; }

/* результат */
.kpi { margin-bottom: 1rem; }
.kpi small { display: block; color: var(--muted); font-size: .85rem; }
.kpi .big { font: 700 clamp(2.2rem, 7vw, 3.2rem)/1.05 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.02em; word-break: break-word; }
.kpi .big.good { color: var(--good); } .kpi .big.bad { color: var(--bad); }
.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface2); margin: .6rem 0 .3rem; }
.bar i { display: block; height: 100%; min-width: 0; transition: width .25s; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.legend b { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: .35rem; }
.c1 { background: var(--bad); } .c2 { background: var(--warn); } .c3 { background: #7aa7ff; } .c4 { background: var(--good); } .c5 { background: #b58cff; }
dl.rows { margin: 0; } dl.rows div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px dashed var(--line); font-size: .93rem; }
dl.rows dt { color: var(--muted); } dl.rows dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
dl.rows .strong dd, dl.rows .strong dt { color: var(--text); font-weight: 700; }
.note { font-size: .86rem; color: var(--muted); background: var(--surface2); border-radius: 10px; padding: .6rem .8rem; margin-top: .8rem; }
.note.warn { color: var(--warn); } .note.bad { color: var(--bad); }
.err { color: var(--bad); font-size: .93rem; }
.ladder { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: .4rem; font-variant-numeric: tabular-nums; }
.ladder th, .ladder td { text-align: right; padding: .35rem .4rem; border-top: 1px dashed var(--line); } .ladder th:first-child, .ladder td:first-child { text-align: left; }
.ladder th { color: var(--muted); font-weight: 600; border-top: 0; }

/* utm / csv */
.out { font: 13.5px/1.5 var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; word-break: break-all; min-height: 3rem; }
.hist { list-style: none; margin: 0; padding: 0; } .hist li { display: flex; gap: .6rem; align-items: center; padding: .5rem 0; border-top: 1px dashed var(--line); font-size: .85rem; }
.hist code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 1.2rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--surface2); }
.preview { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 10px; }
.preview table { border-collapse: collapse; font-size: .82rem; width: 100%; }
.preview th, .preview td { padding: .35rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.preview th { position: sticky; top: 0; background: var(--surface2); }
.preview td.ph { color: var(--good); } .preview td.bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stats div { background: var(--surface2); border-radius: 10px; padding: .6rem .8rem; } .stats b { display: block; font: 700 1.4rem var(--serif); } .stats span { font-size: .78rem; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .3rem 0 .8rem; }

/* реклама и партнёрки: пустой слот не занимает места, пока в него не вставлен код РСЯ */
.ad-slot { margin: 1.5rem 0; min-height: 0; } .ad-slot:empty { display: none; }
.ad-slot::before { content: "Реклама"; display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.aff { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px dashed var(--line); border-radius: var(--r); font-size: .93rem; } .aff:empty { display: none; }
.aff small { display: block; color: var(--muted); margin-top: .4rem; font-size: .75rem; }

/* текст-статья и FAQ */
.prose { max-width: 74ch; } .prose h2 { margin-top: 2rem; } .prose li { margin-bottom: .35rem; }
.prose code { font-family: var(--mono); background: var(--surface2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .6rem; } summary { cursor: pointer; font-weight: 600; } details p { margin: .6rem 0 0; color: var(--muted); }
.cta { margin: 2.5rem 0 0; padding: 1.5rem; border-radius: var(--r); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface)); border: 1px solid var(--line); }
.cta h2 { margin-bottom: .3rem; }
footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; } footer nav { display: flex; gap: 1rem; flex-wrap: wrap; } footer a { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
