/* ═══ RNI FAIL-CLOSED GATE (rni-session.js.2) ═══ */
html.rni-locked body { opacity: 0; pointer-events: none; }
html.rni-unlocked body { opacity: 1; pointer-events: auto; transition: opacity 120ms ease; }

/* Lucide Icon Defaults */
svg.lucide { width: 16px; height: 16px; display: inline-block; vertical-align: -2px; stroke-width: 1.75; stroke: currentColor !important; }
i[data-lucide] { display: inline-block; width: 16px; height: 16px; }

/* ============================================
   RNI PATIENT PORTALPWA CANON
   - Progressive Web App (manifest + service worker)
   - Mobile-first responsive (375px → 1700px)
   - Bottom nav + Olivia slide-up drawer
   - Lucide icons throughout
   - Two green dots + legal consent + e-signature
   - 75% thin accent lines (Sovereign Standard)
   - Touch targets 48px minimum
   ============================================ */

:root {
  --rni-green: #43DBA3;
  --rni-green-dark: #2EBD8A;
  --rni-green-soft: rgba(67, 219, 163, 0.12);
  --rni-blue: #3B82F6;
  --rni-blue-soft: rgba(77, 124, 255, 0.12);
  --rni-red: #FF6B6B;
  --rni-red-soft: rgba(255, 107, 107, 0.1);
  --rni-purple: #7C3AED;
  --rni-purple-dark: #6D28D9;
  --rni-purple-soft: rgba(124, 58, 237, 0.1);
  --rni-amber-dark: #92400E;
  --rni-blue-dark: #2563EB;
  --rni-dark: #1a1f2e;
  --rni-dark-deep: #111827;
  --rni-yellow: #FFC932;
  --rni-yellow-soft: rgba(255, 201, 50, 0.12);
  
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  
  /* SAME TINT FOR BOTH IMAGES - Subtle green wash */
  --image-overlay: linear-gradient(
    135deg, 
    rgba(67, 219, 163, 0.12) 0%,
    rgba(17, 24, 39, 0.55) 40%,
    rgba(17, 24, 39, 0.45) 100%
  );
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Heebo', -apple-system, sans-serif;
  color: var(--text);
}

.site-header, #site-header, .kallium-header, .kallium-footer,
.footer-wrapper, #colophon, body > footer, #footer, #wpadminbar {
  display: none !important;
}

/* ============================================
   LAYOUT - WIDER
   ============================================ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   LEFT SIDEBAR
   ============================================ */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar > .day-card {
  flex-shrink: 0;
  margin-top: auto;
}

/* BRAND HEADER WITH HEART LOGO */
.brand-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}

.brand-heart {
  width: 56px;
  height: auto;
  margin: 0 auto 8px;
  display: block;
  /* Tint white logo to RNI green #43DBA3 */
  filter: brightness(0) saturate(100%) invert(78%) sepia(42%) saturate(522%) hue-rotate(103deg) brightness(94%) contrast(87%);
  animation: heartbeat 2.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { 
    transform: scale(1); 
    filter: brightness(0) saturate(100%) invert(78%) sepia(42%) saturate(522%) hue-rotate(103deg) brightness(94%) contrast(87%) drop-shadow(0 0 8px rgba(67, 219, 163, 0.6));
  }
  50% { 
    transform: scale(1.15); 
    filter: brightness(0) saturate(100%) invert(78%) sepia(42%) saturate(522%) hue-rotate(103deg) brightness(94%) contrast(87%) drop-shadow(0 0 22px rgba(67, 219, 163, 1));
  }
}

.brand-tagline {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* NAV - Scrollable with all items visible */
.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-scroll::-webkit-scrollbar {
  display: none;
}

.nav-group {
  margin-bottom: 20px;
}

.nav-group:last-child {
  margin-bottom: 0;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--rni-green-soft);
  color: var(--rni-green-dark);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--rni-green);
  border-radius: 0 2px 2px 0;
}

