/* ZARii AI — Design tokens & global styles */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Noto+Nastaliq+Urdu:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand palette */
  --green-900: #1F4A2C;
  --green-700: #2E6B3F;
  --green-500: #66A64F;
  --green-300: #9DCB7C;
  --green-100: #E4F0D8;
  --green-50:  #F1F7E9;
  --amber:     #F4A62A;
  --amber-soft:#FCD58A;
  --cream:     #F7E8C6;
  --cream-50:  #FBF4E2;
  --ink:       #2B2B2B;
  --ink-soft:  #4A4A4A;
  --ink-mute:  #7E7E7E;
  --line:      #E6E0D1;
  --line-soft: #F1ECDD;
  --bg:        #FBFAF4;
  --paper:     #FFFFFF;

  --font-en:   'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-ur:   'Noto Nastaliq Urdu', 'Noto Naskh Arabic', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(31, 74, 44, 0.06), 0 0 0 1px rgba(31, 74, 44, 0.04);
  --shadow:    0 4px 16px rgba(31, 74, 44, 0.08), 0 0 0 1px rgba(31, 74, 44, 0.04);
  --shadow-lg: 0 16px 40px rgba(31, 74, 44, 0.14), 0 0 0 1px rgba(31, 74, 44, 0.04);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-en);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

