:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --accent-glow: 0 0 24px rgba(99, 102, 241, 0.35);
  --success: #10b981;
  --success-glow: 0 0 16px rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: 'Inter', 'Noto Sans Bengali', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --header-height: 60px;
  --mobile-nav-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* Background animated glow orbs */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.14;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -150px;
  left: -100px;
}
.orb-2 {
  width: 450px;
  height: 450px;
  background: #06b6d4;
  bottom: -150px;
  right: -100px;
}

/* App Header */
header.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  flex-shrink: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  flex-shrink: 0;
}
.brand-icon {
  font-size: 1.25rem;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-titles h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Status Indicators & Badges */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  box-shadow: var(--success-glow);
  animation: pulse-dot 2.5s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.badge-admin {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}
.badge-canonical {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.35);
  color: #67e8f9;
}
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
  filter: brightness(1.1);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* App Main Layout */
.app-container {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
  width: 100%;
}

/* Desktop Sidebar Navigation */
nav.app-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.85rem 0.65rem;
  flex-shrink: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.nav-item.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
}
.nav-item .nav-icon {
  font-size: 1.1rem;
}

/* Content Area */
main.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* VIEW SECTIONS - CLEAN VISIBILITY */
.view-section {
  display: none;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem 1.75rem;
}

.view-section.active {
  display: flex;
  flex-direction: column;
}

/* CHAT VIEW - DEDICATED FULL HEIGHT ZERO PADDING */
#chat-view.view-section {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100% !important;
}
#chat-view.view-section.active {
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  height: 100% !important;
}

/* ================================================= */
/* CHAT VIEW ARCHITECTURE                            */
/* ================================================= */

.chat-container {
  display: flex;
  height: 100%;
  width: 100%;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Chat Session History Sidebar */
.chat-history-sidebar,
.chat-sidebar {
  width: 260px;
  min-width: 260px;
  background: rgba(15, 23, 42, 0.75);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 20;
}

.chat-history-header,
.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.chat-history-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
}

.session-item {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}
.session-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.08);
}
.session-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
  border-color: rgba(99, 102, 241, 0.35);
}

/* Chat Main Flow Area */
.chat-main-flow,
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-primary);
  position: relative;
}

