/* ═══════════════════════════════════════════════════════════
   Agribot — Main Stylesheet
   Theme: Agricultural Green + Clean White
   ═══════════════════════════════════════════════════════════ */

:root {
  --green-900: #1B4332;
  --green-800: #2D6A4F;
  --green-700: #40916C;
  --green-600: #52B788;
  --green-400: #74C69D;
  --green-200: #B7E4C7;
  --green-100: #D8F3DC;
  --green-50:  #F0FAF2;

  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB;

  --amber-500: #F59E0B;
  --amber-100: #FEF3C7;
  --red-500:   #EF4444;
  --red-100:   #FEE2E2;
  --blue-500:  #3B82F6;
  --blue-100:  #DBEAFE;

  --primary:        var(--green-800);
  --primary-light:  var(--green-700);
  --primary-hover:  var(--green-900);
  --accent:         var(--green-600);
  --bg:             var(--green-50);
  --surface:        #FFFFFF;
  --border:         var(--gray-200);
  --text:           var(--gray-900);
  --text-muted:     var(--gray-500);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.06);

  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-w: 260px;
  --header-h:  64px;
  --transition: .18s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green-200); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-400); }

/* ── Typography ────────────────────────────────────────── */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-muted); }

/* ── Utility ────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex    { display: flex; }
.items-center { align-items: center; }
.gap-2   { gap: .5rem; }
.gap-3   { gap: .75rem; }
.gap-4   { gap: 1rem; }
.ml-auto { margin-left: auto; }
.w-full  { width: 100%; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(45,106,79,.3);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 14px rgba(45,106,79,.4); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--green-50); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: .5rem .75rem;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

.btn-danger {
  background: var(--red-500);
  color: #fff;
}
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; }
.btn-icon { padding: .55rem; border-radius: var(--radius-sm); }

/* ── Form ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label { font-size: .875rem; font-weight: 500; color: var(--gray-700); }
.form-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(82,183,136,.15);
}
.form-input::placeholder { color: var(--gray-400); }
.form-input.error { border-color: var(--red-500); }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-green  { background: var(--green-100); color: var(--green-800); }
.badge-amber  { background: var(--amber-100); color: #92400E; }
.badge-red    { background: var(--red-100);   color: #991B1B; }
.badge-blue   { background: var(--blue-100);  color: #1E40AF; }
.badge-gray   { background: var(--gray-100);  color: var(--gray-700); }

/* ── Alert ──────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-error   { background: var(--red-100);   color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: var(--green-100); color: var(--green-800); border: 1px solid var(--green-200); }
.alert-warn    { background: var(--amber-100); color: #92400E; border: 1px solid #FDE68A; }

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 9999;
}
.toast {
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  background: var(--gray-900);
  color: #fff;
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast.success { background: var(--green-800); }
.toast.error   { background: var(--red-500); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--green-100);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-600), var(--green-400));
  border-radius: 99px;
  transition: width .6s ease;
}
.progress-fill.warning { background: linear-gradient(90deg, var(--amber-500), #FCD34D); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--red-500), #F87171); }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
.spinner-dark {
  border-color: rgba(45,106,79,.2);
  border-top-color: var(--green-700);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--green-100);
  color: var(--green-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .25rem;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card .stat-sub {
  font-size: .75rem;
  color: var(--green-700);
  font-weight: 500;
}

/* ── Table ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--gray-50); }
thead th {
  padding: .875rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--gray-100); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--green-50); }
tbody td { padding: .875rem 1rem; font-size: .875rem; }

/* ── Sidebar Layout ─────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--transition);
}
.sidebar-logo {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-weight: 800;
  font-size: 1.2rem;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--green-600);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: .75rem; overflow-y: auto; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
  padding: .75rem .75rem .3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--green-700); color: #fff; }
.nav-item .nav-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 1rem; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,.08); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  color: #fff;
  flex-shrink: 0;
}
.user-info .name  { font-size: .85rem; font-weight: 600; color: #fff; }
.user-info .email { font-size: .7rem;  color: rgba(255,255,255,.5); }

/* ── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.page-header {
  height: var(--header-h);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-shrink: 0;
}
.page-header h1 { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.page-body { flex: 1; overflow-y: auto; padding: 1.75rem; }

/* ── Chat Page Specific ─────────────────────────────────── */
.chat-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.chat-sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.conv-list { flex: 1; overflow-y: auto; padding: .5rem; }
.conv-item {
  padding: .65rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  color: rgba(255,255,255,.75);   /* readable on dark sidebar */
}
.conv-item:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.conv-item.active {
  background: var(--green-700);
  color: #fff;
}
.conv-item .conv-title { font-size: .82rem; font-weight: 500; flex: 1; }
.conv-item .conv-delete {
  opacity: 0;
  color: rgba(255,255,255,.45);
  padding: .2rem;
  border-radius: 4px;
  transition: opacity var(--transition), color var(--transition);
}
.conv-item:hover .conv-delete { opacity: 1; }
.conv-item .conv-delete:hover { color: #fca5a5; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  padding: .875rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.message-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.message-row.user { flex-direction: row-reverse; }
.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
}
.message-avatar.bot  { background: var(--green-100); color: var(--green-800); }
.message-avatar.user { background: var(--gray-800);  color: #fff; }

/* ── User bubble content aligns flush to avatar ── */
.message-row.user .bubble-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-bubble {
  max-width: 72%;
  padding: .85rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: .9rem;
  line-height: 1.65;
  position: relative;
}

/* ── Bot bubble: arrow pointing left toward avatar ── */
.message-row.assistant .message-bubble {
  background: var(--surface);
  border: 1.5px solid var(--gray-400);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  line-height: 1.75;
}
.message-row.assistant .message-bubble::before {
  content: '';
  position: absolute;
  top: 10px;
  left: -9px;
  border: 8px solid transparent;
  border-right-color: var(--gray-400);
  border-left-width: 0;
}
.message-row.assistant .message-bubble::after {
  content: '';
  position: absolute;
  top: 11px;
  left: -7px;
  border: 7px solid transparent;
  border-right-color: var(--surface);
  border-left-width: 0;
}

/* ── User bubble: arrow pointing right toward avatar ── */
.message-row.user .message-bubble {
  background: var(--green-800);
  color: #fff;
  border-top-right-radius: 4px;
}
.message-row.user .message-bubble::before {
  content: '';
  position: absolute;
  top: 10px;
  right: -8px;
  border: 8px solid transparent;
  border-left-color: var(--green-800);
  border-right-width: 0;
}

/* ── Thinking / typing indicator ── */
.thinking-bubble {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
}
.thinking-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.thinking-dots span {
  width: 7px; height: 7px;
  background: var(--green-400);
  border-radius: 50%;
  animation: thinking-bounce .9s ease-in-out infinite;
}
.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: .15s; }
.thinking-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes thinking-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30%            { transform: translateY(-6px); opacity: 1; }
}
.thinking-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4rem;
  font-size: .7rem;
  color: var(--text-muted);
}
.message-row.user .message-meta { justify-content: flex-end; color: rgba(255,255,255,.5); }
.sources-tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .45rem;
  background: var(--green-100);
  color: var(--green-800);
  border-radius: 4px;
  font-size: .65rem;
  font-weight: 600;
}

