:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2fa;
  --text: #172033;
  --muted: #5b6577;
  --line: #dde3ef;
  --primary: #2142bf;
  --primary-hover: #19349a;
  --on-primary: #ffffff;
  --accent: #ff8418;
  --ok: #17803d;
  --ok-bg: #e5f6ea;
  --warn: #9a5a00;
  --warn-bg: #fff3dc;
  --err: #b42318;
  --err-bg: #fde8e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 32, 51, 0.06), 0 8px 24px rgba(23, 32, 51, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #171e2e;
    --surface-2: #1e2740;
    --text: #e8ecf6;
    --muted: #9aa5bd;
    --line: #29334d;
    --primary: #6a88f3;
    --primary-hover: #8aa2f7;
    --on-primary: #0b1020;
    --ok: #5fd08a;
    --ok-bg: #12301f;
    --warn: #f3b35c;
    --warn-bg: #36280f;
    --err: #ff8f86;
    --err-bg: #3a1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
img, picture { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.container { width: min(1120px, 100% - 32px); margin: 0 auto; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .container { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.topnav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.topnav a:not(.btn) { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.topnav a:not(.btn):hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 42px;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--err); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; min-height: 52px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 0.9rem; }
.btn[disabled], .btn.disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.hero { padding: 56px 0 40px; }
.hero .container { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); align-items: center; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 40em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }
.hero-shot img, .shot img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); width: 100%; height: auto; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.section { padding: 40px 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 42em; margin-bottom: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.section.alt .card { background: var(--bg); box-shadow: none; }
.card h3 { margin-bottom: 0.4em; }
.card > :last-child { margin-bottom: 0; }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 12px; }
.split { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); align-items: center; }
.split + .split { margin-top: 48px; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 1.7em; position: relative; margin-bottom: 0.5em; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.req { width: 100%; border-collapse: collapse; }
.req th, .req td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.req th { width: 11em; color: var(--muted); font-weight: 600; }

.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 24px; color: var(--muted); font-size: 0.9rem; }
.footer .container { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-left: auto; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }

.draft-banner { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); border-radius: 10px; padding: 12px 16px; margin-bottom: 24px; font-weight: 600; }
.prose { max-width: 46em; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; }

.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 32px 0; }
.auth-card { width: min(420px, 100% - 32px); }
.auth-card h1 { font-size: 1.6rem; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
input[type="text"], input[type="password"], input[type="search"] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; min-height: 44px;
}
input:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--bg); }
.checkbox input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.checkbox:hover { border-color: var(--primary); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

.cabinet { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); padding: 24px 0 40px; }
.content { min-width: 0; }
.sidenav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.sidenav a { white-space: nowrap; color: var(--muted); padding: 9px 14px; border-radius: 10px; font-weight: 600; border: 1px solid transparent; }
.sidenav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.sidenav a.active { background: var(--surface); border-color: var(--line); color: var(--primary); box-shadow: var(--shadow); }
.content > h1 { font-size: 1.7rem; margin-bottom: 16px; }
.stack > * + * { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.9rem; }
.kv dd { margin: 0 0 10px; font-weight: 600; }
.keybox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.keybox code { font-size: 1.15rem; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; word-break: break-all; user-select: all; }
.inline-form { display: inline; }
progress { width: 100%; height: 12px; accent-color: var(--primary); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 480px; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.notes { white-space: pre-line; margin: 0; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 0.4em; }

@media (min-width: 720px) {
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .kv { grid-template-columns: max-content 1fr; }
  .kv dd { margin-bottom: 6px; }
}

@media (min-width: 960px) {
  .hero .container { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split.reverse .shot { order: -1; }
  .cabinet { grid-template-columns: 220px minmax(0, 1fr); }
  .sidenav { flex-direction: column; overflow: visible; position: sticky; top: 84px; align-self: start; }
}

@media (max-width: 520px) {
  .btn-lg { width: 100%; }
  .hero { padding-top: 32px; }
  .topnav a:not(.btn) { padding: 6px 6px; }
}

.btn-block { width: 100%; }
.mt { margin-top: 10px; }
.wrap { word-break: break-all; }
