/* helicopter app shell: the signed-in pages (Home, Agents, API keys, Settings, one agent).
   Pages link /brand.css then /app.css, then their own file. app.js builds the sidebar, the phone top bar + sheet,
   the command palette and the toasts; this file also holds the shared parts every app page uses (ax-*).
   Components come from the approved kit (docs/landing-next/kit.html: app-sidebar, command-palette, api-keys table,
   agent-header-tabs). Colour: green = working/live, amber = needs you. Nothing else is coloured.
   The brand tokens are set again on body.ax: older page files redefine --bg/--text on :root. */

body.ax {
  --bg: #050706; --card: #0a0d0c; --card2: #111514; --raised: #151a18;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.12); --line3: rgba(255,255,255,.18);
  --text: #eef1ef; --muted: #8f9893; --faint: #6b746f; --ghost: #3a413d;
  --green: #7ae35f; --amber: #e0ad4f; --red: #e2665f;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ax-side: 232px;
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; color-scheme: dark;
}
body.ax *, body.ax *::before, body.ax *::after { box-sizing: border-box; }
body.ax.ax-lock { overflow: hidden; }

/* icons (sprite from app.js) */
.ax-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ax-i.s { width: 14px; height: 14px; }
.ax-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.ax-muted { color: var(--muted); } .ax-faint { color: var(--faint); }
.ax-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; font: 500 11px/1.4 var(--mono); color: var(--muted);
  border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
.ax-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.ax-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(122,227,95,.12); }
.ax-dot.warn { background: var(--amber); }
.ax-dot.off { background: transparent; border: 1.5px solid var(--faint); }
.ax-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout */
.ax-side { position: fixed; top: 0; left: 0; bottom: 0; width: var(--ax-side); z-index: 30; display: flex; flex-direction: column;
  padding: 14px 10px 10px; background: #080b0a; border-right: 1px solid var(--line); overflow-y: auto; }
.ax-main { margin-left: var(--ax-side); min-width: 0; min-height: 100vh; }
.ax-content { max-width: 1160px; margin: 0 auto; padding: 32px 40px 64px; }
.ax-content.wide { max-width: none; }
.ax-top { display: none; }
.ax-scrim { display: none; }

/* sidebar */
.ax-word { display: inline-flex; align-items: center; gap: 9px; padding: 4px 8px 0; color: var(--text); text-decoration: none; }
.ax-word svg { width: 18px; height: 18px; fill: currentColor; }
.ax-word img { height: 12px; width: auto; display: block; filter: invert(1) brightness(.95); }
.ax-find { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; margin-top: 18px; padding: 0 8px 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(255,255,255,.02); color: var(--faint); font: 13px var(--sans); cursor: pointer; text-align: left; }
.ax-find:hover { border-color: var(--line2); color: var(--muted); }
.ax-find .ax-kbd { margin-left: auto; }
.ax-nav { margin-top: 14px; display: grid; gap: 2px; }
.ax-nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; font: 13.5px var(--sans);
  color: var(--muted); text-decoration: none; }
.ax-nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.ax-nav a.on { background: rgba(255,255,255,.07); color: var(--text); }
.ax-nav a .c { margin-left: auto; font: 11.5px var(--mono); color: var(--faint); }
.ax-nav-h { font: 500 11px var(--sans); color: var(--faint); padding: 16px 10px 4px; }
.ax-nav + .ax-nav-h + .ax-nav { margin-top: 0; }
.ax-foot { margin-top: auto; padding-top: 12px; }
.ax-trial { padding: 10px; font-size: 12px; color: var(--muted); }
.ax-me { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 8px 4px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.ax-me:hover .ax-me-t small { color: var(--muted); }
.ax-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--raised);
  border: 1px solid var(--line2); font: 600 10.5px var(--mono); color: var(--muted); text-transform: uppercase; }
