/* Flagonic design system — near-black with purple highlights. */

:root {
  --bg: #09090e;
  --bg-raised: #0e0e16;
  --surface: rgba(139, 92, 246, 0.04);
  --surface-2: rgba(255, 255, 255, 0.03);
  --border: rgba(139, 92, 246, 0.18);
  --border-soft: rgba(255, 255, 255, 0.07);
  --purple: #8b5cf6;
  --purple-bright: #a78bfa;
  --purple-deep: #6d28d9;
  --purple-glow: rgba(139, 92, 246, 0.35);
  --text: #ececf4;
  --muted: #9a98b5;
  --green: #34d399;
  --red: #f87171;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--purple-bright); text-decoration: none; }
a:hover { color: #c4b5fd; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.9rem; }
h3 { font-size: 1.05rem; }

.container { width: min(1120px, 100% - 3rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.t-right { text-align: right; }
.grad {
  background: linear-gradient(100deg, var(--purple-bright), #e0aaff 60%, var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* keep descenders inside the painted area */
  padding-bottom: 0.08em;
}

/* --- Navigation --- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(9, 9, 14, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* On the landing page the nav starts fully transparent so the hero glow and
   globe flow behind it uncut, then regains its backdrop once scrolled. */
.nav-landing {
  background: transparent;
  backdrop-filter: none;
  border-bottom-color: transparent;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.nav-landing.scrolled {
  background: rgba(9, 9, 14, 0.8);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--border-soft);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.brand:hover { color: var(--text); }
.brand-mark { color: var(--purple-bright); filter: drop-shadow(0 0 8px var(--purple-glow)); }

.nav-links { display: flex; align-items: center; gap: 1.3rem; }
.nav-links a { color: var(--muted); font-size: 0.92rem; }
.nav-links a:hover { color: var(--text); }
.nav-links a.btn { color: #fff; }

.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.92rem; font-family: inherit;
}
.link-btn:hover { color: var(--text); }

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--purple-bright);
}
.btn-ghost:hover { border-color: var(--purple); background: rgba(139, 92, 246, 0.1); }

.btn-danger {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.16); }

.btn-sm { padding: 0.32rem 0.75rem; font-size: 0.84rem; }
.btn-lg { padding: 0.75rem 1.6rem; font-size: 1rem; border-radius: 11px; }
.btn-row { display: flex; gap: 0.7rem; }

/* --- Landing --- */

.landing { position: relative; overflow-x: hidden; }

/* Ambient glow centered behind the globe, not the nav: only a faint tail
   reaches the top of the page, so nothing bright sits in the bar. */
.hero-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 1100px;
  height: 860px;
  background:
    radial-gradient(ellipse 50% 42% at 50% 42%, rgba(139, 92, 246, 0.22), transparent 70%),
    radial-gradient(ellipse 30% 26% at 62% 32%, rgba(192, 132, 252, 0.12), transparent 70%);
  pointer-events: none;
}

/* Centered hero: the animated globe sits behind the wordmark, fading out
   toward the bottom so the copy stays readable. */
.hero-center {
  position: relative;
  text-align: center;
  padding: 2.5rem 0 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.globe-wrap {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  max-width: 100vw;
  height: 620px;
  pointer-events: none;
  z-index: 0;
}

#globe { width: 100%; height: 100%; display: block; }

/* Standalone HTTP error pages (dist/<code>.html), served by nginx. Reuse the
   hero + globe; just center it and enlarge the status number. */
.error-hero { min-height: 74vh; justify-content: center; }
.error-hero .hero-copy { padding-top: 150px; }
.error-code {
  font-size: clamp(4.5rem, 17vw, 9.5rem);
  line-height: 1;
  margin: 0.5rem 0 0.2em;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 200px;
}

.wordmark {
  font-size: clamp(3.4rem, 9vw, 5.8rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  /* background-clip:text only paints the line box + padding; without the
     bottom padding the "g" descender falls outside it and renders
     transparent (looks cut off). */
  padding-bottom: 0.14em;
  margin: 1.1rem 0 -0.1em;
  filter: drop-shadow(0 0 35px rgba(139, 92, 246, 0.35));
}

.tagline {
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.1rem;
}

.lede { color: var(--muted); font-size: 1.08rem; max-width: 38rem; }
.lede strong { color: var(--text); }
.lede em { color: var(--purple-bright); font-style: normal; }

.cta-row { display: flex; gap: 0.9rem; margin: 1.8rem 0 2.2rem; justify-content: center; flex-wrap: wrap; }

.sdk-row { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.sdk-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center; }

/* Protocol section: code window beside the pitch. */
.proto-split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.proto-copy h3 { margin-bottom: 0.35rem; }
.proto-copy h3 + p { margin-bottom: 1.4rem; }

/* --- Chips & badges --- */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--purple-bright);
}

.chip-glow { box-shadow: 0 0 16px rgba(139, 92, 246, 0.25); }
.chip-role { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.1em; }

.badge {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge-on { background: rgba(52, 211, 153, 0.12); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-off { background: rgba(255, 255, 255, 0.05); color: var(--muted); border: 1px solid var(--border-soft); }
.badge-na { color: #55536e; border: 1px solid transparent; }

/* --- Code window --- */

.code-window {
  background: #0c0c14;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 40px rgba(139, 92, 246, 0.12);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
}
.code-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2c2b3d; }
.code-bar i:first-child { background: rgba(248, 113, 113, 0.55); }
.code-bar i:nth-child(2) { background: rgba(250, 204, 21, 0.5); }
.code-bar i:nth-child(3) { background: rgba(52, 211, 153, 0.5); }
.code-bar span { margin-left: 0.5rem; color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }

.code-window pre {
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
}
.code-window code { background: none; border: none; padding: 0; font-size: inherit; }
.code-window .c { color: #5c5a78; }
.code-window .k { color: var(--purple-bright); }
.code-window .s { color: #b4e8c8; }
.code-window .v { color: #e0aaff; }

/* --- Sections, cards, steps --- */

.section { padding: 4rem 0; }

.section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  margin-bottom: 2.6rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.1rem;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: var(--border); }
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--muted); font-size: 0.92rem; }

.card-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  margin-bottom: 0.9rem;
  font-size: 1.1rem;
  color: var(--purple-bright);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.15);
}

.card-link { display: flex; flex-direction: column; gap: 0.3rem; color: var(--text); }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(139, 92, 246, 0.12); color: var(--text); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; }

.step {
  position: relative;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-2);
}
.step h3 { margin: 0.8rem 0 0.4rem; }
.step p { color: var(--muted); font-size: 0.92rem; }

