/* Tide — cycle & support PWA */
:root {
  --bg: #120e19;
  --bg-2: #191322;
  --card: #1f1829;
  --card-2: #251d31;
  --fg: #f4eff8;
  --muted: #a89fb8;
  --dim: #7d7489;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #e05c74;
  --ok: #4fc3a1;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(224, 92, 116, 0.16), transparent 70%),
    radial-gradient(90% 50% at 100% 0%, rgba(79, 195, 161, 0.08), transparent 60%),
    var(--bg);
  min-height: 100dvh;
}

button, input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.app {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px calc(96px + var(--safe-b));
  min-height: 100dvh;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 2px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, var(--bg) 55%, rgba(18, 14, 25, 0.75) 80%, transparent);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.02em; font-size: 17px; }
.brand svg { display: block; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: color-mix(in srgb, var(--accent) 60%, white);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- generic ---------- */
h1 { font-size: 30px; line-height: 1.12; letter-spacing: -0.03em; margin: 4px 0 8px; font-weight: 680; }
h2 { font-size: 19px; line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 640; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 640; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.tight { padding: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }
.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--dim); font-weight: 700; margin-bottom: 8px;
}
.accent { color: var(--accent); }
.phase-ink { color: color-mix(in srgb, var(--accent) 75%, white); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 20px 18px 16px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%),
    linear-gradient(180deg, var(--card-2), var(--bg-2));
}
.hero .day {
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--accent) 70%, white);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  padding: 5px 10px; border-radius: 999px;
}
.hero h1 { font-size: 32px; }
.hero .blurb { color: color-mix(in srgb, var(--fg) 82%, var(--muted)); font-size: 15px; line-height: 1.45; margin: 0; }
.hero-curve { margin: 14px -6px -6px; display: block; width: calc(100% + 12px); height: auto; }

