/* ============================================
   Cykel — Design System v3
   Nostr meets warm femininity — privacy, weird, easy
   ============================================ */

:root {
  color-scheme: light;
  /* Core palette */
  --bg: #FAF6F1;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-elevated: rgba(255, 255, 255, 0.85);
  --surface-glass: rgba(255, 255, 255, 0.55);
  --text: #1A1714;
  --text-secondary: #6B6560;
  --text-tertiary: #756E66; /* darkened from #A39E98 for WCAG AA contrast */
  --border: rgba(237, 232, 226, 0.6);
  --border-subtle: rgba(242, 238, 234, 0.5);
  --border-glow: rgba(196, 101, 74, 0.2);

  /* Brand */
  --accent: #C4654A;
  --accent-hover: #B35840;
  --accent-bg: rgba(196, 101, 74, 0.08);
  --accent-bg-strong: rgba(196, 101, 74, 0.15);
  --accent-glow: rgba(196, 101, 74, 0.35);

  /* Semantic */
  --flow-spotting: #F0DDD7;
  --flow-spotting-text: #9B6B5A;
  --flow-light: #EACDC4;
  --flow-light-text: #8B5A4A;
  --flow-medium: #D4937E;
  --flow-medium-text: #FFFFFF;
  --flow-heavy: #C4654A;
  --flow-heavy-text: #FFFFFF;
  --symptom: #8BA889;
  --symptom-bg: rgba(139, 168, 137, 0.12);
  --symptom-bg-strong: rgba(139, 168, 137, 0.22);
  --predicted: rgba(196, 101, 74, 0.18);
  --fertile: #7B68C4;
  --fertile-bg: rgba(123, 104, 196, 0.12);
  --fertile-bg-strong: rgba(123, 104, 196, 0.22);
  --fertile-peak: rgba(123, 104, 196, 0.30);
  --fertile-glow: rgba(123, 104, 196, 0.4);
  --mood: #7B8EC4;
  --mood-bg: rgba(123, 142, 196, 0.15);
  --danger: #D44A4A;
  --danger-bg: rgba(212, 74, 74, 0.06);

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

  /* Radius */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 280ms;
  --duration-fast: 160ms;
  --duration-slow: 500ms;
}

/* ============================================
   Dark mode — token overrides only (warm dark, not pure black)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141110;
    --surface: rgba(38, 34, 31, 0.72);
    --surface-elevated: rgba(46, 41, 37, 0.88);
    --surface-glass: rgba(38, 34, 31, 0.55);
    --text: #F4EFEA;
    --text-secondary: #B7AFA6;
    --text-tertiary: #8B847B;
    --border: rgba(255, 255, 255, 0.10);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(196, 101, 74, 0.28);

    --accent-bg: rgba(196, 101, 74, 0.16);
    --accent-bg-strong: rgba(196, 101, 74, 0.26);

    --predicted: rgba(196, 101, 74, 0.32);
    --symptom-bg: rgba(139, 168, 137, 0.18);
    --symptom-bg-strong: rgba(139, 168, 137, 0.30);
    --fertile-bg: rgba(123, 104, 196, 0.20);
    --fertile-bg-strong: rgba(123, 104, 196, 0.32);
    --mood-bg: rgba(123, 142, 196, 0.22);
    --danger-bg: rgba(212, 74, 74, 0.14);
  }

  .alert-banner.alert-doctor { background: rgba(255, 196, 120, 0.12); }
}

/* ============================================
   Accessibility — respect reduced motion & show focus rings
   ============================================ */
@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;
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
.cal-day:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.4;
}

/* Ambient mesh gradient behind calendar */
.screen-inner::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -20%;
  width: 140%;
  height: 80%;
  background:
    radial-gradient(ellipse 50% 50% at 20% 50%, rgba(196, 101, 74, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 80% 30%, rgba(123, 104, 196, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(139, 168, 137, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: meshDrift 20s ease-in-out infinite alternate;
}

@keyframes meshDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(3%, 2%) rotate(1deg); }
}

#app {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea {
  font-family: inherit;
}

/* ============================================
   Screens & Transitions
   ============================================ */

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  animation: screenIn var(--duration) var(--ease) forwards;
}

.hidden {
  display: none !important;
}

.header-spacer {
  width: 48px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.do-shake {
  animation: shake 400ms ease;
}

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

.screen-inner {
  padding: var(--s-xl) var(--s-xl) var(--s-3xl);
  min-height: 100%;
}

.center-v {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--s-2xl);
}

/* ============================================
   Brand / Setup / Unlock
   ============================================ */

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-md);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent), #D4937E, #B07CC6);
  background-size: 200% 200%;
  margin-bottom: var(--s-sm);
  box-shadow: 0 8px 32px rgba(196, 101, 74, 0.3), 0 0 60px rgba(196, 101, 74, 0.15);
  animation: brandShift 6s ease-in-out infinite alternate;
}

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

.wordmark {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text);
  text-transform: lowercase;
}

.tagline {
  font-size: 14px;
  color: var(--text-tertiary);
  letter-spacing: 2px;
  font-weight: 400;
}

