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

:root {
  --rose: #F4C0D1;
  --rose-mid: #D4537E;
  --rose-dark: #993556;
  --rose-deep: #72243E;
  --rose-light: #FBEAF0;
  --teal: #5DCAA5;
  --teal-light: #E1F5EE;
  --teal-mid: #9FE1CB;
  --teal-dark: #0F6E56;
  --amber: #EF9F27;
  --amber-light: #FAEEDA;
  --amber-mid: #FAC775;
  --amber-dark: #854F0B;
  --purple: #7F77DD;
  --purple-light: #EEEDFE;
  --purple-mid: #AFA9EC;
  --purple-dark: #3C3489;
  --bg: #f5f2f4;
  --surface: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #aaa;
  --border: rgba(0,0,0,0.1);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* Header */
.header {
  background: var(--rose-dark);
  padding: 48px 20px 20px;
  flex-shrink: 0;
}

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

.app-title {
  font-family: 'DM Serif Display', serif;
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

.app-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 300;
  margin-top: 4px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.cycle-status-card {
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.phase-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.phase-label {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.phase-name {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  margin-top: 2px;
}

.day-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 8px 16px;
  text-align: center;
  flex-shrink: 0;
}

.day-badge .num {
  color: #fff;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

.day-badge .lbl {
  color: rgba(255,255,255,0.65);
  font-size: 10px;
}

/* Content scroll area */
.content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px;
  -webkit-overflow-scrolling: touch;
}

.section {
  padding: 16px 16px 0;
}

.section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

/* Calendar */
.calendar-card {
  background: var(--surface);
  border-radius: 16px;
  border: 0.5px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}

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

.cal-month {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--text-primary);
}

.cal-nav {
  display: flex;
  gap: 4px;
}

.cal-nav button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cal-nav button:active {
  background: var(--bg);
}

.cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-day-label {
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  color: var(--text-primary);
  transition: background 0.15s;
}

.cal-day:active { opacity: 0.7; }
.cal-day.other-month { color: var(--text-tertiary); }
.cal-day.period { background: var(--rose-mid); color: #fff; }
.cal-day.fertile { background: var(--teal-light); color: var(--teal-dark); }
.cal-day.ovulation { background: var(--teal); color: #fff; }
.cal-day.today { font-weight: 600; }
.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose-mid);
}
.cal-day.today.period::after { background: #fff; }
.cal-day.today.ovulation::after { background: #fff; }
.cal-day.predicted-start {
  border: 2px dashed var(--rose-mid);
  color: var(--rose-dark);
  font-weight: 500;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.period-dot { background: var(--rose-mid); }
.fertile-dot { background: var(--teal-light); border: 1px solid var(--teal); }
.ovulation-dot { background: var(--teal); }
.predicted-dot { border: 2px dashed var(--rose-mid); }

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.info-card {
  background: var(--surface);
  border-radius: 14px;
  border: 0.5px solid var(--border);
  padding: 14px;
}

.ic-icon { font-size: 18px; margin-bottom: 8px; }
.ic-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.ic-value { font-family: 'DM Serif Display', serif; font-size: 18px; color: var(--text-primary); line-height: 1.2; }
.ic-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }

.info-card.rose { background: var(--rose-light); border-color: var(--rose); }
.info-card.rose .ic-value { color: var(--rose-dark); }
.info-card.teal { background: var(--teal-light); border-color: var(--teal-mid); }
.info-card.teal .ic-value { color: var(--teal-dark); }
.info-card.amber { background: var(--amber-light); border-color: var(--amber-mid); }
.info-card.amber .ic-value { color: var(--amber-dark); }
.info-card.purple { background: var(--purple-light); border-color: var(--purple-mid); }
.info-card.purple .ic-value { color: var(--purple-dark); }

/* Log form */
.log-form {
  background: var(--surface);
  border-radius: 16px;
  border: 0.5px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.date-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}

.date-input:focus { border-color: var(--rose-mid); }

.log-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--rose-dark);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.log-btn:active { background: var(--rose-deep); }
.log-btn.secondary {
  background: var(--rose-light);
  color: var(--rose-dark);
  border: 0.5px solid var(--rose-mid);
}
.log-btn.secondary:active { background: var(--rose); }

/* Symptoms */
.symptoms-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.symptom-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.symptom-chip.active {
  background: var(--rose-light);
  border-color: var(--rose-mid);
  color: var(--rose-dark);
  font-weight: 500;
}

/* Insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.insight-item {
  background: var(--surface);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.insight-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.insight-text { font-size: 13px; color: var(--text-primary); line-height: 1.6; }
.insight-text strong { color: var(--rose-dark); font-weight: 500; }
.insight-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 64px;
  background: var(--surface);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}

.nav-item:active { background: var(--bg); }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-label { font-size: 10px; color: var(--text-tertiary); }
.nav-item.active .nav-label { color: var(--rose-dark); font-weight: 500; }

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

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

/* Install banner */
.install-banner {
  background: var(--rose-light);
  border-top: 0.5px solid var(--rose);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: 99;
  animation: slideUp 0.3s ease;
}

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

.install-banner p { font-size: 13px; color: var(--rose-dark); flex: 1; }
.install-banner button {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.install-btn { background: var(--rose-dark); color: #fff; }
.dismiss-btn { background: transparent; color: var(--text-secondary); }