.step-num {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-weight: 700; font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 0 16px var(--purple-glow);
}

.pricing-band {
  text-align: center;
  padding: 3rem 2rem;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface-2);
}
.pricing-band .chip { margin-bottom: 1.1rem; }
.pricing-band h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  text-transform: none; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 0.7rem;
}
.pricing-band p { max-width: 44rem; margin: 0 auto; }

.cta-band {
  text-align: center;
  padding: 3.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 60% 90% at 50% -10%, rgba(139, 92, 246, 0.16), transparent),
    var(--surface-2);
}
.cta-band h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  text-transform: none; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 0.5rem;
}
.cta-band p { margin-bottom: 1.6rem; }

/* --- Dashboard layout --- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.2rem 0 1.4rem;
}

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.breadcrumb span { margin: 0 0.3rem; color: #44425c; }

.panel {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.3rem;
}

.danger-zone { border-color: rgba(248, 113, 113, 0.2); }
.danger-zone h2 { color: var(--red); }

.empty { color: var(--muted); padding: 1rem 0; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.1rem;
}

/* --- Forms --- */

input, select, textarea {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.55rem 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
input::placeholder { color: #55536e; }

.inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 0.8rem; }

.json-editor {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  width: 100%;
  resize: vertical;
  tab-size: 2;
}

/* --- Flag editor (flag-editor.js) --- */

.fe-tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border-soft); }
.fe-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.fe-tab:hover { color: var(--text); }
.fe-tab.active { color: var(--text); border-bottom-color: var(--purple); }