.form-block {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.input-wrap input {
  width: 100%;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: all var(--duration-fast) var(--ease);
}

.input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.input-wrap { position: relative; }

.input-reveal {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.input-reveal:active { color: var(--accent); }
.input-reveal[aria-pressed="true"] { color: var(--accent); }

.pass-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 4px 0;
}
.pass-strength-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.pass-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
  background: #C44A4A;
}
.pass-strength-fill[data-score="0"] { background: #C44A4A; }
.pass-strength-fill[data-score="1"] { background: #C44A4A; }
.pass-strength-fill[data-score="2"] { background: #C9942E; }
.pass-strength-fill[data-score="3"] { background: #4A9B6B; }
.pass-strength-fill[data-score="4"] { background: #2E8B57; }
.pass-strength-label {
  font-size: 12px;
  font-weight: 600;
  min-width: 64px;
  text-align: right;
  color: var(--text-tertiary);
}
.pass-strength-label[data-score="3"],
.pass-strength-label[data-score="4"] { color: #2E8B57; }

.setup-hint {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 4px 4px 0;
  line-height: 1.4;
}

.btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--duration-fast) var(--ease);
  margin-top: var(--s-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background var(--duration-fast);
}

.btn-primary.is-loading {
  color: transparent;
  pointer-events: none;
}
.btn-primary.is-loading::before {
  content: '';
  position: absolute;
  z-index: 1;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn-primary:hover::after {
  background: rgba(0,0,0,0.06);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.error-text {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  font-weight: 500;
}

.disclaimer {
  max-width: 280px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

/* ============================================
   Top Bar (Calendar)
   ============================================ */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--s-lg);
}

.top-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.top-btn:hover {
  background: var(--border-subtle);
}

.top-btn:active {
  transform: scale(0.9);
}

/* ============================================
   Month Navigation
   ============================================ */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--s-xl);
  position: relative;
  z-index: 1;
}

.month-label {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.month-label h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: capitalize;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.month-year {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav-arrow {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: var(--surface-glass);
}

.nav-arrow:hover {
  background: var(--surface-elevated);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.nav-arrow:active {
  transform: scale(0.85);
  transition: transform 80ms ease;
}

/* ============================================
   Calendar Grid
   ============================================ */

.cal-wrap {
  padding: 0 var(--s-xs);
  position: relative;
  z-index: 1;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  animation: calGridIn 400ms var(--ease) both;
}

@keyframes calGridIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: var(--s-sm) 0 var(--s-md);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.cal-day:active {
  transform: scale(0.85);
  transition: transform 80ms ease;
}

/* Today — glowing ring */
.cal-day.is-today {
  font-weight: 800;
  color: var(--accent);
  background: rgba(196, 101, 74, 0.06);
  box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent-glow);
  animation: todayPulse 3s ease-in-out infinite;
}

@keyframes todayPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent-glow); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 20px var(--accent-glow), 0 0 40px rgba(196, 101, 74, 0.1); }
}

.cal-day.is-today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--accent);
}

/* Empty / Other month */
.cal-day.is-empty {
  pointer-events: none;
}

/* Flow states — gradients + inner glow */
.cal-day.flow-spotting {
  background: linear-gradient(145deg, #F5E4DE, #EBCFC6);
  color: var(--flow-spotting-text);
  box-shadow: inset 0 1px 2px rgba(155, 107, 90, 0.1);
}

.cal-day.flow-light {
  background: linear-gradient(145deg, #F0D8CE, #E4C0B4);
  color: var(--flow-light-text);
  box-shadow: inset 0 1px 2px rgba(139, 90, 74, 0.12);
}

.cal-day.flow-medium {
  background: linear-gradient(145deg, #DA9F8C, #CE8770);
  color: var(--flow-medium-text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(212, 147, 126, 0.3);
}

.cal-day.flow-heavy {
  background: linear-gradient(145deg, #D0714E, #B85A3E);
  color: var(--flow-heavy-text);
  font-weight: 700;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(196, 101, 74, 0.35);
}

/* Symptoms indicator */
.cal-day.has-symptoms::before {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--symptom);
  box-shadow: 0 0 4px rgba(139, 168, 137, 0.4);
}

/* Predicted — dashed border + soft bg */
.cal-day.is-predicted {
  background: var(--predicted);
  border: 1.5px dashed rgba(196, 101, 74, 0.3);
}

.cal-day.is-predicted.flow-light,
.cal-day.is-predicted.flow-medium,
.cal-day.is-predicted.flow-heavy {
  border: none;
  /* Flow takes priority over prediction bg */
}

/* ============================================
   Prediction Card
   ============================================ */

.prediction-card {
  margin-top: var(--s-xl);
  padding: var(--s-lg) var(--s-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--s-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.pred-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.pred-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pred-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.pred-date {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   Cycle Summary (Legend)
   ============================================ */

.cycle-summary {
  display: flex;
  justify-content: center;
  gap: var(--s-lg);
  margin-top: var(--s-xl);
  padding-top: var(--s-lg);
}

.summary-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
}

.dot-flow { background: var(--accent); }
.dot-symptom { background: var(--symptom); }
.dot-predicted { background: var(--predicted); border: 1.5px solid var(--accent); box-sizing: border-box; }

/* ============================================
   Sheet Header (Day Log / Settings)
   ============================================ */

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--s-xl);
  gap: var(--s-md);
}

.back-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text);
  transition: all var(--duration-fast) var(--ease);
}

.back-btn:active {
  transform: scale(0.88);
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.save-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease);
}

.save-btn:active {
  transform: scale(0.94);
}

/* Clear Day Button */
.daylog-actions {
  display: flex;
  justify-content: flex-end;
  padding-bottom: var(--s-sm);
}

.clear-day-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-subtle);
  background: none;
  transition: all var(--duration-fast) var(--ease);
}

.clear-day-btn:active {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  transform: scale(0.95);
}

/* ============================================
   Cramp Pain Scale
   ============================================ */

.cramp-scale {
  width: 100%;
  padding: 12px 0 4px;
  animation: slideDown var(--duration-fast) var(--ease) both;
}

.cramp-scale.hidden {
  display: none;
}

