/* ==========================================================================
   ASHA Sahayak v2 - Modern Health-Tech Design System
   Teal brand (#0F766E), WCAG AA accessible risk tokens, light/dark themes,
   smooth motion, glass sticky header, bottom mobile tab bar, 2-pane desktop.
   ========================================================================== */

:root {
  --bg-page: #F3F7F6;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-alt: #F6FAF9;
  --bg-glass: rgba(255, 255, 255, 0.86);
  --bg-nav-pill: #E6EFEE;
  --bg-input: #F8FBFA;

  --text-main: #0F172A;
  --text-secondary: #334155;
  --text-muted: #526373;

  --brand: #0F766E;
  --brand-hover: #0D5E58;
  --brand-light: #14B8A6;
  --brand-soft: rgba(15, 118, 110, 0.10);
  --brand-border: rgba(15, 118, 110, 0.25);

  --accent: #0284C7;
  --accent-soft: rgba(2, 132, 199, 0.10);

  /* Accessible WCAG AA Risk Colors */
  --risk-urgent: #B91C1C;
  --risk-urgent-bg: #FEF2F2;
  --risk-urgent-border: rgba(185, 28, 28, 0.35);

  --risk-refer: #9A3412;
  --risk-refer-bg: #FFF7ED;
  --risk-refer-border: rgba(154, 52, 18, 0.32);

  --risk-home: #047857;
  --risk-home-bg: #ECFDF5;
  --risk-home-border: rgba(4, 120, 87, 0.30);

  --border-subtle: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.18);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 10px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 24px -6px rgba(15, 23, 42, 0.10), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.14);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-stack: "Noto Sans Devanagari", "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.theme-dark {
  --bg-page: #0B1215;
  --bg-surface: #121D21;
  --bg-card: #162328;
  --bg-card-alt: #1C2C32;
  --bg-glass: rgba(18, 29, 33, 0.88);
  --bg-nav-pill: #1E2E33;
  --bg-input: #111B1E;

  --text-main: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --brand: #14B8A6;
  --brand-hover: #2DD4BF;
  --brand-light: #5EEAD4;
  --brand-soft: rgba(20, 184, 166, 0.16);
  --brand-border: rgba(45, 212, 191, 0.32);

  --risk-urgent: #FCA5A5;
  --risk-urgent-bg: rgba(185, 28, 28, 0.22);
  --risk-urgent-border: rgba(248, 113, 113, 0.42);

  --risk-refer: #FDBA74;
  --risk-refer-bg: rgba(154, 52, 18, 0.24);
  --risk-refer-border: rgba(251, 146, 60, 0.40);

  --risk-home: #6EE7B7;
  --risk-home-bg: rgba(4, 120, 87, 0.22);
  --risk-home-border: rgba(52, 211, 153, 0.38);

  --border-subtle: rgba(241, 245, 249, 0.10);
  --border-strong: rgba(241, 245, 249, 0.20);

  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-page);
  color: var(--text-main);
}

body {
  font-family: var(--font-stack);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 76px; /* room for mobile bottom tab bar */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }
}

.hidden {
  display: none !important;
}

.svg-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.svg-icon.sm { width: 16px; height: 16px; }
.svg-icon.lg { width: 24px; height: 24px; }
.svg-icon.xl { width: 30px; height: 30px; }

/* Focus Visible Accessibility */
:focus-visible {
  outline: 3px solid var(--brand-light);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Sticky Glass Header + Sliding Desktop Navigation Pill
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 120;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (min-width: 1120px) {
  .header-inner {
    flex-wrap: nowrap;
  }
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0F766E, #14B8A6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-title-col {
  display: flex;
  flex-direction: column;
}

.app-title-h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-sub-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Desktop Navigation Bar inside sticky chrome */
.desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    position: relative;
    align-items: center;
    background: var(--bg-nav-pill);
    padding: 4px;
    border-radius: var(--radius-full);
    gap: 2px;
    border: 1px solid var(--border-subtle);
  }
}

.nav-pill-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  transition: transform 0.28s var(--ease-out), width 0.28s var(--ease-out);
  z-index: 0;
  pointer-events: none;
}

.desktop-nav .nav-tab-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.desktop-nav .nav-tab-btn.active {
  color: var(--brand);
}

.desktop-nav .nav-tab-btn:hover:not(.active) {
  color: var(--text-main);
}

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

.btn-judge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  min-height: 36px;
}

