/* ==========================================================================
   DocMind -- Design System
   ========================================================================== */

/* -- Variables ------------------------------------------------------------ */
:root {
  /* Base backgrounds */
  --bg-page:     #0b0d14;
  --bg-sidebar:  #10131f;
  --bg-elevated: #161b2e;
  --bg-card:     #1c2237;
  --bg-hover:    #212840;
  --bg-input:    #161b2e;

  /* Borders */
  --border-subtle: #252d47;
  --border-medium: #2e3a5c;
  --border-focus:  #6c5ce7;

  /* Text */
  --text-primary:   #e4eaf8;
  --text-secondary: #8896b8;
  --text-muted:     #4a5680;
  --text-hint:      #3b4565;

  /* Accent -- purple */
  --accent:         #6c5ce7;
  --accent-hover:   #7c6ef0;
  --accent-active:  #5a4bcb;
  --accent-subtle:  rgba(108, 92, 231, 0.15);
  --accent-glow:    rgba(108, 92, 231, 0.35);

  /* Status */
  --success:     #00cca3;
  --success-bg:  rgba(0, 204, 163, 0.12);
  --error:       #ff5f6d;
  --error-bg:    rgba(255, 95, 109, 0.12);
  --warning:     #ffa94d;
  --warning-bg:  rgba(255, 169, 77, 0.12);

  /* Misc */
  --sidebar-w:   264px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.65);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --transition:  0.18s ease;
}