.fe-error { color: #f87171; font-size: 0.85rem; }

.fe-section { display: flex; flex-direction: column; gap: 0.6rem; }
.fe-heading { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.fe-grid { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.fe-field { display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 12rem; }
.fe-label { font-size: 0.76rem; color: var(--muted); }
.fe-field .fe-check { padding: 0.55rem 0; }

.fe-row { display: flex; gap: 0.6rem; align-items: center; }
.fe-row input, .fe-row select { flex: 1 1 8rem; min-width: 0; }
.fe-row .fe-remove { flex: 0 0 auto; }

.fe-check { display: inline-flex; gap: 0.45rem; align-items: center; cursor: pointer; }
.fe-check input { padding: 0; accent-color: var(--purple); }

.fe-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.fe-card-head { display: flex; justify-content: space-between; align-items: center; }

.fe-rule {
  border: 1px dashed var(--border-soft);
  border-radius: 9px;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fe-mono { font-family: var(--mono); font-size: 0.84rem; }
.fe-invalid { border-color: #f87171 !important; }

.fe-form button.btn { align-self: flex-start; }
.fe-card button.btn, .fe-rule button.btn { align-self: flex-start; }

/* --- Flag history --- */

.history { display: flex; flex-direction: column; gap: 0.35rem; }
.history-entry {
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg-raised);
}
.history-entry summary {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  list-style: none;
}
.history-entry summary::-webkit-details-marker { display: none; }
.history-entry[open] summary { border-bottom: 1px solid var(--border-soft); }
.history-actor { font-size: 0.88rem; color: var(--muted); }
.history-doc {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 0.8rem 0.9rem;
  margin: 0;
  overflow-x: auto;
}
.diff-add { color: rgb(134, 239, 172); background: rgba(134, 239, 172, 0.07); }
.diff-del { color: rgb(252, 165, 165); background: rgba(252, 165, 165, 0.07); }
.diff-ctx { color: var(--muted); }
.history-entry form { padding: 0 0.9rem 0.8rem; }

/* --- Tables --- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}
.table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(139, 92, 246, 0.03); }

.flag-link { font-family: var(--mono); font-size: 0.9rem; font-weight: 600; }

/* --- Environments --- */

.env-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--purple-bright);
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 600;
}
.env-pill form { display: flex; }

.x-btn {
  background: none; border: none; cursor: pointer;
  color: #55536e; font-size: 1rem; line-height: 1; padding: 0 0.2rem;
}
.x-btn:hover { color: var(--red); }

.env-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.3rem;
}

.env-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}
.env-card-head h3 { font-family: var(--mono); font-size: 0.95rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin-bottom: 1rem; font-size: 0.88rem; }
.kv dt { color: var(--muted); }

/* --- Alerts, tokens --- */

.alert {
  margin-top: 1.2rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}
.alert-err { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; }
.alert-ok { background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.25); color: var(--green); }

.token-reveal {
  margin: 1.3rem 0;
  padding: 1.2rem 1.4rem;
  border-radius: 14px;
  border: 1px solid var(--purple);
  background: rgba(139, 92, 246, 0.07);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
}
.token-reveal h3 { font-size: 0.95rem; margin-bottom: 0.7rem; }
.token {
  display: block;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  user-select: all;
}

/* --- Groups & audit --- */

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}
.group-head h2 { margin-bottom: 0; }

.group-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1.2rem 0 0.5rem;
}

.mono-cell { font-family: var(--mono); font-size: 0.82rem; white-space: nowrap; }

/* --- Auth --- */