.nav-item i, .nav-item svg.lucide {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.nav-item:hover i, .nav-item:hover svg.lucide {
  color: var(--rni-green);
}

.nav-item.active i, .nav-item.active svg.lucide {
  color: var(--rni-green);
}

.nav-badge {
  margin-left: auto;
  background: var(--rni-green);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

/* DAY COUNTER */
.day-card {
  margin: 12px;
  margin-bottom: 16px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  height: 110px;
  flex-shrink: 0;
  background: url('https://recoverynetwork.aihttps://recoverynetwork.aihttps://recoverynetwork.aihttps://recoverynetwork.ai/wp-content/uploads/2018/03/double-exposure-of-a-woman-holding-up-her-arms-scaled.jpg') center/cover;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.day-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--image-overlay); /* SAME TINT */
}

.day-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  color: #fff;
}

.day-num {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  line-height: 1;
  color: var(--rni-green);
}

.day-label {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
}

.day-motto {
  font-size: 10px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
  font-style: italic;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  padding: 20px 24px;
  overflow-y: auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.main::-webkit-scrollbar {
  display: none;
}

/* HERO */
.hero {
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  height: 200px;
  min-height: 200px;
  flex-shrink: 0;
  margin-bottom: 16px;
  background: url('https://recoverynetwork.aihttps://recoverynetwork.aihttps://recoverynetwork.aihttps://recoverynetwork.ai/wp-content/uploads/2022/07/close-up-people-holding-hands-1-1-scaled.jpg') center/cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--image-overlay); /* SAME TINT */
}

.hero-inner {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  color: #FFFFFF;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hero-greeting {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  color: #FFFFFF;
}

.hero-date {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
}

.sync-pill {
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 6px 12px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #FFFFFF;
}

.sync-signal { font-size: 10px; color: var(--rni-green); }
.sync-battery { font-size: 10px; color: var(--rni-green); }
.sync-dot { 
  width: 6px; 
  height: 6px; 
  background: var(--rni-green); 
  border-radius: 50%;
  margin-left: 2px;
}

.hero-bottom {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  gap: 28px;
}

/* GAUGE */
.gauge {
  position: relative;
  width: 120px;
  height: 75px;
  flex-shrink: 0;
}

.gauge svg {
  width: 120px;
  height: 75px;
}

.gauge-track {
  fill: none;
  stroke: rgba(255,255,255,0.25);
  stroke-width: 10;
  stroke-linecap: round;
}

.gauge-bar {
  fill: none;
  stroke: var(--rni-green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  filter: drop-shadow(0 0 8px var(--rni-green));
  transition: stroke-dashoffset 1.2s ease-out;
}

.gauge-value {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.gauge-num {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  line-height: 1;
  color: #FFFFFF;
}

.gauge-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.7);
}

.hero-msg {
  flex: 1;
}

.hero-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 26px;
  margin-bottom: 8px;
  color: #FFFFFF;
}

.hero-text {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255,255,255,0.9);
}

/* ============================================
   METRICS
   ============================================ */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.metric {
  background: var(--card);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  cursor: pointer;
}

.metric:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.metric-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-icon i, .metric-icon svg { font-size: 14px; }
.metric-icon.sleep { color: var(--rni-blue); }
.metric-icon.hrv { color: var(--rni-green); }
.metric-icon.stress { color: var(--rni-yellow); }

.metric-icon span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.metric-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
}

.metric-trend.up {
  background: var(--rni-green-soft);
  color: var(--rni-green-dark);
}

.metric-trend.down {
  background: var(--rni-red-soft);
  color: var(--rni-red);
}

.metric-trend.flat {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
}

.metric-val {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.metric-num {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--text);
}

.metric-unit {
  font-size: 14px;
  color: var(--text-muted);
}

