
#svg-sprites {
  display: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
/* ============================================================
   FOOTMATRIX 2.0 / EXODUS GLOBAL DESIGN SYSTEM
   Premium Technical Editorial · Mobile-First Conversational UI
   Color Palette: #0C0F12 (void), #151B1E (surface), #283035 (border), #00E599 (matrix green)
   ============================================================ */

:root {
  --void: #0C0F12;
  --surface: #151B1E;
  --surface-2: #1C2429;
  --surface-3: #222C32;
  --line: #283035;
  --line-strong: #3D4950;
  --text: #F3F5F7;
  --muted: #8E9A9D;
  --muted-2: #5C676A;
  --signal: #00E599;
  --signal-soft: rgba(0, 229, 153, 0.10);
  --signal-glow: rgba(0, 229, 153, 0.25);
  --amber: #FFB347;
  --red: #FF4D4D;
  --blue: #5AB2FF;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, ui-monospace, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

/* Keep hidden controls out of layout and the accessibility tree. */
[hidden] { display: none !important; }

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--void);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-width: 320px;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--signal);
  color: #000;
}

/* SVG Sprite Icons */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-sm {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-lg {
  width: 22px;
  height: 22px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   APPLICATION SHELL & VIEWPORT ARCHITECTURE
   ============================================================ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--void);
  position: relative;
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
  }
}

.workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* TOPBAR */
.topbar {
  height: 54px;
  flex-shrink: 0;
  background: rgba(12, 15, 18, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 30;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-wordmark {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #FFF;
}
.brand-wordmark span {
  color: var(--signal);
}
.brand-wordmark sup {
  font-size: 9px;
  color: var(--signal);
  margin-left: 2px;
  vertical-align: super;
}

.topbar-route {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}
.icon-button:hover {
  border-color: var(--signal);
  color: var(--signal);
  background: var(--surface-2);
}

.shell-menu {
  display: grid;
}
@media (min-width: 900px) {
  .shell-menu {
    display: none;
  }
}

.topbar-new-chat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.topbar-new-chat:hover {
  border-color: var(--signal);
  color: var(--signal);
  background: var(--surface-3);
}

.runtime-header-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  width: auto;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.runtime-header-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.runtime-live-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 6px var(--signal);
}

.command-button {
  display: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}
.command-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.command-button kbd {
  font-family: var(--mono);
  color: var(--muted);
}
@media (min-width: 1050px) {
  .command-button {
    display: inline-flex;
  }
}

.env-chip {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 8px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.env-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}
.env-chip.live i {
  background: var(--signal);
}
@media (min-width: 1200px) {
  .env-chip {
    display: inline-flex;
  }
}

/* ============================================================
   SIDEBAR & SESSION DRAWER
   ============================================================ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(320px, 86vw);
  height: 100vh;
  height: 100dvh;
  background: #090C0E;
  border-right: 1px solid var(--line);
  z-index: 80;
  transform: translateX(-105%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 16px 14px max(16px, env(safe-area-inset-bottom));
  box-shadow: 20px 0 60px rgba(0,0,0,0.7);
}
.sidebar.open {
  transform: translateX(0);
}

@media (min-width: 900px) {
  .sidebar {
    position: static;
    transform: none;
    width: 100%;
    height: 100vh;
    box-shadow: none;
    padding: 18px 14px;
    z-index: 10;
  }
}

.sidebar-scrim, .runtime-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 75;
}
.sidebar-scrim[hidden], .runtime-scrim[hidden] {
  display: none;
}
.runtime-scrim {
  z-index: 65;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-sub {
  display: block;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-top: 3px;
}
.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}
.drawer-close:hover {
  color: var(--text);
  background: var(--surface);
}
@media (min-width: 900px) {
  .drawer-close {
    display: none;
  }
}

.nav {
  display: grid;
  gap: 2px;
  margin-top: 14px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
}
.nav a .icon {
  color: var(--muted-2);
  transition: color 0.15s ease;
}
.nav a:hover {
  background: var(--surface);
  color: var(--text);
}
.nav a:hover .icon {
  color: var(--signal);
}
.nav a.active {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: #FFF;
  font-weight: 600;
}
.nav a.active .icon {
  color: var(--signal);
}
.nav a.active span {
  color: #FFF;
}

.conversation-history-header {
  margin-top: 18px;
  padding: 12px 6px 6px;
  border-top: 1px solid var(--line);
}
.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.sidebar-new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  background: var(--signal-soft);
  border: 1px solid rgba(0, 229, 153, 0.2);
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}

.conversation-history {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-entry {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  padding: 2px 4px;
  transition: background 0.15s ease;
}
.history-entry:hover {
  background: var(--surface);
}
.history-entry button:first-child {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 4px;
}
.history-entry button:first-child:hover {
  color: var(--text);
}
.history-entry button[data-rename-conversation],
.history-entry button[data-archive-conversation] {
  color: var(--muted-2);
  padding: 4px;
  font-size: 11px;
  border-radius: 4px;
}
.history-entry button[data-rename-conversation]:hover,
.history-entry button[data-archive-conversation]:hover {
  color: var(--text);
  background: var(--surface-2);
}

.secondary-nav {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.secondary-nav a {
  min-height: 32px;
  font-size: 11.5px;
}

.sidebar-foot {
  margin-top: 12px;
  padding: 10px 6px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 6px var(--signal);
  flex-shrink: 0;
}
.sidebar-foot strong {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--text);
}
.sidebar-foot small {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
  margin-top: 1px;
}

/* ============================================================
   MAIN CONTENT WRAPPER
   ============================================================ */

.content {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  outline: none;
  overflow: hidden;
}

/* Page Mode (Non-Chat) */
.content.route-page {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 20px max(40px, env(safe-area-inset-bottom));
  max-width: 1300px;
  margin: 0 auto;
}

/* ============================================================
   CHAT-FIRST INTERFACE (QODER & ASSISTANT-UI ALIGNED)
   ============================================================ */

.chat-layout {
  display: flex;
  flex-direction: row;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.chat-heading {
  display: none;
}

.chat-transcript {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  }

/* Welcome Hero & Suggestions */
.chat-welcome-container {
  margin: auto;
  max-width: 640px;
  width: 100%;
  padding: 20px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--signal-soft);
  border: 1px solid rgba(0, 229, 153, 0.3);
  color: var(--signal);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--signal-glow);
  margin: 0 auto 12px;
}

