:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef7f3;
  --ink: #1d2522;
  --muted: #66716d;
  --line: #dce3e0;
  --line-strong: #c6d0cc;
  --green: #147d64;
  --green-dark: #0d5e4a;
  --green-soft: #dff2ea;
  --coral: #d76052;
  --coral-soft: #fbe9e6;
  --amber: #b87910;
  --amber-soft: #fff3d6;
  --blue: #4276a8;
  --blue-soft: #e6f0fa;
  --shadow: 0 10px 28px rgba(29, 37, 34, 0.07);
  --radius: 6px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

.static-seo-fallback { width: min(820px, calc(100% - 40px)); margin: 60px auto; }
.static-seo-fallback h1 { margin: 0 0 14px; font-size: 34px; line-height: 1.2; }
.static-seo-fallback p { color: var(--muted); font-size: 16px; line-height: 1.7; }

button, input, select { font: inherit; letter-spacing: 0; }
button, a, select, input[type="checkbox"] { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
svg { display: block; flex: 0 0 auto; }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 64px;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  text-decoration: none;
  border-right: 1px solid var(--line);
  font-size: 18px;
  font-weight: 760;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: white;
  background: var(--green);
  font-size: 16px;
  font-weight: 800;
}

.mobile-tool-name {
  overflow: hidden;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-controls { display: flex; align-items: center; gap: 8px; padding-right: 20px; }

.compact-select {
  height: 38px;
  max-width: 158px;
  padding: 0 31px 0 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
}

.layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 14px 24px;
}

.nav-label {
  margin: 12px 10px 7px;
  color: #8a938f;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tool-nav { display: grid; gap: 3px; }

.nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 5px;
  color: #4c5753;
  text-decoration: none;
  font-size: 13px;
  font-weight: 620;
}

