/* ==============================================================================
   HIYUKI // GLACIO CHAFE DESIGN SYSTEM — OPTIMIZED UI/UX
   Wuthering Waves Resonance Theme + Antigravity IDE Architecture
   ============================================================================== */

:root {
  /* Glacio Palette */
  --bg-deep-abyss: #070b12;
  --bg-surface-slate: #0b121e;
  --bg-card-glass: rgba(12, 20, 34, 0.78);
  --bg-card-hover: rgba(18, 30, 52, 0.88);
  --bg-input-glass: rgba(10, 17, 30, 0.92);
  
  /* Crystalline Accents */
  --glacio-cyan: #67e8f9;
  --glacio-ice: #38bdf8;
  --glacio-bright: #a5f3fc;
  --glacio-glow: rgba(103, 232, 249, 0.28);
  --glacio-subtle-glow: rgba(56, 189, 248, 0.12);
  
  /* Borders & Crystals */
  --border-crystal: rgba(103, 232, 249, 0.22);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(103, 232, 249, 0.45);
  
  /* Typography & Colors */
  --text-main: #f0f9ff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-accent: #70e1ff;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-display: 'Cinzel', serif;

  /* Dimensions */
  --sidebar-width: 280px;
  --topbar-height: 56px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.glacio-env {
  font-family: var(--font-sans);
  background-color: var(--bg-deep-abyss);
  color: var(--text-main);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Background Frost Canvas */
.frost-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
}

/* App Main Layout Grid */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==============================================================================
   1. SIDEBAR (ANTIGRAVITY SESSIONS & MEMORY)
   ============================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: rgba(9, 14, 24, 0.92);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
}

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

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-signature {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crest-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px var(--glacio-cyan));
  animation: frostPulse 4s ease-in-out infinite alternate;
}

@keyframes frostPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px var(--glacio-cyan)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 12px var(--glacio-ice)); }
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 1.2px;
  color: #fff;
  background: linear-gradient(135deg, #fff 40%, var(--glacio-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--glacio-cyan);
  opacity: 0.85;
}

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.sidebar-collapse-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
}

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

.btn-new-protocol {
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16) 0%, rgba(103, 232, 249, 0.06) 100%);
  border: 1px solid var(--border-crystal);
  border-radius: var(--radius-sm);
  color: var(--glacio-bright);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.06);
}

.btn-new-protocol:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28) 0%, rgba(103, 232, 249, 0.14) 100%);
  border-color: var(--glacio-cyan);
  box-shadow: 0 0 16px var(--glacio-glow);
  transform: translateY(-1px);
}

/* Biological Server Load Card */
.bio-load-card {
  margin: 6px 14px 10px;
  padding: 10px 12px;
  background: rgba(14, 22, 36, 0.65);
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.bio-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.pulse-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseBeacon 2s infinite ease-in-out;
}

@keyframes pulseBeacon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.bio-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
}

.bio-status {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--glacio-bright);
  margin-bottom: 5px;
}

.bio-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
}

.bio-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.bio-note {
  font-size: 10.5px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
}

/* Sidebar Sessions List */
.sidebar-sessions-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 14px;
}

.sessions-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 8px 4px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12.5px;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  text-decoration: none;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.session-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
  color: var(--glacio-bright);
}

.session-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.btn-delete-session {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 13px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.session-item:hover .btn-delete-session {
  opacity: 1;
}

.btn-delete-session:hover {
  color: #f87171;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(7, 11, 18, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drive-sync-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--glacio-cyan);
  opacity: 0.9;
}

.btn-icon-footer {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.btn-icon-footer:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

/* ==============================================================================
   2. RE-ENGINEERED HEADER (ANTIGRAVITY + GLACIO CHAFE)
   ============================================================================== */
.main-sanctuary {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background: radial-gradient(circle at 50% 0%, rgba(14, 27, 49, 0.45) 0%, rgba(7, 11, 18, 0.88) 100%);
  overflow: hidden;
}

.sanctuary-topbar {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 13, 22, 0.78);
  backdrop-filter: blur(20px);
  z-index: 25;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.topbar-icon-btn:hover {
  color: var(--glacio-bright);
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--border-crystal);
}

.topbar-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
}

/* Model Selector Pill */
.model-picker-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(13, 21, 35, 0.85);
  border: 1px solid var(--border-crystal);
  border-radius: var(--radius-sm);
  padding: 3px 6px 3px 8px;
  box-shadow: 0 0 10px rgba(103, 232, 249, 0.06);
  transition: var(--transition-smooth);
}

.model-picker-pill:hover,
.model-picker-pill:focus-within {
  border-color: var(--glacio-cyan);
  box-shadow: 0 0 14px var(--glacio-glow);
}

.model-symbol {
  font-size: 13px;
  color: var(--glacio-cyan);
}

.model-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.model-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 18px 3px 2px;
  cursor: pointer;
  outline: none;
}

.model-select option {
  background: #0b121e;
  color: #fff;
  padding: 6px;
}