.urdu { font-family: var(--font-ur); direction: rtl; line-height: 2; }
.urdu-inline { font-family: var(--font-ur); direction: rtl; unicode-bidi: isolate; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--green-700); color: #fff;
  box-shadow: 0 6px 14px rgba(46, 107, 63, 0.28);
}
.btn-primary:hover { background: var(--green-900); }
.btn-secondary {
  background: var(--paper); color: var(--green-900);
  box-shadow: inset 0 0 0 1.5px var(--green-700);
}
.btn-secondary:hover { background: var(--green-50); }
.btn-ghost { color: var(--green-900); }
.btn-ghost:hover { background: var(--green-50); }
.btn-amber {
  background: var(--amber); color: #2B1F00;
  box-shadow: 0 6px 14px rgba(244, 166, 42, 0.32);
}
.btn-amber:hover { filter: brightness(0.96); }
.btn-wa {
  background: #25D366; color: #fff;
  box-shadow: 0 6px 14px rgba(37, 211, 102, 0.30);
}
.btn-wa:hover { background: #1EBE5C; }

.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Cards */
.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  padding: var(--space-lg);
}

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-green { background: var(--green-100); color: var(--green-900); }
.tag-amber { background: #FDE9C2; color: #6E4A00; }
.tag-cream { background: var(--cream); color: var(--green-900); }
.tag-red { background: #FCDFD9; color: #8A2A1B; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #DCD5C2; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #C7BF9F; }

/* Utility */
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

/* Containers */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Grid helpers */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* Flex helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Text helpers */
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-3xl { font-size: 40px; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* Spacing helpers */
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Animations */
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(244, 166, 42, 0.55); }
  70% { box-shadow: 0 0 0 28px rgba(244, 166, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 166, 42, 0); }
}
@keyframes pulseRingGreen {
  0% { box-shadow: 0 0 0 0 rgba(102, 166, 79, 0.45); }
  70% { box-shadow: 0 0 0 24px rgba(102, 166, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(102, 166, 79, 0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes mic-bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1.0); }
}
@keyframes scanline {
  0% { top: 0; }
  100% { top: 100%; }
}

.skeleton {
  background: linear-gradient(90deg, #EFE9D6 0%, #F8F2DF 40%, #EFE9D6 80%);
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 8px;
}

#root { min-height: 100vh; }

/* ============================================
   BASE RESPONSIVE RESET
   ============================================ */

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, video {
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Minimum touch target size */
a, button, input, select, textarea {
  min-height: 44px;
  min-width: 44px;
}

/* Remove default tap highlight on mobile */
a, button, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Large Desktop: 1200px+ */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Desktop: 992px - 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
}

/* Tablet: 768px - 991px */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Large: 576px - 767px */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    max-width: 540px;
    padding: 0 var(--space-md);
  }
  
  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Mobile Small: below 576px */
@media (max-width: 575px) {
  .container {
    width: 100%;
    padding: 0 var(--space-md);
  }

  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  /* Base font scaling */
  html {
    font-size: 14px;
  }

  h1 { font-size: 1.75rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
  p { font-size: 0.95rem; }

  /* Ensure no horizontal overflow */
  body, #root {
    overflow-x: hidden;
    width: 100%;
  }

  /* Smaller buttons on mobile */
  .btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
    min-width: 44px;
  }

  .btn-lg {
    padding: 14px 20px;
    font-size: 15px;
  }

  .btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
    min-width: 36px;
  }

  /* Prevent text overflow */
  * {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Ensure images don't overflow */
  img, video, svg {
    max-width: 100%;
    height: auto;
  }

  /* Stack flex containers */
  .flex-col-mobile {
    flex-direction: column !important;
  }

  .grid-col-mobile {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet and below: make sidebar a bottom nav */
@media (max-width: 900px) {
  .app-shell {
    flex-direction: column !important;
  }
  .app-sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    padding: 8px !important;
    border-right: none !important;
    border-top: 1px solid var(--line-soft) !important;
    z-index: 999 !important;
    background: var(--paper) !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
  }
  .app-sidebar nav {
    flex-direction: row !important;
    justify-content: space-around !important;
    width: 100% !important;
  }
  .app-sidebar .logo,
  .app-sidebar .lang-toggle,
  .app-sidebar .user-info {
    display: none !important;
  }
  .app-main {
    padding: var(--space-lg) var(--space-md) !important;
    padding-bottom: 80px !important;
  }
}

/* Enhanced Tablet breakpoint for better tablet handling */
@media (max-width: 900px) {
  /* Landing page tablet adjustments */
  .hero-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
    padding: 32px var(--space-lg) !important;
  }

  .hero-visual {
    display: none !important;
  }

  .hero-title {
    font-size: 40px !important;
  }

  .hero-buttons {
    justify-content: center !important;
  }

  .hero-stats {
    justify-content: center !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  .features-grid {
    grid-template-columns: 1fr !important;
  }

  .testimonials-grid {
    grid-template-columns: 1fr !important;
  }

  .landing-header nav a:not(.btn):not(.lang-toggle) {
    display: none;
  }

  /* Tablet: Stack all two-column layouts */
  .two-col-stack {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard cards stack */
  .dashboard-cards {
    grid-template-columns: 1fr !important;
  }

  .action-cards-row {
    grid-template-columns: 1fr !important;
  }

  .three-col-strip {
    grid-template-columns: 1fr !important;
  }

  .split-view {
    grid-template-columns: 1fr !important;
  }

  .recent-suggestions-row {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   LANDING PAGE SPECIFIC
   ============================================ */

/* Header */
.landing-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(251, 250, 244, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.landing-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--space-lg);
}

.landing-header nav {
  display: flex; align-items: center; gap: 28;
}

.landing-header nav a {
  color: var(--ink-soft); font-weight: 500; font-size: 14; text-decoration: none;
}

/* Hero Section */
.hero-section {
  position: relative; overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 48px var(--space-lg) 40px;
  max-width: 1240px;
  margin: 0 auto;
}

.hero-title {
  font-size: 56px; line-height: 1.1;
  font-weight: 800; color: var(--green-900);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.hero-desc {
  font-size: 16; line-height: 1.6; color: var(--ink-soft);
  margin-top: 16;
}

.hero-buttons {
  display: flex; gap: 12; margin-top: 24; flex-wrap: wrap;
}

.hero-buttons .btn {
  flex: 1 1 auto; min-width: 200px;
}

.hero-stats {
  display: flex; gap: 14; margin-top: 24; align-items: center;
  color: var(--ink-mute); font-size: 12; flex-wrap: wrap;
}

/* Hero Visual - Phone Mockup */
.hero-visual {
  position: relative; height: 580px;
  display: flex; justify-content: center;
}

.hero-visual .phone {
  position: relative;
  width: 320px; height: 580px;
  background: #1a2a1f;
  border-radius: 44px;
  padding: 10px;
  box-shadow: 0 30px 60px rgba(31,74,44,0.30), 0 12px 24px rgba(31,74,44,0.18);
  animation: float 6s ease-in-out infinite;
}

.hero-visual .phone-screen {
  width: 100%; height: 100%; border-radius: 36px;
  background: var(--bg); overflow: hidden; position: relative;
}

/* Stats Strip */
.stats-strip {
  max-width: 1240px; margin: 32px auto 0; padding: 0 var(--space-lg);
}

.stats-grid {
  background: var(--green-700);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20; color: #fff;
  position: relative; overflow: hidden;
}

.stats-deco {
  position: absolute;
  right: -40px;
  top: -40px;
  opacity: 0.08;
}

.stat-item {
  position: relative;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 4px;
}

/* How It Works */
.how-section {
  padding: 48px var(--space-lg);
  max-width: 1240px; margin: 0 auto;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16;
}

/* Features Section */
.features-section {
  padding: 48px var(--space-lg);
  max-width: 1240px; margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20;
}

/* Testimonials */
.testimonials-section {
  padding: 48px var(--space-lg);
  background: var(--green-900);
  color: #fff;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20;
}

/* CTA Section */
.cta-section {
  padding: 64px var(--space-lg);
  text-align: center;
  background: var(--cream-50);
}

/* Tablet */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }

  .app-sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    top: auto; width: 100%; height: auto;
    flex-direction: row; padding: 8px;
    border-right: none;
    border-top: 1px solid var(--line-soft);
    z-index: 999;
    background: var(--paper);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  }

  .app-sidebar .logo,
  .app-sidebar .lang-toggle {
    display: none;
  }

  .app-sidebar nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }

  .app-sidebar nav a {
    padding: 12px;
    flex-direction: column;
    gap: 4px;
    font-size: 11;
  }

  .app-sidebar nav a span {
    display: none;
  }

  .app-main {
    padding: var(--space-lg);
    padding-bottom: 80px;
  }

  .dashboard-cards {
    grid-template-columns: 1fr !important;
  }

  /* Landing page tablet overrides - override inline grid */
  .hero-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
    padding: 32px var(--space-lg) !important;
  }

  .hero-visual {
    display: none !important;
  }

  .hero-title {
    font-size: 40px !important;
  }

  .hero-buttons {
    justify-content: center !important;
  }

  .hero-stats {
    justify-content: center !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  .features-grid {
    grid-template-columns: 1fr !important;
  }

  .testimonials-grid {
    grid-template-columns: 1fr !important;
  }

  .landing-header nav a:not(.btn):not(.lang-toggle) {
    display: none;
  }

  .steps-grid {
    grid-template-columns: 1fr !important;
  }

  /* Two-column layouts become single column */
  .two-col-stack {
    grid-template-columns: 1fr !important;
  }

  .action-cards-row {
    grid-template-columns: 1fr !important;
  }

  .three-col-strip {
    grid-template-columns: 1fr !important;
  }

  .split-view {
    grid-template-columns: 1fr !important;
  }

  .recent-suggestions-row {
    grid-template-columns: 1fr !important;
  }

  .cta-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }

  .cta-grid > div:first-child {
    margin: 0 auto !important;
  }
}

