/* Dot — Mini App styles. Light-first, dark via [data-theme=dark]. Phase colours drive the hero. */
:root{
  --bg:#FFF6F8; --card:#FFFFFF; --card2:#FFF0F3; --text:#211A26; --muted:#8B7F91; --line:rgba(33,26,38,.07); --chip:#F6EEF2; --chip-text:#3B2F41;
  --accent:#F2547A; --accent-soft:#FFE1E9; --accent-text:#C7355A;
  --teal:#22B3B8; --teal-soft:#DCF5F4; --lav:#8C79F5; --lav-soft:#ECE7FF; --peach:#FF9A62; --peach-soft:#FFEADB; --gold:#F0A93A; --gold-soft:#FFF1D4;
  --shadow:0 8px 28px rgba(140,60,90,.10); --radius:22px; --hero-text:#fff;
  --g-period:linear-gradient(160deg,#FF6A8E 0%,#FFA79C 100%); --g-period_predicted:linear-gradient(160deg,#FF8AA6 0%,#FFC4B8 100%);
  --g-follicular:linear-gradient(160deg,#FF9660 0%,#FFCF98 100%); --g-fertile:linear-gradient(160deg,#21C1B3 0%,#8DE6D2 100%);
  --g-ovulation:linear-gradient(160deg,#1FA6CB 0%,#7BDCF1 100%); --g-luteal:linear-gradient(160deg,#9A83FF 0%,#D6C6FF 100%);
  --g-pregnant:linear-gradient(160deg,#F0A030 0%,#FFD98A 100%); --g-none:linear-gradient(160deg,#C8B6D9 0%,#EBDFF5 100%);
  --sab:env(safe-area-inset-bottom,0px);
}
[data-theme=dark]{
  --bg:#15111B; --card:#201A29; --card2:#2A2234; --text:#F5EEF7; --muted:#A79BB0; --line:rgba(255,255,255,.08); --chip:#2C2437; --chip-text:#E9E0EE;
  --accent:#FF6B8F; --accent-soft:#3C2230; --accent-text:#FF9DB5; --teal-soft:#183336; --lav-soft:#2A2545; --peach-soft:#3A2A22; --gold-soft:#3A3020;
  --shadow:0 8px 28px rgba(0,0,0,.35);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text)}
body{font-family:'Nunito',-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang TC','Noto Sans TC','Microsoft JhengHei',sans-serif;font-size:15px;line-height:1.4;overscroll-behavior-y:none;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{border:0;background:none;padding:0;cursor:pointer}
a{color:var(--accent-text)}
h1,h2,h3,h4{margin:0;font-weight:800;letter-spacing:-.01em}
h2{font-size:22px} h3{font-size:17px} h4{font-size:15px}
.muted{color:var(--muted)} .small{font-size:13px} .b{font-weight:800}
#app{min-height:100vh;padding-bottom:calc(84px + var(--sab))}
/* splash */
.splash{height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;background:var(--g-period);color:#fff}
.dot-logo{width:76px;height:76px;border-radius:50%;background:rgba(255,255,255,.22);display:grid;place-items:center;animation:pulse 1.6s ease-in-out infinite}
.dot-logo span{width:30px;height:30px;border-radius:50%;background:#fff;display:block}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}
.splash-t{font-size:34px;font-weight:900;letter-spacing:-.02em}.splash-s{opacity:.85}
/* hero */
.hero{color:var(--hero-text);padding:10px 16px 22px;border-radius:0 0 32px 32px;background:var(--g-none);transition:background .4s;position:relative;overflow:hidden}
.hero.period{background:var(--g-period)} .hero.period_predicted{background:var(--g-period_predicted)} .hero.follicular{background:var(--g-follicular)}
.hero.fertile{background:var(--g-fertile)} .hero.ovulation{background:var(--g-ovulation)} .hero.luteal{background:var(--g-luteal)} .hero.pregnant{background:var(--g-pregnant)}
.hero:before{content:'';position:absolute;inset:-40% -20% auto auto;width:70%;aspect-ratio:1;border-radius:50%;background:rgba(255,255,255,.12);pointer-events:none}
.datebar{display:flex;align-items:center;justify-content:space-between;gap:8px;position:relative}
.datebar .dt{flex:1;text-align:center;font-weight:900;font-size:20px;line-height:1.15}
.datebar .dt small{display:block;font-size:12px;font-weight:700;opacity:.85;text-transform:uppercase;letter-spacing:.06em}
.ico-btn{width:38px;height:38px;border-radius:50%;background:rgba(255,255,255,.18);display:grid;place-items:center;color:#fff;font-size:18px;font-weight:900}
.ico-btn:active{background:rgba(255,255,255,.3)}
.todaypill{position:absolute;left:50%;transform:translateX(-50%);top:46px;background:rgba(255,255,255,.9);color:#3B2F41;font-size:12px;font-weight:800;padding:4px 10px;border-radius:12px}
.weekstrip{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin:14px 0 6px}
.wd{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 0 5px;border-radius:14px;color:#fff;opacity:.85;position:relative}
.wd small{font-size:10px;font-weight:800;text-transform:uppercase;opacity:.85}
.wd b{font-size:15px;font-weight:900;width:28px;height:28px;border-radius:50%;display:grid;place-items:center}
.wd.sel{background:rgba(255,255,255,.22);opacity:1}
.wd.today b{outline:2px solid rgba(255,255,255,.9);outline-offset:1px}
.wd.p b{background:#fff;color:#E0476E} .wd.pp b{border:2px dashed rgba(255,255,255,.9)} .wd.f b{background:rgba(255,255,255,.35)} .wd.ov b{background:#fff;color:#1FA6CB}
.wd .d{width:5px;height:5px;border-radius:50%;background:#fff;margin-top:1px;opacity:0} .wd.log .d{opacity:1}
.wd.future{opacity:.45}
.ring{margin:14px auto 8px;width:206px;height:206px;border-radius:50%;background:rgba(255,255,255,.16);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:18px;position:relative;box-shadow:inset 0 0 0 8px rgba(255,255,255,.2)}
.ring .k{font-size:15px;font-weight:800;opacity:.92;line-height:1.2}
.ring .v{font-size:34px;font-weight:900;letter-spacing:-.02em;line-height:1.05;margin:4px 0}
.ring .s{font-size:13px;opacity:.9}
.ring.tap{cursor:pointer}
.phaserow{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-top:6px}
.pill{background:rgba(255,255,255,.22);padding:5px 12px;border-radius:14px;font-size:12.5px;font-weight:800}
/* sections */
.sec{padding:16px 16px 0}
.sec-h{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:10px}
.sec-h .lnk{color:var(--accent-text);font-weight:800;font-size:13px}
.card{background:var(--card);border-radius:var(--radius);padding:14px 16px;box-shadow:var(--shadow);margin-bottom:12px}
.card.soft{background:var(--card2);box-shadow:none}
.row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.row:last-child{border-bottom:0} .row .l{flex:1;min-width:0} .row .l small{display:block;color:var(--muted);font-size:12.5px}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;align-items:center;gap:6px;padding:8px 12px 8px 10px;border-radius:18px;background:var(--chip);color:var(--chip-text);font-weight:700;font-size:13.5px;line-height:1.15;transition:transform .08s,background .15s;user-select:none;border:1.5px solid transparent}
.chip .i{font-size:16px;line-height:1} .chip:active{transform:scale(.95)}
.chip.on{background:var(--accent);color:#fff;border-color:var(--accent)}
.chip.on.teal{background:var(--teal);border-color:var(--teal)} .chip.on.lav{background:var(--lav);border-color:var(--lav)}
.chip.val{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft)}
.chip.dis{opacity:.45;pointer-events:none}
.cat{margin-bottom:10px}
.cat h4{margin-bottom:9px;display:flex;justify-content:space-between;align-items:center}
.cat h4 .x{color:var(--muted);font-size:12px;font-weight:700}
.drops{display:inline-flex;gap:1px;align-items:flex-end;height:16px}
.drops i{display:block;width:8px;height:11px;background:currentColor;border-radius:50% 50% 50% 50%/60% 60% 40% 40%;transform:rotate(0deg)}
.drops i.s{width:6px;height:6px;border-radius:50%}
.counter{display:inline-flex;align-items:center;gap:10px;background:var(--chip);border-radius:18px;padding:4px 6px}
.counter button{width:32px;height:32px;border-radius:50%;background:var(--card);font-weight:900;font-size:18px;color:var(--accent-text);box-shadow:0 1px 3px rgba(0,0,0,.08)}
.counter span{min-width:70px;text-align:center;font-weight:800}
.glasses{display:flex;gap:4px;margin-top:8px;flex-wrap:wrap}.glasses i{width:14px;height:20px;border-radius:3px 3px 6px 6px;background:var(--chip);display:block}.glasses i.on{background:var(--teal)}
.summary{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.summary .t{background:var(--accent-soft);color:var(--accent-text);border-radius:12px;padding:4px 10px;font-size:12.5px;font-weight:800}
textarea.note{width:100%;border:0;background:var(--chip);border-radius:14px;padding:10px 12px;min-height:64px;resize:vertical;outline:none}
.hint{color:var(--muted);font-size:13px;margin:0 0 10px}
/* insight cards */
.icard{display:flex;gap:12px;align-items:flex-start}.icard .em{font-size:26px;line-height:1;width:40px;height:40px;border-radius:14px;display:grid;place-items:center;background:var(--accent-soft);flex-shrink:0}
.icard .tt{font-weight:800}.icard .ss{color:var(--muted);font-size:13px;margin-top:2px}
.arow{display:flex;gap:10px;overflow-x:auto;padding:2px 16px 10px;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch}
.arow::-webkit-scrollbar{display:none}
.acard{min-width:210px;max-width:230px;scroll-snap-align:start;background:var(--card);border-radius:20px;padding:14px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:6px}
.acard .tp{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--accent-text)}
.acard .tt{font-weight:800;line-height:1.25}.acard .ss{font-size:12.5px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.alist .acard{min-width:0;max-width:none;margin-bottom:10px}
.topic-chips{display:flex;gap:6px;overflow-x:auto;padding:0 16px 8px}.topic-chips::-webkit-scrollbar{display:none}
.topic-chips .chip{white-space:nowrap;padding:6px 12px}
/* calendar */
.cal-h{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 6px}
.cal-h h2{text-transform:capitalize}
.cal-h .nav{display:flex;gap:6px}.cal-h .nav button{width:36px;height:36px;border-radius:50%;background:var(--card);box-shadow:var(--shadow);font-weight:900;font-size:18px;color:var(--accent-text)}
.wdays{display:grid;grid-template-columns:repeat(7,1fr);padding:0 12px;color:var(--muted);font-size:11.5px;font-weight:800;text-transform:uppercase;text-align:center}
.grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px 2px;padding:6px 12px 10px}
.cell{aspect-ratio:1;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:50%;font-weight:800;font-size:14.5px;position:relative;margin:0 auto;width:min(100%,44px)}
.cell.o{opacity:.28}.cell.empty{visibility:hidden}
.cell.p{background:var(--accent);color:#fff}.cell.pp{border:2px dashed var(--accent);color:var(--accent-text)}
.cell.f{background:var(--teal-soft);color:var(--text)}.cell.ov{background:var(--teal);color:#fff}
.cell.today{box-shadow:0 0 0 2px var(--text)}
.cell .d{position:absolute;bottom:4px;width:5px;height:5px;border-radius:50%;background:var(--lav)}.cell.p .d,.cell.ov .d{background:#fff}
.cell .sp{position:absolute;top:4px;right:6px;width:6px;height:6px;border-radius:50%;background:var(--accent)}
.cell .hx{position:absolute;top:1px;left:5px;font-size:9px;line-height:1;color:var(--accent)}.cell.p .hx,.cell.ov .hx{color:#fff}
.cell.fut{color:var(--muted)}.cell.pp.fut{color:var(--accent-text)}
.editing .cell{cursor:pointer}.editing .cell.today{box-shadow:0 0 0 2px var(--accent)}
.legend{display:flex;flex-wrap:wrap;gap:10px 14px;padding:6px 16px 4px;font-size:12px;color:var(--muted);font-weight:700}
.legend span{display:inline-flex;align-items:center;gap:5px}.legend i{width:12px;height:12px;border-radius:50%;display:inline-block}
.legend .lp{background:var(--accent)}.legend .lpp{border:2px dashed var(--accent);width:10px;height:10px}.legend .lf{background:var(--teal-soft)}.legend .lo{background:var(--teal)}.legend .ll{background:var(--lav);width:7px;height:7px}
.editbar{margin:8px 16px 0;padding:10px 14px;border-radius:16px;background:var(--accent-soft);color:var(--accent-text);font-weight:800;font-size:13px;display:flex;justify-content:space-between;align-items:center}
/* stats */
.tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.tile{background:var(--card);border-radius:18px;padding:12px 14px;box-shadow:var(--shadow)}
.tile .v{font-size:24px;font-weight:900;letter-spacing:-.02em}.tile .v small{font-size:13px;font-weight:700;color:var(--muted);margin-left:3px}
.tile .k{font-size:12.5px;color:var(--muted);font-weight:700}
.tile.acc{background:var(--accent-soft)}.tile.acc .v{color:var(--accent-text)}
svg.chart{width:100%;height:auto;display:block}
table.hist{width:100%;border-collapse:collapse;font-size:14px}table.hist th{font-size:11.5px;text-transform:uppercase;color:var(--muted);text-align:left;font-weight:800;padding:4px 0}
table.hist td{padding:7px 0;border-top:1px solid var(--line)}table.hist td:not(:first-child),table.hist th:not(:first-child){text-align:right}
.bar{display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid var(--line)}.bar:last-child{border-bottom:0}
.bar .em{font-size:18px;width:26px;text-align:center}.bar .n{flex:1;min-width:0}.bar .n small{display:block;color:var(--muted);font-size:12px}
.bar .tr{width:90px;height:8px;background:var(--chip);border-radius:6px;overflow:hidden}.bar .tr i{display:block;height:100%;background:var(--accent);border-radius:6px}
.bar .c{font-weight:800;min-width:28px;text-align:right}
/* forms */
.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:14px 16px;border-radius:18px;background:var(--accent);color:#fff;font-weight:800;font-size:15.5px;box-shadow:0 8px 20px rgba(242,84,122,.28)}
.btn:active{transform:scale(.985)}.btn.ghost{background:var(--card);color:var(--accent-text);box-shadow:var(--shadow)}.btn.soft{background:var(--accent-soft);color:var(--accent-text);box-shadow:none}
.btn.danger{background:var(--card);color:#D9453B;box-shadow:var(--shadow)}.btn.sm{padding:10px 14px;font-size:14px;border-radius:14px;width:auto}
.btn[disabled]{opacity:.5}
.btns{display:flex;gap:10px}.btns .btn{flex:1}
.switch{position:relative;width:48px;height:28px;border-radius:14px;background:var(--chip);flex-shrink:0;transition:background .2s}
.switch:after{content:'';position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:transform .2s}
.switch.on{background:var(--accent)}.switch.on:after{transform:translateX(20px)}
.stepper{display:inline-flex;align-items:center;gap:8px;background:var(--chip);border-radius:16px;padding:3px}
.stepper button{width:34px;height:34px;border-radius:50%;background:var(--card);font-weight:900;font-size:18px;color:var(--accent-text);box-shadow:0 1px 3px rgba(0,0,0,.08)}
.stepper span{min-width:44px;text-align:center;font-weight:900;font-size:16px}
.seg{display:flex;background:var(--chip);border-radius:14px;padding:3px;gap:2px}.seg button{flex:1;padding:8px 6px;border-radius:11px;font-weight:800;font-size:13px;color:var(--muted)}.seg button.on{background:var(--card);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.1)}
input.inp,select.inp{width:100%;border:0;background:var(--chip);border-radius:14px;padding:12px 14px;outline:none;font-weight:700}
input[type=date].inp,input[type=time].inp{min-height:46px;-webkit-appearance:none;appearance:none}
input.inp.sm{width:auto;min-width:96px;padding:8px 10px;text-align:center}
.modes{display:grid;gap:10px}.mode{display:flex;align-items:center;gap:12px;background:var(--card);border-radius:18px;padding:14px;box-shadow:var(--shadow);border:2px solid transparent;text-align:left}
.mode.on{border-color:var(--accent)}.mode .em{font-size:26px}.mode .tt{font-weight:800}.mode .dd{font-size:12.5px;color:var(--muted)}
/* onboarding */
.ob{min-height:100vh;display:flex;flex-direction:column;padding:26px 20px calc(20px + var(--sab))}
.ob .body{flex:1}.ob h2{font-size:26px;margin:18px 0 8px}.ob .dots{display:flex;gap:6px;justify-content:center;margin-bottom:6px}.ob .dots i{width:8px;height:8px;border-radius:50%;background:var(--chip)}.ob .dots i.on{background:var(--accent)}
.ob .big{font-size:60px;text-align:center;margin:20px 0}
/* tabbar */
#tabbar{position:fixed;left:0;right:0;bottom:0;display:flex;background:var(--card);border-top:1px solid var(--line);padding:6px 6px calc(6px + var(--sab));z-index:20}
#tabbar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 0 3px;color:var(--muted);font-size:11px;font-weight:800;border-radius:14px}
#tabbar button.on{color:var(--accent-text)}#tabbar button svg{width:24px;height:24px}
/* sheet */
.sheet-bg{position:fixed;inset:0;background:rgba(20,10,20,.45);z-index:30;animation:fade .2s}
.sheet{position:fixed;left:0;right:0;bottom:0;max-height:90vh;overflow:auto;background:var(--bg);border-radius:26px 26px 0 0;padding:10px 18px calc(22px + var(--sab));z-index:31;animation:up .25s cubic-bezier(.2,.8,.2,1)}
.sheet.full{top:0;max-height:none;border-radius:0;padding-top:14px}
.sheet .grip{width:40px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 12px}
.sheet h3{margin-bottom:8px}.sheet .body p{margin:0 0 12px;line-height:1.55}
.sheet .x{position:absolute;right:14px;top:12px;width:34px;height:34px;border-radius:50%;background:var(--chip);font-weight:900}
@keyframes fade{from{opacity:0}to{opacity:1}}@keyframes up{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
#toast{position:fixed;left:50%;bottom:calc(96px + var(--sab));transform:translateX(-50%) translateY(20px);background:#2A2030;color:#fff;padding:10px 16px;border-radius:14px;font-weight:700;font-size:14px;opacity:0;pointer-events:none;transition:.25s;z-index:40;max-width:88vw;text-align:center}
#toast.show{opacity:1;transform:translateX(-50%)}
/* chat */
.chat{display:flex;flex-direction:column;gap:8px;padding:8px 0 12px}.msg{max-width:86%;padding:10px 13px;border-radius:18px;line-height:1.45;white-space:pre-wrap}
.msg.u{align-self:flex-end;background:var(--accent);color:#fff;border-bottom-right-radius:6px}.msg.a{align-self:flex-start;background:var(--card);box-shadow:var(--shadow);border-bottom-left-radius:6px}
.askbar{display:flex;gap:8px;align-items:flex-end}.askbar textarea{flex:1;min-height:44px;max-height:120px}.askbar .btn{width:auto;padding:12px 16px}
.ex{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
/* partner */
.pv-hero .ring{width:180px;height:180px}
.tips li{margin-bottom:8px;line-height:1.45}
.pv-send{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.pv-send button{background:var(--card);border-radius:16px;padding:12px 4px;box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;gap:4px;font-size:12px;font-weight:800}.pv-send button .em{font-size:24px}
.center{text-align:center}.mt{margin-top:12px}.mb{margin-bottom:12px}.gap{height:8px}
.preg-card{display:flex;gap:14px;align-items:center}.preg-card .em{font-size:44px}
.err-full{min-height:100vh;display:grid;place-items:center;padding:24px;text-align:center;color:var(--muted)}
/* v3: contraception / alerts / pms / charts */
.card.alert{border:1.5px solid var(--accent)}
.al{margin-top:8px;padding:8px 10px;border-radius:12px;background:var(--card2);font-size:13px;line-height:1.4}.al.hot{background:var(--accent-soft);color:var(--accent-text);font-weight:700}
.cell.pms:after{content:'';position:absolute;bottom:2px;left:50%;transform:translateX(-50%);width:14px;height:3px;border-radius:2px;background:var(--lav);opacity:.8}
.cell.p.pms:after,.cell.pp.pms:after{display:none}
.legend .lpms{background:var(--lav);width:14px;height:4px;border-radius:2px}
.logbox .askbar textarea{min-height:40px}
.logbox{padding:12px 14px}