.ax-me-t { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35; }
.ax-me-t b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-me-t small { display: block; color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-menu { position: absolute; left: 10px; right: 10px; bottom: 62px; z-index: 5; padding: 5px; border-radius: 12px; border: 1px solid var(--line2);
  background: #0d1110; box-shadow: 0 20px 50px -16px rgba(0,0,0,.8); }
.ax-menu[hidden] { display: none; }
.ax-menu a, .ax-menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 0;
  background: none; color: var(--muted); font: 13px var(--sans); text-decoration: none; cursor: pointer; text-align: left; }
.ax-menu a:hover, .ax-menu button:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* ---------- page header */
.ax-ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.ax-ph h1 { margin: 0; font: 600 24px/1.15 var(--sans); letter-spacing: -0.025em; }
.ax-ph p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.ax-ph .ax-acts { display: flex; gap: 8px; flex: none; }
.ax-crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.ax-crumb a { color: var(--muted); text-decoration: none; } .ax-crumb a:hover { color: var(--text); }
.ax-crumb .sl { color: var(--ghost); }

/* ---------- buttons */
.ax-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px;
  font: 500 13.5px var(--sans); color: var(--text); border: 1px solid var(--line2); background: rgba(255,255,255,.03); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.ax-btn:hover { background: rgba(255,255,255,.07); border-color: var(--line3); }
.ax-btn:focus-visible, .ax-find:focus-visible, .ax-nav a:focus-visible, .ax-me:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.ax-btn.p { background: var(--text); color: #070908; border-color: var(--text); } .ax-btn.p:hover { background: #fff; }
.ax-btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.ax-btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.ax-btn.ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }
.ax-btn.icon { width: 36px; padding: 0; } .ax-btn.sm.icon { width: 30px; }
.ax-btn.danger { color: var(--red); }
.ax-btn:disabled { opacity: .45; cursor: default; }

/* ---------- surfaces */
.ax-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: inset 0 -20px 80px -20px rgba(255,255,255,.04); }
.ax-card.pad { padding: 20px; }
.ax-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ax-card-h h2, .ax-card-h h3 { margin: 0; font: 600 14.5px var(--sans); letter-spacing: -0.01em; }
.ax-sec { margin-top: 32px; }
.ax-sec > h2 { margin: 0 0 12px; font: 600 15px var(--sans); letter-spacing: -0.01em; }

/* tabs (kit agent-header-tabs) */
.ax-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ax-tabs::-webkit-scrollbar { display: none; }
.ax-tabs a, .ax-tabs button { position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 10px 12px; border: 0; background: none;
  font: 13.5px var(--sans); color: var(--muted); text-decoration: none; white-space: nowrap; cursor: pointer; }
.ax-tabs a:hover, .ax-tabs button:hover { color: var(--text); }
.ax-tabs .on { color: var(--text); }
.ax-tabs .on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 1.5px; background: var(--text); }
.ax-tabs .n { font: 11px var(--mono); color: var(--faint); }

/* inline banner: amber = needs you */
.ax-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 12px; border: 1px solid rgba(224,173,79,.28);
  background: rgba(224,173,79,.06); font-size: 13.5px; color: var(--text); }
.ax-banner > .ax-dot { margin-top: 0; }
.ax-banner .t { flex: 1; min-width: 0; }
.ax-banner .t small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.ax-banner .ax-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ax-banner + .ax-banner { margin-top: 10px; }

/* table (kit api-keys) */
.ax-tw { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; background: var(--card); }
table.ax-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.ax-table th { text-align: left; font: 500 12px var(--sans); color: var(--faint); padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015); white-space: nowrap; }
table.ax-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
table.ax-table tr:last-child td { border-bottom: 0; }
table.ax-table tbody tr { transition: background .12s; } table.ax-table tbody tr:hover { background: rgba(255,255,255,.02); }
table.ax-table td.nm { color: var(--text); font-weight: 500; }
table.ax-table td.r { text-align: right; }

/* empty state: one line + one action, no illustration */
.ax-empty { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 20px; border: 1px dashed var(--line2);
  border-radius: 12px; color: var(--muted); font-size: 13.5px; }
.ax-empty .ax-btn { flex: none; }

