:root {
  /* Organic Dark Luxury Palette */
  --bg-app: #080c14;
  --bg-surface: #0e1420;
  --bg-surface-elevated: #141d2d;
  --bg-surface-hover: #1a2538;
  --bg-pill: rgba(255, 255, 255, 0.04);
  --bg-pill-hover: rgba(255, 255, 255, 0.08);
  
  --glass-bg: rgba(14, 20, 32, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-focus: rgba(0, 240, 255, 0.4);
  
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Curvaceous Accents */
  --cyan-primary: #00d8f6;
  --cyan-soft: rgba(0, 216, 246, 0.12);
  --cyan-glow: rgba(0, 216, 246, 0.25);
  --green-primary: #00e676;
  --green-soft: rgba(0, 230, 118, 0.12);
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Smooth Organic Radii (No Sharp Boxes) */
  --radius-full: 9999px;
  --radius-2xl: 28px;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --header-height: 56px;
  --sidebar-width: 270px;
  --bottom-nav-height: 62px;
  --transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  position: relative;
}

body.not-authenticated #app,
body:not(.authenticated) #app {
  display: none !important;
}

/* High-Contrast Draggable Scrollbar (Easy Click & Drag) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: rgba(4, 8, 16, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 216, 246, 0.5);
  border: 2px solid #080c14;
  border-radius: 10px;
  cursor: grab;
}
::-webkit-scrollbar-thumb:hover {
  background: #00d8f6;
  box-shadow: 0 0 12px rgba(0, 216, 246, 0.8);
}
::-webkit-scrollbar-thumb:active {
  background: #38bdf8;
  cursor: grabbing;
}

/* ==========================================================================
   Header: Aerodynamic Floating Nav Bar
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 18px;
  z-index: 40;
  user-select: none;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.brand:hover {
  background: var(--bg-pill);
}

.brand-title {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.6px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-sovereign {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.btn-icon {
  background: var(--bg-pill);
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover {
  background: var(--bg-pill-hover);
  color: #fff;
  transform: scale(1.05);
}

.btn-download-apk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: var(--transition);
}
.btn-download-apk:hover {
  background: rgba(0, 240, 255, 0.22);
  color: #fff;
  border-color: var(--cyan-primary);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Aerodynamic Header Pills */
.header-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-pill);
  border: 1px solid var(--glass-border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.header-pill:hover {
  background: var(--bg-pill-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.indicator-pulse {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--green-primary);
  box-shadow: 0 0 8px var(--green-primary);
}

.dropdown-header {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  outline: none;
  cursor: pointer;
}
.user-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}
.user-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--green-primary);
  box-shadow: 0 0 8px var(--green-primary);
}
.user-display-name {
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--green-primary);
  letter-spacing: 0.3px;
}
.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.btn-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* View Mode Pill Capsule */
.view-mode-group {
  display: flex;
  background: var(--bg-pill);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.btn-mode:hover {
  color: var(--text-main);
}
.btn-mode.active {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
}

.status-tag {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cyan-primary);
  background: var(--cyan-soft);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Workspace Layout (Sidebar + Fluid Chat Canvas)
   ========================================================================== */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar: Smooth Floating Drawer */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-top-action {
  padding: 14px 14px 8px 14px;
}

.btn-new-chat-sidebar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-pill);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-new-chat-sidebar:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--cyan-primary);
  box-shadow: 0 4px 20px rgba(0, 216, 246, 0.15);
  transform: translateY(-1px);
}
.btn-new-chat-sidebar span {
  flex: 1;
  text-align: left;
  margin-left: 10px;
}

.shortcut-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.history-search-wrap {
  position: relative;
  margin: 6px 14px 8px 14px;
}
.history-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.history-search-wrap input {
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 8px 12px 8px 34px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}
.history-search-wrap input:focus {
  border-color: var(--glass-border-focus);
  background: var(--bg-surface);
}

.sidebar-nav-tabs {
  display: flex;
  background: var(--bg-app);
  border-radius: var(--radius-full);
  margin: 4px 14px 8px 14px;
  padding: 3px;
}
.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.sidebar-tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--cyan-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-section {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.sidebar-section.active {
  display: flex;
}

.history-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
}

.history-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 10px 4px 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 3px;
  transition: var(--transition);
  font-size: 12.5px;
}
.history-item:hover {
  background: var(--bg-pill);
  color: var(--text-main);
}
.history-item.active {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  font-weight: 600;
}

.history-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 6px;
}

.history-actions {
  display: none;
  gap: 3px;
}
.history-item:hover .history-actions {
  display: flex;
}
.history-btn {
  background: transparent;
  border: none;
  font-size: 11.5px;
  padding: 2px 5px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.history-btn:hover {
  background: var(--bg-pill-hover);
  color: #fff;
}

.history-inline-edit {
  flex: 1;
  background: rgba(4, 9, 18, 0.9);
  border: 1px solid var(--cyan-primary);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 3px 8px;
  outline: none;
  box-shadow: 0 0 10px var(--cyan-glow);
  margin-right: 6px;
}

.file-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.tree-item:hover {
  background: var(--bg-pill);
  color: var(--text-main);
}
.tree-item.folder {
  color: var(--cyan-primary);
  font-weight: 500;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar APK Download Button */
.sidebar-apk-download-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}
.sidebar-apk-download-btn:hover {
  background: rgba(0, 240, 255, 0.16);
  border-color: var(--cyan-primary);
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.15);
  transform: translateY(-1px);
}
.sidebar-apk-icon {
  font-size: 16px;
  line-height: 1;
}
.sidebar-apk-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.sidebar-apk-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cyan-primary);
}
.sidebar-apk-sub {
  font-size: 9.5px;
  color: var(--text-muted);
}
.sidebar-apk-arrow {
  color: var(--text-muted);
  transition: var(--transition);
}
.sidebar-apk-download-btn:hover .sidebar-apk-arrow {
  color: var(--cyan-primary);
  transform: translateY(2px);
}

