/* ===================================================================
   GiziKu - Design System & Stylesheet
   Mobile-First, Clean, Systematic, Minimal-Text Healthcare Interface
   =================================================================== */

:root {
  /* Primary Health Teal Palette */
  --primary-50: #f0fdfa;
  --primary-100: #ccfbf1;
  --primary-200: #99f6e4;
  --primary-300: #5eead4;
  --primary-400: #2dd4bf;
  --primary-500: #14b8a6;
  --primary-600: #0d9488;
  --primary-700: #0f766e;
  --primary-800: #115e59;
  --primary-900: #134e4a;

  /* Status Colors (Green, Yellow/Amber, Red) */
  --status-green: #10b981;
  --status-green-bg: #ecfdf5;
  --status-green-border: #a7f3d0;
  --status-green-text: #065f46;

  --status-yellow: #f59e0b;
  --status-yellow-bg: #fffbeb;
  --status-yellow-border: #fde68a;
  --status-yellow-text: #92400e;

  --status-red: #ef4444;
  --status-red-bg: #fef2f2;
  --status-red-border: #fecaca;
  --status-red-text: #991b1b;

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

  /* Typography & Geometry */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(13, 148, 136, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(13, 148, 136, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 8px 20px rgba(15, 23, 42, 0.04);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: #f6f9f8;
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* App Container (Mobile-first, max-width tablet/desktop centered) */
.app-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.06);
}

@media (min-width: 768px) {
  .app-container {
    max-width: 520px;
    margin: 20px auto;
    min-height: calc(100vh - 40px);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--slate-200);
  }
}

/* Top App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-800);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-text p {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-50);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-800);
  border: 1px solid var(--primary-100);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-badge:hover {
  background: var(--primary-100);
}

/* Main Content Area */
.main-viewport {
  flex: 1;
  padding: 20px 20px 90px 20px;
  overflow-y: auto;
}

/* Screen Transitions */
.screen {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.screen.active {
  display: block;
}

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

/* ===================================================================
   1. LOGIN SCREEN
   =================================================================== */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  text-align: center;
  padding: 20px 10px;
}

.login-logo {
  width: 76px;
  height: 76px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 10px 25px rgba(13, 148, 136, 0.3);
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-900);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-bottom: 32px;
  max-width: 320px;
  line-height: 1.4;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-700);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-field {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  background-color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  color: var(--slate-800);
  transition: var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px var(--primary-100);
}

.select-field {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  background-color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  color: var(--slate-800);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

.select-field:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px var(--primary-100);
}

/* Primary Big Button */
.btn-primary {
  width: 100%;
  height: 54px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.28);
  transition: var(--transition-smooth);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.btn-demo-quick {
  width: 100%;
  height: 46px;
  background-color: var(--primary-50);
  color: var(--primary-700);
  border: 1px dashed var(--primary-400);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: var(--transition-fast);
}

.btn-demo-quick:hover {
  background-color: var(--primary-100);
}

.btn-secondary {
  width: 100%;
  height: 50px;
  background-color: #ffffff;
  color: var(--slate-700);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-secondary:active {
  background-color: var(--slate-50);
  transform: scale(0.98);
}

.login-footer-link {
  font-size: 0.8rem;
  color: var(--slate-400);
  margin-top: 16px;
  text-decoration: none;
}

/* ===================================================================
   2. HOME / BERANDA SCREEN
   =================================================================== */
.hero-card {
  background: linear-gradient(145deg, #0d9488, #115e59);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: #ffffff;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}

.hero-tagline {
  font-size: 0.88rem;
  opacity: 0.92;
  margin-bottom: 20px;
  line-height: 1.45;
}

.hero-btn {
  background-color: #ffffff;
  color: var(--primary-800);
  border: none;
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: var(--transition-fast);
}

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

/* 4 Core Feature Cards Grid (2x2) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.feature-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.feature-card:active, .feature-card:hover {
  border-color: var(--primary-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.feature-icon-box.green {
  background-color: var(--primary-50);
  color: var(--primary-600);
}

.feature-icon-box.blue {
  background-color: #eff6ff;
  color: #2563eb;
}

.feature-icon-box.amber {
  background-color: var(--status-yellow-bg);
  color: var(--status-yellow);
}

.feature-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1.2;
}

/* Quick Stats Bar */
.stats-bar {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 24px;
}

.stats-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stats-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 800;
}

.stat-num.total { color: var(--slate-800); }
.stat-num.normal { color: var(--status-green); }
.stat-num.warning { color: var(--status-yellow); }
.stat-num.danger { color: var(--status-red); }

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--slate-500);
}

/* Formal Disclaimer Box */
.disclaimer-card {
  background: var(--slate-50);
  border-left: 4px solid var(--primary-500);
  padding: 12px 14px;
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
  font-size: 0.74rem;
  color: var(--slate-600);
  line-height: 1.4;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ===================================================================
   3. SKRINING STATUS GIZI
   =================================================================== */
.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--slate-900);
}

.section-desc {
  font-size: 0.85rem;
  color: var(--slate-500);
}

.screening-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-addon-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-addon-group .input-field {
  padding-right: 48px;
}

.input-addon {
  position: absolute;
  right: 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-400);
  pointer-events: none;
}

.gender-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gender-btn {
  height: 50px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-600);
  cursor: pointer;
  transition: var(--transition-fast);
}

.gender-btn.active {
  border-color: var(--primary-600);
  background: var(--primary-50);
  color: var(--primary-800);
}

