:root{
  --plum:#5E3B9A; --plum-deep:#3E2670; --plum-btn:#6C45B3; --plum-soft:#A88BD9;
  --lav-1:#F7F3FC; --lav-2:#EFE8F8; --lav-3:#E3D8F3;
  --rose:#E48BAD; --rose-soft:#F6D5E3; --coral:#F0997B; --mint:#8CD9C4;
  --ink:#2B1F45; --ink-2:#635A7A; --ink-3:#7E7593; --line:#E9E2F4;
  --r-card:22px; --r-pill:999px;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:"Manrope",system-ui,-apple-system,sans-serif;color:var(--ink);
  background:#ECE4F5;display:flex;align-items:center;justify-content:center;
  padding:24px 12px;min-height:100vh;
}
.phone{
  width:min(390px,100%);background:#fff;border-radius:44px;overflow:hidden;
  box-shadow:0 30px 60px rgba(62,38,112,.18),0 0 0 8px #1a1230,0 0 0 9px #3a2f55;
  display:flex;flex-direction:column;height:820px;max-height:calc(100vh - 48px);
  position:relative;
}
.status{display:flex;justify-content:space-between;align-items:center;padding:16px 28px 0;font-size:14px;font-weight:600}
.status .right{display:flex;gap:6px;align-items:center;font-size:12px}
.notch{position:absolute;top:14px;left:50%;transform:translateX(-50%);width:110px;height:30px;background:#1a1230;border-radius:20px}
.screen{flex:1;overflow-y:auto;padding:20px 20px 96px;display:none;scrollbar-width:none}
.screen::-webkit-scrollbar{display:none}
.screen.active{display:block}
h1{font-size:22px;font-weight:700;letter-spacing:-.2px}
h2{font-size:17px;font-weight:700}
.muted{color:var(--ink-2);font-size:13px}
.hint{color:var(--ink-3);font-size:12px}
.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;gap:10px}
.top .day{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--ink-2)}
.bell{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:var(--lav-1);border:0;cursor:pointer;flex:none}
.tabs{display:flex;border-bottom:1px solid var(--line);margin:0 -20px 18px;padding:0 20px}
.tabs button{flex:1;background:none;border:0;padding:10px 0;font:inherit;font-size:12px;font-weight:700;letter-spacing:.6px;color:var(--ink-3);border-bottom:2px solid transparent;cursor:pointer}
.tabs button.on{color:var(--plum);border-color:var(--plum)}
.card{background:var(--lav-1);border-radius:var(--r-card);padding:18px;margin-bottom:14px}
.card.white{background:#fff;border:1px solid var(--line)}
.center{text-align:center}
.chip{display:inline-flex;align-items:center;justify-content:center;padding:8px 14px;border-radius:var(--r-pill);background:#fff;border:1px solid var(--line);font-size:12px;font-weight:600;color:var(--ink-2);cursor:pointer;user-select:none;font-family:inherit}
.chip.on{background:var(--lav-2);border-color:var(--plum-soft);color:var(--plum)}
.chip.soft{background:var(--lav-2);border-color:transparent;color:var(--plum)}
.btn{display:block;width:100%;border:0;border-radius:14px;padding:15px;font:inherit;font-weight:700;font-size:15px;color:#fff;background:var(--plum-btn);cursor:pointer}
.btn:active{transform:scale(.99)}
.btn.ghost{background:var(--lav-2);color:var(--plum)}
.btn.danger{background:#FBE3E3;color:#B03A3A}
.btn[disabled]{opacity:.5;cursor:not-allowed}
.link{color:var(--plum);font-size:13px;font-weight:600;text-decoration:none;background:none;border:0;font-family:inherit;cursor:pointer;padding:0}
.row{display:flex;align-items:center;gap:10px}
.grow{flex:1}
.icon{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;flex:none}
.moods{display:flex;justify-content:space-between;align-items:flex-end;margin-top:14px}
.mood{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:11px;color:var(--ink-2);background:none;border:0;font:inherit;cursor:pointer}
.mood .face{width:44px;height:44px;border-radius:50%;background:#fff;border:1.5px solid var(--line);display:grid;place-items:center;transition:all .15s}
.mood.on .face{background:var(--lav-2);border-color:var(--plum-soft)}
.mood .face svg{width:26px;height:26px;stroke:var(--plum);fill:none;stroke-width:1.8;stroke-linecap:round}
.plus{width:52px;height:52px;border-radius:50%;background:var(--lav-2);color:var(--plum);display:grid;place-items:center;font-size:28px;font-weight:400}
.dates{display:flex;justify-content:space-between;margin:6px 0 18px;gap:2px}
.dates button{text-align:center;width:38px;font-size:11px;color:var(--ink-3);line-height:1.2;background:none;border:0;font:inherit;cursor:pointer;padding:4px 0;border-radius:19px;position:relative}
.dates b{display:block;font-size:14px;font-weight:600;color:var(--ink);margin-top:3px}
.dates .today{background:var(--plum);color:#fff}
.dates .today b{color:#fff}
.dates .sel{box-shadow:inset 0 0 0 2px var(--plum-soft)}
.dates .dot{position:absolute;bottom:1px;left:50%;transform:translateX(-50%);width:4px;height:4px;border-radius:50%;background:var(--rose)}
.dates .today .dot{background:#fff}
.sect{font-size:14px;font-weight:700;margin:14px 0 10px}
.opts{display:flex;gap:10px}
.opt{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 6px;border-radius:14px;border:1.5px solid var(--line);font-size:11px;color:var(--ink-2);background:#fff;cursor:pointer;font:inherit}
.opt.on{background:var(--lav-2);border-color:var(--plum-soft);color:var(--plum)}
.opt svg{width:22px;height:22px}
.slider{display:grid;grid-template-columns:90px 34px 1fr 36px;align-items:center;gap:6px;margin:10px 0;font-size:13px;font-weight:600}
.slider small{font-size:11px;color:var(--ink-3);font-weight:500}
.slider small.r{text-align:right}
input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:2px;background:var(--lav-3);outline:none}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:50%;background:var(--plum-soft);border:2px solid #fff;box-shadow:0 0 0 1px var(--plum-soft);cursor:pointer}
input[type=range]::-moz-range-thumb{width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:var(--plum-soft);cursor:pointer}
input[type=range].rose::-webkit-slider-thumb{background:var(--rose);box-shadow:0 0 0 1px var(--rose)}
input[type=range].deep::-webkit-slider-thumb{background:var(--plum);box-shadow:0 0 0 1px var(--plum)}
input[type=range]:focus-visible{outline:2px solid var(--plum);outline-offset:4px}
.faces{display:flex;justify-content:space-between}
.faces button{width:38px;height:38px;border-radius:50%;background:none;border:0;display:grid;place-items:center;cursor:pointer}
.faces button.on{background:var(--lav-2)}
.faces svg{width:24px;height:24px;stroke:var(--plum-soft);fill:none;stroke-width:1.8;stroke-linecap:round}
.faces button.on svg{stroke:var(--plum)}
.chips{display:flex;flex-wrap:wrap;gap:8px}
textarea,input[type=text],input[type=date],input[type=number],input[type=time]{
  width:100%;border:1px solid var(--line);border-radius:14px;padding:12px;font:inherit;font-size:13px;
  background:#fff;color:var(--ink);
}
textarea{resize:none;height:44px;margin:8px 0 16px}
textarea::placeholder,input::placeholder{color:var(--ink-3)}
input:focus-visible,textarea:focus-visible,button:focus-visible{outline:2px solid var(--plum);outline-offset:2px}
.pattern{display:flex;gap:12px;padding:10px 0}
.pattern p{font-size:13px;color:var(--ink-2);line-height:1.45}
.pattern b{display:block;color:var(--ink);font-size:14px;margin-bottom:2px}
.nav{position:absolute;left:0;right:0;bottom:0;background:#fff;border-top:1px solid var(--line);display:flex;justify-content:space-around;align-items:flex-end;padding:8px 8px 22px}
.nav button{background:none;border:0;font:inherit;font-size:10px;color:var(--ink-3);display:flex;flex-direction:column;align-items:center;gap:4px;width:56px;cursor:pointer}
.nav button.on{color:var(--plum)}
.nav svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.nav .fab{width:50px;height:50px;border-radius:50%;background:var(--plum);color:#fff;display:grid;place-items:center;font-size:26px;font-weight:300;margin-bottom:4px}
.close{width:32px;height:32px;border-radius:50%;background:none;border:0;font-size:20px;color:var(--ink-2);cursor:pointer}
.toast{position:absolute;left:50%;bottom:110px;transform:translate(-50%,10px);background:var(--plum-deep);color:#fff;padding:10px 18px;border-radius:999px;font-size:13px;font-weight:600;opacity:0;transition:all .25s;pointer-events:none;z-index:40;max-width:80%;text-align:center}
.toast.show{opacity:1;transform:translate(-50%,0)}
.ai{background:var(--plum-deep);color:#fff;border-radius:var(--r-card);padding:18px}
.ai p{font-size:13px;line-height:1.5;opacity:.92}

/* calendar */
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.cal-head b{font-size:15px}
.cal-nav{width:34px;height:34px;border-radius:50%;border:1px solid var(--line);background:#fff;color:var(--plum);font-size:16px;cursor:pointer;display:grid;place-items:center}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.cal-grid .wd{text-align:center;font-size:10px;font-weight:700;color:var(--ink-3);padding-bottom:4px;letter-spacing:.4px}
.cal-day{aspect-ratio:1;border:0;background:none;font:inherit;font-size:13px;color:var(--ink);border-radius:50%;cursor:pointer;position:relative;display:grid;place-items:center}
.cal-day.pad{visibility:hidden}
.cal-day.bleed{background:var(--rose);color:#fff;font-weight:700}
.cal-day.p-bleed{background:var(--rose-soft);color:#96345C}
.cal-day.p-fertile{background:#DFF3EC;color:#2F7A67}
.cal-day.p-ovulation{background:var(--mint);color:#17544a;font-weight:700}
.cal-day.today{box-shadow:inset 0 0 0 2px var(--plum)}
.cal-day.sel{box-shadow:inset 0 0 0 2px var(--plum-deep)}
.cal-day .mark{position:absolute;bottom:4px;left:50%;transform:translateX(-50%);width:4px;height:4px;border-radius:50%;background:var(--plum-soft)}
.cal-day.bleed .mark{background:#fff}
.legend{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.legend span{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--ink-2)}
.legend i{width:12px;height:12px;border-radius:50%;display:block}

/* generic list rows */
.rows{background:#fff;border:1px solid var(--line);border-radius:var(--r-card);overflow:hidden}
.rows .r{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line);font-size:14px;width:100%;background:none;border-left:0;border-right:0;border-top:0;font:inherit;text-align:left;cursor:pointer;color:var(--ink)}
.rows .r:last-child{border-bottom:0}
.rows .r span.grow{font-size:14px}
.rows .r small{display:block;color:var(--ink-3);font-size:11px;font-weight:500;margin-top:2px}
.rows .r .val{color:var(--ink-3);font-size:13px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12px;font-weight:700;color:var(--ink-2);margin-bottom:6px}

/* switch */
.sw{width:44px;height:26px;border-radius:13px;background:var(--lav-3);position:relative;flex:none;border:0;cursor:pointer;transition:background .15s}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:transform .15s}
.sw.on{background:var(--plum)}
.sw.on::after{transform:translateX(18px)}

/* bars */
.bar{height:8px;border-radius:4px;background:var(--lav-2);overflow:hidden;margin-top:6px}
.bar i{display:block;height:100%;border-radius:4px;background:linear-gradient(90deg,var(--rose),var(--plum-soft))}
.stat{margin-bottom:14px}
.stat .row{justify-content:space-between;font-size:13px}
.stat b{font-size:13px}

/* empty state */
.empty{text-align:center;padding:26px 18px;color:var(--ink-2)}
.empty .ring{width:54px;height:54px;border-radius:50%;background:var(--lav-2);display:grid;place-items:center;margin:0 auto 12px;color:var(--plum);font-size:22px}
.empty p{font-size:13px;line-height:1.5;margin-bottom:4px}

/* onboarding */
.sheet{position:absolute;inset:0;background:#fff;z-index:60;display:none;flex-direction:column;padding:32px 24px 24px;overflow-y:auto}
.sheet.active{display:flex}
.sheet .logo{width:56px;height:56px;border-radius:18px;background:linear-gradient(160deg,var(--plum-btn),var(--plum-deep));display:grid;place-items:center;margin-bottom:18px}
.sheet h1{margin-bottom:8px}
.sheet .step{display:none}
.sheet .step.active{display:block}
.sheet .foot{margin-top:auto;padding-top:18px}
.dots{display:flex;gap:6px;justify-content:center;margin-bottom:14px}
.dots i{width:6px;height:6px;border-radius:50%;background:var(--lav-3)}
.dots i.on{background:var(--plum);width:18px;border-radius:3px}

/* timeline */
.tl{position:relative;padding-left:22px}
.tl::before{content:"";position:absolute;left:6px;top:6px;bottom:6px;width:2px;background:var(--lav-2)}
.tl .item{position:relative;padding-bottom:16px}
.tl .item::before{content:"";position:absolute;left:-19px;top:5px;width:10px;height:10px;border-radius:50%;background:var(--plum-soft);border:2px solid #fff}
.tl .item.bleed::before{background:var(--rose)}
.tl .item b{font-size:13px;display:block}
.tl .item p{font-size:12px;color:var(--ink-2);line-height:1.5}

.banner{display:flex;gap:10px;align-items:center;background:var(--lav-2);border-radius:16px;padding:12px 14px;margin-bottom:14px;font-size:13px;color:var(--plum-deep)}
.banner button{margin-left:auto;flex:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (max-width:480px),(display-mode:standalone){
  body{padding:0;background:#fff}
  .phone{width:100%;height:100dvh;max-height:none;border-radius:0;box-shadow:none}
  .notch,.status{display:none}
  .screen{padding-top:calc(16px + env(safe-area-inset-top))}
  .nav{padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .sheet{padding-top:calc(32px + env(safe-area-inset-top));padding-bottom:calc(24px + env(safe-area-inset-bottom))}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