/* Mobile: below 640px (Samsung Galaxy S9, iPhone 6/7/8) */
@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-sm);
    max-width: 100%;
  }

  /* Stack everything */
  .grid-4, .grid-3, .grid-2,
  .grid-responsive {
    grid-template-columns: 1fr !important;
    gap: var(--space-sm) !important;
  }

  /* Typography scale */
  html {
    font-size: 13px;
  }

  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.35rem !important; }
  h3 { font-size: 1.15rem !important; }
  h4 { font-size: 1.05rem !important; }

  /* Padding/margin reductions */
  body > section,
  .section-padding {
    padding: 32px var(--space-sm) !important;
  }

  /* Stack flex rows */
  .flex-row-mobile {
    flex-direction: column !important;
  }

  .flex-col-reverse-mobile {
    flex-direction: column-reverse !important;
  }

  /* Full-width buttons */
  .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .hero-buttons .btn {
    width: 100%;
    min-width: unset;
  }

  /* Sidebar: hide all text labels, show icons only */
  .app-sidebar nav a span,
  .admin-sidebar nav span {
    display: none !important;
  }

  /* Adjust card padding */
  .card {
    padding: var(--space-md) !important;
  }

  /* Input scaling */
  input, textarea, select {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 12px !important;
  }

  /* Reduce max-widths */
  .max-width-sm {
    max-width: 100% !important;
  }

  /* Hide decorative elements that cause overflow */
  .deco-hide-mobile {
    display: none !important;
  }

  /* Table scroll */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Contact row adjustments */
  .contact-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  /* Form adjustments */
  .form-stack input {
    margin-bottom: var(--space-sm);
  }

  /* Modal fullscreen */
  .modal-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
}

