/* Shell extras: bright theme, smart left nav, collapsible right rail, live token feed, profile menu. */
:root { --rail-w-min: 52px; --live-claude: #f59e0b; --live-codex: #22d3ee; }

/* ---------- bright theme ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #e8f3ff; --ink-2: #f4f9ff; --ink-3: #dbeafe;
  --glass: rgba(255,255,255,0.72); --glass-2: rgba(255,255,255,0.92);
  --line: rgba(15,23,42,0.13); --line-2: rgba(0,119,204,0.45);
  --text: #0f172a; --text-2: #1e293b; --muted: #475569; --muted-2: #64748b;
  --blu: #0077cc; --cyan: #0e9bb8; --amber: #b45309; --green: #15803d; --red: #dc2626; --violet: #6d28d9;
  --claude: #b45309; --codex: #0e7490; --live-claude: #b45309; --live-codex: #0e7490;
  --well: rgba(0,90,200,0.05); --well-soft: rgba(0,90,200,0.03); --panel: rgba(255,255,255,0.98); --scrim: rgba(226,232,240,0.7);
  --bf-card: rgba(0,90,200,0.03); --bf-card-line: rgba(15,23,42,0.12);
}
/* Bright mode: surfaces that are translucent white on ink become translucent ink on white. */
:root[data-theme="light"] .role-card, :root[data-theme="light"] .rowi, :root[data-theme="light"] .hire-row select, :root[data-theme="light"] .hire-search, :root[data-theme="light"] .hire-task,
:root[data-theme="light"] .auto-toggle, :root[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), :root[data-theme="light"] textarea { background: rgba(0,90,200,0.04); }
:root[data-theme="light"] .auto-toggle.on { color: var(--blu); background: rgba(0,119,204,0.1); }
:root[data-theme="light"] .auto-toggle.warn.on { color: var(--amber); }
:root[data-theme="light"] .hire-card, :root[data-theme="light"] .ud-card, :root[data-theme="light"] .ls-pop, :root[data-theme="light"] .sysmon, :root[data-theme="light"] .ud-pill, :root[data-theme="light"] .hz-node, :root[data-theme="light"] .orbit-card { box-shadow: 0 18px 50px rgba(15,23,42,0.16); }
:root[data-theme="light"] .lb-preview img { background: repeating-conic-gradient(#e2e8f0 0 25%, #f8fafc 0 50%) 50% / 16px 16px; }
:root[data-theme="light"] .emp-avatar { background: radial-gradient(circle at 50% 35%, rgba(0,119,204,0.16), rgba(0,90,200,0.06)); }
:root[data-theme="light"] .sg-cmds, :root[data-theme="light"] .sg-pre { background: #eef2f8; color: var(--text); }
/* Popovers and backdrops whose styles live inside TS modules. */
:root[data-theme="light"] .ag-run, :root[data-theme="light"] .ci-bulk { background: rgba(255,255,255,0.97); box-shadow: 0 12px 40px rgba(15,23,42,0.16); }
:root[data-theme="light"] .bs-overlay, :root[data-theme="light"] .vp-overlay { background: var(--scrim); }
:root[data-theme="light"] .topbar { background: linear-gradient(180deg, #ffffff, #eef3fa); }
:root[data-theme="light"] .cmdbar { background: rgba(255,255,255,0.92); }
:root[data-theme="light"] .canvas { background: radial-gradient(900px 500px at 70% -10%, rgba(37,99,235,0.10), transparent 60%), var(--ink); }
:root[data-theme="light"] kbd, :root[data-theme="light"] .gsearch, :root[data-theme="light"] .cmd-input { background: rgba(0,90,200,0.04); }
:root[data-theme="light"] .nav-item:hover, :root[data-theme="light"] .topbtn:hover, :root[data-theme="light"] .cmd-input .ibtn:hover { background: rgba(0,90,200,0.06); }
:root[data-theme="light"] .nav-item.active { background: rgba(0,119,204,0.12); }
:root[data-theme="light"] .rail .mini { background: rgba(0,90,200,0.035); }
:root[data-theme="light"] .rail .mini:hover { background: rgba(0,119,204,0.09); }
:root[data-theme="light"] .modal, :root[data-theme="light"] .palette, :root[data-theme="light"] .hire-modal { background: rgba(226,232,240,0.7); }
:root[data-theme="light"] .tooltip, :root[data-theme="light"] .toast, :root[data-theme="light"] .ss-pop { background: rgba(255,255,255,0.97); color: var(--text); box-shadow: 0 8px 28px rgba(15,23,42,0.14); }
:root[data-theme="light"] pre.log, :root[data-theme="light"] .vs-pre, :root[data-theme="light"] .vs-cmds { background: #eef2f8; color: var(--text); }
:root[data-theme="light"] .ministat, :root[data-theme="light"] select.inline, :root[data-theme="light"] .explorer, :root[data-theme="light"] .lb-preview, :root[data-theme="light"] .approval .prompt { background: rgba(0,90,200,0.04); }
:root[data-theme="light"] .boot { background: radial-gradient(900px 600px at 50% 40%, rgba(0,119,204,0.10), transparent 60%), var(--ink); }
:root[data-theme="light"] .g-label { fill: #1e293b; stroke: rgba(255,255,255,0.9); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(71,85,105,0.3); }

/* ---------- left nav: collapse, expand, or smart-expand on hover ---------- */
.shell.collapsed .nav { position: relative; z-index: 25; width: var(--nav-w-collapsed); overflow: hidden; transition: width 0.18s ease 0.12s, box-shadow 0.18s ease 0.12s; }
.shell.collapsed .nav:hover { width: var(--nav-w); box-shadow: 8px 0 28px rgba(0,0,0,0.35); }
:root[data-theme="light"] .shell.collapsed .nav:hover { box-shadow: 8px 0 28px rgba(15,23,42,0.18); }
.shell.collapsed .nav:hover .nav-item { justify-content: flex-start; padding: 9px 11px; }
.shell.collapsed .nav:hover .nav-item span, .shell.collapsed .nav:hover .nav-item em { display: inline; }
.shell.collapsed .nav:hover .nav-foot { display: block; }
/* A collapsed tab with something waiting shows its count as a badge on the icon. */
.shell.collapsed .nav-item em.hot { display: grid; position: absolute; top: 2px; right: 8px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--amber); color: #fff; font-size: 9.5px; font-weight: 700; place-items: center; }
.shell.collapsed .nav:hover .nav-item em.hot { position: static; margin-left: auto; display: inline; min-width: 0; height: auto; padding: 0; background: none; color: var(--amber); font-size: 10px; font-weight: 400; }
.nav-toggle { transition: transform 0.2s; }
.shell.collapsed .nav-toggle svg { transform: none; }
.shell:not(.collapsed) .nav-toggle svg { transform: rotate(180deg); }

/* ---------- right rail: sections + minimised tab strip ---------- */
.shell.rail.rail-min .body { grid-template-columns: var(--nav-w) 1fr var(--rail-w-min); }
.shell.rail.rail-min.collapsed .body { grid-template-columns: var(--nav-w-collapsed) 1fr var(--rail-w-min); }
.rail.rail-host { padding: 0; gap: 0; overflow: hidden; display: flex; flex-direction: column; }
.rail-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px 16px; border-bottom: 1px solid var(--line); }
.rail-title { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.rail-collapse { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); transition: transform 0.2s; }
.rail-collapse:hover { color: var(--text); background: rgba(0, 162, 255, 0.14); }
.rail-sections { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.rail-tabs { display: none; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; }
.rail.min { padding: 0; }
.rail.min .rail-bar { flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rail.min .rail-title, .rail.min .rail-sections { display: none; }
.rail.min .rail-tabs { display: flex; }
.rail-tab { position: relative; width: 38px; min-height: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 10px; color: var(--muted); }
.rail-tab:hover { color: var(--text); background: rgba(0, 162, 255, 0.14); }
.rail-tab em { font-style: normal; font-family: var(--mono); font-size: 9px; font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 8px; background: rgba(0, 162, 255, 0.22); color: var(--text-2); max-width: 46px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-tab.hot { color: var(--amber); }
.rail-tab.hot em { background: var(--amber); color: #fff; animation: railpulse 1.8s ease-in-out infinite; }
@keyframes railpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.55); } 50% { box-shadow: 0 0 0 5px rgba(245,158,11,0); } }
.rsec { border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 162, 255, 0.04); }
.rsec-h { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--blu); text-align: left; }
.rsec-h .ico { transition: transform 0.18s; color: var(--muted); }
.rsec.closed .rsec-h .ico { transform: rotate(-90deg); }
.rsec-h span:not(.ico) { flex: 1; }
.rsec-badge { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: 0; padding: 1px 6px; border-radius: 9px; background: rgba(0, 162, 255, 0.2); color: var(--text-2); }
.rsec-badge.hot { background: var(--amber); color: #fff; }
.rsec-b { padding: 2px 10px 10px; }
.rsec.closed .rsec-b { display: none; }

/* ---------- live tokens (pump.fun-style feed) ---------- */
.live-tokens { display: grid; gap: 8px; }
.lt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.lt-big { display: block; font-family: var(--display); font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.live-tokens.compact .lt-big { font-size: 22px; }
.lt-big.tick { animation: lttick 0.45s ease-out; }
@keyframes lttick { 0% { color: var(--green); transform: translateY(-2px); } 100% { color: var(--text); transform: none; } }
.lt-head small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lt-live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--green); }
.lt-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: ltblink 1.2s ease-in-out infinite; }
.lt-live.idle { color: var(--muted); } .lt-live.idle i { background: var(--muted-2); box-shadow: none; animation: none; }
.lt-live.off { color: var(--red); } .lt-live.off i { background: var(--red); box-shadow: none; animation: none; }
@keyframes ltblink { 50% { opacity: 0.35; } }
.lt-spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.lt-spark i { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; background: rgba(0, 162, 255, 0.25); }
.lt-spark i.on { background: linear-gradient(180deg, var(--blu), var(--cobalt)); }
.lt-spark i:last-child.on { background: var(--green); }
.lt-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; color: var(--muted); }
.lt-stats b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.lt-list { display: grid; gap: 4px; max-height: 420px; overflow-y: auto; }
.live-tokens.compact .lt-list { max-height: 300px; }
.lt-row { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 10px 7px 0; border-radius: 8px; background: rgba(0, 162, 255, 0.06); overflow: hidden; }
.lt-row .lt-dot { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--live-claude); }
.lt-row.codex .lt-dot { background: var(--live-codex); }
.lt-main { min-width: 0; }
.lt-top { display: flex; gap: 8px; align-items: baseline; font-size: 12px; min-width: 0; }
.lt-top b { font-weight: 600; white-space: nowrap; }
.lt-proj { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-bar { height: 4px; margin-top: 5px; border-radius: 3px; background: rgba(0, 162, 255, 0.16); overflow: hidden; }
.lt-bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.lt-bar i.out { background: var(--red); }
.lt-num { text-align: right; line-height: 1.25; }
.lt-num b { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--green); font-variant-numeric: tabular-nums; }
.lt-num small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.lt-row time { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); min-width: 26px; text-align: right; }
.live-tokens.compact .lt-num small { display: none; }
.lt-row.fresh { animation: ltin 1.4s ease-out; }
@keyframes ltin { 0% { transform: translateY(-14px); opacity: 0; background: rgba(34,197,94,0.35); } 25% { transform: none; opacity: 1; } 100% { background: rgba(0, 162, 255, 0.06); } }
.lt-empty { font-size: 12px; margin: 6px 2px; }
.live-panel { margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--glass); }
.live-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.live-title b { font-family: var(--display); font-size: 14px; }
.live-title small { color: var(--muted); font-size: 11.5px; }
@media (prefers-reduced-motion: reduce) { .lt-row.fresh, .lt-big.tick, .rail-tab.hot em, .lt-live i { animation: none; } }
:root[data-motion="reduced"] .lt-row.fresh, :root[data-motion="reduced"] .rail-tab.hot em { animation: none; }

/* ---------- profile menu ---------- */
.topbtn.profile { width: 44px; }
.pf-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 10.5px; color: #fff; background: linear-gradient(135deg, var(--blu), var(--cobalt)); }
.pf-avatar.big { width: 40px; height: 40px; font-size: 14px; }
.profile-pop { position: fixed; z-index: 95; width: 360px; max-height: calc(100vh - 70px); overflow-y: auto; padding: 14px; display: grid; gap: 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--ink-2); color: var(--text); box-shadow: 0 18px 50px rgba(0,0,0,0.45); }
:root[data-theme="light"] .profile-pop { box-shadow: 0 18px 50px rgba(15,23,42,0.2); }
.pf-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.pf-who b { display: block; font-family: var(--display); font-size: 14px; }
.pf-who small { color: var(--muted); font-size: 11.5px; }
.pf-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--text); background: rgba(0, 162, 255, 0.1); }
.pf-btn:hover { border-color: var(--line-2); }
.pf-btn.primary { background: var(--blu); border-color: var(--blu); color: #fff; }
.pf-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.pf-btn.small { padding: 3px 8px; font-size: 11px; margin-left: auto; }
.pf-confirm { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); grid-column: 1 / -1; justify-content: flex-end; }
.pf-logins { display: grid; gap: 4px; }
.pf-login { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.pf-login i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.pf-login i.ok { background: var(--green); } .pf-login i.warn { background: var(--amber); }
.pf-login small { color: var(--muted); }
.pf-month { display: grid; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.pf-total { display: flex; align-items: baseline; gap: 8px; padding-top: 8px; }
.pf-total .ico { align-self: center; color: var(--blu); }
.pf-total b { font-family: var(--display); font-size: 24px; letter-spacing: -0.02em; }
.pf-total span { color: var(--muted); font-size: 12px; }
.pf-total em { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--amber); }
.pf-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: rgba(0, 162, 255, 0.12); }
.pf-tab { flex: 1; padding: 5px 4px; border-radius: 7px; font-size: 11.5px; color: var(--muted); }
.pf-tab.on { background: var(--ink-2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.25); }
.pf-bars { display: grid; gap: 7px; }
.pf-bar { display: grid; grid-template-columns: 112px 1fr 52px; gap: 8px; align-items: center; font-size: 12px; }
.pf-bar .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-bar .b { height: 6px; border-radius: 4px; background: rgba(0, 162, 255, 0.16); overflow: hidden; }
.pf-bar .b i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blu), var(--cobalt)); }
.pf-bar b { text-align: right; font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.pf-days { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.pf-days i { flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: rgba(0, 162, 255, 0.22); }
.pf-days i.on { background: var(--blu); }
.pf-heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 26px; }
.pf-heat i { border-radius: 3px; background: var(--blu); }
.pf-heat-l { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted-2); font-family: var(--mono); margin-top: 3px; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.pf-stat { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.pf-stat b { display: block; font-family: var(--display); font-size: 15px; }
.pf-stat small { color: var(--muted); font-size: 10.5px; }
.pf-empty { font-size: 12px; margin: 4px 0; }
.pf-foot { color: var(--muted-2); font-size: 10.5px; line-height: 1.5; }

/* ---------- fit: the extra top-bar buttons must not squeeze the search box ---------- */
.topbar { grid-template-columns: var(--nav-w) minmax(0, 1fr) auto; }
.shell.collapsed .topbar { grid-template-columns: var(--nav-w-collapsed) minmax(0, 1fr) auto; }
.top-center { min-width: 0; overflow: hidden; }
.gsearch { min-width: 0; }
.gsearch span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace { white-space: nowrap; }
.lt-list { grid-auto-rows: max-content; align-content: start; }
.lt-row { min-height: 40px; }
.gsearch { min-width: 130px; flex-shrink: 0; }
.gsearch kbd { display: none; }
/* The icon is a <span class="ico">; the collapsed-nav rule that hides labels must not hide it. */
.shell.collapsed .nav-item .ico, .shell.collapsed .nav:hover .nav-item .ico { display: inline-flex; }

/* Screen switch: opaque cover while the next screen builds, then a short fade. */
.screen-loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: var(--ink); animation: sl-in .12s ease-out both; }
.sl-inner { display: grid; justify-items: center; gap: 12px; opacity: 0; animation: sl-in .2s .18s ease-out forwards; }
.sl-mark svg { width: 44px; height: 44px; fill: rgba(0,162,255,0.08); stroke: var(--blu); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.sl-inner b { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; color: var(--text-2); }
.sl-bar { width: 132px; height: 3px; border-radius: 3px; background: rgba(0, 162, 255, 0.15); overflow: hidden; }
.sl-bar i { display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blu), var(--violet)); animation: sl-run 1s ease-in-out infinite; }
@keyframes sl-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sl-run { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .screen-loading, .sl-inner { animation: none; opacity: 1; } .sl-bar i { animation: none; width: 100%; } }
:root[data-motion="reduced"] .screen-loading, :root[data-motion="reduced"] .sl-inner { animation: none; opacity: 1; }

/* Live tokens: range quick switches */
.lt-ranges { display: flex; gap: 4px; margin: 8px 0 6px; flex-wrap: wrap; }
.lt-range { font-family: var(--display); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: rgba(0, 162, 255, 0.06); transition: color .12s, border-color .12s, background .12s; }
.lt-range:hover { color: var(--text); border-color: var(--line-2); }
.lt-range.on { color: var(--ink); background: var(--blu); border-color: var(--blu); }
.lt-range:focus-visible { outline: 2px solid var(--blu); outline-offset: 2px; }