/* -- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }


/* ==========================================================================
   AUTH OVERLAY
   ========================================================================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  z-index: 1000;
  overflow: hidden;
}

/* Animated background shapes */
.auth-bg-shapes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
}
.shape-1 {
  width: 500px; height: 500px;
  background: #6c5ce7;
  top: -150px; left: -100px;
  animation: floatShape 12s ease-in-out infinite alternate;
}
.shape-2 {
  width: 400px; height: 400px;
  background: #0984e3;
  bottom: -100px; right: -80px;
  animation: floatShape 16s ease-in-out infinite alternate-reverse;
}
.shape-3 {
  width: 300px; height: 300px;
  background: #00cca3;
  top: 40%; left: 55%;
  animation: floatShape 10s ease-in-out infinite alternate;
}
@keyframes floatShape {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

/* Auth card */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 36px 32px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(108,92,231,0.08);
  z-index: 1;
  max-height: 95vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.auth-card::-webkit-scrollbar { display: none; }

/* Auth header */
.auth-header { text-align: center; margin-bottom: 28px; }

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logo-mark {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.logo-wordmark {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-tagline {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Auth panels */
.auth-panel { display: flex; flex-direction: column; gap: 14px; }
.auth-panel.hidden { display: none; }

/* Form inside auth panel needs its own column flex so groups have gaps */
.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Google button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  color: #3c4043;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid #dadce0;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.btn-google:active { background: #f0f0f0; transform: scale(0.99); }

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

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.forgot-link {
  font-size: 12px;
  color: var(--accent);
  transition: color var(--transition);
}
.forgot-link:hover { color: var(--accent-hover); text-decoration: underline; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input::placeholder { color: var(--text-hint); }
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Primary button */
.btn-primary {
  width: 100%;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { background: var(--accent-active); transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Auth error / success */
.auth-error {
  font-size: 13px;
  color: var(--error);
  min-height: 0;
  line-height: 0;   /* collapse when empty */
  overflow: hidden;
}
.auth-error:not(:empty) { line-height: 1.5; }
.auth-error:not(:empty) {
  padding: 9px 12px;
  background: var(--error-bg);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,95,109,.2);
}
.auth-success {
  font-size: 13px;
  color: var(--success);
  padding: 9px 12px;
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,204,163,.2);
}


/* ==========================================================================
   FORGOT PASSWORD MODAL
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 2000;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.hidden { display: none !important; }

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

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: -4px;
}


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

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}


/* ==========================================================================
   SIDEBAR
   ========================================================================== */

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

/* Sidebar top */
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark-sm {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-new-chat:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Sidebar sections */
.sidebar-section { padding: 12px 10px 8px; overflow: hidden; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 6px 8px;
}

/* Chat history */
.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.no-history {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 8px;
}

.chat-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.chat-history-item:hover { background: var(--bg-hover); }
.chat-history-item.active { background: var(--accent-subtle); }

.chi-icon { font-size: 13px; margin-top: 1px; flex-shrink: 0; opacity: 0.6; }
.chi-body { flex: 1; min-width: 0; }
.chi-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chi-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chi-time { font-size: 10px; color: var(--text-hint); margin-top: 2px; }
.chi-delete {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition);
}
.chat-history-item:hover .chi-delete { opacity: 1; }
.chi-delete:hover { background: var(--error-bg); color: var(--error); }

/* Sidebar divider */
.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0 10px;
  flex-shrink: 0;
}

/* Upload zone */
.upload-zone {
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.upload-icon { color: var(--text-muted); transition: color var(--transition); }
.upload-zone:hover .upload-icon { color: var(--accent); }

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

.btn-browse {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 5px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-browse:hover { background: var(--accent-subtle); }

/* Doc list */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.doc-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.doc-card-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.doc-card-info { flex: 1; min-width: 0; }
.doc-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-meta { font-size: 11px; color: var(--text-muted); }

.doc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 4px;
}
.doc-status-badge.processing { background: var(--warning-bg); color: var(--warning); }
.doc-status-badge.ready      { background: var(--success-bg); color: var(--success); }
.doc-status-badge.error      { background: var(--error-bg);   color: var(--error);   }

/* Spinner */
.spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.footer-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.footer-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.footer-user-email {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 148px;
  display: block;
}

.btn-signout {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-signout:hover { background: var(--error-bg); color: var(--error); }


/* ==========================================================================
   CHAT MAIN
   ========================================================================== */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0 16px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

/* Welcome screen */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding: 40px 24px;
}

.welcome-graphic { margin-bottom: 20px; }

.welcome-icon-ring {
  width: 72px; height: 72px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-medium);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  margin: 0 auto;
  box-shadow: 0 0 0 8px var(--accent-subtle);
}

.welcome-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  margin-bottom: 8px;
}
.welcome-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.example-queries {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 540px;
}
.example-chip {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--bg-card);
  transition: all var(--transition);
  cursor: pointer;
}
.example-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}


/* -- Message rows --------------------------------------- */

.msg-row {
  display: flex;
  gap: 12px;
  padding: 8px 48px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-row.user .msg-avatar      { background: var(--accent); color: #fff; }
.msg-row.assistant .msg-avatar {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  font-size: 10px;
}

.msg-bubble { max-width: 72%; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.msg-row.user .msg-bubble { align-items: flex-end; }

.msg-content {
  padding: 11px 15px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.user .msg-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: normal;
}
.msg-row.assistant .msg-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.msg-content.msg-error {
  background: var(--error-bg);
  border-color: rgba(255,95,109,.2);
  color: var(--error);
}

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  display: inline;
  animation: blink 0.7s step-end infinite;
  color: var(--accent);
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* Thinking dots */
.thinking-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
}
.thinking-dots span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}


/* -- Markdown body -------------------------------------- */

.markdown-body { white-space: normal; }

.markdown-body p { margin-bottom: 10px; }
.markdown-body p:last-child { margin-bottom: 0; }

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 16px 0 8px;
  color: var(--text-primary);
}
.markdown-body h1 { font-size: 1.4em; }
.markdown-body h2 { font-size: 1.2em; }
.markdown-body h3 { font-size: 1.05em; }

.markdown-body ul, .markdown-body ol {
  padding-left: 20px;
  margin-bottom: 10px;
}
.markdown-body li { margin-bottom: 4px; }

.markdown-body code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.875em;
  background: rgba(108, 92, 231, 0.12);
  color: #c3b5ff;
  padding: 1px 5px;
  border-radius: 4px;
}
.markdown-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin-bottom: 12px;
}
.markdown-body pre code {
  background: none;
  color: var(--text-primary);
  padding: 0;
  font-size: 0.875em;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 10px 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 14px 0;
}

/* Tables */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 13px;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.markdown-body thead { background: var(--bg-elevated); }
.markdown-body th {
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.markdown-body td {
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}
.markdown-body tbody tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
.markdown-body tbody tr:nth-child(even) td { background: rgba(255,255,255,0.02); }


/* -- Citations & Confidence ---------------------------- */

.citations { margin-top: 4px; }

.citations-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.citations-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.citations-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.citations-list.collapsed { max-height: 0; opacity: 0; }

.citation-item {
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.citation-source {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.citation-excerpt {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.conf-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.conf-dot.conf-high   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.conf-dot.conf-medium { background: var(--warning); }
.conf-dot.conf-low    { background: var(--error); }


/* -- Input area ---------------------------------------- */

.input-area {
  padding: 12px 48px 20px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 10px 12px 10px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.message-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.message-textarea::placeholder { color: var(--text-hint); }
.message-textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.send-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}
.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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


/* ==========================================================================
   TOAST
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error   { border-color: var(--error);   color: var(--error);   background: var(--error-bg);   }
.toast.success { border-color: var(--success); color: var(--success); background: var(--success-bg); }


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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-medium); }


/* ==========================================================================
   UTILITY
   ========================================================================== */

.hidden { display: none !important; }