/* Extra small phones: below 380px */
@media (max-width: 380px) {
  .hero-title {
    font-size: 28px !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .stats-grid > div {
    border-left: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.18);
    padding-left: 0 !important;
    padding: 12px 0;
  }

  .step-card {
    padding: 16px !important;
  }
}

/* ============================================
   DASHBOARD / APP SHELL
   ============================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 240px;
  background: var(--paper);
  border-right: 1px solid var(--line-soft);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-sidebar .logo {
  margin-bottom: var(--space-xl);
}

.app-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.app-sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  transition: all .15s ease;
}

.app-sidebar nav a:hover {
  background: var(--green-50);
  color: var(--green-900);
}

.app-sidebar nav a.active {
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 600;
}

.app-main {
  flex: 1;
  padding: var(--space-xl);
  background: var(--bg);
}

/* Dashboard Cards */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.dashboard-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
}

.dashboard-card h3 {
  margin: 0 0 var(--space-sm);
  font-size: 14; font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-card .value {
  font-size: 32; font-weight: 700;
  color: var(--green-900);
}

.dashboard-card .trend {
  font-size: 13; color: var(--green-500);
  margin-top: var(--space-xs);
}

/* Tablet */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  
  /* Show hamburger menu button */
  .mobile-menu-toggle {
    display: flex !important;
  }
  /* Mobile sidebar overlay */
  .mobile-sidebar-overlay {
    display: block !important;
  }
  /* Mobile slide-out sidebar */
  .mobile-sidebar {
    display: flex !important;
    animation: fadeIn 0.2s ease;
  }
  /* Hide regular sidebar on mobile */
  .app-sidebar {
    display: none !important;
  }
  
  .app-sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    top: auto; width: 100%; height: auto;
    flex-direction: row; padding: 8px;
    border-right: none;
    border-top: 1px solid var(--line-soft);
    z-index: 999;
    background: var(--paper);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  }
  
  .app-sidebar .logo,
  .app-sidebar .lang-toggle {
    display: none;
  }
  
  .app-sidebar nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }
  
  /* Show icons only in bottom nav - but user wanted labels visible */
  .app-sidebar nav button {
    padding: 10px 8px;
    flex-direction: column;
    gap: 2px;
    font-size: 10;
    min-width: 52px;
  }
  
  /* Keep labels visible on mobile for accessibility */
  .app-sidebar nav button span {
    display: block !important;
    font-size: 9px !important;
    margin-top: 2px;
  }
  
  .app-main {
    padding: var(--space-lg);
    padding-bottom: 80px;
    padding-left: 56px; /* Account for hamburger button */
  }
  
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

/* ============================================
   ANALYZE / UPLOAD COMPONENT
   ============================================ */

.analyze-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  background: var(--paper);
}

.upload-zone:hover {
  border-color: var(--green-500);
  background: var(--green-50);
}

.upload-zone.dragging {
  border-color: var(--green-700);
  background: var(--green-50);
  transform: scale(1.02);
}

.upload-zone.has-image {
  padding: 0;
  border-style: solid;
}

.upload-zone .preview {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.analyze-result {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow);
  margin-top: var(--space-lg);
}

.disease-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
}

.disease-badge.high {
  background: #FCDFD9;
  color: #8A2A1B;
}

.disease-badge.medium {
  background: #FDE9C2;
  color: #6E4A00;
}

.disease-badge.low {
  background: var(--green-100);
  color: var(--green-900);
}