/* Login APK Download Link */
.login-download-apk-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--cyan-primary);
  background: rgba(0, 240, 255, 0.06);
  border: 1px dashed rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
}
.login-download-apk-link:hover {
  background: rgba(0, 240, 255, 0.15);
  color: #fff;
  border-color: var(--cyan-primary);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Empty Chat APK Download Link */
.chat-empty-apk-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cyan-primary);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: var(--transition);
}
.chat-empty-apk-link:hover {
  background: rgba(0, 240, 255, 0.2);
  color: #fff;
  border-color: var(--cyan-primary);
  box-shadow: 0 0 14px var(--cyan-glow);
  transform: scale(1.03);
}

.sys-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--green-primary);
  box-shadow: 0 0 6px var(--green-primary);
}

/* ==========================================================================
   Center Pane: Organic Gemini/ChatGPT Flow Chat
   ========================================================================== */
.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 24px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  z-index: 10;
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.active-session-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.session-model-badge {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.session-id-pill {
  display: none !important;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-action {
  background: var(--bg-pill);
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.btn-header-action:hover {
  background: var(--bg-pill-hover);
  color: var(--text-main);
}

/* Messages Scroll Feed (Full-Height Draggable Edge Scrollbar) */
.chat-messages {
  flex: 1;
  overflow-y: scroll !important; /* Force scrollbar to always exist */
  padding: 20px calc(50% - 430px) 160px calc(50% - 430px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .chat-messages {
    padding: 20px 24px 160px 24px;
  }
}

/* Sovereign 3D Empty Chat Hero (Pure 3D Mesh) */
.chat-empty-3d-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px 20px 20px;
  margin: auto auto;
  text-align: center;
  width: 100%;
  animation: fadeIn 0.4s ease;
  user-select: none;
}

.chat-empty-canvas-wrap {
  width: 320px;
  height: 320px;
  max-width: 82vw;
  max-height: 82vw;
  aspect-ratio: 1 / 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

.chat-empty-3d-canvas {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1;
  display: block;
  cursor: grab;
  opacity: 1;
}
.chat-empty-3d-canvas:active {
  cursor: grabbing;
}

.chat-empty-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.chat-empty-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.history-archived-notice {
  text-align: center;
  padding: 8px 16px;
  margin: 0 auto 12px auto;
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  max-width: 540px;
}

/* Messages Bubbles: Ferrari Curvaceous & Clean Flow */
.message {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User Message: Elegant Capsule */
.message.user-msg {
  align-items: flex-end;
}

.message.user-msg .msg-bubble {
  background: #141d2d;
  border: 1px solid rgba(0, 216, 246, 0.2);
  color: #ffffff;
  padding: 13px 18px;
  border-radius: 22px 22px 4px 22px;
  max-width: 78%;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

/* Assistant Message: Elegant Subtle Tinted Surface */
.message.assistant-msg {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: var(--radius-2xl);
  padding: 18px 22px 16px 22px;
  transition: var(--transition);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}
.message.assistant-msg:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.028);
}

.msg-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
}

.msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.msg-avatar.ai {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
}

.msg-author-name {
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
}

.msg-model-tag {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* The Assistant Response Content */
.message.assistant-msg .msg-content {
  width: 100%;
  color: var(--text-main);
  font-size: 14.5px;
  line-height: 1.75;
  word-break: break-word;
}

/* Tool execution status: Sleek Capsule Pills */
.msg-tools-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 216, 246, 0.05);
  border: 1px solid rgba(0, 216, 246, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--cyan-primary);
  width: fit-content;
  max-width: 100%;
  transition: all 0.2s ease;
}
.tool-pill.success {
  background: rgba(0, 230, 118, 0.05);
  border-color: rgba(0, 230, 118, 0.18);
  color: var(--green-primary);
}

.tool-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00d8f6, #0077ff);
  color: #050a14;
  font-weight: 800;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 12px;
  margin-left: 6px;
  box-shadow: 0 0 8px rgba(0, 216, 246, 0.6);
  letter-spacing: 0.5px;
  animation: pulseScale 0.25s ease;
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Sleek Collapsible Micro-Auditor Accordion */
.auditor-details-accordion {
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 8px 0;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  overflow: hidden;
  display: block;
}

.auditor-summary-header {
  padding: 3px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  font-size: 11px;
  line-height: 1.4;
  color: #fbbf24;
  transition: all 0.15s ease;
  list-style: none;
}
.auditor-summary-header:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #fef08a;
}
.auditor-summary-header list-style, .auditor-summary-header::-webkit-details-marker {
  display: none !important;
}

.auditor-toggle-icon {
  font-size: 11px;
  font-weight: bold;
  color: #f59e0b;
  display: inline-block;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}
.auditor-details-accordion[open] .auditor-toggle-icon {
  transform: rotate(90deg);
}

.auditor-title-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.auditor-title-text code {
  background: rgba(0,0,0,0.4);
  color: #fde047;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
}

.auditor-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.auditor-status-badge.status-pass {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.auditor-status-badge.status-fail {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.auditor-accordion-content {
  padding: 8px 12px;
  border-top: 1px dashed rgba(245, 158, 11, 0.2);
  background: rgba(10, 15, 26, 0.92);
  font-size: 11px;
  line-height: 1.5;
  color: #cbd5e1;
  animation: fadeIn 0.15s ease;
}

.auditor-accordion-content blockquote {
  margin: 0 0 6px 0;
  padding: 4px 8px;
  border-left: 2px solid #f59e0b;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  font-size: 10.5px;
}
.auditor-accordion-content ul {
  margin: 4px 0 4px 16px !important;
}
.auditor-accordion-content li {
  margin-bottom: 2px !important;
}
.auditor-accordion-content strong {
  color: #fbbf24 !important;
}

/* Auditor Verifying Pulse / Shimmer Loading Animation */
.auditor-verifying-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.4);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11.5px;
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
  margin: 8px 0;
  animation: auditorPulse 1.8s infinite ease-in-out;
}
.auditor-verifying-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes auditorPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(14, 165, 233, 0.2); opacity: 0.92; }
  50% { box-shadow: 0 0 16px rgba(14, 165, 233, 0.6); opacity: 1; }
}

/* Thinking Indicator & Live CoT Stream Box */
.msg-thinking {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.thinking-shimmer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan-primary);
  font-size: 12.5px;
  font-family: var(--font-mono, monospace);
  font-style: italic;
  letter-spacing: 0.2px;
  transition: opacity 0.22s ease-in-out, transform 0.22s ease-in-out;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}