.metric-range {
  font-size: 11px;
  color: var(--rni-green);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-range i, .metric-range svg { font-size: 10px; }

/* SPARKLINE - Animated */
.sparkline {
  height: 40px;
}

.sparkline svg {
  width: 100%;
  height: 40px;
}

.spark-area { 
  opacity: 0;
  animation: areaFadeIn 0.8s ease-out forwards;
  animation-delay: 0.8s;
}

@keyframes areaFadeIn {
  from { opacity: 0; }
  to { opacity: 0.15; }
}

.spark-area.sleep { fill: var(--rni-blue); }
.spark-area.hrv { fill: var(--rni-green); }
.spark-area.stress { fill: var(--rni-yellow); }

.spark-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: drawLine 1s ease-out forwards;
  animation-delay: 0.3s;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

.spark-line.sleep { stroke: var(--rni-blue); }
.spark-line.hrv { stroke: var(--rni-green); }
.spark-line.stress { stroke: var(--rni-yellow); }

.spark-dot { 
  fill: var(--card); 
  stroke-width: 2.5;
  opacity: 0;
  transform-origin: center;
  animation: dotPop 0.3s ease-out forwards;
  animation-delay: 1.2s;
}

@keyframes dotPop {
  0% { opacity: 0; transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

.spark-dot.sleep { stroke: var(--rni-blue); }
.spark-dot.hrv { stroke: var(--rni-green); }
.spark-dot.stress { stroke: var(--rni-yellow); }

/* Stagger animations for each metric */
.metric:nth-child(1) .spark-line { animation-delay: 0.3s; }
.metric:nth-child(1) .spark-area { animation-delay: 0.8s; }
.metric:nth-child(1) .spark-dot { animation-delay: 1.2s; }

.metric:nth-child(2) .spark-line { animation-delay: 0.5s; }
.metric:nth-child(2) .spark-area { animation-delay: 1.0s; }
.metric:nth-child(2) .spark-dot { animation-delay: 1.4s; }

.metric:nth-child(3) .spark-line { animation-delay: 0.7s; }
.metric:nth-child(3) .spark-area { animation-delay: 1.2s; }
.metric:nth-child(3) .spark-dot { animation-delay: 1.6s; }

.spark-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.spark-labels span {
  font-size: 10px;
  color: var(--text-muted);
}

.spark-range {
  font-size: 9px !important;
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.3px;
}

/* ============================================
   QUICK ACTIONS - Improved
   ============================================ */
.actions {
  background: none;
  border-radius: 0;
  padding: 0;
  border: none;
  margin-bottom: 14px;
  flex-shrink: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.actions-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.06);
  position: relative;
  min-height: 100px;
}

.action-btn i, .action-btn svg {
  font-size: 24px;
  transition: transform 0.2s ease;
}

/* Logistical actions - Blue */
.action-btn.logistical i, .action-btn.logistical svg {
  color: var(--rni-blue);
}

.action-btn.logistical:hover {
  border-color: var(--rni-blue);
  background: var(--rni-blue-soft);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(77, 124, 255, 0.2);
}

.action-btn.logistical:hover i, .action-btn.logistical:hover svg {
  transform: scale(1.1);
}

/* Growth actions - Blue (same hover, distinct icon tone) */
.action-btn.growth i, .action-btn.growth svg {
  color: var(--text-secondary);
}

.action-btn.growth:hover {
  border-color: var(--rni-blue);
  background: var(--rni-blue-soft);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(77, 124, 255, 0.2);
}

.action-btn.growth:hover i, .action-btn.growth:hover svg {
  transform: scale(1.1);
  color: var(--rni-blue);
}

.action-btn span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

/* Contextual meta text under buttons */
.action-meta {
  font-size: 10px !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  margin-top: 0 !important;
}

/* Pulse animation for incomplete Check-in */
.action-btn.pulse i, .action-btn.pulse svg {
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 1;
  }
  50% { 
    transform: scale(1.15);
    opacity: 0.8;
  }
}

/* Check-in Success State */
.action-btn.completed {
  background: var(--rni-green-soft);
  border-color: var(--rni-green);
}

.action-btn.completed i, .action-btn.completed svg {
  color: var(--rni-green);
  animation: none;
}

.action-btn.completed:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: default;
}