/* Typing cursor animation */
.cursor { display: inline-block; width: 2px; height: 1em; background: currentColor; margin-left: 2px; animation: blink .8s step-end infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }

.chat-input-area {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  background: var(--gray-100);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .5rem .5rem .5rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-row:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(82,183,136,.12);
  background: var(--surface);
}
.chat-textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  outline: none;
  font-size: .9rem;
  color: var(--text);
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
}
.chat-textarea::placeholder { color: var(--gray-400); }
.chat-send-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--green-800);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover  { background: var(--green-900); }
.chat-send-btn:active { transform: scale(.93); }
.chat-send-btn:disabled { background: var(--gray-300); cursor: not-allowed; }
.token-counter {
  text-align: right;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .4rem;
}

/* ── Welcome Screen ─────────────────────────────────────── */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
  text-align: center;
}
.welcome-screen .welcome-logo {
  width: 72px; height: 72px;
  background: var(--green-100);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.welcome-screen h2 { color: var(--text); font-size: 1.5rem; }
.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  max-width: 480px;
}
.welcome-chip {
  padding: .55rem 1rem;
  border: 1.5px solid var(--green-200);
  border-radius: 99px;
  font-size: .82rem;
  color: var(--green-800);
  cursor: pointer;
  background: var(--surface);
  transition: background var(--transition), border-color var(--transition);
}
.welcome-chip:hover { background: var(--green-100); border-color: var(--green-400); }