/* ---------- stat grid ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 10px; text-align: left;
}
.stat .k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat .v { font-size: 17px; font-weight: 660; letter-spacing: -0.02em; margin-top: 4px; }
.stat .s { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- lists ---------- */
.why { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.why:last-child { border-bottom: 0; padding-bottom: 0; }
.why:first-child { padding-top: 0; }
.why .n { flex: 0 0 auto; font-size: 16px; line-height: 1.3; opacity: 0.9; }
.why .t { font-size: 14.5px; font-weight: 600; }
.why .d { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }

.bullets { margin: 0; padding-left: 18px; }
.bullets li { font-size: 14.5px; line-height: 1.5; margin-bottom: 7px; color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }
.bullets li:last-child { margin-bottom: 0; }

.do-dont { display: grid; gap: 10px; }
@media (min-width: 520px) { .do-dont { grid-template-columns: 1fr 1fr; } }
.dd { border-radius: 14px; padding: 13px 14px; border: 1px solid var(--line); }
.dd.do { background: color-mix(in srgb, var(--ok) 9%, var(--card)); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.dd.dont { background: color-mix(in srgb, var(--accent) 9%, var(--card)); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.dd .h { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.dd.do .h { color: var(--ok); }
.dd.dont .h { color: color-mix(in srgb, var(--accent) 80%, white); }
.dd ul { margin: 0; padding-left: 16px; }
.dd li { font-size: 13.5px; line-height: 1.45; margin-bottom: 6px; color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }
.dd li:last-child { margin-bottom: 0; }

.quote {
  border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding: 2px 0 2px 12px; margin: 0 0 10px;
  font-size: 14.5px; line-height: 1.45; color: color-mix(in srgb, var(--fg) 90%, var(--muted));
}
.quote:last-child { margin-bottom: 0; }

/* ---------- chips / buttons ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 13px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-strong);
  font-size: 13.5px; font-weight: 550; color: var(--fg);
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip:active { transform: scale(0.97); }
.chip.on {
  background: color-mix(in srgb, var(--accent) 22%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 13px;
  background: var(--card-2); border: 1px solid var(--line-strong);
  font-size: 15px; font-weight: 620; width: 100%;
}
.btn.primary {
  background: color-mix(in srgb, var(--accent) 88%, white 4%);
  border-color: transparent; color: #17060c;
}
.btn.ghost { background: transparent; }
.btn:active { transform: scale(0.99); }
.btn.sm { width: auto; padding: 9px 13px; font-size: 13.5px; border-radius: 11px; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 40%, rgba(18, 14, 25, 0.86));
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs-inner { display: flex; width: 100%; max-width: 620px; justify-content: space-between; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px; color: var(--dim); font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  border-radius: 12px;
}
.tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: color-mix(in srgb, var(--accent) 78%, white); }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .m { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); color: var(--fg); font-size: 16px;
}
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 4px; }
.day-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 550; color: var(--fg);
  border: 1px solid transparent;
}
.day-cell.out { color: var(--dim); opacity: 0.4; }
.day-cell.today { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }
.day-cell.period { background: color-mix(in srgb, #e05c74 26%, transparent); color: #fff; }
.day-cell.pred { background: color-mix(in srgb, #e05c74 11%, transparent); border: 1px dashed color-mix(in srgb, #e05c74 45%, transparent); }
.day-cell.fertile { background: color-mix(in srgb, #4fc3a1 10%, transparent); }
.day-cell .dot { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.day-cell .ov { position: absolute; top: 4px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: #f0a04b; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: 11.5px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* ---------- bars / insights ---------- */
.bar-row { margin-bottom: 10px; }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; color: var(--muted); }
.bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.obs { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.obs:first-of-type { border-top: 0; }
.obs .b { color: var(--accent); font-weight: 700; }

/* ---------- sheet ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(6, 4, 10, 0.62); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.sheet-wrap.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 620px; max-height: 88dvh; overflow-y: auto;
  background: var(--bg-2); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line-strong);
  padding: 10px 18px calc(20px + var(--safe-b));
  transform: translateY(14px); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}
.sheet-wrap.open .sheet { transform: none; }
.grabber { width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 4px auto 14px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
input[type="text"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; padding: 12px 13px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line-strong); color: var(--fg);
  font-size: 16px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
textarea { min-height: 72px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 30px; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 10px 4px; border-radius: 11px; font-size: 12.5px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.seg button.on { background: color-mix(in srgb, var(--accent) 20%, var(--card)); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: #fff; }
.sheet-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translate(-50%, 12px);
  background: #2c2440; color: var(--fg); border: 1px solid var(--line-strong);
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 550;
  z-index: 80; opacity: 0; pointer-events: none; transition: all 0.2s ease; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- onboarding ---------- */
.onboard { padding-top: 10px; }
.onboard h1 { font-size: 34px; }
.logo-big { display: flex; justify-content: center; padding: 18px 0 14px; }

/* ---------- misc ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }
.seg-tabs { display: flex; gap: 6px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 12px; }
.seg-tabs button { flex: 1; padding: 9px 6px; border-radius: 10px; font-size: 13.5px; font-weight: 620; color: var(--muted); }
.seg-tabs button.on { background: var(--card-2); color: var(--fg); box-shadow: 0 1px 0 var(--line-strong) inset; }
.check { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.check:last-child { border-bottom: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.check.on span { color: var(--dim); text-decoration: line-through; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { border-top: 0; }
summary { font-size: 15px; font-weight: 620; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--dim); font-weight: 400; }
details[open] summary::after { content: "–"; }
details .dbody { padding-top: 10px; font-size: 14px; line-height: 1.5; color: color-mix(in srgb, var(--fg) 84%, var(--muted)); }
details .dbody p { margin-bottom: 8px; }
.warn {
  border: 1px solid color-mix(in srgb, #d3a839 34%, transparent);
  background: color-mix(in srgb, #d3a839 8%, var(--card));
  border-radius: 14px; padding: 13px 14px; font-size: 13px; line-height: 1.45;
  color: color-mix(in srgb, var(--fg) 88%, #d3a839);
}
.foot { text-align: center; font-size: 11.5px; color: var(--dim); padding: 18px 0 4px; line-height: 1.5; }
