/* ============================================================
   ICRISAT Dryland Agriculture AI – Google Material Design UI
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Google Blue palette */
  --blue-50:  #e8f0fe;
  --blue-100: #d2e3fc;
  --blue-500: #1a73e8;
  --blue-600: #1967d2;
  --blue-700: #1557b0;

  /* Greens (ICRISAT / agriculture) */
  --green-50:  #e6f4ea;
  --green-500: #34a853;
  --green-600: #2d9249;

  /* Neutrals */
  --grey-50:  #f8f9fa;
  --grey-100: #f1f3f4;
  --grey-200: #e8eaed;
  --grey-300: #dadce0;
  --grey-400: #bdc1c6;
  --grey-600: #80868b;
  --grey-700: #5f6368;
  --grey-800: #3c4043;
  --grey-900: #202124;

  /* Semantic */
  --surface:       #ffffff;
  --surface-alt:   #f8f9fa;
  --surface-dark:  #1e1e2e;
  --on-surface:    #202124;
  --border:        #dadce0;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:     0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.16);

  /* Layout */
  --header-h:    60px;
  --footer-h:    36px;
  --sidebar-w:   280px;
  --input-area-h: 90px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   24px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

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

html, body {
  height: 100%;
  font-family: 'Google Sans', 'Roboto', sans-serif;
  font-size: 14px;
  color: var(--grey-900);
  background: var(--grey-50);
  overflow: hidden;
}

a { color: var(--blue-500); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 16px; font-weight: 500; color: var(--grey-900); line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--grey-600); line-height: 1.2; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.status-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--grey-100);
  font-size: 12px;
  color: var(--grey-700);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-500);
  transition: background .3s var(--ease);
}
.status-dot.thinking { background: var(--blue-500); animation: pulse 1.4s ease infinite; }
.status-dot.error    { background: #ea4335; }

@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

.hdr-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-600);
  transition: background .15s var(--ease);
  font-size: 20px;
}
.hdr-btn:hover { background: var(--grey-100); color: var(--grey-900); }
.hdr-btn .material-icons-round { font-size: 20px; }

/* ── Layout ────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: calc(100vh - var(--header-h) - var(--footer-h));
  margin-top: var(--header-h);
  overflow: hidden;
}

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 -1px 3px rgba(0,0,0,.06);
}

.footer-copy {
  font-size: 11px;
  color: var(--grey-600);
  white-space: nowrap;
}

.footer-disclaimer-btn {
  font-size: 11px;
  color: var(--blue-500);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}
.footer-disclaimer-btn:hover { color: var(--blue-700); }

/* ── Disclaimer modal ──────────────────────────────────────── */
.disclaimer-modal { max-width: 560px; }

.disclaimer-text {
  font-size: 13px;
  color: var(--grey-800);
  line-height: 1.6;
  margin-bottom: 12px;
}
.disclaimer-text:last-child { margin-bottom: 0; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 4px; }

.sidebar-section { margin-bottom: 8px; }

.section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 8px 8px 6px;
}

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

.topic-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--grey-800);
  text-align: left;
  line-height: 1.3;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.topic-chip:hover {
  background: var(--blue-50);
  color: var(--blue-600);
}
.chip-icon {
  font-size: 16px !important;
  color: var(--green-500);
  flex-shrink: 0;
}

.about-section { margin-top: 8px; }
.sidebar-para {
  font-size: 12px;
  color: var(--grey-700);
  line-height: 1.6;
  padding: 0 8px;
}

.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 8px 4px;
}
.tech-badge {
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--blue-100);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--blue-500);
  padding: 4px 8px;
  margin-top: 4px;
}

/* ── Chat main ──────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--grey-50);
}

/* ── Messages scroll ─────────────────────────────────────────── */
.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  scroll-behavior: smooth;
}

.messages-scroll::-webkit-scrollbar { width: 6px; }
.messages-scroll::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 4px; }

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

/* ── Welcome card ────────────────────────────────────────────── */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.welcome-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-50), var(--blue-50));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: var(--green-500);
}
.welcome-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--grey-900);
  margin-bottom: 8px;
}
.welcome-sub {
  font-size: 14px;
  color: var(--grey-600);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 24px;
}
.welcome-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.eg-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.eg-btn {
  max-width: 560px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--grey-700);
  text-align: left;
  line-height: 1.4;
  transition: border-color .15s, background .15s, color .15s;
}
.eg-btn:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-600);
}