/* toast */
.ax-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.ax-toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: #0d1110; color: var(--text); font-size: 13px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.8); pointer-events: auto;
  opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.ax-toast.in { opacity: 1; transform: none; }

/* ---------- command palette (kit command-palette) */
.ax-pal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(2,3,3,.62); display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; }
.ax-pal-bg[hidden] { display: none; }
.ax-pal { width: 100%; max-width: 560px; border-radius: 14px; border: 1px solid var(--line2); background: #0d1110; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.5); display: flex; flex-direction: column; max-height: 72vh; }
.ax-pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.ax-pal-in input { flex: 1; min-width: 0; height: 50px; border: 0; outline: 0; background: none; color: var(--text); font: 15px var(--sans); }
button.ax-kbd { background: none; cursor: pointer; }
.ax-pal-in input::placeholder { color: var(--faint); }
.ax-pal-list { overflow-y: auto; padding: 0 0 6px; }
.ax-pal-g { padding: 6px 6px 0; }
.ax-pal-g + .ax-pal-g { border-top: 1px solid var(--line); margin-top: 6px; }
.ax-pal-g h6 { margin: 6px 10px 4px; font: 500 11.5px var(--sans); color: var(--faint); }
.ax-pi { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.ax-pi.on { background: rgba(255,255,255,.06); color: var(--text); }
.ax-pi > .ax-dot { margin: 0 3.5px; }
.ax-pi .m { font-family: var(--mono); color: var(--text); flex: none; }
.ax-pi .s { color: var(--muted); font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-pi .r { margin-left: auto; display: flex; gap: 8px; align-items: center; font: 11.5px var(--mono); color: var(--faint); flex: none; }
.ax-pal-none { padding: 18px 16px; color: var(--faint); font-size: 13px; }
.ax-pal-f { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); }
.ax-pal-f span { display: inline-flex; gap: 6px; align-items: center; }
.ax-pal-f .end { margin-left: auto; }

/* ---------- phones: top bar + sheet */
@media (max-width: 860px) {
  .ax-main { margin-left: 0; }
  .ax-content { padding: 20px 16px 48px; }
  .ax-top { display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 20; height: 52px; padding: 0 8px 0 16px;
    background: rgba(5,7,6,.92); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .ax-top .ax-word { padding: 0; }
  .ax-top .t { flex: 1; min-width: 0; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); font-size: 13.5px; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ax-top .ax-btn.icon { width: 40px; height: 40px; }
  .ax-side { width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease, visibility .22s; visibility: hidden; }
  .ax-side.open { transform: none; visibility: visible; box-shadow: 20px 0 60px -20px rgba(0,0,0,.8); }
  .ax-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(2,3,3,.6); }
  .ax-scrim.open { display: block; }
  .ax-nav a { height: 40px; font-size: 14.5px; }
  .ax-ph { flex-direction: column; align-items: stretch; margin-bottom: 18px; }
  .ax-ph h1 { font-size: 21px; }
  .ax-ph .ax-acts { flex-wrap: wrap; }
  .ax-banner { flex-wrap: wrap; }
  .ax-banner .ax-acts { width: 100%; justify-content: flex-start; padding-left: 19px; }
  .ax-empty { flex-direction: column; align-items: flex-start; }
  .ax-toasts { left: 16px; right: 16px; bottom: 16px; justify-items: stretch; }
  .ax-toast { max-width: none; }
  .ax-pal-bg { padding: 10px 10px; }
  .ax-pal { max-height: calc(100vh - 20px); }
  .ax-pal-f { display: none; }
  .ax-pi { height: 42px; }
}
@media (max-width: 360px) {
  .ax-top .t { display: none; }
  .ax-top .ax-word { margin-right: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ax-side, .ax-toast { transition: none; }
}

@media (max-width: 650px) {
  .ax-side .ax-nav a, .ax-btn, .ax-btn.sm, .ax-btn.sm.icon { min-height: 44px; }
  .ax-btn.icon, .ax-btn.sm.icon { min-width: 44px; }
}