.select-arrow {
  position: absolute;
  right: 0;
  pointer-events: none;
  color: var(--glacio-cyan);
  opacity: 0.8;
}

.engine-badge-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--glacio-cyan);
  background: rgba(56, 189, 248, 0.14);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(103, 232, 249, 0.2);
}

/* Active Protocol Breadcrumb */
.active-protocol-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.protocol-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--glacio-cyan);
  box-shadow: 0 0 6px var(--glacio-cyan);
}

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

/* Center Aura */
.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.resonance-aura-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  color: var(--glacio-bright);
}

.aura-sparkle {
  font-size: 12px;
  animation: frostPulse 3s infinite alternate;
}

/* Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.telemetry-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(14, 23, 38, 0.6);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(103, 232, 249, 0.18);
  display: flex;
  align-items: center;
  gap: 6px;
}

.telemetry-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.telemetry-pill.active .telemetry-live-dot {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseBeacon 1.2s infinite;
}

.telemetry-divider {
  opacity: 0.35;
}

.topbar-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.action-pill-btn.icon-only {
  width: 32px;
  padding: 0;
  justify-content: center;
}

.action-pill-btn:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--border-crystal);
  color: var(--glacio-bright);
}

/* WebGPU Download Progress Banner */
.webgpu-progress-banner {
  padding: 8px 20px;
  background: rgba(12, 22, 38, 0.95);
  border-bottom: 1px solid var(--border-crystal);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.webgpu-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--glacio-bright);
  margin-bottom: 5px;
}

.webgpu-pct {
  margin-left: auto;
  font-family: var(--font-mono);
}

.webgpu-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.webgpu-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #67e8f9);
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* ==============================================================================
   3. CHAT THREAD & MESSAGES
   ============================================================================== */
.chat-thread-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

/* Custom Scrollbar */
.chat-thread-container::-webkit-scrollbar,
.sidebar-sessions-wrap::-webkit-scrollbar {
  width: 5px;
}

.chat-thread-container::-webkit-scrollbar-track,
.sidebar-sessions-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.chat-thread-container::-webkit-scrollbar-thumb,
.sidebar-sessions-wrap::-webkit-scrollbar-thumb {
  background: rgba(103, 232, 249, 0.15);
  border-radius: 3px;
}

.chat-thread-container::-webkit-scrollbar-thumb:hover,
.sidebar-sessions-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(103, 232, 249, 0.35);
}

/* Welcome Sanctuary */
.welcome-sanctuary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px 16px;
  margin: auto 0;
}

.hero-emblem {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(103, 232, 249, 0.05));
  border: 1px solid var(--border-crystal);
  box-shadow: 0 0 24px var(--glacio-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: floatEmblem 6s ease-in-out infinite;
}

@keyframes floatEmblem {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.emblem-core {
  font-size: 30px;
  filter: drop-shadow(0 0 8px var(--glacio-bright));
}

.hero-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff 40%, var(--glacio-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 540px;
  margin-bottom: 28px;
  line-height: 1.6;
}

.hero-subtitle strong {
  color: var(--glacio-bright);
}

.quick-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 660px;
}

.prompt-chip {
  background: rgba(12, 19, 32, 0.7);
  border: 1px solid var(--border-crystal);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.prompt-chip:hover {
  background: rgba(18, 30, 52, 0.95);
  border-color: var(--glacio-cyan);
  box-shadow: 0 0 16px var(--glacio-glow);
  transform: translateY(-2px);
}

.chip-icon {
  font-size: 18px;
  line-height: 1;
  padding-top: 2px;
}

.chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip-title {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.chip-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Message Rows */
.message-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.25s ease-out;
}

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

.message-row.user {
  align-items: flex-end;
}

.message-bubble.user {
  max-width: 80%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0f2b4c 0%, #164273 100%);
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 16px 16px 4px 16px;
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.message-row.assistant {
  align-items: flex-start;
}

.message-meta-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--glacio-cyan);
  margin-bottom: 2px;
}

.message-bubble.assistant {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-card-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-crystal);
  border-radius: 4px 16px 16px 16px;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.65;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ==============================================================================
   COLLAPSIBLE THINKING PROCESS (ANTIGRAVITY / DEEPMIND STYLE)
   ============================================================================== */
.thinking-block {
  margin-bottom: 14px;
  background: rgba(8, 14, 24, 0.75);
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition-smooth);
}

.thinking-block summary {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--glacio-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.07);
  user-select: none;
}

.thinking-block summary::-webkit-details-marker {
  display: none;
}

.thinking-block[open] summary {
  border-bottom: 1px dashed rgba(103, 232, 249, 0.2);
}

.thinking-sparkle {
  font-size: 12px;
  animation: frostPulse 3s infinite;
}

.think-timer {
  color: var(--text-muted);
  font-size: 10.5px;
  margin-left: auto;
}

.think-content {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  background: rgba(5, 8, 14, 0.45);
}