.thinking-shimmer.fade-out {
  opacity: 0.25;
  transform: translateY(-2px);
}
.dot-flashing {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--cyan-primary);
  box-shadow: 0 0 6px var(--cyan-primary);
  animation: dotFlashing 1s infinite alternate;
}

.cot-live-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(0, 216, 246, 0.2);
  border-left: 3px solid var(--cyan-primary);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fadeIn 0.2s ease;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

.tool-pill.jit-pill {
  background: rgba(245, 158, 11, 0.06) !important;
  border: 1px solid rgba(245, 158, 11, 0.22) !important;
  color: #fbbf24 !important;
  padding: 0 !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  width: fit-content !important;
  max-width: 100% !important;
  margin: 2px 0 3px 0 !important;
  display: inline-block !important;
  box-shadow: none !important;
}

.jit-details-accordion {
  width: 100%;
}

.jit-summary-header {
  padding: 2px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
  font-size: 11px;
  line-height: 1.4;
  color: #fbbf24;
  transition: all 0.15s ease;
  list-style: none;
}
.jit-summary-header:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #fef08a;
}
.jit-summary-header list-style, .jit-summary-header::-webkit-details-marker {
  display: none !important;
}

.jit-toggle-icon {
  font-size: 11px;
  font-weight: bold;
  color: #f59e0b;
  display: inline-block;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}
.jit-details-accordion[open] .jit-toggle-icon {
  transform: rotate(90deg);
}

.jit-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.jit-accordion-content {
  padding: 6px 10px 8px 10px;
  border-top: 1px dashed rgba(245, 158, 11, 0.2);
  background: rgba(10, 15, 26, 0.9);
  font-size: 10.5px;
  line-height: 1.5;
  color: #cbd5e1;
  animation: fadeIn 0.15s ease;
}

.jit-pill-body {
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.55;
  background: rgba(0, 0, 0, 0.55);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #f59e0b;
  max-height: 480px;
  overflow-y: auto;
}

.jit-pill-refs {
  font-size: 10.5px;
  color: #facc15;
  line-height: 1.6;
  background: rgba(245, 158, 11, 0.08);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px dashed rgba(245, 158, 11, 0.25);
}

.tool-pill.jit-pill code {
  background: rgba(0, 0, 0, 0.4) !important;
  color: #fef08a !important;
  padding: 1px 4px !important;
  border-radius: 3px !important;
  font-size: 10px !important;
}