/* Chat Top Bar */
.chat-topbar {
  height: 48px;
  min-height: 48px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 10;
}
.chat-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.chat-topbar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.chat-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Scrollable Messages Area */
.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Message Bubbles */
.chat-bubble,
.message-bubble {
  max-width: 82%;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  position: relative;
  line-height: 1.6;
  animation: fadeIn 0.15s ease-out;
  word-break: break-word;
  overflow-wrap: anywhere;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble-user,
.message-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  padding: 0.85rem 1.15rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.bubble-assistant,
.message-assistant {
  align-self: flex-start;
  background: rgba(17, 24, 39, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.bubble-header,
.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bubble-user .bubble-header,
.message-user .message-meta {
  color: rgba(255, 255, 255, 0.75);
}
.bubble-author {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bubble-body {
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.bubble-body code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.bubble-body pre {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  overflow-x: auto;
  max-width: 100%;
  margin: 0.65rem 0;
}
.bubble-body pre code {
  background: none;
  padding: 0;
}

/* Welcome Card for Empty State */
.chat-welcome-card {
  align-self: center;
  max-width: 640px;
  width: 100%;
  margin: 2rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}
.welcome-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  box-shadow: var(--accent-glow);
  font-size: 1.8rem;
}
.welcome-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* Quick Prompt Chips */
.chat-chips {
  padding: 0.45rem 1rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.5);
  flex-shrink: 0;
}
.chat-chips::-webkit-scrollbar {
  height: 4px;
}
.chat-chips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.chip {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* Composer Bar */
.chat-input-container,
.chat-input-bar {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.chat-textarea {
  flex: 1;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  resize: none;
  min-height: 46px;
  height: 46px;
  max-height: 140px;
  line-height: 1.45;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.chat-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

#btn-send-chat {
  height: 46px;
  min-width: 80px;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Loading Dots Animation */
.loading-dots {
  display: inline-block;
  color: var(--accent-secondary);
  font-weight: 500;
  animation: pulse-text 1.5s infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Mobile-only and Desktop-only helpers */
.mobile-only {
  display: none !important;
}
.desktop-only {
  display: block;
}

/* Mobile Bottom Navigation (Hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

/* ================================================= */
/* OTHER VIEWS: CARDS & GRIDS                       */
/* ================================================= */
.view-header {
  margin-bottom: 1.25rem;
}
.view-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.view-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.grid-cards-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.grid-cards-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
}
.stat-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}
.data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  margin: 1rem;
}
.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.login-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-primary);
}

.alert-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Mobile Drawer Overlay for Sessions / Menu */
.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  z-index: 60;
  backdrop-filter: blur(4px);
}
.mobile-drawer-backdrop.active {
  display: block;
}

/* ================================================= */
/* RESPONSIVE DESIGN (MOBILE & TABLET)               */
/* ================================================= */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
  nav.app-sidebar {
    width: 200px;
    min-width: 200px;
  }
  .chat-history-sidebar,
  .chat-sidebar {
    width: 220px;
    min-width: 220px;
  }
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 52px;
    --mobile-nav-height: 56px;
  }

  .mobile-only {
    display: inline-flex !important;
  }
  .desktop-only {
    display: none !important;
  }

  /* Header scaling */
  header.app-header {
    padding: 0 0.85rem;
  }
  .brand-titles h1 {
    font-size: 0.88rem;
  }
  .brand-subtitle {
    display: none;
  }
  .badge-canonical {
    display: none;
  }

  /* Hide Desktop Sidebar */
  nav.app-sidebar {
    display: none !important;
  }

  /* App Container adjusts for bottom nav */
  .app-container {
    height: calc(100vh - var(--header-height) - var(--mobile-nav-height));
    height: calc(100dvh - var(--header-height) - var(--mobile-nav-height));
  }

  /* Chat container takes full width */
  .chat-container {
    padding: 0;
    gap: 0;
  }

  /* Chat Sidebar transforms into mobile drawer */
  .chat-history-sidebar,
  .chat-sidebar {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: 82%;
    max-width: 320px;
    height: calc(100vh - var(--header-height) - var(--mobile-nav-height));
    height: calc(100dvh - var(--header-height) - var(--mobile-nav-height));
    z-index: 70;
    transition: left var(--transition-normal);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.7);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
  }
  .chat-history-sidebar.mobile-open,
  .chat-sidebar.mobile-open {
    left: 0;
  }

  /* Chat Main Flow takes 100% width */
  .chat-main-flow,
  .chat-window {
    width: 100%;
  }

  .chat-messages-scroll {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .chat-bubble,
  .message-bubble {
    max-width: 90%;
    font-size: 0.88rem;
    padding: 0.75rem 0.95rem;
  }

  .chat-welcome-card {
    margin: 1rem auto;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
  }
  .welcome-title {
    font-size: 1.1rem;
  }
  .welcome-desc {
    font-size: 0.82rem;
  }

  .chat-chips {
    padding: 0.4rem 0.75rem;
  }
  .chip {
    font-size: 0.74rem;
    padding: 0.3rem 0.65rem;
  }

  /* Composer bar with touch friendliness */
  .chat-input-container,
  .chat-input-bar {
    padding: 0.6rem 0.75rem;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }
  .chat-textarea {
    font-size: 0.88rem;
    padding: 0.65rem 0.85rem;
    min-height: 44px;
    height: 44px;
  }
  #btn-send-chat {
    height: 44px;
    min-width: 68px;
    padding: 0 0.85rem;
    font-size: 0.85rem;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    z-index: 50;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.25rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    height: 100%;
    transition: color var(--transition-fast);
  }
  .mobile-nav-btn.active {
    color: #a5b4fc;
    font-weight: 600;
  }
  .mobile-nav-btn .m-icon {
    font-size: 1.15rem;
    line-height: 1;
  }

  /* Non-chat views on mobile */
  .view-section {
    padding: 1rem;
    overflow-y: auto;
  }
  .grid-cards-2,
  .grid-cards-3 {
    grid-template-columns: 1fr;
  }
}
