/* BluFox OS design tokens. Dark is the default; [data-theme="light"] swaps the neutrals.
   Values follow jarvis-hq/renderer/style.css (BluBeds palette) plus the app's accent tokens. */
@font-face { font-family: "Space Grotesk"; src: url("/app/renderer/brand/fonts/SpaceGrotesk-latin-variable.woff2") format("woff2"); font-weight: 300 700; }
@font-face { font-family: "Inter"; src: url("/app/renderer/brand/fonts/Inter-latin-variable.woff2") format("woff2"); font-weight: 100 900; }

:root {
  --bg: #020817; --surface: #0f172a; --surface-2: #1e293b; --hover: #334155;
  --hairline: #2b3b55; --hairline-strong: #3b4b66;
  --text: #f8fafc; --text-2: #cbd5e1; --muted: #94a3b8;
  --selected: #0b2a3d; --screen: #050b1c;

  --brand: #1fadff; --on-brand: #020817; --violet: #7c6cff; --mint: #34d399;
  --coral: #fb7185; --amber: #fbbf24; --cyan: #22d3ee; --ok: #4ade80;
  --claude: #d97757; --codex: #10a37f;

  /* text-safe accent inks (pass 4.5:1 on their own theme's surface) */
  --brand-ink: #7dd3fc; --violet-ink: #a78bfa; --mint-ink: #34d399;
  --coral-ink: #fb7185; --amber-ink: #fbbf24; --cyan-ink: #22d3ee;

  --tint-a: 18%;   /* accent tint strength on panels */
  --glow-a: 40%;

  --display: "Space Grotesk", "Segoe UI Variable Display", sans-serif;
  --body: Inter, "Segoe UI", system-ui, sans-serif;
  --code: "Cascadia Code", Consolas, "JetBrains Mono", monospace;

  --r-s: 8px; --r: 12px; --r-l: 16px;
  --rail-w: 64px; --side-w: 300px; --top-h: 48px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f7fb; --surface: #ffffff; --surface-2: #eef2f7; --hover: #e2e8f0;
  --hairline: #e2e8f0; --hairline-strong: #cbd5e1;
  --text: #0b1220; --text-2: #334155; --muted: #5b6b80;
  --selected: #e0f2fe; --screen: #0b1220;
  --brand-ink: #0369a1; --violet-ink: #5b4bdb; --mint-ink: #047857;
  --coral-ink: #be123c; --amber-ink: #b45309; --cyan-ink: #0e7490;
  --tint-a: 14%; --glow-a: 22%;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- app frame ---------- */
.app { display: flex; width: 1440px; height: 900px; margin: 0 auto; overflow: hidden; background: var(--bg); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top-h); flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--hairline); }
.top b { font-weight: 600; font-size: 13px; }
.top .sub { color: var(--muted); font-size: 13px; flex: 1; }
.search { display: flex; align-items: center; gap: 8px; height: 30px; width: 280px; padding: 0 10px; border-radius: var(--r-s); background: var(--surface); border: 1px solid var(--hairline); color: var(--muted); font-size: 13px; }
.search kbd { margin-left: auto; font: 500 11px var(--body); }
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); display: inline-block; flex-shrink: 0; }

/* ---------- rail ---------- */
.rail { width: var(--rail-w); flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px; background: var(--surface); border-right: 1px solid var(--hairline); }
.rail .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--violet)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.rail .new { width: 40px; height: 32px; border-radius: 10px; display: grid; place-items: center; border: 1px dashed color-mix(in srgb, var(--brand) 55%, transparent); color: var(--brand-ink); }
.rail hr { width: 24px; border: 0; border-top: 1px solid var(--hairline); margin: 2px 0; }
.rail a { position: relative; width: 44px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); text-decoration: none; }
.rail a:hover { background: var(--surface-2); color: var(--text); }
.rail a.on { background: color-mix(in srgb, var(--brand) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 50%, transparent); color: var(--brand); }
.rail a .badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--amber); color: #2a1c00; font: 700 9px/16px var(--body); text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.rail a[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 52px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font: 600 12px var(--body); z-index: 5; }
.rail .crew { margin-top: auto; width: 44px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0; border-radius: 14px; background: var(--bg); }
.rail .crew span { font: 600 10px var(--body); color: var(--muted); }
.rail svg { width: 20px; height: 20px; }