.tool-pill.jit-pill em {
  color: #fde047 !important;
  font-style: normal !important;
}
@keyframes dotFlashing {
  0% { opacity: 0.2; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* Markdown Rendering Inside Response */
.msg-body h1, .msg-body h2, .msg-body h3 {
  color: #fff;
  margin: 18px 0 10px 0;
  font-weight: 600;
}
.msg-body h1 { font-size: 19px; }
.msg-body h2 { font-size: 16.5px; }
.msg-body h3 { font-size: 15px; }

.msg-body p {
  margin-bottom: 14px;
}
.msg-body p:last-child {
  margin-bottom: 0;
}

.msg-body ul, .msg-body ol {
  margin-left: 22px;
  margin-bottom: 14px;
}
.msg-body li {
  margin-bottom: 5px;
}
.msg-body strong {
  color: #ffffff;
}

.msg-body code:not(pre code) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--cyan-primary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Code Blocks: Smooth Curved Containers with Floating Header */
.code-block-container {
  position: relative;
  background: #090d16;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  margin: 16px 0;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 16px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.code-lang-tag {
  color: var(--cyan-primary);
  font-weight: 600;
  text-transform: uppercase;
}

.code-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-code-action {
  background: var(--bg-pill);
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.btn-code-action:hover {
  background: var(--cyan-soft);
  color: #fff;
}

.code-block-container pre {
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: transparent !important;
}

/* ==========================================================================
   Slash Command Autocomplete Popover (Curved Glass Card)
   ========================================================================== */
.slash-menu {
  position: absolute;
  bottom: 96px;
  left: 24px;
  right: 24px;
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  z-index: 50;
  overflow: hidden;
  padding: 6px;
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.slash-menu.hidden {
  display: none;
}

.slash-menu-header {
  padding: 8px 14px 4px 14px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.slash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
}
.slash-item:hover, .slash-item.selected {
  background: var(--bg-pill-hover);
}

.cmd-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cyan-primary);
  background: var(--cyan-soft);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  min-width: 80px;
}

.cmd-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Chat Input Card: Aerodynamic Capsule (Compact & Non-Blocking)
   ========================================================================== */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 32px 14px 32px;
  background: transparent !important; /* Pure transparent - zero blockage */
  z-index: 50;
  pointer-events: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-mode-pill-bar {
  max-width: 680px;
  width: 100%;
  margin: 0 auto 6px auto;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto !important;
}

.btn-chatmode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(13, 20, 36, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.btn-chatmode-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.btn-chatmode-pill:hover {
  background: rgba(20, 30, 52, 0.9);
  color: #fff;
  border-color: rgba(0, 216, 246, 0.3);
}

.btn-chatmode-pill.active {
  background: linear-gradient(135deg, rgba(0, 216, 246, 0.2), rgba(0, 153, 255, 0.25));
  border-color: rgba(0, 216, 246, 0.5);
  color: #00d8f6;
  box-shadow: 0 0 14px rgba(0, 216, 246, 0.2);
}

.btn-chatmode-pill.active .pill-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.chat-input-card {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 4px 8px 4px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: var(--transition);
  pointer-events: auto !important;
}
.chat-input-card:focus-within {
  border-color: var(--glass-border-focus);
  box-shadow: 0 0 18px var(--cyan-glow);
  background: #162032;
}

.btn-slash-trigger {
  background: var(--bg-pill);
  border: none;
  color: var(--cyan-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-slash-trigger:hover {
  background: var(--cyan-soft);
  transform: scale(1.05);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 120px;
  padding: 4px 2px;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
}

.btn-send {
  background: linear-gradient(135deg, var(--cyan-primary) 0%, #00b4d8 100%);
  border: none;
  color: #040912;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-send:hover {
  box-shadow: 0 0 12px var(--cyan-glow);
  transform: scale(1.05);
}

.btn-send.stop-mode {
  background: #ff3366 !important;
  color: #ffffff !important;
  animation: pulseStop 1.3s infinite ease-in-out;
}
.btn-send.stop-mode:hover {
  background: #ff0044 !important;
  box-shadow: 0 0 18px rgba(255, 51, 102, 0.75) !important;
  transform: scale(1.1);
}

@keyframes pulseStop {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(255, 51, 102, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

.chat-input-footer {
  text-align: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Right Pane: Code Canvas (Curved Floating Surface)
   ========================================================================== */
.editor-pane {
  width: 50%;
  background: var(--bg-surface);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: var(--transition);
}

.editor-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  background: transparent;
  border-bottom: 1px solid var(--glass-border);
  padding: 0 16px;
}

.tab-list {
  display: flex;
  gap: 6px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-pill);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.tab.active {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  font-weight: 600;
}

.editor-tab-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-tab-action {
  background: var(--bg-pill);
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.btn-tab-action:hover {
  background: var(--bg-pill-hover);
  color: var(--text-main);
}

.btn-tab-action.active-lock {
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.btn-tab-action.edit-mode {
  background: rgba(255, 170, 0, 0.16);
  color: #ffaa00;
  border: 1px solid rgba(255, 170, 0, 0.35);
}

/* Canvas Code History Dropdown Menu */
.canvas-history-wrap {
  position: relative;
}

.canvas-history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: var(--radius-full);
  background: var(--cyan-primary);
  color: #000;
  margin-left: 4px;
}
.canvas-history-badge.hidden {
  display: none;
}

.canvas-history-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 420px;
  background: #0d131f;
  border: 1px solid rgba(0, 216, 246, 0.25);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.18s ease;
}
.canvas-history-menu.hidden {
  display: none;
}

.history-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan-primary);
  letter-spacing: 0.5px;
}

.btn-history-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10.5px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-history-clear:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.canvas-history-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 340px;
}

.history-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.history-item-row:hover {
  background: rgba(0, 216, 246, 0.08);
  border-color: rgba(0, 216, 246, 0.25);
  transform: translateX(2px);
}
.history-item-row.active {
  background: rgba(0, 216, 246, 0.14);
  border-color: var(--cyan-primary);
}

.history-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.history-item-name {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.history-item-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cyan-primary);
}

.empty-history-hint {
  text-align: center;
  padding: 20px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* Multi-Tab Support in Canvas Tabs Bar */
.tab-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 60%;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-pill);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.tab:hover {
  background: var(--bg-pill-hover);
  color: var(--text-main);
}
.tab.active {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  font-weight: 700;
  border: 1px solid rgba(0, 216, 246, 0.3);
}
.tab.permanent-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #c9d1d9;
}
.tab.permanent-tab:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
.tab.permanent-tab.active {
  background: rgba(88, 166, 255, 0.16);
  color: #58a6ff;
  font-weight: 700;
  border: 1px solid rgba(88, 166, 255, 0.45);
}
.tab-pin-badge {
  font-size: 9px;
  opacity: 0.75;
}
.tab-close-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 2px;
}
.tab-close-btn:hover {
  opacity: 1;
  color: #ef4444;
}

.editor-container {
  flex: 1;
  position: relative;
  background: #0d1117;
  display: flex;
  overflow: hidden;
}

.editor-gutter {
  width: 48px;
  min-width: 48px;
  background: rgba(13, 17, 23, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 0;
  user-select: none;
  overflow: hidden;
  text-align: right;
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace);
  font-size: 13px;
  line-height: 1.65;
  color: #484f58;
  box-sizing: border-box;
}

.editor-gutter .line-numbers {
  padding-right: 12px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.editor-gutter .line-number {
  display: block;
  height: 21.45px; /* 13px * 1.65 line-height */
  transition: color 0.1s ease;
}

.editor-gutter .line-number.active-line {
  color: #58a6ff;
  font-weight: 600;
}

#code-editor {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: #e6edf3;
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace);
  font-size: 13px;
  line-height: 1.65;
  padding: 20px 20px 20px 12px;
  resize: none;
  outline: none;
  white-space: pre;
  tab-size: 2;
  overflow-y: auto;
  overflow-x: auto;
  box-sizing: border-box;
}

#code-editor[readonly] {
  cursor: default;
  color: #c9d1d9;
}

/* ==========================================================================
   CANVAS INTERACTIVE SANDBOX & MULTI-VIEW SUITE
   ========================================================================== */
.canvas-view-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.btn-view-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-view-toggle.active {
  background: var(--cyan-soft);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 216, 246, 0.35);
  box-shadow: 0 0 10px rgba(0, 216, 246, 0.2);
}

.btn-tab-action.btn-highlight-action {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(0, 216, 246, 0.2));
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.btn-tab-action.btn-highlight-action:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(0, 216, 246, 0.35));
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* Canvas View Panels */
.canvas-view-panel {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
}

.canvas-view-panel.hidden {
  display: none !important;
}

.canvas-code-view {
  display: flex;
  flex-direction: row;
}

/* Sandbox Preview View */
.canvas-preview-view {
  display: flex;
  flex-direction: column;
  background: #080c14;
}

.sandbox-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 14px;
  background: rgba(13, 17, 23, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sandbox-url-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #7ee787;
}

.sandbox-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.sandbox-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-ctrl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sandbox-ctrl-btn:hover {
  background: rgba(0, 216, 246, 0.12);
  color: var(--cyan-primary);
  border-color: rgba(0, 216, 246, 0.3);
}

.console-badge {
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}
.console-badge.hidden {
  display: none;
}

.sandbox-frame-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.canvas-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Console Drawer */
.sandbox-console-drawer {
  height: 180px;
  min-height: 120px;
  max-height: 50%;
  background: #0d1117;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  transition: var(--transition);
}

.sandbox-console-drawer.collapsed {
  height: 0 !important;
  min-height: 0 !important;
  border-top: none;
  overflow: hidden;
}

.console-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(22, 27, 34, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  color: #8b949e;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan-primary);
}

