/* ============================================================
   TLE AI — STYLES
   All colors via CSS variables. Change :root to retheme.
   ============================================================ */

/* ── 1. CSS VARIABLES ── */
:root {
  /* Backgrounds */
  --bg-sidebar:        #f7f7f8;
  --bg-main:           #ffffff;
  --bg-input:          #f4f4f4;
  --bg-hover:          #ececec;
  --bg-active:         #e5e5e5;
  --bg-overlay:        rgba(0, 0, 0, 0.35);
  --bg-dropdown:       #ffffff;
  --bg-user-bubble:    #f0f4ff;
  --bg-toast:          #1f2937;

  /* Text */
  --text-primary:      #202123;
  --text-muted:        #6e6e80;
  --text-sidebar:      #374151;
  --text-inverse:      #ffffff;

  /* Accent */
  --accent:            #1a3a6b;
  --accent-hover:      #14305a;
  --accent-light:      #e8eef8;

  /* Borders */
  --border:            #e5e7eb;
  --border-input:      #d1d5db;
  --border-focus:      #1a3a6b;

  /* Status colors */
  --success:           #16a34a;
  --warning:           #ca8a04;
  --danger:            #dc2626;
  --danger-hover:      #b91c1c;
  --danger-bg:         #fef2f2;

  /* Status badge backgrounds */
  --status-completed-bg:  #dcfce7;
  --status-completed-text: #15803d;
  --status-pending-bg:    #fef9c3;
  --status-pending-text:  #854d0e;
  --status-failed-bg:     #fee2e2;
  --status-failed-text:   #991b1b;
  --status-processing-bg: #dbeafe;
  --status-processing-text: #1d4ed8;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'Fira Code', 'Courier New', monospace;

  /* Sizing */
  --sidebar-width:   260px;
  --input-max-width: 48rem;
  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       18px;
  --radius-xl:       24px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.12);
}

/* ── 2. RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── 3. APP SHELL ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── 4. SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.sidebar-top {
  padding: 12px 12px 8px;
  flex-shrink: 0;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.new-chat-btn:hover { background: var(--accent-hover); }
.new-chat-btn svg { flex-shrink: 0; }

/* Conversation list */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
}
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-track { background: transparent; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.conv-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 8px 4px;
}

/* Conversation item */
.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background 0.1s;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-active); }

.conv-item:hover .conv-menu-btn,
.conv-item.active .conv-menu-btn { opacity: 1; }

.conv-title-link {
  flex: 1;
  display: block;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--text-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.conv-title-link:hover { color: var(--text-primary); }

.conv-title-input {
  flex: 1;
  padding: 6px 8px;
  font-size: 13.5px;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--text-primary);
  outline: none;
  margin: 4px 4px 4px 6px;
}

/* Pin icon on pinned items */
.conv-pin-icon {
  font-size: 11px;
  color: var(--accent);
  padding-left: 6px;
  flex-shrink: 0;
}

/* ── 5. CONVERSATION MENU (⋮) ── */
.conv-menu {
  position: relative;
  flex-shrink: 0;
}

.conv-menu-btn {
  opacity: 0;
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  transition: opacity 0.15s, background 0.1s;
  margin-right: 4px;
}
.conv-menu-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.conv-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  min-width: 148px;
  background: var(--bg-dropdown);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
  animation: dropdown-in 0.1s ease;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.conv-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  text-align: left;
  transition: background 0.1s;
}
.conv-dropdown button:hover { background: var(--bg-hover); }
.conv-dropdown button.danger { color: var(--danger); }
.conv-dropdown button.danger:hover { background: var(--danger-bg); }

/* ── 6. SIDEBAR BOTTOM ── */
.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: background 0.1s;
  cursor: pointer;
  position: relative;
}
.user-info:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sidebar);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.user-menu-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-dropdown);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 100;
}
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  text-align: left;
  text-decoration: none;
  transition: background 0.1s;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover { background: var(--bg-hover); }

/* ── 7. MAIN CONTENT AREA ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

/* ── 8. CHAT HEADER ── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-main);
  min-height: 57px;
}

.chat-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.hamburger-btn:hover { background: var(--bg-hover); }

/* ── 9. MESSAGE AREA ── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  scroll-behavior: smooth;
}
.messages-area::-webkit-scrollbar { width: 5px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.messages-inner {
  max-width: var(--input-max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Message bubbles */
.message-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

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

.message-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
}

.message-row.user .message-bubble {
  background: var(--bg-user-bubble);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--text-primary);
}