/* ── Message row ─────────────────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 12px;
  animation: slideUp .25s var(--ease);
}

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

.msg-row.user-row {
  flex-direction: row-reverse;
}

/* Avatar */
.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-top: 2px;
}
.msg-avatar.bot-avatar  { background: linear-gradient(135deg, var(--green-500), var(--blue-500)); color: #fff; }
.msg-avatar.user-avatar { background: var(--blue-500); color: #fff; font-size: 13px; font-weight: 500; }

/* Bubble */
.msg-bubble {
  max-width: 76%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.bubble-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--grey-900);
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

.user-row .bubble-body {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
}

/* Markdown styles inside bot bubble */
.bubble-body h1, .bubble-body h2, .bubble-body h3 {
  margin: 12px 0 6px;
  font-size: 15px;
  font-weight: 500;
}
.bubble-body p  { margin: 6px 0; }
.bubble-body ul, .bubble-body ol { margin: 6px 0 6px 20px; }
.bubble-body li { margin: 4px 0; }
.bubble-body strong { font-weight: 500; }
.bubble-body em { font-style: italic; color: var(--grey-700); }
.bubble-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.bubble-body code {
  background: var(--grey-100);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
}
.bubble-body a { color: var(--blue-500); }
.inline-cite {
  display: inline-block;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-600);
  font-size: 0.85em;
  text-decoration: none;
}
.inline-cite:hover {
  background: var(--blue-100);
}

/* Citations panel */
.citations-panel {
  background: var(--grey-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.citations-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-700);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.citations-toggle:hover { background: var(--grey-100); }
.citations-toggle .material-icons-round { font-size: 16px; }
.toggle-arrow { margin-left: auto; font-size: 18px !important; transition: transform .2s; }
.citations-toggle.open .toggle-arrow { transform: rotate(180deg); }

.citations-list {
  display: none;
  padding: 0 14px 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
  flex-direction: column;
}
.citations-list.visible { display: flex; }

.cite-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--grey-200);
}
.cite-item:last-child { border-bottom: none; }
.cite-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-500);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
  height: fit-content;
  margin-top: 2px;
}
.cite-info { flex: 1; min-width: 0; }
.cite-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-900);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cite-meta {
  font-size: 11px;
  color: var(--grey-600);
  margin-top: 2px;
}
.cite-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--blue-500);
  margin-top: 2px;
}

/* ── Scenario / workflow badge ─────────────────────────────── */
.scenario-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 6px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--badge-color, #1a73e8) 10%, white);
  border: 1px solid color-mix(in srgb, var(--badge-color, #1a73e8) 25%, white);
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--badge-color, #1a73e8);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.scenario-icon {
  font-size: 14px !important;
  color: var(--badge-color, #1a73e8);
}
.scenario-label {
  line-height: 1;
}

/* Eval chip strip */
.eval-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0;
}
.eval-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.eval-chip.high       { background: var(--green-50); color: var(--green-600); border: 1px solid #c6e6ca; }
.eval-chip.medium     { background: #fff8e1;          color: #f57c00;          border: 1px solid #ffe082; }
.eval-chip.low        { background: #fce8e6;          color: #c62828;          border: 1px solid #f5c6c4; }
.eval-chip.score-chip { background: var(--grey-100); color: var(--grey-700);  border: 1px solid var(--border); }

/* Feedback row */
.feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}
.fb-label { font-size: 12px; color: var(--grey-600); }
.fb-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--grey-700);
  transition: background .15s, color .15s, border-color .15s;
}
.fb-btn:hover { border-color: var(--grey-400); background: var(--grey-50); }
.fb-btn.active-up   { background: var(--green-50);  color: var(--green-600); border-color: var(--green-500); }
.fb-btn.active-down { background: #fce8e6;           color: #c62828;          border-color: #ea4335; }
.fb-btn .material-icons-round { font-size: 14px; }
.fb-btn.fb-done {
  color: var(--grey-500);
  border-color: var(--grey-200);
  cursor: default;
  font-style: italic;
}

/* Highlighted cite item after clicking an inline citation */
.cite-highlight {
  background: #e8f0fe !important;
  border-radius: 4px;
  transition: background .4s ease;
}

/* Follow-up question chips shown below each answer */
.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 2px;
}
.followup-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid #bdd4f8;
  background: #e8f0fe;
  color: #1a73e8;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-align: left;
  line-height: 1.35;
}
.followup-chip:hover {
  background: #d2e3fc;
  border-color: #669df6;
  color: #1557b0;
}
.followup-chip .material-icons-round { font-size: 13px; }

/* ── Thinking / status row ───────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 76%;
  box-shadow: var(--shadow-sm);
  animation: slideUp .2s var(--ease);
}
.status-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-500);
}
.status-icon-wrap .material-icons-round { font-size: 18px; }

.status-texts { flex: 1; }
.status-main  { font-size: 13px; font-weight: 500; color: var(--grey-800); }
.status-detail{ font-size: 11px; color: var(--grey-600); margin-top: 1px; }

/* ── Progress pipeline ───────────────────────────────────────── */
.pipeline-track {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 2px solid var(--grey-200);
  margin-left: 16px;
  padding-left: 0;
}
.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0 6px 16px;
  margin-left: -1px;
  position: relative;
}
.pipeline-step::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 13px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grey-300);
  border: 2px solid var(--surface);
}
.pipeline-step.done::before { background: var(--green-500); }
.pipeline-step.active::before { background: var(--blue-500); animation: pulse 1s ease infinite; }