.btn-console-action {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 10.5px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-console-action:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.console-log-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.console-empty-hint {
  color: #484f58;
  font-style: italic;
  padding: 10px 0;
}

.console-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  word-break: break-all;
}

.console-row .time-tag {
  color: #484f58;
  font-size: 10px;
}

.console-row.log { color: #c9d1d9; }
.console-row.warn { color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.console-row.error { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.console-row.info { color: var(--cyan-primary); }

/* Markdown Document & Mermaid View */
.canvas-doc-view {
  padding: 28px 36px;
  overflow-y: auto;
  background: #0d1117;
  color: #c9d1d9;
  line-height: 1.7;
}

.doc-content-wrap {
  max-width: 900px;
  margin: 0 auto;
}

.canvas-doc-view h1,
.canvas-doc-view h2,
.canvas-doc-view h3 {
  color: #f0f6fc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-top: 24px;
  margin-bottom: 14px;
}

.canvas-doc-view h1 { font-size: 1.6rem; color: var(--cyan-primary); }
.canvas-doc-view h2 { font-size: 1.3rem; }
.canvas-doc-view h3 { font-size: 1.1rem; }

.canvas-doc-view pre {
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
}

.canvas-doc-view code {
  font-family: var(--font-mono);
  background: rgba(110, 118, 129, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.canvas-doc-view ul,
.canvas-doc-view ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

.canvas-doc-view blockquote {
  border-left: 4px solid var(--cyan-primary);
  padding-left: 14px;
  margin-left: 0;
  color: #8b949e;
  background: rgba(0, 216, 246, 0.04);
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
}

/* Interactive Mermaid Containers in Canvas */
.mermaid-sandbox-svg {
  display: flex;
  justify-content: center;
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid rgba(0, 216, 246, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  overflow-x: auto;
}


.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--glass-border);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Layout View Modes & Resizable Splitters */
.pane-resizer {
  position: relative;
  width: 8px;
  background: transparent;
  cursor: col-resize;
  z-index: 45;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 -4px;
}

.pane-resizer::after {
  content: '';
  width: 2px;
  height: 100%;
  background: var(--glass-border);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pane-resizer:hover,
.pane-resizer.is-dragging {
  background: rgba(0, 216, 246, 0.08);
}

.pane-resizer:hover::after,
.pane-resizer.is-dragging::after {
  width: 3px;
  background: var(--cyan-primary);
  box-shadow: 0 0 10px var(--cyan-primary), 0 0 20px rgba(0, 216, 246, 0.6);
}

body.layout-chat .editor-pane,
body.layout-chat .resizer-canvas {
  display: none !important;
}
body.layout-chat .chat-pane {
  flex: 1 !important;
  width: 100% !important;
}

body.layout-canvas .chat-pane,
body.layout-canvas .resizer-canvas,
body.layout-canvas .resizer-sidebar {
  display: none !important;
}
body.layout-canvas .editor-pane {
  flex: 1 !important;
  width: 100% !important;
}

body.layout-split .editor-pane {
  display: flex !important;
  flex-shrink: 0;
  width: var(--canvas-width, 50%);
  min-width: 260px;
}
body.layout-split .chat-pane {
  flex: 1 !important;
  min-width: 280px;
}

body.resizing-active,
body.resizing-active * {
  user-select: none !important;
  cursor: col-resize !important;
}

/* ==========================================================================
   Bottom Terminal Tray (Curved Sheet)
   ========================================================================== */
.terminal-tray {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.terminal-tray.open {
  display: flex;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  padding: 8px 18px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.terminal-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-primary);
  font-weight: 600;
}

.terminal-cwd {
  color: var(--text-muted);
  font-weight: normal;
}

.terminal-cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 520px;
  margin-left: 20px;
}

#terminal-cmd-input {
  flex: 1;
  background: var(--bg-app);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  color: var(--green-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}
#terminal-cmd-input:focus {
  border-color: var(--green-primary);
}

.btn-terminal-run {
  background: var(--green-soft);
  border: none;
  color: var(--green-primary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-terminal-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}
.btn-terminal-icon:hover {
  color: #fff;
  background: var(--bg-pill);
}

.terminal-output {
  flex: 1;
  padding: 12px 18px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #00e676;
  white-space: pre-wrap;
  background: var(--bg-app);
}

/* Attachment Button & Voice Button in Input Card */
.btn-input-action {
  background: var(--bg-pill);
  border: none;
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-input-action:hover {
  background: var(--bg-pill-hover);
  color: var(--text-main);
  transform: scale(1.05);
}

.btn-mic {
  color: var(--text-muted);
}
.btn-mic:hover {
  color: var(--cyan-primary);
}
.btn-mic.listening {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444 !important;
  animation: pulseMic 1.2s infinite alternate;
}

.btn-radio-toggle.playing {
  background: rgba(0, 216, 246, 0.2) !important;
  color: var(--cyan-primary) !important;
  border-color: rgba(0, 216, 246, 0.5) !important;
  animation: pulseRadio 2s infinite ease-in-out;
}

@keyframes pulseRadio {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(0, 216, 246, 0); }
  50% { transform: scale(1.08); box-shadow: 0 0 12px rgba(0, 216, 246, 0.5); }
}

/* 🎵 Header Ambient Audio Controller (Clean, Compact, In-Header) */
.chat-header-music-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 216, 246, 0.08);
  border: 1px solid rgba(0, 216, 246, 0.3);
  padding: 2px 10px;
  border-radius: 20px;
  font-family: var(--font-sans);
  color: #e6edf3;
  animation: slideUpFade 0.25s ease;
  user-select: none;
  margin-left: 8px;
}

.chat-header-music-bar.hidden {
  display: none !important;
}

.chat-header-music-bar .music-inline-disc {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: spinDisc 3.5s linear infinite;
}

.chat-header-music-bar.paused .music-inline-disc {
  animation-play-state: paused;
  opacity: 0.5;
}

.chat-header-music-bar .music-inline-title {
  font-size: 10.5px;
  font-weight: 600;
  color: #00d8f6;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.chat-header-music-bar .music-inline-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.chat-header-music-bar .btn-music-ctrl {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e6edf3;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 8.5px;
  transition: var(--transition);
}

.chat-header-music-bar .btn-music-ctrl:hover {
  background: rgba(0, 216, 246, 0.25);
  border-color: rgba(0, 216, 246, 0.6);
  color: #00d8f6;
  transform: scale(1.12);
}

.music-disc-spin {
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 216, 246, 0.12);
  border: 1px solid rgba(0, 216, 246, 0.3);
  animation: spinDisc 3.5s linear infinite;
}

.chat-header-music-bar.paused .music-disc-spin {
  animation-play-state: paused;
  opacity: 0.6;
}

@keyframes spinDisc {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.12); box-shadow: 0 0 16px rgba(239, 68, 68, 0.8); }
}

