/* RMRP Право · Александр Белоконь 770-860, Рублёвка */
:root {
  --bg: #f3f4fa; --bg-glow-a: rgba(106, 75, 255, .10); --bg-glow-b: rgba(25, 182, 216, .10);
  --surface: #ffffff; --surface-2: #f6f7fc; --surface-3: #eceef8;
  --border: #e2e4f0; --border-strong: #cfd3e6;
  --text: #161a2a; --text-2: #3c435d; --muted: #6b7290;
  --accent: #5b3df5; --accent-2: #0e94b3; --accent-soft: rgba(91, 61, 245, .10);
  --grad: linear-gradient(135deg, #6a4bff 0%, #19b6d8 100%);
  --mark: #ffe17a; --mark-text: #3a2c00;
  --danger: #d6284b; --ok: #0f9d68; --warn: #c77a06;
  --shadow: 0 1px 2px rgba(20, 24, 50, .05), 0 8px 24px rgba(20, 24, 50, .06);
  --shadow-lg: 0 20px 60px rgba(20, 24, 50, .18);
  --radius: 16px; --radius-sm: 10px;
  --law-l: 36%; --law-bg-a: .10; --law-bd-a: .28;
  --wm-color: rgba(30, 30, 80, .045);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --script: "Segoe Script", "Snell Roundhand", "Brush Script MT", "Lucida Handwriting", cursive;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090b12; --bg-glow-a: rgba(106, 75, 255, .16); --bg-glow-b: rgba(25, 182, 216, .10);
  --surface: #11141f; --surface-2: #161a28; --surface-3: #1d2233;
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .16);
  --text: #e9ecf6; --text-2: #c2c8dc; --muted: #8990a9;
  --accent: #8a72ff; --accent-2: #3cc8e6; --accent-soft: rgba(138, 114, 255, .14);
  --mark: #6d5a10; --mark-text: #fff3c0;
  --danger: #ff6b86; --ok: #3fd39a; --warn: #f0b04a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  --law-l: 68%; --law-bg-a: .13; --law-bd-a: .32;
  --wm-color: rgba(190, 190, 255, .04);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text);
  background: var(--bg); min-height: 100vh; min-height: 100dvh;
  background-image:
    radial-gradient(900px 500px at 12% -10%, var(--bg-glow-a), transparent 60%),
    radial-gradient(800px 460px at 95% 0%, var(--bg-glow-b), transparent 60%);
  background-repeat: no-repeat; background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wm { position: fixed; inset: 0; z-index: 0; pointer-events: none; background-image: var(--wm); background-size: 420px 260px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
svg.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 40; backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.top-in { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; min-width: 0; }
.mono {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -.02em; box-shadow: 0 6px 18px rgba(106, 75, 255, .4); flex: none;
}
.brand-t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-t b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand-t small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav a {
  color: var(--text-2); padding: 8px 13px; border-radius: 10px; font-weight: 500; font-size: 14.5px; display: flex; align-items: center; gap: 7px;
  text-decoration: none;
}
.nav a:hover { background: var(--surface-3); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.top-sp { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center;
  color: var(--text-2); transition: .15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.dot { position: relative; }
.dot::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface); }
.dot.ok::after { background: var(--ok); }

main { position: relative; z-index: 1; max-width: 1160px; margin: 0 auto; padding: 22px 16px 60px; }

/* ---------- поиск ---------- */
.hero { text-align: center; padding: 34px 0 6px; transition: .2s; }
.hero h1 { font-size: clamp(28px, 5vw, 46px); font-weight: 800; letter-spacing: -.03em; }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 640px; margin: 12px auto 0; font-size: 16.5px; }
.has-q .hero { display: none; }
.sigline { margin: 16px auto 0; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.sig { font-family: var(--script); font-size: 22px; color: var(--accent); transform: rotate(-2deg); line-height: 1.2; }
.sig-sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.flourish { width: 150px; height: 10px; color: var(--accent); opacity: .7; }

.searchbox { max-width: 860px; margin: 22px auto 0; }
.has-q .searchbox { margin-top: 4px; }
.sfield {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 20px; padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.sfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.sfield > .i { color: var(--muted); width: 22px; height: 22px; }
.sfield textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; resize: none; padding: 12px 0;
  height: 48px; max-height: 160px; line-height: 24px;
}
.sfield textarea::placeholder { color: var(--muted); }
.clear-btn { border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.clear-btn:hover { background: var(--surface-3); color: var(--text); }
.go {
  border: 0; background: var(--grad); color: #fff; font-weight: 700; padding: 0 22px; height: 48px; border-radius: 15px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(106, 75, 255, .35); transition: transform .1s, filter .15s;
}
.go:hover { filter: brightness(1.08); }
.go:active { transform: scale(.97); }

.opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; color: var(--text-2); white-space: nowrap; transition: .15s; user-select: none;
}
.pill:hover { border-color: var(--border-strong); }
.pill.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); font-weight: 600; }
.pill .i { width: 15px; height: 15px; }
.filters-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; margin: 8px -2px 0; scrollbar-width: none; }
.filters-row::-webkit-scrollbar { display: none; }
.filters-row .pill { flex: none; }

