/* ====================================================================
   N.O.S. PIXEL OPS — Neural Operations System
   Cyberpunk command center theme. Live Ready V4.
   ==================================================================== */

:root {
  --bg-0: #06080d;
  --bg-1: #0a0f1a;
  --bg-2: #101727;
  --bg-3: #182238;
  --panel: rgba(16, 23, 39, 0.78);
  --panel-2: rgba(24, 34, 56, 0.85);
  --line: rgba(124, 255, 59, 0.18);
  --line-soft: rgba(124, 255, 59, 0.08);
  --line-strong: rgba(124, 255, 59, 0.45);

  --green: #7CFF3B;
  --cyan: #38e0ff;
  --violet: #b07bff;
  --amber: #f6c453;
  --red: #ff5470;
  --pink: #ff5dc8;
  --orange: #ff8c42;
  --blue: #5ab0ff;
  --teal: #2bd4c1;
  --yellow: #f4d35e;

  --text: #d8e7ff;
  --text-dim: #8a9bb7;
  --text-mute: #5d6f8a;

  --shadow-soft: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 18px rgba(124, 255, 59, 0.18);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Menlo', 'Courier New', monospace;
  --font-ui: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(ellipse at top left, rgba(124, 255, 59, 0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(176, 123, 255, 0.08), transparent 50%),
    var(--bg-0);
  overflow: auto;            /* CHAT PANEL 2026-07-03 v4: page scrolls so the chat panel at the bottom is reachable */
  overflow-x: hidden;
  font-size: 13px;
  line-height: 1.4;
}
body[data-world="cyberpunk"] { --accent: #7CFF3B; }
body[data-world="space"] { --accent: #60A5FA; }
body[data-world="corporate"] { --accent: #14B8A6; }
body[data-world="arcade"] { --accent: #F472B6; }
body[data-world="factory"] { --accent: #F59E0B; }
body[data-world="temple"] { --accent: #A78BFA; }
body[data-world="minimal"] { --accent: #94A3B8; }
body[data-world="ocean"] { --accent: #22D3EE; }
body[data-world="desert"] { --accent: #FBBF24; }
body[data-world="jungle"] { --accent: #34D399; }
body[data-world="noir"] { --accent: #E5E7EB; }
body[data-world="solarpunk"] { --accent: #A3E635; }
body[data-world="ice"] { --accent: #7DD3FC; }
body[data-world="lava"] { --accent: #FB7185; }
body[data-world="samurai"] { --accent: #F43F5E; }
body[data-world="pirate"] { --accent: #F97316; }
body[data-world="cloudcity"] { --accent: #38BDF8; }
body[data-world="gamer"] { --accent: #C084FC; }
body[data-world="mars"] { --accent: #F97316; }
body[data-world="vaporwave"] { --accent: #FB7185; }
body[data-world="haunted"] { --accent: #A78BFA; }
body[data-world="medieval"] { --accent: #F59E0B; }
body[data-world="luxury"] { --accent: #FACC15; }
body[data-world="subway"] { --accent: #22D3EE; }
body[data-world="candy"] { --accent: #FF5DC8; }
body[data-world="robot"] { --accent: #38E0FF; }
body[data-world="archive"] { --accent: #C4B5FD; }
body[data-world="casino"] { --accent: #F4D35E; }
body.no-effects * { transition: none !important; animation: none !important; }

/* ====================================================================
   APP SHELL — 3 column layout with topbar and bottom strip
   ==================================================================== */
.app-shell-v2 {
  display: grid;
  grid-template-rows: 56px 1fr 36px;
  grid-template-columns: 1fr;
  height: 100vh;
}

/* ====================================================================
   TOPBAR
   ==================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(16,23,39,0.95), rgba(10,15,26,0.85));
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 24px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-emblem {
  width: 28px; height: 28px; border-radius: 50%;  /* v50l9 2026-07-05: was 32x32 — shrink to fit 50px topbar */
  background: conic-gradient(var(--green), var(--cyan), var(--violet), var(--green));
  box-shadow: 0 0 12px rgba(124, 255, 59, 0.5);
  position: relative;
}
.brand-emblem::after {
  content: 'N';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--bg-0); font-size: 14px;
  background: var(--bg-1); border-radius: 50%;
  margin: 3px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 13px; letter-spacing: 0.06em; color: var(--text); }
.brand-text span { font-size: 9px; letter-spacing: 0.18em; color: var(--text-mute); }

.status-pills { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px; letter-spacing: 0.08em; font-weight: 600;
  border: 1px solid currentColor;
  background: rgba(0,0,0,0.3);
}
.pill-green { color: var(--green); }
.pill-violet { color: var(--violet); }
.pill-amber { color: var(--amber); }
.pill-red { color: var(--red); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill .bars::before { content: '▂▄▆'; letter-spacing: -1px; }

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.4);
  padding: 2px;
}
.view-toggle-btn {
  background: transparent; border: 0;
  color: var(--text-dim);
  padding: 6px 12px;
  font-size: 11px; letter-spacing: 0.08em; font-weight: 700;
  cursor: pointer; border-radius: 6px;
}
.view-toggle-btn.is-active { background: var(--accent); color: var(--bg-0); }

.mode-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.audio-switch { display: inline-flex; align-items: center; }
.audio-switch .win-btn { font-size: 14px; padding: 4px 8px; }
.audio-switch .win-btn:hover { color: var(--accent); }
.switch { position: relative; display: inline-block; width: 36px; height: 18px; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(0,0,0,0.5); border: 1px solid var(--line);
  border-radius: 18px;
  transition: 0.2s;
}
.slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); transition: 0.2s;
}
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--cyan); }
.switch input:checked + .slider { border-color: var(--cyan); }

.win-controls { display: inline-flex; align-items: center; gap: 8px; }
.win-btn {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-dim);
  width: 24px; height: 24px; border-radius: 4px;
  font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.win-btn:hover { color: var(--text); border-color: var(--accent); }
.win-version { font-size: 10px; color: var(--text-mute); }

/* ====================================================================
   HQ VIEW — 3 column grid
   ==================================================================== */
.hq-view {
  display: grid;
  grid-template-columns: 320px 1fr 380px;
  gap: 16px;
  padding: 16px;
  overflow: visible;        /* CHAT PANEL 2026-07-03 v4: let bottom-bar render below viewport if needed */
  min-height: 0;
  height: auto;             /* CHAT PANEL 2026-07-03 v4: allow grid to grow with content */
}

/* SIDEBARS */
.sidebar {
  display: flex; flex-direction: column; gap: 4px;  /* v48d 2026-07-05: gap 4px (was 10) to fit all 3 right-side panels in 453px sidebar */
  overflow-y: auto; overflow-x: hidden;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: none;  /* v48 2026-07-05: hide Firefox scrollbar — user calls them "sliders" */
}
.sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }  /* v48 2026-07-05: hide WebKit scrollbar */
/* v48 2026-07-05: also hide all panel scrollbars — user calls them "sliders" */
.roster-list, .approval-list, .activity-feed, .chat-thread,
.fin-hero, .fin-kpi-grid, .fin-bottom, .kpi-grid, .budget-visual-summary,
.usage-list, .opp-list, .panel-body, .panel {
  scrollbar-width: none;
}
.roster-list::-webkit-scrollbar, .approval-list::-webkit-scrollbar, .activity-feed::-webkit-scrollbar,
.chat-thread::-webkit-scrollbar, .fin-hero::-webkit-scrollbar, .fin-kpi-grid::-webkit-scrollbar,
.fin-bottom::-webkit-scrollbar, .kpi-grid::-webkit-scrollbar, .budget-visual-summary::-webkit-scrollbar,
.usage-list::-webkit-scrollbar, .opp-list::-webkit-scrollbar, .panel-body::-webkit-scrollbar,
.panel::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Right sidebar: pin the most-used panel (Budget & Ledger) to the bottom
   of the visible area. The Worlds panel is the tallest (shows all 30
   world thumbnails) and pushes Budget & Ledger off-screen. By making
   Worlds collapsible with an internal scroll area, the user can keep
   Budget & Ledger always visible. */
/* RIGHT SIDEBAR — Interactive Slider Bar
   Lets the user manually resize each right-sidebar panel when they
   need more room. Saves preferences to localStorage so they persist. */
/* =========================================================
   LAYOUT v3 — ADDED 2026-07-02:
     * .rs-tabs (right-sidebar tab nav: Financials | Layout)
     * .panel-header-right (header extras: badge + height slider)
     * .height-slider (range input that drives panel max-height)
     * updated positions: panel-opps → left sidebar, panel-activity → bottom-strip
   ========================================================= */
.rs-tabs {
  display: flex;
  flex-direction: row;
  gap: 0;
  margin-bottom: 0;  /* v50l7 2026-07-05: 0 (was 10) — gap on parent instead */
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 4px 0;  /* v50l8 2026-07-05: padding-bottom 0 (was 4) — use gap on parent */
  flex: 0 0 41px;  /* v50l7: fixed 41px (was auto) */
  min-height: 41px;
  max-height: 41px;
  box-sizing: border-box;
}
.rs-tab {
  flex: 1 1 0;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 8px 10px;
  font: 600 11px/1 var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.rs-tab:hover { color: var(--fg); }
.rs-tab.is-active {
  background: var(--accent);
  color: #0a0d12;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* .height-slider + .rs-slider-* DELETED 2026-07-05 v46.
   Per-panel height sliders were removed from the UI on 2026-07-03 (per user
   "fill the space" / "no sliders per module"). The CSS is purged so that any
   stale browser cache still serving v2/v3 HTML cannot resurrect the slider
   visuals. The single source of truth for panel sizing is now the v45
   flex/min/max rules on .panel-revenue / .panel-budget / .panel-opps. */

/* Sidebar-left: panel-opps MOVED 2026-07-03 v5 from left sidebar to
   right sidebar (under BUDGET & LEDGER on the Financials tab). */
.sidebar-left .panel-opps { display: none; }
.sidebar-left .panel-opps .opp-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* Bottom-strip: now holds panel-activity (full width). */
.bottom-strip .panel-activity {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 240px;
  max-height: 320px;
  overflow: hidden;
}
.bottom-strip .panel-activity .activity-feed { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* Tab-hidden panels: explicit display:none for clarity (the inline
   style set by the tab JS handles this, but keep the rule so non-JS
   fallback hides the inactive tab content cleanly). */
.sidebar-right [data-tab-panel].is-hidden { display: none !important; }

/* .rs-slider-bar (and its descendants .rs-slider-row, .rs-slider,
   .rs-slider-val) DELETED 2026-07-05 v46 — same rationale as
   .height-slider above. Marked dead in code comments since 2026-07-02 v2
   ("rs-slider-bar (worlds/opps/budget sliders) DELETED"). Purging the
   rules ensures stale browser cache cannot redraw the controls. */

/* REORDER 2026-07-02 v3: TABBED right sidebar.
   tab 1 "Financials" (preloaded) → REVENUE + BUDGET (height sliders in headers)
   tab 2 "Layout"                 → WORLDS & THEMES
   v3.1 2026-07-02: REVENUE max-height raised 260→420 (default) so 8 KPI
   cards fit. Slider max raised 600→900 to let the panel grow further.
   The JS in index.html overrides these on input. */
/* Right sidebar panels — DEAD CODE REMOVED 2026-07-05 (v50l_cleanup):
   Old `flex: 1 1 0` rules at 323-336 and duplicate .budget-settings at 339-346
   were overridden by the v50l8b/v50l8d rules below (lines 378+). Later cascade
   wins, so 323-346 was pure noise. See CHANGELOG.md. */
/* New extra budget data fields */
.budget-extra-fields { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border, #2a3142); }
.bef-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.bef-stat { display: flex; flex-direction: column; padding: 6px 8px; background: rgba(95, 209, 255, 0.05); border: 1px solid var(--border, #2a3142); border-radius: 4px; min-height: 48px; }
.bef-stat span { font-size: 9px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 3px; }
.bef-stat b { font-size: 14px; color: var(--accent, #5fd1ff); font-weight: 700; line-height: 1.3; font-family: 'Courier New', monospace; }
.bef-stat em { font-size: 9px; color: var(--muted, #6b7280); font-style: normal; margin-top: 3px; line-height: 1.2; }
.bef-section { margin-top: 4px; }
.bef-label { font-size: 9px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.budget-spark { display: flex; align-items: flex-end; gap: 2px; height: 32px; padding: 2px 0; }
.budget-spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; position: relative; }
.budget-spark-col span { width: 100%; background: linear-gradient(180deg, var(--accent, #5fd1ff), #2a8aaf); border-radius: 1px 1px 0 0; min-height: 2px; transition: height 0.3s; }
.budget-spark-col i { font-size: 7px; color: var(--muted, #6b7280); font-style: normal; margin-top: 1px; }
.budget-detail-rows { display: flex; flex-direction: column; gap: 2px; }
.bdr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; padding: 2px 4px; background: rgba(95, 209, 255, 0.03); border-radius: 2px; font-size: 9px; }
.bdr label { color: var(--muted, #6b7280); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bdr b { color: #fff; font-weight: 600; font-size: 10px; }
.bdr em { grid-column: 1 / -1; font-size: 8px; color: var(--muted, #6b7280); font-style: normal; text-align: right; }
.bdr-empty { font-size: 9px; color: var(--muted, #6b7280); font-style: italic; padding: 4px; }
.bef-toggle { display: block; text-align: center; margin-top: 6px; font-size: 10px; color: var(--accent, #5fd1ff); text-decoration: none; padding: 2px 0; border-top: 1px dashed var(--border, #2a3142); border-bottom: 1px dashed var(--border, #2a3142); letter-spacing: 0.05em; }
.bef-toggle:hover { color: #fff; background: rgba(95, 209, 255, 0.08); }
.budget-settings { margin: 4px 0 6px; border: 1px solid var(--border, #2a3142); border-radius: 3px; background: rgba(95, 209, 255, 0.03); }
.budget-settings summary { font-size: 9px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 6px; cursor: pointer; list-style: none; user-select: none; }
.budget-settings summary::-webkit-details-marker { display: none; }
.budget-settings summary:hover { color: #fff; background: rgba(95, 209, 255, 0.06); }
.budget-settings[open] summary { color: var(--accent, #5fd1ff); border-bottom: 1px solid var(--border, #2a3142); }
.budget-settings .budget-row { padding: 2px 6px; }
.sidebar-right .panel-worlds  { display: none; }  /* v48c 2026-07-05: collapsed to 0 — was 0px anyway, hide it */
/* OPPORTUNITY SCANNER — moved 2026-07-03 v5 from left sidebar to right
   sidebar (under BUDGET & LEDGER). Slim, sits below budget panel.
   v48c 2026-07-05: fixed 70px (user "make opps a lil smaller"). */
.sidebar-right .panel-revenue { display: flex; flex-direction: column; flex: 0 0 200px; min-height: 0; overflow: hidden; scrollbar-width: none; padding: 6px 10px 0; margin-bottom: 0; }  /* v67 2026-07-06: 200px (revenue KPIs need space). Cashflow added in v66+ takes remaining 53px (flex:1 1 auto with overflow-y:auto). */
.sidebar-right .panel-revenue::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar-right .panel-revenue .kpi-grid { flex: 0 0 auto; min-height: 0; overflow: hidden; }
.sidebar-right .panel-revenue .panel-header { flex: 0 0 auto; margin-bottom: 4px; }  /* v48d: mb 4 (was 6) */
.sidebar-right .panel-budget  { display: flex; flex-direction: column; flex: 0 0 92px; min-height: 0; overflow: hidden; scrollbar-width: none; margin-bottom: 0; padding-bottom: 0; }  /* v50l8d 2026-07-05: 92px. Math: 41+4+200+4+92+4+108 = 453 EXACT. */
.sidebar-right .panel-budget::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar-right .panel-budget .panel-header { flex: 0 0 auto; margin-bottom: 4px; }
.sidebar-right .panel-budget .budget-visual-summary { flex: 0 0 auto; overflow: visible; min-height: 0; }
.sidebar-right .panel-budget .budget-settings { display: none; }
/* v50c 2026-07-05: visual summary normal flow; model-bar reordered to top with order:-1 so it always renders at top of panel viewport. */
/* v50 2026-07-05: visible model dropdown at top of budget panel. order:-1 forces it above visual-summary. */
.sidebar-right .panel-budget .budget-model-bar {
  order: -1;        /* v50c: render before visual-summary in flex layout */
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 5px;
  margin: 0;
  background: rgba(95,209,255,0.05);
  border: 1px solid var(--line-soft, #2a3142);
  border-radius: 3px;
  position: sticky; top: 0; z-index: 3;   /* double-safety: even if order fails, sticky pins to top of panel scroll */
  font-size: 9px; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: 0.05em;
}
.sidebar-right .panel-budget .budget-model-bar select {
  flex: 1 1 auto; min-width: 0;
  padding: 3px 6px; font-size: 10px;
  background: rgba(0,0,0,0.4); color: var(--text, #dbe7f4);
  border: 1px solid var(--border, #2a3142); border-radius: 2px;
  cursor: pointer; text-transform: none; letter-spacing: 0;
  font-family: var(--mono, 'JetBrains Mono', monospace);
}
.sidebar-right .panel-budget .budget-model-bar select:hover { border-color: var(--accent, #5fd1ff); }
.sidebar-right .panel-budget .budget-model-bar select:focus { outline: 1px solid var(--accent, #5fd1ff); outline-offset: 1px; }
.sidebar-right .panel-opps    { position: relative; display: flex; flex-direction: column; flex: 0 0 108px; min-height: 0; overflow: hidden; padding: 0 6px; margin-bottom: 0; }  /* v50l8d 2026-07-05: 108px to fit viewAll (19px) inside opp panel. Math: 41+4+200+4+92+4+108 = 453 EXACT. */
.sidebar-right .panel-opps .panel-header { margin-bottom: 1px; padding: 0 2px; min-height: 18px; }  /* v50e 2026-07-05: tighter header to fit 2 opps */
.sidebar-right .panel-opps .panel-header h3 { font-size: 10px; line-height: 1; }  /* v50e: smaller heading, single line */
.sidebar-right .panel-opps .panel-header #oppsCounter { font-size: 9px; padding: 1px 4px; }  /* v50e: smaller counter */
.sidebar-right .panel-opps .panel-header .opps-refresh-btn { padding: 1px 5px; font-size: 10px; }  /* v50e: smaller refresh */
.sidebar-right .panel-opps .opps-watcher-row { display: none !important; }
.sidebar-right .panel-opps .opps-source-row { display: none; }  /* v50d 2026-07-05: hide chips in 90px panel to maximize item visibility. Source filter still available via modal. */
.sidebar-right .panel-opps .opp-list { position: relative; flex: 1 1 0; overflow-y: auto; min-height: 0; padding: 0; margin: 0; }
.sidebar-right .panel-opps > #openSocialManager { display: none !important; }
.sidebar-right .panel-opps .opp-list .opp-footer { position: sticky; bottom: 0; left: 0; right: 0; height: 18px; padding: 0 !important; border-top: 1px solid var(--border, #2a3142); margin: 0 !important; text-align: center; background: var(--bg-2, #0d1420); display: block !important; z-index: 2; }
.sidebar-right .panel-opps .opp-list .opp-footer .panel-link { display: block; font-size: 9px; line-height: 18px; color: var(--accent, #5fd1ff); text-decoration: none; letter-spacing: 0.05em; padding: 0; font-weight: 600; }

/* v67 2026-07-06: cashflow panel — flex:1 1 auto so it consumes the slack
   in the 453px sidebar after revenue (200) + budget (92) + opps (108) + 41 header + 3*4 gaps = 453.
   Internal overflow-y:auto so the 1100px-tall content (4 KPIs + 12 source rows)
   can be scrolled inside its allocated box. */
.sidebar-right .panel-cashflow {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #2a3142) transparent;
  margin-bottom: 0;
  padding-bottom: 4px;
}
.sidebar-right .panel-cashflow::-webkit-scrollbar { width: 4px; }
.sidebar-right .panel-cashflow::-webkit-scrollbar-thumb { background: var(--border, #2a3142); border-radius: 2px; }
.sidebar.sidebar-right { display: flex; flex-direction: column; gap: 4px !important; padding-bottom: 0; padding-right: 0; }  /* v50l8c 2026-07-05: !important to beat line 1388 .sidebar{gap:8px}. Total: 41+4+200+4+95+4+100 = 448 in 453 = 5px slack. */
.sidebar-right .panel:last-child { margin-bottom: 0; }

/* Bottom strip — holds SYSTEM ACTIVITY (scrollable feed). */
.bottom-strip {
  display: flex !important;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.bottom-strip .panel { margin-bottom: 0; }
.bottom-strip .panel-activity { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; overflow: hidden; }
.bottom-strip .panel-activity .activity-feed { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* Left sidebar — REORDERED 2026-07-02 v3:
   * AGENT ROSTER  (panel-roster)   — top, flex 3 (expanded)
   * OPPORTUNITY SCANNER (panel-opps) — moved here from bottom-strip (slim)
   * No more SYSTEM ACTIVITY here (moved to bottom-strip in v3). */
.sidebar-left .panel-roster     { flex: 3 1 0; min-height: 420px; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-left .panel-roster .roster-list { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
/* OPPORTUNITY SCANNER — moved out of left sidebar 2026-07-03 v5. */
.sidebar-left .panel-opps       { display: none; }
.sidebar-left .panel-activity   { display: none; }   /* moved to .bottom-strip in v3 */
/* panel-revenue / panel-finance are no longer in the left sidebar. */
.sidebar-left .panel-revenue    { display: none; }
.sidebar-left .panel-finance    { display: none; }
.sidebar-left .panel { margin-bottom: 12px; }
.sidebar-left .panel:last-child { margin-bottom: 0; }

/* PANELS */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  position: relative;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.panel-header h3 {
  margin: 0; font-size: 11px; letter-spacing: 0.1em; font-weight: 700;
  color: var(--text);
}
.panel-sub, .muted { color: var(--text-mute); font-size: 11px; }
.panel-link {
  display: block; text-align: center;
  font-size: 10px; letter-spacing: 0.12em; color: var(--accent);
  margin-top: 6px; cursor: pointer; text-decoration: none;
  border-top: 1px dashed var(--line-soft); padding-top: 6px;
}
.counter {
  font-size: 10px; color: var(--text-dim);
  padding: 2px 6px; border-radius: 10px;
  border: 1px solid var(--line);
}
.live-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--green);
}
.live-indicator .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ====================================================================
   AGENT ROSTER (compact rows)
   ==================================================================== */
.roster-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 520px; overflow-y: auto;
  margin-bottom: 6px;
}
.roster-team-header {
  padding: 8px 10px 4px; margin-top: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  border-left: 2px solid; border-bottom: 1px solid rgba(255,255,255,.12);
  padding-left: 8px;
}
.roster-team-header:first-child { margin-top: 0; }
.roster-team-header small { opacity: .6; font-weight: 400; text-transform: none; letter-spacing: 0; }
.roster-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.roster-row:hover { border-color: var(--accent); }
.roster-row.is-busy { border-left-width: 3px; }
.roster-row .roster-portrait { margin-top: 1px; flex-shrink: 0; }
.roster-row .roster-pct { margin-top: 2px; flex-shrink: 0; }
.roster-row .agent-row-actions { display: flex; gap: 4px; margin-top: 1px; flex-shrink: 0; }
.roster-portrait {
  width: 28px; height: 28px;
  border-radius: 4px; overflow: hidden;
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--accent);
  border: 1px solid var(--line);
  position: relative;
}
.roster-portrait img { width: 100%; height: 100%; object-fit: cover; }
.roster-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; gap: 1px; padding: 2px 0; }
.roster-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-name small { font-weight: 500; opacity: .55; margin-left: 4px; }
.roster-role { font-size: 10px; color: var(--accent); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-activity { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.roster-chip {
  font-size: 9px; padding: 1px 5px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-soft);
  color: var(--text-dim); white-space: nowrap;
}
.roster-pct {
  font-size: 11px; font-weight: 700; color: var(--accent);
  font-family: var(--font-mono);
}

/* ====================================================================
   SYSTEM ACTIVITY
   ==================================================================== */
.activity-feed {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 130px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 10.5px;
}
.log-line {
  padding: 4px 6px;
  background: rgba(0,0,0,0.25);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.log-line time { color: var(--text-mute); margin-right: 6px; }
.log-line b { color: var(--accent); margin-right: 4px; font-size: 9px; }

/* ====================================================================
   REVENUE / KPI GRID
   ==================================================================== */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.kpi-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  position: relative;
  overflow: hidden;
}
.kpi-card.kpi-revenue { grid-column: span 2; }
.kpi-label { font-size: 9px; color: var(--text-mute); letter-spacing: 0.08em; text-transform: uppercase; }
.kpi-value { font-size: 14px; font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.kpi-delta { font-size: 10px; color: var(--text-dim); }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-spark { width: 100%; height: 16px; color: var(--green); margin-top: 2px; }

/* ====================================================================
   CENTER COLUMN
   ==================================================================== */
.center-col {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

/* HQ HERO */
.hero-hq {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 220px;
  min-width: 0;
  align-self: stretch;
}
.hero-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.3);
  flex-wrap: wrap; gap: 8px;
}
.hero-title h2 {
  margin: 0; font-size: 14px; letter-spacing: 0.06em; color: var(--text);
  font-family: var(--font-mono);
}
.hero-subtitle { font-size: 10px; color: var(--text-dim); }
.hero-modes { display: flex; align-items: center; gap: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.seg-btn { background: transparent; border: 0; color: var(--text-dim); padding: 4px 10px; font-size: 10px; letter-spacing: 0.08em; font-weight: 700; cursor: pointer; border-radius: 4px; }
.seg-btn.is-active { background: var(--accent); color: var(--bg-0); }
.toggle-row { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-dim); cursor: pointer; }
.toggle-row input[type="checkbox"] { accent-color: var(--accent); }
.zoom { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.zoom-btn { background: rgba(0,0,0,0.4); border: 1px solid var(--line); color: var(--text); width: 22px; height: 22px; border-radius: 4px; cursor: pointer; }
.zoom-btn:hover { border-color: var(--accent); }
#hqZoomLabel { color: var(--text-dim); min-width: 36px; text-align: center; font-family: var(--font-mono); }

/* Coded World Engine toggle (Industrial Factory) */
.coded-engine-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--text);
  font: 600 10px/1 var(--font-mono, monospace);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.coded-engine-btn:hover { background: rgba(245, 158, 11, 0.22); border-color: #F59E0B; }
.coded-engine-btn .ce-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #F59E0B;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
  animation: ce-pulse 1.6s infinite;
}
.coded-engine-btn.is-on {
  background: rgba(245, 158, 11, 0.32);
  border-color: #F59E0B;
  color: #FFE4B5;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
.coded-engine-btn.is-on .ce-dot { background: #FFD27A; animation: none; box-shadow: 0 0 8px #FFD27A; }
@keyframes ce-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
[data-agent-id].is-engine-highlight {
  outline: 2px solid #FFD27A;
  outline-offset: 2px;
  background: rgba(255, 210, 122, 0.15);
  transition: outline 0.3s, background 0.3s;
}

/* HQ SCENE — the big isometric backdrop with rooms overlaid */
.hq-scene {
  flex: 1;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  min-height: 0;
  transition: background-image 0.4s;
}
.hq-scene::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(6,8,13,0.55) 100%);
  pointer-events: none;
}
.hq-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,255,59,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,255,59,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.7;
}
.hq-scene.no-grid .hq-grid { display: none; }
.hq-rooms {
  position: absolute; inset: 0;
}
.hq-room {
  position: absolute;
  min-width: 110px; max-width: 160px;
  background: rgba(6, 8, 13, 0.78);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: move;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), 0 0 14px rgba(124,255,59,0.15);
  transition: box-shadow 0.2s;
}
.hq-room:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.5), 0 0 22px rgba(124,255,59,0.3); }
.hq-room.is-selected { border-color: var(--green); box-shadow: 0 0 24px rgba(124,255,59,0.45); }
.hq-room.is-busy { animation: roomPulse 1.8s ease-in-out infinite; }
@keyframes roomPulse { 50% { box-shadow: 0 0 26px rgba(124,255,59,0.55); } }
.hq-room-name { font-size: 11px; font-weight: 700; color: var(--text); letter-spacing: 0.04em; }
.hq-room-type { font-size: 9px; color: var(--text-dim); margin-top: 1px; }
.hq-room-agent {
  display: flex; align-items: center; gap: 4px;
  margin-top: 4px; padding-top: 4px;
  border-top: 1px dashed var(--line-soft);
  font-size: 10px; color: var(--accent);
}
.hq-room-agent-portrait {
  width: 16px; height: 16px; border-radius: 3px; overflow: hidden;
  background: var(--bg-2);
}
.hq-room-agent-portrait img { width: 100%; height: 100%; object-fit: cover; }

.hq-confidential {
  position: absolute; bottom: 8px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px; letter-spacing: 0.3em;
  color: var(--text-mute);
  border: 1px solid var(--line-soft);
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
}

/* ====================================================================
   MID ROW (3 cards)
   ==================================================================== */
.mid-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  min-height: 150px;
  max-height: 200px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
}
.card-head h3 { margin: 0; font-size: 11px; letter-spacing: 0.1em; font-weight: 700; }
.card-x {
  background: transparent; border: 0; color: var(--text-mute);
  font-size: 16px; cursor: pointer; padding: 0 4px;
}
.card-x:hover { color: var(--text); }
.card-body { padding: 10px 12px; }

/* MISSION CONTROL */
.mission-active { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.mission-active strong { font-size: 13px; color: var(--text); }
.mission-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.progress-bar {
  flex: 1; height: 6px; background: var(--bg-2);
  border-radius: 3px; overflow: hidden;
  border: 1px solid var(--line-soft);
}
.progress-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 8px var(--green);
  transition: width 0.4s;
}
.progress-pct { font-size: 11px; font-weight: 700; color: var(--green); font-family: var(--font-mono); }
.mission-pipeline { list-style: none; padding: 0; margin: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.mission-pipeline li {
  flex: 1; min-width: 60px; text-align: center;
  padding: 4px 6px;
  font-size: 9px; letter-spacing: 0.06em; color: var(--text-mute);
  background: rgba(0,0,0,0.3); border: 1px solid var(--line-soft);
  border-radius: 4px;
}
.mission-pipeline li.is-done { color: var(--green); border-color: var(--green); }
.mission-pipeline li.is-current { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px rgba(56,224,255,0.4); }
.mission-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--text-dim); }
.mission-meta b { color: var(--text); }

/* APPROVAL QUEUE */
.badge-count {
  display: inline-block; margin-left: 4px;
  background: var(--red); color: #fff;
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
}
.approval-list { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.approval-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  margin-bottom: 4px;
}
.ap-title { font-size: 11px; color: var(--text); font-weight: 600; }
.ap-sub { grid-column: 1 / -1; font-size: 9px; color: var(--text-mute); }
.ap-yes, .ap-no {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.ap-yes { color: var(--green); }
.ap-no  { color: var(--red); }
.ap-yes:hover { background: rgba(124,255,59,0.15); }
.ap-no:hover  { background: rgba(255,84,112,0.15); }

/* QUICK LAUNCH */
.launch-icons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.launch-icon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 6px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  gap: 4px;
  transition: 0.15s;
}
.launch-icon:hover { border-color: var(--accent); background: rgba(124,255,59,0.08); }
.li-glyph { font-size: 18px; }
.li-label { font-size: 9px; color: var(--text-dim); letter-spacing: 0.04em; }

/* BUTTONS */
.btn {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px; letter-spacing: 0.08em; font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-add { width: 100%; border-style: dashed; color: var(--green); border-color: var(--green); background: rgba(124,255,59,0.05); }
.btn-add:hover { background: rgba(124,255,59,0.12); }
.btn-add-small { width: 28px; padding: 4px 8px; }
.btn-launch { background: var(--green); color: var(--bg-0); border-color: var(--green); width: 100%; }
.btn-launch:hover { background: transparent; color: var(--green); }
.btn-execute { background: var(--cyan); color: var(--bg-0); border-color: var(--cyan); }
.btn-execute:hover { background: transparent; color: var(--cyan); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

/* ====================================================================
   BOTTOM BAR (command + presets) and TERMINAL
   ==================================================================== */
.bottom-bar {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px;
}
.command-center, .workspace-presets {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
}
.cc-label { font-size: 9px; color: var(--text-mute); letter-spacing: 0.1em; min-width: 100px; }
.command-center input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: 6px 10px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px;
  outline: none;
}
.command-center input:focus { border-color: var(--accent); }

.preset-chips { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.preset-chip {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.preset-chip.is-active { background: var(--accent); color: var(--bg-0); border-color: var(--accent); }
.preset-chip:hover { color: var(--text); }

.terminal-pane {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  height: 130px;
  overflow: hidden;
}
.terminal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 10px;
  font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim);
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--line-soft);
}
.terminal-output {
  flex: 1;
  margin: 0; padding: 8px 10px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--green);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ====================================================================
   RIGHT SIDEBAR — Worlds & Themes, Opportunities, Budget
   ==================================================================== */
.worlds-tabs { display: flex; gap: 2px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.wt-tab {
  background: transparent; border: 0;
  color: var(--text-dim);
  font-size: 9px; letter-spacing: 0.1em; font-weight: 700;
  padding: 4px 8px; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.wt-tab.is-active { color: var(--accent); border-color: var(--accent); }
.world-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  margin-bottom: 8px;
}
.world-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 0.85;
  display: flex; flex-direction: column;
  transition: 0.15s;
  --wc-accent: var(--green);
}
.world-card:hover { border-color: var(--wc-accent); transform: translateY(-1px); }
.world-card.is-active {
  border-color: var(--wc-accent);
  box-shadow: 0 0 14px var(--wc-accent), inset 0 0 0 1px var(--wc-accent);
}
.world-card.is-active::after {
  content: '\2713';
  position: absolute; top: 4px; left: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--wc-accent); color: var(--bg-0);
  font-size: 12px; font-weight: 900; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 8px var(--wc-accent);
  z-index: 3;
}
.world-card-thumb {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  background-color: var(--bg-2);
}
.world-card-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.85) 100%);
}
.world-card-name {
  position: absolute; left: 8px; right: 8px; bottom: 22px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em;
  color: #FFD86B;
  text-shadow: 0 1px 2px rgba(0,0,0,1), 0 0 6px rgba(0,0,0,0.9);
  z-index: 2;
  line-height: 1.1;
  text-align: left;
  padding: 0; background: none;
}
.world-card.is-active .world-card-name { color: var(--wc-accent); text-shadow: 0 1px 2px rgba(0,0,0,1), 0 0 8px var(--wc-accent); }
.world-card-tag {
  position: absolute; left: 8px; right: 8px; bottom: 6px;
  font-size: 7.5px; letter-spacing: 0.04em;
  color: var(--wc-accent);
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  z-index: 2;
  line-height: 1.2;
  opacity: 0.95;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left;
}
.world-card-custom {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-style: dashed;
  color: var(--text-mute);
  font-size: 9px; text-align: center;
  padding: 6px;
  background: rgba(0,0,0,0.3);
}
.world-card-custom .pi-glyph { font-size: 18px; margin-bottom: 4px; }
.world-card-custom .world-card-name { position: static; color: var(--text-mute); font-size: 9px; text-align: center; padding: 0; background: none; text-shadow: none; }
.world-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.world-actions .btn { font-size: 9px; padding: 4px 8px; flex: 1; }

.opp-list { list-style: none; padding: 0; margin: 0; }
.opp-list li {
  display: flex; flex-direction: column;
  padding: 2px 5px;     /* v50d 2026-07-05: even tighter so 2 rows fit in 90px panel */
  backg...[truncated]
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  margin-bottom: 2px;   /* v50 2026-07-05: tighter */
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.opp-list li.opp-item { cursor: pointer; }
.opp-list li.opp-item:hover {
  background: rgba(96,165,250,0.18);
  border-color: var(--blue, #60a5fa);
  transform: translateX(2px);
}
/* v50 2026-07-05: compact two-row layout — badge+title+score on top, meta+actions on bottom. */
.opp-row-top {
  display: flex; align-items: center; gap: 4px;
  min-width: 0;
}
.opp-row-top .opp-badge { margin-top: 0; flex: 0 0 auto; }
.opp-row-top .opp-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 11px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opp-row-top .opp-score {
  flex: 0 0 auto;
  font-size: 10px; font-weight: 700; color: var(--accent, #5fd1ff);
  font-variant-numeric: tabular-nums;
  min-width: 22px; text-align: right;
}
.opp-row-bot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1px; gap: 2px; min-height: 14px;     /* v50d 2026-07-05: tighter so 2 rows fit in 90px panel */
}
.opp-row-bot .opp-meta { margin-top: 0; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px; }  /* v50d: smaller font */
.opp-row-bot .opp-acts { flex: 0 0 auto; display: inline-flex; gap: 1px; }
.opp-row-top { display: flex; align-items: center; gap: 4px; min-height: 14px; }  /* v50d: tighter top row */
.opp-row-top .opp-title { font-size: 10px; }  /* v50d: smaller title */
/* v50d 2026-07-05: tiny icon buttons on each opp row. */
.opp-act-btn {
  font-size: 9px; line-height: 1; padding: 1px 3px;     /* v50d: smaller */
  background: var(--bg-2, #0d1420); color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.opp-act-btn:hover { border-color: var(--accent, #5fd1ff); color: var(--accent, #5fd1ff); }
.opp-act-btn:active { transform: scale(0.92); }
.opp-act-btn.opp-act-play { color: var(--green, #7cff3b); }
.opp-act-btn.opp-act-play:hover { background: var(--green, #7cff3b); color: var(--bg); }
.opp-act-btn.opp-act-del { color: var(--red, #ff5470); }
.opp-act-btn.opp-act-del:hover { background: var(--red, #ff5470); color: var(--bg); }
/* v50 2026-07-05: source-filter chip row above the opp list. */
.opps-source-row {
  display: flex; flex-wrap: nowrap; gap: 2px;
  padding: 2px 5px 1px 5px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  flex: 0 0 auto;
}
.opps-source-row::-webkit-scrollbar { display: none; }
.opp-source-chip {
  flex: 0 0 auto;
  font-size: 9px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 6px;
  background: var(--bg-2, #0d1420);
  color: var(--muted, #6b7a99);
  border: 1px solid var(--line-soft, #1d2533);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.opp-source-chip:hover { border-color: var(--accent, #5fd1ff); color: var(--accent, #5fd1ff); }
.opp-source-chip.active {
  background: var(--accent, #5fd1ff); color: var(--bg, #0a0e1a);
  border-color: var(--accent, #5fd1ff);
}
/* v50 2026-07-05: tiny refresh button in the panel header. */
.opps-refresh-btn {
  font-size: 12px; line-height: 1; padding: 1px 4px;
  background: transparent; color: var(--accent, #5fd1ff);
  border: 1px solid var(--line-soft, #1d2533);
  border-radius: 3px; cursor: pointer;
  font-family: inherit; margin-left: auto;
  transition: background 0.12s, color 0.12s;
}
.opps-refresh-btn:hover { background: var(--accent, #5fd1ff); color: var(--bg, #0a0e1a); }
.opps-refresh-btn:disabled { opacity: 0.5; cursor: wait; }
.opp-title { font-size: 11px; color: var(--text); }
.opp-badge { font-size: 9px; padding: 1px 6px; border-radius: 8px; align-self: flex-start; margin-top: 3px; }
.opp-meta  { font-size: 9px; color: var(--muted); margin-top: 2px; opacity: 0.75; }
.opp-empty { font-size: 11px; color: var(--muted); padding: 8px; text-align: center; }
.opp-high { background: rgba(255,84,112,0.15); color: var(--red); border: 1px solid var(--red); }
.opp-opp  { background: rgba(124,255,59,0.15); color: var(--green); border: 1px solid var(--green); }
.opp-pct  { background: rgba(56,224,255,0.15); color: var(--cyan); border: 1px solid var(--cyan); }
.opp-low  { background: rgba(255,212,82,0.15); color: var(--yellow, #ffd452); border: 1px solid var(--yellow, #ffd452); }
.opp-agent { background: rgba(180,140,255,0.15); color: #b48cff; border: 1px solid #b48cff; }

/* BUDGET */
.badge {
  display: inline-block;
  font-size: 9px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-2); color: var(--text-dim);
  border: 1px solid var(--line);
}
.badge.green { color: var(--green); border-color: var(--green); }
.badge.amber { color: var(--amber); border-color: var(--amber); }
.badge.red   { color: var(--red); border-color: var(--red); }

.budget-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.budget-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; font-size: 10px; color: var(--text-dim); }
.budget-row input, .budget-row select {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  color: var(--text); padding: 3px 6px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 10px;
  width: 100%;
}
.budget-row input[type="checkbox"] { accent-color: var(--accent); }
.budget-actions { display: flex; gap: 4px; margin-bottom: 6px; }
.budget-actions .btn { flex: 1; font-size: 9px; padding: 4px 6px; }
.usage-list { display: flex; flex-direction: column; gap: 3px; max-height: 80px; overflow-y: auto; }
.usage-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px;
  background: rgba(0,0,0,0.25);
  border-radius: 3px;
  font-size: 10px;
}
.usage-item b { display: block; color: var(--text); font-size: 10px; }
.usage-item span { color: var(--text-mute); font-size: 9px; }
.usage-item em { color: var(--accent); font-style: normal; font-family: var(--font-mono); }

/* ====================================================================
   BOTTOM WORKSPACE STRIP
   ==================================================================== */
.workspace-strip {
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  background: linear-gradient(0deg, rgba(10,15,26,0.95), rgba(16,23,39,0.85));
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--text-dim);
}
.ws-group { display: flex; align-items: center; gap: 6px; }
.ws-group label { letter-spacing: 0.1em; font-weight: 700; color: var(--text-mute); }
.ws-group select {
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: 3px 8px; border-radius: 3px;
  font-size: 10px; font-family: var(--font-mono);
}
.ws-group input[type="checkbox"] { accent-color: var(--accent); }
.ws-toggles { display: flex; gap: 6px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; cursor: pointer; }
.ws-spacer { flex: 1; }
.ws-actions { gap: 6px; }

/* ====================================================================
   WORKFLOW BUILDER VIEW
   ==================================================================== */
.builder-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
  padding: 12px;
  min-width: 0;
}
.builder-shell {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 12px;
  height: 100%;
  min-height: 0;
}
.builder-palette, .builder-inspector {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: 10px;
}
.builder-palette { display: flex; flex-direction: column; gap: 12px; }
.palette-head h3 { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.1em; }
.palette-group h4 {
  font-size: 9px; letter-spacing: 0.12em; color: var(--text-mute);
  margin: 0 0 4px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.palette-item, .palette-agent {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  font-size: 11px;
  cursor: grab;
  margin-bottom: 4px;
}
.palette-item:active { cursor: grabbing; }
.palette-item:hover, .palette-agent:hover { border-color: var(--accent); }
.pi-glyph {
  width: 18px; text-align: center; color: var(--accent);
  font-size: 12px;
}
.palette-agents { display: flex; flex-direction: column; gap: 2px; }
.palette-agent { padding: 4px 6px; }
.palette-agent-portrait { width: 18px; height: 18px; border-radius: 3px; overflow: hidden; background: var(--bg-2); }
.palette-agent-portrait img { width: 100%; height: 100%; object-fit: cover; }
.palette-agent-name { font-size: 10.5px; }

.builder-canvas-wrap {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.builder-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.3);
}
.builder-name {
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: 4px 10px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  outline: none;
}
.builder-toolbar-right { display: flex; gap: 6px; }
.builder-canvas {
  flex: 1; position: relative;
  background-color: var(--bg-1);
  background-image:
    linear-gradient(rgba(124,255,59,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,255,59,0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: auto;
  min-height: 400px;
}
.builder-wires {
  position: absolute; inset: 0; pointer-events: none;
  width: 100%; height: 100%;
}
.builder-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mute); font-size: 12px;
  pointer-events: none;
}
.wf-node {
  position: absolute;
  min-width: 140px; max-width: 180px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: move;
  user-select: none;
  box-shadow: var(--shadow-soft);
}
.wf-node:hover { border-color: var(--accent); }
.wf-node.is-selected { border-color: var(--green); box-shadow: 0 0 16px rgba(124,255,59,0.3); }
.wf-node[data-type="trigger"]  { border-left: 3px solid var(--green); }
.wf-node[data-type="agent"]   { border-left: 3px solid var(--cyan); }
.wf-node[data-type="action"]  { border-left: 3px solid var(--amber); }
.wf-node[data-type="logic"]   { border-left: 3px solid var(--violet); }

.wf-node-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.wf-node-glyph { font-size: 14px; color: var(--accent); }
.wf-node-title { font-size: 11px; font-weight: 700; color: var(--text); }
.wf-node-sub { font-size: 9px; color: var(--text-mute); }
.wf-port {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg-2); border: 2px solid var(--accent);
  cursor: crosshair; pointer-events: auto;
  top: 50%; transform: translateY(-50%);
}
.wf-port.in  { left: -6px; }
.wf-port.out { right: -6px; }
.wf-port:hover { box-shadow: 0 0 8px var(--accent); }
.wf-port.is-connecting { background: var(--green); box-shadow: 0 0 12px var(--green); }
.wf-wire {
  stroke: var(--green);
  stroke-width: 2;
  fill: none;
  filter: drop-shadow(0 0 4px var(--green));
}

.builder-inspector .inspector-head { margin-bottom: 8px; }
.inspector-body { display: flex; flex-direction: column; gap: 8px; }
.inspector-body label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--text-dim); }
.inspector-body input, .inspector-body select, .inspector-body textarea {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  color: var(--text); padding: 5px 8px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px;
}
.inspector-body textarea { min-height: 60px; resize: vertical; }
.inspector-empty { color: var(--text-mute); font-size: 11px; text-align: center; padding: 20px 0; }

/* hide views based on data-view */
body[data-view="hq"] .builder-view { display: none; }
body[data-view="builder"] .hq-view { display: none; }

/* responsive — collapse side panels on narrow screens */
@media (max-width: 1280px) {
  .hq-view { grid-template-columns: 240px 1fr 280px; }
  .status-pills { display: none; }
}
@media (max-width: 1024px) {
  .hq-view { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .sidebar { max-height: 200px; }
  .mid-row { grid-template-columns: 1fr; }
}

/* ====================================================================
   Reference UI polish pass — matches the supplied N.O.S. Pixel Ops mockup
   while keeping the dashboard interactive.
   ==================================================================== */
:root {
  --panel: rgba(5, 9, 15, 0.82);
  --panel-2: rgba(7, 12, 22, 0.88);
  --line: rgba(80, 255, 90, 0.22);
  --line-soft: rgba(80, 255, 90, 0.10);
  --line-strong: rgba(124, 255, 59, 0.55);
}
body {
  font-family: var(--font-mono);
  font-size: 12px;
  background:
    radial-gradient(circle at 52% 18%, rgba(70, 40, 150, 0.18), transparent 32%),
    radial-gradient(circle at 12% 4%, rgba(0, 255, 170, 0.10), transparent 24%),
    #02050a;
}
.app-shell-v2 { grid-template-rows: 58px 1fr 40px; }
.topbar {
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.96), rgba(5, 9, 16, 0.92));
  border-bottom: 1px solid rgba(69, 255, 115, 0.18);
  box-shadow: 0 1px 0 rgba(0,255,255,0.09), 0 0 25px rgba(0,0,0,0.6);
}
.brand-text strong {
  font-size: 22px;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--green);
  text-shadow: 0 0 10px rgba(124,255,59,0.38);
}
.brand-text span { font-size: 11px; letter-spacing: .22em; color: #f0f5ff; }
.brand-emblem { width: 40px; height: 40px; background: transparent; border: 2px solid #60ffd6; box-shadow: 0 0 14px rgba(96,255,214,.35); }
.brand-emblem::after { content: ''; inset: 7px; margin: 0; border: 2px solid #60ffd6; background: transparent; border-radius: 30%; transform: rotate(45deg); }
.status-pills { gap: 12px; }
.pill {
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 11px;
  background: rgba(0,0,0,0.55);
  box-shadow: inset 0 0 10px rgba(255,255,255,0.02);
}
.pill .bars::before { content: '▂▃▄▅▆▇▆▃'; color: var(--green); margin-right: 8px; }
.view-toggle, .mode-switch { display: none !important; }
.win-controls { gap: 8px; }
.win-version { order: -1; margin-right: 8px; font-size: 11px; color: var(--text-dim); }
.win-btn { width: 30px; height: 30px; border-radius: 3px; background: rgba(0,0,0,.5); color: #aab8cc; }
.win-btn:last-child { color: #ff5870; border-color: rgba(255,84,112,.3); }

.hq-view {
  grid-template-columns: 286px minmax(0, 1fr) 362px;
  gap: 10px;
  padding: 10px 12px 8px;
  background: radial-gradient(circle at 50% 45%, rgba(42, 50, 130, .17), transparent 42%);
}
.sidebar { gap: 8px; padding-right: 0; }
.panel, .card, .command-center, .workspace-presets, .terminal-pane {
  background: linear-gradient(180deg, rgba(6, 10, 18, .92), rgba(3, 6, 12, .84));
  border: 1px solid rgba(65, 255, 103, .18);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 0 18px rgba(0,0,0,.32);
}
.panel-header h3, .card-head h3, .cc-label { color: #f0f6ff; font-size: 12px; letter-spacing: .09em; }
.panel-header h3::before, .card-head h3::before { color: var(--accent); margin-right: 5px; }
.panel-roster .panel-header h3::before { content: '♚'; }
.panel-activity .panel-header h3::before { content: '?'; color: #ff5470; }
.panel-revenue .panel-header h3::before { content: '◉'; color: #ff5470; }
.panel-worlds .panel-header h3::before { content: '✹'; color: var(--accent); }
.panel-opps .panel-header h3::before { content: '◉'; color: var(--accent); }
.counter { color: var(--green); border: 0; font-weight: 800; }
.roster-list { max-height: 520px; gap: 5px; }
.roster-row {
  grid-template-columns: 28px 1fr auto auto;
  align-items: start;
  min-height: 40px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 3px;
}
.roster-row:hover { background: rgba(124,255,59,.06); }
.roster-portrait { border-radius: 4px; border-color: rgba(124,255,59,.25); }
.roster-name { font-size: 12px; color: #f6f8ff; }
.roster-activity { font-size: 10px; color: var(--green); }
.roster-pct { color: #eef5ff; font-size: 11px; }
.btn { border-radius: 3px; letter-spacing: .09em; }

/* UPDATED 2026-07-02: added a 4th row for the new .bottom-strip
   (Opp Scanner + Budget/Ledger relocated from the right sidebar). */
.center-col { gap: 8px; grid-template-rows: minmax(0, 1fr) auto auto auto; }
.hero-hq { border-radius: 4px; background: #03070f; }
.hero-toolbar {
  min-height: 35px;
  padding: 5px 8px;
  background: rgba(1, 5, 12, .88);
  border-bottom: 1px solid rgba(65,255,103,.15);
}
.hero-title { display: flex; align-items: center; gap: 10px; }
.hero-title h2 { font-size: 12px; color: #dfefff; }
.hero-subtitle { color: var(--green); font-size: 10px; }
.segmented { border-radius: 4px; }
.seg-btn { padding: 5px 11px; }
.seg-btn.is-active { background: rgba(124,255,59,.12); color: var(--green); box-shadow: inset 0 0 0 1px rgba(124,255,59,.45); }
.hq-scene {
  background-size: 100% auto;
  background-position: center center;
  background-color: #050912;
  border-top: 1px solid rgba(90, 120, 255, .10);
}
.hq-scene::before { background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.12)); }
.hq-grid { opacity: .16; background-size: 36px 36px; }
.hq-confidential { display: none; }
.hq-hotspot {
  position: absolute;
  background: transparent;
  border: 0;
  min-width: 0;
  max-width: none;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}
.hq-hotspot:hover, .hq-hotspot.is-selected { box-shadow: inset 0 0 0 1px rgba(124,255,59,.45), 0 0 20px rgba(124,255,59,.18); border-radius: 6px; }
.hotspot-ping {
  position: absolute; right: 8px; top: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(124,255,59,.8);
  opacity: 0;
  box-shadow: 0 0 10px rgba(124,255,59,.75);
}
.hq-hotspot:hover .hotspot-ping, .hq-hotspot.is-selected .hotspot-ping { opacity: 1; }
.hotspot-tooltip {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.94);
  min-width: 158px; padding: 7px 9px;
  background: rgba(2, 6, 12, .92);
  border: 1px solid rgba(124,255,59,.42);
  border-radius: 4px;
  color: #f3f8ff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s, transform .14s;
  text-align: center;
}
.hotspot-tooltip strong { display: block; font-size: 11px; color: var(--accent); letter-spacing: .07em; }
.hotspot-tooltip span, .hotspot-tooltip em { display: block; font-size: 9px; color: var(--text-dim); font-style: normal; margin-top: 2px; }
.hq-hotspot:hover .hotspot-tooltip, .hq-hotspot.is-selected .hotspot-tooltip { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.mid-row { grid-template-columns: minmax(0, 1.35fr) 180px 205px; gap: 8px; }
.card { border-radius: 4px; }
.card-body { padding: 8px 10px; }
.mission-pipeline li { font-size: 9px; }
.approval-list li { grid-template-columns: 1fr 25px 25px; }
.launch-icons { grid-template-columns: repeat(3, 1fr); }
.bottom-bar { grid-template-columns: 1.25fr 1fr; gap: 8px; }
.command-center, .workspace-presets { min-height: 68px; }
.terminal-pane { display: none; }

.panel-worlds { padding: 10px; }
.worlds-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(124,255,59,.13);
  border-radius: 3px;
  gap: 0;
}
.wt-tab {
  min-width: 0;
  padding: 7px 4px;
  border-right: 1px solid rgba(124,255,59,.08);
  border-bottom: 0;
  white-space: normal;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.wt-tab.is-active { background: rgba(124,255,59,.10); border: 1px solid rgba(124,255,59,.42); margin: -1px 0 -1px -1px; }
.panel-sub { margin: 8px 0 10px; }
.world-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
.world-card {
  aspect-ratio: 1 / .78;
  border-radius: 4px;
  background: #050913;
}
.world-card.is-active { box-shadow: 0 0 0 1px var(--wc-accent), 0 0 16px rgba(124,255,59,.25); }
.world-card-name { top: 10px; bottom: auto; left: 34px; font-size: 11px; color: #f4f6ff; }
.world-card-tag { bottom: 8px; font-size: 9px; }
.world-card-thumb { inset: 33px 8px 26px 8px; border-radius: 2px; }
.world-card-thumb::after { background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.18)); }
.world-card.is-active::after { left: 9px; top: 9px; width: 17px; height: 17px; }
.world-card-custom { aspect-ratio: 1/.78; }
.world-card-custom .world-card-name { color: #cbd4e6; margin-top: 4px; }
.world-card-custom .world-card-tag { position: static; white-space: normal; color: var(--text-dim); }
.world-actions { gap: 7px; }
.world-actions .btn { min-height: 28px; }
@media (max-width: 1440px) {
  .hq-view { grid-template-columns: 270px minmax(0,1fr) 340px; }
  .brand-text strong { font-size: 18px; }
  .pill { padding: 7px 9px; }
  .workspace-strip {
    padding: 0 15px;
    background: rgba(3, 7, 13, .96);
    border-top: 1px solid rgba(124,255,59,.16);
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    flex-shrink: 0;
    overflow: hidden;
    flex-wrap: nowrap;
  }
  .ws-group { background: rgba(0,0,0,.18); border: 1px solid rgba(124,255,59,.09); padding: 5px 8px; border-radius: 3px; }
  .ws-spacer { background: transparent; border: 0; }
  .ws-actions { background: transparent; border: 0; }
}

/* ====================================================================
   Button map UI states, modals, layout modes, and interaction feedback
   ==================================================================== */
.nos-clicked {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.25);
}
.nos-toast {
  position: fixed;
  right: 20px;
  bottom: 54px;
  z-index: 9998;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: rgba(3, 8, 14, 0.94);
  box-shadow: 0 0 24px rgba(0, 255, 200, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font-size: 12px;
  letter-spacing: .03em;
}
.nos-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.nos-modal-overlay,
.nos-closed-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 4, 10, 0.74);
  backdrop-filter: blur(8px);
}
.nos-modal-overlay[hidden],
.nos-closed-overlay[hidden],
.modal-overlay[hidden] {
  display: none !important;
}
.nos-modal,
.nos-closed-card,
.modal-card {
  width: min(720px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(10, 18, 28, 0.98), rgba(3, 7, 12, 0.98));
  box-shadow: 0 0 40px rgba(0, 255, 200, 0.16), inset 0 0 32px rgba(124,255,59,0.05);
  color: var(--text);
}
.nos-modal header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  letter-spacing: .08em;
}
.nos-modal-x,
.modal-x {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.nos-modal-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.45;
}
.nos-modal footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.nos-log-list,
.nos-theme-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.nos-log-list li,
.nos-theme-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.nos-log-list span,
.nos-theme-list span { color: var(--text-mute); }
.nos-help-grid,
.nos-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.nos-help-grid p,
.nos-settings-grid label {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.035);
}
.nos-closed-card {
  text-align: center;
  padding: 34px;
}
.nos-closed-card h2 {
  margin-top: 0;
  color: var(--accent);
  letter-spacing: .14em;
}

/* OPPORTUNITY SCANNER MODAL — opened from "VIEW ALL OPPORTUNITIES".
   Two-column: full ranked list (left) + agent-add form (right). */
.opps-modal-card {
  width: min(960px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
}
.opps-modal-stats {
  flex: 1 1 auto;
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.modal-header h2 {
  margin: 0;
  color: var(--accent);
  letter-spacing: .14em;
  font-size: 15px;
}
.opps-modal-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.02);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.opps-modal-toolbar .opps-search {
  flex: 2 1 220px;
  min-width: 0;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.opps-modal-toolbar .opps-source-filter {
  flex: 1 1 120px;
  min-width: 0;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.opps-modal-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  flex: 1 1 auto;
  min-height: 0;
}
.opps-modal-list-wrap {
  overflow-y: auto;
  padding: 8px 12px;
  border-right: 1px solid var(--line-soft);
  min-height: 0;
}
.opps-modal-side {
  padding: 14px 16px;
  overflow-y: auto;
  background: rgba(255,255,255,0.018);
}
.opps-modal-side h3 {
  margin: 0 0 6px 0;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--accent);
}
.opps-modal-hint {
  font-size: 11px;
  color: var(--text-mute);
  margin: 0 0 12px 0;
  line-height: 1.4;
}
.opps-add-form { display: flex; flex-direction: column; gap: 8px; }
.opps-add-form label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute);
}
.opps-add-form input,
.opps-add-form select,
.opps-add-form textarea {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.opps-add-form textarea { resize: vertical; min-height: 38px; }
.opps-add-form .btn { margin-top: 4px; }
.opps-add-status {
  font-size: 10px; min-height: 14px; color: var(--text-mute);
  letter-spacing: .04em;
}
.opps-add-status.ok    { color: var(--green); }
.opps-add-status.err   { color: var(--red); }
.opps-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opps-modal-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255,255,255,0.025);
  font-size: 12px;
}
.opps-modal-list .opp-title { font-size: 12px; }
.opps-modal-list .opp-meta  { font-size: 10px; }
.opps-modal-list .opp-del {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--red);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
  align-self: start;
}
.opps-modal-list .opp-del:hover { background: rgba(255,84,112,0.1); }
.opps-modal-list .opp-empty { border: none; background: transparent; text-align: center; padding: 18px 6px; }

@media (max-width: 760px) {
  .opps-modal-card { width: calc(100vw - 16px); }
  .opps-modal-grid { grid-template-columns: 1fr; }
  .opps-modal-list-wrap { border-right: none; border-bottom: 1px solid var(--line-soft); max-height: 50vh; }
}
.theme-option {
  min-height: 122px;
  cursor: pointer;
}
.theme-swatch {
  height: 58px;
  margin: 10px;
  border-radius: 8px;
  box-shadow: 0 0 24px currentColor;
}
.effect-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding-left: 16px;
}
.effect-card input {
  width: 22px;
  height: 22px;
}
.layout-mini {
  height: 58px;
  margin: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(124,255,59,.35) 0 22%, transparent 22% 24%, rgba(80,180,255,.25) 24% 72%, transparent 72% 74%, rgba(244,114,182,.28) 74% 100%);
}
.layout-mini.expanded-view {
  background:
    linear-gradient(90deg, rgba(124,255,59,.28) 0 15%, transparent 15% 17%, rgba(80,180,255,.35) 17% 83%, transparent 83% 85%, rgba(244,114,182,.22) 85% 100%);
}
.layout-mini.focus-mode {
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(80,180,255,.45) 8% 92%, transparent 92% 100%);
}
body.effects-no-glow * {
  box-shadow: none !important;
  text-shadow: none !important;
}
body.effects-no-particles .hq-grid {
  opacity: 0.18;
}
body[data-layout-mode="expanded-view"] .hq-view {
  grid-template-columns: 230px 1fr 270px;
}
body[data-layout-mode="expanded-view"] .mid-row {
  grid-template-columns: 1.2fr .8fr .8fr;
}
body[data-layout-mode="focus-mode"] .hq-view {
  grid-template-columns: 1fr;
}
body[data-layout-mode="focus-mode"] .sidebar-left,
body[data-layout-mode="focus-mode"] .sidebar-right,
body[data-layout-mode="focus-mode"] .workspace-strip {
  display: none;
}
body[data-layout-mode="focus-mode"] .app-shell-v2 {
  grid-template-rows: 56px 1fr 0;
}
body.nos-soft-minimized .sidebar,
body.nos-soft-minimized .mid-row,
body.nos-soft-minimized .workspace-strip {
  display: none !important;
}
body.nos-soft-minimized .hq-view {
  grid-template-columns: 1fr;
}
body.nos-soft-minimized .app-shell-v2 {
  grid-template-rows: 56px 1fr 0;
}
.hq-scene.mode-select .hq-room {
  cursor: pointer;
}
.hq-scene.mode-drag .hq-room {
  cursor: grab;
}
.hq-scene.mode-drag .hq-room:active {
  cursor: grabbing;
}
@media (max-width: 720px) {
  .nos-help-grid,
  .nos-settings-grid {
    grid-template-columns: 1fr;
  }
}



/* ====================================================================
   FRAMEWORK REPAIR PATCH V2 — stable layout + productivity controls
   ==================================================================== */
.app-shell-v2 {
  grid-template-rows: minmax(50px, 50px) minmax(0, 1fr) minmax(32px, 32px) minmax(40px, 40px);  /* v50l9 2026-07-05: 4 rows. Old: 58/1fr/44. New: 50/1fr/32/40. Total chrome: 50+32+40=122. Sidebar gains 8px (58→50 topbar) and 32px (no longer covered by dock) = +40px usable. Dock uses grid-row 3/4 explicit, builder-view (row 5, 0-height) still exists for builder mode. */
  /* v47 2026-07-05: dropped min-width 1180px so app fills the available viewport.
     Was causing the right ~25% of the screen to render as black void when the
     browser window was narrower than 1180px. Sidebars now flex to fit. */
  min-width: 0;
}
.topbar {
  min-height: 50px;  /* v50l9 2026-07-05: was 58px — compress to give sidebar 8 more px */
  max-height: 50px;  /* v50l9 2026-07-05: was implicit. Force content to fit 50px */
  height: 50px;  /* v50l9 2026-07-05: force exact */
  gap: 12px;
  overflow: hidden;
}
.topbar-left,
.topbar-right {
  min-width: 0;
}
.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.status-pills .pill {
  white-space: nowrap;
}
.view-toggle {
  flex-shrink: 0;
}
.win-controls {
  flex-shrink: 0;
}
.hq-view {
  /* v47 2026-07-05: lower center col min from 560→280 so the app fits
     viewports down to ~700px without horizontal overflow / black void.
     At 1264px viewport, 17vw clamp gives ~250px sidebar, 1fr fills rest. */
  grid-template-columns: clamp(180px, 17vw, 310px) minmax(280px, 1fr) clamp(220px, 22vw, 420px);
  min-width: 0;
}
.center-col,
.sidebar,
.panel,
.card,
.card-body,
.bottom-bar,
.command-center,
.workspace-presets,
.terminal-pane {
  min-width: 0;
}
.mid-row {
  grid-template-columns: minmax(310px, 1.35fr) minmax(230px, .8fr) minmax(260px, .9fr);
  align-items: stretch;
}
.card-launch .launch-icons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.launch-icon {
  min-width: 0;
}
.world-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.world-card {
  min-width: 0;
}
.workspace-strip {
  min-height: 44px;
  height: 44px;
  max-height: 44px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 12px;
  padding: 0 14px;
  overflow: hidden;
}
.workspace-strip .ws-group {
  min-width: 0;
}
.workspace-strip select {
  max-width: 190px;
}
.framework-dock {
  position: relative;  /* v50l9 2026-07-05: was absolute. Now static grid row in app-shell. No more overlay on right sidebar. */
  grid-row: 3 / 4;  /* v50l9 2026-07-05: dock now in the empty builder-view row (row 3, 0-height). Workspace-strip pushed to row 4 by explicit grid-row. No more overlap. */
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(2, 7, 12, 0.94);
  box-shadow: 0 0 18px rgba(0,255,190,.10);
  min-height: 32px;
  max-height: 32px;
  height: 32px;
  overflow: hidden;
  flex-shrink: 0;
}
.fd-left,
.fd-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.framework-dock strong {
  color: var(--accent);
  letter-spacing: .12em;
  font-size: 11px;
  white-space: nowrap;
}
.fd-btn,
.framework-dock select {
  border: 1px solid var(--line);
  background: rgba(8,18,28,.86);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 7px;  /* v50l9 2026-07-05: was 6px 9px — dock compressed to 32px tall */
  font-size: 9px;  /* v50l9 2026-07-05: was 10px */
  letter-spacing: .08em;
  cursor: pointer;
  max-width: 210px;
}
.fd-btn:hover,
.fd-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(124,255,59,.14);
}
.nos-widget-list,
.nos-agent-health {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
}
.nos-widget-list li,
.nos-agent-health li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.nos-widget-list label,
.nos-agent-health li {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
}
.nos-agent-health li {
  grid-template-columns: 1fr 1fr auto;
}
.nos-agent-health em {
  color: var(--accent);
  font-style: normal;
}
body[data-view="builder"] .framework-dock {
  border-color: rgba(96,165,250,.6);
}
body[data-layout-mode="focus-mode"] .framework-dock,
body.nos-soft-minimized .framework-dock {
  left: 18px;
  right: 18px;
}
body[data-layout-mode="focus-mode"] .workspace-strip {
  display: none !important;
}
body[data-layout-mode="focus-mode"] .app-shell-v2 {
  grid-template-rows: minmax(58px, auto) minmax(0,1fr);
}
body[data-layout-mode="focus-mode"] .builder-view {
  height: calc(100vh - 120px);
}
.builder-view {
  min-width: 0;
}
.builder-layout {
  grid-template-columns: 260px minmax(500px, 1fr) 300px;
  min-width: 0;
}
.builder-canvas-wrap,
.builder-canvas,
.inspector,
.node-palette {
  min-width: 0;
}
@media (max-width: 1500px) {
  .status-pills .pill:nth-child(2) { display: none; }
  .hq-view { grid-template-columns: 250px minmax(520px, 1fr) 330px; }
}
@media (max-width: 1280px) {
  /* v47 2026-07-05: allow shell to fit smaller windows.
     Old min-width 1040 was still too wide for ~700-1100px viewports,
     producing a clipped left slice with black void on the right. */
  .app-shell-v2 { min-width: 0; }
  .status-pills { display: none; }
  .framework-dock { overflow-x: auto; }  /* v50l9 2026-07-05: removed position:fixed — dock is now a static grid row in app-shell */
}



/* ====================================================================
   Agent OS / Connector / Visual Operations Layer
   ==================================================================== */
.connector-mini-status {
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 10px;
  white-space: nowrap;
  background: rgba(8,18,28,.7);
}
.connector-grid,
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.connector-card,
.template-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(8, 18, 28, .72);
}
.connector-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.connector-badge {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.connector-badge.ready { color: #7cff3b; }
.connector-badge.manual { color: #facc15; }
.connector-badge.needs { color: #fb7185; }
.connector-card p,
.template-card p {
  color: var(--text-mute);
  min-height: 34px;
}
.connector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.agent-editor { display: grid; gap: 12px; }
.agent-editor-controls {
  display: grid;
  grid-template-columns: 1.2fr 1fr .55fr;
  gap: 10px;
}
.agent-editor-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-mute);
  font-size: 11px;
  letter-spacing: .05em;
}
.agent-editor-controls select,
.agent-editor-controls input {
  background: rgba(8,18,28,.9);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 9px;
}
.agent-editor-preview {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  align-items: stretch;
}
.agent-editor-big-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8,18,28,.7);
  padding: 10px;
  min-width: 0;
}
.agent-editor-big-card span {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}
.agent-editor-big-card div { min-width: 0; display: grid; gap: 4px; }
.agent-editor-big-card strong,
.agent-editor-big-card small { overflow: hidden; text-overflow: ellipsis; }
.agent-editor-big-card small { color: var(--text-mute); }
.agent-editor-pixel-preview {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: rgba(8,18,28,.8);
  background-repeat: no-repeat;
  background-size: 320px auto;
  background-position: left top;
  image-rendering: pixelated;
}
.agent-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.agent-asset-card {
  display: grid;
  gap: 6px;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8,18,28,.72);
  color: var(--text);
  padding: 7px;
  cursor: pointer;
  text-align: left;
}
.agent-asset-card:hover,
.agent-asset-card.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(124,255,59,.22), 0 0 18px rgba(124,255,59,.12);
}
.agent-asset-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  background-color: rgba(0,0,0,.28);
  background-size: cover;
  background-position: center;
}
.agent-asset-grid.pixel .agent-asset-thumb {
  background-size: 220px auto;
  background-repeat: no-repeat;
  background-position: left top;
  image-rendering: pixelated;
}
.agent-asset-card b {
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
}
.template-card span {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .12em;
}
.template-card ol {
  margin: 8px 0;
  padding-left: 18px;
  color: var(--text-mute);
  font-size: 11px;
}
.room-agent-chip {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-areas: "icon name" "icon state";
  column-gap: 5px;
  padding: 5px 6px;
  border: 1px solid rgba(124,255,59,.35);
  border-radius: 7px;
  background: rgba(0, 5, 12, .78);
  pointer-events: none;
  box-shadow: 0 0 12px rgba(124,255,59,.12);
}
.room-agent-chip span { grid-area: icon; font-size: 15px; align-self: center; }
.room-agent-chip b {
  grid-area: name;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-agent-chip em {
  grid-area: state;
  color: var(--accent);
  font-size: 9px;
  font-style: normal;
}
.room-agent-chip::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: nosPulse 1.4s infinite ease-in-out;
}
.status-working,
.status-creating,
.status-researching,
.status-thinking,
.status-optimizing,
.status-calculating {
  animation: nosWorkGlow 1.8s infinite alternate ease-in-out;
}
.hq-scene {
  background-position: center center;
}
body:not(.visual-ops-off) .hq-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 25% 25%, rgba(45,230,255,.12), transparent 18%),
    radial-gradient(circle at 75% 35%, rgba(244,114,182,.10), transparent 18%),
    linear-gradient(115deg, transparent 0 42%, rgba(255,255,255,.07) 48%, transparent 54% 100%);
  mix-blend-mode: screen;
  animation: nosScanSweep 6s infinite linear;
}
body.visual-ops-off .room-agent-chip,
body.visual-ops-off .hq-scene::after {
  animation: none !important;
  opacity: .7;
}
@keyframes nosPulse {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.25); }
}
@keyframes nosWorkGlow {
  from { box-shadow: 0 0 8px rgba(124,255,59,.12); border-color: rgba(124,255,59,.30); }
  to { box-shadow: 0 0 18px rgba(124,255,59,.35); border-color: rgba(124,255,59,.72); }
}
@keyframes nosScanSweep {
  0% { transform: translateX(-45%); opacity: .28; }
  45% { opacity: .38; }
  100% { transform: translateX(45%); opacity: .28; }
}
@media (max-width: 900px) {
  .connector-grid,
  .template-grid {
    grid-template-columns: 1fr;
  }
  .agent-editor-controls,
  .agent-editor-preview {
    grid-template-columns: 1fr;
  }
  .agent-editor-pixel-preview {
    height: 92px;
  }
}



/* ====================================================================
   User Agents Only — create/remove/run controls
   ==================================================================== */
.agent-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.agent-create-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-mute);
  font-size: 11px;
  letter-spacing: .05em;
}
.agent-create-form input,
.agent-create-form select {
  background: rgba(8,18,28,.9);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 9px;
}
.agent-create-form label:nth-child(1),
.agent-create-form label:nth-child(2),
.agent-create-note {
  grid-column: 1 / -1;
}
.agent-create-note {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-mute);
  background: rgba(255,255,255,.035);
  margin: 0;
}
.user-agent-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}
.roster-name small {
  margin-left: 4px;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 4px;
  font-size: 8px;
}
.agent-row-actions {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}
.agent-mini-btn {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(8,18,28,.86);
  color: var(--accent);
  width: 21px;
  height: 21px;
  line-height: 17px;
  cursor: pointer;
  font-size: 11px;
}
.agent-mini-btn.danger {
  color: #fb7185;
  border-color: rgba(251,113,133,.45);
}
.agent-mini-btn:hover {
  filter: brightness(1.25);
  box-shadow: 0 0 10px rgba(124,255,59,.18);
}
@media (max-width: 720px) {
  .agent-create-form {
    grid-template-columns: 1fr;
  }
}



/* ====================================================================
   World Animation Phase 1 — ambient motion and reactive environments
   ==================================================================== */
.hq-scene {
  overflow: hidden;
  transform-style: preserve-3d;
}
.hq-scene::before {
  content: "";
  position: absolute;
  inset: -2%;
  background: inherit;
  opacity: 0;
  pointer-events: none;
}
body:not(.world-fx-off) .hq-scene {
  animation: nosWorldBreath 18s ease-in-out infinite;
}
.world-ambient-layer,
.world-particles-layer,
.world-scan-layer,
.world-fog-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.world-ambient-layer { z-index: 2; }
.world-particles-layer { overflow: hidden; }
.world-scan-layer::before,
.world-scan-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 43%, color-mix(in srgb, var(--world-scan-color, #45e6ff) 28%, transparent) 49%, transparent 55% 100%);
  mix-blend-mode: screen;
  opacity: .42;
  animation: nosScanDrift 7.5s linear infinite;
}
.world-scan-layer::after {
  background:
    linear-gradient(180deg, transparent 0 88%, color-mix(in srgb, var(--world-scan-color, #45e6ff) 36%, transparent) 92%, transparent 100%);
  opacity: .18;
  animation: nosHorizontalSweep 4.2s linear infinite;
}
.wa-particle {
  position: absolute;
  display: block;
  border-radius: 999px;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.22));
}
.wa-particle.rain {
  width: 1px;
  height: 18px;
  background: linear-gradient(180deg, rgba(69,230,255,.75), transparent);
  animation: nosRainFall linear infinite;
}
.wa-particle.stars {
  width: 2px;
  height: 2px;
  background: rgba(190,225,255,.95);
  box-shadow: 0 0 8px rgba(190,225,255,.55);
  animation: nosStarFloat linear infinite;
}
.wa-particle.glass {
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
  transform: rotate(-12deg);
  animation: nosGlassDrift linear infinite;
}
.wa-particle.pixels {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: rgba(255,120,220,.9);
  box-shadow: 0 0 7px rgba(255,94,216,.42);
  animation: nosPixelHop steps(3) infinite;
}
.wa-particle.embers {
  width: 3px;
  height: 3px;
  background: rgba(245,158,11,.95);
  box-shadow: 0 0 8px rgba(245,158,11,.55);
  animation: nosEmberRise linear infinite;
}
.wa-particle.dust {
  width: 5px;
  height: 5px;
  background: radial-gradient(circle, rgba(210,190,255,.5) 0, rgba(210,190,255,.12) 60%, transparent 100%);
  animation: nosDustFloat linear infinite;
}
.wa-fog-bank {
  position: absolute;
  left: -18%;
  bottom: -3%;
  width: 48%;
  height: 24%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.10), rgba(255,255,255,.02) 54%, transparent 72%);
  filter: blur(16px);
  opacity: .35;
  animation: nosFogRoll linear infinite;
}
.wa-fog-bank:nth-child(2) { left: 26%; bottom: -1%; }
.wa-fog-bank:nth-child(3) { left: 58%; bottom: 2%; }
.wa-fog-bank:nth-child(4) { left: 8%; bottom: 7%; }

.hq-room.room-hover-armed {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.hq-room.room-hover-armed.is-hot {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 0 22px color-mix(in srgb, var(--world-glow-color, #7cff3b) 28%, transparent);
}
.hq-room.room-busy::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid color-mix(in srgb, var(--world-glow-color, #7cff3b) 65%, transparent);
  opacity: .65;
  animation: nosBusyPulse 1.6s ease-in-out infinite;
  pointer-events: none;
}
.hq-room.room-idle::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,.06);
  opacity: .45;
  pointer-events: none;
}
.hq-room.selected-boost {
  animation: nosSelectBoost .55s ease;
}
.hq-room.pulse-neon.room-busy { box-shadow: 0 0 20px rgba(124,255,59,.18), inset 0 0 18px rgba(69,230,255,.06); }
.hq-room.pulse-cool.room-busy { box-shadow: 0 0 20px rgba(96,165,250,.20), inset 0 0 18px rgba(155,213,255,.07); }
.hq-room.pulse-gold.room-busy { box-shadow: 0 0 20px rgba(212,175,55,.20), inset 0 0 18px rgba(212,175,55,.08); }
.hq-room.pulse-arcade.room-busy { box-shadow: 0 0 20px rgba(244,114,182,.22), inset 0 0 18px rgba(255,94,216,.08); }
.hq-room.pulse-amber.room-busy { box-shadow: 0 0 20px rgba(245,158,11,.20), inset 0 0 18px rgba(245,158,11,.08); }
.hq-room.pulse-mystic.room-busy { box-shadow: 0 0 20px rgba(167,139,250,.22), inset 0 0 18px rgba(192,132,252,.08); }

.room-agent-chip {
  backdrop-filter: blur(8px);
}
.room-agent-chip em {
  animation: nosStatusBlink 2.3s ease-in-out infinite;
}

body.world-fx-off .world-ambient-layer,
body.world-fx-off .hq-room::after,
body.world-fx-off .room-agent-chip em {
  animation: none !important;
}
body.world-fx-off .world-particles-layer,
body.world-fx-off .world-fog-layer,
body.world-fx-off .world-scan-layer {
  opacity: 0 !important;
}
body[data-anim-level="minimal"] .world-scan-layer::before,
body[data-anim-level="minimal"] .world-scan-layer::after {
  opacity: .16;
}
body[data-anim-level="cinematic"] .world-scan-layer::before {
  opacity: .58;
}
body[data-anim-level="cinematic"] .hq-room.room-busy::after {
  opacity: .82;
}

@keyframes nosWorldBreath {
  0%, 100% { transform: scale(1) translate3d(0,0,0); }
  50% { transform: scale(1.012) translate3d(0,-3px,0); }
}
@keyframes nosScanDrift {
  0% { transform: translateX(-48%); }
  100% { transform: translateX(52%); }
}
@keyframes nosHorizontalSweep {
  0% { transform: translateY(-30%); }
  100% { transform: translateY(38%); }
}
@keyframes nosRainFall {
  0% { transform: translate3d(0,-10%,0) rotate(10deg); opacity: 0; }
  15% { opacity: .75; }
  100% { transform: translate3d(-28px,130%,0) rotate(10deg); opacity: 0; }
}
@keyframes nosStarFloat {
  0% { transform: translate3d(0,0,0) scale(.6); opacity: .2; }
  50% { transform: translate3d(12px,-14px,0) scale(1); opacity: .95; }
  100% { transform: translate3d(24px,-28px,0) scale(.7); opacity: .1; }
}
@keyframes nosGlassDrift {
  0% { transform: translate3d(-10px,0,0) rotate(-12deg); opacity: .1; }
  50% { transform: translate3d(16px,-6px,0) rotate(-12deg); opacity: .55; }
  100% { transform: translate3d(32px,-12px,0) rotate(-12deg); opacity: .08; }
}
@keyframes nosPixelHop {
  0% { transform: translate3d(0,0,0); opacity: .14; }
  25% { transform: translate3d(6px,-9px,0); opacity: .9; }
  50% { transform: translate3d(12px,3px,0); opacity: .3; }
  100% { transform: translate3d(20px,-13px,0); opacity: .85; }
}
@keyframes nosEmberRise {
  0% { transform: translate3d(0,10px,0) scale(.8); opacity: .1; }
  35% { opacity: .8; }
  100% { transform: translate3d(14px,-40px,0) scale(1.15); opacity: 0; }
}
@keyframes nosDustFloat {
  0% { transform: translate3d(0,0,0); opacity: .18; }
  50% { transform: translate3d(-8px,-18px,0); opacity: .55; }
  100% { transform: translate3d(12px,-30px,0); opacity: .08; }
}
@keyframes nosFogRoll {
  0% { transform: translateX(0) scale(1); opacity: .18; }
  50% { transform: translateX(16%) scale(1.08); opacity: .38; }
  100% { transform: translateX(34%) scale(1.16); opacity: .12; }
}
@keyframes nosBusyPulse {
  0%, 100% { transform: scale(1); opacity: .32; }
  50% { transform: scale(1.02); opacity: .85; }
}
@keyframes nosStatusBlink {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}
@keyframes nosSelectBoost {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}



/* ====================================================================
   Hard no-demo / unlimited agent roster polish
   ==================================================================== */
.empty-user-roster {
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.025);
}
.panel-roster .counter {
  min-width: auto;
  white-space: nowrap;
}
#clearAllAgentsBtn {
  width: 100%;
  border-color: rgba(251,113,133,.35);
  color: #fb7185;
}
.roster-list {
  max-height: none;
}
.user-agent-row {
  position: relative;
}

.panel-hawaii { margin-top: 8px; }
.counter.offline { color: var(--red, #f87171); border-color: rgba(248,113,113,.35); }
.hawaii-summary { font-size: 11px; color: var(--text-dim); line-height: 1.6; }
.hawaii-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hawaii-offline { color: var(--text-dim); font-size: 10px; line-height: 1.5; }
.hawaii-offline code { font-size: 10px; }


/* ====================================================================
   HQ Visual Resize / Full Image Fit Patch
   Keeps controls accessible while giving the main world image more room.
   ==================================================================== */

/* Main dashboard proportions: smaller side rails, bigger center canvas. */
body:not([data-layout-mode="focus-mode"]) .hq-view {
  grid-template-columns:
    clamp(220px, 14.5vw, 270px)
    minmax(720px, 1.55fr)
    clamp(280px, 18.5vw, 360px) !important;
  gap: 9px !important;
  padding: 8px 10px 6px !important;
  overflow: hidden !important;
}

/* Center column: 4 rows — hero / mid-row / system-activity / chat. */
.center-col {
  grid-template-rows:
    minmax(170px, 1fr)
    minmax(96px, 100px)
    minmax(70px, 80px)
    minmax(72px, 80px) !important;
  gap: 4px !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  padding-right: 3px;
  padding-bottom: 0;
  scroll-behavior: smooth;
}
body[data-view="hq"] .center-col > .hero-hq,
.center-col > .hero-hq {
  min-height: 170px !important;
  max-height: 100% !important;
  height: auto !important;
  flex: 1 1 auto;
}
.center-col > .mid-row     { min-height: 96px;  max-height: 100px; flex: 0 0 auto; }
.center-col > .bottom-strip { min-height: 50px;  max-height: 60px; flex: 0 0 50px; overflow: hidden; }
.center-col > .bottom-bar   { min-height: 72px;  max-height: 80px; flex: 0 0 80px; }
body[data-hq-visual-size="xl"] .center-col > .bottom-strip { min-height: 40px; max-height: 40px; flex: 0 0 40px; }
body[data-hq-visual-size="xl"] .center-col > .mid-row { min-height: 70px; max-height: 80px; flex: 0 0 80px; }
}
.center-col::-webkit-scrollbar { width: 6px; }
.center-col::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }

/* The world visual itself gets priority. */
.hero-hq {
  min-height: clamp(380px, 52vh, 660px) !important;
  max-height: none !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hq-scene {
  min-height: 0 !important;
  flex: 1 1 auto;
  background-size: contain !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-color: #020711 !important;
}

/* Size modes. Default is large. */
body[data-hq-visual-size="normal"] .center-col {
  grid-template-rows:
    minmax(0, 1fr)
    minmax(110px, auto)
    minmax(60px, auto)
    minmax(80px, auto) !important;
}
body[data-hq-visual-size="normal"] .hero-hq {
  min-height: clamp(180px, 32vh, 320px) !important;
}
body[data-hq-visual-size="normal"] .hq-scene {
  min-height: 0 !important;
}

body[data-hq-visual-size="large"] .center-col {
  grid-template-rows:
    minmax(0, 1.8fr)
    minmax(100px, auto)
    minmax(50px, auto)
    minmax(80px, auto) !important;
}
body[data-hq-visual-size="large"] .hero-hq {
  min-height: clamp(200px, 40vh, 380px) !important;
}
body[data-hq-visual-size="large"] .hq-scene {
  min-height: 0 !important;
}

body[data-hq-visual-size="xl"] .center-col {
  grid-template-rows:
    minmax(0, 2.6fr)
    minmax(80px, auto)
    minmax(40px, auto)
    minmax(70px, auto) !important;
}
body[data-hq-visual-size="xl"] .hero-hq {
  min-height: clamp(260px, 50vh, 480px) !important;
}
body[data-hq-visual-size="xl"] .hq-scene {
  min-height: 0 !important;
}

/* Fit mode shows the full uploaded world image. Fill mode allows crop when desired. */
body[data-hq-image-fit="fit"] .hq-scene {
  background-size: contain !important;
}
body[data-hq-image-fit="fill"] .hq-scene {
  background-size: cover !important;
}

/* Keep toolbar usable even with added controls. */
.hero-toolbar {
  gap: 6px !important;
  align-items: center !important;
}
.hero-modes {
  gap: 6px !important;
  flex-wrap: wrap !important;
  justify-content: flex-end;
}
.hq-visual-control-group {
  flex-shrink: 0;
}
.hq-visual-btn {
  min-width: 82px;
  white-space: nowrap;
}

/* Keep mid/lower widgets compact so they don't steal too much from the world image. */
.mid-row {
  grid-template-columns: minmax(260px, 1.25fr) minmax(220px, .85fr) minmax(230px, .9fr) !important;
  gap: 8px !important;
}
.card-head {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}
.card-body {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}
.terminal-pane {
  max-height: 190px;
}
.terminal-output {
  max-height: 142px;
  overflow: auto;
}

/* On medium screens preserve access rather than forcing crop. */
/* v47 2026-07-05: this whole block previously forced min-width 1040 +
   center-col min 620px, producing horizontal overflow + black void on
   the right when the browser window was narrower than 1040px (e.g.
   the user's 470px screenshot 2026-07-05). The new grid uses
   `auto` on sidebars and `minmax(0, 1fr)` on center, so the layout
   fills any viewport >= ~700px (below that, the existing @media
   (max-width: 820px) at line 4569 stacks everything vertically). */
@media (max-width: 1500px) {
  body:not([data-layout-mode="focus-mode"]) .hq-view {
    grid-template-columns: 200px minmax(0, 1fr) 240px !important;
  }
  .hero-title h2 { font-size: 11px; }
  .hero-subtitle { display: none; }
}
@media (max-width: 1280px) {
  body:not([data-layout-mode="focus-mode"]) .app-shell-v2 {
    min-width: 0;
  }
  body:not([data-layout-mode="focus-mode"]) .hq-view {
    grid-template-columns: 190px minmax(0, 1fr) 230px !important;
  }
  .hq-visual-btn {
    min-width: 74px;
    padding-left: 7px !important;
    padding-right: 7px !important;
  }
}

/* Focus mode still lets the image dominate, but the dock/toolbar remain reachable. */
body[data-layout-mode="focus-mode"] .center-col,
body.nos-soft-minimized .center-col {
  padding-bottom: 72px;
}
body[data-layout-mode="focus-mode"] .hero-hq,
body.nos-soft-minimized .hero-hq {
  min-height: calc(100vh - 150px) !important;
}
body[data-layout-mode="focus-mode"] .hq-scene,
body.nos-soft-minimized .hq-scene {
  min-height: calc(100vh - 205px) !important;
}

/* ====================================================================
   INTERACTIVE WORLD ANIMATION LAYER v3
   Lights (per-room ceiling lamps) + Globe (fixed corner) + Room-anchored
   ambient elements (graphs, holos, dials, screens, checkmarks) that
   animate IN PLACE on their room, never cross the screen.
   Per-world themed. CSS-only. Respects WORLD FX OFF + quality levels.
   ==================================================================== */

.world-lights,
.world-ambient,
.world-globe,
.world-graph-flow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.world-lights     { z-index: 3; }
.world-ambient    { z-index: 5; }
.world-globe      { z-index: 5; }
.world-graph-flow { z-index: 2; opacity: 0.55; }

/* ---------- LIGHTS: per-room ceiling lamps with radial pulse ---------- */
.wl-lamp {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--world-glow-color, #7cff3b);
  box-shadow:
    0 0 10px 2px var(--world-glow-color, #7cff3b),
    0 0 24px 6px color-mix(in srgb, var(--world-glow-color, #7cff3b) 40%, transparent);
  transform: translate(-50%, -50%);
  animation: nosLampPulse 2.4s ease-in-out infinite;
}
.wl-lamp::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 70px; height: 70px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--world-glow-color, #7cff3b) 18%, transparent) 0%, transparent 70%);
  animation: nosLampHalo 3.2s ease-in-out infinite;
}
body.world-cyberpunk .wl-lamp:nth-child(3n) { animation: nosLampFlicker 5s linear infinite; }
body.world-space     .wl-lamp                { animation-duration: 4s; }
body.world-corporate .wl-lamp                { animation: nosLampSteady 3.5s ease-in-out infinite; }
body.world-arcade    .wl-lamp                { animation: nosLampNeon 0.9s steps(2) infinite; }
body.world-industrial .wl-lamp               { animation: nosLampEmber 1.8s ease-in-out infinite; }
body.world-temple    .wl-lamp                { animation: nosLampMystic 6s ease-in-out infinite; }

@keyframes nosLampPulse   { 0%,100% { opacity: 0.85; transform: translate(-50%,-50%) scale(1); } 50% { opacity: 1; transform: translate(-50%,-50%) scale(1.12); } }
@keyframes nosLampHalo    { 0%,100% { opacity: 0.5; } 50% { opacity: 0.95; } }
@keyframes nosLampFlicker { 0%,19%,21%,23%,80%,100% { opacity: 1; } 20%,22%,79% { opacity: 0.35; } }
@keyframes nosLampSteady  { 0%,100% { opacity: 0.95; } 50% { opacity: 1; } }
@keyframes nosLampNeon    { 0% { opacity: 1; box-shadow: 0 0 12px 2px var(--world-glow-color, #ff5ed8), 0 0 30px 8px var(--world-glow-color, #ff5ed8); } 50% { opacity: 0.5; box-shadow: 0 0 6px 1px var(--world-glow-color, #ff5ed8), 0 0 14px 4px var(--world-glow-color, #ff5ed8); } 100% { opacity: 1; } }
@keyframes nosLampEmber   { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.18); } }
@keyframes nosLampMystic  { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ---------- GLOBE: rotating wireframe sphere, fixed in top-right corner ---------- */
.wg-globe {
  position: absolute;
  top: 14%; right: 6%;
  width: 90px; height: 90px;
  transform-style: preserve-3d;
  animation: nosGlobeBob 8s ease-in-out infinite;
}
.wg-globe svg { width: 100%; height: 100%; overflow: visible; }
.wg-globe .wg-sphere    { fill: none; stroke: var(--world-glow-color, #7cff3b); stroke-width: 1; opacity: 0.7; }
.wg-globe .wg-meridian  { fill: none; stroke: var(--world-glow-color, #7cff3b); stroke-width: 0.7; opacity: 0.45; }
.wg-globe .wg-spin      { transform-origin: 50% 50%; animation: nosGlobeSpin 18s linear infinite; }
.wg-globe .wg-spinfast  { transform-origin: 50% 50%; animation: nosGlobeSpinReverse 9s linear infinite; opacity: 0.55; }
.wg-globe .wg-glow      { fill: var(--world-glow-color, #7cff3b); opacity: 0.08; animation: nosGlobeGlow 4s ease-in-out infinite; }
.wg-globe .wg-surface-pattern { fill: var(--world-glow-color, #7cff3b); opacity: 0.35; }

body.world-cyberpunk  .wg-globe .wg-surface-pattern { opacity: 0.55; }
body.world-cyberpunk  .wg-globe .wg-sphere    { stroke-dasharray: 3 5; animation: nosGlobeDash 4s linear infinite; }
body.world-space      .wg-globe .wg-glow      { opacity: 0.15; }
body.world-space      .wg-globe               { top: 12%; right: 5%; }
body.world-corporate  .wg-globe .wg-sphere    { stroke: #d4af37; }
body.world-corporate  .wg-globe               { top: 10%; right: 5%; width: 70px; height: 70px; }
body.world-arcade     .wg-globe .wg-sphere    { stroke-dasharray: 2 3; }
body.world-arcade     .wg-globe               { animation: nosGlobeBob 5s ease-in-out infinite, nosGlobeTilt 9s ease-in-out infinite; }
body.world-industrial .wg-globe               { filter: hue-rotate(-15deg); }
body.world-temple     .wg-globe .wg-sphere    { stroke: #a78bfa; }
body.world-temple     .wg-globe .wg-meridian  { stroke: #c084fc; }

@keyframes nosGlobeSpin        { to { transform: rotate(360deg); } }
@keyframes nosGlobeSpinReverse { to { transform: rotate(-360deg); } }
@keyframes nosGlobeBob         { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes nosGlobeGlow        { 0%,100% { opacity: 0.08; } 50% { opacity: 0.18; } }
@keyframes nosGlobeDash        { to { stroke-dashoffset: -80; } }
@keyframes nosGlobeTilt        { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(4deg); } }

/* ---------- ROOM-ANCHORED AMBIENT ELEMENTS -----------------------
   Each .wa-ambient is positioned inside its parent room (.hq-room
   with data-room="..."). It never crosses room boundaries. All
   animation happens in place via translate/scale/opacity/stroke-dash.
   ---------------------------------------------------------------- */

.world-ambient .wa-ambient {
  position: absolute;
  inset: 4% 4% 4% 4%;
  pointer-events: none;
  opacity: 0.85;
}

/* ----- Finance room: bar chart ticking + scrolling line chart ----- */
.wa-ambient .wa-bars {
  position: absolute;
  bottom: 6%; left: 6%; right: 6%; height: 60%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
}
.wa-ambient .wa-bar {
  flex: 1;
  background: linear-gradient(to top, color-mix(in srgb, var(--world-glow-color, #7cff3b) 30%, transparent), var(--world-glow-color, #7cff3b));
  border-radius: 1px 1px 0 0;
  transform-origin: bottom;
  animation: nosBarTick 3.2s ease-in-out infinite;
}
.wa-ambient .wa-bar:nth-child(1)  { animation-delay: 0.0s; }
.wa-ambient .wa-bar:nth-child(2)  { animation-delay: 0.3s; }
.wa-ambient .wa-bar:nth-child(3)  { animation-delay: 0.6s; }
.wa-ambient .wa-bar:nth-child(4)  { animation-delay: 0.9s; }
.wa-ambient .wa-bar:nth-child(5)  { animation-delay: 1.2s; }
.wa-ambient .wa-bar:nth-child(6)  { animation-delay: 1.5s; }
.wa-ambient .wa-bar:nth-child(7)  { animation-delay: 1.8s; }
.wa-ambient .wa-bar:nth-child(8)  { animation-delay: 2.1s; }
.wa-ambient .wa-bar:nth-child(9)  { animation-delay: 2.4s; }
.wa-ambient .wa-bar:nth-child(10) { animation-delay: 2.7s; }
@keyframes nosBarTick {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1.0); }
}

/* ----- Command room: holographic globe with rotating rings ----- */
.wa-ambient .wa-holo {
  position: absolute;
  inset: 10%;
}
.wa-ambient .wa-holo-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  opacity: 0.55;
}
.wa-ambient .wa-holo-ring:nth-child(1) { animation: nosHoloSpin 7s linear infinite; }
.wa-ambient .wa-holo-ring:nth-child(2) { animation: nosHoloSpin 11s linear infinite reverse; transform: rotate(60deg) scaleY(0.6); }
.wa-ambient .wa-holo-ring:nth-child(3) { animation: nosHoloSpin 9s linear infinite; transform: rotate(30deg) scaleY(0.8); }
.wa-ambient .wa-holo-core {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  background: var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  box-shadow: 0 0 12px 2px var(--world-glow-color, #7cff3b);
  animation: nosHoloPulse 1.8s ease-in-out infinite;
}
@keyframes nosHoloSpin  { to { transform: rotate(360deg); } }
@keyframes nosHoloPulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.4); } }

/* ----- Intel room: radar sweep ----- */
.wa-ambient .wa-radar {
  position: absolute;
  inset: 15%;
  border: 1px solid var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle, color-mix(in srgb, var(--world-glow-color, #7cff3b) 8%, transparent) 0%, transparent 70%);
}
.wa-ambient .wa-radar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, var(--world-glow-color, #7cff3b) 0deg, transparent 60deg);
  animation: nosRadarSweep 3s linear infinite;
  opacity: 0.45;
}
.wa-ambient .wa-radar::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 4px;
  transform: translate(-50%, -50%);
  background: var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  box-shadow: 0 0 8px 1px var(--world-glow-color, #7cff3b);
}
@keyframes nosRadarSweep { to { transform: rotate(360deg); } }

/* ----- Ecommerce rooms: product card stack with one cycling forward ----- */
.wa-ambient .wa-stack {
  position: absolute;
  inset: 15% 20%;
  perspective: 200px;
}
.wa-ambient .wa-card {
  position: absolute;
  inset: 0;
  border: 1px solid var(--world-glow-color, #7cff3b);
  border-radius: 3px;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 6%, transparent);
}
.wa-ambient .wa-card:nth-child(1) { animation: nosCardFlip1 6s ease-in-out infinite; }
.wa-ambient .wa-card:nth-child(2) { animation: nosCardFlip2 6s ease-in-out infinite; }
.wa-ambient .wa-card:nth-child(3) { animation: nosCardFlip3 6s ease-in-out infinite; }
@keyframes nosCardFlip1 { 0%,30%,100% { opacity: 1; transform: translateZ(0) rotateY(0); } 40%,90% { opacity: 0.4; transform: translateZ(-20px) rotateY(20deg); } }
@keyframes nosCardFlip2 { 0%,100%    { opacity: 0.4; transform: translateZ(-20px) rotateY(20deg); } 30%,60% { opacity: 1; transform: translateZ(0) rotateY(0); } }
@keyframes nosCardFlip3 { 0%,60%,100%{ opacity: 0.4; transform: translateZ(-40px) rotateY(20deg); } 70%,30% { opacity: 1; transform: translateZ(-20px) rotateY(0); } }

/* ----- Review/Approval room: checklist with sequential checkmarks ----- */
.wa-ambient .wa-checks {
  position: absolute;
  inset: 12% 12%;
  display: flex; flex-direction: column;
  gap: 6px;
}
.wa-ambient .wa-check {
  height: 6px;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 15%, transparent);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}
.wa-ambient .wa-check::after {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  background: var(--world-glow-color, #7cff3b);
  animation: nosCheckFill 4.8s ease-in-out infinite;
}
.wa-ambient .wa-check:nth-child(1)::after { animation-delay: 0.0s; }
.wa-ambient .wa-check:nth-child(2)::after { animation-delay: 0.6s; }
.wa-ambient .wa-check:nth-child(3)::after { animation-delay: 1.2s; }
.wa-ambient .wa-check:nth-child(4)::after { animation-delay: 1.8s; }
.wa-ambient .wa-check:nth-child(5)::after { animation-delay: 2.4s; }
.wa-ambient .wa-check:nth-child(6)::after { animation-delay: 3.0s; }
@keyframes nosCheckFill {
  0%, 100% { width: 0; }
  40%, 60% { width: 100%; }
}

/* ----- Support room: chat bubble with typing dots ----- */
.wa-ambient .wa-chat {
  position: absolute;
  inset: 15% 10%;
  display: flex; flex-direction: column;
  gap: 4px;
}
.wa-ambient .wa-bubble {
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 22%, transparent);
  animation: nosBubbleBlink 3s ease-in-out infinite;
}
.wa-ambient .wa-bubble:nth-child(1) { width: 60%; animation-delay: 0.0s; }
.wa-ambient .wa-bubble:nth-child(2) { width: 80%; animation-delay: 0.4s; }
.wa-ambient .wa-bubble:nth-child(3) { width: 45%; animation-delay: 0.8s; }
.wa-ambient .wa-bubble:nth-child(4) { width: 70%; animation-delay: 1.2s; }
.wa-ambient .wa-bubble:nth-child(5) {
  width: 18px; height: 8px;
  display: flex; gap: 2px; align-items: center; padding: 0 4px;
  background: transparent;
}
.wa-ambient .wa-bubble:nth-child(5)::before,
.wa-ambient .wa-bubble:nth-child(5)::after,
.wa-ambient .wa-bubble:nth-child(5) span {
  content: ""; width: 3px; height: 3px; border-radius: 50%;
  background: var(--world-glow-color, #7cff3b);
  animation: nosDot 1.2s ease-in-out infinite;
}
.wa-ambient .wa-bubble:nth-child(5)::before { animation-delay: 0.0s; }
.wa-ambient .wa-bubble:nth-child(5) span    { animation-delay: 0.2s; display: inline-block; }
.wa-ambient .wa-bubble:nth-child(5)::after  { animation-delay: 0.4s; }
@keyframes nosBubbleBlink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes nosDot         { 0%,100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }

/* ----- Marketing room: ad mockup with pulsing CTA ----- */
.wa-ambient .wa-ad {
  position: absolute;
  inset: 12% 8%;
  border: 1px solid var(--world-glow-color, #7cff3b);
  border-radius: 3px;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 6%, transparent);
  overflow: hidden;
}
.wa-ambient .wa-ad-image {
  position: absolute;
  top: 8%; left: 8%; right: 30%;
  height: 40%;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 25%, transparent);
  border-radius: 2px;
  animation: nosAdShimmer 4s ease-in-out infinite;
}
.wa-ambient .wa-ad-text {
  position: absolute;
  bottom: 25%; left: 8%; right: 8%;
  height: 4px;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 35%, transparent);
  border-radius: 1px;
}
.wa-ambient .wa-ad-text:nth-of-type(2) { bottom: 18%; width: 65%; }
.wa-ambient .wa-ad-cta {
  position: absolute;
  bottom: 8%; left: 8%;
  width: 36%; height: 16%;
  background: var(--world-glow-color, #7cff3b);
  border-radius: 2px;
  animation: nosAdCta 1.4s ease-in-out infinite;
}
@keyframes nosAdShimmer { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes nosAdCta     { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--world-glow-color, #7cff3b) 60%, transparent); } 50% { transform: scale(1.05); box-shadow: 0 0 0 5px color-mix(in srgb, var(--world-glow-color, #7cff3b) 0%, transparent); } }

/* ----- Visuals/Creative rooms: rotating dial + image tile refresh ----- */
.wa-ambient .wa-dial {
  position: absolute;
  top: 18%; left: 50%;
  transform: translateX(-50%);
  width: 60%; aspect-ratio: 1;
  border: 1px solid var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  border-top-color: transparent;
  animation: nosDial 3.5s linear infinite;
}
.wa-ambient .wa-dial::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  transform: translate(-50%, -50%);
  background: var(--world-glow-color, #7cff3b);
  border-radius: 50%;
  box-shadow: 0 0 6px 1px var(--world-glow-color, #7cff3b);
}
@keyframes nosDial { to { transform: translateX(-50%) rotate(360deg); } }

.wa-ambient .wa-tiles {
  position: absolute;
  bottom: 8%; left: 8%; right: 8%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}
.wa-ambient .wa-tile {
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 18%, transparent);
  border-radius: 1px;
  animation: nosTile 4s ease-in-out infinite;
}
.wa-ambient .wa-tile:nth-child(1)  { animation-delay: 0.0s; }
.wa-ambient .wa-tile:nth-child(2)  { animation-delay: 0.3s; }
.wa-ambient .wa-tile:nth-child(3)  { animation-delay: 0.6s; }
.wa-ambient .wa-tile:nth-child(4)  { animation-delay: 0.9s; }
.wa-ambient .wa-tile:nth-child(5)  { animation-delay: 1.2s; }
.wa-ambient .wa-tile:nth-child(6)  { animation-delay: 1.5s; }
.wa-ambient .wa-tile:nth-child(7)  { animation-delay: 1.8s; }
.wa-ambient .wa-tile:nth-child(8)  { animation-delay: 2.1s; }
@keyframes nosTile { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ---------- GRAPH FLOW: subtle dashed marching on the cost sparkline ---------- */
.wg-flow-line {
  stroke: var(--world-glow-color, #7cff3b);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  fill: none;
  animation: nosDashMarch 1.6s linear infinite;
  opacity: 0.6;
}
@keyframes nosDashMarch { to { stroke-dashoffset: -32; } }

/* ---------- WORLD FX OFF: kill all new layer animations ---------- */
body.world-fx-off .wl-lamp,
body.world-fx-off .wl-lamp::after,
body.world-fx-off .wg-globe,
body.world-fx-off .wg-globe .wg-spin,
body.world-fx-off .wg-globe .wg-spinfast,
body.world-fx-off .wg-globe .wg-glow,
body.world-fx-off .wa-ambient,
body.world-fx-off .wa-ambient *,
body.world-fx-off .wg-flow-line {
  animation: none !important;
}
body.world-fx-off .wl-lamp::after { display: none; }
body.world-fx-off .wa-ambient     { display: none; }

/* ---------- QUALITY LEVELS ---------- */
body.anim-quality-minimal .world-graph-flow,
body.anim-quality-minimal .wg-globe .wg-glow,
body.anim-quality-minimal .wg-globe .wg-surface-pattern,
body.anim-quality-minimal .wl-lamp::after,
body.anim-quality-minimal .wa-ambient {
  display: none !important;
}
body.anim-quality-balanced .wa-ambient .wa-holo-ring:nth-child(3) {
  display: none;
}

/* ---------- REDUCED MOTION: respect OS preference ---------- */
@media (prefers-reduced-motion: reduce) {
  .wl-lamp, .wl-lamp::after,
  .wg-globe, .wg-globe *, .wa-ambient *, .wg-flow-line {
    animation: none !important;
  }
}



/* ====================================================================
   WORLD ENVIRONMENT CORRECTION PATCH
   Remove legacy random full-scene FX and use room-anchored environment FX.
   ==================================================================== */
.world-ambient-layer,
.world-particles-layer,
.world-scan-layer,
.world-fog-layer { display: none !important; }

.hq-room {
  overflow: hidden;
  isolation: isolate;
}
.hq-room .wa-ambient {
  position: absolute;
  inset: 22% 5% 7% 5%;
  pointer-events: none;
  opacity: .88;
  z-index: 1;
}
.hq-room .wl-lamp {
  z-index: 2;
}
.hq-room-name,
.hq-room-type,
.hq-room-agent,
.room-agent-chip { position: relative; z-index: 3; }

/* World-specific room surface feel */
body.world-cyberpunk .hq-room { background: linear-gradient(180deg, rgba(7,14,28,.9), rgba(4,8,18,.82)); }
body.world-space .hq-room { background: linear-gradient(180deg, rgba(8,18,30,.9), rgba(3,9,18,.82)); }
body.world-corporate .hq-room { background: linear-gradient(180deg, rgba(19,22,28,.92), rgba(11,14,19,.86)); }
body.world-arcade .hq-room { background: linear-gradient(180deg, rgba(22,10,28,.92), rgba(10,5,18,.86)); }
body.world-industrial .hq-room { background: linear-gradient(180deg, rgba(28,16,8,.92), rgba(18,10,5,.86)); }
body.world-temple .hq-room { background: linear-gradient(180deg, rgba(16,10,28,.92), rgba(10,6,18,.86)); }

/* analytics room */
.wa-ambient .wa-graphs { position:absolute; inset:8% 6% 8% 6%; }
.wa-ambient .wa-graph-grid { position:absolute; inset:0; border-radius:4px; background:
  linear-gradient(to right, color-mix(in srgb, var(--world-glow-color, #7cff3b) 12%, transparent) 1px, transparent 1px) 0 0 / 20% 100%,
  linear-gradient(to top, color-mix(in srgb, var(--world-glow-color, #7cff3b) 12%, transparent) 1px, transparent 1px) 0 0 / 100% 25%; opacity:.45; }
.wa-ambient .wa-linechart { position:absolute; left:0; right:0; top:2%; width:100%; height:68%; overflow:visible; }
.wa-ambient .wa-line { fill:none; stroke: var(--world-glow-color, #7cff3b); stroke-width:2.2; stroke-linejoin:round; stroke-linecap:round; stroke-dasharray: 160; stroke-dashoffset: 160; animation: nosLineDraw 3.8s ease-in-out infinite; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--world-glow-color, #7cff3b) 45%, transparent)); }
.wa-ambient .wa-point { fill: var(--world-glow-color, #7cff3b); animation: nosPointBlink 2.2s ease-in-out infinite; }
.wa-ambient .wa-point:nth-child(2){ animation-delay:.2s } .wa-ambient .wa-point:nth-child(3){ animation-delay:.5s } .wa-ambient .wa-point:nth-child(4){ animation-delay:.8s } .wa-ambient .wa-point:nth-child(5){ animation-delay:1.1s }
.wa-ambient .wa-mini-bars { position:absolute; left:4%; right:4%; bottom:0; height:24%; display:flex; gap:3px; align-items:flex-end; }
.wa-ambient .wa-mini-bars span { flex:1; border-radius:2px 2px 0 0; background: linear-gradient(to top, color-mix(in srgb, var(--world-glow-color, #7cff3b) 25%, transparent), var(--world-glow-color, #7cff3b)); transform-origin:bottom; animation: nosMiniBar 2.8s ease-in-out infinite; }
.wa-ambient .wa-mini-bars span:nth-child(2){animation-delay:.2s}.wa-ambient .wa-mini-bars span:nth-child(3){animation-delay:.4s}.wa-ambient .wa-mini-bars span:nth-child(4){animation-delay:.6s}.wa-ambient .wa-mini-bars span:nth-child(5){animation-delay:.8s}.wa-ambient .wa-mini-bars span:nth-child(6){animation-delay:1s}
@keyframes nosLineDraw { 0%,15% { stroke-dashoffset: 160; opacity:.45; } 35%,70% { stroke-dashoffset: 0; opacity:1; } 100% { stroke-dashoffset: -10; opacity:.6; } }
@keyframes nosPointBlink { 0%,100% { opacity:.35; transform: scale(1); } 50% { opacity:1; transform: scale(1.45); } }
@keyframes nosMiniBar { 0%,100%{ transform:scaleY(.35); opacity:.4 } 50%{ transform:scaleY(1); opacity:1 } }

/* execution pipeline */
.wa-ambient .wa-pipeline { position:absolute; inset:14% 6%; }
.wa-ambient .wa-track { position:absolute; left:0; right:0; top:28%; height:3px; background: linear-gradient(to right, transparent, color-mix(in srgb, var(--world-glow-color, #7cff3b) 55%, transparent), transparent); box-shadow: 0 0 6px color-mix(in srgb, var(--world-glow-color, #7cff3b) 35%, transparent); }
.wa-ambient .wa-track2 { top:62%; opacity:.7; }
.wa-ambient .wa-packet { position:absolute; width:18px; height:12px; border-radius:3px; border:1px solid var(--world-glow-color, #7cff3b); background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 18%, transparent); top:22%; left:-8%; animation: nosPacketMove 4.5s linear infinite; }
.wa-ambient .wa-packet2 { top:56%; animation-delay:1.2s; animation-duration:5.2s; }
.wa-ambient .wa-packet3 { top:22%; animation-delay:2.3s; animation-duration:6s; }
@keyframes nosPacketMove { 0%{ left:-10%; opacity:0 } 10%{opacity:1} 90%{opacity:1} 100%{ left:94%; opacity:0 } }

/* security scanner */
.wa-ambient .wa-scanner { position:absolute; inset:10% 10%; border:1px solid color-mix(in srgb, var(--world-glow-color, #7cff3b) 45%, transparent); border-radius:4px; overflow:hidden; background: color-mix(in srgb, var(--world-glow-color, #7cff3b) 5%, transparent); }
.wa-ambient .wa-scan-box { position:absolute; inset:0; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--world-glow-color, #7cff3b) 5%, transparent)); }
.wa-ambient .wa-scan-line { position:absolute; left:0; right:0; height:2px; top:0; background: var(--world-glow-color, #7cff3b); box-shadow: 0 0 8px var(--world-glow-color, #7cff3b); animation: nosScanLine 3s ease-in-out infinite; }
.wa-ambient .wa-target { position:absolute; width:10px; height:10px; border:1px solid var(--world-glow-color, #7cff3b); border-radius:50%; animation: nosTargetPing 2.7s ease-in-out infinite; }
.wa-ambient .wa-target::before, .wa-ambient .wa-target::after { content:''; position:absolute; background: var(--world-glow-color, #7cff3b); opacity:.8; }
.wa-ambient .wa-target::before { left:50%; top:-4px; width:1px; height:18px; transform:translateX(-50%); }
.wa-ambient .wa-target::after { top:50%; left:-4px; width:18px; height:1px; transform:translateY(-50%); }
.wa-ambient .wa-target1 { left:18%; top:22%; animation-delay:.1s; }
.wa-ambient .wa-target2 { left:58%; top:34%; animation-delay:.7s; }
.wa-ambient .wa-target3 { left:34%; top:62%; animation-delay:1.3s; }
@keyframes nosScanLine { 0%,100% { top:0%; opacity:.4 } 50% { top:88%; opacity:1 } }
@keyframes nosTargetPing { 0%,100% { transform:scale(.9); opacity:.35 } 50% { transform:scale(1.2); opacity:1 } }

/* shopkeeper hub / storefront */
.wa-ambient .wa-storefront { position:absolute; inset:10% 7%; display:grid; grid-template-columns:repeat(3,1fr); gap:4px; align-content:center; }
.wa-ambient .wa-store-card { aspect-ratio: .8; border:1px solid var(--world-glow-color, #7cff3b); border-radius:3px; background: linear-gradient(180deg, color-mix(in srgb, var(--world-glow-color, #7cff3b) 15%, transparent) 0 42%, color-mix(in srgb, var(--world-glow-color, #7cff3b) 5%, transparent) 42% 100%); animation: nosStoreGlow 3.4s ease-in-out infinite; }
.wa-ambient .wa-store-card:nth-child(2){ animation-delay:.4s } .wa-ambient .wa-store-card:nth-child(3){ animation-delay:.8s }
.wa-ambient .wa-store-badge { position:absolute; right:4%; top:6%; width:26px; height:10px; border-radius:999px; background: var(--world-glow-color, #7cff3b); box-shadow:0 0 8px color-mix(in srgb, var(--world-glow-color, #7cff3b) 55%, transparent); animation: nosBadgePulse 1.8s ease-in-out infinite; }
@keyframes nosStoreGlow { 0%,100%{ opacity:.5; transform:translateY(0)} 50%{ opacity:1; transform:translateY(-2px)} }
@keyframes nosBadgePulse { 0%,100%{ transform:scale(1); opacity:.75 } 50%{ transform:scale(1.08); opacity:1 } }

/* stronger theme flavor by world */
body.world-cyberpunk .wa-radar::before, body.world-cyberpunk .wa-scanner { filter: saturate(1.15); }
body.world-space .wa-radar, body.world-space .wa-holo { box-shadow: 0 0 14px rgba(154,216,255,.14); }
body.world-corporate .wa-ambient { opacity: .78; }
body.world-arcade .wa-dial, body.world-arcade .wa-tiles .wa-tile, body.world-arcade .wa-mini-bars span { box-shadow: 0 0 8px color-mix(in srgb, var(--world-glow-color, #ff3df0) 35%, transparent); }
body.world-industrial .wa-pipeline .wa-packet, body.world-industrial .wa-bars .wa-bar { filter: saturate(1.1); }
body.world-temple .wa-holo-ring, body.world-temple .wa-radar, body.world-temple .wa-scanner { border-style: solid; box-shadow: 0 0 10px rgba(192,132,252,.18); }


/* ====================================================================
   FINANCIAL DASHBOARD + DISPLAY CONTROL POLISH PATCH
   ==================================================================== */
html, body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
body, button, input, select, textarea {
  font-variant-ligatures: none;
}
.muted, .panel-sub, .hero-subtitle, .kpi-label, .usage-item span, .roster-activity {
  color: #b7c3d7;
}
.panel-header h3, .card-head h3, .cc-label, .ws-group label, .fd-btn, .framework-dock strong {
  text-shadow: 0 0 0 transparent;
}
select, input, button, textarea {
  font-size: 11px;
}

/* professional financial dashboard */
.panel-revenue { overflow: hidden; }
.fin-hero {
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:10px;
  margin-top: 8px;
  margin-bottom: 10px;
}
.fin-hero-main, .fin-chart-card, .fin-kpi, .fin-split, .budget-mini-card {
  background: linear-gradient(180deg, rgba(6,11,18,.92), rgba(8,14,24,.78));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.fin-hero-main { padding: 12px 14px; display:flex; flex-direction:column; justify-content:center; min-height: 112px; }
.fin-overline { font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:#c7d2e7; }
.fin-hero-value { font-size: 24px; line-height:1.05; color:#f7fbff; font-family: var(--font-mono); margin-top: 6px; }
.fin-hero-meta { display:flex; gap:10px; flex-wrap:wrap; margin-top: 8px; font-size: 11px; color:#d4deef; }
.fin-status-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; padding: 6px 12px 10px; border-top: 1px solid rgba(255,255,255,.06); margin-top: 6px; }
.fin-pill { display:inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; }
.fin-pill.ok { background: rgba(110, 200, 130, 0.12); color: #9fe2b0; border-color: rgba(110, 200, 130, 0.32); }
.fin-pill.warn { background: rgba(240, 180, 80, 0.12); color: #f4d090; border-color: rgba(240, 180, 80, 0.32); }
.fin-pill.err { background: rgba(230, 90, 90, 0.12); color: #f4a0a0; border-color: rgba(230, 90, 90, 0.32); }
.fin-meta { font-size: 11px; color: #b6c3da; font-family: var(--font-mono); }
.fin-refresh { background: rgba(255,255,255,.04); color:#cfdcef; border:1px solid rgba(255,255,255,.10); border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor:pointer; transition: background .15s; }
.fin-refresh:hover { background: rgba(255,255,255,.10); }
.fin-refresh:disabled { opacity:.5; cursor: progress; }
.fin-chart-card { padding: 10px; display:flex; align-items:center; }
.fin-chart { width:100%; height:112px; color: var(--accent); }
.fin-grid-line { fill:none; stroke: rgba(255,255,255,.08); stroke-width:.8; }
.fin-area { fill: url(#finArea); }
.fin-line { fill:none; stroke: currentColor; stroke-width:2.1; stroke-linejoin:round; stroke-linecap:round; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 35%, transparent)); }
.fin-kpi-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-bottom: 10px; }
.fin-kpi { padding: 10px 12px; display:flex; flex-direction:column; gap:4px; }
.fin-kpi span { font-size:10px; text-transform:uppercase; letter-spacing:.12em; color:#bfd0e6; }
.fin-kpi strong { font-size:16px; color:#f5f9ff; font-family: var(--font-mono); }
.fin-kpi em { font-style:normal; font-size:10px; color:#9fc4a8; }
.fin-bottom { display:grid; grid-template-columns: 1.05fr .95fr; gap:8px; }
.fin-split { padding: 10px 12px; }
.fin-section-title { font-size: 10px; text-transform: uppercase; letter-spacing:.12em; color:#dce6f6; margin-bottom:8px; }
.fin-channel { display:grid; grid-template-columns: 72px 1fr 34px; align-items:center; gap:8px; margin-bottom:6px; }
.fin-channel label { font-size:11px; color:#edf2fb; }
.fin-channel b, .fin-health-row b { font-size:11px; color:#f5fbff; font-family: var(--font-mono); }
.fin-channel-bar { height:8px; border-radius:999px; overflow:hidden; background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.05); }
.fin-channel-bar span { display:block; height:100%; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 58%, transparent), var(--accent)); box-shadow:0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.fin-health-row { display:flex; justify-content:space-between; gap:12px; padding:6px 0; border-bottom:1px dashed rgba(255,255,255,.08); font-size:11px; color:#cad6e8; }
.fin-health-row:last-child { border-bottom:0; }

/* budget polish — v50l5 2026-07-05: compressed for 80px sidebar slot */
.budget-visual-summary { display:flex; flex-direction:column; gap:2px; margin: 2px 0 2px; }
.budget-insight-grid { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; }
.budget-mini-card { padding: 2px 4px; display:flex; flex-direction:row; align-items:baseline; gap: 4px; flex-wrap: nowrap; }
.budget-mini-card span { font-size:7px; color:#bcd0e5; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
.budget-mini-card strong { color:#f6fbff; font-size:10px; font-family: var(--font-mono); }
.budget-mini-card em { font-style:normal; font-size:7px; color:#9bc8a1; }
.budget-meter { display:flex; flex-direction:row; gap:6px; }
.budget-meter-row { display:grid; grid-template-columns: 32px 1fr 24px; gap:4px; align-items:center; font-size:8px; color:#d5e0ef; }
.budget-track { height:8px; background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.05); border-radius:999px; overflow:hidden; }
.budget-track span { display:block; height:100%; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 58%, transparent), var(--accent)); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.budget-rows { gap:6px; }
.budget-row { grid-template-columns: 76px 1fr; font-size:11px; color:#dbe7f4; }
.budget-row input, .budget-row select { padding: 6px 8px; font-size: 11px; }
.budget-actions .btn { font-size: 10px; padding: 6px 8px; }
.usage-list { gap:4px; max-height: 122px; }
.usage-item { padding: 6px 8px; border:1px solid rgba(255,255,255,.05); border-radius: 6px; }
.usage-item b { font-size:11px; color:#f4f8ff; }
.usage-item span { font-size:10px; }
.usage-item em { font-size:11px; }

/* workspace controls / dock */
.workspace-strip {
  align-items: center;
  border-top-color: var(--line-strong);
  background: linear-gradient(0deg, rgba(6,11,18,.97), rgba(10,17,28,.92));
}
.workspace-strip .ws-group {
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
  padding: 7px 10px;
}
.workspace-strip .ws-group label { color: #dce8f7; font-size:10px; }
.workspace-strip select, .framework-dock select {
  min-height: 32px;
  color: #f4f8ff;
}
.ws-helper {
  font-size: 10px;
  color: #b5c5dc;
  white-space: nowrap;
}
.framework-dock {
  border-color: var(--line-strong);
  box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 22px color-mix(in srgb, var(--accent) 16%, transparent);
}
/* REMOVED 2026-07-02: CONTROL PANEL READY pseudo-element (duplicate status text) */
.framework-dock[data-operational="1"]::after { content: none; }
.fd-btn, .framework-dock select {
  min-height: 32px;
  font-weight: 700;
}

@media (max-width: 1380px) {
  .fin-hero, .fin-bottom, .budget-insight-grid { grid-template-columns: 1fr; }
  .ws-helper { display:none; }
}



/* ====================================================================
   N.O.S. × Pixel Agents Bridge
   Pixel-office layer imported from Pixel Agents MIT source/assets.
   ==================================================================== */
.pa-mini-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8,18,28,.86), rgba(4,8,14,.72));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pa-mini-panel strong {
  display: block;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .12em;
}
.pa-mini-panel span {
  display: block;
  color: #b8c6dc;
  font-size: 10px;
  margin-top: 2px;
}

.pa-modal-mount {
  min-height: min(72vh, 760px);
}
.pa-office-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pa-office-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 9, 16, .78);
}
.pa-office-head strong {
  display: block;
  color: #f5f9ff;
  letter-spacing: .12em;
  font-size: 13px;
}
.pa-office-head span {
  display: block;
  color: #b9c6da;
  font-size: 11px;
  margin-top: 3px;
}
.pa-office-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pa-office-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 34%),
    #050914;
  overflow: auto;
  padding: 16px;
  max-height: min(64vh, 680px);
}
.pa-stage {
  --pa-cell: clamp(18px, 2.25vw, 32px);
  position: relative;
  width: calc(var(--pa-cols) * var(--pa-cell));
  height: calc(var(--pa-rows) * var(--pa-cell));
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid rgba(255,255,255,.06);
  box-shadow: 0 0 32px rgba(0,0,0,.46), inset 0 0 0 1px rgba(255,255,255,.05);
  background: #0b0f18;
}
.pa-tile-layer,
.pa-furniture-layer,
.pa-agent-layer {
  position: absolute;
  inset: 0;
}
.pa-tile-layer {
  display: grid;
}
.pa-tile {
  background-size: cover;
  background-repeat: repeat;
  image-rendering: pixelated;
}
.pa-tile-255 {
  background: transparent !important;
}
.pa-tile-0 {
  background-color: #141d2b;
}
.pa-tile-1,
.pa-tile-7,
.pa-tile-9 {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.pa-furniture {
  position: absolute;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: center center;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.24));
}
.pa-agent {
  position: absolute;
  width: calc(var(--pa-cell) * 1);
  height: calc(var(--pa-cell) * 2);
  transform: translateY(-35%);
  z-index: 10;
  image-rendering: pixelated;
}
.pa-character {
  width: calc(var(--pa-cell) * 1);
  height: calc(var(--pa-cell) * 2);
  background-repeat: no-repeat;
  background-size: 700% 300%;
  background-position: 0 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.35));
}
.pa-agent.is-working .pa-character {
  animation: paSpriteWalk .72s steps(4) infinite;
}
.pa-agent.is-idle .pa-character {
  animation: paSpriteIdle 2.4s steps(2) infinite;
}
.pa-bubble {
  position: absolute;
  left: 50%;
  top: calc(var(--pa-cell) * -0.65);
  transform: translateX(-50%);
  min-width: calc(var(--pa-cell) * .75);
  height: calc(var(--pa-cell) * .55);
  border-radius: 4px;
  background: #fffdf4;
  color: #172033;
  font-size: calc(var(--pa-cell) * .34);
  font-family: var(--font-mono);
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
  animation: paBubbleBob 1.7s ease-in-out infinite;
}
.pa-agent.needs-attention .pa-bubble {
  color: #7c1d1d;
  background: #ffe2e2;
}
.pa-name {
  position: absolute;
  top: calc(var(--pa-cell) * 1.75);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(2,6,12,.82);
  border: 1px solid rgba(255,255,255,.12);
  color: #f4f9ff;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 9px;
  white-space: nowrap;
  max-width: calc(var(--pa-cell) * 4.2);
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}
.pa-office-empty {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(4,8,14,.9);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px 22px;
  color: #d8e4f4;
  font-size: 13px;
  text-align: center;
  max-width: 320px;
  z-index: 12;
}
.pa-office-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pa-office-status span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(8,18,28,.66);
  color: #d9e5f5;
  font-size: 10px;
}
.pa-gallery h4 {
  margin: 16px 0 8px;
  color: var(--accent);
  letter-spacing: .12em;
  font-size: 12px;
  text-transform: uppercase;
}
.pa-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.pa-gallery figure {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8,18,28,.6);
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}
.pa-gallery img {
  max-width: 56px;
  max-height: 56px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.pa-gallery figcaption {
  color: #cbd7e8;
  font-size: 9px;
  text-align: center;
  word-break: break-word;
}
@keyframes paSpriteWalk {
  from { background-position-x: 0; }
  to { background-position-x: -400%; }
}
@keyframes paSpriteIdle {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
@keyframes paBubbleBob {
  0%,100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -3px); }
}



/* ====================================================================
   Visible Pixel Agents HQ Mode
   Makes Pixel Agents visually present inside the main HQ scene.
   ==================================================================== */
.pixel-mode-control-group {
  flex-shrink: 0;
}
.pixel-mode-btn {
  min-width: 98px;
}
.pixel-topbar-btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 25%, transparent);
}
.pa-hq-layer {
  position: absolute;
  inset: 42px 18px 18px 18px;
  z-index: 9;
  pointer-events: auto;
  display: grid;
  place-items: center;
}
body:not(.pixel-hq-mode) .pa-hq-layer {
  display: none !important;
}
body.pixel-hq-mode .hq-grid,
body.pixel-hq-mode .hq-rooms {
  opacity: .42;
}
body.pixel-hq-mode .hq-rooms {
  pointer-events: none;
}
.pa-hq-card {
  width: min(96%, 760px);
  height: min(96%, 760px);
  max-height: 100%;
  min-height: 0;
  display: block;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, transparent);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 38%),
    rgba(3, 7, 13, .42);
  box-shadow:
    0 10px 24px rgba(0,0,0,.34),
    0 0 18px color-mix(in srgb, var(--accent) 10%, transparent),
    inset 0 0 0 1px rgba(255,255,255,.045);
  backdrop-filter: blur(5px);
  overflow: hidden;
  position: relative;
}
.pa-hq-title {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(2,8,14,.58);
  backdrop-filter: blur(5px);
}
.pa-hq-title strong {
  display: block;
  color: #f6fbff;
  font-size: 13px;
  letter-spacing: .13em;
}
.pa-hq-title span {
  display: none;
  color: #b7c5d9;
  font-size: 11px;
  margin-top: 2px;
}
.pa-hq-layout-switch {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.pa-hq-layout-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8,18,28,.78);
  color: #d7e4f4;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
}
.pa-hq-layout-btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 22%, transparent);
}
.pa-hq-mini-btn {
  border: 1px solid var(--line);
  background: rgba(8,18,28,.85);
  color: #eef5ff;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: .1em;
  cursor: pointer;
}
.pa-hq-mini-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.pa-hq-stage {
  --pa-cell: 24px;
  --pa-cell-base: 24px;
  position: relative;
  width: calc(var(--pa-cols) * var(--pa-cell));
  height: calc(var(--pa-rows) * var(--pa-cell));
  margin: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background:
    url('assets/pixel-agents/floors/floor_5.png'),
    #101827;
  background-size: 32px 32px;
  border: 3px solid rgba(255,255,255,.08);
  border-radius: 6px;
  box-shadow:
    0 0 28px rgba(0,0,0,.55),
    inset 0 0 0 1px rgba(255,255,255,.06);
  overflow: hidden;
}
.pa-hq-tiles,
.pa-hq-zones,
.pa-hq-decor,
.pa-hq-furniture,
.pa-hq-agents,
.pa-hq-scan {
  position: absolute;
  inset: 0;
}
.pa-hq-tiles {
  display: grid;
}
.pa-hq-tile {
  background-size: cover;
  image-rendering: pixelated;
}
.pa-hq-theme-wood-lab .pa-hq-stage {
  background:
    linear-gradient(90deg, rgba(70,42,20,.5) 0 2px, transparent 2px 24px),
    linear-gradient(0deg, rgba(70,42,20,.5) 0 2px, transparent 2px 24px),
    #8a6237;
  background-size: 24px 24px;
}
.pa-hq-theme-wood-lab .pa-hq-tile {
  background:
    linear-gradient(90deg, rgba(70,42,20,.48) 0 1px, transparent 1px 24px),
    linear-gradient(0deg, rgba(70,42,20,.48) 0 1px, transparent 1px 24px),
    #8a6237 !important;
  filter: none;
}
.pa-hq-theme-dark-lab .pa-hq-tile {
  background:
    linear-gradient(90deg, rgba(85,116,148,.16) 0 1px, transparent 1px 24px),
    linear-gradient(0deg, rgba(85,116,148,.16) 0 1px, transparent 1px 24px),
    #111827 !important;
  filter: none;
}
.pa-hq-theme-dark-lab .pa-hq-tile-0,
.pa-hq-theme-wood-lab .pa-hq-tile-0 {
  background:
    linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 12px),
    #050b14 !important;
}
.pa-hq-theme-dark-lab .pa-hq-tile-1,
.pa-hq-theme-dark-lab .pa-hq-tile-9 {
  background:
    linear-gradient(90deg, rgba(69,234,255,.12) 0 1px, transparent 1px 24px),
    linear-gradient(0deg, rgba(69,234,255,.10) 0 1px, transparent 1px 24px),
    #132033 !important;
}
.pa-hq-theme-wood-lab .pa-hq-tile-1,
.pa-hq-theme-wood-lab .pa-hq-tile-9 {
  background:
    linear-gradient(90deg, rgba(85,52,26,.42) 0 1px, transparent 1px 24px),
    linear-gradient(0deg, rgba(85,52,26,.42) 0 1px, transparent 1px 24px),
    #9b7140 !important;
}
.pa-hq-tile-255 {
  background-image: url('assets/pixel-agents/floors/floor_5.png') !important;
  background-size: cover;
}
.pa-hq-tile-7 {
  background-image: url('assets/pixel-agents/floors/floor_5.png') !important;
}
.pa-hq-tile-0,
.pa-hq-tile-1,
.pa-hq-tile-7,
.pa-hq-tile-9 {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
.pa-hq-furniture-item {
  position: absolute;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.25));
}
.pa-hq-zones,
.pa-hq-decor {
  pointer-events: none;
}
.pa-hq-zone {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--zone-color, #45eaff) 55%, transparent);
  background: color-mix(in srgb, var(--zone-color, #45eaff) 6%, transparent);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--zone-color, #45eaff) 11%, transparent);
  z-index: 2;
}
.pa-hq-zone span {
  position: absolute;
  left: 4px;
  top: -10px;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--zone-color, #45eaff) 60%, transparent);
  background: rgba(2,8,14,.9);
  color: var(--zone-color, #45eaff);
  font-size: 7px;
  font-family: var(--font-mono);
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pa-hq-tone-cyan { --zone-color: #45eaff; }
.pa-hq-tone-blue { --zone-color: #7db4ff; }
.pa-hq-tone-green { --zone-color: #68ff9b; }
.pa-hq-tone-amber { --zone-color: #ffd166; }
.pa-hq-tone-violet { --zone-color: #dd76ff; }
.pa-hq-decor-item {
  position: absolute;
  z-index: 4;
  border: 1px solid color-mix(in srgb, var(--zone-color, #45eaff) 55%, transparent);
  background:
    linear-gradient(90deg, transparent 0 48%, color-mix(in srgb, var(--zone-color, #45eaff) 25%, transparent) 49% 51%, transparent 52%),
    linear-gradient(0deg, transparent 0 48%, color-mix(in srgb, var(--zone-color, #45eaff) 20%, transparent) 49% 51%, transparent 52%),
    color-mix(in srgb, var(--zone-color, #45eaff) 10%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--zone-color, #45eaff) 22%, transparent);
}
.pa-hq-decor-holo-panel {
  border-radius: 3px;
  opacity: .9;
}
.pa-hq-decor-holo-avatar {
  border-radius: 50% 50% 44% 44%;
  opacity: .62;
}
.pa-hq-decor-round-table {
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--zone-color, #45eaff) 34%, transparent), transparent 42%),
    color-mix(in srgb, var(--zone-color, #45eaff) 9%, transparent);
}
.pa-hq-decor-crystal-core {
  clip-path: polygon(50% 0, 86% 28%, 72% 82%, 50% 100%, 28% 82%, 14% 28%);
  animation: paHqCrystalFloat 2.6s ease-in-out infinite;
}
.pa-hq-decor-server-wall {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.10) 0 1px, transparent 1px 7px),
    color-mix(in srgb, var(--zone-color, #45eaff) 8%, #0b1220);
}
.pa-hq-agent {
  position: absolute;
  width: var(--pa-cell);
  height: calc(var(--pa-cell) * 2);
  transform: translateY(-35%);
  z-index: 10;
  image-rendering: pixelated;
}
.pa-hq-char {
  width: var(--pa-cell);
  height: calc(var(--pa-cell) * 2);
  background-repeat: no-repeat;
  background-size: 700% 300%;
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.35));
}
.pa-hq-agent.is-working .pa-hq-char {
  animation: paHqSpriteWalk .72s steps(4) infinite;
}
.pa-hq-agent.is-idle .pa-hq-char {
  animation: paHqSpriteIdle 2.2s ease-in-out infinite;
}
.pa-hq-bubble {
  position: absolute;
  top: calc(var(--pa-cell) * -.68);
  left: 50%;
  transform: translateX(-50%);
  min-width: calc(var(--pa-cell) * .75);
  height: calc(var(--pa-cell) * .55);
  border-radius: 5px;
  background: #fffdf4;
  color: #172033;
  font-size: calc(var(--pa-cell) * .34);
  font-family: var(--font-mono);
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
  /* Default: static. Apply .pa-hq-bubble--active for the gentle bob. */
  animation: none;
}
.pa-hq-bubble--active { animation: paHqBubbleBob 1.5s ease-in-out infinite; }
.pa-hq-agent.needs-attention .pa-hq-bubble {
  background: #ffe2e2;
  color: #7c1d1d;
}
.pa-hq-name {
  position: absolute;
  top: calc(var(--pa-cell) * 1.76);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(var(--pa-cell) * 5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 5px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(2,6,12,.88);
  color: #f8fbff;
  font-size: 9px;
  font-family: var(--font-mono);
}
.pa-hq-scan {
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 42%, color-mix(in srgb, var(--accent) 16%, transparent) 49%, transparent 56% 100%);
  mix-blend-mode: screen;
  animation: paHqScan 6s linear infinite;
  opacity: .55;
}
.pa-hq-footer {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.pa-hq-footer span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: #d7e4f4;
  background: rgba(8,18,28,.66);
  font-size: 10px;
}
.pa-hq-error {
  color: #fff;
  min-height: 160px;
  place-items: center;
}
@keyframes paHqSpriteWalk {
  from { background-position-x: 0; }
  to { background-position-x: -400%; }
}
@keyframes paHqSpriteIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
@keyframes paHqBubbleBob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -3px); }
}
@keyframes paHqScan {
  from { transform: translateX(-72%); }
  to { transform: translateX(72%); }
}
@keyframes paHqCrystalFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@media (max-width: 1380px) {
  .pa-hq-stage {
    --pa-cell: 24px;
  }
  .pa-hq-card {
    width: min(96%, 700px);
    height: min(96%, 700px);
  }
}



/* ====================================================================
   HARD-VISIBLE PIXEL AGENTS HQ EMBED
   This is static-first so the Pixel Agents integration is visible even
   before the bridge JS finishes loading.
   ==================================================================== */
.pa-permanent-layer {
  position: absolute;
  inset: 50px 20px 18px 20px;
  z-index: 7;
  pointer-events: auto;
  display: none;
  place-items: center;
}
body:not(.pixel-hq-mode) .pa-permanent-layer {
  display: none !important;
}
body.pixel-hq-mode .pa-permanent-layer {
  display: none !important;
}
body.pixel-hq-mode .hq-grid,
body.pixel-hq-mode .hq-rooms {
  opacity: .08 !important;
}
.pa-permanent-card {
  width: min(98%, 1040px);
  height: min(96%, 650px);
  min-height: 440px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--line-strong);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 36%),
    rgba(3, 7, 13, .94);
  box-shadow:
    0 20px 55px rgba(0,0,0,.58),
    0 0 42px color-mix(in srgb, var(--accent) 28%, transparent),
    inset 0 0 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.pa-permanent-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  border-bottom:1px solid rgba(255,255,255,.09);
  padding: 2px 2px 10px;
}
.pa-permanent-head strong {
  display:block;
  color:#f7fbff;
  font-size:15px;
  letter-spacing:.14em;
}
.pa-permanent-head span {
  display:block;
  color:#b9c8dc;
  font-size:11px;
  margin-top:2px;
}
.pa-permanent-badges {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.pa-permanent-badges span,
.pa-permanent-foot span {
  border:1px solid var(--line);
  background:rgba(8,18,28,.74);
  color:#e5edf8;
  border-radius:999px;
  padding:5px 8px;
  font-size:10px;
  white-space:nowrap;
}
.pa-permanent-office {
  position:relative;
  overflow:hidden;
  margin:auto;
  width:min(100%, 900px);
  height:min(100%, 500px);
  border:3px solid rgba(255,255,255,.08);
  border-radius:8px;
  background:#101827;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06), 0 0 24px rgba(0,0,0,.45);
}
.pa-px-floor {
  position:absolute;
  inset:0;
  background-image:
    url('assets/pixel-agents/floors/floor_5.png'),
    linear-gradient(135deg, rgba(255,255,255,.035) 25%, transparent 25% 50%, rgba(255,255,255,.035) 50% 75%, transparent 75%);
  background-size: 32px 32px, 64px 64px;
  opacity: .95;
}
.pa-px-furniture {
  position:absolute;
  object-fit:contain;
  image-rendering:pixelated;
  filter:drop-shadow(0 4px 0 rgba(0,0,0,.28));
  z-index:3;
}
.pa-desk-1 { left:14%; top:33%; width:96px; height:64px; }
.pa-desk-2 { left:42%; top:33%; width:96px; height:64px; }
.pa-desk-3 { left:70%; top:33%; width:96px; height:64px; }
.pa-pc-1 { left:17%; top:28%; width:42px; height:72px; }
.pa-pc-2 { left:45%; top:28%; width:42px; height:72px; }
.pa-pc-3 { left:73%; top:28%; width:42px; height:72px; }
.pa-books { left:9%; top:12%; width:80px; height:80px; }
.pa-board { right:13%; top:11%; width:80px; height:80px; }
.pa-plant { right:6%; bottom:10%; width:70px; height:110px; }
.pa-px-agent {
  position:absolute;
  z-index:6;
  width:48px;
  height:86px;
  image-rendering:pixelated;
}
.pa-agent-1 { left:20%; top:48%; }
.pa-agent-2 { left:48%; top:48%; }
.pa-agent-3 { left:76%; top:48%; }
.pa-agent-4 { left:38%; top:69%; }
.pa-px-sprite {
  width:56px;
  height:96px;
  background-repeat:no-repeat;
  background-size:700% 300%;
  background-position:0 0;
  image-rendering:pixelated;
  filter:drop-shadow(0 5px 0 rgba(0,0,0,.36));
  /* Default: frozen on the idle frame so sprites don't "flash" by walking in place.
     Apply .pa-px-agent--working to enable the walk cycle. */
  animation: none;
}
.pa-px-agent--working .pa-px-sprite { animation: paHardSpriteWalk .72s steps(4) infinite; }
.pa-px-agent--working.pa-agent-2 .pa-px-sprite { animation-duration: 1.05s; }
.pa-px-agent--working.pa-agent-3 .pa-px-sprite { animation-duration: .9s; }
.pa-px-agent--working.pa-agent-4 .pa-px-sprite { animation-duration: .78s; }
.pa-px-bubble {
  position:absolute;
  left:50%;
  top:-18px;
  transform:translateX(-50%);
  min-width:28px;
  height:20px;
  border-radius:6px;
  background:#fffdf4;
  color:#172033;
  display:grid;
  place-items:center;
  font-size:12px;
  font-family:var(--font-mono);
  font-weight:900;
  box-shadow:0 3px 0 rgba(0,0,0,.24);
  /* Default: static. Apply .pa-px-bubble--active for the gentle bob. */
  animation: none;
}
.pa-px-bubble--active { animation: paHardBubble 1.45s ease-in-out infinite; }
.pa-agent-3 .pa-px-bubble {
  background:#ffe2e2;
  color:#7c1d1d;
}
.pa-px-agent span {
  position:absolute;
  top:80px;
  left:50%;
  transform:translateX(-50%);
  max-width:90px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(2,6,12,.86);
  color:#f5fbff;
  border-radius:6px;
  padding:2px 6px;
  font-size:10px;
  font-family:var(--font-mono);
}
.pa-px-terminal {
  position:absolute;
  left:50%;
  bottom:8%;
  transform:translateX(-50%);
  z-index:5;
  width:min(70%, 460px);
  border:1px solid var(--line);
  border-radius:10px;
  background:rgba(2,8,14,.86);
  padding:10px 12px;
  box-shadow:0 0 18px color-mix(in srgb, var(--accent) 16%, transparent);
}
.pa-px-terminal b,
.pa-px-terminal span,
.pa-px-terminal em {
  display:block;
  font-family:var(--font-mono);
}
.pa-px-terminal b { color:var(--accent); font-size:12px; letter-spacing:.12em; }
.pa-px-terminal span { color:#edf6ff; font-size:11px; margin-top:4px; }
.pa-px-terminal em { color:#b9c8dc; font-size:10px; margin-top:3px; font-style:normal; }
.pa-px-scan {
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:8;
  opacity:.44;
  mix-blend-mode:screen;
  background:linear-gradient(115deg, transparent 0 42%, color-mix(in srgb, var(--accent) 22%, transparent) 49%, transparent 56% 100%);
  animation: paHardScan 5.5s linear infinite;
}
.pa-permanent-foot {
  display:flex;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
  padding-top:2px;
}
@keyframes paHardSpriteWalk {
  from { background-position-x:0; }
  to { background-position-x:-400%; }
}
@keyframes paHardBubble {
  0%,100% { transform:translate(-50%,0); }
  50% { transform:translate(-50%,-4px); }
}
@keyframes paHardScan {
  from { transform:translateX(-75%); }
  to { transform:translateX(75%); }
}
@media (max-width: 1400px) {
  .pa-permanent-office { height:440px; }
  .pa-px-sprite { width:44px; height:76px; }
  .pa-px-agent span { top:68px; }
  .pa-desk-1, .pa-desk-2, .pa-desk-3 { width:82px; height:55px; }
}

/* =========================================================
   FLOOR PLAN + WORKFLOWS (LAYOUT tab) — v3.6.1
   Added 2026-07-02: rooms grouped by floor, click to inspect;
   workflow cards with steps / rooms / agents.
   ========================================================= */
.floorplan-wrap, .workflows-wrap {
  flex: 1 1 0; overflow-y: auto; min-height: 200px;
  display: flex; flex-direction: column; gap: 8px;
  padding-right: 2px;
}
.fp-header, .wf-header {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px; margin-bottom: 4px;
}
.fp-header h4, .wf-header h4 {
  margin: 0; font-size: 11px; letter-spacing: 0.08em; color: var(--text-dim);
}
.fp-stats, .wf-stats { font-size: 9px; color: var(--text-dim); }
.fp-stats span, .wf-stats span { color: var(--accent); font-weight: 700; }
.fp-floors { display: flex; flex-direction: column; gap: 8px; }
.fp-floor { background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; padding: 6px; }
.fp-floor-head { display: flex; gap: 6px; align-items: baseline; margin-bottom: 4px; }
.fp-floor-id { font-weight: 800; color: var(--accent); font-size: 11px; letter-spacing: 0.06em; }
.fp-floor-label { font-size: 9px; color: var(--text-dim); letter-spacing: 0.04em; }
.fp-floor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.fp-room {
  background: var(--bg-3); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px; padding: 4px 5px; cursor: pointer;
  transition: border-color 120ms, transform 80ms;
  outline: none;
  display: grid; grid-template-columns: 32px 1fr; gap: 6px; align-items: center;
}
.fp-room:hover, .fp-room:focus { border-color: var(--accent); transform: translateY(-1px); }
.fp-room-portrait {
  width: 32px; height: 32px; border-radius: 3px;
  background-size: cover; background-position: center; background-color: var(--bg-2);
  border: 1px solid var(--border);
  image-rendering: pixelated;
}
.fp-room-portrait-empty {
  background-image: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
}
.fp-room-body { min-width: 0; }
.fp-room-name { font-size: 10px; font-weight: 700; color: var(--text); letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-room-agent { font-size: 8.5px; color: var(--accent); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-room-meta { font-size: 8px; color: var(--text-dim); margin-top: 1px; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-accent-gold   { border-left-color: #FFD24A; }
.fp-accent-green  { border-left-color: #4ADE80; }
.fp-accent-cyan   { border-left-color: #22D3EE; }
.fp-accent-violet { border-left-color: #A78BFA; }
.fp-accent-red    { border-left-color: #F87171; }
.fp-accent-amber  { border-left-color: #FBBF24; }
.fp-accent-orange { border-left-color: #FB923C; }
.fp-accent-yellow { border-left-color: #FACC15; }
.fp-accent-pink   { border-left-color: #F472B6; }
.fp-accent-teal   { border-left-color: #2DD4BF; }
.fp-accent-blue   { border-left-color: #60A5FA; }
.fp-accent-lime   { border-left-color: #A3E635; }
.fp-accent-grey   { border-left-color: #94A3B8; }
.fp-accent-white  { border-left-color: #E2E8F0; }
.fp-selected {
  background: var(--bg-2); border: 1px solid var(--accent);
  border-radius: 4px; padding: 8px; margin-top: 6px;
}
.fp-sel-portrait {
  width: 100%; height: 88px; border-radius: 3px;
  background-size: cover; background-position: center;
  background-color: var(--bg-3);
  margin-bottom: 6px;
  image-rendering: pixelated;
  border: 1px solid var(--border);
}
.fp-selected h4 { margin: 0 0 4px; font-size: 10px; letter-spacing: 0.06em; color: var(--accent); }
.fp-selected-card { display: flex; flex-direction: column; gap: 4px; }
.fp-sel-head { display: flex; gap: 6px; align-items: baseline; }
.fp-sel-floor { font-size: 10px; color: var(--accent); font-weight: 800; }
.fp-sel-name { font-size: 12px; font-weight: 800; color: var(--text); }
.fp-sel-acc { font-size: 8.5px; color: var(--text-dim); letter-spacing: 0.04em; }
.fp-sel-desc { font-size: 9.5px; color: var(--text); line-height: 1.4; }
.fp-sel-row { display: flex; gap: 6px; font-size: 9px; align-items: flex-start; }
.fp-sel-label { color: var(--text-dim); min-width: 64px; font-weight: 700; letter-spacing: 0.04em; }
.fp-sel-val { color: var(--text); flex: 1 1 auto; }
.fp-wf-chip, .fp-tool, .wf-room-chip, .wf-agent-chip {
  display: inline-block; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 4px; margin: 1px 2px 1px 0;
  font-size: 8.5px; color: var(--text);
}
.fp-step-line { font-size: 8.5px; color: var(--text); line-height: 1.4; margin-top: 1px; }
.fp-step-line b { color: var(--accent); }

.workflows-wrap { gap: 8px; }
.wf-list { display: flex; flex-direction: column; gap: 8px; }
.wf-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.wf-card-head { display: flex; align-items: baseline; gap: 6px; justify-content: space-between; }
.wf-name { margin: 0; font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: 0.04em; }
.wf-badge { font-size: 7.5px; padding: 1px 4px; border-radius: 2px; letter-spacing: 0.04em; font-weight: 700; }
.wf-badge-approval { background: rgba(251, 191, 36, 0.18); color: #FBBF24; border: 1px solid #FBBF24; }
.wf-badge-auto { background: rgba(74, 222, 128, 0.18); color: #4ADE80; border: 1px solid #4ADE80; }
.wf-goal { font-size: 9.5px; color: var(--text); line-height: 1.4; }
.wf-stats-line { display: flex; gap: 10px; font-size: 8.5px; color: var(--text-dim); }
.wf-stats-line b { color: var(--accent); font-size: 10px; }
.wf-steps { font-size: 9px; }
.wf-steps summary { cursor: pointer; color: var(--accent); font-weight: 700; letter-spacing: 0.05em; padding: 2px 0; }
.wf-step-list { list-style: none; padding: 4px 0 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.wf-step { display: flex; gap: 6px; align-items: flex-start; }
.wf-step-num {
  flex: 0 0 18px; height: 18px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--accent); font-weight: 800;
}
.wf-step-body { flex: 1 1 auto; }
.wf-step-title-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wf-step-name { font-size: 10px; color: var(--text); font-weight: 700; }
.wf-step-sub { font-size: 8.5px; color: var(--accent); font-style: italic; }
.wf-step-action { font-size: 8.5px; color: var(--text-dim); line-height: 1.4; }
.wf-step-meta { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.wf-tool-chip { font-size: 8px; padding: 1px 4px; border-radius: 2px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.wf-tool-codex { background: #1e1e3a; color: #7dd3fc; border: 1px solid #2d2d5a; }
.wf-tool-printify { background: #1a3a1e; color: #86efac; border: 1px solid #2d5a2d; }
.wf-tool-etsy { background: #3a2a1a; color: #fbbf24; border: 1px solid #5a3a1a; }
.wf-step-gate { color: #f87171; font-size: 10px; }
.wf-step-auto { color: #86efac; font-size: 10px; }
.wf-step-codex { background: #0d0d1a; color: #a3a3c2; font-family: 'Consolas','Menlo',monospace; font-size: 8px; padding: 3px 5px; border-radius: 2px; margin-top: 3px; border-left: 2px solid #2d2d5a; white-space: pre-wrap; word-break: break-word; }
.wf-codex-label { color: #7dd3fc; font-weight: 700; }
.wf-output-chip { font-size: 8px; padding: 1px 4px; background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--border); border-radius: 2px; }
.wf-meta-label { font-size: 7.5px; color: var(--text-dim); letter-spacing: 0.04em; margin-right: 2px; font-weight: 700; }
.wf-rooms-row { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; padding-top: 4px; border-top: 1px dashed var(--border); margin-top: 2px; }


/* ====================================================================
   CHAT PANEL  2026-07-03 v4
   Replaces the legacy 1-line command center with a real thread panel.
   ==================================================================== */
.bottom-bar { grid-template-columns: 1fr; min-height: 100px; }
.command-center.chat-panel {
  display: flex; flex-direction: column;
  padding: 8px 10px; min-height: 100px; max-height: 100%;
  height: 100%;
  gap: 6px;
  position: relative;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 4px;
}
.chat-head-tools { display: flex; align-items: center; gap: 4px; }
.chat-mode-pill {
  font-size: 8px; letter-spacing: .12em; padding: 2px 6px;
  background: var(--bg-2); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 3px;
  font-family: var(--font-mono);
}
.chat-mode-pill[data-mode="ollama"] { color: var(--green); border-color: var(--green); }
.chat-mode-pill[data-mode="mock"]   { color: var(--cyan); border-color: var(--cyan); }
.btn-clear-chat, .btn-toggle-presets { font-size: 9px; padding: 2px 6px; }
.chat-presets-row {
  display: none;
  gap: 4px; align-items: center;
  padding: 2px 0;
  border-bottom: 1px dashed var(--line);
}
.chat-presets-row.is-open { display: flex; }
.chat-presets-row .preset-chips { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.chat-thread {
  flex: 1 1 auto; min-height: 0; max-height: 60px;
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg-0);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.chat-thread::-webkit-scrollbar { width: 6px; }
.chat-thread::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.chat-empty {
  color: var(--text-mute);
  text-align: left;
  padding: 6px 4px;
  line-height: 1.5;
}
.chat-empty code {
  background: var(--bg-2); padding: 1px 4px; border-radius: 2px;
  color: var(--accent); font-family: var(--font-mono);
}
.chat-msg { display: flex; flex-direction: column; margin: 4px 0; }
.chat-msg .chat-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.chat-msg .chat-meta { font-size: 9px; color: var(--text-mute); }
.chat-msg .chat-sender {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.chat-msg .chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-msg .chat-text code { color: var(--accent); background: var(--bg-2); padding: 0 3px; border-radius: 2px; }
.chat-msg.kind-user .chat-sender { color: var(--cyan); border-color: var(--cyan); }
.chat-msg.kind-user .chat-text { color: var(--text); }
.chat-msg.kind-reply .chat-sender { color: var(--accent); border-color: var(--accent); }
.chat-msg.kind-reply .chat-text { color: var(--text); }
.chat-msg.kind-system .chat-sender { color: var(--text-mute); border-color: var(--line); }
.chat-msg.kind-system .chat-text { color: var(--text-dim); font-style: italic; }
.chat-msg.kind-command .chat-sender { color: #b78aff; border-color: #b78aff; }
.chat-msg.kind-error .chat-sender { color: #ff5470; border-color: #ff5470; }
.chat-msg.kind-error .chat-text { color: #ff5470; }
.chat-msg.kind-tool .chat-sender { color: var(--green); border-color: var(--green); }
.chat-msg.is-pending .chat-text { color: var(--text-mute); }
.chat-msg.is-pending .chat-text::after {
  content: ' ▌'; animation: chat-blink 1s steps(1) infinite;
  color: var(--accent);
}
@keyframes chat-blink { 50% { opacity: 0; } }
.chat-input-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  flex-shrink: 0;
}
.chat-input-prefix {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--cyan);
  padding: 4px 6px;
  background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 3px;
  cursor: pointer;
  user-select: none;
  min-width: 70px; flex-shrink: 0; text-align: center;
}
.chat-input-prefix:hover { border-color: var(--cyan); }
.chat-input-row input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: 6px 10px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-suggest {
  position: absolute; left: 10px; right: 10px; bottom: 48px;
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 4px; padding: 4px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
  z-index: 50; max-height: 200px; overflow-y: auto;
}
.chat-suggest-item {
  padding: 4px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
  display: flex; gap: 8px; align-items: baseline;
}
.chat-suggest-item:hover, .chat-suggest-item.is-active { background: var(--bg-2); }
.chat-suggest-item .si-cmd { color: var(--accent); font-weight: 700; min-width: 70px; }
.chat-suggest-item .si-help { color: var(--text-mute); font-size: 10px; }
.chat-actions {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
  padding: 4px 0; border-top: 1px dashed var(--line);
}
.chat-action {
  font-size: 9px; padding: 2px 8px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 3px;
  font-family: var(--font-mono);
}
.chat-action:hover { background: var(--accent); color: var(--bg-0); }

/* ====================================================================
   PHONE VIEW OVERRIDE 2026-07-03
   Forces the live LAN dashboard into a stacked iPhone layout. This block is
   intentionally last so it beats the desktop workstation rules above.
   ==================================================================== */
@media (max-width: 820px) {
  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: #02070c !important;
  }

  .app-shell-v2 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 100svh !important;
    height: auto !important;
    overflow: visible !important;
  }

  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 120 !important;
    min-height: 54px !important;
    height: auto !important;
    padding: 8px 10px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }
  .topbar-left,
  .topbar-right {
    width: 100% !important;
    gap: 8px !important;
    justify-content: space-between !important;
  }
  .brand-text strong { font-size: 11px !important; }
  .brand-text span,
  .status-pills,
  .mode-switch,
  .win-version {
    display: none !important;
  }
  .view-toggle { flex: 1 1 auto !important; }
  .view-toggle-btn,
  .win-btn { min-height: 34px !important; }

  .hq-view {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 8px !important;
    gap: 8px !important;
  }
  .center-col,
  .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .center-col {
    order: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding-bottom: 120px !important;
  }
  .sidebar-left { order: 2 !important; }
  .sidebar-right { order: 3 !important; }

  .hero-toolbar,
  .hero-modes {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .hero-title h2 {
    font-size: 11px !important;
    white-space: normal !important;
  }
  .hero-subtitle { display: block !important; }
  .hero-hq,
  .hq-scene {
    min-height: 360px !important;
    height: auto !important;
    width: 100% !important;
  }
  .hq-scene {
    background-size: contain !important;
    background-position: center top !important;
    overflow: hidden !important;
  }

  .pa-permanent-layer {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    padding: 6px !important;
  }
  .pa-permanent-card {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 300px !important;
  }
  .pa-permanent-office {
    min-height: 240px !important;
    transform: scale(.72) !important;
    transform-origin: top left !important;
    width: 138% !important;
  }

  .mid-row,
  .bottom-strip,
  .bottom-bar,
  .kpi-grid,
  .world-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .bottom-bar,
  .bottom-bar .command-center {
    min-height: 260px !important;
    max-height: none !important;
  }
  .panel,
  .card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .sidebar-right [data-tab-panel] {
    display: block !important;
  }
  .sidebar-right [data-tab-panel="layout"],
  .rs-tabs,
  .panel-worlds,
  .floorplan-wrap,
  .workflows-wrap {
    display: none !important;
  }

  .workspace-strip {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 8px 8px 108px !important;
  }
  .workspace-strip select,
  .workspace-strip input,
  .btn {
    max-width: 100% !important;
    min-height: 34px !important;
  }

  .framework-dock {
    left: 6px !important;
    right: 6px !important;
    bottom: 6px !important;
    padding: 6px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    align-items: flex-start !important;
  }
  .fd-left,
  .fd-right {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .fd-btn,
  .framework-dock select {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    max-width: 160px !important;
    font-size: 9px !important;
  }

  .builder-view,
  .builder-shell,
  .builder-layout {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
  }
  .builder-shell,
  .builder-layout {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* === OPPORTUNITY WATCHER (Midas / Scout / Research Agent) — 2026-07-04 === */
.opps-watcher-row {
  display: flex; align-items: center; gap: 6px;
  padding: 0 0 1px; border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  flex: 0 0 18px; min-height: 18px; max-height: 18px; line-height: 12px;
}
.opps-watcher-badge {
  flex: 1 1 auto; min-width: 0;
  font-size: 9px; line-height: 1.3;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 6px; border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.02);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opps-watcher-badge.online  { color: var(--green); border-color: rgba(0,255,136,0.35); background: rgba(0,255,136,0.08); }
.opps-watcher-badge.offline { color: #ff5470; border-color: rgba(255,84,112,0.35); background: rgba(255,84,112,0.08); }
.opps-run-btn {
  flex: 0 0 auto;
  font-size: 9px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  width: 22px; height: 22px; padding: 0;
  background: var(--bg-panel); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 3px;
  cursor: pointer; transition: all 0.15s ease;
}
.opps-run-btn:hover  { background: var(--accent); color: var(--bg); }
.opps-run-btn:active { transform: scale(0.92); }
.opps-run-btn:disabled { opacity: 0.5; cursor: wait; }

/* ====================================================================
   DESKTOP LAYOUT REPAIR 2026-07-05
   Social-manager compact rules hid the Layout panel and old Floor/Workflow
   blocks could override the hidden attribute. Keep the visible tab set clean.
   ==================================================================== */
.panel-worlds .floorplan-wrap[hidden],
.panel-worlds .workflows-wrap[hidden] {
  display: none !important;
}

@media (min-width: 821px) {
  .sidebar-right .panel-worlds[data-tab-panel="layout"] {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 220px;
    overflow: hidden;
  }

  .sidebar-right .panel-worlds .world-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow-y: auto;
    min-height: 120px;
    flex: 1 1 auto;
  }

  .sidebar-right .panel-worlds .world-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 0 0 auto;
    padding-top: 8px;
  }

  .sidebar-right .worlds-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
  }

  .sidebar-right .wt-tab {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
  }
}

/* ====================================================================
   RIGHT RAIL REFERENCE LAYOUT 2026-07-05
   Match the supplied Financial Dashboard / Budget & Ledger references:
   vertical scroll stack, full cards, no forced 92px/108px compression.
   ==================================================================== */
@media (min-width: 821px) {
  .sidebar.sidebar-right {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding-right: 8px !important;
    padding-bottom: 82px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .sidebar-right .panel {
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }

  .sidebar-right .panel-revenue {
    display: flex !important;
    flex-direction: column !important;
    min-height: 552px !important;
    padding: 10px 12px !important;
    border-radius: 7px !important;
  }

  .sidebar-right .panel-revenue .panel-header,
  .sidebar-right .panel-budget .panel-header,
  .sidebar-right .panel-opps .panel-header {
    min-height: 28px !important;
    margin-bottom: 10px !important;
    padding: 0 !important;
    align-items: center !important;
  }

  .sidebar-right .panel-revenue .panel-header h3,
  .sidebar-right .panel-budget .panel-header h3,
  .sidebar-right .panel-opps .panel-header h3 {
    font-size: 11px !important;
    line-height: 1.2 !important;
    letter-spacing: .12em !important;
  }

  .fin-hero {
    display: grid !important;
    grid-template-columns: 1.12fr .9fr !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
    min-height: 134px !important;
  }

  .fin-hero-main,
  .fin-chart-card,
  .fin-kpi,
  .fin-split,
  .budget-mini-card {
    border: 1px solid rgba(65,255,103,.17) !important;
    border-radius: 8px !important;
    background: rgba(6, 12, 20, .72) !important;
  }

  .fin-hero-main {
    min-height: 134px !important;
    padding: 18px 14px !important;
  }

  .fin-chart-card {
    min-height: 134px !important;
    padding: 10px !important;
    background:
      linear-gradient(180deg, rgba(251,161,11,.62), rgba(251,161,11,.10) 72%, rgba(6,12,20,.72)) !important;
  }

  .fin-chart { height: 108px !important; }
  .fin-overline { font-size: 10px !important; color: #b8c7dc !important; }
  .fin-hero-value { font-size: 24px !important; }
  .fin-hero-meta { font-size: 10px !important; }

  .fin-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .fin-kpi {
    min-height: 80px !important;
    padding: 11px 12px !important;
  }

  .fin-kpi span,
  .fin-section-title {
    font-size: 10px !important;
    letter-spacing: .13em !important;
  }

  .fin-kpi strong { font-size: 16px !important; }
  .fin-kpi em { font-size: 10px !important; }

  .fin-bottom {
    display: grid !important;
    grid-template-columns: 1.05fr .95fr !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
  }

  .fin-split {
    min-height: 168px !important;
    padding: 11px 12px !important;
  }

  .fin-channel {
    grid-template-columns: 72px minmax(34px, 1fr) 28px !important;
    gap: 7px !important;
    margin-bottom: 7px !important;
  }

  .fin-channel label,
  .fin-health-row {
    font-size: 11px !important;
  }

  .fin-health-row {
    padding: 6px 0 !important;
  }

  .sidebar-right .panel-budget {
    display: flex !important;
    flex-direction: column !important;
    min-height: 328px !important;
    padding: 10px 12px !important;
    border-radius: 7px !important;
  }

  .sidebar-right .panel-budget .budget-model-bar {
    position: relative !important;
    top: auto !important;
    order: 0 !important;
    margin: 0 0 8px !important;
    padding: 6px 8px !important;
    min-height: 32px !important;
    border-radius: 4px !important;
  }

  .sidebar-right .panel-budget .budget-model-bar label {
    font-size: 9px !important;
  }

  .sidebar-right .panel-budget .budget-model-bar select {
    min-height: 26px !important;
    font-size: 10px !important;
  }

  .sidebar-right .panel-budget .budget-visual-summary {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .budget-insight-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .budget-mini-card {
    min-height: 74px !important;
    padding: 10px 11px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 5px !important;
  }

  .budget-mini-card span {
    font-size: 9px !important;
    letter-spacing: .12em !important;
  }

  .budget-mini-card strong {
    font-size: 14px !important;
  }

  .budget-mini-card em {
    font-size: 9px !important;
  }

  .budget-meter {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .budget-meter-row {
    display: grid !important;
    grid-template-columns: 42px 1fr 32px !important;
    gap: 7px !important;
    align-items: center !important;
    font-size: 10px !important;
  }

  .budget-track {
    height: 8px !important;
  }

  .sidebar-right .panel-budget .budget-settings {
    display: block !important;
    margin-top: 8px !important;
  }

  .sidebar-right .panel-budget .budget-settings:not([open]) {
    min-height: 28px !important;
  }

  .sidebar-right .panel-budget .budget-settings summary {
    text-align: center !important;
    color: #ffae35 !important;
    font-size: 10px !important;
  }

  .sidebar-right .panel-opps {
    display: flex !important;
    flex-direction: column !important;
    min-height: 170px !important;
    padding: 9px 10px !important;
    border-radius: 7px !important;
    overflow: hidden !important;
  }

  .sidebar-right .panel-opps .opps-source-row,
  .sidebar-right .panel-opps .opps-watcher-row {
    display: flex !important;
  }

  .sidebar-right .panel-opps .opps-watcher-row {
    flex: 0 0 auto !important;
    min-height: 22px !important;
    max-height: none !important;
    margin-bottom: 6px !important;
  }

  .sidebar-right .panel-opps .opp-list {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .sidebar-right .panel-opps .opp-list li {
    min-height: 30px !important;
    padding: 5px 6px !important;
  }

  .sidebar-right .panel-opps .opp-row-top .opp-title {
    font-size: 11px !important;
  }

  .sidebar-right .panel-opps .opp-list .opp-footer {
    position: static !important;
    height: 22px !important;
    margin-top: 4px !important;
  }

  .sidebar-right .panel-opps .opp-list .opp-footer .panel-link {
    line-height: 22px !important;
    font-size: 9px !important;
  }

  .sidebar-right .panel-opps > #openSocialManager {
    display: inline-block !important;
    margin-top: 6px !important;
    font-size: 9px !important;
  }
}

/* ====================================================================
   LAYOUT AUDIT GUARDS 2026-07-05
   Final non-visual cleanup after the right rail was accepted as stable.
   ==================================================================== */
@media (min-width: 821px) {
  .app-shell-v2 {
    min-width: 1180px;
  }

  .framework-dock {
    flex: 0 0 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .framework-dock .fd-left,
  .framework-dock .fd-right {
    flex-wrap: nowrap !important;
  }

  .workspace-strip {
    flex: 0 0 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }

  .center-col {
    min-width: 0 !important;
  }
}

/* ====================================================================
   CENTER MODULE REPAIR 2026-07-05
   Mission Control / Approval Queue / Quick Launch need real height and
   the center stack has five visible modules, including terminal output.
   ==================================================================== */
@media (min-width: 821px) {
  .center-col {
    grid-template-rows:
      minmax(360px, 1fr)
      minmax(166px, auto)
      minmax(78px, auto)
      minmax(220px, auto)
      minmax(112px, auto) !important;
    gap: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    padding-bottom: 8px !important;
  }

  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: 360px !important;
    max-height: none !important;
  }

  .center-col > .mid-row {
    min-height: 166px !important;
    max-height: none !important;
    flex: 0 0 auto !important;
  }

  body[data-hq-visual-size="xl"] .center-col > .mid-row {
    min-height: 166px !important;
    max-height: none !important;
  }

  .mid-row {
    display: grid !important;
    grid-template-columns: minmax(360px, 1.25fr) minmax(300px, .88fr) minmax(280px, .82fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
    overflow: visible !important;
  }

  .card-mission,
  .card-approvals,
  .card-launch {
    min-height: 166px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .card-mission .card-head,
  .card-approvals .card-head,
  .card-launch .card-head {
    min-height: 32px !important;
    padding: 7px 10px !important;
    flex: 0 0 auto !important;
  }

  .card-mission .card-body,
  .card-approvals .card-body,
  .card-launch {
    min-height: 0 !important;
  }

  .card-mission .card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 9px !important;
    padding: 10px !important;
  }

  .mission-active,
  .mission-progress,
  .mission-pipeline,
  .mission-meta {
    margin: 0 !important;
  }

  .mission-active strong {
    font-size: 13px !important;
    line-height: 1.25 !important;
  }

  .mission-progress {
    gap: 8px !important;
  }

  .mission-pipeline {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  .mission-pipeline li {
    min-width: 0 !important;
    min-height: 27px !important;
    padding: 6px 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    white-space: nowrap !important;
  }

  .mission-meta {
    margin-top: auto !important;
    gap: 12px !important;
  }

  .approval-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .approval-list li {
    min-height: 34px !important;
    margin-bottom: 0 !important;
    grid-template-columns: minmax(0, 1fr) 24px 24px !important;
  }

  .approval-empty {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-height: 58px !important;
  }

  .card-launch {
    padding-bottom: 9px !important;
  }

  .card-launch .launch-icons {
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 9px 9px 0 !important;
    margin: 0 !important;
  }

  .launch-icon {
    min-height: 72px !important;
    padding: 10px 6px !important;
    border-radius: 6px !important;
  }

  .li-glyph {
    font-size: 19px !important;
    line-height: 1 !important;
  }

  .li-label {
    font-size: 9px !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }

  .card-launch .btn-launch {
    min-height: 32px !important;
    margin: 9px 9px 0 !important;
    padding: 8px 10px !important;
    flex: 0 0 auto !important;
  }

  .center-col > .bottom-strip {
    min-height: 78px !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
  }

  .center-col > .bottom-bar {
    min-height: 220px !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
  }

  .terminal-pane {
    display: flex !important;
    min-height: 112px !important;
    max-height: none !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
}

/* ====================================================================
   COMMAND CENTER CONTROL SURFACE 2026-07-05
   Hide System Activity and make Command Center the primary agent control.
   ==================================================================== */
@media (min-width: 821px) {
  .center-col {
    grid-template-rows:
      minmax(520px, 1fr)
      minmax(150px, auto)
      minmax(260px, auto) !important;
  }

  .bottom-strip,
  .center-col > .bottom-strip,
  .panel-activity {
    display: none !important;
    min-height: 0 !important;
    max-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  .center-col > .bottom-bar {
    order: 2 !important;
    min-height: 260px !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .bottom-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    min-height: 260px !important;
  }

  .command-center.chat-panel {
    min-height: 260px !important;
    padding: 10px 12px !important;
    gap: 8px !important;
    border-color: rgba(124,255,59,.34) !important;
    background: rgba(5, 10, 18, .86) !important;
  }

  .chat-head {
    min-height: 30px !important;
    padding-bottom: 6px !important;
  }

  .chat-head .cc-label {
    min-width: auto !important;
    font-size: 10px !important;
    color: var(--text) !important;
  }

  .chat-agent-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 0 0 6px !important;
    border-bottom: 1px dashed var(--line) !important;
  }

  .chat-agent-chip {
    min-height: 24px !important;
    padding: 4px 9px !important;
    border: 1px solid var(--line) !important;
    border-radius: 4px !important;
    background: rgba(0,0,0,.28) !important;
    color: var(--text-dim) !important;
    font-family: var(--font-mono) !important;
    font-size: 10px !important;
    letter-spacing: .04em !important;
    cursor: pointer !important;
  }

  .chat-agent-chip:hover,
  .chat-agent-chip.is-active {
    color: var(--bg-0) !important;
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 10px rgba(124,255,59,.28) !important;
  }

  .chat-thread {
    min-height: 130px !important;
    max-height: none !important;
    padding: 9px 10px !important;
    font-size: 11.5px !important;
    line-height: 1.5 !important;
  }

  .chat-empty {
    padding: 8px 6px !important;
  }

  .chat-input-row {
    gap: 8px !important;
  }

  .chat-input-prefix {
    min-width: 82px !important;
    min-height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .chat-input-row input {
    min-height: 34px !important;
    font-size: 12px !important;
  }

  .chat-input-row .btn-execute {
    min-height: 34px !important;
    min-width: 72px !important;
  }

  .chat-suggest {
    bottom: 50px !important;
  }
}

/* ====================================================================
   COMMAND CENTER COMPACT RESTORE 2026-07-05
   Keep agent control available without blocking the Worlds/HQ focal panel
   or the bottom workspace menus.
   ==================================================================== */
@media (min-width: 821px) {
  .center-col {
    grid-template-rows:
      minmax(560px, 1fr)
      minmax(142px, auto)
      minmax(136px, auto) !important;
    gap: 8px !important;
    overflow-y: auto !important;
    padding-bottom: 8px !important;
  }

  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(560px, 68vh, 790px) !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(490px, 60vh, 720px) !important;
  }

  .center-col > .mid-row {
    order: 1 !important;
    min-height: 142px !important;
  }

  .card-mission,
  .card-approvals,
  .card-launch {
    min-height: 142px !important;
  }

  .center-col > .bottom-bar {
    order: 2 !important;
    min-height: 136px !important;
    max-height: 150px !important;
    overflow: hidden !important;
  }

  .bottom-bar {
    min-height: 136px !important;
    max-height: 150px !important;
  }

  .command-center.chat-panel {
    min-height: 136px !important;
    max-height: 150px !important;
    padding: 7px 9px !important;
    gap: 5px !important;
    overflow: hidden !important;
  }

  .chat-head {
    min-height: 24px !important;
    padding-bottom: 4px !important;
  }

  .chat-head-tools {
    gap: 4px !important;
  }

  .chat-agent-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 5px !important;
    padding: 0 0 4px !important;
    scrollbar-width: thin !important;
  }

  .chat-agent-chip {
    flex: 0 0 auto !important;
    min-height: 22px !important;
    padding: 3px 7px !important;
    font-size: 9px !important;
  }

  .chat-thread {
    min-height: 42px !important;
    max-height: 54px !important;
    padding: 5px 7px !important;
    font-size: 10.5px !important;
    line-height: 1.35 !important;
  }

  .chat-empty {
    padding: 3px 2px !important;
    line-height: 1.35 !important;
  }

  .chat-input-row {
    gap: 6px !important;
  }

  .chat-input-prefix,
  .chat-input-row input,
  .chat-input-row .btn-execute {
    min-height: 28px !important;
  }

  .chat-input-prefix {
    min-width: 76px !important;
    padding: 3px 5px !important;
  }

  .chat-input-row input {
    padding: 5px 8px !important;
  }

  .chat-input-row .btn-execute {
    min-width: 64px !important;
    padding: 5px 9px !important;
  }

  .chat-suggest {
    bottom: 40px !important;
  }

  .workspace-strip {
    position: relative !important;
    z-index: 30 !important;
  }
}

@media (min-width: 821px) and (max-width: 1420px) {
  .mid-row {
    grid-template-columns: minmax(330px, 1.18fr) minmax(260px, .86fr) minmax(250px, .8fr) !important;
  }

  .mission-pipeline li {
    font-size: 8px !important;
    letter-spacing: .03em !important;
  }
}

/* ====================================================================
   WORLDS FOCAL POINT RESTORE 2026-07-05
   Hide terminal output and give the live Worlds/HQ section priority.
   Lower modules stay underneath the focal panel instead of covering it.
   ==================================================================== */
@media (min-width: 821px) {
  .center-col {
    grid-template-rows:
      minmax(520px, 1fr)
      minmax(150px, auto)
      minmax(76px, auto)
      minmax(180px, auto) !important;
    gap: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-content: start !important;
  }

  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(520px, 64vh, 760px) !important;
    max-height: none !important;
    order: 0 !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(450px, 56vh, 690px) !important;
  }

  .pa-permanent-layer {
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 14px !important;
  }

  .pa-permanent-card {
    width: min(100%, 980px) !important;
    max-height: none !important;
  }

  .pa-permanent-office {
    min-height: clamp(360px, 47vh, 560px) !important;
  }

  .center-col > .mid-row {
    order: 1 !important;
    min-height: 150px !important;
  }

  .card-mission,
  .card-approvals,
  .card-launch {
    min-height: 150px !important;
  }

  .launch-icon {
    min-height: 62px !important;
  }

  .center-col > .bottom-strip {
    order: 2 !important;
    min-height: 76px !important;
  }

  .center-col > .bottom-bar {
    order: 3 !important;
    min-height: 180px !important;
  }

  .terminal-pane,
  .center-col > .terminal-pane {
    display: none !important;
    min-height: 0 !important;
    max-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}

/* ====================================================================
   FINAL STACK ORDER REPAIR 2026-07-05
   Authoritative end-of-file override: Worlds/HQ, then mission modules,
   then compact Command Center. Also restores right-rail Layout tab hiding.
   ==================================================================== */
@media (min-width: 821px) {
  .center-col {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    padding-bottom: 8px !important;
  }

  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    order: 0 !important;
    flex: 0 0 auto !important;
    min-height: clamp(470px, 58vh, 690px) !important;
    max-height: none !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(405px, 51vh, 620px) !important;
  }

  .pa-permanent-card {
    width: min(100%, 980px) !important;
  }

  .pa-permanent-office {
    min-height: clamp(315px, 40vh, 500px) !important;
  }

  .center-col > .mid-row {
    order: 1 !important;
    flex: 0 0 auto !important;
    min-height: 150px !important;
    max-height: none !important;
    display: grid !important;
    grid-template-columns: minmax(360px, 1.25fr) minmax(300px, .88fr) minmax(280px, .82fr) !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  .card-mission,
  .card-approvals,
  .card-launch {
    min-height: 150px !important;
    max-height: none !important;
  }

  .bottom-strip,
  .center-col > .bottom-strip,
  .panel-activity,
  .terminal-pane,
  .center-col > .terminal-pane {
    display: none !important;
    min-height: 0 !important;
    max-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  .center-col > .bottom-bar {
    order: 2 !important;
    flex: 0 0 132px !important;
    min-height: 132px !important;
    max-height: 140px !important;
    overflow: hidden !important;
  }

  .bottom-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    min-height: 132px !important;
    max-height: 140px !important;
    overflow: hidden !important;
  }

  .command-center.chat-panel {
    min-height: 132px !important;
    max-height: 140px !important;
    padding: 7px 9px !important;
    gap: 5px !important;
    overflow: hidden !important;
  }

  .chat-agent-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 5px !important;
    padding: 0 0 3px !important;
  }

  .chat-thread {
    min-height: 38px !important;
    max-height: 48px !important;
    overflow-y: auto !important;
    padding: 5px 7px !important;
  }

  .chat-input-prefix,
  .chat-input-row input,
  .chat-input-row .btn-execute {
    min-height: 28px !important;
  }

  .workspace-strip {
    position: relative !important;
    z-index: 50 !important;
  }

  .sidebar-right [data-tab-panel][style*="display: none"] {
    display: none !important;
  }

  /* desktop sidebar: force flex on ALL visible tab panels.
     The sidebar is display:flex column with fixed-height children that use
     flex:0 0 Xpx; that only works when the children are also flex containers
     themselves. The financials-tab panels (revenue/budget/cashflow/opps) and
     the layout-tab panel (panelWorlds) both need display:flex; the
     [style*="display: none"] carve-out handles inactive panels. */
  .sidebar-right [data-tab-panel]:not([style*="display: none"]) {
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar-right .panel-worlds[data-tab-panel="layout"]:not([style*="display: none"]) {
    flex-direction: column !important;
    min-height: 460px !important;
    padding: 10px 12px !important;
    overflow: visible !important;
  }

  .sidebar-right .panel-worlds .world-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .sidebar-right .panel-worlds .world-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

@media (min-width: 821px) and (max-height: 860px) {
  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(410px, 52vh, 610px) !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(345px, 45vh, 545px) !important;
  }
}

/* ====================================================================
   GENTLE SIZE TUNE 2026-07-05
   Small non-structural adjustment: Worlds/HQ and Command Center slightly
   taller without changing stack order or restoring hidden panels.
   ==================================================================== */
@media (min-width: 821px) {
  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(495px, 60vh, 715px) !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(428px, 53vh, 645px) !important;
  }

  .pa-permanent-office {
    min-height: clamp(335px, 42vh, 520px) !important;
  }

  .center-col > .bottom-bar {
    flex-basis: 150px !important;
    min-height: 150px !important;
    max-height: 158px !important;
  }

  .bottom-bar,
  .command-center.chat-panel {
    min-height: 150px !important;
    max-height: 158px !important;
  }

  .chat-thread {
    min-height: 48px !important;
    max-height: 58px !important;
  }
}

@media (min-width: 821px) and (max-height: 860px) {
  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(430px, 54vh, 625px) !important;
  }

  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(365px, 47vh, 560px) !important;
  }
}

/* ====================================================================
   COMMAND CENTER DROPDOWN + EXPAND 2026-07-05
   Replace agent chip row with a compact selector and opt-in larger chat.
   ==================================================================== */
@media (min-width: 821px) {
  .chat-agent-bar {
    display: none !important;
  }

  .chat-head {
    gap: 8px !important;
  }

  .chat-head-tools {
    flex: 0 0 auto !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
  }

  .chat-agent-select {
    height: 24px !important;
    max-width: 112px !important;
    background: var(--bg-2) !important;
    border: 1px solid var(--line) !important;
    color: var(--text) !important;
    border-radius: 4px !important;
    font-family: var(--font-mono) !important;
    font-size: 9px !important;
    padding: 2px 6px !important;
    outline: none !important;
  }

  .chat-agent-select:focus {
    border-color: var(--accent) !important;
  }

  .btn-expand-chat {
    height: 24px !important;
    padding: 2px 7px !important;
    font-size: 9px !important;
  }

  .center-col > .bottom-bar {
    flex-basis: 126px !important;
    min-height: 126px !important;
    max-height: 134px !important;
  }

  .bottom-bar,
  .command-center.chat-panel {
    min-height: 126px !important;
    max-height: 134px !important;
  }

  .command-center.chat-panel {
    padding: 7px 9px !important;
  }

  .chat-thread {
    min-height: 44px !important;
    max-height: 52px !important;
  }

  body.chat-expanded .center-col > .bottom-bar {
    flex-basis: 260px !important;
    min-height: 260px !important;
    max-height: 280px !important;
  }

  body.chat-expanded .bottom-bar,
  body.chat-expanded .command-center.chat-panel {
    min-height: 260px !important;
    max-height: 280px !important;
  }

  body.chat-expanded .chat-thread {
    min-height: 164px !important;
    max-height: 184px !important;
  }
}

/* ====================================================================
   HQ IMAGE FIT + CONTROL COLOR TUNE 2026-07-05
   Keep world image fully visible, especially in XL, and style the new
   Command Center controls to match the N.O.S. green/cyan system.
   ==================================================================== */
@media (min-width: 821px) {
  .hero-hq {
    overflow: hidden !important;
  }

  .hq-scene {
    width: 100% !important;
    flex: 1 1 auto !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-color: #020711 !important;
  }

  body[data-hq-image-fit="fit"] .hq-scene,
  .hq-scene[data-image-fit="fit"] {
    background-size: contain !important;
  }

  body[data-hq-image-fit="fill"] .hq-scene,
  .hq-scene[data-image-fit="fill"] {
    background-size: cover !important;
  }

  body[data-hq-visual-size="xl"] .center-col > .hero-hq {
    min-height: clamp(540px, 66vh, 780px) !important;
  }

  body[data-hq-visual-size="xl"] .hq-scene {
    min-height: clamp(470px, 59vh, 710px) !important;
  }

  body[data-hq-visual-size="xl"] .pa-permanent-office {
    min-height: clamp(365px, 46vh, 560px) !important;
  }

  .chat-agent-select {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
    background:
      linear-gradient(180deg, rgba(124,255,59,.12), rgba(0,0,0,.24)),
      var(--bg-2) !important;
    color: var(--accent) !important;
    box-shadow: inset 0 0 0 1px rgba(124,255,59,.08) !important;
  }

  .chat-agent-select:hover,
  .chat-agent-select:focus {
    border-color: var(--cyan) !important;
    color: var(--cyan) !important;
    box-shadow: 0 0 10px rgba(56,224,255,.18), inset 0 0 0 1px rgba(56,224,255,.10) !important;
  }

  .btn-expand-chat {
    border-color: color-mix(in srgb, var(--cyan) 58%, var(--line)) !important;
    color: var(--cyan) !important;
    background: rgba(56,224,255,.08) !important;
  }

  .btn-expand-chat:hover,
  body.chat-expanded .btn-expand-chat {
    border-color: var(--accent) !important;
    color: var(--bg-0) !important;
    background: var(--accent) !important;
    box-shadow: 0 0 10px rgba(124,255,59,.26) !important;
  }
}

@media (min-width: 821px) and (max-height: 860px) {
  body[data-hq-visual-size="xl"] .center-col > .hero-hq {
    min-height: clamp(455px, 57vh, 650px) !important;
  }

  body[data-hq-visual-size="xl"] .hq-scene {
    min-height: clamp(390px, 50vh, 585px) !important;
  }
}

/* ====================================================================
   WORLD FRAME + GREEN CONTROLS POLISH 2026-07-05
   Keep the world image large and correctly framed while preserving the
   stable stack. Pin control chrome to N.O.S. green even in blue worlds.
   ==================================================================== */
@media (min-width: 821px) {
  body[data-hq-visual-size="large"] .center-col > .hero-hq,
  body[data-view="hq"] .center-col > .hero-hq,
  .center-col > .hero-hq {
    min-height: clamp(520px, 62vh, 740px) !important;
  }

  body[data-hq-visual-size="large"] .hq-scene,
  .hero-hq .hq-scene,
  .hq-scene {
    min-height: clamp(455px, 55vh, 670px) !important;
  }

  body[data-hq-visual-size="xl"] .center-col > .hero-hq {
    min-height: clamp(600px, 72vh, 830px) !important;
  }

  body[data-hq-visual-size="xl"] .hq-scene {
    min-height: clamp(530px, 65vh, 770px) !important;
  }

  body[data-hq-visual-size="xl"][data-hq-image-fit="fill"] .hq-scene,
  body[data-hq-visual-size="xl"] .hq-scene[data-image-fit="fill"] {
    background-size: cover !important;
    background-position: center center !important;
  }

  body[data-hq-visual-size="xl"][data-hq-image-fit="fit"] .hq-scene,
  body[data-hq-visual-size="xl"] .hq-scene[data-image-fit="fit"] {
    background-size: contain !important;
    background-position: center center !important;
  }

  .seg-btn.is-active,
  .view-toggle-btn.is-active,
  .rs-tab.is-active,
  .fd-btn.is-active,
  .pixel-topbar-btn.is-active {
    background: rgba(124,255,59,.14) !important;
    border-color: var(--green) !important;
    color: var(--green) !important;
    box-shadow: inset 0 0 0 1px rgba(124,255,59,.42), 0 0 10px rgba(124,255,59,.18) !important;
  }

  .toggle-row input[type="checkbox"],
  .ws-group input[type="checkbox"],
  .budget-row input[type="checkbox"],
  input[type="checkbox"] {
    accent-color: var(--green) !important;
  }

  .chat-agent-select,
  .workspace-strip select,
  .framework-dock select,
  .ws-group select,
  #layoutSelect,
  #worldSelect,
  #colorSelect {
    border-color: rgba(124,255,59,.42) !important;
    color: #d9ffcc !important;
  }

  .chat-agent-select {
    background:
      linear-gradient(180deg, rgba(124,255,59,.14), rgba(2,8,14,.78)),
      var(--bg-2) !important;
    color: var(--green) !important;
  }

  .btn-expand-chat,
  .hq-visual-btn,
  .zoom-btn {
    border-color: rgba(124,255,59,.42) !important;
    color: var(--green) !important;
    background: rgba(124,255,59,.07) !important;
  }

  .btn-expand-chat:hover,
  body.chat-expanded .btn-expand-chat,
  .hq-visual-btn:hover,
  .zoom-btn:hover {
    border-color: var(--green) !important;
    color: #061006 !important;
    background: var(--green) !important;
    box-shadow: 0 0 10px rgba(124,255,59,.24) !important;
  }
}

@media (min-width: 821px) and (max-height: 860px) {
  body[data-hq-visual-size="xl"] .center-col > .hero-hq {
    min-height: clamp(500px, 62vh, 690px) !important;
  }

  body[data-hq-visual-size="xl"] .hq-scene {
    min-height: clamp(430px, 55vh, 625px) !important;
  }
}

/* ====================================================================
   GREEN SLIDERS + FINANCIAL DEFAULT POLISH 2026-07-05
   Final chrome pass: visible scrollbars/range sliders stay N.O.S. green.
   ==================================================================== */
* {
  scrollbar-color: var(--green) rgba(5, 12, 18, .72) !important;
}

::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

::-webkit-scrollbar-track {
  background: rgba(5, 12, 18, .72) !important;
  border-radius: 999px !important;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124,255,59,.95), rgba(64,210,76,.72)) !important;
  border: 1px solid rgba(124,255,59,.38) !important;
  border-radius: 999px !important;
  box-shadow: 0 0 8px rgba(124,255,59,.28) !important;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green) !important;
}

.center-col::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb,
.sidebar-left::-webkit-scrollbar-thumb,
.chat-thread::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124,255,59,.95), rgba(64,210,76,.72)) !important;
  border-color: rgba(124,255,59,.45) !important;
}

input[type="range"] {
  accent-color: var(--green) !important;
}

input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(124,255,59,.18) !important;
  border: 1px solid rgba(124,255,59,.28) !important;
  border-radius: 999px !important;
}

input[type="range"]::-webkit-slider-thumb {
  background: var(--green) !important;
  border: 1px solid rgba(214,255,198,.8) !important;
  box-shadow: 0 0 10px rgba(124,255,59,.4) !important;
}

input[type="range"]::-moz-range-track {
  background: rgba(124,255,59,.18) !important;
  border: 1px solid rgba(124,255,59,.28) !important;
  border-radius: 999px !important;
}

input[type="range"]::-moz-range-thumb {
  background: var(--green) !important;
  border: 1px solid rgba(214,255,198,.8) !important;
  box-shadow: 0 0 10px rgba(124,255,59,.4) !important;
}

/* ============== CASHFLOW PANEL v50 2026-07-06 ============== */
.panel-cashflow {
  /* same shape as panel-revenue */
}
.panel-cashflow .panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-cashflow .fin-status-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
.panel-cashflow .fin-pill {
  display: inline-block;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cdd;
  white-space: nowrap;
}
.panel-cashflow .fin-pill--ok    { background: rgba(124,255,59,0.16);  border-color: rgba(124,255,59,0.4);  color: #d6ffc6; }
.panel-cashflow .fin-pill--err   { background: rgba(255,90,90,0.16);  border-color: rgba(255,90,90,0.4);  color: #ffd0d0; }
.panel-cashflow .fin-pill--warn  { background: rgba(255,180,40,0.16); border-color: rgba(255,180,40,0.4); color: #ffe4b3; }

.panel-cashflow .fin-refresh {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cdd;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.panel-cashflow .fin-refresh:hover { background: rgba(124,255,59,0.16); border-color: rgba(124,255,59,0.4); }
.panel-cashflow .fin-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

/* Container query: respond to panel's OWN width, not window width.
   Sidebar = ~230px, full-width = 800px+. */
/* Panel itself: force block layout. container-type: inline-size alone does NOT
   change display, but various flex containers upstream sometimes "inherit"
   display:flex through the cascade. Pin this to block + width:100% so the
   children (grids) have a stable block parent and the panel itself fills
   the sidebar column. */
.panel-cashflow {
  /* container-type: inline-size responds to the panel's own width; needed
     for @container cf queries below. The desktop sidebar media query forces
     display:flex on this panel which is fine — container queries measure
     the used width, not the box-sizing. */
  container-type: inline-size;
  container-name: cf;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* default (>= 600px): 4-col KPIs, 4-col table.
   width:100% + min-width:0 are CRITICAL because the panel is a flex column item;
   without these, grid 1fr resolves to min-content of children and the row collapses
   to ~46px wide even in a 220px panel. */
.panel-cashflow .fin-hero-row {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
  box-sizing: border-box;
}
.panel-cashflow .fin-hero {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.panel-cashflow .fin-hero-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #8a9;
  font-weight: 700;
}
.panel-cashflow .fin-hero-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.panel-cashflow .fin-hero-meta {
  font-size: 10px;
  color: #8a9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-cashflow .fin-hero-value--neg { color: #ff8a8a; }
.panel-cashflow .fin-hero-value--pos { color: #aef09b; }
.panel-cashflow .fin-hero-value--api { color: #ffd699; }

.panel-cashflow .cf-source-table {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  overflow: hidden;
  font-size: 12px;
}
.panel-cashflow .cf-source-row {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 1.4fr 0.8fr 1.0fr 1.4fr;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
  box-sizing: border-box;
}
.panel-cashflow .cf-source-row:last-child { border-bottom: none; }
.panel-cashflow .cf-source-header {
  background: rgba(255,255,255,0.06);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #8a9;
}
.panel-cashflow .cf-source-name { color: #d6ffc6; font-weight: 600; }
.panel-cashflow .cf-source-type { color: #8a9; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.panel-cashflow .cf-source-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.panel-cashflow .cf-source-bar > div {
  height: 100%;
  background: var(--green, #7cff3b);
  transition: width 0.3s ease;
}
.panel-cashflow .cf-source-bar > div.low { background: #ff8a4a; }
.panel-cashflow .cf-source-bar > div.crit { background: #ff5a5a; }
.panel-cashflow .fin-meta {
  font-size: 10px;
  color: #6a7;
  margin-top: 8px;
  text-align: right;
}

/* responsive: handled by container queries on .panel-cashflow, NOT window width.
   The panel lives in a 230px right sidebar OR a wider content area; we respond to
   the panel's own inline-size. */

/* SIDEBAR mode (panel < 380px wide): 2-col KPIs, 1-col table stacked, smaller fonts.
   width:100% + min-width:0 on all grids so they fill the panel even as flex items. */
@container cf (max-width: 380px) {
  .panel-cashflow .fin-hero-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 6px;
  }
  .panel-cashflow .fin-hero {
    padding: 7px 9px;
    min-width: 0;
    overflow: hidden;
  }
  .panel-cashflow .fin-hero-value {
    font-size: 16px;
    line-height: 1.15;
  }
  .panel-cashflow .fin-hero-label {
    font-size: 9px;
  }
  .panel-cashflow .fin-hero-meta {
    font-size: 9px;
    white-space: normal;
  }
  .panel-cashflow .fin-pill {
    font-size: 9px;
    padding: 2px 6px;
  }
  .panel-cashflow .cf-source-table {
    width: 100%;
    min-width: 0;
  }
  .panel-cashflow .cf-source-row {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 8px;
    box-sizing: border-box;
  }
  .panel-cashflow .cf-source-row > span {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .panel-cashflow .cf-source-name { font-size: 12px; }
  .panel-cashflow .cf-source-type { font-size: 9px; }
  .panel-cashflow .cf-source-header { display: none; }
  .panel-cashflow .cf-source-bar { width: 100%; max-width: 100%; }
  .cf-source-row--sub { padding-left: 8px; }
}

/* FULL-WIDTH mode (panel >= 600px): keep 4-col, but loosen gap */
@container cf (min-width: 600px) {
  .panel-cashflow .fin-hero-row { gap: 14px; }
  .panel-cashflow .cf-source-row { padding: 9px 12px; }
}

/* per-sub row: visual indent + smaller font so it nests under summary.
   Reduced indent in narrow mode (see container query above) */
.cf-source-row--sub {
  padding-left: 18px;
  font-size: 11px;
  opacity: 0.9;
  border-left: 2px solid rgba(174, 240, 155, 0.15);
}

/* Bar fill within a source row: cap it to cell width so it never overflows */
.panel-cashflow .cf-source-bar {
  display: inline-block;
  width: 60px;
  max-width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}

/* Live control-plane inventory: keep each business visually bounded. */
.wf-business-group { margin: 0 0 18px; padding: 10px; border: 1px solid rgba(73, 229, 255, .16); border-radius: 10px; background: linear-gradient(135deg, rgba(10,20,38,.72), rgba(8,12,24,.5)); }
.wf-business-heading { display:flex; justify-content:space-between; align-items:center; margin:0 2px 9px; color:#8eeaff; font:700 11px/1.2 monospace; letter-spacing:.12em; }
.wf-business-heading em { color:#86f1ae; font-style:normal; font-size:9px; }
.metis-control-status { margin-left:auto; padding:6px 10px; border:1px solid rgba(73,229,255,.22); border-radius:7px; background:rgba(5,16,30,.78); color:#8eeaff; font:600 10px/1.2 monospace; letter-spacing:.04em; }
.metis-control-status b { color:#86f1ae; letter-spacing:.12em; }

/* === LIVE VISUAL ORCHESTRATION CONTROL ROOM === */
.view-toggle { display:flex !important; align-items:center; gap:4px; }
.orchestration-view { grid-row:2 / 4; min-height:0; overflow:hidden; padding:12px; background:#050914; color:#eef7ff; }
body[data-view="hq"] .orchestration-view, body[data-view="builder"] .orchestration-view { display:none !important; }
body[data-view="orchestration"] .hq-view, body[data-view="orchestration"] .builder-view, body[data-view="orchestration"] .framework-dock { display:none !important; }
body[data-view="orchestration"] .orchestration-view { display:flex !important; flex-direction:column; }
.orch-topbar { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:8px 10px 14px; border-bottom:1px solid rgba(90,223,255,.2); }
.orch-kicker { color:#66e8ff; font:700 9px/1.2 'JetBrains Mono',monospace; letter-spacing:.18em; }
.orch-topbar h1,.orch-workflow-head h2 { margin:4px 0 2px; color:#f5fbff; font:700 24px/1.1 Inter,sans-serif; letter-spacing:-.02em; }
.orch-topbar p,.orch-workflow-head p { margin:0; color:#7890aa; font:10px/1.4 'JetBrains Mono',monospace; }
.orch-live-summary { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.orch-live-summary span,.orch-head-badges span { padding:7px 9px; border:1px solid rgba(95,225,255,.16); border-radius:5px; background:rgba(8,20,36,.85); color:#8ca4bc; font:700 9px/1 monospace; white-space:nowrap; }
.orch-live-summary b { color:#8bffb3; font-size:11px; }
.orch-dot { display:inline-block; width:6px; height:6px; margin-right:5px; border-radius:50%; background:#607080; }
.orch-dot.live { background:#53ff9a; box-shadow:0 0 8px #53ff9a; animation:orchPulse 1.4s infinite; }
.warn { color:#ffbd66 !important; border-color:rgba(255,174,72,.4) !important; }
.orch-shell { display:grid; grid-template-columns:230px minmax(600px,1fr) 260px; gap:10px; min-height:0; flex:1; padding-top:10px; }
.orch-business-rail,.orch-workspace,.orch-inspector { min-height:0; border:1px solid rgba(70,214,255,.14); background:linear-gradient(180deg,rgba(7,16,30,.94),rgba(4,9,18,.96)); border-radius:8px; }
.orch-business-rail { padding:8px; overflow:hidden; display:flex; flex-direction:column; }
.orch-search { display:flex; align-items:center; gap:5px; padding:7px 9px; border:1px solid rgba(88,211,255,.15); border-radius:5px; background:#07101d; }
.orch-search span { color:#56e3ff; }.orch-search input { width:100%; border:0; outline:0; background:transparent; color:#dff8ff; font:10px monospace; }
.orch-business-list { margin-top:7px; overflow:auto; display:flex; flex-direction:column; gap:5px; }
.orch-business { width:100%; display:grid; grid-template-columns:30px 1fr auto; gap:8px; align-items:center; padding:8px; border:1px solid transparent; border-radius:6px; background:transparent; color:#d9e9f7; text-align:left; cursor:pointer; }
.orch-business:hover { background:rgba(64,211,255,.06); }.orch-business.is-active { border-color:rgba(70,227,255,.45); background:linear-gradient(90deg,rgba(48,209,255,.13),rgba(61,119,255,.04)); box-shadow:inset 2px 0 #5de8ff; }
.orch-business-mark { display:grid; place-items:center; width:28px; height:28px; border:1px solid rgba(91,229,255,.28); border-radius:6px; color:#69eaff; font:800 9px monospace; background:#091726; }
.orch-business b { display:block; font:700 10px/1.3 Inter,sans-serif; }.orch-business small { display:block; color:#647b91; font:8px/1.4 monospace; }
.orch-business em,.orch-state { font:700 7px/1 monospace; font-style:normal; color:#83a0b5; }
.state-scheduled,.state-succeeded { color:#6dffad !important; }.state-draft,.state-unmapped { color:#879caf !important; }.state-halted,.state-failed { color:#ff6d83 !important; }.state-queued,.state-claimed,.state-running { color:#61e9ff !important; }
.orch-workspace { overflow:hidden; display:flex; flex-direction:column; }
.orch-workflow-head { min-height:72px; padding:12px 15px; display:flex; justify-content:space-between; align-items:center; gap:15px; border-bottom:1px solid rgba(75,218,255,.13); }
.orch-workflow-head h2 { font-size:17px; }.orch-workflow-head p { max-width:650px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.orch-head-badges { display:flex; gap:5px; flex-wrap:wrap; justify-content:flex-end; }
.orch-canvas-shell { position:relative; min-height:0; flex:1; overflow:auto; background:#050b16; }
.orch-canvas-grid { position:absolute; inset:0; opacity:.24; pointer-events:none; background-image:linear-gradient(rgba(75,215,255,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(75,215,255,.08) 1px,transparent 1px); background-size:24px 24px; }
.orch-canvas { position:relative; z-index:1; min-width:900px; padding:18px; }
.orch-empty-manifest { margin:30px; padding:30px; border:1px dashed rgba(255,171,75,.4); border-radius:8px; background:rgba(54,31,10,.2); text-align:center; }.orch-empty-manifest b { color:#ffbd66; font:700 11px monospace; letter-spacing:.12em; }.orch-empty-manifest p { color:#8c785f; font:9px/1.6 monospace; }
.orch-lane { display:grid; grid-template-columns:135px 1fr; min-height:130px; margin-bottom:12px; border:1px solid rgba(72,207,255,.11); border-radius:8px; background:linear-gradient(90deg,rgba(12,32,53,.5),rgba(5,10,20,.45)); }
.orch-lane.is-halted { border-color:rgba(255,85,111,.36); background:linear-gradient(90deg,rgba(78,18,35,.28),rgba(8,10,18,.55)); }
.orch-lane-label { padding:14px 10px; border-right:1px solid rgba(77,216,255,.12); display:flex; flex-direction:column; justify-content:center; }
.orch-lane-label span { color:#526c82; font:700 8px monospace; letter-spacing:.14em; }.orch-lane-label b { margin:4px 0; color:#d9f6ff; font:700 11px monospace; }.orch-lane-label small { color:#5ae4ff; font:8px monospace; }.orch-lane-label em { margin-top:8px; color:#ff7188; font:700 7px monospace; font-style:normal; }
.orch-flow { display:flex; align-items:center; padding:18px; overflow-x:auto; }
.orch-node { position:relative; flex:0 0 144px; min-height:76px; padding:11px 9px 8px; border:1px solid rgba(112,224,255,.28); border-radius:7px; background:linear-gradient(145deg,#0c1c30,#08111f); color:#e6f8ff; text-align:left; box-shadow:0 9px 22px rgba(0,0,0,.22); cursor:pointer; transition:.18s ease; }
.orch-node:hover { transform:translateY(-2px); border-color:#64eaff; box-shadow:0 10px 28px rgba(44,208,255,.15); }
.orch-node-icon { float:left; display:grid; place-items:center; width:24px; height:24px; margin-right:7px; border-radius:5px; background:rgba(78,222,255,.09); color:#61eaff; font-size:12px; }
.orch-node-copy { display:block; min-width:0; }.orch-node-copy b { display:block; overflow:hidden; text-overflow:ellipsis; color:#f0fbff; font:700 9px/1.25 monospace; text-transform:uppercase; }.orch-node-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#6f899f; font:8px/1.4 monospace; }
.orch-node-runtime { position:absolute; left:9px; bottom:7px; color:#7392a8; font:700 7px monospace; text-transform:uppercase; }
.orch-side-effect { position:absolute; right:6px; bottom:6px; padding:2px 4px; border:1px solid rgba(255,178,74,.4); border-radius:3px; color:#ffbd66; font:700 6px monospace; }
.orch-port { position:absolute; top:50%; width:6px; height:6px; margin-top:-3px; border:1px solid #50ddff; border-radius:50%; background:#06101d; }.orch-port.in { left:-4px; }.orch-port.out { right:-4px; }
.orch-wire { position:relative; flex:0 0 34px; height:2px; background:linear-gradient(90deg,#2b6e82,#4fe5ff); }.orch-wire:after { content:''; position:absolute; right:-1px; top:-3px; border-left:5px solid #4fe5ff; border-top:4px solid transparent; border-bottom:4px solid transparent; }
.doctor-wire { background:repeating-linear-gradient(90deg,#b26cff 0 5px,transparent 5px 9px); }.doctor-wire:after { border-left-color:#b26cff; }
.type-trigger { border-color:rgba(82,255,160,.45); }.type-trigger .orch-node-icon { color:#66ffac; }.type-approval { border-color:rgba(255,186,84,.55); }.type-guardrail { border-color:rgba(255,213,93,.4); }.type-doctor_control,.type-doctor { border-color:rgba(185,105,255,.52); background:linear-gradient(145deg,#21103c,#0b1223); }.type-doctor_control .orch-node-icon,.type-doctor .orch-node-icon { color:#c687ff; }
.job-claimed,.job-running,.job-queued { animation:orchNodeLive 1.3s infinite; }.job-succeeded { border-color:rgba(90,255,163,.38); }.job-failed { border-color:#ff637d; box-shadow:0 0 18px rgba(255,65,101,.2); }
.orch-run-strip { flex:0 0 116px; border-top:1px solid rgba(72,207,255,.13); display:grid; grid-template-columns:140px 1fr; min-height:0; }
.orch-run-strip header { padding:13px; border-right:1px solid rgba(72,207,255,.13); }.orch-run-strip header b { display:block; margin-top:5px; color:#dceeff; font:700 9px monospace; }
.orch-runs { display:flex; gap:7px; overflow:auto; padding:10px; }.orch-run { flex:0 0 135px; padding:8px; border:1px solid rgba(92,220,255,.14); border-radius:5px; background:#071321; }.orch-run i { display:inline-block; width:6px; height:6px; border-radius:50%; background:#768899; }.orch-run.state-succeeded i { background:#57f89e; }.orch-run.state-halted i,.orch-run.state-failed i { background:#ff647d; }.orch-run b,.orch-run small { display:block; font:8px/1.3 monospace; }.orch-run small { color:#60798f; }.orch-run em { color:inherit; font:700 7px monospace; font-style:normal; }.orch-run code { float:right; color:#4e687e; font-size:7px; }
.orch-inspector { padding:14px; overflow:auto; }.orch-inspector h3 { margin:7px 0; color:#eefaff; font:700 16px Inter,sans-serif; text-transform:capitalize; }.orch-inspector>p { color:#6f879c; font:10px/1.6 monospace; }.orch-inspector-status { display:inline-block; margin-bottom:12px; padding:4px 7px; border:1px solid currentColor; border-radius:4px; color:#78a0b9; font:700 8px monospace; }
.orch-inspector dl { margin:0; }.orch-inspector dt { margin-top:10px; color:#547086; font:700 7px monospace; letter-spacing:.12em; text-transform:uppercase; }.orch-inspector dd { margin:2px 0 0; padding-bottom:6px; border-bottom:1px solid rgba(92,213,255,.09); color:#c5dbe8; font:9px/1.45 monospace; overflow-wrap:anywhere; }
.orch-job-evidence { margin-top:14px; }.orch-job-evidence>b { color:#66e8ff; font:700 8px monospace; letter-spacing:.12em; }.orch-job-evidence p { display:grid; grid-template-columns:auto auto; gap:3px 7px; margin:7px 0; padding:7px; background:#07121e; border:1px solid rgba(86,211,255,.11); border-radius:4px; }.orch-job-evidence span,.orch-job-evidence code { font:7px monospace; }.orch-job-evidence small { grid-column:1/-1; color:#688095; font:8px monospace; }
@keyframes orchPulse { 50% { opacity:.35; box-shadow:0 0 2px #53ff9a; } }
@keyframes orchNodeLive { 50% { border-color:#55edff; box-shadow:0 0 22px rgba(55,220,255,.25); } }
@media (max-width:1100px) { .orch-shell { grid-template-columns:190px minmax(560px,1fr); overflow:auto; }.orch-inspector { display:none; } }
