:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --card: #141a26;
  --text: #e7ecf6;
  --muted: #93a0b5;
  --line: #2a3348;
  --accent: #8b7cff;
  --accent-ink: #fff;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #fff;
  --text: #141824;
  --muted: #5d6880;
  --line: #e4e7f0;
  --accent: #6d4aff;
  --accent-ink: #fff;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: 6px 10px; text-decoration: none; color: var(--muted); }
.seg a.on { background: var(--accent); color: var(--accent-ink); }
.icon-btn, .ghost, .primary {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; }
.icon-btn svg, .search svg { width: 18px; height: 18px; fill: currentColor; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 61px); }
.sidebar {
  position: sticky; top: 61px; align-self: start;
  height: calc(100vh - 61px); overflow: auto;
  padding: 16px; border-right: 1px solid var(--line);
}
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.search input { border: 0; background: transparent; color: inherit; width: 100%; outline: none; }
.sidebar nav { display: flex; flex-direction: column; margin-top: 12px; }
.sidebar a { text-decoration: none; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.sidebar a.active, .sidebar a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.doc { width: min(860px, 100%); padding: 28px 28px 64px; }
.panel, .hero, .doc-foot {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
}
.kicker { margin: 0 0 8px; color: var(--accent); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.time { color: var(--muted); font-size: 0.9rem; }
h1 { font-size: 2.2rem; margin: 0 0 8px; }
h2 { margin: 0; }
.lead { font-size: 1.05rem; }
.callout {
  padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.hero-actions, .file-card { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); font-size: 0.85rem; }
.callout.warn { background: color-mix(in srgb, #ffb020 18%, transparent); }
.file-card {
  margin-top: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  justify-content: space-between;
}
.file-card strong, .file-card span { display: block; }
.file-card span { color: var(--muted); }
.steps { display: grid; gap: 10px; }
.step { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.tag { color: var(--accent); font-weight: 700; }
.bullets, .checks { padding-left: 18px; }
.checks li { margin: 6px 0; }
.flash { list-style: none; padding: 0; }
.flash li { padding: 10px 12px; border-radius: 10px; }
.flash .error { background: rgba(255, 107, 122, 0.14); }
.flash .ok { background: rgba(61, 214, 140, 0.14); }
.gate-main { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); }
.gate-card input, .gate-card button { width: 100%; margin-top: 8px; }
.gate-card input {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 15; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 16; top: 61px; left: 0; bottom: 0; width: min(300px, 86vw);
    background: var(--bg); transform: translateX(-105%); transition: transform .15s ease;
  }
  .sidebar.open { transform: none; }
  .doc { padding: 18px 14px 48px; }
}
@media print {
  .topbar, .sidebar, .backdrop { display: none; }
  .shell { display: block; }
}
