:root {
  --bg: #000000;
  --bg-soft: #0c0d12;
  --surface: #14161d;
  --surface-2: #1b1e28;
  --border: #262a37;
  --text: #e9eaf1;
  --text-muted: #a0a7bb;
  --text-subtle: #70778c;
  --accent: #8b7ce8;
  --accent-bright: #a495ff;
  --accent-soft: rgba(139, 124, 232, 0.13);
  --danger: #e07a7a;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.72);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, rgba(139,124,232,0.28), rgba(139,124,232,0.08));
  border: 1px solid rgba(139, 124, 232, 0.4);
  color: var(--accent-bright); font-weight: 800; font-size: 14px;
}
.brand-text { font-weight: 700; font-size: 15px; }
.brand-text em { font-style: normal; color: var(--text-muted); font-weight: 500; }
.header-nav { display: flex; gap: 18px; font-size: 14px; font-weight: 600; align-items: center; }
.header-nav a { color: var(--text-muted); }
.header-nav a:hover { color: var(--text); text-decoration: none; }

.nav-toggle-label { display: none; cursor: pointer; padding: 8px; color: var(--text-muted); font-size: 20px; line-height: 1; }
#nav-toggle { display: none; }

/* ---------- main ---------- */
main { padding: 40px 0 64px; min-height: 60vh; }
.loading { color: var(--text-muted); }

.hero h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; }
.lead { color: var(--text-muted); margin: 0 0 24px; max-width: 68ch; }
.lead-sm { color: var(--text-muted); margin: 4px 0 0; max-width: 68ch; font-size: 15px; }

.sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 30px 0 26px; }
.section-card {
  display: block; padding: 22px 22px 16px; border-radius: 18px;
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}
.section-card:hover { text-decoration: none; border-color: rgba(139, 124, 232, 0.55); transform: translateY(-1px); }
.section-card h2 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.section-card p { margin: 0 0 12px; color: var(--text-muted); font-size: 14px; }
.section-card ul { margin: 0; padding: 0; list-style: none; }
.section-card li {
  padding: 7px 0; border-top: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.section-card .ver { color: var(--text-subtle); font-family: var(--mono); font-size: 11px; font-weight: 400; }

.operator {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
  background: var(--bg-soft); display: grid; gap: 8px; font-size: 14px; color: var(--text-muted);
  margin-top: 8px;
}
.op-label {
  display: inline-block; min-width: 190px; margin-right: 12px;
  color: var(--text-subtle); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}

/* ---------- doc list ---------- */
.doc-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-top: 18px; }
.doc-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 16px 6px; border-bottom: 1px solid var(--border); color: var(--text);
  border-radius: 6px;
}
.doc-row:hover { text-decoration: none; background: var(--bg-soft); }
.doc-row .name { font-weight: 600; font-size: 16px; }
.doc-row .meta { color: var(--text-subtle); font-size: 12.5px; white-space: nowrap; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }

.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-muted);
  white-space: nowrap;
}
.badge.required { color: var(--accent-bright); border-color: rgba(139, 124, 232, 0.45); background: var(--accent-soft); }
.badge.draft { color: var(--danger); border-color: rgba(224, 122, 122, 0.4); }
.badge.current { color: #8fd6a4; border-color: rgba(143, 214, 164, 0.35); }
.badge.old { color: var(--text-muted); }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }

/* ---------- doc page ---------- */
.doc-layout { max-width: 780px; }
.doc-main { min-width: 0; }
.doc-head { margin-bottom: 20px; }
.doc-head h1 { font-size: clamp(23px, 4.5vw, 28px); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-subtle); font-size: 12.5px; margin-bottom: 14px; }
.doc-meta code { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.doc-actions select, .btn-print {
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 12px; cursor: pointer;
}
.btn-print:hover, .doc-actions select:hover { border-color: var(--accent); }
.change-note { color: var(--text-muted); font-size: 13px; margin-top: 12px; }
.ver-nav { display: flex; gap: 16px; font-size: 13px; font-weight: 600; margin: 8px 0 0; }

.toc {
  margin: 18px 0 8px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-soft); padding: 12px 16px;
}
.toc summary { cursor: pointer; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.toc nav { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.toc nav a { font-size: 14px; color: var(--text-muted); }
.toc nav a:hover { color: var(--accent-bright); text-decoration: none; }

.doc-body { font-size: 16px; max-width: 72ch; }
.doc-body h1 { font-size: 24px; margin: 0 0 14px; }
.doc-body h2 { font-size: 18.5px; font-weight: 700; margin: 32px 0 10px; padding-top: 20px; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.doc-body h3 { font-size: 16px; font-weight: 700; margin: 20px 0 6px; color: var(--text); scroll-margin-top: 80px; }
.doc-body p { margin: 10px 0; }
.doc-body ul, .doc-body ol { margin: 8px 0; padding-left: 24px; }
.doc-body li { margin: 4px 0; }
.doc-body blockquote {
  margin: 16px 0; padding: 12px 16px;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 10px 10px 0; color: var(--text-muted); font-size: 14px;
}
.doc-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc-body th { background: var(--surface); font-weight: 700; }
.doc-body code { font-family: var(--mono); font-size: 13px; }
.doc-body strong { font-weight: 700; }

.table-scroll { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.history-table th, .history-table td { border-bottom: 1px solid var(--border); padding: 10px 8px; text-align: left; vertical-align: top; }
.history-table th { color: var(--text-subtle); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.history-table td code { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }

.site-footer { border-top: 1px solid var(--border); padding: 26px 0 40px; font-size: 13px; color: var(--text-muted); }
.site-footer .muted { color: var(--text-subtle); }
.back-link { display: inline-block; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; }
.notice {
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; color: var(--text-muted); font-size: 14px; margin: 18px 0;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .sections { grid-template-columns: 1fr; }
  .doc-row { flex-direction: column; gap: 4px; }
  .doc-row .meta { justify-content: flex-start; }
  .op-label { min-width: 0; display: block; margin: 0 0 2px; }

  .nav-toggle-label { display: block; }
  .header-nav {
    display: none; position: absolute; top: 62px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 20px 14px;
    background: rgba(0, 0, 0, 0.96); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
  }
  .header-nav a { padding: 10px 0; font-size: 15px; }
  #nav-toggle:checked ~ .header-nav { display: flex; }
}

@media print {
  :root { --bg: #fff; --text: #111; --text-muted: #444; --text-subtle: #666; --border: #ccc; --surface: #fff; --accent: #333; --accent-soft: transparent; }
  .site-header, .site-footer, .doc-actions, .back-link, .toc { display: none; }
  body { background: #fff; }
  .doc-body h2 { border-top-color: #ccc; }
}