.sect-t { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.sect-t .sp { flex: 1; }
.sect-t button { border: 0; background: none; color: var(--muted); font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.sect-t button:hover { color: var(--danger); }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ex {
  text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 13px 15px; color: var(--text-2); font-size: 14.5px;
  display: flex; gap: 11px; align-items: flex-start; transition: .15s;
}
.ex:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.ex .i { color: var(--accent); margin-top: 2px; }
.ex small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.hist { display: flex; flex-wrap: wrap; gap: 8px; }
.stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 26px; margin-top: 26px; color: var(--muted); font-size: 13.5px; }
.stats b { color: var(--text); font-weight: 700; }

/* ---------- ответ ---------- */
.answer {
  margin-top: 20px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background:
    linear-gradient(180deg, var(--accent-soft), transparent 120px), var(--surface); box-shadow: var(--shadow); padding: 18px 20px 16px;
}
.answer-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; }
.answer-h .badge { margin-left: auto; }
.spark { width: 28px; height: 28px; border-radius: 9px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.spark .i { width: 16px; height: 16px; }
.md { font-size: 15.5px; color: var(--text); overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; } .md li { margin: 4px 0; }
.md li ul { margin: 4px 0; }
.md strong { font-weight: 700; } .md em { color: var(--muted); }
.md h3 { font-size: 15.5px; margin: 12px 0 6px; }
.cite {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin: 0 1px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 700; vertical-align: 1px; text-decoration: none !important; cursor: pointer; border: 0;
}
.cite:hover { background: var(--accent); color: #fff; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.answer-idle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; transition: .15s; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(106, 75, 255, .3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.err-box { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding: 10px 14px; border-radius: 12px; font-size: 14.5px; }
.skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sh 1.2s infinite; margin: 9px 0; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- результаты ---------- */
.res-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 24px 2px 12px; }
.res-head h2 { font-size: 18px; font-weight: 700; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: transparent; }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); border-color: transparent; }
.cards { display: grid; gap: 12px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--border-strong); }
.card.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); } }
.card-h { display: flex; align-items: flex-start; gap: 12px; }
.rank { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; margin-top: 1px; }
.card-t { min-width: 0; flex: 1; }
.card-t h3 { font-size: 17px; font-weight: 700; }
.card-t h3 a { color: var(--text); text-decoration: none; }
.card-t h3 a:hover { color: var(--accent); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 7px; font-size: 13px; color: var(--muted); }
.law-chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  background: hsl(var(--h) 80% 55% / var(--law-bg-a)); color: hsl(var(--h) 75% var(--law-l)); border: 1px solid hsl(var(--h) 80% 55% / var(--law-bd-a));
}
.relbar { width: 54px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
.relbar i { display: block; height: 100%; background: var(--grad); border-radius: 3px; }
.snip { margin: 11px 0 0 38px; font-size: 14.5px; color: var(--text-2); position: relative; }
.snip .ref { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.snip-body { max-height: 10.5em; overflow: hidden; position: relative; }
.md .sub { margin-top: 4px; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--text-2); font-size: 14.5px; }
.snip.open .snip-body { max-height: none; }
.snip:not(.open) .snip-body.long::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(transparent, var(--surface)); }
.more-link { border: 0; background: none; color: var(--accent); font-size: 13.5px; font-weight: 600; padding: 4px 0; }
.card-a { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 38px; flex-wrap: wrap; }
.mini { border: 0; background: transparent; color: var(--muted); padding: 6px 9px; border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.mini:hover { background: var(--surface-3); color: var(--text); }
.mini.on { color: var(--warn); }
.mini.on .i { fill: currentColor; }
.mark, mark { background: var(--mark); color: var(--mark-text); border-radius: 4px; padding: 0 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 40px; }
.empty h3 { color: var(--text); margin: 10px 0 6px; }
.more-row { text-align: center; margin: 18px 0 0; }

/* текст закона */
.lt { line-height: 1.62; }
.lt .ln { margin: 0 0 6px; }
.lt .li { padding-left: 18px; text-indent: -0; position: relative; margin: 0 0 4px; }
.lt .pref { font-weight: 700; color: var(--accent); margin-right: 4px; }
.lt .penalty { font-weight: 500; color: var(--text); border-left: 3px solid var(--accent); padding-left: 10px; margin: 6px 0 8px; }
.lt .xref { border-bottom: 1px dashed currentColor; text-decoration: none; }
.sprp { display: inline-flex; gap: 4px; align-items: baseline; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); border-radius: 7px; padding: 0 7px; font-size: .88em; font-weight: 600; white-space: nowrap; }
.sprp b { letter-spacing: .04em; }

