:root {
  --bg: #ffffff; --fg: #1d2329; --muted: #5b6672; --line: #e3e7eb; --card: #f6f8fa;
  --accent: #0055da; --accent-fg: #ffffff; --hero: #eef4fb; --logo: #0055da;
}
/* Тёмная тема: по системе, если человек не выбрал светлую; кнопка в шапке ставит data-theme (localStorage). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161b; --fg: #e6eaee; --muted: #9aa5b1; --line: #26303a; --card: #182029;
    --accent: #4c8dff; --accent-fg: #0b1117; --hero: #15202c; --logo: #5b9bff;
  }
}
:root[data-theme="dark"] {
  --bg: #11161b; --fg: #e6eaee; --muted: #9aa5b1; --line: #26303a; --card: #182029;
  --accent: #4c8dff; --accent-fg: #0b1117; --hero: #15202c; --logo: #5b9bff;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.logo { color: var(--logo); display: inline-flex; align-items: center; text-decoration: none; }
.logo svg { height: 30px; width: auto; display: block; }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { color: var(--fg); text-decoration: none; }
nav a:hover { color: var(--accent); }
nav { align-items: center; }
.langs { position: relative; }
.langs summary { cursor: pointer; list-style: none; color: var(--muted); padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.langs summary::-webkit-details-marker { display: none; }
.langs ul { position: absolute; right: 0; top: 30px; z-index: 10; margin: 0; padding: 6px 0; list-style: none; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.15); max-height: 70vh; overflow-y: auto; min-width: 170px; }
.langs li a { display: block; padding: 4px 14px; color: var(--fg); white-space: nowrap; }
.langs li a:hover { background: var(--card); }
.langs li a[aria-current] { font-weight: 700; }
.theme { background: none; border: 1px solid var(--line); border-radius: 6px; width: 32px; height: 28px; padding: 3px; cursor: pointer; color: var(--fg); display: inline-flex; align-items: center; justify-content: center; }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme .sun { display: none; }
  :root:not([data-theme]) .theme .moon { display: inline; }
}
.hero { background: var(--hero); padding: 56px 0 48px; }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 24px; margin: 40px 0 12px; }
h3 { font-size: 18px; margin: 0 0 6px; }
.lead { font-size: 18px; color: var(--muted); max-width: 760px; }
.cta { margin-top: 24px; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); text-decoration: none; font-weight: 600; border: 1px solid var(--accent); margin: 4px 8px 4px 0; }
.btn.ghost { background: transparent; color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid article, .plan { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.grid article { overflow: hidden; padding: 0 0 18px; }
.grid article img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.grid article h3, .grid article p { padding: 0 18px; }
.grid p { margin: 0; color: var(--muted); }
pre { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 13px; line-height: 1.45; }
.small { font-size: 13px; color: var(--muted); }
.ticks { padding-left: 20px; }
.ticks li { margin: 6px 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 24px 0; }
.plan { display: flex; flex-direction: column; }
.plan ul { padding-left: 18px; margin: 8px 0 16px; flex: 1; font-size: 15px; }
.plan.featured { border-color: var(--accent); }
.price { font-size: 28px; font-weight: 700; margin: 4px 0; }
.price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; margin: 12px 0; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td:last-child, .tbl th:last-child { text-align: right; white-space: nowrap; }
.doc { max-width: 780px; }
.doc h2 { font-size: 19px; margin-top: 28px; }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 20px 0 32px; color: var(--muted); font-size: 14px; }
.foot p { margin: 6px 0; }
.period { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 8px 0 0; }
.period button { background: none; border: 0; padding: 8px 14px; cursor: pointer; color: var(--fg); font: inherit; }
.period button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.sandbox-note { background: #fff4ce; color: #5c4400; border-radius: 8px; padding: 8px 12px; }
.keys { background: var(--card); border: 2px solid var(--accent); border-radius: 12px; padding: 16px 18px; margin: 8px 0 24px; }
.keys-msg { margin: 0 0 10px; font-weight: 600; }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.key-label { min-width: 230px; color: var(--muted); }
.key-val { font-size: 15px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; word-break: break-all; }
.key-copy { padding: 4px 10px; margin: 0; }
.acc-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.acc-form input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); min-width: 260px; }
.signin { padding: 6px 14px; margin: 0; }
.me { position: relative; }
.me summary { list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.me summary::-webkit-details-marker { display: none; }
.me ul { position: absolute; right: 0; top: 40px; z-index: 10; margin: 0; padding: 6px 0; list-style: none; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.15); min-width: 160px; }
.me li a, .me li button { display: block; width: 100%; text-align: left; padding: 6px 14px; color: var(--fg); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.me li a:hover, .me li button:hover { background: var(--card); }
.google { margin: 8px 0; }
.acc-or { margin: 8px 0; }
[hidden] { display: none !important; }
.docs-page { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 32px; }
.docs-toc { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow-y: auto; padding-top: 24px; }
.docs-toc ul { list-style: none; padding: 0; margin: 0 0 12px; }
.docs-toc li a { display: block; padding: 3px 0; color: var(--fg); text-decoration: none; font-size: 14px; }
.docs-toc li a:hover { color: var(--accent); }
.docs-body { max-width: none; min-width: 0; }
.docs-body h2 { border-top: 1px solid var(--line); padding-top: 24px; }
.docs-body code { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 0.92em; }
.docs-body pre code { border: 0; padding: 0; background: none; }
@media (max-width: 760px) { .docs-page { grid-template-columns: 1fr; } .docs-toc { position: static; max-height: none; } }
.docs-body .tbl { display: block; overflow-x: auto; }
.docs-body .tbl td:last-child, .docs-body .tbl th:last-child { text-align: left; white-space: normal; }