.cramp-scale-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 8px;
}

.cramp-slider-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.cramp-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--symptom-bg-strong), var(--danger));
  outline: none;
}

.cramp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: white;
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.cramp-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

.cramp-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: white;
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
}

.cramp-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  text-align: center;
}

.cramp-scale-ends {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============================================
   Day Log Body
   ============================================ */

.daylog-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2xl);
}

.log-section {
  display: flex;
  flex-direction: column;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-md);
}

/* Flow selection */
.flow-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-sm);
}

.flow-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-sm);
  padding: var(--s-lg) var(--s-sm);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all var(--duration-fast) var(--ease);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.flow-opt:active {
  transform: scale(0.94);
}

.flow-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  border: 2px solid var(--border);
  transition: all var(--duration-fast) var(--ease);
}

.fc-spotting { border-color: var(--flow-spotting); background: var(--flow-spotting); }
.fc-light { border-color: var(--flow-light); background: var(--flow-light); }
.fc-medium { border-color: var(--flow-medium); background: var(--flow-medium); }
.fc-heavy { border-color: var(--flow-heavy); background: var(--flow-heavy); }

.flow-opt.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.flow-opt.active .flow-circle {
  box-shadow: 0 0 0 3px var(--accent-bg-strong);
}

.flow-opt.active span {
  color: var(--accent);
  font-weight: 700;
}

/* Symptom chips */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
}

.chip {
  padding: var(--s-sm) var(--s-lg);
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.chip:active {
  transform: scale(0.94);
}

.chip.active {
  border-color: var(--symptom);
  background: var(--symptom-bg-strong);
  color: #4A6B48;
  font-weight: 600;
}

/* Notes */
.notes-input {
  width: 100%;
  padding: var(--s-lg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color var(--duration-fast) var(--ease);
  line-height: 1.5;
}

.notes-input::placeholder {
  color: var(--text-tertiary);
}

.notes-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ============================================
   Settings
   ============================================ */

.settings-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2xl);
}

.settings-group {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-label {
  font-size: 16px;
  font-weight: 500;
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.stepper-btn:active {
  transform: scale(0.88);
  background: var(--border);
}

.stepper-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 50px;
  text-align: center;
}

/* Support / Lightning tip jar */
.support-group {
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.support-group::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(123, 104, 196, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.support-label {
  color: var(--fertile) !important;
}

.support-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--s-sm);
}

.lightning-address-row {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg);
  background: rgba(123, 104, 196, 0.06);
  border-radius: var(--r-md);
  border: 1px solid rgba(123, 104, 196, 0.12);
}

.lightning-icon {
  color: #F7931A;
  flex-shrink: 0;
  display: flex;
}

.lightning-addr {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: var(--s-sm);
  line-height: 1.4;
}

.btn-copied {
  color: var(--symptom) !important;
}

.danger-zone {
  background: var(--danger-bg);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--danger);
  margin-bottom: var(--s-xs);
}

.group-label-muted { color: var(--text-tertiary); }
.color-customizer-hint { margin-bottom: 12px; }
.report-bc-current { font-size: 14px; color: var(--text-secondary); }

.btn-destructive {
  width: 100%;
  padding: 14px;
  background: var(--danger);
  color: white;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease);
}

.btn-destructive:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.danger-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.app-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-xs);
  padding-top: var(--s-xl);
}

.footer-logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-tertiary);
}

.footer-version {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.footer-badge {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  margin-top: var(--s-xs);
}

/* ============================================
   Scrollbar
   ============================================ */

.screen::-webkit-scrollbar {
  width: 0;
}

/* ============================================
   Safe areas (mobile)
   ============================================ */

@supports (padding-top: env(safe-area-inset-top)) {
  .screen-inner {
    padding-top: calc(var(--s-xl) + env(safe-area-inset-top));
    padding-bottom: calc(var(--s-3xl) + env(safe-area-inset-bottom));
  }
}

/* ============================================
   Fertility Calendar States — Nostr purple glow
   ============================================ */

.cal-day.is-fertile {
  background: linear-gradient(145deg, rgba(123, 104, 196, 0.18), rgba(123, 104, 196, 0.28));
  color: var(--fertile);
  box-shadow: 0 0 8px rgba(123, 104, 196, 0.15);
}

.cal-day.is-peak {
  background: linear-gradient(145deg, rgba(123, 104, 196, 0.28), rgba(123, 104, 196, 0.38));
  color: #5B48A4;
  font-weight: 700;
  box-shadow: 0 0 12px var(--fertile-glow);
  animation: fertilePulse 4s ease-in-out infinite;
}

.cal-day.is-ovulation {
  background: linear-gradient(145deg, #8B78D0, #6A54B8);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 12px var(--fertile-glow), 0 0 24px rgba(123, 104, 196, 0.2);
  animation: fertilePulse 3s ease-in-out infinite;
}

@keyframes fertilePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(123, 104, 196, 0.2); }
  50% { box-shadow: 0 2px 16px rgba(123, 104, 196, 0.35), 0 0 30px rgba(123, 104, 196, 0.12); }
}

/* Flow overrides fertility */
.cal-day.flow-light.is-fertile,
.cal-day.flow-medium.is-fertile,
.cal-day.flow-heavy.is-fertile,
.cal-day.flow-light.is-peak,
.cal-day.flow-medium.is-peak,
.cal-day.flow-heavy.is-peak {
  animation: none;
  /* flow colors take priority */
}

/* ============================================
   Fertility Card
   ============================================ */