.btn-judge-pill:hover {
  background: var(--brand);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.lang-chips {
  display: inline-flex;
  background: var(--bg-nav-pill);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.lang-chip {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 30px;
}

.lang-chip.active {
  background: var(--brand);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: rotate(10deg);
}

/* Mobile Fixed Bottom Tab Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 130;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-bottom-nav .nav-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

.mobile-bottom-nav .nav-tab-btn.active {
  color: var(--brand);
  background: var(--brand-soft);
}

/* --------------------------------------------------------------------------
   Main App Container & View Transitions
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.tab-view {
  animation: viewEnter 0.34s var(--ease-out);
}

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

.offline-banner {
  background: var(--risk-refer-bg);
  border: 1px solid var(--risk-refer-border);
  color: var(--risk-refer);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
}

/* Demo Sample Active Strip */
.demo-active-strip {
  background: linear-gradient(90deg, var(--brand-soft), var(--accent-soft));
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand);
}

/* Shared Cards & Buttons */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, transform 0.25s var(--ease-out);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Ripple & Interactive Buttons */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s ease, background 0.2s ease;
  min-height: 46px;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  box-shadow: 0 6px 16px -4px rgba(15, 118, 110, 0.45);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -4px rgba(15, 118, 110, 0.50);
}

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-urgent {
  background: #B91C1C;
  color: #FFFFFF;
}

.btn-urgent:hover:not(:disabled) {
  background: #991B1B;
}

.btn-sm {
  padding: 7px 13px;
  min-height: 36px;
  font-size: 0.82rem;
}

.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  transform: scale(0);
  animation: rippleAnim 0.55s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* --------------------------------------------------------------------------
   VIEW 0: LANDING PAGE (HOME)
   -------------------------------------------------------------------------- */
.hero-section {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(2, 132, 199, 0.08), rgba(20, 184, 166, 0.14));
  background-size: 200% 200%;
  animation: heroGradient 12s ease infinite;
  border: 1px solid var(--brand-border);
  margin-bottom: 28px;
}

@keyframes heroGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-section {
    padding: 44px 40px;
  }
  .hero-grid {
    grid-template-columns: 1.25fr 0.95fr;
    gap: 40px;
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.hero-headline {
  font-size: clamp(1.65rem, 3.2vw, 2.55rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-bottom: 14px;
}

.hero-subline {
  font-size: 1.02rem;
  color: var(--text-secondary);
  max-width: 56ch;
  margin-bottom: 22px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Animated Phone Mockup */
.phone-mockup-wrap {
  display: flex;
  justify-content: center;
}

.phone-frame {
  width: 280px;
  background: var(--bg-card);
  border: 6px solid #1E293B;
  border-radius: 30px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.phone-notch {
  width: 84px;
  height: 12px;
  background: #1E293B;
  border-radius: var(--radius-full);
  margin: 0 auto 12px;
}

.phone-screen-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phone-cycle-card {
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1.5px solid transparent;
  transition: all 0.45s var(--ease-out);
  min-height: 175px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.phone-cycle-card.URGENT_REFERRAL {
  background: var(--risk-urgent-bg);
  border-color: var(--risk-urgent-border);
  color: var(--risk-urgent);
}

.phone-cycle-card.VISIT_PHC {
  background: var(--risk-refer-bg);
  border-color: var(--risk-refer-border);
  color: var(--risk-refer);
}

.phone-cycle-card.HOME_CARE {
  background: var(--risk-home-bg);
  border-color: var(--risk-home-border);
  color: var(--risk-home);
}

.phone-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.phone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: width 0.25s ease, background 0.25s ease;
}

.phone-dot.active {
  width: 20px;
  border-radius: var(--radius-full);
  background: var(--brand);
}

/* Landing Sections: 3 Steps, Trust Strip, Verified Numbers */
.landing-section {
  margin-bottom: 32px;
}

.landing-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-main);
}

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

@media (min-width: 768px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.step-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.step-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.trust-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .trust-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

.trust-pill-card {
  background: var(--bg-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.trust-pill-card .svg-icon {
  color: var(--brand);
}

.facts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 600px) {
  .facts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .facts-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.fact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.fact-number {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.15;
  margin-bottom: 6px;
}

.fact-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.fact-source {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   VIEW 1: TRIAGE 2-PANE DESKTOP SHELL & STEPPER
   -------------------------------------------------------------------------- */
.triage-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 1024px) {
  .triage-shell {
    grid-template-columns: 300px 1fr;
    align-items: start;
  }
}

.triage-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 1024px) {
  .triage-sidebar {
    position: sticky;
    top: 84px;
  }
}

.stepper-list {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 0;
}

@media (min-width: 1024px) {
  .stepper-list {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }
}

.stepper-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: background 0.2s ease, color 0.2s ease;
}

.stepper-item.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.stepper-item.done {
  color: var(--risk-home);
}

.stepper-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.stepper-item.active .stepper-num {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

.stepper-item.done .stepper-num {
  background: var(--risk-home);
  border-color: var(--risk-home);
  color: #FFFFFF;
}

.stepper-label {
  display: none;
}

@media (min-width: 600px) {
  .stepper-label {
    display: inline;
  }
}

.sidebar-summary-box {
  display: none;
}

@media (min-width: 1024px) {
  .sidebar-summary-box {
    display: block;
    border-top: 1px solid var(--border-subtle);
    padding-top: 14px;
  }
}

.summary-kv {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.triage-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-nav-pill);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 16px;
}

.triage-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-out);
}

/* Module Grid */
.module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 600px) {
  .module-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.module-card-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card-alt);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  font-family: inherit;
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 86px;
}