.welcome-title {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #FFF;
}
.welcome-title span {
  color: var(--signal);
}

.welcome-subtitle {
  color: var(--muted);
  font-size: 13.5px;
  max-width: 440px;
  margin: 6px auto 0;
  line-height: 1.5;
}

.welcome-suggestions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
@media (min-width: 600px) {
  .welcome-suggestions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.welcome-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.welcome-chip:hover {
  border-color: var(--signal);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.chip-kicker {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--signal);
  letter-spacing: 0.08em;
  font-weight: 700;
}
.welcome-chip strong {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  padding-right: 16px;
}
.chip-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}
.welcome-chip:hover .chip-arrow {
  color: var(--signal);
}

/* Chat Turn & Alignment */
.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* User Message Bubble */
.chat-user-wrap {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}
.chat-user-bubble {
  max-width: min(88%, 620px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  word-break: break-word;
}
.chat-bubble-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}
.chat-bubble-author .user-tag {
  color: var(--signal);
}
.chat-user-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

/* Assistant Message Card */
.chat-assistant-wrap {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}
.chat-assistant-card {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 16px 16px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  word-break: break-word;
}

.chat-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.assistant-identity {
  display: flex;
  align-items: center;
  gap: 8px;
}
.assistant-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--signal-soft);
  border: 1px solid rgba(0, 229, 153, 0.3);
  display: grid;
  place-items: center;
  color: var(--signal);
}
.assistant-avatar.is-pulsing {
  animation: pulseAvatar 1.5s infinite alternate;
}
@keyframes pulseAvatar {
  from { box-shadow: 0 0 4px var(--signal); }
  to { box-shadow: 0 0 12px var(--signal); }
}
.assistant-avatar.is-error {
  background: rgba(255, 77, 77, 0.1);
  border-color: rgba(255, 77, 77, 0.3);
  color: var(--red);
}