/* ── Dashboard Grid ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Plan Cards ─────────────────────────────────────────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.plan-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: default;
}
.plan-card.popular { border-color: var(--green-600); }
.plan-card.current { border-color: var(--green-800); background: var(--green-50); }
.plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--text); }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.plan-feature {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .83rem;
  color: var(--text-muted);
}
.plan-feature::before { content: "✓"; color: var(--green-600); font-weight: 700; }

/* ── Landing Page ───────────────────────────────────────── */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--green-900);
}
.nav-brand .logo-icon {
  width: 38px; height: 38px;
  background: var(--green-800);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 0 auto;
}
.nav-links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-600, var(--text-muted));
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--green-800); }
.nav-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Language toggle button ─────────────────────────────── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid currentColor;
  background: transparent;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  letter-spacing: .02em;
}
/* On dark sidebar */
.sidebar .lang-toggle {
  color: rgba(255,255,255,.7);
  border-color: rgba(255,255,255,.3);
}
.sidebar .lang-toggle:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
/* On light nav (landing/login) */
.landing-nav .lang-toggle, .auth-panel .lang-toggle {
  color: var(--green-800);
  border-color: var(--green-700);
}
.landing-nav .lang-toggle:hover, .auth-panel .lang-toggle:hover {
  background: var(--green-50);
}

.hero {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--green-50) 0%, #fff 50%, var(--green-50) 100%);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2340916C' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { max-width: 560px; position: relative; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--green-100);
  color: var(--green-800);
  padding: .3rem .85rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  color: var(--green-900);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero h1 span { color: var(--green-600); }
.hero p { font-size: 1.1rem; margin-bottom: 2rem; line-height: 1.7; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.chat-preview {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  width: 340px;
  border: 1px solid var(--border);
}
.chat-preview-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.chat-preview-msg {
  padding: .65rem .9rem;
  border-radius: var(--radius-lg);
  font-size: .82rem;
  line-height: 1.55;
  margin-bottom: .5rem;
}
.chat-preview-msg.bot {
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-top-left-radius: 4px;
  max-width: 90%;
}
.chat-preview-msg.user {
  background: var(--green-800);
  color: #fff;
  margin-left: auto;
  max-width: 80%;
  border-top-right-radius: 4px;
}

.features-section { padding: 5rem 2rem; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { color: var(--text); margin-bottom: .5rem; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  background: var(--green-100);
  color: var(--green-800);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.feature-card h3 { margin-bottom: .4rem; color: var(--text); }

/* ── Login Page ─────────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-visual  { display: none; }
}
.auth-visual {
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #fff;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-visual-content { position: relative; text-align: center; }
.auth-visual h2 { font-size: 2rem; margin-bottom: .75rem; }
.auth-visual p { opacity: .8; font-size: 1.05rem; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--surface);
}
.auth-box {
  width: 100%;
  max-width: 420px;
}
.auth-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 2rem;
}
.auth-tab {
  flex: 1;
  padding: .6rem;
  border-radius: calc(var(--radius) - 2px);
  text-align: center;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--green-800);
  box-shadow: var(--shadow-sm);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .page-body { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