/* Attachment Previews Bar */
.attachment-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 860px;
  margin: 0 auto 8px auto;
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
}
.attachment-previews.hidden {
  display: none;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-pill);
  border: 1px solid var(--glass-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-family: var(--font-sans);
  color: var(--text-main);
}
.attachment-thumb {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
}
.attachment-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-remove-attachment {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  border-radius: var(--radius-full);
}
.btn-remove-attachment:hover {
  color: #ef4444;
}

.chat-input-wrapper.drag-over {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 20px rgba(0, 216, 246, 0.4);
}

.chat-doc-pill:hover {
  background: rgba(0, 216, 246, 0.12) !important;
  border-color: rgba(0, 216, 246, 0.4) !important;
  transform: translateY(-1px);
}

.chat-thumb-img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0, 216, 246, 0.3);
}

/* Image Lightbox Overlay */
.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}

.image-lightbox-overlay.closing {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 15, 0.88);
  backdrop-filter: blur(10px);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 216, 246, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  object-fit: contain;
}

.lightbox-close-btn {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #161b22;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.lightbox-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.1);
}

/* Assistant Response Bottom Footer Actions (Copy + TTS Voice) */
.msg-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-msg-action {
  background: var(--bg-pill);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-family: var(--font-sans);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.btn-msg-action:hover {
  background: var(--bg-pill-hover);
  color: var(--cyan-primary);
  border-color: rgba(0, 216, 246, 0.25);
  transform: translateY(-1px);
}
.btn-msg-action.copied {
  background: rgba(0, 230, 118, 0.15) !important;
  color: var(--green-primary) !important;
  border-color: rgba(0, 230, 118, 0.3) !important;
}

.btn-speak-tts.speaking {
  color: var(--cyan-primary);
  animation: pulseMic 1s infinite alternate;
}

.msg-body {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* ==========================================================================
   Mobile Responsive Navigation & Polish
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  z-index: 80;
  justify-content: space-around;
  align-items: center;
  padding: 4px 10px;
}

.mobile-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.mobile-nav-item.active {
  color: var(--cyan-primary);
  background: var(--cyan-soft);
}

.sidebar-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 70;
  pointer-events: none;
}
@media (max-width: 860px) {
  .sidebar-overlay.active {
    display: block !important;
    pointer-events: auto;
  }
}

/* Breakpoints for Mobile Fluidity */
@media (max-width: 860px) {
  .desktop-only, .desktop-only-text {
    display: none !important;
  }

  #btn-toggle-terminal {
    display: none !important;
  }

  .app-header {
    padding: 0 12px;
    height: 52px;
  }

  .brand-title {
    font-size: 12.5px;
  }

  .header-pill {
    padding: 4px 10px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: var(--bottom-nav-height);
    left: 0;
    width: 295px;
    max-width: 86vw;
    transform: translateX(-100%);
    z-index: 85;
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 26, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-footer {
    padding: 12px 14px;
    background: rgba(14, 20, 32, 0.98);
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
    position: relative;
    z-index: 10;
  }

  .btn-mobile-logout {
    color: #ff5252 !important;
  }

  .view-mode-group,
  #btn-split-toggle-action {
    display: none !important;
  }

  body.layout-split .chat-pane {
    width: 100% !important;
  }
  body.layout-split .editor-pane {
    display: none !important;
  }

  /* Full Screen Canvas Editor on Mobile when opening files */
  body.layout-canvas .chat-pane {
    display: none !important;
  }
  body.layout-canvas .editor-pane {
    display: flex !important;
    width: 100% !important;
    height: calc(100vh - 52px - var(--bottom-nav-height)) !important;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: var(--bottom-nav-height);
    z-index: 60;
  }

  /* Hide Walkthrough & Task Ledger top pinned tabs on mobile to prevent duplicate navigation */
  .editor-tabs-bar .permanent-tab,
  #tab-walkthrough,
  #tab-tasks {
    display: none !important;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .chat-messages {
    padding: 16px 18px 210px 18px !important;
    gap: 20px;
  }

  .message.user-msg .msg-bubble {
    max-width: 88%;
    padding: 12px 16px;
    font-size: 14px;
  }

  .message.assistant-msg .msg-content {
    font-size: 14px;
    line-height: 1.65;
    padding-left: 0;
  }

  .chat-input-wrapper {
    bottom: var(--bottom-nav-height);
    padding: 8px 12px 10px 12px;
  }

  .chat-input-card {
    padding: 8px 10px 8px 12px;
    gap: 6px;
    border-radius: var(--radius-xl);
  }

  #chat-input {
    font-size: 14px;
  }

  .btn-input-action, .btn-slash-trigger, .btn-send {
    width: 34px;
    height: 34px;
  }

  .terminal-tray {
    bottom: var(--bottom-nav-height);
    height: 250px;
  }
}

/* ==========================================================================
   Sovereign Login Modal Screen (Glassmorphism + Organic Curves)
   ========================================================================== */
/* ==========================================================================
   Sovereign Login Screen with 3D Interactive Canvas Background
   ========================================================================== */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 40px 10vw;
  background-color: #030712;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(0, 216, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.not-authenticated .settings-view,
body.not-authenticated #settings-view {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.hidden,
.login-modal.hidden,
body.authenticated .login-modal,
body.authenticated #login-modal {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 860px) {
  .login-modal {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 18px;
  }

  .login-card {
    max-width: 360px;
    padding: 28px 24px;
    margin: 0 auto;
  }
}

