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

:root {
  /* Navy Blue Palette */
  --navy-900: #0d1f33;
  --navy-800: #1e3a5f;
  --navy-700: #2d5a87;
  --navy-600: #3d7ab0;
  --navy-500: #4d9ad9;

  /* Gold Accents */
  --gold-600: #8b6914;
  --gold-500: #b8860b;
  --gold-400: #d4a017;
  --gold-300: #f0c040;
  --gold-200: #f5d872;

  /* Neutrals */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic Colors */
  --primary: var(--navy-800);
  --primary-hover: var(--navy-700);
  --accent: var(--gold-500);
  --accent-hover: var(--gold-400);
  --background: var(--gray-50);
  --surface: #ffffff;
  --border: var(--gray-200);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-500);

  /* Status Colors */
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Layout */
  --sidebar-width: 320px;
  --header-height: 64px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  font-size: 15px;
}

/* ========================================
   MAIN LAYOUT
   ======================================== */

.main-content {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  background: var(--background);
  position: relative;
}

/* ========================================
   SIDEBAR - Navy Background
   ======================================== */

/* Sidebar styles now defined in index.html for ChatGPT-style collapse */

/* Old sidebar toggle styles removed - using ChatGPT-style collapse */

/* Old sidebar reveal button removed - using ChatGPT-style collapse */

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.sidebar-nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav-link.active {
  background: rgba(184, 134, 11, 0.2);
  color: var(--gold-400);
}

/* New Chat Button - Gold Accent */
.new-chat-btn-container {
  margin-top: 12px;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-600) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-500) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4);
}

.new-chat-btn .btn-icon-circle {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.new-chat-btn .btn-icon-circle svg {
  width: 16px;
  height: 16px;
}

/* Sidebar Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Sessions List */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item {
  position: relative;
  padding: 14px 16px;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.session-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--gold-400);
}

.session-item-content {
  flex: 1;
  min-width: 0;
}

.session-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.session-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.session-item-time {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  flex-shrink: 0;
}

.session-item-preview {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.session-item-date {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-item-date::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

/* Session Menu */
.session-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.session-item:hover .session-menu-btn {
  display: flex;
}

.session-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.session-menu-btn svg {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.6);
}

.session-menu-dropdown {
  position: absolute;
  right: 8px;
  top: 100%;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 160px;
  display: none;
  overflow: hidden;
}

.session-menu-dropdown.show {
  display: block;
}

.session-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: background 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.session-menu-item:hover {
  background: var(--gray-100);
}

.session-menu-item.danger {
  color: var(--danger);
}

.session-menu-item.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.session-menu-item svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   CHAT PANEL
   ======================================== */

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transition: width 0.3s ease;
  position: relative;
  min-height: 0;
}

.chat-panel.split-view {
  flex: 1 1 auto;
  min-width: 280px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--gray-50);
  min-height: 0;
}

/* Welcome Message */
.welcome-message {
  max-width: 700px;
  margin: 60px auto;
  text-align: center;
}

