:root{
  --bg:#fff8fb;
  --surface:#ffffff;
  --surface-2:#fff0f5;
  --text:#261d23;
  --muted:#82737b;
  --line:#f1e2e8;
  --accent:#e9608f;
  --accent-deep:#ca4675;
  --accent-soft:#ffdce8;
  --violet:#a987c9;
  --fertile:#eee4f7;
  --shadow:0 18px 50px rgba(105,70,86,.11);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}
body{min-height:100dvh}
button,input,textarea{font:inherit}
button{cursor:pointer}

.hidden{display:none!important}

.loader-screen,.state-screen{
  min-height:100dvh;display:grid;place-items:center;padding:24px
}
.spinner{
  width:38px;height:38px;border:4px solid #f5dbe5;border-top-color:var(--accent);
  border-radius:50%;animation:spin .8s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}

.state-card{
  max-width:360px;width:100%;background:#fff;border:1px solid var(--line);border-radius:28px;
  padding:32px;text-align:center;box-shadow:var(--shadow)
}
.state-mark{
  width:54px;height:54px;border-radius:50%;background:var(--surface-2);display:grid;place-items:center;
  margin:0 auto 14px;font-size:30px;color:var(--accent-deep)
}
.state-card h1{margin:0 0 8px;font-size:24px}
.state-card p{margin:0;color:var(--muted);line-height:1.45}

.onboarding{
  min-height:100dvh;padding:max(22px,env(safe-area-inset-top)) 18px max(28px,env(safe-area-inset-bottom));
  display:flex;flex-direction:column;justify-content:center;gap:18px
}
.brand{font-weight:800;letter-spacing:-.03em;font-size:18px;text-align:center}
.onboarding-card{
  max-width:430px;width:100%;margin:0 auto;background:#fff;border:1px solid var(--line);
  border-radius:32px;padding:24px;box-shadow:var(--shadow)
}
.step-pill{
  display:inline-flex;background:var(--surface-2);color:var(--accent-deep);font-size:12px;font-weight:800;
  padding:8px 10px;border-radius:999px
}
.onboarding h1{font-size:30px;letter-spacing:-.04em;margin:14px 0 8px}
.onboarding p{color:var(--muted);line-height:1.45;margin:0 0 20px}
.fine-print{font-size:12px!important;text-align:center;margin:14px 0 0!important}