/* Full-Screen 3D Holographic Canvas */
.login-3d-bg {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
  cursor: grab;
}
.login-3d-bg:active {
  cursor: grabbing;
}

.login-backdrop-tint {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle at 30% 50%, rgba(8, 12, 20, 0.2) 0%, rgba(4, 8, 16, 0.85) 100%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  width: 100%;
  max-width: 390px;
  background: rgba(14, 20, 32, 0.82);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(0, 216, 246, 0.22);
  border-radius: var(--radius-2xl);
  padding: 34px 30px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 32px rgba(0, 216, 246, 0.15);
  animation: loginCardSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardSlide {
  0% { opacity: 0; transform: scale(0.94) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-tabs {
  display: flex;
  background: rgba(8, 12, 20, 0.7);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  margin-bottom: 18px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 216, 246, 0.2), rgba(0, 153, 255, 0.25));
  color: #fff;
  border: 1px solid rgba(0, 216, 246, 0.4);
  box-shadow: 0 0 12px rgba(0, 216, 246, 0.2);
}

.register-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto !important;
}

.register-info-box {
  background: rgba(0, 216, 246, 0.08);
  border: 1px solid rgba(0, 216, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.register-info-box p {
  color: #a0d8ef;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.btn-google-register {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #ffffff;
  color: #1f2937;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn-google-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
  background: #f8fafc;
}

.verified-email-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #a7f3d0;
}

.verified-email-badge .badge-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto !important;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: center;
}
.login-error.hidden {
  display: none;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-input-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-input-wrapper input {
  width: 100%;
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: #fff;
  outline: none;
  transition: var(--transition);
  pointer-events: auto !important;
}
.login-input-wrapper input:focus {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 16px var(--cyan-glow);
  background: rgba(16, 23, 38, 0.9);
}

.btn-login-submit {
  position: relative;
  z-index: 20;
  pointer-events: auto !important;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--cyan-primary) 0%, #0099ff 100%);
  border: none;
  color: #040912;
  font-size: 13.5px;
  font-weight: 700;
  padding: 13px 20px;
  border-radius: var(--radius-full);
  cursor: pointer !important;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 216, 246, 0.3);
}
.btn-login-submit * {
  pointer-events: none;
}
.btn-login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 216, 246, 0.5);
}
.btn-login-submit:active {
  transform: scale(0.98);
}

/* Sidebar Footer User Profile */
.user-profile-sidebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 6px;
}

.user-profile-main {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--green-primary);
  box-shadow: 0 0 8px var(--green-primary);
  flex-shrink: 0;
}

.user-display-name {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: var(--bg-pill);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.3);
  transform: scale(1.08);
}

/* ==========================================================================
   NATIVE X-FLOW SOVEREIGN SETTINGS VIEW (NO IFRAME)
   ========================================================================== */
.settings-view {
  position: fixed;
  inset: 0;
  background-color: #030712;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 216, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.05) 0%, transparent 40%);
  color: #f8fafc;
  z-index: 500;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.settings-header {
  background: rgba(13, 20, 36, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 216, 246, 0.2);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.btn-back-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0, 216, 246, 0.12);
  border: 1px solid rgba(0, 216, 246, 0.35);
  border-radius: 20px;
  color: #00d8f6;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-back-settings:hover {
  background: rgba(0, 216, 246, 0.25);
  transform: translateX(-2px);
}

.settings-brand-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.settings-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.settings-sidebar {
  width: 250px;
  background: rgba(8, 14, 26, 0.85);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), padding 0.28s ease;
}

.settings-sidebar.collapsed {
  margin-left: -250px;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 860px) {
  .settings-sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 95;
    background: rgba(6, 12, 22, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    transform: translateX(-100%);
  }
  .settings-sidebar.mobile-open {
    transform: translateX(0);
  }
}

.settings-nav-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 10px 4px 10px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s ease;
  user-select: none;
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.settings-nav-item.active {
  background: rgba(0, 216, 246, 0.12);
  color: #00d8f6;
  border: 1px solid rgba(0, 216, 246, 0.3);
}

.settings-sub-item {
  padding: 6px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
}

.settings-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #030712;
}

/* X-FLOW INTERNAL COMPONENTS IN EMBEDDED SETTINGS */
.settings-content .card {
  background: rgba(13, 20, 36, 0.7);
  border: 1px solid rgba(0, 216, 246, 0.15);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.settings-content .card:hover {
  border-color: rgba(0, 216, 246, 0.4);
}

.settings-content .card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #00d8f6;
  letter-spacing: 0.02em;
}

.settings-content .grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.settings-content .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-content .field label {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
}