.welcome-message h3 {
  font-size: 1.8rem;
  margin-bottom: 16px;
  color: var(--navy-800);
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.capabilities {
  text-align: left;
  max-width: 600px;
  margin: 24px auto;
  padding: 24px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.capabilities h4 {
  margin-bottom: 12px;
  color: var(--navy-800);
  font-size: 1rem;
}

.capabilities ul {
  list-style: none;
  padding-left: 0;
}

.capabilities li {
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  color: var(--text-secondary);
}

.capabilities li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 16px;
  height: 16px;
  background: var(--gold-500);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-size: contain;
}

/* ========================================
   MESSAGE STYLES
   ======================================== */

.message {
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

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

.message-label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message.user .message-label {
  text-align: right;
  color: var(--navy-700);
}

.message.assistant .message-label {
  color: var(--gold-600);
}

.message-content {
  padding: 18px 22px;
  border-radius: 14px;
  line-height: 1.7;
}

.message.user .message-content {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: white;
  margin-left: auto;
  max-width: 80%;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Markdown Content */
.message-content h1,
.message-content h2,
.message-content h3 {
  margin-top: 16px;
  margin-bottom: 12px;
  color: var(--navy-800);
}

.message.user .message-content h1,
.message.user .message-content h2,
.message.user .message-content h3 {
  color: white;
}

.message-content h1 {
  font-size: 1.5rem;
}
.message-content h2 {
  font-size: 1.3rem;
}
.message-content h3 {
  font-size: 1.1rem;
}

.message-content p {
  margin-bottom: 12px;
}

.message-content ul,
.message-content ol {
  margin-bottom: 12px;
  padding-left: 24px;
}

.message-content li {
  margin-bottom: 6px;
}

.message-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.9em;
}

.message.user .message-content code {
  background: rgba(255, 255, 255, 0.2);
}

.message-content pre {
  background: var(--gray-900);
  color: #f8f8f2;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.message-content blockquote {
  border-left: 3px solid var(--gold-500);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text-secondary);
}

.message-content a {
  /* color: var(--navy-700); */
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message.user .message-content a {
  color: var(--gold-300);
}

/* Page Links - Gold Accent */
.page-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  margin: 0 3px;
  border-radius: 6px;
  border: 1px solid var(--navy-600);
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: white;
  font-size: 0.8em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: baseline;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.page-link:hover {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
  border-color: var(--gold-400);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.page-link:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.citation-doc {
  font-size: 0.7em;
  color: var(--text-secondary);
  margin-left: 4px;
  font-style: italic;
}

/* Source Chips - Citation Display at Bottom of Messages */
.source-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.source-chips-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 280px;
}

.source-chip:hover {
  background: var(--navy-800);
  border-color: var(--navy-700);
  color: white;
  box-shadow: var(--shadow-sm);
}

.source-chip:hover .source-chip-icon {
  color: var(--gold-400);
}

.source-chip-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.source-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.source-chip-pages {
  font-size: 0.75rem;
  padding: 2px 6px;
  background: var(--gold-500);
  color: white;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}

.source-chip:hover .source-chip-pages {
  background: var(--gold-400);
}

/* ========================================
   CHAT FOOTER - Unified Input Area
   ======================================== */

.chat-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Filter Row */
.filter-row {
  position: relative;
  margin-bottom: 10px;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-toggle:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

.filter-toggle.open {
  background: var(--navy-800);
  color: white;
  border-color: var(--navy-800);
}

.filter-toggle .chevron {
  transition: transform 0.2s ease;
}

.filter-toggle.open .chevron {
  transform: rotate(180deg);
}

.filter-panel {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.filter-panel.open {
  display: block;
}

/* Input Row */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.input-actions-left {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.input-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.input-action-btn:hover {
  border-color: var(--navy-600);
  color: var(--navy-600);
  background: rgba(30, 58, 95, 0.05);
}

.input-action-btn.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #059669;
  color: white;
}

.input-wrapper {
  flex: 1;
  min-width: 0;
}

.chat-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  max-height: 120px;
  line-height: 1.4;
  background: var(--gray-50);
}

.chat-input:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
  background: var(--surface);
}

.chat-input:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
  transform: scale(1.05);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

/* Web Search Badge */
.web-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Hybrid Search Badge */
.hybrid-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Web Search Result Styling */
.web-search-result .message-content {
  border-left: 3px solid #059669;
  padding-left: 16px;
}

.web-search-message .thinking-content {
  border-left: 3px solid #059669;
  padding-left: 16px;
}

/* Web Citation Badges */
.web-citation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  margin: 0 2px;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(8, 145, 178, 0.3);
}

.web-citation-badge:hover {
  background: linear-gradient(135deg, #0e7490 0%, #155e75 100%);
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(8, 145, 178, 0.4);
}

/* Clickable web citations (with URL) */
a.web-citation-badge {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

a.web-citation-badge:hover {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Non-clickable web citations (no URL found) */
span.web-citation-badge {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  cursor: default;
  opacity: 0.8;
}

span.web-citation-badge:hover {
  transform: none;
}

/* Web Sources Section */
.web-sources {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.web-sources-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.web-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.web-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.web-source-link:hover {
  background: var(--gray-200);
  color: #059669;
}

.web-source-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #059669;
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.web-source-domain {
  color: inherit;
}

/* Hybrid Search Sections */
.hybrid-search-result .message-content {
  border-left: 3px solid #7c3aed;
  padding-left: 16px;
}

.hybrid-section {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 12px;
}

.hybrid-section:last-child {
  margin-bottom: 0;
}

.hybrid-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-700);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.hybrid-section-header svg {
  color: var(--gold-500);
}

.documents-section {
  border-left: 3px solid var(--navy-600);
}

.web-section {
  border-left: 3px solid #059669;
}

/* Grounded Search Styles */
.grounded-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.grounded-search-result .message-content {
  border-left: 3px solid #0891b2;
  padding-left: 16px;
}

.grounded-section {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 12px;
}

.grounded-section:last-child {
  margin-bottom: 0;
}

.grounded-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.primary-section {
  border-left: 3px solid var(--navy-600);
}

.primary-section .grounded-section-header {
  color: var(--navy-700);
}

.primary-section .grounded-section-header svg {
  color: var(--gold-500);
}

.verification-section {
  border-left: 3px solid #059669;
  background: rgba(5, 150, 105, 0.05);
}

.verification-section .grounded-section-header {
  color: #047857;
}

.verification-section .grounded-section-header svg {
  color: #059669;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 24px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: white;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.btn-primary svg {
  width: 24px;
  height: 24px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--navy-700);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}

.btn-link:hover {
  color: var(--navy-800);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.btn-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-label {
  letter-spacing: 0.4px;
}

.danger-btn {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.danger-btn:hover {
  background: rgba(220, 38, 38, 0.2);
}

/* ========================================
   LOADING & THINKING STATES
   ======================================== */

.loading-message .message-content {
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.typing-indicator {
  display: flex;
  gap: 6px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy-600);
  animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-8px);
  }
}

.thinking-animation {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-right: 8px;
}

.thinking-dot {
  width: 8px;
  height: 8px;
  background: var(--gold-500);
  border-radius: 50%;
  animation: thinking-bounce 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.thinking-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes thinking-bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.thinking-content {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(184, 134, 11, 0.1);
  border-radius: 8px;
  color: var(--gold-600);
  font-weight: 500;
  border: 1px solid rgba(184, 134, 11, 0.2);
}

.thinking-text {
  font-size: 14px;
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--navy-700);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* ========================================
   PDF VIEWER PANEL
   ======================================== */

.pdf-panel {
  position: relative;
  width: 0;
  flex: 0 0 0;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease;
  pointer-events: none;
  min-height: 0;
}

.pdf-panel.open {
  width: 45%;
  flex: 0 0 auto;
  pointer-events: auto;
}

.pdf-panel:not(.open) .pdf-panel-content,
.pdf-panel:not(.open) .pdf-toolbar {
  opacity: 0;
}

.pdf-panel.open .pdf-panel-content,
.pdf-panel.open .pdf-toolbar {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Resize Handle */
.resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  cursor: col-resize;
  z-index: 100;
  transition: background 0.2s ease;
}

.resize-handle:hover,
.resize-handle.dragging {
  background: var(--gold-500);
}

.pdf-panel:not(.open) .resize-handle {
  display: none;
}

.pdf-panel-header {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.pdf-panel-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 16px;
}

.pdf-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* PDF Toolbar */
.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.pdf-toolbar-left,
.pdf-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.pdf-toolbar-btn:hover {
  background: var(--gray-100);
  border-color: var(--navy-700);
}

.pdf-zoom-level {
  min-width: 60px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.pdf-page-indicator {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* PDF Content */
.pdf-panel-content {
  flex: 1;
  overflow: hidden;
  background: var(--gray-100);
  display: flex;
  flex-direction: column;
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  background: var(--gray-100);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.pdf-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 16px;
}

.pdf-page-container {
  background: white;
  box-shadow: var(--shadow-md);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-message {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.pdf-page-container.highlighted {
  box-shadow: 0 0 0 3px var(--gold-400), var(--shadow-lg);
  animation: highlightPulse 0.6s ease-out;
}

@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 0 0 var(--gold-400), var(--shadow-lg);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(184, 134, 11, 0.3), var(--shadow-lg);
    transform: scale(1.005);
  }
  100% {
    box-shadow: 0 0 0 3px var(--gold-400), var(--shadow-lg);
    transform: scale(1);
  }
}

.pdf-highlight-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--gold-500);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  max-width: 260px;
  line-height: 1.4;
}

/* ========================================
   UPLOAD PAGE
   ======================================== */

.upload-content {
  flex: 1;
  height: 100vh;
  padding: 32px;
  overflow-y: auto;
  background: var(--background);
}

.upload-panel {
  max-width: 960px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-header h1 {
  font-size: 1.35rem;
  margin-bottom: 6px;
  color: var(--navy-800);
}

.panel-header p {
  color: var(--text-secondary);
  max-width: 560px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--gray-50);
}

.dropzone:hover {
  border-color: var(--navy-700);
  background: rgba(30, 58, 95, 0.03);
}

.dropzone.drag-over {
  border-color: var(--gold-500);
  background: rgba(184, 134, 11, 0.05);
  transform: scale(1.01);
}

.dropzone.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--navy-700);
}

.dropzone-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.dropzone-subtext {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.uploads-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  background: var(--gray-50);
}

.uploads-count {
  font-weight: 600;
  color: var(--navy-800);
}

.uploads-actions {
  display: flex;
  gap: 12px;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  gap: 16px;
  transition: border-color 0.2s ease;
}

.upload-item:hover {
  border-color: var(--navy-700);
}

.upload-details {
  flex: 1;
  min-width: 0;
}

.upload-details h4 {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.file-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-icon {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  color: var(--navy-700);
  flex-shrink: 0;
}

/* ========================================
   SCROLLBARS
   ======================================== */

.chat-messages::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar,
.pdf-viewer::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track,
.pdf-viewer::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.pdf-viewer::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.pdf-viewer::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   SUGGESTED QUESTIONS
   ======================================== */

.suggested-questions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.suggested-questions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggested-questions-header svg {
  width: 16px;
  height: 16px;
  color: var(--gold-500);
}

.suggested-questions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggested-question-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  width: 100%;
}

.suggested-question-btn:hover {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  border-color: var(--navy-700);
  color: white;
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.suggested-question-btn:hover .question-number {
  background: var(--gold-500);
  color: white;
}

.question-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-800);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.question-text {
  flex: 1;
  line-height: 1.4;
}

/* ========================================
   CATEGORY FILTER BAR
   ======================================== */

.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-label svg {
  color: var(--gold-500);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--gray-100);
  border: 2px solid transparent;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.category-chip:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

.category-chip.selected {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  border-color: var(--navy-700);
  color: white;
}

.category-chip.selected:hover {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
}

.category-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.category-chip.selected .chip-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Document Picker Styles */
.category-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.category-group.expanded {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}

.category-chip-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.category-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.category-expand-btn:hover {
  background: var(--gray-100);
  color: var(--navy-600);
  border-color: var(--navy-300);
}

.category-expand-btn.expanded {
  background: var(--navy-100);
  color: var(--navy-700);
  border-color: var(--navy-300);
}

.category-expand-btn svg {
  transition: transform 0.2s ease;
}

.category-expand-btn.expanded svg {
  transform: rotate(180deg);
}

.document-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.document-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 6px 4px;
  margin-bottom: 4px;
}

.document-list-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-select-all-btn {
  font-size: 0.7rem;
  color: var(--navy-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.doc-select-all-btn:hover {
  background: var(--navy-100);
}

.document-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 0.8rem;
}

.document-item:hover {
  background: var(--gray-100);
}

.document-item.selected {
  background: rgba(30, 58, 95, 0.08);
}

.doc-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--navy-600);
}

