/* ══════════════════════════════════════════════════════════════════════════
   XYAPIS SHARED SHELL — one nav, one palette, every page
   ══════════════════════════════════════════════════════════════════════════
   WHY THIS FILE EXISTS. The API surface is six pages (dashboard, docs, explorer,
   account, status, landing) and each grew its own chrome. Two of them —
   account.html and status.html — shipped with NO navigation at all, so a visitor
   who arrived from an email or a status link could not reach their keys, the docs
   or the dashboard without editing the URL. That is the bug this fixes.

   THE PALETTE IS COPIED, NOT INVENTED. dashboard.html and api-docs.html already
   declared an identical :root block; this keeps their exact values so adopting
   the shell does not restyle anything that was already right. Pages opt in by
   loading this file AFTER their own CSS, and the tokens here are the same, so
   there is no cascade fight to lose.
   ══════════════════════════════════════════════════════════════════════════ */

:root{
  --bg:#f8f9fb; --bg2:#fff; --bg3:#f0f1f5; --bg4:#e8e9ef;
  --text:#18181b; --text2:#6b6b80; --text3:#9d9db0;
  --accent:#4f6ef7; --accent2:#3b5de7; --accent-light:rgba(79,110,247,0.08);
  --green:#10b981; --red:#ef4444; --amber:#f59e0b;
  --bd:#e4e4ed; --bd2:#d4d4dd; --code:#0f172a;
  --r:10px; --r2:14px; --shadow:0 1px 3px rgba(0,0,0,0.04);
  --xy-ring:rgba(79,110,247,0.22);
  --xy-elev:0 1px 2px rgba(0,0,0,.05), 0 8px 24px -14px rgba(0,0,0,.28);
  --shell-h:58px;
}
[data-theme="dark"]{
  --bg:#0f0f14; --bg2:#17171f; --bg3:#1e1e28; --bg4:#262631;
  --text:#f2f2f5; --text2:#a0a0b4; --text3:#6e6e82;
  --accent:#6b86ff; --accent2:#4f6ef7; --accent-light:rgba(107,134,255,0.14);
  --bd:#2a2a36; --bd2:#37374a;
  --shadow:0 1px 3px rgba(0,0,0,0.4);
  --xy-ring:rgba(107,134,255,0.28);
  --xy-elev:0 1px 2px rgba(0,0,0,.5), 0 10px 30px -16px rgba(0,0,0,.9);
}

/* ── THE TOP BAR ────────────────────────────────────────────────────────── */
.xy-shell{
  position:sticky;top:0;z-index:900;
  height:var(--shell-h);
  display:flex;align-items:center;gap:6px;
  padding:0 16px;
  background:color-mix(in srgb,var(--bg2) 82%,transparent);
  -webkit-backdrop-filter:saturate(180%) blur(16px);
  backdrop-filter:saturate(180%) blur(16px);
  border-bottom:1px solid color-mix(in srgb,var(--bd) 70%,transparent);
  box-sizing:border-box;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.xy-shell *{box-sizing:border-box}
.xy-brand{
  display:flex;align-items:center;gap:8px;
  font-weight:650;font-size:.92rem;letter-spacing:-.025em;
  color:var(--text);text-decoration:none;white-space:nowrap;
  margin-right:16px;flex-shrink:0;
}
.xy-brand img{width:24px;height:24px;border-radius:7px;box-shadow:var(--xy-elev)}
.xy-brand:hover{text-decoration:none;color:var(--text)}
.xy-brand .xy-brand-sub{
  font-weight:650;font-size:.58rem;letter-spacing:.08em;text-transform:uppercase;
  color:var(--accent);
  padding:3px 7px;border-radius:999px;background:var(--accent-light);
  margin-left:2px;
}
/* The links row scrolls horizontally on narrow screens instead of wrapping into a
   second line that pushes the page down — the bug that made the old sidebar feel
   broken on small viewports. */
.xy-nav{
  display:flex;align-items:center;gap:2px;
  flex:1 1 auto;min-width:0;
  overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;
}
.xy-nav::-webkit-scrollbar{display:none}
.xy-nav a{
  display:flex;align-items:center;
  padding:7px 12px;border-radius:999px;
  font-size:.82rem;font-weight:520;
  color:var(--text2);text-decoration:none;white-space:nowrap;
  transition:background .14s,color .14s;
}
.xy-nav a:hover{background:var(--bg3);color:var(--text);text-decoration:none}
.xy-nav a[aria-current="page"]{background:var(--accent-light);color:var(--accent);font-weight:640}
.xy-nav a.xy-ext::after{content:"↗";font-size:.7em;margin-left:4px;opacity:.55}

.xy-actions{display:flex;align-items:center;gap:6px;flex-shrink:0;margin-left:auto}
.xy-btn{
  display:inline-flex;align-items:center;justify-content:center;
  height:34px;padding:0 14px;border-radius:9px;
  font-size:.8rem;font-weight:620;letter-spacing:-.005em;text-decoration:none;
  border:1px solid transparent;cursor:pointer;
  transition:background .14s,border-color .14s,color .14s,transform .14s,box-shadow .14s;
  white-space:nowrap;
}
.xy-btn-primary{
  background:linear-gradient(180deg,
    color-mix(in srgb,var(--accent) 92%,#fff), var(--accent));
  color:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.14);
}
.xy-btn-primary:hover{
  background:var(--accent2);text-decoration:none;color:#fff;
  transform:translateY(-1px);
  box-shadow:0 4px 12px -3px color-mix(in srgb,var(--accent) 55%,transparent);
}
.xy-btn-ghost{background:transparent;color:var(--text2);border-color:var(--bd)}
.xy-btn-ghost:hover{background:var(--bg3);color:var(--text);text-decoration:none}
.xy-icon-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;border-radius:9px;
  background:transparent;border:1px solid var(--bd);
  color:var(--text2);cursor:pointer;padding:0;
  transition:background .14s,color .14s;
}
.xy-icon-btn:hover{background:var(--bg3);color:var(--text)}
.xy-nav a:focus-visible,.xy-btn:focus-visible,.xy-icon-btn:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px;
}

/* ── MOBILE: keep the bar one line, hide what does not fit ──────────────── */
@media(max-width:760px){
  .xy-shell{padding:0 12px;gap:4px}
  .xy-brand{margin-right:6px}
  .xy-brand .xy-brand-sub{display:none}
  .xy-nav a{padding:7px 9px;font-size:.78rem}
  /* The one action that always survives a narrow bar: getting started. */
  .xy-actions .xy-btn-ghost{display:none}
}
@media(max-width:480px){
  .xy-brand span{display:none}          /* icon only */
  .xy-brand img{width:24px;height:24px}
  .xy-actions .xy-btn-primary{padding:7px 10px;font-size:.75rem}
}

/* Pages using the shell reserve room so content is never hidden under it. */
body.xy-has-shell>.xy-shell{margin-bottom:0}

/* ── ONE TOGGLE PER PAGE ────────────────────────────────────────────────────
   dashboard.html already carries a theme toggle in its sidebar, beside Sign Out,
   and api-docs.html used to carry its own. Showing the shell's toggle as well would
   give a page two controls for one setting. The page that owns one says so with
   `data-xy-own-theme` on <body> and the shell drops its own; the sidebar's stays
   authoritative because it is where the user already found it. */
body[data-xy-own-theme] .xy-actions .xy-icon-btn{display:none}
