:root {
  --bg: #ffffff;
  --bg-2: #f1f7fc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f1b2e;
  --muted: #5b6b82;
  --accent: #0ea5e9;
  --accent-2: #0284c7;
  --grad: linear-gradient(120deg, #0ea5e9, #6366f1);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 27, 46, 0.05), 0 10px 30px rgba(15, 27, 46, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 78px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.55rem; letter-spacing: 0.3px; flex-shrink: 0; }
.logo svg { width: 38px; height: 38px; color: var(--accent); }
.site-nav { display: flex; gap: 6px; margin-left: auto; }
.site-nav a { color: var(--muted); padding: 9px 15px; border-radius: 9px; font-size: 1rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-2); }
.site-nav a.on { color: var(--accent-2); background: var(--bg-2); font-weight: 600; }

/* поиск в шапке */
.search-form { position: relative; flex: 0 1 300px; }
.search-form input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 40px 9px 14px; font-size: 0.95rem;
  color: var(--text); outline: none; transition: border-color 0.15s;
}
.search-form input:focus { border-color: var(--accent); background: #fff; }
.search-form button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px; display: flex; align-items: center;
}
.search-form button:hover { color: var(--accent-2); }

/* hero */
.hero { padding: 90px 0 70px; background:
  radial-gradient(900px 450px at 75% -10%, rgba(14, 165, 233, 0.14), transparent 60%),
  radial-gradient(700px 380px at 8% 110%, rgba(99, 102, 241, 0.10), transparent 60%),
  linear-gradient(180deg, #f8fcff, #ffffff); }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); line-height: 1.15; margin: 0 0 18px; max-width: 800px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 700px; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 11px; font-weight: 600; font-size: 1rem; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border: 1px solid var(--border); color: var(--text); background: var(--card); }
.btn.ghost:hover { border-color: var(--accent); }
.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 1.9rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats span { color: var(--muted); font-size: 0.9rem; }

/* sections */
.section { padding: 55px 0; }
.section.alt { background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 1.5rem; }
.more { color: var(--muted); font-size: 0.95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--text); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.card:hover { transform: translateY(-2px); border-color: rgba(14, 165, 233, 0.5); box-shadow: 0 4px 10px rgba(15, 27, 46, 0.05), 0 14px 38px rgba(15, 27, 46, 0.10); text-decoration: none; }
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card.guide { border-left: 3px solid var(--accent); }
.tag { display: inline-block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--accent-2); margin-bottom: 8px; }
.date { display: block; margin-top: 12px; color: var(--muted); font-size: 0.82rem; }

/* page head */
.page-head { padding: 60px 0 30px; background:
  radial-gradient(600px 260px at 85% -20%, rgba(14, 165, 233, 0.12), transparent 60%),
  linear-gradient(180deg, #f8fcff, #ffffff); }
.page-head h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: 0 0 12px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }

/* glossary */
.letter-block { margin-bottom: 30px; }
.letter { font-size: 1.4rem; color: var(--accent-2); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 0 0 14px; }
.term-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.term-list a { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 12px 16px; color: var(--text); box-shadow: var(--shadow); }
.term-list a:hover { border-color: rgba(14, 165, 233, 0.5); text-decoration: none; }
.term-list b { display: block; margin-bottom: 3px; }
.term-list span { color: var(--muted); font-size: 0.88rem; }

/* article */
.article { max-width: 760px; }
.article h2 { font-size: 1.5rem; margin: 38px 0 12px; }
.article h3 { font-size: 1.2rem; margin: 28px 0 10px; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 18px; padding-left: 24px; }
.article li { margin-bottom: 6px; }
.article blockquote { margin: 0 0 18px; padding: 14px 18px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 10px 10px 0; color: var(--muted); }
.article code { background: rgba(14, 165, 233, 0.10); color: var(--accent-2); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }
.article pre { background: #0f1b2e; color: #e2e8f0; border-radius: 10px; padding: 16px; overflow-x: auto; margin: 0 0 18px; }
.article pre code { background: none; color: inherit; padding: 0; }
.article table { width: 100%; border-collapse: collapse; }
.article svg { width: 100%; height: auto; margin: 6px 0 20px; border-radius: 16px; }
.article img { display: block; max-width: 100%; height: auto; border-radius: 16px; margin: 6px 0 20px; box-shadow: var(--shadow); }
.article th, .article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.article th { color: var(--accent-2); font-weight: 600; background: var(--bg-2); }
.table-wrap { overflow-x: auto; margin-bottom: 18px; }
.related { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.related h3 { margin: 0 0 12px; font-size: 1.05rem; color: var(--muted); }
.chip { display: inline-block; margin: 0 8px 8px 0; padding: 7px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 99px; color: var(--text); font-size: 0.9rem; }
.chip:hover { border-color: var(--accent); text-decoration: none; }

/* cta */
.cta-box { background: linear-gradient(135deg, rgba(14, 165, 233, 0.10), rgba(99, 102, 241, 0.10)); border: 1px solid rgba(14, 165, 233, 0.25); border-radius: 18px; padding: 38px; text-align: center; }
.cta-box h2 { margin: 0 0 10px; }
.cta-box p { color: var(--muted); max-width: 520px; margin: 0 auto 22px; }
.cta-inline { margin-top: 40px; padding: 22px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cta-inline p { margin: 0; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; background: var(--bg-2); }
.footer-inner p { margin: 0 0 6px; }
.footer-inner .muted { font-size: 0.85rem; }

/* chat widget */
#chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}
#chat-fab:hover { filter: brightness(1.06); }
#chat-root { position: fixed; right: 22px; bottom: 90px; z-index: 95; width: min(400px, calc(100vw - 44px)); }
.chat-panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(15, 27, 46, 0.18); display: flex; flex-direction: column; height: 520px; }
.chat-panel--full { height: 560px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-head button { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-body--full { height: 380px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 13px; font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; }
.msg.bot { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--border); }
.msg.bot.err { border-color: rgba(239, 68, 68, 0.5); color: #b91c1c; }
.msg.typing { color: var(--muted); font-style: italic; }
.chat-quick { display: flex; gap: 8px; padding: 0 14px 10px; flex-wrap: wrap; }
.chat-quick button { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: 99px; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; }
.chat-quick button:hover { border-color: var(--accent); }
.chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 10px 14px; font-size: 0.95rem; outline: none; }
.chat-form input:focus { border-color: var(--accent); }
.chat-form button { background: var(--grad); border: none; color: #fff; border-radius: 10px; padding: 0 18px; font-weight: 600; cursor: pointer; }

/* assistant page */
.assistant-wrap { max-width: 760px; margin: 0 auto; }

/* поиск: страница результатов */
.search-results { margin-top: 8px; }
.search-results .term-list { grid-template-columns: 1fr; }
.search-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.search-empty .big { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.search-hit { background: var(--bg-2); border-radius: 6px; padding: 1px 4px; }

@media (max-width: 640px) {
  .hero { padding: 60px 0 45px; }
  .site-nav a { padding: 6px 9px; font-size: 0.85rem; }
  .grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 10px; }
  .search-form { flex: 1 1 100%; order: 3; margin-left: 0; }
  .site-nav { margin-left: 0; }
}