.doc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.document-item.selected .doc-name {
  color: var(--navy-700);
  font-weight: 500;
}

/* Document list scrollbar */
.document-list::-webkit-scrollbar {
  width: 4px;
}

.document-list::-webkit-scrollbar-track {
  background: transparent;
}

.document-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 2px;
}

.document-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 968px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 999;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .chat-panel {
    width: 100%;
  }

  .workspace {
    flex-direction: column;
  }

  .pdf-panel.open {
    width: 100%;
    flex: 0 0 100%;
  }

  .sidebar-reveal {
    top: 64px;
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  /* Header Mobile */
  .top-header {
    padding: 8px 12px;
  }

  .header-left {
    gap: 10px;
  }

  .header-logo {
    height: 36px;
  }

  .header-divider {
    height: 32px;
  }

  .header-brand h1 {
    font-size: 1.1rem;
  }

  .header-brand p {
    font-size: 0.6rem;
    display: none;
  }

  .header-logo-right {
    display: none;
  }

  .user-info-sm {
    display: none;
  }

  .user-avatar-sm {
    width: 32px;
    height: 32px;
  }

  .user-menu-trigger {
    padding: 6px;
  }

  /* Chat Footer Mobile */
  .chat-footer {
    padding: 10px 12px 14px;
  }

  .filter-row {
    margin-bottom: 8px;
  }

  .filter-toggle {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .filter-panel {
    padding: 10px;
  }

  .category-chips {
    gap: 6px;
  }

  .category-chip {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .chip-count {
    font-size: 0.65rem;
    padding: 1px 5px;
  }

  .input-row {
    gap: 6px;
  }

  .input-actions-left {
    gap: 4px;
  }

  .input-action-btn {
    width: 34px;
    height: 34px;
  }

  .input-action-btn svg {
    width: 16px;
    height: 16px;
  }

  .chat-input {
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .send-btn {
    width: 38px;
    height: 38px;
  }

  .send-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Messages Mobile */
  .chat-messages {
    padding: 12px;
  }

  .message {
    margin-bottom: 12px;
  }

  .message-content {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .message-label {
    font-size: 0.75rem;
  }

  /* Welcome Message Mobile */
  .welcome-message {
    padding: 20px 16px;
  }

  .welcome-message h3 {
    font-size: 1.2rem;
  }

  .welcome-message p {
    font-size: 0.9rem;
  }

  /* Source Chips Mobile */
  .source-chips {
    flex-direction: column;
    align-items: stretch;
  }

  .source-chip {
    font-size: 0.8rem;
  }

  /* Suggested Questions Mobile */
  .suggested-questions {
    gap: 6px;
  }

  .suggested-question-btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  /* PDF Panel Mobile */
  .pdf-panel.open {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
  }

  .pdf-panel-header {
    padding: 12px;
  }

  .pdf-panel-title {
    font-size: 0.9rem;
  }

  .pdf-toolbar {
    padding: 8px 12px;
  }

  /* Hybrid/Web Search Mobile */
  .hybrid-section {
    padding: 12px;
  }

  .hybrid-section-header {
    font-size: 0.8rem;
  }

  .web-sources-list {
    gap: 6px;
  }

  .web-source-link {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

/* Very Small Screens */
@media (max-width: 400px) {
  .header-brand h1 {
    font-size: 1rem;
  }

  .header-logo {
    height: 32px;
  }

  .input-actions-left {
    display: none;
  }

  .filter-toggle span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-input {
    padding: 8px 12px;
  }

  .send-btn {
    width: 36px;
    height: 36px;
  }
}

/* ========================================
   ENHANCED MOBILE STYLES
   ======================================== */

/* Sidebar Expand Handle - Hidden on desktop */
.sidebar-expand-handle {
  display: none;
}

/* Mobile User Section - Hidden on desktop */
.mobile-user-section {
  display: none;
}

/* Mobile Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.show {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  /* Sidebar Expand Handle - Arrow on left edge */
  .sidebar-expand-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: var(--navy-800);
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    z-index: 500;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
  }

  .sidebar-expand-handle svg {
    width: 16px;
    height: 16px;
    color: white;
  }

  .sidebar-expand-handle:active {
    background: var(--navy-700);
  }

  /* Hide expand handle when sidebar is open */
  body.sidebar-open .sidebar-expand-handle {
    opacity: 0;
    pointer-events: none;
  }

  /* Body when sidebar open */
  body.sidebar-open {
    overflow: hidden;
  }

  /* Main content adjustments */
  .main-content {
    flex-direction: column;
    height: 100vh;
  }

  .workspace {
    flex-direction: column;
    height: 100vh;
    padding-top: 0;
  }

  /* Sidebar Mobile - Completely Hidden by Default */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 85%;
    max-width: 300px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    display: flex !important;
    flex-direction: column !important;
  }

  /* Hide the rail completely on mobile */
  .sidebar-rail {
    display: none !important;
  }

  /* Always show expanded view on mobile */
  .sidebar-expanded {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    width: 100%;
    overflow: hidden;
  }

  /* Remove collapsed state effect on mobile */
  .sidebar.collapsed {
    width: 85%;
    max-width: 300px;
    transform: translateX(-100%);
  }

  .sidebar.collapsed .sidebar-expanded {
    display: flex !important;
  }

  .sidebar.collapsed .sidebar-rail {
    display: none !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.mobile-open.collapsed {
    transform: translateX(0);
  }

  /* Sidebar Header Mobile */
  .sidebar-header-row {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-title {
    font-size: 1.2rem;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  /* Sidebar Actions Mobile */
  .sidebar-actions {
    padding: 12px 16px;
  }

  .sidebar-action-btn {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .sidebar-action-btn.primary {
    background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-400) 100%);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
  }

  /* Sessions List Mobile */
  .sessions-list {
    padding: 8px 12px;
  }

  .session-item {
    padding: 14px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .session-item:hover,
  .session-item:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .session-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid var(--gold-400);
  }

  .session-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
  }

  .session-item-preview {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
  }

  .session-item-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
  }

  /* Session Menu Button */
  .session-menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
  }

  /* Sidebar Navigation Mobile */
  .sidebar-nav {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
  }

  .sidebar-nav-link {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  /* Mobile User Section */
  .mobile-user-section {
    display: block;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
  }

  .mobile-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-400) 100%);
    color: var(--navy-900);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
  }

  .mobile-user-details {
    flex: 1;
    min-width: 0;
  }

  .mobile-user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-user-email {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-user-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-user-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
  }

  .mobile-user-action-btn:active {
    background: rgba(255, 255, 255, 0.15);
  }

  .mobile-user-action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .mobile-user-action-btn.danger {
    color: #f87171;
  }

  /* Chat Panel Full Width */
  .chat-panel {
    width: 100% !important;
    flex: 1 1 auto;
  }

  /* Chat Messages */
  .chat-messages {
    padding: 16px 12px;
    padding-bottom: 8px;
  }

  .message {
    margin-bottom: 16px;
    max-width: 100%;
  }

  .message.user .message-content {
    max-width: 90%;
    margin-left: auto;
  }

  .message-content {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
  }

  /* Welcome Message Mobile */
  .welcome-message {
    margin: 20px auto;
    padding: 0 16px;
  }

  .welcome-message h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
  }

  .welcome-message p {
    font-size: 0.95rem;
  }

  .capabilities {
    padding: 16px;
    margin: 16px auto;
    border-radius: 10px;
  }

  .capabilities h4 {
    font-size: 0.95rem;
  }

  .capabilities li {
    padding: 6px 0;
    padding-left: 24px;
    font-size: 0.9rem;
  }

  /* Chat Footer - Fixed at Bottom */
  .chat-footer {
    padding: 10px 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
  }

  /* Add padding to chat messages to account for fixed footer */
  .chat-messages {
    padding-bottom: 140px !important;
  }

  /* Filter Row Mobile */
  .filter-row {
    margin-bottom: 10px;
  }

  .filter-toggle {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 16px;
  }

  .filter-panel {
    position: fixed;
    bottom: 70px;
    left: 12px;
    right: 12px;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 16px;
  }

  .category-filter-bar {
    padding: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .category-chips {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .category-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  /* Input Row Mobile */
  .input-row {
    gap: 10px;
    align-items: flex-end;
  }

  .input-wrapper {
    flex: 1;
    background: var(--gray-100);
    border-radius: 24px;
    border: 1px solid var(--border);
  }

  .chat-input {
    padding: 12px 16px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    border-radius: 24px;
    min-height: 44px;
    max-height: 120px;
    background: transparent;
    border: none;
    width: 100%;
    line-height: 1.4;
  }

  .chat-input::placeholder {
    font-size: 14px;
    color: var(--gray-400);
    opacity: 1;
  }

  .chat-input:focus {
    outline: none;
    box-shadow: none;
  }

  .input-wrapper:focus-within {
    border-color: var(--navy-600);
    box-shadow: 0 0 0 3px rgba(45, 90, 135, 0.15);
  }

  .send-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-800) 100%);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
  }

  .send-btn:active {
    transform: scale(0.95);
  }

  .send-btn:disabled {
    opacity: 0.5;
    box-shadow: none;
  }

  .input-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
  }

  /* Page Links Mobile */
  .page-link {
    padding: 4px 10px;
    font-size: 0.75em;
    margin: 2px;
  }

  /* Source Chips Mobile */
  .source-chips {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .source-chip {
    max-width: 100%;
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  /* Suggested Questions Mobile */
  .suggested-questions {
    margin-top: 16px;
    padding-top: 12px;
  }

  .suggested-questions-list {
    gap: 8px;
  }

  .suggested-question-btn {
    padding: 12px 14px;
    font-size: 0.9rem;
    border-radius: 12px;
  }

  .question-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  /* PDF Panel Mobile - Full Screen */
  .pdf-panel {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100vh !important;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .pdf-panel.open {
    transform: translateX(0);
    flex: none !important;
  }

  .pdf-panel-header {
    padding: 12px 16px;
  }

  .pdf-panel-title {
    font-size: 0.95rem;
  }

  .pdf-close-btn {
    width: 40px;
    height: 40px;
  }

  .pdf-toolbar {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .pdf-toolbar-btn {
    width: 40px;
    height: 40px;
  }

  .resize-handle {
    display: none;
  }

  /* Web/Hybrid Search Mobile */
  .grounded-section,
  .hybrid-section {
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 10px;
  }

  .grounded-section-header,
  .hybrid-section-header {
    font-size: 0.85rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .web-sources {
    margin-top: 14px;
    padding-top: 10px;
  }

  .web-sources-list {
    gap: 8px;
  }

  .web-source-link {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
  }

  /* Upload Page Mobile */
  .upload-content {
    padding: 16px;
  }

  .upload-panel {
    padding: 20px;
    border-radius: 12px;
  }

  .panel-header {
    flex-direction: column;
    gap: 12px;
  }

  .panel-header h1 {
    font-size: 1.2rem;
  }

  .dropzone {
    padding: 24px 16px;
    border-radius: 10px;
  }

  .upload-icon {
    width: 40px;
    height: 40px;
  }

  .dropzone-text {
    font-size: 0.95rem;
  }

  .dropzone-subtext {
    font-size: 0.8rem;
  }

  .uploads-toolbar {
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .upload-item {
    padding: 14px;
    flex-wrap: wrap;
  }

  .file-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }

  /* Session Items Mobile */
  .session-item {
    padding: 12px 14px;
  }

  .session-item-name {
    font-size: 0.9rem;
  }

  /* Sidebar Content Mobile - Additional Overrides */
  .sidebar-content {
    padding: 8px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide desktop-only elements */
  .sidebar-reveal {
    display: none;
  }

  /* Empty State Mobile */
  .empty-sessions {
    padding: 40px 20px;
    text-align: center;
  }

  .empty-sessions svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
    margin-bottom: 16px;
  }

  .empty-sessions p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .session-menu-btn {
    display: flex;
    opacity: 0.7;
  }

  .suggested-question-btn:active {
    transform: scale(0.98);
  }

  .page-link:active {
    transform: scale(0.95);
  }

  .send-btn:active {
    transform: scale(0.95);
  }

  .category-chip:active {
    transform: scale(0.97);
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-messages {
    padding: 12px;
  }

  .welcome-message {
    margin: 16px auto;
  }

  .welcome-message h3 {
    font-size: 1.2rem;
  }

  .capabilities {
    padding: 12px;
  }

  .pdf-panel.open {
    width: 60% !important;
    transform: translateX(0);
  }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .chat-footer {
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .chat-messages {
      padding-bottom: calc(160px + env(safe-area-inset-bottom)) !important;
    }

    .sidebar {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}