.assistant-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11.5px;
  color: #FFF;
  letter-spacing: 0.08em;
}
.assistant-badge {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  color: var(--signal);
  background: var(--signal-soft);
  border: 1px solid rgba(0, 229, 153, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.assistant-badge.is-live {
  color: var(--amber);
  background: rgba(255, 179, 71, 0.1);
  border-color: rgba(255, 179, 71, 0.3);
}
.assistant-badge.is-error {
  color: var(--red);
  background: rgba(255, 77, 77, 0.1);
  border-color: rgba(255, 77, 77, 0.3);
}

.assistant-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
}
.live-dot-sm {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 4px var(--signal);
}
.running-timer-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--signal);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Qoder Agent Activity Strip (Running State) */
.agent-activity-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
}
.activity-lifecycle-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
}
.activity-lifecycle-strip .step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-2);
}
.activity-lifecycle-strip .step.active {
  color: var(--signal);
  font-weight: 600;
}
.activity-lifecycle-strip .step.active.pulse .step-dot {
  animation: pulseDot 1s infinite alternate;
}
@keyframes pulseDot {
  from { opacity: 0.4; }
  to { opacity: 1; transform: scale(1.3); }
}
.activity-lifecycle-strip .step-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.activity-lifecycle-strip .step-arrow {
  color: var(--muted-2);
  font-size: 8px;
}
.activity-running-msg {
  display: flex;
  align-items: center;
  gap: 12px;
}
.loader-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.activity-msg-text {
  flex: 1;
  min-width: 0;
}
.activity-msg-text strong {
  display: block;
  font-size: 12.5px;
  color: var(--text);
}
.activity-msg-text small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.activity-cancel-btn {
  background: rgba(255, 77, 77, 0.1);
  border: 1px solid rgba(255, 77, 77, 0.3);
  color: var(--red);
  padding: 5px 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Tool Accordion (Qoder Style) */
.agent-tools-accordion {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 2px 0 8px;
  overflow: hidden;
}
.agent-tools-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: var(--sans);
  color: var(--muted);
  user-select: none;
}
.agent-tools-summary:hover {
  color: var(--text);
  background: var(--surface-3);
}
.tools-summary-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}
.tools-summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
}
.model-badge {
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}
.latency-badge {
  color: var(--signal);
  font-weight: 600;
}
.chevron {
  transition: transform 0.2s ease;
}
details[open] .chevron {
  transform: rotate(180deg);
}
.tools-accordion-content {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  background: var(--surface);
}
.agent-lifecycle-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--signal);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.lifecycle-step.is-done {
  color: var(--signal);
}
.lifecycle-arrow {
  color: var(--muted-2);
}
.tools-telemetry-meta {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.tools-telemetry-meta b {
  color: var(--text);
}
.tool-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tool-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: var(--mono);
  font-size: 11px;
}
.tool-step-num {
  color: var(--muted-2);
  margin-right: 6px;
}
.tool-step-name {
  color: var(--text);
  font-weight: 600;
}
.tool-step-status.is-ok {
  color: var(--signal);
  font-weight: 700;
}
.tool-step-status.is-fail {
  color: var(--red);
  font-weight: 700;
}
.tool-step-latency {
  color: var(--muted);
  margin-left: 8px;
  font-size: 10px;
}
.tools-empty-note {
  color: var(--muted);
  font-size: 11.5px;
}