.settings-content .input-box {
  display: flex;
  background: rgba(2, 4, 8, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.settings-content .input-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 7px 10px;
  outline: none;
}

.settings-content button {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.settings-content button:hover { background: #0369a1; }

.settings-content button.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}
.settings-content button.ghost:hover { background: rgba(255, 255, 255, 0.1); }

.settings-content button.danger { background: #dc2626; }
.settings-content button.danger:hover { background: #b91c1c; }

.settings-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}

.settings-content th {
  text-align: left;
  padding: 8px 10px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.65rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.settings-content td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.settings-content .badge-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-block;
  border: 1px solid transparent;
}
.settings-content .badge-status.green {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}
.settings-content .badge-status.yellow {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}
.settings-content .badge-status.red {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.settings-content .stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  width: 100%;
}
.settings-content .stat-card {
  background: rgba(10, 26, 38, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: all 0.2s ease;
}
.settings-content .stat-card:hover {
  border-color: #00d8f6;
  background: rgba(14, 36, 52, 0.9);
  transform: translateY(-2px);
}
.settings-content .stat-card .label {
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 600;
}
.settings-content .stat-card .val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

/* Toast Element for X-FLOW */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(10, 18, 30, 0.95);
  color: #00d8f6;
  border: 1px solid rgba(0, 216, 246, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 216, 246, 0.2);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono, monospace);
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   Cinematic Holographic Greeting (Windows 11 Setup Typewriter - No Box)
   ========================================================================== */
.login-hero-greeting {
  position: absolute;
  bottom: 50px;
  left: 28%;
  transform: translateX(-50%);
  z-index: 15;
  width: 520px;
  max-width: 48vw;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  pointer-events: none;
  user-select: none;
  text-align: left;
}

.greeting-pretitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 800;
  color: #00d8f6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  opacity: 0.95;
}

.greeting-pretitle .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.greeting-text-wrap {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  letter-spacing: -0.015em;
  min-height: 68px;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.95), 0 0 25px rgba(0, 216, 246, 0.25);
}

.greeting-typing-text {
  background: linear-gradient(135deg, #ffffff 55%, #7dd3fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.speech-cursor {
  display: inline-block;
  color: #00d8f6;
  font-weight: 900;
  font-size: 1.7rem;
  margin-left: 4px;
  -webkit-text-fill-color: #00d8f6;
  animation: blinkCursor 0.75s infinite;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px #00d8f6; }
  50% { opacity: 0; }
}

@media (max-width: 860px) {
  .login-hero-greeting {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 360px;
    margin: 0 auto 18px auto;
    text-align: center;
  }
  .greeting-pretitle {
    justify-content: center;
  }
  .greeting-text-wrap {
    font-size: 1.3rem;
  }
}

/* ==========================================================================
   INTERACTIVE QUESTION MODAL OVERLAY POPUP (ask_question Tool - Tabbed Edition)
   ========================================================================== */
.ask-question-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: 20px;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ask-question-card {
  background: linear-gradient(145deg, rgba(13, 22, 38, 0.98), rgba(8, 14, 26, 0.99));
  border: 1px solid rgba(0, 216, 246, 0.45);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 216, 246, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  animation: popInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popInModal {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ask-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #00d8f6;
  border-bottom: 1px solid rgba(0, 216, 246, 0.2);
  padding-bottom: 12px;
}

/* Tabs Navigation for Multi-Question */
.ask-question-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 216, 246, 0.3) transparent;
}

.ask-question-tab-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ask-question-tab-btn:hover {
  background: rgba(0, 216, 246, 0.15);
  color: #fff;
  border-color: rgba(0, 216, 246, 0.3);
}

.ask-question-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 216, 246, 0.25), rgba(0, 136, 204, 0.35));
  color: #00d8f6;
  border-color: #00d8f6;
  box-shadow: 0 0 10px rgba(0, 216, 246, 0.25);
}

.ask-question-tab-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 216, 246, 0.2);
  color: #00d8f6;
}

/* Scrollable Body Container */
.ask-question-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(88vh - 180px);
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 216, 246, 0.35) rgba(15, 23, 42, 0.5);
}

.ask-question-body::-webkit-scrollbar {
  width: 6px;
}
.ask-question-body::-webkit-scrollbar-thumb {
  background: rgba(0, 216, 246, 0.35);
  border-radius: 4px;
}

.ask-question-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ask-question-item.hidden {
  display: none !important;
}

.ask-question-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.5;
}

.ask-question-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ask-question-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.ask-question-option:hover {
  background: rgba(0, 216, 246, 0.15);
  border-color: rgba(0, 216, 246, 0.5);
  transform: translateX(2px);
}

.ask-question-option.selected {
  background: rgba(0, 216, 246, 0.25);
  border-color: #00d8f6;
  box-shadow: 0 0 14px rgba(0, 216, 246, 0.25);
}

.ask-question-option input[type="radio"],
.ask-question-option input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #00d8f6;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.ask-question-option-text {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.45;
  flex: 1;
}

.ask-question-custom-input {
  width: 100%;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
  margin-top: 4px;
}

.ask-question-custom-input:focus {
  border-color: #00d8f6;
  box-shadow: 0 0 12px rgba(0, 216, 246, 0.35);
  background: rgba(8, 12, 20, 0.98);
}

.ask-question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ask-question-nav-group {
  display: flex;
  gap: 8px;
}

.btn-ask-nav {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ask-nav:hover {
  background: rgba(0, 216, 246, 0.2);
  color: #fff;
  border-color: rgba(0, 216, 246, 0.4);
}

.btn-ask-submit {
  background: linear-gradient(135deg, #00d8f6, #0088cc);
  color: #040914;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 216, 246, 0.35);
}

.btn-ask-submit:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(0, 216, 246, 0.55);
}

.btn-ask-skip {
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ask-skip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ==========================================================================
   SYSTEM RESTART & AUTO-WAKEUP COUNTDOWN OVERLAY
   ========================================================================== */
.restart-countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000000;
  animation: fadeInModal 0.3s ease;
}

.restart-countdown-card {
  background: linear-gradient(145deg, rgba(10, 18, 32, 0.98), rgba(4, 10, 20, 0.99));
  border: 1px solid rgba(0, 216, 246, 0.6);
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 50px rgba(0, 216, 246, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.restart-spinner-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.restart-spinner-circle {
  position: absolute;
  inset: 0;
  border: 4px solid rgba(0, 216, 246, 0.15);
  border-top-color: #00d8f6;
  border-right-color: #38bdf8;
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.restart-countdown-number {
  font-size: 28px;
  font-weight: 900;
  color: #00d8f6;
  font-family: var(--font-mono);
  text-shadow: 0 0 12px rgba(0, 216, 246, 0.6);
}

.restart-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.restart-subtitle {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.restart-ping-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(0, 216, 246, 0.1);
  border: 1px solid rgba(0, 216, 246, 0.3);
  border-radius: 20px;
  font-size: 11px;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.restart-ping-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1s infinite;
}

/* ==========================================================================
   Team Inget Live Visual Indicators & Toasts
   ========================================================================== */
.team-inget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.team-inget-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: rgba(10, 18, 30, 0.95);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
  font-size: 12px;
}

.team-inget-toast.active-scanning {
  border: 1px solid rgba(0, 216, 246, 0.4);
  color: #38bdf8;
}

.team-inget-toast.success-universal {
  border: 1px solid rgba(16, 185, 129, 0.5);
  background: rgba(6, 28, 20, 0.95);
  color: #34d399;
}

.team-inget-toast.success-private {
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(28, 20, 6, 0.95);
  color: #fbbf24;
}

.team-inget-toast .toast-title {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.team-inget-toast .toast-desc {
  font-size: 11px;
  color: #cbd5e1;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.inget-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 216, 246, 0.25);
  border-top-color: #00d8f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