/* Markdown formatting inside assistant bubble */
.message-bubble.assistant p {
  margin-bottom: 10px;
}

.message-bubble.assistant p:last-child {
  margin-bottom: 0;
}

.message-bubble.assistant h1,
.message-bubble.assistant h2,
.message-bubble.assistant h3,
.message-bubble.assistant h4 {
  font-family: var(--font-sans);
  color: #fff;
  margin: 16px 0 8px;
  font-weight: 700;
}

.message-bubble.assistant h1 { font-size: 1.35rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 5px; }
.message-bubble.assistant h2 { font-size: 1.15rem; }
.message-bubble.assistant h3 { font-size: 1.02rem; }

.message-bubble.assistant ul,
.message-bubble.assistant ol {
  margin: 6px 0 12px 20px;
}

.message-bubble.assistant li {
  margin-bottom: 5px;
}

.message-bubble.assistant blockquote {
  border-left: 3px solid var(--glacio-cyan);
  padding: 6px 14px;
  margin: 10px 0;
  background: rgba(103, 232, 249, 0.05);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--glacio-bright);
}

.message-bubble.assistant pre {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(103, 232, 249, 0.18);
  background: #080d16 !important;
  overflow-x: auto;
}

.message-bubble.assistant code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--glacio-bright);
}

.message-bubble.assistant pre code {
  background: transparent;
  padding: 12px;
  display: block;
  color: #e2e8f0;
}

.message-bubble.assistant table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
}

.message-bubble.assistant th,
.message-bubble.assistant td {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.message-bubble.assistant th {
  background: rgba(56, 189, 248, 0.1);
  color: var(--glacio-bright);
}

/* ==============================================================================
   4. BOTTOM COMPOSER (ANTIGRAVITY STYLE COMMAND CONSOLE)
   ============================================================================== */
.sanctuary-composer {
  padding: 10px 16px 16px;
  background: linear-gradient(180deg, transparent 0%, rgba(7, 11, 18, 0.96) 40%);
  position: relative;
  z-index: 10;
}

.composer-box {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-input-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-crystal);
  border-radius: var(--radius-md);
  padding: 10px 14px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px var(--glacio-subtle-glow);
  transition: var(--transition-smooth);
}

.composer-box:focus-within {
  border-color: var(--glacio-cyan);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 20px var(--glacio-glow);
}

.composer-top-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 10.5px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--glacio-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--glacio-cyan);
  box-shadow: 0 0 5px var(--glacio-cyan);
}

.tag-meta {
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.prompt-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  min-height: 24px;
}

.prompt-textarea::placeholder {
  color: var(--text-dim);
}

.btn-send {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--glacio-ice) 0%, #2563eb 100%);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-send:hover {
  background: linear-gradient(135deg, var(--glacio-bright) 0%, #3b82f6 100%);
  box-shadow: 0 0 16px var(--glacio-glow);
  transform: scale(1.04);
}

.btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.composer-bottom-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10.5px;
  color: var(--text-dim);
}

.shortcuts-hint kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-muted);
}

.status-encryption {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--glacio-cyan);
  opacity: 0.75;
}

/* ==============================================================================
   5. SETTINGS MODAL
   ============================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #0b1320;
  border: 1px solid var(--border-crystal);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 24px var(--glacio-subtle-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-row h3 {
  font-size: 15px;
  color: #fff;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.help-link {
  color: var(--glacio-cyan);
  text-decoration: none;
  font-size: 11.5px;
}

.help-link:hover {
  text-decoration: underline;
}

.form-input, .form-select {
  background: rgba(7, 11, 18, 0.85);
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus {
  border-color: var(--glacio-cyan);
  box-shadow: 0 0 10px var(--glacio-glow);
}

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.vault-info-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(103, 232, 249, 0.22);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-muted);
}

.vault-info-box code {
  color: var(--glacio-bright);
  font-family: var(--font-mono);
  display: block;
  margin-bottom: 3px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(7, 11, 18, 0.5);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, var(--glacio-ice) 0%, #0284c7 100%);
  border: 1px solid var(--border-crystal);
  color: #fff;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: var(--transition-smooth);
  box-shadow: 0 0 12px var(--glacio-subtle-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--glacio-bright) 0%, #0369a1 100%);
  box-shadow: 0 0 18px var(--glacio-glow);
}

/* ==============================================================================
   6. RESPONSIVE BREAKPOINTS (LEGION Y700 / TABLET / MOBILE)
   ============================================================================== */
@media (max-width: 960px) {
  .topbar-center {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(0);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: 0;
  }

  .active-protocol-pill {
    display: none;
  }

  .telemetry-pill {
    display: none;
  }

  .action-pill-btn .action-label {
    display: none;
  }

  .action-pill-btn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .quick-prompts-grid {
    grid-template-columns: 1fr;
  }

  .sanctuary-topbar {
    padding: 0 12px;
  }

  .sanctuary-composer {
    padding: 8px 12px 14px;
  }
}