/* Markdown Answer Body */
.chat-answer-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.chat-answer-body p {
  margin: 0 0 10px;
}
.chat-answer-body p:last-child {
  margin-bottom: 0;
}
.chat-answer-body h1, .chat-answer-body h2, .chat-answer-body h3, .chat-answer-body h4 {
  color: #FFF;
  margin: 16px 0 8px;
  font-family: var(--sans);
  letter-spacing: -0.01em;
}
.chat-answer-body h2 {
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.chat-answer-body h3 {
  font-size: 14.5px;
  color: var(--signal);
}
.chat-answer-body ul, .chat-answer-body ol {
  padding-left: 20px;
  margin: 8px 0;
}
.chat-answer-body li {
  margin: 4px 0;
}
.chat-answer-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--signal);
}
.chat-answer-body pre {
  background: #090C0E;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 10px 0;
}
.chat-answer-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 12px;
}
.chat-answer-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12.5px;
}
.chat-answer-body th, .chat-answer-body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}
.chat-answer-body th {
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

/* Card Action Buttons */
.chat-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.chat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-action-btn:hover {
  border-color: var(--signal);
  color: var(--text);
  background: var(--surface-3);
}

/* Dossiê / Artifact Card */
.chat-artifact-dossier {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 8px 0;
  overflow: hidden;
}
.dossier-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 229, 153, 0.03);
}
.dossier-summary-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dossier-pill {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  color: var(--signal);
  letter-spacing: 0.08em;
}
.dossier-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFF;
  line-height: 1.3;
}
.dossier-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.dossier-fullscreen-btn:hover {
  border-color: var(--signal);
  color: var(--signal);
}
.dossier-body {
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dossier-meta-row {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.dossier-meta-row b {
  color: var(--text);
}
.dossier-lead {
  color: var(--text);
  font-size: 13px;
}
.dossier-subjects {
  font-size: 12px;
  color: var(--muted);
}
.subject-tag {
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
}
.dossier-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.chat-fact-card {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fact-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fact-val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.fact-status-chip {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--amber);
}
.fact-status-chip.is-verified {
  color: var(--signal);
}
.dossier-section h4, .dossier-claims-wrap h4, .dossier-limitations-wrap h4 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--signal);
  margin: 10px 0 6px;
}
.dossier-claims-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.claim-item {
  font-size: 12.5px;
}
.claim-header {
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  margin-bottom: 2px;
}
.claim-status-badge {
  color: var(--amber);
  background: rgba(255, 179, 71, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
}
.claim-ref {
  color: var(--muted);
}
.claim-text {
  color: var(--text);
}
.chat-artifact-dossier.fullscreen {
  position: fixed;
  inset: 10px;
  z-index: 100;
  margin: 0;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,0.85);
  overflow-y: auto;
  max-width: 900px;
  margin: auto;
  height: min(94vh, 880px);
}

/* Evidence Accordion */
.chat-evidence-accordion {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 2px 0;
  overflow: hidden;
}
.evidence-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--muted);
}
.evidence-summary:hover {
  color: var(--text);
  background: var(--surface-3);
}
.evidence-summary-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.evidence-accordion-content {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.evidence-sources-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.evidence-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--signal);
  word-break: break-all;
  font-size: 12px;
}
.evidence-source-link:hover {
  text-decoration: underline;
}
.evidence-claim-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.evidence-chip {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--amber);
}

/* COMPOSER (MOBILE-FIRST SAFE AREA) */
.chat-composer-wrap {
  flex-shrink: 0;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  background: var(--void);
  border-top: 1px solid var(--line);
  z-index: 20;
}
@media (min-width: 768px) {
  .chat-composer-wrap {
    padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  }
}

.chat-composer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-composer-card:focus-within {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px var(--signal-glow), 0 4px 20px rgba(0,0,0,0.4);
}
.chat-composer-card textarea {
  width: 100%;
  min-height: 38px;
  max-height: 140px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.45;
  padding: 2px 0;
}
.chat-composer-card textarea::placeholder {
  color: var(--muted-2);
  font-size: 13.5px;
}

.composer-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.composer-pills-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.composer-pills-group::-webkit-scrollbar {
  display: none;
}
.composer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.composer-pill:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.composer-pill.model-pill {
  color: var(--text);
  font-weight: 600;
}
.composer-pill.model-pill .icon-sm {
  color: var(--signal);
}
.composer-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--signal);
  color: #000;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  flex-shrink: 0;
}
.composer-send-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: scale(1.05);
}
.composer-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}
.composer-send-btn:disabled {
  background: var(--surface-3);
  color: var(--muted-2);
  cursor: not-allowed;
}
.composer-send-btn.is-running {
  background: var(--red);
  color: #FFF;
}

/* ============================================================
   RUNTIME / SESSION DRAWER (RIGHT PANEL)
   ============================================================ */