.field{display:flex;flex-direction:column;gap:8px;margin:14px 0}
.field span{font-size:13px;font-weight:700;color:#685961}
.field input,.field textarea,.date-input{
  width:100%;border:1px solid var(--line);background:#fff;border-radius:16px;padding:14px 15px;
  color:var(--text);outline:none
}
.field input:focus,.field textarea:focus,.date-input:focus{border-color:#e8a1bb;box-shadow:0 0 0 3px #fff0f5}
.field textarea{min-height:96px;resize:vertical}
.two-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.primary-btn{
  width:100%;border:0;border-radius:18px;padding:15px 18px;background:linear-gradient(135deg,var(--accent),var(--accent-deep));
  color:#fff;font-weight:800;box-shadow:0 10px 24px rgba(207,70,118,.22)
}
.primary-btn:active{transform:translateY(1px)}

.main{
  width:100%;max-width:560px;margin:0 auto;min-height:100dvh;
  padding:max(18px,env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom))
}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.topbar h1{font-size:26px;letter-spacing:-.04em;margin:2px 0 0}
.eyebrow{text-transform:uppercase;letter-spacing:.12em;font-size:10px;font-weight:800;color:var(--muted)}
.icon-btn,.round-btn{
  border:1px solid var(--line);background:#fff;width:42px;height:42px;border-radius:50%;display:grid;place-items:center;
  color:var(--text);font-size:22px
}
.icon-btn{font-size:24px;line-height:1}

.page{display:none;animation:fade .18s ease}
.page.active{display:block}
@keyframes fade{from{opacity:.35;transform:translateY(4px)}to{opacity:1;transform:none}}

.hero-card{
  background:radial-gradient(circle at 10% 0%,#fff,#fff2f6 72%);border:1px solid var(--line);
  border-radius:32px;padding:20px;box-shadow:var(--shadow);display:grid;grid-template-columns:150px 1fr;
  gap:18px;align-items:center
}
.cycle-orbit{height:150px;position:relative;display:grid;place-items:center}
.orbit-ring{
  position:absolute;inset:0;border-radius:50%;
  background:conic-gradient(var(--accent) 0 34%,#f7dce6 34% 72%,var(--violet) 72% 81%,#f5e9ef 81% 100%);
  -webkit-mask:radial-gradient(circle,transparent 55%,#000 57%);
  mask:radial-gradient(circle,transparent 55%,#000 57%)
}
.orbit-content{text-align:center;display:flex;flex-direction:column;gap:2px}
.orbit-content span{font-size:11px;color:var(--muted);font-weight:700}
.orbit-content strong{font-size:44px;line-height:1;letter-spacing:-.05em}
.orbit-content small{font-size:11px;color:var(--accent-deep);font-weight:800}
.hero-label{font-size:12px;color:var(--muted);font-weight:700}
.hero-value{font-size:23px;line-height:1.1;font-weight:850;letter-spacing:-.04em;margin-top:5px}
.hero-sub{font-size:12px;color:var(--muted);line-height:1.4;margin-top:10px}

.period-start-btn{
  width:100%;
  margin-top:14px;
  border:1px solid #f1d7e0;
  background:#fff;
  border-radius:22px;
  padding:14px 16px;
  display:flex;
  align-items:center;
  gap:12px;
  text-align:left;
  color:var(--text);
  box-shadow:0 8px 24px rgba(105,70,86,.06)
}
.period-start-btn:active{transform:translateY(1px)}
.period-start-btn:disabled{opacity:1}
.period-start-icon{
  flex:0 0 auto;
  width:38px;
  height:38px;
  border-radius:50%;
  background:linear-gradient(135deg,#f7a5bc,#e9608f);
  position:relative
}
.period-start-icon:after{
  content:"";
  position:absolute;
  width:10px;
  height:15px;
  background:#fff;
  border-radius:50% 50% 55% 55% / 40% 40% 65% 65%;
  left:14px;
  top:10px;
}
.period-start-btn span:last-child{
  display:flex;
  flex-direction:column;
  gap:3px
}
.period-start-btn strong{
  font-size:14px;
  letter-spacing:-.01em
}
.period-start-btn small{
  color:var(--muted);
  font-size:11px
}
.period-start-btn.done{
  background:#faf6f8;
  box-shadow:none
}
.period-start-btn.done .period-start-icon{
  background:#dfd2d7
}

.section-head{display:flex;justify-content:space-between;align-items:end;margin:28px 2px 12px}
.section-head h2{margin:3px 0 0;font-size:22px;letter-spacing:-.03em}
.text-btn{border:0;background:transparent;color:var(--accent-deep);font-weight:800;padding:8px}

.summary-card,.info-card,.stats-card,.calendar-card{
  background:#fff;border:1px solid var(--line);border-radius:24px;padding:18px
}
.summary-card.empty{color:var(--muted);line-height:1.45}
.summary-list{display:flex;flex-wrap:wrap;gap:8px}
.summary-chip{background:var(--surface-2);border-radius:999px;padding:9px 11px;font-size:13px;font-weight:700}
.summary-note{margin-top:12px;color:var(--muted);font-size:13px;line-height:1.4}
.info-card{margin-top:14px}
.info-card h3{font-size:20px;margin:4px 0 16px}
.info-card p{font-size:12px;color:var(--muted);line-height:1.45;margin:14px 0 0}
.forecast-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.forecast-grid div{background:#faf6f8;border-radius:16px;padding:13px}
.forecast-grid span{display:block;color:var(--muted);font-size:11px;margin-bottom:5px}
.forecast-grid strong{font-size:14px}

.calendar-card{padding:16px}
.calendar-head{display:grid;grid-template-columns:42px 1fr 42px;align-items:center;gap:8px;margin-bottom:12px}
.calendar-head h2{text-align:center;margin:0;font-size:19px;text-transform:capitalize}
.weekdays,.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.weekdays span{text-align:center;font-size:10px;color:var(--muted);font-weight:800;padding:8px 0}
.day{
  aspect-ratio:1/1;border:0;background:transparent;border-radius:15px;position:relative;
  display:grid;place-items:center;font-size:13px;color:var(--text)
}
.day.other{opacity:.24}
.day.today{box-shadow:inset 0 0 0 1.5px var(--text);font-weight:800}
.day.period{background:#f7abc2;color:#5a2338;font-weight:850}
.day.predicted{background:#ffe3ec;color:#8f3858;font-weight:800}
.day.fertile{background:var(--fertile);color:#6e5790;font-weight:800}
.day.ovulation:after{
  content:"";position:absolute;width:5px;height:5px;border-radius:50%;background:#8462aa;bottom:5px
}
.day.has-entry:before{
  content:"";position:absolute;width:4px;height:4px;border-radius:50%;background:var(--text);top:5px;right:5px;opacity:.6
}
.legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px;color:var(--muted);font-size:10px}
.legend span{display:flex;align-items:center;gap:5px}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block}
.dot.period{background:#f7abc2}.dot.predicted{background:#ffe3ec}.dot.fertile{background:var(--fertile)}

.stats-card h2{margin:4px 0 18px}
.stats-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.stats-row div{background:#faf6f8;padding:14px;border-radius:17px}
.stats-row strong{display:block;font-size:22px}
.stats-row span{font-size:11px;color:var(--muted)}
.history-list{display:flex;flex-direction:column;gap:10px;margin-top:14px}
.history-item{
  background:#fff;border:1px solid var(--line);border-radius:20px;padding:15px;display:grid;grid-template-columns:1fr auto;
  gap:8px;align-items:center
}
.history-item h3{font-size:15px;margin:0 0 4px}
.history-item p{font-size:12px;color:var(--muted);margin:0}
.history-days{font-size:13px;font-weight:850;color:var(--accent-deep)}
.history-empty{padding:24px;text-align:center;color:var(--muted);font-size:13px}

.bottom-nav{
  position:fixed;z-index:20;left:50%;transform:translateX(-50%);bottom:max(10px,env(safe-area-inset-bottom));
  width:min(calc(100% - 24px),536px);height:70px;background:rgba(255,255,255,.94);backdrop-filter:blur(18px);
  border:1px solid var(--line);border-radius:24px;box-shadow:0 18px 45px rgba(90,53,68,.14);
  display:grid;grid-template-columns:1fr 1fr 66px 1fr;align-items:center;padding:6px
}
.nav-item{height:56px;border:0;background:transparent;color:var(--muted);display:flex;flex-direction:column;gap:5px;align-items:center;justify-content:center}
.nav-item b{font-size:10px}
.nav-item.active{color:var(--accent-deep)}
.nav-dot{width:13px;height:13px;border:2px solid currentColor;border-radius:50%}
.nav-square{width:14px;height:14px;border:2px solid currentColor;border-radius:4px}
.nav-lines{width:15px;height:12px;border-top:2px solid currentColor;border-bottom:2px solid currentColor;position:relative}
.nav-lines:after{content:"";position:absolute;left:0;right:0;top:4px;border-top:2px solid currentColor}
.add-btn{
  width:54px;height:54px;border-radius:19px;border:0;background:linear-gradient(135deg,var(--accent),var(--accent-deep));
  color:#fff;font-size:30px;line-height:1;box-shadow:0 10px 22px rgba(207,70,118,.27);justify-self:center
}

.sheet-wrap{position:fixed;z-index:100;inset:0;display:flex;align-items:flex-end;justify-content:center}
.sheet-backdrop{position:absolute;inset:0;background:rgba(45,31,38,.32);backdrop-filter:blur(2px)}
.sheet{
  position:relative;z-index:1;width:min(100%,560px);max-height:92dvh;overflow:auto;background:var(--bg);
  border-radius:30px 30px 0 0;padding:10px 18px max(26px,env(safe-area-inset-bottom));box-shadow:0 -20px 50px rgba(50,30,40,.15)
}
.small-sheet{max-height:70dvh}
.sheet-grabber{width:42px;height:5px;border-radius:99px;background:#dfd1d7;margin:4px auto 14px}
.sheet-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.sheet-head h2{margin:3px 0 0}
.date-input{margin-bottom:8px}
.question{margin:20px 0}
.question h3{font-size:14px;margin:0 0 10px}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chips button{
  border:1px solid var(--line);background:#fff;border-radius:999px;padding:10px 12px;color:#5f5158;font-size:12px;font-weight:700
}
.chips button.selected{background:var(--accent-soft);border-color:#f2b8ca;color:#8c3254}
.privacy-note{margin-top:18px;padding:14px;border-radius:16px;background:#faf3f6}
.privacy-note strong{font-size:13px}
.privacy-note p{font-size:12px;color:var(--muted);line-height:1.4;margin:5px 0 0}

.toast{
  position:fixed;z-index:200;left:50%;transform:translateX(-50%);bottom:98px;background:#2c2227;color:#fff;
  border-radius:999px;padding:11px 15px;font-size:12px;box-shadow:0 10px 30px rgba(0,0,0,.18)
}

@media(max-width:390px){
  .hero-card{grid-template-columns:126px 1fr;padding:16px;gap:12px}
  .cycle-orbit{height:126px}
  .orbit-content strong{font-size:38px}
  .hero-value{font-size:20px}
  .main{padding-left:12px;padding-right:12px}
}


.advanced-settings{
  margin-top:18px;
  padding-top:18px;
  border-top:1px solid var(--line);
}

.settings-title h3{
  margin:4px 0 10px;
  font-size:17px;
}

.secondary-btn{
  width:100%;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  border-radius:16px;
  padding:13px 15px;
  font-weight:800;
}

.secondary-btn:disabled,
.danger-text-btn:disabled{
  opacity:.4;
}

.danger-text-btn{
  width:100%;
  border:0;
  background:transparent;
  color:#b34161;
  padding:14px 8px 4px;
  font-size:13px;
  font-weight:800;
}

.danger-zone p{
  margin:0 0 13px;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.danger-btn{
  width:100%;
  border:1px solid #efc3cf;
  background:#fff2f5;
  color:#a52f52;
  border-radius:16px;
  padding:13px 15px;
  font-weight:800;
}


.quick-card{
  margin-top:14px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:24px;
  padding:16px;
}

.quick-head{
  margin-bottom:12px;
}

.quick-row + .quick-row{
  margin-top:16px;
}

.quick-row > span{
  display:block;
  margin-bottom:8px;
  font-size:12px;
  font-weight:800;
  color:#685961;
}

.quick-options{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.quick-options button{
  border:1px solid var(--line);
  background:#faf7f8;
  color:#66565e;
  border-radius:999px;
  padding:9px 11px;
  font-size:11px;
  font-weight:750;
}

.quick-options button.selected{
  background:var(--accent-soft);
  border-color:#efb6c8;
  color:#8c3254;
}

.quick-options button:active{
  transform:scale(.97);
}


.day.period-start{
  outline:2px solid #d34f7f;
  outline-offset:-3px;
  font-weight:900;
}

.day.period-start{
  outline:2px solid #d34f7f;
  outline-offset:-3px;
  font-weight:900;
}
