/* Shared styles for Adionexus secondary pages (auth, docs, legal). */
:root {
  --navy-950: #070B16;
  --navy-900: #0B1120;
  --navy-850: #101828;
  --line-dark: rgba(255, 255, 255, 0.08);
  --line-dark-strong: rgba(255, 255, 255, 0.14);
  --text-on-dark: #E6EAF2;
  --muted-on-dark: #94A0B8;
  --accent-on-dark: #7C9DFF;

  --ink: #0E1525;
  --ink-2: #2B3447;
  --muted: #5E687C;
  --subtle: #8B94A7;
  --line: #E5E8EE;
  --line-soft: #EEF0F4;
  --bg: #FFFFFF;
  --bg-soft: #F6F7FA;

  --accent: #3A68F5;
  --accent-hover: #2D57DB;
  --accent-soft: #EDF2FF;
  --green: #15803D;
  --green-soft: #E8F6EC;
  --amber: #B45309;
  --amber-soft: #FDF3E3;
  --red: #C2410C;
  --red-soft: #FDEEE8;

  --shadow-sm: 0 1px 2px rgba(14, 21, 37, 0.06);
  --shadow: 0 1px 2px rgba(14, 21, 37, 0.05), 0 8px 24px -8px rgba(14, 21, 37, 0.10);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 420px) { .container { padding: 0 16px; } }