.module-card-btn:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

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

.module-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Forms & Inputs */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (min-width: 600px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control {
  font-family: inherit;
  font-size: 0.96rem;
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  color: var(--text-main);
  min-height: 44px;
  width: 100%;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.age-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.age-unit-badge {
  background: var(--bg-nav-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Voice State Machine UI (P0-B) */
.voice-card {
  background: var(--bg-card-alt);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 18px;
}

.voice-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.voice-mic-circle {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s ease;
}

.voice-mic-circle.listening {
  background: #B91C1C;
}

.voice-mic-circle.listening::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #EF4444;
  animation: micPulseRing 1.3s ease-out infinite;
}

@keyframes micPulseRing {
  0% { transform: scale(0.95); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}

.voice-state-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.voice-state-bar.listening {
  background: var(--risk-urgent-bg);
  border: 1px solid var(--risk-urgent-border);
  color: var(--risk-urgent);
}

.voice-state-bar.processing,
.voice-state-bar.asking_permission {
  background: var(--accent-soft);
  border: 1px solid rgba(2, 132, 199, 0.3);
  color: var(--accent);
}

.voice-state-bar.success {
  background: var(--risk-home-bg);
  border: 1px solid var(--risk-home-border);
  color: var(--risk-home);
}

.voice-state-bar.error {
  background: var(--risk-urgent-bg);
  border: 1px solid var(--risk-urgent-border);
  color: var(--risk-urgent);
  flex-wrap: wrap;
}

.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.waveform span {
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  animation: waveBar 0.9s ease-in-out infinite alternate;
}

.waveform span:nth-child(2) { animation-delay: 0.15s; }
.waveform span:nth-child(3) { animation-delay: 0.3s; }
.waveform span:nth-child(4) { animation-delay: 0.45s; }
.waveform span:nth-child(5) { animation-delay: 0.6s; }
.waveform span:nth-child(6) { animation-delay: 0.25s; }

@keyframes waveBar {
  from { height: 5px; }
  to { height: 20px; }
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.suggest-chip.confirmed {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* Grouped Danger Sign Icon Cards (P0-D) */
.early-exit-banner {
  background: var(--risk-urgent-bg);
  border: 2px solid var(--risk-urgent);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-md);
  animation: viewEnter 0.25s var(--ease-out);
}

@media (min-width: 768px) {
  .early-exit-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.group-section {
  margin-bottom: 18px;
}

.group-heading-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.group-heading-title {
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

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

@media (min-width: 700px) {
  .signs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sign-tile {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s var(--ease-out), border-color 0.2s ease, background 0.2s ease;
}

.sign-tile:hover {
  border-color: var(--brand-border);
  transform: translateY(-1px);
}

.sign-tile.state-yes {
  background: var(--risk-urgent-bg);
  border-color: var(--risk-urgent);
}

.sign-tile.state-yes.level-REFER {
  background: var(--risk-refer-bg);
  border-color: var(--risk-refer);
}

.sign-tile.state-no {
  background: var(--risk-home-bg);
  border-color: var(--risk-home-border);
}

.sign-tile.state-dont_know {
  background: var(--risk-refer-bg);
  border-color: var(--risk-refer-border);
}

.sign-tile-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.sign-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sign-tile.state-yes .sign-icon-box {
  background: var(--risk-urgent);
  color: #FFFFFF;
}

.sign-tile-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.2s var(--ease-out);
}

.sign-tile.state-yes .sign-tile-check {
  background: var(--risk-urgent);
  border-color: var(--risk-urgent);
  color: #FFFFFF;
  animation: checkBounce 0.25s var(--ease-out);
}

.sign-tile.state-no .sign-tile-check {
  background: var(--risk-home);
  border-color: var(--risk-home);
  color: #FFFFFF;
}

@keyframes checkBounce {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.sign-why-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 2px solid var(--brand-border);
  padding-left: 8px;
}

.sign-tile-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-pill {
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 5px 11px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
}

.mini-pill.active-yes {
  background: var(--risk-urgent);
  border-color: var(--risk-urgent);
  color: #FFFFFF;
}

.mini-pill.active-no {
  background: var(--risk-home);
  border-color: var(--risk-home);
  color: #FFFFFF;
}

.mini-pill.active-dk {
  background: var(--risk-refer);
  border-color: var(--risk-refer);
  color: #FFFFFF;
}

/* Breath Counter Ring */
.breath-card {
  background: var(--bg-card-alt);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
}

.breath-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-around;
  gap: 18px;
  margin: 14px 0;
}

.ring-box {
  position: relative;
  width: 112px;
  height: 112px;
}

.ring-svg {
  width: 112px;
  height: 112px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 8;
}

.ring-bar {
  fill: none;
  stroke: var(--brand);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-sec {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-chip.neutral { background: var(--bg-nav-pill); color: var(--text-muted); }
.status-chip.normal { background: var(--risk-home-bg); color: var(--risk-home); border: 1px solid var(--risk-home-border); }
.status-chip.fast { background: var(--risk-urgent-bg); color: var(--risk-urgent); border: 1px solid var(--risk-urgent-border); }

/* Result Reveal Screen */
.result-banner {
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 18px;
  border: 2px solid transparent;
  animation: resultReveal 0.4s var(--ease-out);
}

@keyframes resultReveal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.result-banner.URGENT_REFERRAL {
  background: var(--risk-urgent-bg);
  border-color: var(--risk-urgent);
  color: var(--risk-urgent);
}

.result-banner.VISIT_PHC {
  background: var(--risk-refer-bg);
  border-color: var(--risk-refer);
  color: var(--risk-refer);
}

.result-banner.HOME_CARE {
  background: var(--risk-home-bg);
  border-color: var(--risk-home);
  color: var(--risk-home);
}

.result-banner-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-banner-icon .svg-icon {
  color: #FFFFFF;
}

.result-banner.URGENT_REFERRAL .result-banner-icon {
  animation: urgentPulse 1.6s infinite;
}

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(185, 28, 28, 0); }
}

.result-stagger > * {
  animation: viewEnter 0.35s var(--ease-out) backwards;
}

.result-stagger > *:nth-child(2) { animation-delay: 0.06s; }
.result-stagger > *:nth-child(3) { animation-delay: 0.12s; }
.result-stagger > *:nth-child(4) { animation-delay: 0.18s; }

.referral-slip {
  background: var(--bg-input);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  color: var(--text-main);
}

.action-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}

@media (min-width: 600px) {
  .action-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --------------------------------------------------------------------------
   DASHBOARD + SKELETON LOADERS + CHARTS
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-nav-pill) 25%, var(--bg-card-alt) 50%, var(--bg-nav-pill) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.kpi-card.urgent { border-bottom-color: var(--risk-urgent); }
.kpi-card.refer { border-bottom-color: var(--risk-refer); }
.kpi-card.home { border-bottom-color: var(--risk-home); }

.kpi-val {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-lbl {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 900px) {
  .dash-charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.bar-row {
  margin-bottom: 10px;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-nav-pill);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-full);
  transition: width 0.55s var(--ease-out);
}

.alert-card {
  background: var(--risk-urgent-bg);
  border: 1px solid var(--risk-urgent-border);
  color: var(--risk-urgent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.alert-card.WARNING {
  background: var(--risk-refer-bg);
  border-color: var(--risk-refer-border);
  color: var(--risk-refer);
}

/* Info / Privacy Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}

@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.qr-card {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--brand-soft);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 20px;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  z-index: 250;
  animation: viewEnter 0.2s var(--ease-out);
}

@media (min-width: 768px) {
  .toast {
    bottom: 24px;
  }
}

/* Global Build Stamp Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 18px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.build-stamp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Print Layout for Doctor Referral Slip */
@media print {
  .app-header, .mobile-bottom-nav, .triage-sidebar, .action-grid-4, .no-print, .app-footer {
    display: none !important;
  }
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}