/* Responsive 2x2 on tablets */
@media (max-width: 1100px) {
  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   FOOTER - Dark Professional
   ============================================ */
.main-footer {
  margin-top: auto;
  padding-top: 16px;
  flex-shrink: 0;
}

.footer-dark {
  background: #1a1f2e;
  border-radius: 10px;
  padding: 20px 24px;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.footer-disclaimer {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.footer-compliance {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 14px;
}

.footer-legal-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
}

.footer-legal-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-legal-links a:hover {
  color: #fff;
}

.footer-legal-links span {
  color: rgba(255, 255, 255, 0.4);
}

/* EKG + Powered By */
.footer-ekg {
  text-align: center;
  padding: 20px 0 10px;
}

.ekg-line {
  height: 36px;
  width: 200px;
  margin: 0 auto 14px;
  position: relative;
  overflow: hidden;
}

.ekg-line svg {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 400px;
  height: 36px;
  animation: ekg-scroll 2.5s linear infinite;
}

@keyframes ekg-scroll {
  from { left: 0; }
  to { left: -200px; }
}

.ekg-path {
  fill: none;
  stroke: var(--rni-green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-powered {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================
   RIGHT PANEL - DR. OLIVIA
   ============================================ */
.olivia-panel {
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 16px 16px 16px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}

.olivia-panel::-webkit-scrollbar {
  display: none;
}

.olivia-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.olivia-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rni-green) 0%, var(--rni-green-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.olivia-avatar svg.ekg-avatar {
  width: 22px;
  height: 11px;
}

.olivia-avatar svg.ekg-avatar polyline {
  fill: none;
  stroke: rgba(255,255,255,0.9);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.olivia-avatar span {
  display: none;
}

.olivia-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 8px;
  height: 8px;
  background: var(--rni-green);
  border: 2px solid var(--card);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}

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

.olivia-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.olivia-info .status {
  font-size: 10px;
  color: var(--rni-green);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.olivia-info .status i, .olivia-info .status svg {
  font-size: 5px;
}

/* INSIGHTS */
.insights {
  flex: 1;
  overflow: visible;
  min-height: 0;
}

.insight-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.insight {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 1.5px solid rgba(67, 219, 163, 0.75);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.insight:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.insight.caution {
  border-left-color: rgba(255, 201, 50, 0.75);
}

.insight p {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.insight-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.insight-meta i, .insight-meta svg {
  font-size: 11px;
  color: var(--rni-green);
}

.insight.caution .insight-meta i, .insight-meta svg {
  color: var(--rni-yellow);
}

/* CHAT — Clean, restrained */
.chat-section {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  transition: border-color 0.15s;
}

.chat-box:focus-within {
  border-color: var(--rni-green);
}

.chat-box input {
  flex: 1;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  padding: 4px 0;
}

.chat-box input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--rni-green);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: var(--rni-green-dark);
}

.chat-send i, .chat-send svg {
  font-size: 12px;
}

/* Quick Chips */
.quick-chips {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--rni-green);
  color: var(--rni-green);
  background: var(--rni-green-soft);
}

.chip:first-child {
  border-color: rgba(67, 219, 163, 0.5);
  background: var(--rni-green-soft);
  color: var(--rni-green-dark);
}

/* ═══ DEVICE CONSENT WORKFLOW (Audio Scribe Pattern) ═══ */
.device-consent-workflow {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 16px;
}
.device-consent-step-bar {
  display: flex; background: var(--bg); border-bottom: 1px solid var(--border);
}
.device-consent-step {
  flex: 1; padding: 10px; text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); position: relative; transition: all 0.2s;
}
.device-consent-step.active { color: var(--text); background: var(--card); }
.device-consent-step.complete { color: var(--rni-green); }
.device-consent-step .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 9px; font-weight: 700;
  margin-right: 4px; border: 1.5px solid var(--text-muted); color: var(--text-muted);
}
.device-consent-step.active .step-num { border-color: var(--text); color: var(--text); }
.device-consent-step.complete .step-num { border-color: var(--rni-green); background: var(--rni-green); color: #fff; }
.device-consent-body { padding: 20px; }
.device-consent-panel { display: none; }
.device-consent-panel.active { display: block; }
.device-consent-doc {
  background: #FAFBFC; border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 18px; max-height: 180px; overflow-y: auto; margin: 12px 0;
  font-size: 12px; color: var(--text-secondary); line-height: 1.7;
}
.device-consent-check {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.device-consent-check:last-child { border-bottom: none; }
.device-consent-check input[type="checkbox"] {
  margin-top: 2px; accent-color: var(--rni-green); width: 16px; height: 16px; flex-shrink: 0;
}
.device-consent-check label {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5; cursor: pointer;
}
.device-sig-area {
  border: 1.5px dashed var(--border); border-radius: 10px; background: #FAFBFC;
  padding: 14px; text-align: center; margin: 10px 0; position: relative;
}
.device-sig-area.signed { border-color: var(--rni-green); border-style: solid; background: #F0FDF9; }
.device-sig-input {
  width: 100%; border: none; background: transparent; text-align: center;
  font-family: 'Brush Script MT', 'Segoe Script', 'Dancing Script', cursive;
  font-size: 28px; color: var(--text); outline: none; padding: 10px 0;
}
.device-sig-input::placeholder { color: var(--text-muted); font-size: 16px; font-family: 'Heebo', sans-serif; }
.device-sig-meta {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.45px;
  margin-top: 4px;
}
.device-consent-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg);
}
.device-consent-filed {
  display: none; background: var(--rni-green-soft); border: 1px solid rgba(67,219,163,0.2);
  border-radius: 12px; padding: 18px 20px; text-align: center;
}
.device-consent-filed.visible { display: block; }

/* Crisis link */
.crisis-link {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
}

/* Olivia Console Trigger */
.olivia-console-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--rni-green);
  border: none;
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.olivia-console-trigger:hover {
  background: var(--rni-green-dark);
}

/* RHS Trigger Chips */
.rhs-trigger-chip {
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.rhs-trigger-chip:hover {
  border-color: var(--rni-yellow);
  background: var(--rni-yellow-soft);
}

.rhs-trigger-chip.selected {
  border-color: var(--rni-yellow);
  background: var(--rni-yellow-soft);
  color: var(--text);
  font-weight: 600;
}

/* ═══ OLIVIA CHAT CONSOLE (Clinical Modal Pattern) ═══ */
.olivia-console-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 950;
  align-items: center;
  justify-content: center;
}
.olivia-console-overlay.open { display: flex; }

.olivia-console {
  background: var(--card);
  border-radius: 14px;
  width: 480px;
  max-width: 92vw;
  height: 600px;
  max-height: 85vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.olivia-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.olivia-console-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.olivia-console-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rni-green) 0%, var(--rni-green-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.olivia-console-avatar svg {
  width: 20px;
  height: 10px;
}

.olivia-console-avatar svg polyline {
  fill: none;
  stroke: rgba(255,255,255,0.9);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.olivia-console-close {
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.olivia-console-close:hover {
  background: var(--bg);
}

.olivia-console-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.olivia-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.olivia-msg.from-olivia {
  background: var(--bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.olivia-msg.from-patient {
  background: var(--rni-green);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.olivia-console-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 0 20px 8px;
  flex-shrink: 0;
}

.olivia-console-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.olivia-console-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

.olivia-console-input input:focus {
  border-color: var(--rni-green);
}

.olivia-console-input button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--rni-green);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.olivia-console-input button:hover {
  background: var(--rni-green-dark);
}

.crisis-link a {
  color: var(--rni-red);
  font-weight: 700;
  text-decoration: none;
}

.crisis-link a:hover {
  text-decoration: underline;
}

/* ============================================
   WEARABLE MODAL (Matching existing design)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-content {
  background: var(--card);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 8px 12px 32px rgba(0, 0, 0, 0.35);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--rni-red-soft);
  color: var(--rni-red);
}

.modal-body {
  padding: 24px;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.device-item:hover {
  border-color: var(--rni-green);
  background: var(--rni-green-soft);
}

.device-item.connected {
  border-color: var(--rni-green);
  background: var(--rni-green-soft);
}

.device-icon {
  width: 48px;
  height: 48px;
  background: var(--card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.device-info {
  flex: 1;
}

.device-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.device-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.device-status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--rni-green);
  background: var(--rni-green-soft);
}

.device-status.connected {
  color: #fff;
  background: var(--rni-green);
}

/* Consent section in modal */
.consent-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.consent-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.consent-title i, .consent-title svg {
  color: var(--rni-green);
}

.consent-list {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
  padding-left: 20px;
}

.consent-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.consent-checkbox input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--rni-green);
}

.consent-checkbox label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.consent-checkbox a {
  color: var(--rni-green);
  text-decoration: none;
}

.consent-checkbox a:hover {
  text-decoration: underline;
}

.consent-buttons {
  display: flex;
  gap: 12px;
}

.consent-btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.consent-btn.cancel {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

.consent-btn.cancel:hover {
  background: var(--bg);
}

.consent-btn.confirm {
  background: var(--rni-green);
  border: none;
  color: #fff;
}

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

.consent-btn.confirm:not(:disabled):hover {
  background: var(--rni-green-dark);
}

/* Phoenix Pulse Bar */
.phoenix-pulse-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rni-green) 0%, var(--rni-blue) 50%, var(--rni-green) 100%);
  opacity: 0.3;
  z-index: 9999;
  transition: opacity 0.3s;
}

.phoenix-pulse-bar.pulse-active {
  opacity: 1;
  animation: phoenixPulse 1s ease-out;
}

@keyframes phoenixPulse {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(1); }
  100% { transform: scaleX(1); opacity: 0.3; }
}

/* Sensor Toggle Switch */
.sensor-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--rni-green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.toggle-label.active {
  color: var(--rni-green);
}

/* ============================================
   PATIENT BENCHMARK FEATURES
   ============================================ */

/* AI INSIGHT CARD */
.ai-insight-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

.ai-insight-icon {
  display: none;
}

.ai-insight-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.ai-insight-body {
  margin-bottom: 0;
  padding: 10px 0 0;
}

.ai-insight-main {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 400;
}

.ai-insight-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.ai-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: transparent;
  padding: 7px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  cursor: default;
}

.ai-suggestion:hover {
  background: var(--rni-green-soft);
}

.ai-suggestion i, .ai-suggestion svg {
  color: var(--rni-green);
  margin-top: 3px;
  font-size: 12px;
}

.ai-insight-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: none;
}