/* Fill-in markers for facts only the operator can supply. Remove once filled. */
.todo { background: #FFF4CC; color: #7A5600; border-radius: 3px; padding: 0 4px; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(14,21,37,.2), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--bg-soft); border-color: #CDD2DC; }
.btn-text-dark { color: var(--muted-on-dark); padding: 0 10px; }
.btn-text-dark:hover { color: #fff; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--nav-h); background: var(--navy-900); border-bottom: 1px solid var(--line-dark); }
.topbar .container { height: 100%; display: flex; align-items: center; gap: 32px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: #fff; color: var(--navy-900); display: grid; place-items: center; }
.logo-mark svg { width: 16px; height: 16px; }
.logo.on-light { color: var(--ink); }
.logo.on-light .logo-mark { background: var(--navy-900); color: #fff; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { font-size: 14px; color: var(--muted-on-dark); padding: 6px 12px; border-radius: 6px; transition: color .15s, background-color .15s; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.05); }
.topbar .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
@media (max-width: 760px) { .topbar nav { display: none; } .topbar .actions .btn-text-dark { display: none; } }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside {
  position: relative; overflow: hidden; background: var(--navy-900); color: var(--text-on-dark);
  padding: 40px 56px; display: flex; flex-direction: column;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 60%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 60%, #000 20%, transparent 75%);
}
.auth-aside > * { position: relative; }
.auth-aside-body { margin: auto 0; max-width: 440px; }
.auth-aside h2 { color: #fff; font-size: 28px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 600; }
.auth-aside p { margin-top: 14px; color: var(--muted-on-dark); font-size: 15.5px; }
.auth-events { margin-top: 32px; border: 1px solid var(--line-dark-strong); border-radius: 10px; background: var(--navy-850); overflow: hidden; }
.auth-events div { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-dark); font-size: 12px; }
.auth-events div:last-child { border-bottom: 0; }
.auth-events span { font-family: var(--mono); color: #6B7790; font-size: 11px; }
.auth-events code { color: #fff; font-size: 12px; }
.auth-events b { font-family: var(--mono); font-weight: 500; color: #86EFAC; font-size: 11px; }
.auth-aside-foot { font-size: 13px; color: var(--muted-on-dark); }

.auth-main { display: flex; flex-direction: column; padding: 32px 24px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.auth-top a.link { color: var(--accent); font-weight: 500; }
.auth-top > span { margin-left: auto; }
.auth-top .logo { display: none; }
.auth-card { width: 100%; max-width: 400px; margin: auto; padding: 40px 0; }
.auth-card h1 { font-size: 26px; letter-spacing: -0.025em; font-weight: 600; line-height: 1.2; }
.auth-card .lead { margin-top: 8px; color: var(--muted); font-size: 15px; }
.oauth { margin-top: 28px; display: grid; gap: 10px; }
.oauth .btn { height: 44px; gap: 10px; }
.oauth svg { width: 18px; height: 18px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; font-size: 12.5px; color: var(--subtle); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); display: flex; justify-content: space-between; }
.field label a { color: var(--accent); font-weight: 500; }
.field input, .field select {
  height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 14.5px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(58,104,245,.15); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field .hint { font-size: 12.5px; color: var(--subtle); }
.field .error { font-size: 12.5px; color: var(--red); display: none; }
.field input[aria-invalid="true"] ~ .error { display: block; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); margin: 4px 0 20px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line); }
.form-alert { display: none; margin-bottom: 16px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; background: var(--red-soft); color: var(--red); }
.form-alert.is-shown { display: block; }
.auth-legal { margin-top: 24px; font-size: 12.5px; color: var(--subtle); line-height: 1.55; }
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-top .logo { display: inline-flex; }
}

/* ---------- Document pages (docs, legal) ---------- */
.doc-hero { background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); padding: 56px 0 40px; }
.eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.doc-hero h1 { margin-top: 10px; font-size: clamp(30px, 4vw, 40px); letter-spacing: -0.03em; line-height: 1.15; font-weight: 600; }
.doc-hero p { margin-top: 12px; color: var(--muted); font-size: 16.5px; max-width: 640px; }
.doc-hero .meta { margin-top: 18px; font-size: 13px; color: var(--subtle); font-family: var(--mono); }

.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding: 48px 24px 96px; }
.toc { position: sticky; top: calc(var(--nav-h) + 32px); align-self: start; font-size: 13.5px; }
.toc h2 { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); font-weight: 600; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; color: var(--muted); border-left: 1px solid transparent; transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }

.prose { max-width: 720px; color: var(--ink-2); font-size: 15.5px; }
.prose section { scroll-margin-top: calc(var(--nav-h) + 24px); }
.prose section + section { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line-soft); }
.prose h2 { font-size: 22px; letter-spacing: -0.02em; font-weight: 600; color: var(--ink); line-height: 1.3; }
.prose h3 { margin-top: 28px; font-size: 16.5px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.prose p { margin-top: 14px; }
.prose ul, .prose ol { margin: 14px 0 0; padding-left: 22px; }
.prose li { margin-top: 6px; }
.prose li::marker { color: var(--subtle); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(58,104,245,.35); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose :not(pre) > code { font-size: 13px; background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 5px; color: var(--ink); }
.prose pre {
  margin: 16px 0 0; padding: 18px 20px; border-radius: 10px; background: var(--navy-950); color: #C9D1E3;
  font-size: 13px; line-height: 1.7; overflow-x: auto; border: 1px solid var(--navy-900);
}
.prose pre .k { color: #93B4FF; } .prose pre .s { color: #A5E3B8; } .prose pre .n { color: #F5C38B; }
.prose pre .m { color: #FF9F7A; font-weight: 500; } .prose pre .c { color: #5F6B85; }
.prose table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.prose th { text-align: left; font-weight: 600; color: var(--ink); font-size: 12.5px; padding: 10px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.prose td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.prose td code { white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 16px; }
.table-wrap table { margin: 0; }
.callout { margin-top: 18px; padding: 14px 16px; border-radius: 8px; background: var(--accent-soft); color: var(--ink-2); font-size: 14.5px; border: 1px solid #DCE5FF; }
.callout strong { color: var(--ink); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; }
  .toc { display: none; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); color: var(--muted-on-dark); font-size: 13.5px; padding: 32px 0; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 16px 32px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a:hover { color: #fff; }

/* ---------- Auth additions ---------- */
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.form-alert { margin: 20px 0 0; }
.form-alert.is-info { background: var(--green-soft); color: var(--green); }
.auth-card form .form-alert { margin: 0 0 16px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn[aria-busy="true"] { cursor: progress; }

/* ---------- App (signed-in) ---------- */
.app-loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-shell[hidden], .app-loading[hidden] { display: none; }
.ws-name { color: var(--muted-on-dark); font-size: 14px; padding-left: 20px; border-left: 1px solid var(--line-dark-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text-on-dark); font-size: 14px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.btn-ghost-dark { color: var(--text-on-dark); border-color: var(--line-dark-strong); background: transparent; }
.btn-ghost-dark:hover { background: rgba(255,255,255,.06); }
.app-page { padding: 48px 24px 96px; }
.app-page h1 { font-size: 28px; letter-spacing: -0.025em; font-weight: 600; }
.app-page .lead { margin-top: 6px; color: var(--muted); }
.banner { margin-top: 28px; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--amber-soft); color: #7A4A0B; font-size: 14px; border: 1px solid #F6E2C0; }
.banner strong { color: #5C3606; }
.banner .badge-test { font-family: var(--mono); font-size: 11px; font-weight: 500; background: #fff; border: 1px solid #F0D9B0; border-radius: 4px; padding: 1px 6px; flex: none; margin-top: 1px; }
.cards { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.card header { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); font-weight: 600; font-size: 15px; }
.rows { margin: 0; }
.rows div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.rows div:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; overflow-wrap: anywhere; }
.rows dd code { font-size: 12.5px; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 1px 8px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.steps li:last-child { border-bottom: 0; }
.steps .num { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.steps li.done .num { background: var(--green); border-color: var(--green); color: #fff; }
.steps span.sub { display: block; color: var(--subtle); font-size: 12.5px; }
.steps a.go { color: var(--accent); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.steps button.go { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); font-weight: 500; font-size: 13.5px; }
.app-note { margin-top: 12px; font-size: 13px; color: var(--green); min-height: 1em; }
@media (max-width: 860px) { .cards { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .ws-name, .user-chip .user-name { display: none; }
  .rows div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .app-page { padding: 32px 16px 72px; }
}