.pesticide-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--green-50);
  border-radius: var(--radius);
  margin-top: var(--space-md);
}

.pesticide-card .icon {
  width: 48px; height: 48px;
  background: var(--green-100);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pesticide-card .details {
  flex: 1;
}

.pesticide-card .name {
  font-weight: 600;
  color: var(--green-900);
}

.pesticide-card .price {
  font-size: 18;
  font-weight: 700;
  color: var(--green-700);
}

@media (max-width: 640px) {
  .analyze-container {
    padding: var(--space-md);
  }
  
  .upload-zone {
    padding: 24px;
  }
  
  .upload-zone .preview {
    max-height: 250px;
  }
  
  .analyze-result {
    padding: var(--space-lg);
  }
}

/* ============================================
   PAGES / VOICE ASSISTANT
   ============================================ */

.pages-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-width: 800px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeUp 0.2s ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--green-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message .avatar.ai {
  background: var(--green-700);
  color: #fff;
}

.message .bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15;
  line-height: 1.5;
}

.message.user .bubble {
  background: var(--green-700);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.ai .bubble {
  background: var(--green-50);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

/* Voice Message Styles */
.voice-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--green-100);
  border-radius: var(--radius);
  min-width: 200px;
}

.voice-message .play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.voice-message .waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  flex: 1;
}

.voice-message .waveform .bar {
  width: 3px;
  background: var(--green-500);
  border-radius: 2px;
  animation: mic-bar 0.5s ease infinite;
}

.voice-message .duration {
  font-size: 12;
  color: var(--ink-mute);
  font-weight: 500;
}

/* Input Area */
.input-area {
  padding: var(--space-md);
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 12px;
  background: var(--paper);
}

.input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15;
  outline: none;
  transition: border-color .15s ease;
}

.input-area input:focus {
  border-color: var(--green-500);
}

.input-area .mic-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all .15s ease;
}

.input-area .mic-btn:hover {
  background: var(--green-900);
}

.input-area .mic-btn.recording {
  background: var(--amber);
  animation: pulseRing 1.5s ease infinite;
}

.input-area .send-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

/* Thinking Indicator */
.thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--green-50);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 14;
}

.thinking .dots {
  display: flex;
  gap: 4px;
}

.thinking .dot {
  width: 6px; height: 6px;
  background: var(--green-500);
  border-radius: 50%;
  animation: bounce 1.4s ease infinite;
}

.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

@media (max-width: 640px) {
  .pages-container {
    border-radius: 0;
    height: 100vh;
  }
  
/* Voice page container - full screen on mobile */
  .voice-page-container {
    padding: 16px 14px !important;
  }
  
  /* Conversation container on mobile */
  .conversation-container {
    min-height: auto !important;
    padding: 16px !important;
  }
  
  /* History, Analytics, WhatsApp pages on mobile */
  .history-page-container,
  .analytics-page-container,
  .whatsapp-page-container {
    padding: 16px 14px !important;
  }
  
  .message {
    max-width: 95%;
  }
  
  .input-area {
    padding: var(--space-sm);
  }
  
  .input-area input {
    padding: 10px 14px;
  }
  
  .input-area .mic-btn,
  .input-area .send-btn {
    width: 44px; height: 44px;
  }
}

/* ============================================
   LANDING PAGE — HEADER MOBILE
   ============================================ */

.landing-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--green-900);
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.mobile-nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 29;
  box-shadow: 0 8px 20px rgba(31,74,44,0.10);
  animation: fadeUp 0.15s ease;
}

.mobile-nav-dropdown a {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 16px;
  text-decoration: none;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-soft);
  display: block;
}

.mobile-nav-dropdown a:last-of-type {
  border-bottom: none;
}

.mobile-nav-dropdown .btn {
  margin-top: 12px;
  width: 100%;
}