.message-row.assistant .message-bubble {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* Markdown inside bubbles */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--text-primary);
}
.message-bubble h1 { font-size: 17px; }
.message-bubble h2 { font-size: 15px; }
.message-bubble h3 { font-size: 14px; }

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

.message-bubble ul,
.message-bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}
.message-bubble li { margin-bottom: 4px; }

.message-bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-input);
  padding: 2px 5px;
  border-radius: 4px;
}

.message-bubble pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
}

.message-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-muted);
}

.message-bubble strong { font-weight: 600; }
.message-bubble em { font-style: italic; }

.message-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* ── 10. TYPING INDICATOR ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Streaming response area */
.streaming-area {
  max-width: var(--input-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.streaming-bubble {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-primary);
  max-width: 85%;
}

/* ── 11. CITATIONS BAR ── */
.citations-bar {
  max-width: var(--input-max-width);
  margin: 6px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.citations-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.citation-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #c8d8f0;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 12. INPUT AREA ── */
.input-area {
  padding: 12px 20px 16px;
  background: var(--bg-main);
  flex-shrink: 0;
}

.input-wrapper {
  max-width: var(--input-max-width);
  margin: 0 auto;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26,58,107,0.08);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-primary);
  min-height: 24px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px 0;
}
.chat-textarea::placeholder { color: var(--text-muted); }

.send-btn {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}
.send-btn:disabled {
  background: var(--border-input);
  cursor: not-allowed;
}

/* ── Voice Button ── */
.voice-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border-input);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
}
.voice-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ── Voice Overlay ── */
#voice-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.voice-modal {
  background: var(--bg-main);
  border-radius: 20px;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 280px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.voice-status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}
.voice-status-icon.listening {
  background: #e6f4ea;
  color: #1e7e34;
  animation: pulse 1.5s infinite;
}
.voice-status-icon.speaking {
  background: #fff3e0;
  color: #e65100;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30,126,52,0.3); }
  50% { box-shadow: 0 0 0 12px rgba(30,126,52,0); }
}
.voice-status-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}
.voice-transcript {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 300px;
  min-height: 20px;
  line-height: 1.5;
}
.voice-stop-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}
.voice-stop-btn:hover { background: #fecaca; }

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

/* ── 13. EMPTY STATE ── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.empty-state h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 14px;
  text-align: center;
  max-width: 360px;
  line-height: 1.6;
}

/* ── 14. TOAST NOTIFICATION ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-toast);
  color: var(--text-inverse);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 15. SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 40;
}

/* ── 16. ADMIN PANEL ── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar-logo {
  padding: 20px 16px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.admin-nav {
  padding: 8px;
  flex: 1;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-sidebar);
  transition: background 0.1s;
  margin-bottom: 2px;
}
.admin-nav a:hover { background: var(--bg-hover); }
.admin-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.admin-main {
  flex: 1;
  padding: 28px 32px;
  background: var(--bg-main);
  overflow-y: auto;
}

.admin-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tables */
.admin-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-table th {
  background: var(--bg-sidebar);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-sidebar); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.badge-completed  { background: var(--status-completed-bg);   color: var(--status-completed-text); }
.badge-pending    { background: var(--status-pending-bg);     color: var(--status-pending-text); }
.badge-processing { background: var(--status-processing-bg);  color: var(--status-processing-text); }
.badge-failed     { background: var(--status-failed-bg);      color: var(--status-failed-text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-primary);
  border-color: var(--border-input);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-file {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-main);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus,
.form-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(26,58,107,0.08); }

.form-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 560px;
}

/* Alert messages */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}
.alert-error {
  background: var(--status-failed-bg);
  border-color: #fca5a5;
  color: var(--status-failed-text);
}
.alert-info {
  background: var(--status-processing-bg);
  border-color: #93c5fd;
  color: var(--status-processing-text);
}

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar);
  padding: 24px;
}

.auth-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.15s;
}
.btn-google:hover { background: var(--bg-hover); }

/* ── 17. MOBILE RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 50;
    transform: translateX(-100%);
  }

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

  .sidebar-overlay.visible {
    display: block;
  }

  .hamburger-btn {
    display: flex;
  }

  .messages-inner,
  .streaming-area,
  .citations-bar {
    padding: 0 12px;
  }

  .input-area {
    padding: 10px 12px 14px;
  }

  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
  }

  .admin-nav {
    display: flex;
    gap: 4px;
    padding: 8px;
  }

  .admin-nav a {
    white-space: nowrap;
  }
}