.ai-powered {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-powered i, .ai-powered svg {
  color: var(--rni-green);
}

.ai-confidence {
  font-size: 11px;
  font-weight: 600;
  color: var(--rni-green);
}

/* ═══ CLINICAL ROWS (Row + Chevron pattern) ═══ */
.checkin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.checkin-row:hover {
  opacity: 0.8;
}

.checkin-row.selected {
  background: none;
}

.checkin-row-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: none;
}

.checkin-row.selected .checkin-row-dot {
  box-shadow: 0 0 8px currentColor;
}

.checkin-row-icon {
  flex-shrink: 0;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s;
}

.checkin-row.selected .checkin-row-icon {
  /* color set per-item via JS */
}

.checkin-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.15s;
}

.checkin-row.selected .checkin-row-label {
  font-weight: 600;
  color: var(--text);
}

.checkin-row-chevron {
  display: none;
}

/* Trigger rows — no special override needed */
.checkin-row.trigger-row.selected {
  background: none;
}

.checkin-row.trigger-row.selected .checkin-row-chevron {
  color: var(--rni-yellow);
}

.checkin-row.trigger-none.selected {
  border-left-color: var(--rni-green);
}

.checkin-row.trigger-none.selected .checkin-row-chevron {
  color: var(--rni-green);
}