.fertility-card {
  margin-top: var(--s-md);
  padding: var(--s-lg) var(--s-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--s-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.fert-icon {
  background: var(--fertile-bg);
  color: var(--fertile);
}

/* ============================================
   Legend
   ============================================ */

.cycle-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-lg);
  margin-top: var(--s-xl);
  padding-top: var(--s-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
}

.dot-flow { background: var(--accent); }
.dot-spotting { background: var(--flow-spotting); border: 1.5px solid var(--flow-spotting-text); box-sizing: border-box; }
.dot-symptom { background: var(--symptom); }
.dot-predicted { background: var(--predicted); border: 1.5px solid var(--accent); box-sizing: border-box; }
.dot-fertile { background: var(--fertile); }

/* ============================================
   Panda Smart Chips
   ============================================ */

.panda-chips {
  display: flex;
  gap: var(--s-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: var(--s-lg) 0 var(--s-sm);
  margin: 0 calc(-1 * var(--s-xl));
  padding-left: var(--s-xl);
  padding-right: var(--s-xl);
}

.panda-chips::-webkit-scrollbar {
  display: none;
}

.panda-chips.hidden {
  display: none;
}

.panda-smart-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease);
  animation: chipFade var(--duration) var(--ease) both;
}

.panda-smart-chip:nth-child(1) { animation-delay: 0ms; }
.panda-smart-chip:nth-child(2) { animation-delay: 50ms; }
.panda-smart-chip:nth-child(3) { animation-delay: 100ms; }
.panda-smart-chip:nth-child(4) { animation-delay: 150ms; }
.panda-smart-chip:nth-child(5) { animation-delay: 200ms; }
.panda-smart-chip:nth-child(6) { animation-delay: 250ms; }
.panda-smart-chip:nth-child(7) { animation-delay: 300ms; }
.panda-smart-chip:nth-child(8) { animation-delay: 350ms; }

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

.panda-smart-chip:active {
  transform: scale(0.94);
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   Alert Banner
   ============================================ */

.alert-banner {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg);
  background: var(--accent-bg);
  border-radius: var(--r-md);
  margin-bottom: var(--s-lg);
  animation: screenIn var(--duration) var(--ease);
}

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.alert-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.alert-dismiss {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.alert-dismiss:active {
  background: var(--accent-bg-strong);
}

.alert-banner.alert-fertile {
  background: var(--fertile-bg);
}

.alert-banner.alert-fertile .alert-icon {
  background: var(--fertile);
}

/* ============================================
   Reminder Prompt
   ============================================ */

.reminder-prompt {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  margin-bottom: var(--s-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  animation: screenIn var(--duration) var(--ease);
}

.reminder-inner {
  display: flex;
  gap: var(--s-lg);
  align-items: flex-start;
}

.reminder-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.reminder-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.reminder-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.reminder-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--s-md);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--s-2xl) var(--s-xl);
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s-sm);
}

.empty-sub {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ============================================
   Stats Screen
   ============================================ */

.stats-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-xl);
}

.stats-empty {
  text-align: center;
  padding: var(--s-3xl) var(--s-xl);
  color: var(--text-tertiary);
  font-size: 15px;
}

#stats-content {
  display: flex;
  flex-direction: column;
  gap: var(--s-xl);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-md);
}

.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-xs);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-detail {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-lg) var(--s-xl);
}

.detail-row + .detail-row {
  border-top: 1px solid var(--border-subtle);
}

.detail-label {
  font-size: 15px;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   Toggle Switch
   ============================================ */

.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}

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

.toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: var(--r-full);
  transition: all var(--duration) var(--ease);
}

.toggle-track::before {
  content: '';
  position: absolute;
  height: 26px;
  width: 26px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: var(--r-full);
  transition: all var(--duration) var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-track {
  background: var(--fertile);
}

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

/* ============================================
   Settings extras
   ============================================ */

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

.setting-desc {
  font-size: 13px;
  color: var(--text-tertiary);
}

.settings-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--s-lg) 0;
}

.action-btn {
  padding: 8px 18px;
  background: var(--border-subtle);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.action-btn:active {
  transform: scale(0.94);
  background: var(--border);
}

/* ============================================
   Top bar layout
   ============================================ */

.top-bar-right {
  display: flex;
  gap: var(--s-xs);
}

/* ============================================
   Install Prompt
   ============================================ */

.install-pitch {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
}

.pitch-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s-lg);
}

.pitch-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.pitch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px;
}

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

.pitch-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.install-steps {
  width: 100%;
  max-width: 320px;
}

.install-how {
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--s-lg);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  flex: 1;
}

.step-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.4;
}

.step-text strong {
  font-weight: 700;
  color: var(--text);
}

.step-icon-share {
  color: var(--accent);
  flex-shrink: 0;
}

.btn-text {
  padding: var(--s-md) var(--s-xl);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color var(--duration-fast) var(--ease);
}

.btn-text:active {
  color: var(--text-secondary);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--s-xl);
  transition: background var(--duration) var(--ease);
}

.modal-overlay.modal-visible {
  background: rgba(0, 0, 0, 0.4);
}

.modal-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--s-2xl);
  max-width: 320px;
  width: 100%;
  transform: scale(0.9);
  opacity: 0;
  transition: all var(--duration) var(--ease);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.modal-visible .modal-card {
  transform: scale(1);
  opacity: 1;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--s-sm);
}

.modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--s-xl);
}

.modal-input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: var(--s-sm);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.modal-input-error {
  font-size: 13px;
  color: #C44A4A;
  min-height: 18px;
  margin-bottom: var(--s-sm);
}
.modal-secondary {
  display: block;
  width: 100%;
  margin-top: var(--s-md);
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: var(--s-sm);
}

.modal-btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease);
}

.modal-btn:active {
  transform: scale(0.96);
}

