:root {
  --bg: #0c1826;
  --bg-elev: #112030;
  --panel: rgba(16, 26, 38, 0.92);
  --panel-solid: #121c26;
  --text: #eef0ea;
  --muted: #a9b1a8;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --accent: #f2d9a0;
  --accent-dim: rgba(242, 217, 160, 0.14);
  --teal: #2ec4b6;
  --amber: #f4a261;
  --sky: #4ea8de;
  --coral: #e63946;
  --topbar-h: 52px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 20px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(45, 106, 147, 0.22), transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--accent); }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ top bar */
.guide-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  background: rgba(10, 16, 22, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.guide-topbar-inner {
  max-width: 1260px;
  height: 100%;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.flag {
  width: 22px; height: 15px; border-radius: 2px; flex: none;
  background:
    linear-gradient(90deg, transparent 6px, #fecc02 6px, #fecc02 9px, transparent 9px),
    linear-gradient(transparent 6px, #fecc02 6px, #fecc02 9px, transparent 9px),
    #106aa7;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.brand-title {
  font: 600 18px/1 Georgia, "Times New Roman", "Noto Serif", serif;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-decoration: none;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tb-btn:hover { border-color: var(--line-strong); text-decoration: none; }
.tb-btn.primary {
  background: var(--accent-dim);
  border-color: rgba(242, 217, 160, 0.45);
  color: var(--accent);
}

.lang-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.lang-pill {
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lang-pill:hover { color: var(--text); }
.lang-pill.is-active {
  background: var(--accent);
  color: #121820;
}

/* ------------------------------------------------------------------ layout */
.guide-shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 24px 18px 48px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
}
.toc-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 8px 8px;
}
.guide-toc nav { display: flex; flex-direction: column; gap: 3px; }
.toc-link {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.toc-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.toc-link.is-active {
  color: var(--accent);
  background: rgba(242, 217, 160, 0.09);
  border-left-color: var(--accent);
  font-weight: 600;
}

.guide-main {
  min-width: 0;
  max-width: 940px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ------------------------------------------------------------------ hero */
.hero {
  background: linear-gradient(135deg, rgba(22, 38, 56, 0.94), rgba(14, 24, 36, 0.94));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.hero-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.hero h1 {
  margin: 0 0 10px;
  font: 600 28px/1.2 Georgia, "Times New Roman", "Noto Serif", serif;
  color: #f6f2e9;
}
.hero p {
  margin: 0 0 18px;
  color: #d5dad3;
  max-width: 72ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-pill {
  margin-top: 14px;
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ sections & cards */
.guide-sec {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
}
.guide-sec h2 {
  margin: 0 0 14px;
  font: 600 21px/1.25 Georgia, "Times New Roman", "Noto Serif", serif;
  color: var(--accent);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.guide-sec h3 {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #f4efe4;
}
.guide-sec p { margin: 8px 0; color: #dde2db; }

.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}
.fact-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
.fact-lbl { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.fact-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.info-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.info-card-title { font-weight: 700; font-size: 14px; color: #f4efe4; }
.info-card-body { font-size: 13px; color: #cfd5ce; }
.info-card-meta { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: auto; padding-top: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-dim); border-color: rgba(242, 217, 160, 0.4); color: var(--accent); }
.badge.warn { background: rgba(230, 57, 70, 0.14); border-color: rgba(230, 57, 70, 0.45); color: #ffb3b8; }

.ramp-bar {
  height: 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.swatch-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  vertical-align: middle;
  margin-right: 6px;
}

/* ------------------------------------------------------------------ callouts & quadrants */
.callout {
  background: rgba(46, 196, 182, 0.08);
  border: 1px solid rgba(46, 196, 182, 0.35);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0 14px;
}
.callout.warn {
  background: rgba(244, 162, 97, 0.09);
  border-color: rgba(244, 162, 97, 0.35);
  border-left-color: var(--amber);
}
.callout-title { font-weight: 700; color: #f6f2e9; margin-bottom: 5px; }

.quad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.quad-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  font-size: 13px;
}
.quad-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }

/* ------------------------------------------------------------------ tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 16, 24, 0.45);
}
table.g-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.g-tbl th, table.g-tbl td {
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
table.g-tbl th {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
table.g-tbl tbody tr:last-child td { border-bottom: 0; }
table.g-tbl tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

kbd {
  display: inline-block;
  padding: 2px 6px;
  font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--accent);
}
code {
  font: 500 12.5px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #e4d4aa;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ sources toolbar */
.sources-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.filter-pill:hover { color: var(--text); border-color: var(--line-strong); }
.filter-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #121820;
}
.source-search {
  flex: 1 1 260px;
  max-width: 360px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 21, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.source-search::placeholder { color: var(--muted); }
.sources-count { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }

.party-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.party-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
}

.wf-list { display: flex; flex-direction: column; gap: 12px; }
.wf-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
}
.wf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.wf-title { font-weight: 700; font-size: 15px; color: #f4efe4; }
.wf-steps { margin: 0; padding-left: 20px; font-size: 13.5px; color: #d5dad3; }
.wf-steps li { margin: 4px 0; }

.guide-footer {
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 18px 36px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .guide-shell { grid-template-columns: 1fr; padding-top: 14px; gap: 16px; }
  .guide-toc { position: static; }
  .guide-toc nav { flex-direction: row; flex-wrap: wrap; }
  .toc-link { border-left: 0; border-bottom: 2px solid transparent; }
  .toc-link.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .hero { padding: 18px; }
  .hero h1 { font-size: 22px; }
  .guide-sec { padding: 16px; }
  .quad-grid { grid-template-columns: 1fr; }
}
