:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e3e6f0;
  --border-strong: #ccd1e2;
  --text: #141726;
  --muted: #646b83;
  --accent: #4f5bff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(79, 91, 255, .12);
  --ok: #15803d;
  --ok-soft: rgba(34, 197, 94, .14);
  --danger: #dc2626;
  --hover: #eef0f8;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 23, 38, .05), 0 10px 28px -12px rgba(20, 23, 38, .12);
  --shadow-lg: 0 2px 4px rgba(20, 23, 38, .05), 0 24px 48px -18px rgba(40, 48, 120, .3);
  --sidebar: 288px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0d0f17;
  --surface: #161924;
  --surface-2: #1b1f2e;
  --border: #272c3d;
  --border-strong: #373d54;
  --text: #eceff7;
  --muted: #98a0b8;
  --accent: #7480ff;
  --accent-soft: rgba(116, 128, 255, .18);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, .14);
  --danger: #f87171;
  --hover: #222740;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 48px -18px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(99, 102, 241, .14), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(14, 165, 233, .1), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- каркас ---------- */

.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 22px 16px 28px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 10px 22px;
  font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 16px; font-weight: 800;
  box-shadow: 0 8px 18px -6px rgba(79, 91, 255, .6);
}

.nav-group { margin-bottom: 18px; }
.nav-title {
  padding: 0 12px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text);
}
.nav-link:hover { background: var(--hover); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-ico {
  display: grid; place-items: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted);
}
.nav-link.active .nav-ico { background: var(--accent); border-color: transparent; color: #fff; }
.nav-link.soon { color: var(--muted); cursor: default; }
.nav-link.soon:hover { background: none; }
.soon-badge {
  margin-left: auto; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}

.main { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 14px; color: var(--muted); }
.topbar-spacer { flex: 1; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 17px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--hover); border-color: var(--border-strong); }
.menu-btn { display: none; }

.content { max-width: 1060px; margin: 0 auto; padding: 36px 28px 80px; }

/* ---------- заголовок страницы ---------- */

.page-head { margin-bottom: 26px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.page-head h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.025em; line-height: 1.12; }
.page-head p { margin-top: 10px; color: var(--muted); font-size: 16px; max-width: 62ch; }

/* ---------- панели ---------- */

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.panel + .panel { margin-top: 18px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 700; }
.panel-sub { font-size: 13px; color: var(--muted); }

.inputs { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }

.field label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; font-size: 13px; font-weight: 600; }
.field .count { font-weight: 500; color: var(--muted); font-size: 12px; }

textarea, .text-input {
  width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  line-height: 1.5; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 220px; resize: vertical; }
textarea:hover, .text-input:hover { border-color: var(--border-strong); }
textarea:focus, .text-input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
::placeholder { color: var(--muted); opacity: .7; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions .hint { margin-left: auto; font-size: 12px; color: var(--muted); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .1s, filter .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px -10px rgba(79, 91, 255, .8);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); border-color: var(--border-strong); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; }

/* ---------- результат ---------- */

.result[hidden] { display: none; }
.result-list {
  max-height: 460px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px;
  font-family: var(--mono); font-size: 13.5px;
}
.result-row { padding: 6px 10px; border-radius: 7px; word-break: break-word; }
.result-row:nth-child(even) { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.result-empty { padding: 20px; text-align: center; color: var(--muted); font-family: var(--font); }
.result-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { display: inline-flex; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 600; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); }
.table tfoot td { font-weight: 700; border-bottom: 0; }

.notice {
  display: block; margin-top: 14px; padding: 11px 14px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ---------- опции, UTM, QR ---------- */

.options { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-top: 18px; }
.options:empty { display: none; }
.opt-select { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; min-width: 220px; }
.opt-select .text-input { padding: 9px 12px; font-weight: 400; }
.result-empty.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 8px; }

.url-out {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 13.5px; word-break: break-all; line-height: 1.6;
}
.url-out.placeholder { opacity: .5; }
code.inline { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }

.qr-grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-preview canvas { width: 100%; max-width: 320px; height: auto; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.color-input { width: 100%; height: 44px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
input[type=number].text-input { appearance: textfield; }

/* ---------- генератор паролей ---------- */

.pass-box {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.pass-value { flex: 1; min-width: 0; font-family: var(--mono); font-size: clamp(16px, 3vw, 22px); font-weight: 600; word-break: break-all; letter-spacing: .02em; }
.strength { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 12px; }
.strength > i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s, background .25s; }
.strength-label { margin-top: 6px; font-size: 12px; color: var(--muted); }

.range-row { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.range-row label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.range-row output { min-width: 28px; font-family: var(--mono); font-weight: 700; color: var(--accent); }
input[type=range] { flex: 1; accent-color: var(--accent); height: 28px; }

.checks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 18px; }
.check {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-size: 14px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--border-strong); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.row { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.row .field { flex: 1 1 200px; }
select.text-input { appearance: auto; }

/* ---------- главная ---------- */

.hero { padding: 8px 0 30px; }
.hero h1 { font-size: clamp(32px, 5.5vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin-top: 14px; font-size: 18px; color: var(--muted); max-width: 54ch; }

.search { position: relative; margin: 26px 0 34px; max-width: 520px; }
.search input {
  width: 100%; height: 50px; padding: 0 18px 0 46px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; outline: none; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }

.group { margin-bottom: 38px; }
.group-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  padding: 20px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); text-decoration: none; }
.card-ico {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 13px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 80% 58%), hsl(calc(var(--h) + 40) 80% 58%));
  box-shadow: 0 10px 20px -10px hsl(var(--h) 80% 50%);
}
.card h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card p { font-size: 13.5px; color: var(--muted); }
.card.soon { opacity: .55; }
.card .soon-badge { position: absolute; top: 16px; right: 16px; margin: 0; }

.empty-search { display: none; padding: 40px; text-align: center; color: var(--muted); }

.footer { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

.backdrop { display: none; }

/* ---------- адаптив ---------- */

@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0;
    width: min(320px, 86vw); translate: -100%; transition: translate .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { translate: 0; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(8, 10, 20, .5); }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 24px 16px 64px; }
  .inputs { grid-template-columns: minmax(0, 1fr); }
  textarea { min-height: 160px; }
  .qr-grid { grid-template-columns: minmax(0, 1fr); }
  .qr-preview { order: -1; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- доступность, 404 ---------- */

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600;
  translate: 0 -200%; transition: translate .15s;
}
.skip:focus { translate: 0; text-decoration: none; }

.empty-page { text-align: center; padding: 70px 0 30px; }
.big-code {
  font-size: clamp(72px, 16vw, 140px); font-weight: 800; letter-spacing: -.04em; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.empty-page h1 { margin-top: 14px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.empty-page p { margin: 10px auto 26px; color: var(--muted); max-width: 44ch; }

/* ---------- новые программы ---------- */

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 18px; }
.tile { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.tile-v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-l { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.panel + .tiles + .panel { margin-top: 18px; }

.freq-row { display: flex; justify-content: space-between; gap: 12px; }
.freq-n { color: var(--muted); font-variant-numeric: tabular-nums; }

.table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-wrap .table th { position: sticky; top: 0; background: var(--surface); }
.table-wrap .table th, .table-wrap .table td { text-align: left; }
.table-wrap .table th:not(:first-child), .table-wrap .table td:not(:first-child) { text-align: right; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.tab:hover { border-color: var(--border-strong); }
.tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tab-n { padding: 1px 8px; border-radius: 99px; background: var(--surface); font-size: 12px; }

.meter { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--border); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s, background .2s; }

.serp { padding: 18px 20px; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--border); font-family: Arial, sans-serif; }
.serp-url { font-size: 13px; color: #202124; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-title { margin: 4px 0 3px; font-size: 20px; line-height: 1.3; color: #1a0dab; white-space: nowrap; overflow: hidden; }
.serp-desc { font-size: 14px; line-height: 1.58; color: #4d5156; max-width: 960px; }
.serp .ph { opacity: .45; }
:root[data-theme="dark"] .serp { background: #fff; }

.tips { list-style: none; margin-top: 16px; display: grid; gap: 8px; }
.tip { padding: 9px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--border); background: var(--surface-2); }
.tip.ok { border-color: color-mix(in srgb, #22c55e 45%, var(--border)); background: var(--ok-soft); }
.tip.warn { border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); background: rgba(245, 158, 11, .12); }
.tip.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.url-out.pre { white-space: pre-wrap; max-height: 460px; overflow: auto; }
textarea[readonly] { cursor: default; }

/* ---------- поиск страниц, проверка элементов ---------- */

.page-list { display: grid; gap: 10px; }
.page-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.page-info { min-width: 0; flex: 1 1 280px; }
.page-name { font-weight: 700; }
.page-sub { font-size: 12.5px; color: var(--muted); }
.page-url { font-family: var(--mono); font-size: 13px; color: var(--accent); word-break: break-all; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 99px; background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); font-size: 13px; }

.check-card { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.check-card + .check-card { margin-top: 12px; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; word-break: break-all; }
.badge { padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.found-line { margin-top: 10px; font-size: 14px; }
.found-line code { font-family: var(--mono); font-size: 12px; color: var(--muted); display: block; margin-top: 4px; word-break: break-all; }