.modal-cancel {
  background: var(--border-subtle);
  color: var(--text-secondary);
}

.modal-confirm {
  background: var(--accent);
  color: white;
}

.modal-destructive {
  background: var(--danger);
  color: white;
}

/* ============================================
   Biometric Button
   ============================================ */

.bio-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: all var(--duration-fast) var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.bio-btn:active {
  transform: scale(0.92);
  background: var(--accent-bg);
  border-color: var(--accent);
}

.install-desktop-msg {
  text-align: center;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: var(--s-xl);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ============================================
   Mood Chips
   ============================================ */

#mood-chips .chip.active {
  border-color: var(--mood);
  background: var(--mood-bg);
  color: #4A5A8B;
  font-weight: 600;
}

/* ============================================
   Mood Grid — emoji-first, 4-col on mobile
   ============================================ */

.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-sm);
}

.mood-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all var(--duration-fast) var(--ease);
  cursor: pointer;
}

.mood-pill:active {
  transform: scale(0.92);
}

.mood-emoji {
  font-size: 24px;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.mood-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.mood-pill.active {
  border-color: var(--mood);
  background: var(--mood-bg);
}

.mood-pill.active .mood-emoji {
  transform: scale(1.15);
}

.mood-pill.active .mood-label {
  color: #4A5A8B;
  font-weight: 600;
}

/* ============================================
   Select Row (discharge, sex)
   ============================================ */

.select-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-sm);
}

.select-row.cols-6 {
  grid-template-columns: repeat(3, 1fr);
}

.select-opt {
  padding: var(--s-sm) var(--s-xs);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  transition: all var(--duration-fast) var(--ease);
}

.select-opt:active { transform: scale(0.94); }

.select-opt.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   Sub-row (sex drive)
   ============================================ */

.sub-row {
  margin-top: var(--s-md);
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.sub-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  min-width: 40px;
}

/* ============================================
   Pill Buttons (drive, lifestyle)
   ============================================ */

.pill-row {
  display: flex;
  gap: var(--s-sm);
  flex: 1;
}

.pill-btn {
  flex: 1;
  padding: var(--s-sm) var(--s-xs);
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  transition: all var(--duration-fast) var(--ease);
}

.pill-btn:active { transform: scale(0.94); }

.pill-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   Lifestyle Grid
   ============================================ */

.lifestyle-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.lifestyle-row {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.lifestyle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
}

/* ============================================
   Cycle Length Bar Chart
   ============================================ */

.cycle-chart {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--s-sm);
  height: 120px;
  padding-top: var(--s-lg);
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-xs);
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 40px;
  background: var(--accent-bg-strong);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  min-height: 4px;
  transition: height var(--duration) var(--ease);
}

.chart-bar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.chart-bar-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============================================
   Pattern Summary (Symptoms, Moods)
   ============================================ */

.pattern-summary {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pattern-bars {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  padding-top: var(--s-md);
}

.pattern-row {
  display: flex;
  align-items: center;
  gap: var(--s-md);
}

.pattern-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 90px;
}

.pattern-track {
  flex: 1;
  height: 8px;
  background: var(--border-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
}

.pattern-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--symptom);
  transition: width var(--duration) var(--ease);
}

.pattern-fill.mood-fill {
  background: var(--mood);
}

.pattern-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 24px;
  text-align: right;
}

/* ============================================
   Report Section
   ============================================ */

.report-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
  align-items: center;
}

.report-hint {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ============================================
   Doctor Report Overlay
   ============================================ */

.report-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  animation: reportSlideUp var(--duration) var(--ease) both;
}

.report-overlay.hidden {
  display: none;
}

@keyframes reportSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.report-overlay-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--s-xl) var(--s-xl) 0;
  padding-top: calc(var(--s-xl) + env(safe-area-inset-top, 0px));
}

.report-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--s-lg);
  gap: var(--s-md);
  flex-shrink: 0;
}

.report-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--s-xl);
  overscroll-behavior: contain;
}

.report-body .report-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  margin-bottom: var(--s-md);
}

.report-body .report-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-md);
}

.report-body .report-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-md);
}

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

.report-body .report-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.report-body .report-stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.report-body .report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-body .report-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: var(--s-sm) 0;
  border-bottom: 1px solid var(--border);
}

.report-body .report-table td {
  padding: var(--s-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

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

.report-body .report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
}

.report-body .report-tag {
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-bg);
  color: var(--accent);
}

.report-body .report-tag-mood {
  background: var(--mood-bg);
  color: var(--mood);
}

.report-body .report-tag-symptom {
  background: var(--symptom-bg);
  color: var(--symptom);
}

.report-body .report-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  font-style: italic;
}

.report-body .report-date-range {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--s-xl);
}

.report-body .report-footer {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--s-xl) 0;
}

.report-actions {
  display: flex;
  gap: var(--s-md);
  padding: var(--s-lg) 0;
  padding-bottom: calc(var(--s-lg) + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
}

.report-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-sm);
  padding: 14px var(--s-lg);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}

.report-action-btn:active {
  transform: scale(0.96);
}

.report-action-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ============================================
   Mode Selector
   ============================================ */

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-sm);
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px var(--s-sm);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease);
  cursor: pointer;
}

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