/* Result Card */
.result-card {
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
  border-width: 2px;
  border-style: solid;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.result-card.green {
  background: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: var(--status-green-text);
}

.result-card.yellow {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
  color: var(--status-yellow-text);
}

.result-card.red {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: var(--status-red-text);
}

.result-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #ffffff;
}

.result-indicator-badge.green { background: var(--status-green); }
.result-indicator-badge.yellow { background: var(--status-yellow); }
.result-indicator-badge.red { background: var(--status-red); }

.result-child-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.result-meta {
  font-size: 0.85rem;
  color: var(--slate-600);
  margin-bottom: 16px;
}

/* Z-Scores Grid Mini Cards */
.zscore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.zscore-item {
  background: #ffffff;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
}

.zscore-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
}

.zscore-value {
  font-size: 1rem;
  font-weight: 800;
  margin: 2px 0;
}

.zscore-status {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-recommendation {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.85rem;
  color: var(--slate-700);
  text-align: left;
  line-height: 1.45;
  border-left: 4px solid var(--primary-500);
  margin-bottom: 20px;
}

.result-recommendation strong {
  color: var(--slate-900);
  display: block;
  margin-bottom: 4px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===================================================================
   4. RIWAYAT & REKAP DATA (KMS DIGITAL)
   =================================================================== */
.kms-chart-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.kms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kms-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--slate-800);
}

.kms-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-500);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.green { background: var(--status-green); }
.legend-dot.plot { background: #2563eb; }

.chart-wrapper {
  width: 100%;
  height: 200px;
  position: relative;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  font-family: inherit;
  font-size: 0.85rem;
}

.filter-select {
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  font-family: inherit;
  font-size: 0.85rem;
  background: #fff;
}

/* History Data Cards / Compact Table */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.history-card:hover {
  border-color: var(--primary-400);
}

.history-main-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-child-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--slate-800);
}

.history-metrics {
  font-size: 0.78rem;
  color: var(--slate-500);
}

.history-status-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.history-status-badge.green {
  background: var(--status-green-bg);
  color: var(--status-green-text);
  border: 1px solid var(--status-green-border);
}

.history-status-badge.yellow {
  background: var(--status-yellow-bg);
  color: var(--status-yellow-text);
  border: 1px solid var(--status-yellow-border);
}

.history-status-badge.red {
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border: 1px solid var(--status-red-border);
}

/* ===================================================================
   5. CHATBOT KONSULTASI GIZI (AI ASISTEN KADER)
   =================================================================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 170px);
  max-height: 560px;
}

.chat-context-banner {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--primary-800);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-context-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-700);
  cursor: pointer;
  text-decoration: underline;
}

/* Quick Reply Chips */
.quick-replies-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.quick-replies-tray::-webkit-scrollbar {
  display: none;
}

.quick-reply-btn {
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1.5px solid var(--primary-300);
  color: var(--primary-700);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.quick-reply-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-600);
}

/* Chat Messages Stream */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
  margin-bottom: 12px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.45;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--slate-100);
  color: var(--slate-800);
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble pre, .chat-bubble code {
  white-space: pre-wrap;
  font-family: inherit;
}

.chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 18px;
}

.chat-dot {
  width: 6px;
  height: 6px;
  background: var(--slate-400);
  border-radius: 50%;
  animation: bounceDot 1.4s infinite ease-in-out;
}

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

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Input Bar (Sticky & Mobile-Optimized) */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 420px;
  max-height: 600px;
  position: relative;
  padding-bottom: 8px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 6px 0;
  position: sticky;
  bottom: 0;
  z-index: 20;
}

.chat-input-field {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-300);
  font-family: inherit;
  font-size: 0.9rem;
  background: #ffffff;
}

.chat-input-field:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.chat-send-btn {
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--primary-600);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--primary-700);
}

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

/* ===================================================================
   6. EDUKASI GIZI (1000 HPK)
   =================================================================== */
.edu-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edu-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.edu-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
}

.edu-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.edu-content {
  flex: 1;
}

.edu-topic-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.edu-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.edu-text {
  font-size: 0.82rem;
  color: var(--slate-600);
  line-height: 1.45;
}

.edu-points {
  margin-top: 8px;
  padding-left: 18px;
  font-size: 0.8rem;
  color: var(--slate-700);
}

.edu-points li {
  margin-bottom: 4px;
}

/* ===================================================================
/* ===================================================================
   BOTTOM NAVIGATION (Mobile Field Bar - Always Fixed at Bottom)
   =================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 68px;
  background: #ffffff;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
  .bottom-nav {
    max-width: 520px;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--slate-400);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  min-height: 48px;
  min-width: 48px;
  transition: var(--transition-fast);
}

.nav-item .nav-icon {
  font-size: 1.25rem;
}

.nav-item.active {
  color: var(--primary-600);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* Login Error Alert */
.login-error-alert {
  display: none;
  background-color: var(--status-red-bg);
  border: 1px solid var(--status-red-border);
  color: var(--status-red-text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
  text-align: left;
  animation: fadeIn 0.2s ease;
}

.login-demo-hint {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.76rem;
  color: var(--slate-600);
  margin-top: 14px;
  text-align: left;
  line-height: 1.45;
}

/* AI Status Badge (In Chat Header) */
.ai-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--status-green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--status-green);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

/* History Responsive Table */
.history-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: #ffffff;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
  min-width: 420px;
}

.history-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-800);
  vertical-align: middle;
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-table tr:hover {
  background-color: var(--primary-50);
}

/* Toast In-App Notification */
.app-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  background: var(--slate-900);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90%;
  text-align: center;
}

.app-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: scaleIn 0.2s ease forwards;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-800);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-400);
  cursor: pointer;
}