.nav-link:hover { background: #f2f5f4; color: var(--ink); }
.nav-link.active { color: var(--green-dark); background: var(--green-soft); }
.nav-link.health.active { color: #a5443a; background: var(--coral-soft); }
.nav-link svg { width: 17px; height: 17px; }

.sidebar-note {
  margin: 22px 10px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.content { min-width: 0; }

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 86px;
  border-bottom: 1px solid var(--line);
  color: #909995;
  background: #f8faf9;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ad-slot > .adsbygoogle { width: 100%; }

.main-wrap {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 32px 28px 54px;
}

.tool-heading { margin-bottom: 24px; }
.tool-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--green); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.tool-kicker.health { color: var(--coral); }
.tool-kicker svg { width: 15px; height: 15px; }
.tool-heading h1 { margin: 0; max-width: 760px; font-size: 30px; line-height: 1.18; letter-spacing: 0; }
.tool-heading p { max-width: 720px; margin: 9px 0 0; color: var(--muted); font-size: 15px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }

.calculator {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-area { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { display: block; margin-bottom: 7px; color: #37413d; font-size: 13px; font-weight: 680; }

.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  color: var(--ink);
  background: white;
}

.field input:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 125, 100, .12); }
.health-theme .field input:focus, .health-theme .field select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(215, 96, 82, .12); }

.switch-row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.check-label { display: inline-flex; align-items: center; gap: 9px; color: #46504c; font-size: 13px; }
.check-label input { width: 17px; height: 17px; accent-color: var(--green); }
.health-theme .check-label input { accent-color: var(--coral); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #f0f3f2; }
.segment { min-height: 36px; padding: 6px 10px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 650; }
.segment.active { color: var(--green-dark); background: white; box-shadow: 0 1px 4px rgba(29,37,34,.1); }

.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.primary-button, .secondary-button, .icon-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 5px;
  font-weight: 720;
}
.primary-button { padding: 0 18px; border: 1px solid var(--green); color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); border-color: var(--green-dark); }
.health-theme .primary-button { border-color: var(--coral); background: var(--coral); }
.health-theme .primary-button:hover { border-color: #b94b40; background: #b94b40; }
.secondary-button { padding: 0 14px; border: 1px solid var(--line-strong); color: #4e5955; background: white; }
.secondary-button:hover { background: #f5f7f6; }
.primary-button svg, .secondary-button svg { width: 17px; height: 17px; }
.icon-button { width: 38px; min-height: 38px; border: 1px solid var(--line); color: var(--ink); background: white; }
.icon-button svg { width: 17px; height: 17px; }

.error-message { display: none; margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid #b7443c; color: #8b322c; background: #fff1ef; font-size: 13px; }
.error-message.show { display: block; }

.result-area { border-top: 1px solid var(--line); background: #fbfcfc; }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 24px; border-bottom: 1px solid var(--line); }
.result-header h2 { margin: 0; font-size: 15px; }
.result-badge { padding: 4px 8px; border-radius: 4px; color: var(--green-dark); background: var(--green-soft); font-size: 11px; font-weight: 750; }
.health-theme .result-badge { color: #a5443a; background: var(--coral-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { min-width: 0; padding: 22px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat:nth-child(3n) { border-right: 0; }
.stat-value { overflow-wrap: anywhere; color: var(--ink); font-size: 26px; font-weight: 770; line-height: 1.15; }
.stat-value.accent { color: var(--green); }
.health-theme .stat-value.accent { color: var(--coral); }
.stat-label { margin-top: 5px; color: var(--muted); font-size: 12px; }

.detail-section { padding: 22px 24px 24px; }
.detail-section + .detail-section { border-top: 1px solid var(--line); }
.detail-title { margin: 0 0 13px; font-size: 14px; }
.detail-list { margin: 0; padding: 0; list-style: none; }
.detail-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid #e8ecea; font-size: 13px; }
.detail-item:last-child { border-bottom: 0; }
.detail-item span:last-child { color: var(--muted); text-align: right; }
.detail-empty { color: var(--muted); font-size: 13px; }

.side-rail { display: grid; gap: 16px; }
.side-ad { min-height: 270px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfb; }
.side-panel { padding: 18px; border-left: 3px solid var(--green); background: var(--surface); }
.health-theme + .side-rail .side-panel { border-left-color: var(--coral); }
.side-panel h3 { margin: 0 0 8px; font-size: 13px; }
.side-panel p { margin: 0; color: var(--muted); font-size: 12px; }

.inline-ad { min-height: 110px; border-top: 1px solid var(--line); border-bottom: 0; }

.calendar-wrap { overflow-x: auto; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.calendar-toolbar h3 { margin: 0; font-size: 14px; }
.calendar-actions { display: flex; gap: 6px; }
.calendar { min-width: 560px; display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.weekday { padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); background: #f5f7f6; font-size: 11px; font-weight: 750; text-align: center; }
.day-cell { position: relative; min-height: 72px; padding: 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; font-size: 12px; }
.day-cell.muted { color: #a7afac; background: #fafbfb; }
.day-number { position: relative; z-index: 2; display: inline-grid; min-width: 24px; height: 24px; place-items: center; border-radius: 50%; }
.day-cell.today .day-number { color: white; background: var(--ink); }
.day-cell.shift-work { background: var(--green-soft); }
.day-cell.shift-off { background: #f2f4f3; }
.day-cell.period { background: var(--coral-soft); }
.day-cell.fertile { background: var(--amber-soft); }
.day-cell.ovulation { background: var(--blue-soft); }
.cell-label { display: block; margin-top: 12px; color: var(--muted); font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 2px; }

.countdown { padding: 28px 24px; text-align: center; }
.countdown-name { margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 650; }
.countdown-parts { display: flex; justify-content: center; align-items: flex-start; gap: 8px; }
.countdown-part { min-width: 72px; }
.countdown-number { display: block; font-size: 32px; font-weight: 800; line-height: 1.1; }
.countdown-unit { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.countdown-colon { padding-top: 4px; font-size: 24px; color: var(--line-strong); }

.progress-track { height: 8px; overflow: hidden; border-radius: 4px; background: #e5eae8; }
.progress-bar { height: 100%; border-radius: 4px; background: var(--green); }
.health-theme .progress-bar { background: var(--coral); }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 11px; }

.milestone-list { display: grid; gap: 0; }
.milestone { display: grid; grid-template-columns: 64px 1fr; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.milestone:last-child { border-bottom: 0; }
.milestone-week { color: var(--coral); font-size: 12px; font-weight: 750; }
.milestone-copy strong { display: block; margin-bottom: 2px; font-size: 13px; }
.milestone-copy span { color: var(--muted); font-size: 12px; }

.home-main { padding-top: 34px; }
.home-heading { max-width: 820px; }
.home-heading h1 { font-size: 34px; }
.home-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 4px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.home-stat { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); }
.home-stat:last-child { border-right: 0; }
.home-stat strong { display: block; color: var(--green); font-size: 24px; line-height: 1.15; }
.home-stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.directory-section { margin-top: 30px; }
.directory-section + .directory-section { padding-top: 30px; border-top: 1px solid var(--line); }
.directory-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.directory-heading h2 { margin: 0; font-size: 18px; }
.directory-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.home-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-tool {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
}
.home-tool:hover { border-color: #9fcabc; box-shadow: 0 7px 20px rgba(29, 37, 34, .06); }
.health-directory .home-tool:hover { border-color: #e6b0aa; }
.home-tool-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 5px; color: var(--green); background: var(--green-soft); }
.health-directory .home-tool-icon { color: var(--coral); background: var(--coral-soft); }
.home-tool-icon svg { width: 18px; height: 18px; }
.home-tool > svg { width: 16px; height: 16px; color: #9aa29f; }
.home-tool strong { display: block; margin-bottom: 3px; font-size: 14px; }
.home-tool small { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.seo-content { max-width: 860px; margin-top: 46px; padding-top: 34px; border-top: 1px solid var(--line-strong); }
.seo-block + .seo-block { margin-top: 32px; }
.seo-block h2 { margin: 0 0 11px; font-size: 20px; }
.seo-block p { margin: 0 0 12px; color: #56615d; line-height: 1.75; }
.steps-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.steps-list li { position: relative; min-height: 34px; padding: 6px 0 6px 44px; color: #46514d; counter-increment: steps; }
.steps-list li::before {
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-dark);
  background: var(--green-soft);
  content: counter(steps);
  font-size: 12px;
  font-weight: 800;
}
.faq-section details { border-top: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 1px solid var(--line); }
.faq-section summary { position: relative; padding: 15px 30px 15px 0; cursor: pointer; font-weight: 680; list-style: none; }
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { position: absolute; right: 4px; top: 13px; color: var(--muted); content: "+"; font-size: 20px; font-weight: 400; }
.faq-section details[open] summary::after { content: "−"; }
.faq-section details p { padding: 0 30px 15px 0; font-size: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.related-link { min-width: 0; display: grid; grid-template-columns: 20px minmax(0, 1fr) 16px; align-items: center; gap: 9px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 5px; color: #44504b; background: white; text-decoration: none; font-size: 13px; font-weight: 650; }
.related-link:hover { border-color: #9fcabc; color: var(--green-dark); }
.related-link svg { width: 16px; height: 16px; }

[dir="rtl"] .steps-list li { padding: 6px 44px 6px 0; }
[dir="rtl"] .steps-list li::before { right: 0; left: auto; }
[dir="rtl"] .faq-section summary { padding: 15px 0 15px 30px; }
[dir="rtl"] .faq-section summary::after { right: auto; left: 4px; }
[dir="rtl"] .faq-section details p { padding: 0 0 15px 30px; }

.info-page { max-width: 840px; padding: 8px 0 30px; }
.info-page h2 { margin: 30px 0 8px; font-size: 20px; }
.info-page p, .info-page li { color: #56615d; }
.info-page ul { padding-left: 20px; }
.policy-meta { padding: 12px 14px; border-left: 3px solid var(--green); background: var(--green-soft); color: var(--green-dark); font-size: 13px; }

.footer { padding: 24px 28px 30px; border-top: 1px solid var(--line); color: var(--muted); background: white; }
.footer-inner { width: min(1180px, 100%); margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; font-size: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer a:hover { color: var(--green); }

.cookie-banner {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  width: min(430px, calc(100% - 40px));
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 18px 52px rgba(29,37,34,.18);
}
.cookie-banner h2 { margin: 0 0 6px; font-size: 15px; }
.cookie-banner p { margin: 0; color: var(--muted); font-size: 12px; }
.cookie-actions { display: flex; gap: 8px; margin-top: 14px; }
.cookie-actions button { min-height: 36px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

[dir="rtl"] .brand { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .side-panel, [dir="rtl"] .policy-meta { border-left: 0; border-right: 3px solid var(--green); }
[dir="rtl"] .compact-select { padding: 0 11px 0 31px; }

@media (max-width: 1020px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .side-rail { grid-template-columns: 1fr; }
  .side-ad { min-height: 110px; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand { width: auto; padding: 0 14px; border-right: 0; }
  .brand-name { display: none; }
  .layout { display: block; }
  .sidebar { position: static; width: 100%; height: auto; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar { display: flex; gap: 5px; }
  .tool-nav { display: contents; }
  .nav-label, .sidebar-note { display: none; }
  .nav-link { min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); white-space: nowrap; }
  .nav-link.active { border-color: #b8dbcf; }
  .main-wrap { padding: 26px 20px 44px; }
  .tool-heading h1 { font-size: 26px; }
}

@media (max-width: 620px) {
  .topbar { height: auto; min-height: 58px; grid-template-columns: auto minmax(0, 1fr); }
  .brand { height: 58px; }
  .brand-mark { width: 29px; height: 29px; }
  .mobile-tool-name { padding: 0 12px 0 0; text-align: right; }
  .context-controls { grid-column: 1 / -1; padding: 8px 12px; border-top: 1px solid var(--line); background: #fafbfb; }
  .compact-select { width: 50%; max-width: none; }
  .sidebar { top: 102px; }
  .ad-slot { min-height: 68px; }
  .main-wrap { padding: 22px 14px 36px; }
  .tool-heading { margin-bottom: 18px; }
  .tool-heading h1 { font-size: 23px; }
  .tool-heading p { font-size: 14px; }
  .home-heading h1 { font-size: 26px; }
  .home-overview { grid-template-columns: 1fr; }
  .home-stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .home-stat:last-child { border-bottom: 0; }
  .directory-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .home-tool-grid, .related-grid { grid-template-columns: 1fr; }
  .seo-content { margin-top: 36px; padding-top: 28px; }
  .seo-block h2 { font-size: 18px; }
  .form-area { padding: 18px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; gap: 15px; }
  .field.full { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions button { width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 18px; }
  .stat:nth-child(3n) { border-right: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat-value { font-size: 22px; }
  .detail-section, .result-header { padding-left: 18px; padding-right: 18px; }
  .countdown-part { min-width: 52px; }
  .countdown-number { font-size: 25px; }
  .countdown-colon { font-size: 18px; }
  .footer { padding-left: 16px; padding-right: 16px; }
  .footer-inner { flex-direction: column; }
}

@media print {
  .topbar, .sidebar, .ad-slot, .side-rail, .footer, .cookie-banner, .form-actions { display: none !important; }
  .layout, .workspace-grid { display: block; }
  .main-wrap { width: 100%; padding: 0; }
  .calculator { box-shadow: none; }
}