.mode-icon {
  font-size: 24px;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.mode-label {
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.mode-btn.active .mode-icon {
  transform: scale(1.12);
}

/* ============================================
   Color Customizer
   ============================================ */

.color-customizer {
  display: flex;
  flex-direction: column;
}

.color-item {
  border-bottom: 1px solid var(--border-subtle);
}

.color-item:last-child {
  border-bottom: none;
}

.color-row {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: 14px 0;
  cursor: pointer;
}

.color-swatch {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: transform var(--duration-fast) var(--ease-bounce);
  background: var(--accent); /* fallback if JS hasn't set inline yet */
}

.color-row:active .color-swatch {
  transform: scale(0.92);
}

.color-row-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.color-chevron {
  color: var(--text-tertiary);
  transition: transform var(--duration-fast) var(--ease);
  flex-shrink: 0;
}

.color-item.open .color-chevron {
  transform: rotate(180deg);
}

.color-palette {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0 16px;
  animation: slideDown var(--duration-fast) var(--ease) both;
}

.color-palette.hidden {
  display: none;
}

.color-pick {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  border: none;
  background-color: #ccc; /* fallback only — JS always sets an inline color */
  background-clip: padding-box;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-bounce), box-shadow var(--duration-fast) var(--ease);
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-pick:active {
  transform: scale(0.88);
}

.color-pick.active {
  transform: scale(1.1);
  box-shadow:
    0 0 0 3px var(--bg),
    0 0 0 5px var(--accent),
    0 4px 12px rgba(0, 0, 0, 0.18);
}

/* Default: white checkmark (for dark/saturated colors) */
.color-pick::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  opacity: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/18px no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  transition: opacity var(--duration-fast);
}

/* Dark checkmark for light/pastel colors */
.color-pick.color-pick-dark-check::after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%231A1714' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/18px no-repeat;
  filter: none;
}

.color-pick.active::after {
  opacity: 1;
}

/* ============================================
   Pregnancy Card
   ============================================ */

.pregnancy-card {
  margin-top: var(--s-xl);
  padding: 28px var(--s-xl) var(--s-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.preg-fruit-wrap {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  border-radius: var(--r-full);
  margin-bottom: 16px;
}

.preg-fruit {
  font-size: 48px;
  line-height: 1;
  animation: fruitBob 3s ease-in-out infinite;
}

@keyframes fruitBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(2deg); }
  75% { transform: translateY(2px) rotate(-1deg); }
}

.preg-week-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 4px 14px;
  border-radius: var(--r-full);
  margin-bottom: 10px;
}

.preg-week-num {
  font-weight: 800;
}

.preg-status {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.preg-size-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.preg-fact {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 320px;
  margin-bottom: 20px;
}

.preg-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.preg-progress-track {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
}

.preg-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-bg-strong), var(--accent));
  border-radius: var(--r-full);
  transition: width var(--duration-slow) var(--ease);
}

.preg-due {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-align: center;
}

/* ============================================
   TTC Card (reuses pred-body styles)
   ============================================ */

