:root{
  --bg:#faf6f4; --surface:#ffffff; --surface2:#fbf1f3;
  --text:#372530; --muted:#8d7380; --line:#f0e1e6;
  --accent:#d9435f; --accent-strong:#bf3350; --accent-soft:#fbe2e8;
  --fertile:#2e9e6b; --fertile-soft:#dcf2e7;
  --ovu:#6c4ab0; --ovu-soft:#e9e1f8;
  --warn:#b45309; --warn-soft:#fdeedd;
  --shadow:0 12px 34px rgba(125,60,85,.09);
  --radius:18px;
}
html.dark{
  --bg:#161014; --surface:#211a20; --surface2:#2a2028;
  --text:#f4eaee; --muted:#a68e9a; --line:#3a2c35;
  --accent:#ef6a82; --accent-strong:#f48ba0; --accent-soft:#46262f;
  --fertile:#4cc38a; --fertile-soft:#1d3a2d;
  --ovu:#a483e0; --ovu-soft:#322a48;
  --warn:#f0a95c; --warn-soft:#3d2c17;
  --shadow:0 12px 34px rgba(0,0,0,.35);
}
*{box-sizing:border-box;margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  background:var(--bg); color:var(--text); line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
.wrap{max-width:880px;margin:0 auto;padding:0 20px}
header{padding:18px 0}
header .wrap{display:flex;align-items:center;justify-content:space-between}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;font-size:1.05rem;letter-spacing:-.01em}
.logo svg{flex:none}
.theme-btn{
  border:1px solid var(--line);background:var(--surface);color:var(--text);
  border-radius:999px;padding:8px 14px;font-size:.85rem;cursor:pointer;font-weight:600;
}
.hero{text-align:center;padding:34px 0 10px}
.hero h1{font-size:clamp(2rem,5.5vw,3.1rem);letter-spacing:-.03em;line-height:1.12;font-weight:800}
.hero h1 em{font-style:normal;color:var(--accent)}
.hero p{max-width:560px;margin:14px auto 0;color:var(--muted);font-size:1.06rem}
.pills{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:20px}
.pill{
  display:inline-flex;align-items:center;gap:7px;font-size:.82rem;font-weight:700;
  background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:7px 14px;color:var(--muted);
}
.pill svg{color:var(--accent)}
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:28px;margin-top:28px;
}
.mode-switch{display:flex;background:var(--surface2);border-radius:12px;padding:4px;gap:4px;margin-bottom:24px}
.mode-switch button{
  flex:1;border:0;background:transparent;color:var(--muted);font-weight:700;font-size:.9rem;
  padding:10px;border-radius:9px;cursor:pointer;transition:.15s;
}
.mode-switch button.active{background:var(--surface);color:var(--text);box-shadow:0 2px 8px rgba(0,0,0,.07)}
.field{margin-bottom:20px}
.field label{display:block;font-weight:700;font-size:.95rem;margin-bottom:8px}
.field .hint{font-size:.82rem;color:var(--muted);margin-top:6px}
input[type=date]{
  width:100%;padding:13px 14px;border:1.5px solid var(--line);border-radius:12px;
  background:var(--surface);color:var(--text);font-size:1rem;font-family:inherit;
}
input[type=date]:focus{outline:none;border-color:var(--accent)}
.stepper{display:flex;align-items:center;gap:14px}
.step-btn{
  width:44px;height:44px;border-radius:12px;border:1.5px solid var(--line);
  background:var(--surface);color:var(--text);font-size:1.3rem;cursor:pointer;line-height:1;
}
.step-btn:hover{border-color:var(--accent);color:var(--accent)}
.step-val{font-weight:800;font-size:1.05rem;min-width:96px;text-align:center}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:20px}
@media(max-width:600px){.grid2{grid-template-columns:1fr}}
.helper-toggle{
  border:0;background:none;color:var(--accent);font-weight:700;font-size:.88rem;cursor:pointer;
  padding:0;margin-top:2px;font-family:inherit;
}
.helper{
  display:none;background:var(--surface2);border-radius:12px;padding:16px;margin-top:12px;
}
.helper.open{display:block}
.helper input{margin-bottom:10px}
.helper .helper-note{font-size:.85rem;font-weight:700;color:var(--fertile)}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:0;border-radius:12px;padding:14px 22px;font-weight:800;font-size:1rem;cursor:pointer;font-family:inherit;
}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-strong)}
.btn-ghost{background:var(--surface);border:1.5px solid var(--line);color:var(--text)}
.auto-note{text-align:center;font-size:.85rem;color:var(--muted);font-weight:600;margin-top:4px}
.privacy-note{display:flex;gap:8px;align-items:center;justify-content:center;margin-top:14px;font-size:.82rem;color:var(--muted)}
#results{display:none}
#results.show{display:block}
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media(max-width:640px){.stat-grid{grid-template-columns:1fr}}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow)}
.stat .k{font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.stat .v{font-size:1.5rem;font-weight:800;letter-spacing:-.02em;margin-top:6px}
.stat .m{font-size:.85rem;color:var(--muted);margin-top:4px}
.stat-hero{grid-column:1/-1;background:linear-gradient(135deg,var(--accent-soft),var(--surface));border-color:var(--accent-soft)}
.stat-hero .v{font-size:1.9rem;color:var(--accent-strong)}
html.dark .stat-hero .v{color:var(--accent)}
.stat.late{background:linear-gradient(135deg,var(--warn-soft),var(--surface))}
.stat.late .v{color:var(--warn)}
.late-help{display:block;margin-top:10px;font-size:.88rem;font-weight:700;color:var(--warn)}
.progress{height:8px;background:var(--surface2);border-radius:99px;margin-top:12px;overflow:hidden}
.progress i{display:block;height:100%;background:var(--accent);border-radius:99px}
.phase-chip{display:inline-block;background:var(--ovu-soft);color:var(--ovu);font-size:.78rem;font-weight:800;border-radius:99px;padding:3px 10px;margin-left:8px;vertical-align:middle}
.cal-section{margin-top:28px}
.cal-section h2,.faq h2,.how h2{font-size:1.35rem;letter-spacing:-.02em;margin-bottom:6px}
.cal-section .sub{color:var(--muted);font-size:.92rem;margin-bottom:16px}
.months{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
@media(max-width:760px){.months{grid-template-columns:repeat(2,1fr)}}
@media(max-width:520px){.months{grid-template-columns:1fr}}
.month{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px}
.month .name{font-weight:800;font-size:.88rem;margin-bottom:8px;text-align:center}
.mgrid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.mgrid .dow{font-size:.62rem;color:var(--muted);text-align:center;font-weight:700}
.day{
  aspect-ratio:1;display:flex;align-items:center;justify-content:center;
  font-size:.72rem;border-radius:7px;color:var(--muted);font-weight:600;position:relative;
}
.day.period{background:var(--accent-soft);color:var(--accent-strong)}
html.dark .day.period{color:var(--accent)}
.day.fertile{background:var(--fertile-soft);color:var(--fertile)}
.day.ovulation{background:var(--ovu-soft);color:var(--ovu);box-shadow:inset 0 0 0 1.5px var(--ovu)}
.day.range{background:repeating-linear-gradient(45deg,var(--accent-soft),var(--accent-soft) 3px,transparent 3px,transparent 6px);color:var(--accent-strong)}
.day.ovu-range{background:repeating-linear-gradient(45deg,var(--ovu-soft),var(--ovu-soft) 3px,transparent 3px,transparent 6px);color:var(--ovu)}
.day.today{box-shadow:inset 0 0 0 2px var(--text)}
.legend{display:flex;flex-wrap:wrap;gap:16px;margin:0 0 14px;font-size:.82rem;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:7px}
.sw{width:14px;height:14px;border-radius:4px;display:inline-block}
.actions{display:flex;gap:12px;margin-top:22px;flex-wrap:wrap}
.actions .btn{flex:1;min-width:180px}
.how{margin-top:56px}
.steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px;margin-top:18px}
@media(max-width:640px){.steps{grid-template-columns:1fr}}
.step-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.step-card .n{
  width:30px;height:30px;border-radius:99px;background:var(--accent-soft);color:var(--accent-strong);
  display:flex;align-items:center;justify-content:center;font-weight:800;font-size:.9rem;margin-bottom:10px;
}
html.dark .step-card .n{color:var(--accent)}
.step-card h3{font-size:1rem;margin-bottom:6px}
.step-card p{font-size:.88rem;color:var(--muted)}
.faq{margin-top:56px}
.faq details{
  background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px 20px;margin-top:10px;
}
.faq summary{font-weight:700;cursor:pointer;font-size:.98rem}
.faq details p{margin-top:10px;color:var(--muted);font-size:.92rem}
.disclaimer{
  margin:48px 0 0;padding:20px;background:var(--surface2);border-radius:var(--radius);
  font-size:.84rem;color:var(--muted);
}
footer{padding:34px 0 46px;text-align:center;color:var(--muted);font-size:.85rem}
.error-msg{color:var(--warn);font-size:.85rem;font-weight:700;margin-top:8px;display:none}
.cal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.seg{display:flex;background:var(--surface2);border-radius:10px;padding:3px;gap:3px}
.seg button{border:0;background:transparent;color:var(--muted);font-weight:700;font-size:.8rem;padding:6px 12px;border-radius:8px;cursor:pointer;font-family:inherit}
.seg button.active{background:var(--surface);color:var(--text);box-shadow:0 2px 6px rgba(0,0,0,.06)}
.table-title{margin-top:28px;font-size:1.05rem}
.table-wrap{overflow-x:auto;margin-top:10px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
table{width:100%;border-collapse:collapse;font-size:.88rem;min-width:520px}
th{text-align:left;padding:10px 14px;background:var(--surface2);font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}
td{padding:10px 14px;border-top:1px solid var(--line)}
td.num{color:var(--muted);font-weight:700;width:36px}
.stat-strip{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.stat-strip span{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:7px 14px;font-size:.8rem;font-weight:600;color:var(--muted)}
.stat-strip b{color:var(--text)}
.history{margin-top:10px}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.chip{background:var(--surface2);border:1px solid var(--line);border-radius:999px;padding:5px 12px;font-size:.8rem;font-weight:700;color:var(--muted)}
.hist-avg{font-size:.85rem;font-weight:700;color:var(--fertile);margin-top:10px}
.hist-avg button{border:0;background:var(--fertile);color:#fff;border-radius:999px;padding:3px 12px;font-weight:700;font-size:.78rem;cursor:pointer;margin-left:6px;font-family:inherit}
.toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%) translateY(16px);background:var(--text);color:var(--bg);padding:10px 20px;border-radius:999px;font-size:.85rem;font-weight:700;opacity:0;pointer-events:none;transition:.25s;z-index:50}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.print-head{display:none}
@media print{
  header,.hero,.card,.how,.faq,.disclaimer,.actions,.privacy-note,.auto-note,footer,.theme-btn,.seg,.toast,#logBtn,.history,.helper,.helper-toggle{display:none!important}
  body{background:#fff}
  .stat,.month{box-shadow:none;break-inside:avoid}
  .print-head{display:block;font-weight:800;font-size:1.05rem;margin-bottom:14px}
  .table-wrap{border-radius:0}
  table{font-size:.72rem;min-width:0}
  th,td{padding:6px 8px}
}
.article{max-width:760px;margin:34px auto 0}
.article h1{font-size:clamp(1.8rem,4.5vw,2.6rem);letter-spacing:-.02em;line-height:1.15}
.article .lead{color:var(--muted);font-size:1.05rem;margin-top:12px}
.byline{display:flex;flex-wrap:wrap;gap:8px 18px;color:var(--muted);font-size:.84rem;margin-top:16px;font-weight:600}
.article h2{font-size:1.3rem;letter-spacing:-.015em;margin:36px 0 10px}
.article p{margin:10px 0}
.article p,.article li{font-size:.98rem}
.article a{color:var(--accent);font-weight:600;text-decoration:none}
.article a:hover{text-decoration:underline}
.refs{margin-top:30px;background:var(--surface2);border-radius:var(--radius);padding:18px 20px;font-size:.85rem}
.refs h2{margin:0 0 10px;font-size:1rem}
.refs li{margin:6px 0 6px 18px;color:var(--muted)}
.refs a{color:var(--muted);font-weight:500;word-break:break-all}
.footer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:24px;text-align:left;margin-bottom:26px}
.footer-grid h3{font-size:.8rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:10px}
.footer-grid a{display:block;color:var(--text);text-decoration:none;font-size:.9rem;margin:6px 0;font-weight:600}
.footer-grid a:hover{color:var(--accent)}
.crumbs{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:.82rem;color:var(--muted);max-width:880px;margin:0 auto;padding:16px 20px 0}
.crumbs a{color:var(--muted);text-decoration:none;font-weight:600}
.crumbs a:hover{color:var(--accent)}
.crumbs .sep{opacity:.6}
.crumbs .current{color:var(--text);font-weight:700}
.hub{max-width:880px;margin:30px auto 0}
.hub h1{font-size:clamp(1.8rem,4.5vw,2.4rem);letter-spacing:-.02em}
.hub .lead{color:var(--muted);margin-top:10px}
.hub-grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));margin-top:20px}
.hub-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px;text-decoration:none;color:inherit;display:block}
.hub-card:hover{border-color:var(--accent)}
.hub-card h3{font-size:1rem;margin-bottom:6px}
.hub-card p{font-size:.88rem;color:var(--muted)}
.header-row{display:flex;align-items:center;gap:14px;justify-content:space-between}
.topnav{display:flex;gap:2px;flex-wrap:wrap}
.topnav a{color:var(--muted);text-decoration:none;font-weight:700;font-size:.9rem;padding:8px 13px;border-radius:999px}
.topnav a:hover{color:var(--text);background:var(--surface2)}
.topnav a[aria-current="page"]{color:var(--text);background:var(--surface2)}
@media(max-width:760px){.header-row{flex-wrap:wrap}.topnav{order:3;width:100%;margin-top:2px}}
.logo svg{height:42px;width:auto;display:block}
.logo svg text:first-of-type{fill:var(--text)}
.logo svg text:last-of-type{fill:var(--accent)}
.print-head img{height:26px;vertical-align:-6px;margin-right:10px}
.dp{position:relative}
.dp-field{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:13px 14px;border:1.5px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);font-size:1rem;font-weight:600;cursor:pointer;font-family:inherit;text-align:left}
.dp-field:hover{border-color:var(--accent)}
.dp-label.empty{color:var(--muted);font-weight:500}
.dp-field svg{color:var(--accent);flex:none}
.dp-pop{position:absolute;top:calc(100% + 8px);left:0;z-index:40;width:296px;max-width:100%;background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:14px;animation:dp-in .16s ease}
@keyframes dp-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.dp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.dp-month{font-weight:800;font-size:.92rem}
.dp-nav{width:32px;height:32px;border:0;background:var(--surface2);border-radius:9px;color:var(--text);font-size:1.1rem;cursor:pointer;line-height:1}
.dp-nav:hover{background:var(--accent-soft);color:var(--accent)}
.dp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.dp-dow{font-size:.64rem;color:var(--muted);text-align:center;font-weight:700;padding:4px 0}
.dp-day{aspect-ratio:1;border:0;background:none;border-radius:9px;font-size:.82rem;font-weight:600;color:var(--text);cursor:pointer;font-family:inherit}
.dp-day:hover:not(:disabled){background:var(--surface2)}
.dp-day.today{box-shadow:inset 0 0 0 1.5px var(--accent)}
.dp-day.sel{background:var(--accent);color:#fff}
.dp-day:disabled{color:var(--muted);opacity:.4;cursor:default}
.byline a{color:var(--accent);font-weight:700;text-decoration:none}
.byline a:hover{text-decoration:underline}