.step-icon { font-size: 15px !important; color: var(--grey-400); }
.pipeline-step.done .step-icon   { color: var(--green-500); }
.pipeline-step.active .step-icon { color: var(--blue-500); }

.step-text  { font-size: 12px; color: var(--grey-600); line-height: 1.4; }
.step-detail{ font-size: 11px; color: var(--grey-500); }

/* ── Input area ──────────────────────────────────────────────── */
.input-area {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px 16px;
}

.input-row {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 8px 8px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.input-row:focus-within {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

.textarea-wrap { flex: 1; }

.query-input {
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--grey-900);
  background: transparent;
  max-height: 140px;
  overflow-y: auto;
}
.query-input::placeholder { color: var(--grey-400); }

.send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s, opacity .15s;
}
.send-btn:hover:not(:disabled) { background: var(--blue-600); transform: scale(1.05); }
.send-btn:disabled { background: var(--grey-300); opacity: .7; cursor: not-allowed; }
.send-btn .material-icons-round { font-size: 18px; }

.input-meta {
  max-width: 820px;
  margin: 6px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.char-count { font-size: 11px; color: var(--grey-400); }
.input-hint { font-size: 11px; color: var(--grey-400); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(32,33,36,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn .15s var(--ease);
}
.modal-backdrop[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
  animation: scaleIn .2s var(--ease);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 500; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-600);
  transition: background .15s;
}
.icon-btn:hover { background: var(--grey-100); }

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

.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-700);
}
.opt-label { font-weight: 400; color: var(--grey-500); }

.star-row { display: flex; gap: 4px; }
.star-btn {
  font-size: 28px;
  color: var(--grey-300);
  line-height: 1;
  transition: color .12s, transform .1s;
}
.star-btn:hover, .star-btn.active { color: #fbbc04; }
.star-btn:hover { transform: scale(1.15); }

.star-hint { font-size: 12px; color: var(--grey-500); }

.feedback-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  color: var(--grey-900);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.feedback-textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
}

.btn-ghost {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
  color: var(--grey-700);
  transition: background .15s;
}
.btn-ghost:hover { background: var(--grey-100); }

.btn-primary {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--blue-500);
  font-size: 13px; font-weight: 500;
  color: #fff;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-600); }
.btn-icon { font-size: 16px !important; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--grey-900);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 300;
  opacity: 0;
  transition: opacity .25s, transform .25s var(--ease);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Scrollbar global ────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .sidebar { display: none; }
  .messages-inner { padding: 0 12px; }
  .input-area { padding: 10px 12px 14px; }
  .brand-sub { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   USER CHIP (header)
   ═══════════════════════════════════════════════════════════════ */
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 20px;
  background: var(--grey-100);
  border: 1px solid var(--border);
  margin-left: 4px;
}

.user-chip-icon {
  font-size: 18px !important;
  color: var(--green-500);
}

.user-chip-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-800);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-600);
  transition: background .15s var(--ease), color .15s;
}
.logout-btn:hover { background: var(--grey-200); color: #ea4335; }
.logout-btn .material-icons-round { font-size: 16px; }

/* ═══════════════════════════════════════════════════════════════
   CONVERSATION LIST (sidebar)
   ═══════════════════════════════════════════════════════════════ */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.conv-empty {
  font-size: 11px;
  color: var(--grey-400);
  padding: 6px 8px;
  display: block;
}

.conv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s;
}
.conv-item:hover {
  background: var(--grey-100);
  border-color: var(--border);
}
.conv-item.active {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

.conv-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.conv-item.active .conv-item-title { color: var(--blue-600); }

.conv-item-date {
  font-size: 10px;
  color: var(--grey-600);
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════ */
.login-body {
  overflow: auto !important;   /* allow page scroll on login */
  display: flex;
  background: linear-gradient(135deg, var(--green-50) 0%, var(--blue-50) 100%);
  min-height: 100vh;
}

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 32px 16px;
  gap: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 40px 40px 32px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.login-logo-wrap {
  margin-bottom: 20px;
}
.login-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--grey-900);
  margin: 0;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--grey-600);
  text-align: center;
  margin: 4px 0 24px;
  line-height: 1.4;
}

.login-error {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fce8e6;
  border: 1px solid #f5c6c2;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #c62828;
  margin-bottom: 16px;
}
.login-error-icon { font-size: 16px !important; flex-shrink: 0; }

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--grey-700);
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  color: var(--grey-400);
  font-size: 18px !important;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--grey-900);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.login-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
.login-input::placeholder { color: var(--grey-400); }

.login-submit-btn {
  width: 100%;
  padding: 11px 20px;
  border-radius: 24px;
  background: var(--green-500);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s;
  margin-top: 4px;
}
.login-submit-btn:hover { background: var(--green-600); }

.login-note {
  font-size: 11px;
  color: var(--grey-500);
  text-align: center;
  margin-top: 20px;
  line-height: 1.5;
}

.login-page-footer {
  font-size: 11px;
  color: var(--grey-500);
  text-align: center;
}