/* ---------- читалка ---------- */
.reader { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.toc {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 14px; overscroll-behavior: contain;
}
.toc-h { position: sticky; top: 0; background: var(--surface); padding: 12px; border-bottom: 1px solid var(--border); z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.toc-h b { font-size: 13.5px; }
.input {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; outline: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.toc-ch { padding: 10px 14px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.toc a.it { display: flex; gap: 8px; padding: 7px 14px; color: var(--text-2); text-decoration: none; border-left: 3px solid transparent; }
.toc a.it:hover { background: var(--surface-2); }
.toc a.it.on { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc a.it .n { flex: none; min-width: 34px; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc a.it.rep { opacity: .5; text-decoration: line-through; }
.art { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 26px 30px 22px; min-width: 0; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.crumbs a { color: var(--muted); }
.art h1 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; margin: 12px 0 4px; letter-spacing: -.02em; }
.art .anum { color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.art-a { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.art .part { margin: 14px 0; font-size: 16.5px; }
.pn { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.pn a {
  flex: 1; max-width: 48%; border: 1px solid var(--border); border-radius: 14px; padding: 11px 14px; color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-2); transition: .15s;
}
.pn a:hover { border-color: var(--accent); }
.pn a small { color: var(--muted); font-size: 12px; }
.pn a span { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pn a.next { text-align: right; margin-left: auto; }
.toc-fab { display: none; }
.toc-close { display: none; }

/* ---------- законы ---------- */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 10px 0 18px; }
.page-h h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.lcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; transition: .15s; }
.lcard:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.lcard h3 { font-size: 16.5px; line-height: 1.3; }
.lcard h3 a { color: var(--text); text-decoration: none; }
.lcard .row { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.lcard .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
details.grp { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
details.grp > summary { padding: 13px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details.grp > summary::-webkit-details-marker { display: none; }
details.grp > summary::before { content: "›"; color: var(--muted); font-size: 20px; transition: transform .15s; line-height: 1; }
details.grp[open] > summary::before { transform: rotate(90deg); }
details.grp > summary small { color: var(--muted); font-weight: 500; margin-left: auto; }
.alist a { display: flex; gap: 12px; padding: 9px 16px 9px 30px; border-top: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
.alist a:hover { background: var(--surface-2); color: var(--accent); }
.alist .n { min-width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alist a.rep { opacity: .5; }

/* ---------- модалка / тост ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 14, .6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; max-height: calc(100dvh - 32px); overflow: auto; animation: pop .18s; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-h h2 { font-size: 20px; flex: 1; }
.modal-b { padding: 8px 20px 22px; }
.sec { padding: 16px 0; border-top: 1px solid var(--border); }
.sec:first-child { border-top: 0; }
.sec h3 { font-size: 15.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.sec p { margin: 4px 0 10px; font-size: 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lan { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; }
.lan img { width: 108px; height: 108px; border-radius: 10px; background: #fff; padding: 5px; flex: none; }
.lan code { font-size: 15px; font-weight: 700; word-break: break-all; color: var(--text); }
.progress { height: 8px; background: var(--surface-3); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--grad); transition: width .4s; }
.sig-card { text-align: center; padding: 18px 10px 4px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .18s; max-width: calc(100vw - 32px); }

/* ---------- подвал / таббар ---------- */
.foot { position: relative; z-index: 1; text-align: center; padding: 26px 16px 34px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); max-width: 1160px; margin: 0 auto; }
.foot .sig { font-size: 19px; display: inline-block; }
.foot div { margin-top: 4px; }
.tabbar { display: none; }

/* ---------- мобильные ---------- */
@media (max-width: 860px) {
  .reader { grid-template-columns: 1fr; }
  .toc {
    position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; top: auto; max-height: 78dvh; border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .toc.open { transform: none; }
  .toc-close { display: grid; }
  .toc-fab { display: inline-flex; }
  .toc-shade { position: fixed; inset: 0; background: rgba(5, 6, 14, .5); z-index: 85; }
  .art { padding: 20px 18px 18px; border-radius: 18px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .brand-t small { display: none; }
  main { padding: 14px 12px calc(92px + env(safe-area-inset-bottom)); }
  .top-in { padding: 8px 12px; }
  .hero { padding: 14px 0 0; }
  .hero p { font-size: 15px; }
  .sfield { border-radius: 18px; padding-left: 14px; }
  .go { padding: 0 16px; }
  .go span { display: none; }
  .go.ai span { display: inline; }
  .go.ai { padding: 0 14px; }
  .card { padding: 14px 14px 10px; }
  .snip, .card-a { margin-left: 0; }
  .card-h { gap: 10px; }
  .card-t h3 { font-size: 16px; }
  .row2 { grid-template-columns: 1fr; }
  .lan { flex-direction: column; text-align: center; }
  .lgrid { grid-template-columns: 1fr; }
  .examples { grid-template-columns: 1fr; }
  .foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; background: none; border: 0; text-decoration: none; border-radius: 12px;
  }
  .tabbar .i { width: 23px; height: 23px; }
  .tabbar .on { color: var(--accent); }
  .pn a small { font-size: 11px; }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .top, .tabbar, .toc, .art-a, .pn, .foot, .wm { display: none !important; } body { background: #fff; } .reader { display: block; } .art { border: 0; box-shadow: none; } }

/* ---------- ИИ: кнопка, режим «Сотрудник» ---------- */
.go.ai { background: linear-gradient(135deg, #f59e0b 0%, #ef5da8 55%, #8a5cff 100%); box-shadow: 0 8px 20px rgba(239, 93, 168, .32); padding: 0 16px; }
.md h3.sec-h { font-size: 16px; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--text); }
.md h3.sec-h:first-child { margin-top: 0; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea.input { resize: vertical; line-height: 1.5; }
.o-form { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 18px 20px 14px; }
.o-form .field { margin-bottom: 14px; }
.o-text { min-height: 150px; font-size: 16px; }
.o-meta { display: flex; justify-content: flex-end; font-size: 12.5px; }
.o-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.o-hint { font-size: 13px; }
.o-form .sect-t { margin: 18px 0 8px; }
.o-result { margin-top: 20px; }
.o-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; padding: 6px 0 10px; }
.dots { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.o-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.o-src { margin-top: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.o-src > summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 14.5px; }
.src-list { display: grid; gap: 2px; padding: 0 6px 8px; }
.src { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none !important; font-size: 14.5px; }
.src:hover { background: var(--surface-3); color: var(--accent); }
.src.flash { animation: flash 1.4s ease; }
.src .rank { width: 22px; height: 22px; font-size: 12px; margin: 0; }
.o-queries { font-size: 12.5px; margin-top: 8px; line-height: 1.4; }
.o-h { text-align: left; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font-size: 14.5px; color: var(--text-2); }
.o-h b { color: var(--text); font-size: 13px; }
@media print {
  .o-form, #o-hist, .o-toolbar, .go, .opts, .filters-row, .searchbox { display: none !important; }
  .answer { border: 0; box-shadow: none; background: #fff; }
  .md, .md * { color: #000 !important; }
}

[hidden] { display: none !important; }
.nav a, .brand-t b { white-space: nowrap; }
@media (max-width: 1000px) { .brand-t small { display: none; } .nav { margin-left: 6px; } .nav a { padding: 8px 10px; } }
.o-ex .pill { white-space: normal; text-align: left; line-height: 1.35; border-radius: 14px; }