.ttc-card {
  margin-top: var(--s-md);
  padding: var(--s-lg) var(--s-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--s-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

/* ============================================
   Discharge Color Dots
   ============================================ */

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.color-clear { background: transparent; border: 1.5px solid var(--border); }
.color-white { background: #F5F5F0; border: 1.5px solid var(--border); }
.color-yellow { background: #F0E060; }
.color-brown { background: #8B6F47; }
.color-green { background: #6B9B5A; }
.color-pink { background: #E8A0B0; }

.color-opt.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.section-label-sub {
  margin-top: var(--s-md);
}

/* ============================================
   Symptom Categories
   ============================================ */

.chip-category {
  margin-bottom: 12px;
}

.chip-cat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  display: block;
}

.chip-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   Doctor Alert Banner
   ============================================ */

.alert-banner.alert-doctor {
  background: #FFF3E0;
}

.alert-banner.alert-doctor .alert-icon {
  background: #E6890C;
}

/* ============================================
   Polish — Micro-interactions
   ============================================ */

/* Alert dismiss animation */
.alert-dismiss-anim {
  animation: slideOutRight 250ms var(--ease) forwards;
}

@keyframes slideOutRight {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Card entrance (prediction, fertility, pregnancy, ttc) */
.prediction-card,
.fertility-card,
.pregnancy-card,
.ttc-card {
  animation: cardIn 450ms var(--ease-bounce) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Stagger card entrances */
.fertility-card { animation-delay: 80ms; }
.pregnancy-card { animation-delay: 120ms; }
.ttc-card { animation-delay: 160ms; }

/* Chip tap pop */
.chip:active {
  transform: scale(0.92);
}

.chip.active {
  transition: all var(--duration-fast) var(--ease);
}

/* Flow button pop */
.flow-opt:active .flow-circle {
  transform: scale(0.85);
  transition: transform 100ms ease;
}

/* Calendar day press */
.cal-day:not(.is-empty):active {
  transform: scale(0.85);
  transition: transform 80ms ease;
  filter: brightness(0.95);
}

/* Save button success flash */
.save-btn:active {
  transform: scale(0.95);
  background: var(--symptom);
  transition: all 100ms ease;
}

/* Smooth alert banner transitions for swipe */
.alert-banner {
  transition: transform 60ms linear, opacity 60ms linear;
  will-change: transform, opacity;
}

/* BC option tap */
.bc-opt:active {
  transform: scale(0.93);
  transition: transform 80ms ease;
}

/* Select option tap */
.select-opt:active {
  transform: scale(0.93);
  transition: transform 80ms ease;
}

/* Pill button tap */
.pill-btn:active {
  transform: scale(0.9);
  transition: transform 80ms ease;
}

/* ============================================
   Birth Control Selector
   ============================================ */

.bc-selector {
  padding: var(--s-md) 0;
}

.bc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-sm);
  margin-bottom: var(--s-md);
}

.bc-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px var(--s-sm);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: center;
}

.bc-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.bc-name {
  font-size: 12px;
  font-weight: 500;
}

.bc-opt.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.bc-opt.active .bc-icon {
  transform: scale(1.12);
}

/* BC sub-selector (pill type, IUD type, etc.) */
.bc-sub {
  margin-bottom: var(--s-md);
  animation: slideDown var(--duration-fast) var(--ease) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bc-sub-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-sm);
}

.bc-sub-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
}

.bc-sub-opt {
  padding: 8px 16px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.bc-sub-opt:active {
  transform: scale(0.94);
}

.bc-sub-opt.active {
  border-color: var(--accent);
  background: var(--accent-bg-strong);
  color: var(--accent);
  font-weight: 600;
}

.bc-date-row {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  margin-bottom: var(--s-md);
}

.bc-date-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.bc-date-input {
  flex: 1;
  padding: var(--s-sm) var(--s-md);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.btn-sm {
  padding: var(--s-sm) var(--s-xl);
  font-size: 14px;
  min-height: 40px;
}

.bc-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
  margin-top: var(--s-sm);
}

.bc-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-sm) var(--s-md);
  background: var(--surface-elevated);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.bc-history-method {
  font-weight: 600;
  color: var(--text);
}

.bc-history-dates {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ============================================
   Import Preview Modal
   ============================================ */

.import-preview {
  padding: var(--s-lg);
}

.import-stat-row {
  display: flex;
  justify-content: space-between;
  padding: var(--s-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
}

.import-stat-label {
  color: var(--text-secondary);
}

.import-stat-value {
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   Cycle Phase Card
   ============================================ */

.phase-card {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg);
  margin: 0 0 var(--s-md);
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  animation: cardIn 450ms var(--ease-bounce) both;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* Phase card colored accent line */
.phase-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}

.phase-day-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: all var(--duration) var(--ease);
}

.phase-day-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.phase-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.phase-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.phase-tip {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

/* Phase ring color variants + accent line */
.phase-card.phase-period .phase-day-ring { border-color: var(--flow-medium); box-shadow: 0 0 10px rgba(212, 147, 126, 0.3); }
.phase-card.phase-period .phase-day-num { color: var(--flow-medium); }
.phase-card.phase-period::before { background: var(--flow-medium); }

.phase-card.phase-follicular .phase-day-ring { border-color: #5B9BD5; box-shadow: 0 0 10px rgba(91, 155, 213, 0.3); }
.phase-card.phase-follicular .phase-day-num { color: #5B9BD5; }
.phase-card.phase-follicular::before { background: #5B9BD5; }

.phase-card.phase-ovulation .phase-day-ring { border-color: var(--fertile); box-shadow: 0 0 12px var(--fertile-glow); }
.phase-card.phase-ovulation .phase-day-num { color: var(--fertile); }
.phase-card.phase-ovulation::before { background: var(--fertile); }

.phase-card.phase-luteal .phase-day-ring { border-color: #B07CC6; box-shadow: 0 0 10px rgba(176, 124, 198, 0.3); }
.phase-card.phase-luteal .phase-day-num { color: #B07CC6; }
.phase-card.phase-luteal::before { background: #B07CC6; }

/* ============================================
   Calendar Day Indicator Dots
   ============================================ */

.cal-day {
  position: relative;
}

.day-dots {
  display: flex;
  justify-content: center;
  gap: 2.5px;
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
}

.day-dot {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
}

.day-dot-flow { background: var(--flow-medium); box-shadow: 0 0 3px rgba(212, 147, 126, 0.5); }
.day-dot-symptom { background: var(--symptom); box-shadow: 0 0 3px rgba(139, 168, 137, 0.5); }
.day-dot-mood { background: #B07CC6; box-shadow: 0 0 3px rgba(176, 124, 198, 0.5); }
.day-dot-sex { background: #E8A0B0; box-shadow: 0 0 3px rgba(232, 160, 176, 0.5); }

/* ============================================
   Panda Hint Bubble
   ============================================ */

.panda-hint {
  position: fixed;
  bottom: 92px;
  right: 20px;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--surface-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.02);
  z-index: 99;
  cursor: pointer;
  animation: hintPop var(--duration) var(--ease-bounce) both;
  animation-delay: 1.5s;
  transition: opacity var(--duration-fast), transform var(--duration-fast) var(--ease);
}

.panda-hint.hidden {
  display: none;
}

.panda-hint:active {
  transform: scale(0.96);
}

@keyframes hintPop {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panda-hint-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
}

.panda-hint-tail {
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: var(--surface-elevated);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

/* ============================================
   Period Panda — FAB
   ============================================ */

.panda-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: var(--r-full);
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 16px rgba(123, 104, 196, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: box-shadow var(--duration) var(--ease);
  animation: pandaBob 3s ease-in-out infinite;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  padding: 8px;
}

.panda-fab-svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.panda-fab:active {
  transform: scale(0.85);
  animation: none;
}

/* Freeze animation + transitions during drag so the finger tracks 1:1 */
.panda-fab.panda-dragging {
  animation: none !important;
  transition: none !important;
  cursor: grabbing;
}

/* Spring snap when released */
.panda-fab.panda-snapping {
  transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              right 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes pandaBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ============================================
   Period Panda — SVG Animations
   ============================================ */

/* Blink animation on eyes */
.panda-eyes {
  animation: pandaBlink 4s ease-in-out infinite;
}

@keyframes pandaBlink {
  0%, 92%, 100% { transform: scaleY(1); transform-origin: center 48px; }
  95% { transform: scaleY(0.05); transform-origin: center 48px; }
}

/* Idle state — gentle breathing on body */
.panda-anim-idle .panda-body {
  animation: pandaBreath 3.5s ease-in-out infinite;
}

@keyframes pandaBreath {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

/* Thinking state — pupils look up, body wiggles */
.panda-anim-thinking .panda-pupil-l,
.panda-anim-thinking .panda-pupil-r {
  animation: pandaLookUp 1.5s ease-in-out infinite;
}

@keyframes pandaLookUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

.panda-anim-thinking .panda-body {
  animation: pandaWiggle 0.8s ease-in-out infinite;
}

@keyframes pandaWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

/* Happy state — eyes widen, sparkle, bounce */
.panda-anim-happy .panda-eyes {
  animation: pandaHappyEyes 0.6s var(--ease-bounce) both;
}

@keyframes pandaHappyEyes {
  0% { transform: scaleY(1) scaleX(1); transform-origin: center 48px; }
  50% { transform: scaleY(1.15) scaleX(1.1); transform-origin: center 48px; }
  100% { transform: scaleY(1.05) scaleX(1.05); transform-origin: center 48px; }
}

.panda-anim-happy .panda-sparkle {
  animation: pandaSparkle 1.2s ease-in-out infinite;
}

@keyframes pandaSparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  30%, 70% { opacity: 1; transform: scale(1.2); }
}

.panda-anim-happy .panda-body {
  animation: pandaHappyBounce 0.5s var(--ease-bounce) both;
}

@keyframes pandaHappyBounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

/* Wave state (welcome) — tilt side to side */
.panda-anim-wave .panda-body {
  animation: pandaWave 1.5s var(--ease) both;
}

@keyframes pandaWave {
  0% { transform: rotate(0deg) scale(0.8); opacity: 0; }
  30% { transform: rotate(-5deg) scale(1.02); opacity: 1; }
  50% { transform: rotate(5deg) scale(1); }
  70% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}

/* Panda avatar sizes */
.panda-header-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-right: var(--s-sm);
}

.panda-header-avatar svg {
  width: 100%;
  height: 100%;
}

.panda-welcome-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--s-md);
}

.panda-welcome-avatar svg {
  width: 100%;
  height: 100%;
}

.panda-msg-avatar {
  font-size: 14px;
  margin-right: 4px;
}

/* ============================================
   Period Panda — Chat Sheet
   ============================================ */

.panda-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0);
  transition: background var(--duration) var(--ease-smooth);
}

.panda-overlay.panda-visible {
  background: rgba(0, 0, 0, 0.4);
}

.panda-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  height: 75vh;
  max-height: 75vh;
  background: var(--surface-elevated);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease);
  z-index: 1001;
}

.panda-overlay.panda-visible .panda-sheet {
  transform: translateY(0);
}

.panda-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--border);
  margin: var(--s-sm) auto 0;
  flex-shrink: 0;
}

.panda-header {
  display: flex;
  align-items: center;
  padding: var(--s-md) var(--s-lg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panda-avatar {
  font-size: 24px;
  line-height: 1;
  margin-right: var(--s-sm);
}

.panda-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.panda-close {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease);
}

.panda-close:active {
  transform: scale(0.85);
  background: var(--border-subtle);
}

.panda-disclaimer {
  padding: var(--s-sm) var(--s-lg);
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ============================================
   Period Panda — Messages
   ============================================ */

.panda-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.panda-msg {
  max-width: 85%;
  padding: var(--s-md) var(--s-lg);
  font-size: 14px;
  line-height: 1.55;
  animation: msgIn 300ms var(--ease-bounce) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panda-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-radius: var(--r-lg) var(--r-lg) var(--s-xs) var(--r-lg);
}

.panda-msg-panda {
  align-self: flex-start;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--s-xs);
  color: var(--text);
}

.panda-msg-panda .panda-msg-avatar {
  font-size: 16px;
  margin-bottom: var(--s-xs);
  display: block;
}

/* Typing indicator */
.panda-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: var(--s-md) var(--s-lg);
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--s-xs);
  animation: msgIn 200ms var(--ease) both;
}

.panda-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.panda-typing-dot:nth-child(2) { animation-delay: 150ms; }
.panda-typing-dot:nth-child(3) { animation-delay: 300ms; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ============================================
   Period Panda — Suggestions
   ============================================ */

.panda-suggestions {
  padding: var(--s-sm) var(--s-lg) var(--s-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
  flex-shrink: 0;
  max-height: 140px;
  overflow-y: auto;
}

.panda-chip {
  padding: var(--s-sm) var(--s-md);
  border-radius: var(--r-full);
  background: rgba(123, 104, 196, 0.08);
  color: var(--fertile);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(123, 104, 196, 0.15);
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
}

.panda-chip:active {
  transform: scale(0.92);
  background: rgba(123, 104, 196, 0.18);
}

/* ============================================
   Period Panda — Input
   ============================================ */

.panda-input-row {
  display: flex;
  gap: var(--s-sm);
  padding: var(--s-md) var(--s-lg);
  padding-bottom: max(var(--s-md), env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.panda-input {
  flex: 1;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  padding: var(--s-sm) var(--s-lg);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease);
}

.panda-input::placeholder {
  color: var(--text-tertiary);
}

.panda-input:focus {
  border-color: var(--fertile);
  box-shadow: 0 0 0 3px rgba(123, 104, 196, 0.1);
}

.panda-send {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: var(--fertile);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease);
}

.panda-send:active {
  transform: scale(0.85);
}

.panda-send:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Welcome message */
.panda-welcome {
  text-align: center;
  padding: var(--s-xl) var(--s-lg);
}

.panda-welcome-emoji {
  font-size: 48px;
  margin-bottom: var(--s-md);
  display: block;
}

.panda-welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--s-xs);
}

.panda-welcome-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
}