/* ---------- shared atoms ---------- */
.av { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font: 700 10px var(--display); flex-shrink: 0; }
.av.lg { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.av.ring { outline: 2px solid var(--ok); outline-offset: 2px; }
.av.ring.wait { outline-color: var(--amber); }
.av.human { border-radius: 99px; background: linear-gradient(160deg, #f8fafc, #cbd5e1); color: #020817; }
.c-blue { background: var(--brand); color: #020817; } .c-violet { background: var(--violet); color: #0b0820; }
.c-mint { background: var(--mint); color: #03241a; } .c-coral { background: var(--coral); color: #2a0710; }
.c-amber { background: var(--amber); color: #2a1c00; } .c-cyan { background: var(--cyan); color: #04232a; }
.mark { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.label { font: 600 11px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.h-display { font: 700 36px/1.05 var(--display); letter-spacing: -.03em; }
.h-title { font: 700 28px/1.1 var(--display); letter-spacing: -.02em; }
.h-sec { font: 600 16px/1.3 var(--display); }
.muted { color: var(--muted); } .t2 { color: var(--text-2); }
.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--r-s); font-weight: 600; font-size: 13px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.ghost { background: var(--surface-2); color: var(--text); font-weight: 500; }
.btn.link { color: var(--brand-ink); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font: 600 12px var(--body); }
.tag { font: 600 10px var(--body); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--hairline); }
.tabs span { padding: 5px 12px; border-radius: 7px; font: 500 12px var(--body); color: var(--muted); cursor: pointer; }
.tabs span.on { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* accent helpers: set --a on any element */
.tint { background: linear-gradient(160deg, color-mix(in srgb, var(--a) var(--tint-a), var(--surface)) 0%, var(--surface) 75%); border-color: color-mix(in srgb, var(--a) 38%, var(--hairline)); }
.edge { box-shadow: inset 3px 0 0 var(--a); }
.glow { box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--a) var(--glow-a), transparent); }
.ink { color: color-mix(in srgb, var(--a) 70%, var(--text)); }
.a-blue { --a: var(--brand); } .a-violet { --a: var(--violet); } .a-mint { --a: var(--mint); }
.a-coral { --a: var(--coral); } .a-amber { --a: var(--amber); } .a-cyan { --a: var(--cyan); }

/* ---------- theme switch (design-review helper, not app UI) ---------- */
.theme-switch { zoom: .75; position: fixed; right: 10px; bottom: 10px; opacity: .55; transition: opacity 160ms ease-out; z-index: 50; display: flex; gap: 6px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--hairline-strong); box-shadow: 0 8px 24px rgb(2 8 23 / .3); font: 600 11px var(--body); padding: 3px; }
.theme-switch button { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.theme-switch button.on { background: var(--brand); color: var(--on-brand); }
.theme-switch a { padding: 6px 10px; color: var(--text-2); text-decoration: none; }

/* ---------- avatar + motion ---------- */
.rail .logo { overflow: hidden; padding: 0; }
.rail .logo-av { width: 40px; height: 40px; object-fit: cover; }
canvas[data-fox] { display: block; }
.wave { display: flex; align-items: center; gap: 3px; height: 28px; }
.wave i { width: 3px; height: 100%; border-radius: 2px; background: linear-gradient(180deg, var(--brand), var(--violet)); transform: scaleY(.12); transform-origin: center; transition: transform 90ms ease-out; }
.live-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.ln { animation: ln-in 220ms ease-out both; }
@keyframes ln-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lift { transition: transform 180ms ease-out, box-shadow 180ms ease-out, border-color 180ms ease-out; }
.lift:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--a, var(--brand)) 55%, var(--hairline)); }
[data-tilt] { transition: transform 160ms ease-out; transform-style: preserve-3d; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.av.critter { background-size: 135% auto; background-position: 50% 38%; background-repeat: no-repeat; color: transparent; text-indent: -999px; overflow: hidden; }
[hidden] { display: none !important; }
.rail .world-btn { color: var(--cyan-ink); background: color-mix(in srgb, var(--cyan) 12%, transparent); }
.rail .world-btn:hover { background: color-mix(in srgb, var(--cyan) 22%, transparent); color: var(--text); }
.theme-switch:hover, .theme-switch:focus-within { opacity: 1; }