.auth-wrap { display: grid; place-items: center; min-height: 60vh; }
.auth-card { width: min(430px, 100%); padding: 2.2rem; }
.auth-card h1 { margin-bottom: 0.4rem; }
.auth-card p { margin-bottom: 1.2rem; }
.auth-card .small { margin: 1.2rem 0 0; }
.auth-card input { width: 100%; }
.auth-card input[name="token"] { font-family: var(--mono); }

.auth-alt { margin-top: 1.3rem; border-top: 1px solid var(--border-soft); padding-top: 1rem; }
.auth-alt summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}
.auth-alt summary:hover { color: var(--purple-bright); }
.auth-alt p { margin: 0.8rem 0; }

/* --- Documentation --- */

.docs-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  margin-top: 2.2rem;
}

.docs-nav {
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.docs-section { display: flex; flex-direction: column; gap: 0.15rem; }

.docs-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.docs-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.32rem 0.7rem;
  border-radius: 8px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.92rem;
}
.docs-link:hover { color: var(--text); background: var(--surface-2); }
.docs-link.active {
  color: var(--purple-bright);
  background: var(--surface);
  border-left-color: var(--purple);
}
.docs-link.soon { cursor: default; }
.docs-link.soon:hover { color: var(--muted); background: none; }
.docs-link.soon em {
  font-style: normal;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #55536e;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.docs-article { max-width: 760px; padding-bottom: 3rem; }
.docs-article h1 { margin-bottom: 0.8rem; }
.docs-article h2 {
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 1.35rem;
  color: var(--text);
  margin: 2.4rem 0 0.7rem;
  padding-top: 0.5rem;
}
.docs-article p { margin-bottom: 0.9rem; }
.docs-article ul { margin: 0 0 1rem 1.2rem; }
.docs-article li { margin-bottom: 0.45rem; }
.docs-lede { color: var(--muted); font-size: 1.05rem; }
.docs-lede em { color: var(--purple-bright); font-style: normal; }

.docs-code {
  background: #0c0c14;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 0.8rem 0 1.2rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
}
.docs-code code { background: none; border: none; padding: 0; font-size: inherit; }
.docs-code .c { color: #5c5a78; }
.docs-code .k { color: var(--purple-bright); }
.docs-code .s { color: #b4e8c8; }
.docs-code .v { color: #e0aaff; }

.docs-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0 1.2rem; }
.docs-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
  font-size: 0.92rem;
}
.docs-table td:first-child { white-space: nowrap; }
.docs-table tr:last-child td { border-bottom: none; }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.85rem 1.1rem;
  margin: 1rem 0 1.4rem;
  font-size: 0.92rem;
}

.callout-warn { border-left-color: var(--red); }
.chip-ok { background: rgba(52, 211, 153, 0.14); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.3); }

/* Account / MFA */
.account-card { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.6rem; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.mfa-enroll { display: flex; gap: 1.6rem; flex-wrap: wrap; align-items: flex-start; margin-top: 1rem; }
.mfa-qr {
  border-radius: 10px;
  background: #fff;      /* QR needs a light quiet zone to scan reliably */
  padding: 8px;
  flex: 0 0 auto;
}
.mfa-manual { display: flex; flex-direction: column; gap: 0.6rem; min-width: 240px; flex: 1; }
.mfa-secret {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  word-break: break-all;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}
.recovery-codes {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.recovery-codes code {
  font-size: 1.02rem;
  letter-spacing: 0.08em;
}

.docs-sdk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}
.docs-sdk-grid .card { padding: 1.1rem 1.2rem; }
.card-soon { opacity: 0.55; }

@media (max-width: 880px) {
  .docs-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 1.5rem; }
}

/* --- Footer --- */

.footer { border-top: 1px solid var(--border-soft); padding: 1.6rem 0; margin-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.88rem; }

@media (max-width: 880px) {
  .proto-split { grid-template-columns: 1fr; }
  .globe-wrap { width: 480px; height: 480px; top: 0; }
  .hero-copy { padding-top: 150px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