@media (max-width: 900px) {
  .hamburger-btn {
    display: flex !important;
  }
  .landing-header-inner {
    padding: 12px 20px !important;
  }
  /* Hide text nav links and desktop CTA — they're in the mobile dropdown */
  .landing-nav > a {
    display: none !important;
  }
  .landing-nav > .btn {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .hamburger-btn,
  .mobile-nav-dropdown {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .landing-header-inner {
    padding: 10px 16px !important;
  }
}

/* ============================================
   LANDING PAGE — SECTION PADDINGS MOBILE
   ============================================ */

.features-section-wrapper {
  padding: 80px 32px;
  background: linear-gradient(180deg, var(--cream-50) 0%, var(--bg) 100%);
}

.testimonials-section-wrapper {
  padding: 90px 32px;
  max-width: 1240px;
  margin: 0 auto;
}

.cta-section-wrapper {
  padding: 40px 32px 80px;
}

@media (max-width: 900px) {
  .features-section-wrapper {
    padding: 48px 20px !important;
  }
  .testimonials-section-wrapper {
    padding: 48px 20px !important;
  }
  .cta-section-wrapper {
    padding: 32px 16px 48px !important;
  }
  .cta-grid {
    padding: 36px 28px !important;
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  .cta-grid > div:last-child .btn {
    width: 100% !important;
  }
}

@media (max-width: 640px) {
  .features-section-wrapper {
    padding: 32px 16px !important;
  }
  .testimonials-section-wrapper {
    padding: 32px 16px !important;
  }
  .cta-section-wrapper {
    padding: 20px 12px 36px !important;
  }
  .cta-grid {
    padding: 24px 20px !important;
  }
  .hero-grid {
    padding: 24px 16px 20px !important;
  }
}

/* ============================================
   DASHBOARD & ANALYZE CONTAINERS
   ============================================ */

.dashboard-container {
  padding: 32px 40px;
  max-width: 1320px;
  margin: 0 auto;
}

.analyze-page-container {
  padding: 32px 40px;
  max-width: 1240px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .dashboard-container,
  .analyze-page-container {
    padding: 24px 20px !important;
  }
}

@media (max-width: 640px) {
  .dashboard-container,
  .analyze-page-container {
    padding: 16px 14px !important;
  }
}

/* ============================================
   ANALYZE COMPONENT — RESPONSIVE GRIDS
   ============================================ */

@media (max-width: 900px) {
  .analyze-upload-row {
    grid-template-columns: 1fr !important;
  }
  .prevention-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   ADMIN PANEL — RESPONSIVE
   ============================================ */

/* Admin sidebar becomes horizontal scrollable bottom tab bar on mobile */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 56px !important;
    flex-direction: row !important;
    padding: 4px 8px !important;
    border-right: none !important;
    border-top: 1px solid rgba(255,255,255,0.12) !important;
    z-index: 999 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    align-items: center !important;
    gap: 2px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .admin-sidebar::-webkit-scrollbar {
    display: none !important;
  }
  /* Hide logo, search, group labels, back button */
  .admin-sidebar-logo,
  .admin-sidebar-search,
  .admin-sidebar-group-label,
  .admin-sidebar-back {
    display: none !important;
  }
  /* Dissolve group containers so buttons flow inline */
  .admin-sidebar-group {
    display: contents !important;
  }
  /* Style tab buttons as compact icon+label tiles */
  .admin-sidebar-group > button {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
    min-width: 52px !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    position: relative !important;
  }
  /* Admin main content — add bottom padding so tab bar doesn't cover it */
  .admin-main {
    padding-bottom: 70px !important;
  }
  /* Admin content area */
  .admin-content {
    padding: 16px 16px 60px !important;
    overflow-x: hidden !important;
  }
  /* Admin topbar compact */
  .admin-topbar {
    padding: 12px 16px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .admin-topbar h1 {
    font-size: 18px !important;
  }
  .admin-topbar > div:last-child {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

@media (max-width: 640px) {
  .admin-topbar {
    padding: 10px 12px !important;
  }
  .admin-topbar h1 {
    font-size: 16px !important;
    margin: 0 !important;
  }
  .admin-content {
    padding: 12px 12px 60px !important;
  }
}

/* Admin content grid layouts — responsive */
@media (max-width: 1024px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .admin-two-col {
    grid-template-columns: 1fr !important;
  }
  .admin-three-col {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* Tables: horizontal scroll */
  .admin-content table {
    min-width: 600px;
  }
  .admin-content .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Wrap overflow tables in admin */
.admin-content > div > div[style*="overflow: auto"],
.admin-content > div > div[style*="overflow:auto"] {
  -webkit-overflow-scrolling: touch;
}

/* Command palette full-width on mobile */
@media (max-width: 640px) {
  .admin-cmd-palette {
    width: calc(100vw - 32px) !important;
    max-width: 100% !important;
  }
}

/* =============================================
   ONBOARDING — MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .onboarding-container {
    flex-direction: column !important;
  }
  .onboarding-left {
    display: none !important;
  }
  .onboarding-right {
    flex: 1 1 100% !important;
    padding: 20px 16px 28px !important;
    min-height: 100vh;
  }
  /* Stepper: shrink so 4 steps fit on 320px */
  .stepper {
    gap: 4px !important;
    margin-top: 16px !important;
  }
  .stepper > * > div:first-child { /* step circle */
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
  }
  .stepper span {
    font-size: 10px !important;
  }
  .stepper > * > div[style*="width: 24"] { /* connector bar */
    width: 12px !important;
  }
  /* Form area: full width, top-aligned */
  .onboarding-right > div:nth-child(3) {
    max-width: 100% !important;
    justify-content: flex-start !important;
    padding-top: 20px;
  }
  /* Language cards: side by side, compact */
  .lang-options {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .lang-options button {
    padding: 16px 10px !important;
  }
  .lang-options button > div:first-child { /* flag emoji */
    font-size: 20px !important;
    margin-bottom: 4px !important;
  }
  .lang-options button > div:nth-child(2) { /* lang name */
    font-size: 16px !important;
  }
  .lang-options button > div:last-child { /* subtitle */
    font-size: 11px !important;
  }
  /* OTP boxes: fit 4 across on 320px */
  .otp-inputs {
    gap: 8px !important;
  }
  .otp-inputs input {
    width: 56px !important;
    height: 62px !important;
    font-size: 24px !important;
    border-radius: 10px !important;
  }
  /* Onboarding button rows — Back + Action */
  .onboarding-btn-row {
    flex-direction: row !important;
  }
  .onboarding-btn-row .btn {
    min-height: 50px !important;
    font-size: 15px !important;
    padding: 12px 16px !important;
  }
  /* Standalone full-width buttons (Continue) */
  .onboarding-continue-btn {
    width: 100% !important;
    min-height: 52px !important;
    font-size: 16px !important;
  }
}
@media (max-width: 380px) {
  .otp-inputs input {
    width: 46px !important;
    height: 54px !important;
    font-size: 20px !important;
  }
  .stepper span {
    display: none !important; /* hide labels, just show circles */
  }
}

/* =============================================
   USER APP PAGES — VOICE / HISTORY / ANALYTICS
   ============================================= */
/* Voice page */
@media (max-width: 768px) {
  .voice-page-container {
    padding: 12px 12px 16px !important;
  }
  .conversation-container {
    padding: 14px !important;
    gap: 12px !important;
  }
  .voice-input-area {
    padding: 14px !important;
    gap: 12px !important;
    flex-direction: row !important;
    align-items: flex-start !important;
  }
  .mic-btn {
    width: 64px !important;
    height: 64px !important;
    flex-shrink: 0 !important;
  }
  .mic-btn svg { width: 30px !important; height: 30px !important; }
}

/* History page */
@media (max-width: 768px) {
  .history-page-container {
    padding: 14px 12px !important;
  }
  .history-page-container > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .history-grid {
    grid-template-columns: 1fr !important;
  }
  .history-item {
    gap: 12px !important;
  }
  .history-item > div:first-child { /* thumbnail */
    width: 56px !important;
    height: 56px !important;
  }
}

/* Analytics page */
@media (max-width: 900px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .analytics-split-view {
    grid-template-columns: 1fr !important;
  }
  .analytics-map-grid {
    grid-template-columns: 1fr !important;
  }
  .analytics-top-questions-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 480px) {
  .analytics-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* WhatsApp layout */
@media (max-width: 768px) {
  .whatsapp-layout {
    grid-template-columns: 1fr !important;
  }
  .whatsapp-phone-mock {
    display: none !important;
  }
}