.chat-runtime {
  display: none;
  position: fixed;
  inset: 0 0 0 auto;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 70;
  background: #090C0E;
  border-left: 1px solid var(--line);
  padding: 20px 18px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.7);
}
.chat-runtime.open {
  display: block;
}
.chat-runtime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #FFF;
}
.chat-runtime-header button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}
.chat-runtime-header button:hover {
  color: var(--text);
  background: var(--surface);
}
.runtime-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.runtime-row span {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.runtime-row strong {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text);
}
.runtime-owner-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}
.runtime-note {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.5;
}

/* ============================================================
   GLOBAL DASHBOARD & PAGES (PLAYERS, RADAR, REPORTS, ETC.)
   ============================================================ */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFF;
  margin-top: 4px;
}
.page-head p {
  color: var(--muted);
  font-size: 13px;
  max-width: 500px;
  line-height: 1.5;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--signal);
  text-transform: uppercase;
}

/* Cards & Grid Containers */
.hero-search {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.search-row {
  display: flex;
  gap: 10px;
}
.search-box {
  flex: 1;
  min-height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-box:focus {
  border-color: var(--signal);
}
.search-box::placeholder {
  color: var(--muted-2);
}

.query-examples {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.query-chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.query-chip:hover {
  border-color: var(--signal);
  color: var(--text);
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card, .panel, .player-card, .decision-card, .signal-card, .live-packet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.stat-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
}
.stat-card label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat-card strong {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: #FFF;
}
.stat-card small {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted-2);
}
.stat-card .accent {
  color: var(--signal);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

.panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-head strong {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #FFF;
}
.panel-head span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted-2);
}
.panel-body {
  padding: 12px 16px;
}

.radar-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.radar-row:last-child {
  border-bottom: none;
}
.radar-type, .badge {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--signal);
  background: var(--signal-soft);
  border: 1px solid rgba(0, 229, 153, 0.25);
  padding: 3px 6px;
  border-radius: 4px;
  width: fit-content;
}

/* Global Buttons */
.primary-button {
  background: var(--signal);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 0 16px;
  min-height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.primary-button:hover:not(:disabled) {
  opacity: 0.9;
}
.primary-button:active:not(:disabled) {
  transform: scale(0.98);
}
.primary-button:disabled {
  background: var(--surface-3);
  color: var(--muted-2);
  cursor: not-allowed;
}

.secondary-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 0 14px;
  min-height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.secondary-button:hover {
  border-color: var(--signal);
  color: #FFF;
  background: var(--surface-3);
}

/* Boot & Auth Screens */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--void);
  text-align: center;
}
.boot-screen p {
  margin: 10px 0 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.boot-screen small {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 11px;
}
.boot-screen[hidden] {
  display: none;
}

/* Command Palette */
.command-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 110;
  display: grid;
  place-items: start center;
  padding: 80px 16px 20px;
}
.command-overlay[hidden] {
  display: none;
}
.command-palette {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  overflow: hidden;
}
.command-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.command-input-wrap span {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
}
.command-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #FFF;
  font-size: 15px;
}
.command-input-wrap kbd {
  font-family: var(--mono);
  font-size: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
}
.command-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.command-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.command-entry:hover, .command-entry.selected {
  background: var(--surface-2);
  color: var(--signal);
}

.mobile-hide {
  display: inline;
}
@media (max-width: 600px) {
  .topbar {
    padding: 0 10px !important;
    gap: 8px !important;
  }
  .topbar-route {
    display: none !important;
  }
  .mobile-hide {
    display: none !important;
  }
  .topbar-new-chat {
    padding: 0 8px !important;
    height: 32px !important;
  }
  .runtime-header-toggle {
    height: 32px !important;
    padding: 0 8px !important;
  }
}
.chat-answer-body hr.agent-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.chat-answer-body blockquote {
  border-left: 3px solid var(--signal);
  padding: 6px 12px;
  margin: 10px 0;
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
}
.chat-answer-body strong {
  color: #FFF;
  font-weight: 600;
}

/* Synthetic radar status uses the same strict edge CSP as live mode. */
.radar-mode-label { margin: auto 4px auto auto; }

/* Keep login and invitation fields grouped and reachable above a mobile keyboard. */
.auth-shell {
  height: 100%;
  overflow-y: auto;
  padding: 24px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.auth-card {
  width: min(100%, 440px);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.auth-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.auth-submit { min-height: 44px; }