/* Fellowship modal rows — full-width list style */
.fellowship-option.checkin-row {
  display: flex;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.fellowship-option.checkin-row .checkin-row-chevron { display: flex; }
.fellowship-option.checkin-row .checkin-row-label { flex: 1; color: var(--text); font-size: 14px; }
.fellowship-option.checkin-row .checkin-row-icon { color: inherit; }
.fellowship-option.checkin-row:hover { background: var(--bg); }
.fellowship-option.checkin-row.selected { background: var(--rni-green-soft); border-color: var(--rni-green); }

/* MOOD CHECK-IN CARD */
.mood-checkin-card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

.mood-checkin-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.mood-checkin-title i, .mood-checkin-title svg {
  color: var(--rni-green);
  margin-right: 6px;
}

.mood-checkin-time {
  font-size: 11px;
  color: var(--text-muted);
}

.mood-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.mood-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.mood-btn:hover {
  border-color: var(--rni-green);
  background: var(--rni-green-soft);
}

.mood-btn.selected {
  border-color: var(--rni-green);
  background: var(--rni-green-soft);
}

.mood-emoji {
  font-size: 24px;
}

.mood-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.mood-triggers {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.trigger-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.trigger-chips {
  display: flex;
  flex-direction: column;
}

.trigger-chip {
  /* Legacy class — now uses .checkin-row pattern */
  display: none;
}

/* JOURNAL CARD */
.journal-card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 14px;
}

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

.journal-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-title i, .journal-title svg {
  color: var(--rni-blue);
  stroke: var(--rni-blue);
}

.journal-streak {
  font-size: 11px;
  color: var(--rni-yellow);
  font-weight: 600;
}

.journal-streak i, .journal-streak svg {
  margin-right: 4px;
}

.journal-input {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}

.journal-input:focus {
  outline: none;
  border-color: var(--rni-blue);
}

.journal-input::placeholder {
  color: var(--text-muted);
}

.journal-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.journal-privacy {
  font-size: 10px;
  color: var(--text-muted);
}

.journal-privacy i, .journal-privacy svg {
  margin-right: 4px;
}

.journal-save {
  padding: 7px 24px;
  background: none;
  color: var(--rni-blue);
  border: 1px solid var(--rni-blue);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.journal-save:hover {
  background: var(--rni-blue-soft);
}

.journal-save:disabled {
  border-color: var(--text-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ═══ PROGRESS PAGE — minimal additions (reuses Today vocabulary) ═══ */

.progress-journey {
  text-align: center;
  padding: 20px 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.progress-day-count {
  font-family: 'DM Serif Display', serif;
  font-size: 48px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
}
.progress-day-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 16px;
}
.progress-milestones {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.progress-milestone {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
}
.progress-milestone--done {
  background: var(--rni-green-soft);
  color: var(--rni-green-dark);
}
.progress-milestone--next {
  background: var(--rni-yellow-soft);
  color: var(--rni-yellow);
  border: 1px solid rgba(255,201,50,0.3);
}
.progress-milestone--future {
  background: var(--bg);
  color: var(--text-muted);
}
.progress-quote {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 14px;
}

/* Goal rows — extend checkin-row dot pattern */
.goal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  cursor: default;
}
.goal-row-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.goal-row-dot--done { background: var(--rni-green); box-shadow: 0 0 6px var(--rni-green); }
.goal-row-dot--progress { background: var(--border); }
.goal-row-label { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.goal-row-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
}

/* Week dots for streak */
.streak-week {
  display: flex;
  gap: 6px;
  align-items: center;
}
.streak-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.streak-dot--done { background: var(--rni-green); }
.streak-dot--missed { background: var(--border); }
.streak-dot--today { background: var(--rni-green); box-shadow: 0 0 6px var(--rni-green); }
.streak-dot--future { background: none; border: 1px dashed var(--border); }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
  z-index: 2000;
  box-shadow: 4px 6px 20px rgba(0, 0, 0, 0.25);
}

.toast.show {
  display: block;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: var(--rni-green);
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
/* ═══ TABLET (≤900px) — Single column, mobile bottom nav ═══ */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding-bottom: 72px;
  }
  .sidebar { display: none; }
  .main {
    height: auto;
    padding: 16px 16px 24px;
  }
  .hero {
    height: 180px;
    min-height: 180px;
    margin-bottom: 20px;
    border-radius: 16px;
  }
  .hero-greeting { font-size: 24px; }
  .hero-headline { font-size: 22px; }
  .hero-inner { padding: 16px; }
  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
  .metric { padding: 14px; border-radius: 10px; }
  .metric-val .num { font-size: 24px; }
  .actions { padding: 0; margin-bottom: 14px; }
  .actions-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mood-checkin-card { padding: 0; margin-bottom: 14px; }
  .footer-dark { padding: 16px; border-radius: 10px; }
  .footer-disclaimer { font-size: 13px; }
  .footer-legal-links { flex-wrap: wrap; justify-content: center; }

  /* Mobile bottom nav */
  .mobile-nav { display: flex; }
}

/* ═══ PHONE (≤600px) — Stacked metrics, tighter spacing ═══ */
@media (max-width: 600px) {
  .main { padding: 12px 12px 20px; }
  .hero {
    height: 160px;
    min-height: 160px;
    margin-bottom: 16px;
    border-radius: 14px;
  }
  .hero-greeting { font-size: 22px; }
  .hero-headline { font-size: 20px; }
  .hero-inner { padding: 14px; }
  .sync-pill { display: none; }
  .gauge { width: 100px; height: 62px; }
  .gauge svg { width: 100px; height: 62px; }
  .metrics {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .metric {
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 12px;
  }
  .metric-head { margin-bottom: 0; }
  .spark-container { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .actions { padding: 0; margin-bottom: 12px; }
  .actions-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .action-btn {
    padding: 14px 10px;
    min-height: 48px; /* touch target */
  }
  .mood-checkin-card { padding: 0; margin-bottom: 12px; }
  .mood-grid { gap: 8px; }
  .mood-btn {
    padding: 10px 8px;
    min-width: 48px;
    min-height: 48px; /* touch target */
  }
  .mood-btn .emoji { font-size: 24px; }
  .mood-btn .mood-label { font-size: 10px; }
  .trigger-chips { gap: 6px; }
  .checkin-row {
    padding: 7px 12px;
    min-height: 40px; /* touch target for chips */
  }
  .ai-insight-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .ai-insight-main { font-size: 13px; }
  .footer-dark { padding: 16px; margin-bottom: 16px; }
  .footer-disclaimer { font-size: 12px; }
  .footer-compliance { font-size: 11px; }
  .footer-legal-links { font-size: 11px; gap: 6px; }

  /* Progress page mobile */
  .streak-grid div { min-width: 0; }

  /* Insights grid stacks */
  .olivia-insights-grid { grid-template-columns: 1fr !important; }

  /* Device modal mobile */
  .modal { width: 95vw; max-height: 85vh; }
}

/* ═══ SMALL PHONE (≤400px) — Maximum compression ═══ */
@media (max-width: 400px) {
  .main { padding: 10px 10px 16px; }
  .hero { height: 140px; min-height: 140px; border-radius: 12px; }
  .hero-greeting { font-size: 20px; }
  .hero-headline { font-size: 18px; }
  .hero-inner { padding: 12px; }
  .hero-bottom { gap: 16px; }
  .gauge { width: 80px; height: 50px; }
  .gauge svg { width: 80px; height: 50px; }
  .metric { padding: 12px; }
  .metric-val .num { font-size: 22px; }
  .actions-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .action-btn { padding: 12px 8px; font-size: 11px; }
  .action-btn i, .action-btn svg { font-size: 18px; }
  .journal-card { padding: 0; }
}

/* ═══ MOBILE BOTTOM NAV ═══ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 900;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg.lucide {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.mobile-nav-item.active {
  color: var(--rni-green);
}

.mobile-nav-item:active {
  opacity: 0.7;
}

/* ═══ OLIVIA MOBILE DRAWER ═══ */
.olivia-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 910;
}
.olivia-drawer-overlay.open { display: block; }

.olivia-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 85vh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  z-index: 920;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
}
.olivia-drawer.open {
  transform: translateY(0);
}

/* ═══ PWA STANDALONE ADJUSTMENTS ═══ */
@media (display-mode: standalone) {
  .main { padding-top: env(safe-area-inset-top, 16px); }
  .mobile-nav { padding-bottom: env(safe-area-inset-bottom, 8px); height: auto; min-height: 64px; }
}

/* ═══ SAFE AREA (iPhone notch) ═══ */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .olivia-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
