:root {
  --bg: #f6f1ea;
  --surface: #ffffff;
  --surface-2: #faf7f2;
  --ink: #2a2830;
  --muted: #7b7684;
  --line: #e7e0d6;
  --accent: #4f8574;
  --accent-ink: #ffffff;
  --accent-soft: #e2eee8;
  --accent-mid: #a9cbbd;
  --warm: #e0745a;
  --period: #c4527a;
  --period-soft: #f7e3ea;
  --shadow: 0 1px 2px rgba(60, 45, 30, .05), 0 8px 24px rgba(60, 45, 30, .06);
  --radius: 22px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151b;
    --surface: #211f28;
    --surface-2: #1b1a21;
    --ink: #f1ece4;
    --muted: #a19ba9;
    --line: #34313d;
    --accent: #7dbba5;
    --accent-ink: #11231d;
    --accent-soft: #24352f;
    --accent-mid: #3f6a5c;
    --period: #e88aab;
    --period-soft: #3a2630;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #16151b;
    --surface: #211f28;
    --surface-2: #1b1a21;
    --ink: #f1ece4;
    --muted: #a19ba9;
    --line: #34313d;
    --accent: #7dbba5;
    --accent-ink: #11231d;
    --accent-soft: #24352f;
    --accent-mid: #3f6a5c;
    --period: #e88aab;
    --period-soft: #3a2630;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
}

/* ---------- Header ---------- */
.hero { padding: 8px 4px 18px; }
.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -.01em;
}
.hero .sub { margin: 8px 0 0; color: var(--muted); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

h2 { font-size: 17px; font-weight: 600; margin: 0; }
.hint { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card > h2 + .chips, .card > .hint + .chips { margin-top: 14px; }
.card.soft { background: var(--accent-soft); box-shadow: none; }

/* ---------- Pain ---------- */
.pain-card { --pain-color: var(--line); }
.pain-display { display: flex; align-items: center; gap: 14px; margin: 16px 0 10px; }
.pain-num {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 36px; font-weight: 600;
  background: var(--pain-color);
  color: #fff;
  transition: background .25s ease, transform .15s ease;
  flex: none;
}
.pain-num.empty { background: var(--surface-2); color: var(--muted); border: 2px dashed var(--line); }
.pain-word { font-size: 20px; font-weight: 600; }
.pain-sub { font-size: 14px; color: var(--muted); }

input[type=range].pain {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; background: transparent; margin: 0;
}
input[type=range].pain::-webkit-slider-runnable-track {
  height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, #6fae8e, #b9bf63 30%, #e9a857 50%, #e0745a 70%, #b03f5b);
}
input[type=range].pain::-moz-range-track {
  height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, #6fae8e, #b9bf63 30%, #e9a857 50%, #e0745a 70%, #b03f5b);
}
input[type=range].pain::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; border-radius: 50%;
  margin-top: -11px;
  background: #fff; border: 4px solid var(--pain-color);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
input[type=range].pain::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 4px solid var(--pain-color);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.pain-card.unset input[type=range].pain::-webkit-slider-thumb { border-color: var(--muted); }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 2px; }

.when { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.linkish {
  background: none; border: 0; padding: 4px 2px; color: var(--accent); font-weight: 600; font-size: 14px;
}
.when-input {
  margin-top: 12px; width: 100%; padding: 10px 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2);
}
.quick-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; }

/* ---------- Body map ---------- */
.bodymap-wrap { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.bodymap { width: 46%; max-width: 200px; flex: none; }
.bodymap .figure { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.bodymap .zone {
  fill: var(--accent-soft); stroke: var(--surface); stroke-width: 2.5;
  cursor: pointer; transition: fill .15s ease;
}
.bodymap .zone.on { fill: var(--warm); }
.bodymap .side { font-size: 11px; fill: var(--muted); font-family: var(--sans); font-weight: 600; }
.loc-list { flex: 1; font-size: 15px; min-width: 0; }
.loc-list ul { list-style: none; margin: 0; padding: 0; }
.loc-list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.loc-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warm); flex: none; }
.loc-list .empty { color: var(--muted); font-size: 14px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  line-height: 1.2;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  min-height: 40px;
}
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.add { border-style: dashed; color: var(--muted); }
.chip-input {
  border: 1.5px solid var(--accent); border-radius: 999px; padding: 8px 14px; min-height: 40px;
  background: var(--surface); width: 170px; outline: none;
}
.chip .dots { display: inline-flex; gap: 3px; }
.chip .dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .25; }
.chip[data-level="1"] { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--ink); }
.chip[data-level="2"] { background: var(--accent-mid); border-color: var(--accent-mid); color: var(--ink); }
.chip[data-level="3"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip[data-level="1"] .dots i:nth-child(-n+1),
.chip[data-level="2"] .dots i:nth-child(-n+2),
.chip[data-level="3"] .dots i:nth-child(-n+3) { opacity: 1; }

/* ---------- Faces ---------- */
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.face-btn {
  border: 1.5px solid transparent; background: var(--surface-2); border-radius: 16px;
  padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted);
}
.face-btn svg { width: 34px; height: 34px; }
.face-btn .f-bg { fill: var(--line); }
.face-btn .f-ln { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.face-btn .f-eye { fill: var(--ink); }
.face-btn[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.face-btn[aria-pressed=true] .f-bg { fill: var(--accent-mid); }

textarea {
  width: 100%; min-height: 96px; margin-top: 12px; resize: vertical;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-2);
  outline: none;
}
textarea:focus, .when-input:focus, .text-input:focus { border-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 600; font-size: 16px;
  background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: #c4473f; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1 1 140px; }

.save-bar {
  position: sticky;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 10px);
  margin-top: 16px; z-index: 5;
}
.save-bar .btn { width: 100%; padding: 17px; font-size: 17px; border-radius: 18px; box-shadow: 0 10px 24px rgba(40, 80, 66, .28); }

/* ---------- Tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 140px; height: var(--tabbar);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.active { color: var(--accent); }
.tabs a.active svg { stroke-width: 2.2; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 84px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-weight: 600; font-size: 15px; transition: all .25s ease; z-index: 30; max-width: calc(100% - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Banner ---------- */
.banner {
  display: flex; gap: 12px; align-items: center;
  background: var(--accent-soft); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px;
}
.banner p { margin: 0; flex: 1; font-size: 14px; }
.banner strong { display: block; font-size: 15px; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1; border-radius: 12px; border: 0; background: var(--surface-2);
  font-size: 14px; font-weight: 500; position: relative; padding: 0;
  display: grid; place-items: center;
}
.cal-day.has { color: #fff; font-weight: 700; }
.cal-day.future { opacity: .35; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.cal-day.blank { background: none; }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend .bar { flex: 1; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #6fae8e, #b9bf63 30%, #e9a857 50%, #e0745a 70%, #b03f5b); }

/* ---------- Entries ---------- */
.entry { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.entry:first-of-type { border-top: 0; padding-top: 6px; }
.entry-top { display: flex; align-items: center; gap: 12px; }
.badge {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-family: var(--serif); font-size: 18px; flex: none;
}
.entry-time { font-weight: 600; }
.entry-sub { font-size: 14px; color: var(--muted); }
.entry dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.entry dt { color: var(--muted); }
.entry dd { margin: 0; }
.entry .note { margin: 10px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.entry .btn-row { margin-top: 10px; }
.empty-state { text-align: center; color: var(--muted); padding: 10px 0; }
.empty-state p { margin: 0 0 12px; }

/* ---------- Insights ---------- */
.seg { display: flex; background: var(--surface); border-radius: 14px; padding: 4px; gap: 4px; box-shadow: var(--shadow); margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat .v small { font-family: var(--sans); font-size: 14px; color: var(--muted); font-weight: 500; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.chart { width: 100%; height: auto; display: block; margin-top: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.bars { list-style: none; padding: 0; margin: 14px 0 0; }
.bars li { margin-bottom: 10px; }
.bars .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.bars .row span:last-child { color: var(--muted); white-space: nowrap; }
.bars .track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bars .fill.warm { background: var(--warm); }
.caveat { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.mini-cols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; align-items: end; height: 140px; }
.mini-cols div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 12px; color: var(--muted); text-align: center; }
.mini-cols .col { width: 100%; max-width: 40px; border-radius: 8px 8px 4px 4px; min-height: 3px; }
.mini-cols b { color: var(--ink); font-size: 13px; }

/* ---------- More ---------- */
.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.text-input, select.text-input {
  width: 100%; padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); outline: none;
}
.manage { margin-top: 14px; }
.manage h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.manage .chip, .chips.editing .chip { padding-right: 8px; }
.chips.editing .chip { border-style: dashed; }
.manage .chip .x, .chips.editing .chip .x { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 14px; color: var(--muted); }
.steps { margin: 10px 0 0; padding-left: 20px; font-size: 15px; }
.steps li { margin-bottom: 6px; }
.small-print { font-size: 13px; color: var(--muted); }
details.card summary { font-weight: 600; font-size: 17px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; }
details.card[open] summary::after { content: "–"; }

/* ---------- Report ---------- */
#report {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  background: #fff; color: #222; font-family: var(--sans);
}
#report[hidden] { display: none; }
.rep { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.rep-actions { display: flex; gap: 8px; position: sticky; top: 0; background: #fff; padding: 12px 0; z-index: 2; border-bottom: 1px solid #eee; margin-bottom: 18px; }
.rep-actions .btn { background: #f3f1ed; color: #222; border-color: #e3ded5; }
.rep-actions .btn.primary { background: #4f8574; color: #fff; border-color: #4f8574; }
.rep h1 { font-size: 26px; color: #222; }
.rep .meta { color: #666; margin: 6px 0 18px; font-size: 14px; }
.rep h2 { font-size: 15px; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .05em; color: #4f8574; }
.rep-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rep-stats div { border: 1px solid #e5e1da; border-radius: 10px; padding: 10px; }
.rep-stats b { display: block; font-size: 22px; font-family: var(--serif); }
.rep-stats span { font-size: 12px; color: #666; }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 14px; }
.rep-cols p { margin: 0; }
.rep table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rep th, .rep td { text-align: left; padding: 6px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.rep th { color: #666; font-weight: 600; }
.rep .chart .grid { stroke: #e5e1da; }
.rep .chart .axis { fill: #777; }
.rep .chart .line { stroke: #4f8574; }
.rep .chart .area { fill: #4f8574; }
.rep .foot { margin-top: 24px; font-size: 12px; color: #888; }

@media (max-width: 520px) {
  .rep-stats { grid-template-columns: repeat(2, 1fr); }
  .rep-cols { grid-template-columns: 1fr; }
  .rep .hide-sm { display: none; }
}

@media print {
  body { background: #fff; }
  body > *:not(#report) { display: none !important; }
  #report { position: static; overflow: visible; }
  .rep { padding: 0; max-width: none; }
  .rep-actions { display: none; }
  .rep .hide-sm { display: table-cell; }
  .rep-stats { grid-template-columns: repeat(4, 1fr); }
  .rep-cols { grid-template-columns: 1fr 1fr; }
  tr { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Dialog ---------- */
.dialog { position: fixed; inset: 0; z-index: 60; background: rgba(20, 18, 24, .45); display: grid; place-items: center; padding: 16px; }
.dialog-box { background: var(--surface); border-radius: 20px; padding: 20px; max-width: 380px; width: 100%; box-shadow: var(--shadow); }
.dialog-box p { margin: 0; font-size: 16px; }
.btn.danger-fill { background: #c4473f; border-color: #c4473f; color: #fff; }

/* ---------- Period ---------- */
.cycle-day { font-size: 13px; font-weight: 600; color: var(--period); background: var(--period-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.cycle-card .hint b { color: var(--ink); font-weight: 600; }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.flow-btn {
  border: 1.5px solid transparent; background: var(--surface-2); border-radius: 14px;
  padding: 10px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted);
}
.flow-btn svg { width: 36px; height: 18px; }
.flow-btn .drop { fill: var(--period); opacity: .55; }
.flow-btn .ring { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.flow-btn[aria-pressed=true] { border-color: var(--period); background: var(--period-soft); color: var(--ink); font-weight: 600; }
.flow-btn[aria-pressed=true] .drop { opacity: 1; }
.day-period { padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.day-period .flow { margin-top: 6px; }

.cal-day .pmark {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
  background: var(--period); border-radius: 0 50% 50% 50%; transform: rotate(45deg);
  box-shadow: 0 0 0 1.5px var(--surface);
}
.cal-day .fmark { position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.cal-day.future .fmark { opacity: 1; }
.cal-day.pred { outline: 2px dashed var(--period); outline-offset: -3px; opacity: .9; color: var(--period); font-weight: 600; }
.legend.keys { gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.legend.keys span { display: inline-flex; align-items: center; gap: 6px; }
.legend.keys i { display: inline-block; width: 10px; height: 10px; }
.k-period { background: var(--period); border-radius: 0 50% 50% 50%; transform: rotate(45deg); }
.k-pred { border: 2px dashed var(--period); border-radius: 3px; }
.k-fert { background: var(--accent); border-radius: 50%; width: 7px !important; height: 7px !important; }

.stats.inner { margin: 14px 0 8px; }
.stats.inner .stat { box-shadow: none; background: var(--surface-2); }
.cycle-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.cycle-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.cycle-list li span:last-child { color: var(--muted); text-align: right; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 15px; }
.switch span { order: -1; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .2s ease; margin: 0; }
.switch input::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,.25); transition: transform .2s ease; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dialog-box { max-height: 88vh; overflow-y: auto; }
.dialog-box h2 { margin-bottom: 6px; }
.dialog-box .hint b { color: var(--ink); }
textarea.code { min-height: 110px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; }

/* ---------- Calm ---------- */
.safety { background: var(--period-soft); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; }
.safety p { margin: 0 0 10px; font-size: 14px; }
.help-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help-row a {
  display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 14px;
  background: var(--surface); color: var(--ink); text-decoration: none; min-height: 52px;
}
.help-row a b { font-size: 16px; color: var(--period); }
.help-row a span { font-size: 12px; color: var(--muted); }
.now-steps { display: flex; gap: 6px; margin: 12px 0 4px; }
.now-steps i { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.now-steps i.on { background: var(--accent); }
.now-step h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 10px 0 6px; }
.now-step p { margin: 0 0 12px; color: var(--muted); }
.section-title { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 22px 4px 10px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  text-align: left; border: 0; background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow);
  display: flex; gap: 12px; align-items: flex-start; min-height: 96px;
}
.tile > span { display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 15px; }
.tile span span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tile.feature { grid-column: 1 / -1; align-items: center; background: var(--accent-soft); box-shadow: none; }
.orbmini {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, var(--surface), var(--accent-mid) 60%, var(--accent));
  animation: orb 10s ease-in-out infinite;
}
@keyframes orb { 0%, 100% { transform: scale(.82); } 40% { transform: scale(1); } }
.anchor {
  width: 100%; border: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px; font-family: var(--serif); font-size: 22px; line-height: 1.3; text-align: left;
}
.anchor small { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 12px; }
.sits { display: flex; flex-direction: column; gap: 8px; }
.sit { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.sit summary { list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.sit summary::-webkit-details-marker { display: none; }
.sit summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; }
.sit[open] summary::after { content: "–"; }
.sit-body { padding: 0 18px 16px; font-size: 15px; }
.sit-body ul { margin: 4px 0 8px; padding-left: 20px; }
.sit-body li { margin-bottom: 4px; }
.sit-body p { margin: 4px 0 8px; }
.lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-top: 10px; }
.lbl.dont { color: var(--warm); }
.remember { font-family: var(--serif); font-size: 18px; line-height: 1.35; }
.redflag { background: var(--period-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.why-list { padding-left: 18px; font-size: 14px; margin: 12px 0 0; }
.why-list li { margin-bottom: 8px; }
.why-list a { color: var(--accent); }
.pause-banner { background: var(--period-soft); }

.calm-layer {
  position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 24px);
}
.calm-layer[hidden] { display: none; }
.calm-bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  max-width: 560px; margin: 0 auto;
}
.calm-bar h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; }
.calm-stage { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.center-text { text-align: center; }
.btn-row.center, .chips.center { justify-content: center; }
.btn-row.center .btn { flex: 0 1 auto; min-width: 120px; }
.btn.wide { min-width: 220px; }
.big { font-family: var(--serif); font-size: 26px; text-align: center; line-height: 1.2; }
.huge { font-family: var(--serif); font-size: 76px; text-align: center; line-height: 1; color: var(--accent); }
.letter { font-family: var(--serif); font-size: 96px; text-align: center; line-height: 1; color: var(--accent); }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.opt span { font-size: 14px; color: var(--muted); }
.opt small { font-size: 12px; color: var(--accent); font-weight: 600; }
.opt[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.custom-breath { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.switch.narrow { max-width: 220px; margin: 0 auto; }
.breath-wrap { width: min(78vw, 320px); aspect-ratio: 1; margin: 0 auto; }
.breath-canvas { width: 100%; height: 100%; display: block; }
.breath-label { font-family: var(--serif); font-size: 28px; text-align: center; }
.breath-label small { display: block; font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 2px; }
.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s linear; }
.dots5 { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.dots5 button { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--accent-mid); background: var(--surface); font-weight: 700; font-size: 18px; }
.dots5 button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.trail { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.trail span { width: 20px; text-align: center; opacity: .5; }
.trail .done { color: var(--accent); opacity: 1; }
.trail .current { color: var(--ink); opacity: 1; text-decoration: underline; }
.sevens { display: flex; justify-content: center; align-items: baseline; gap: 14px; font-family: var(--serif); }
.sevens strong { font-size: 72px; font-weight: 500; }
.sevens span { font-size: 32px; color: var(--muted); }
.num-in {
  display: block; margin: 0 auto; width: 140px; text-align: center; font-size: 32px; font-family: var(--serif);
  padding: 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); outline: none;
}
.num-in:focus { border-color: var(--accent); }
.num-in[readonly] { border-color: var(--accent); color: var(--accent); }
.say { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-style: italic; }
.soften-text { font-size: 18px; line-height: 1.5; text-align: center; margin: 0; }
.quote { margin: 0; background: var(--surface); border-radius: var(--radius); padding: 26px 22px; box-shadow: var(--shadow); }
.quote p { font-family: var(--serif); font-size: 23px; line-height: 1.35; margin: 0 0 12px; }
.quote cite { font-style: normal; font-size: 14px; color: var(--muted); }
.add-quote { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.add-quote textarea { margin-top: 0; min-height: 70px; }
.add-quote .btn { align-self: flex-start; }
.plan-sec { background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.plan-sec h3 { margin: 0 0 4px; font-size: 16px; }
.plan-sec .hint { margin: 2px 0 0; }
.plan-sec textarea { margin-top: 8px; min-height: 80px; }
.plan-text { white-space: pre-wrap; margin: 4px 0 0; }
.contacts { display: grid; gap: 8px; margin-top: 8px; }
.contact { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.contact span { font-size: 13px; color: var(--accent); font-weight: 600; }
.contacts-edit { display: grid; gap: 8px; margin-top: 8px; }
.contact-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.contact-row .text-input { padding: 10px; }

/* ---------- Suggestions ---------- */
.fb-card textarea { min-height: 90px; }
.fb-list { margin-top: 16px; }
.fb-item { border-top: 1px solid var(--line); padding: 10px 0; }
.fb-item p { margin: 0 0 6px; font-size: 14px; }
.fb-status { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.fb-status.done { background: var(--accent-soft); color: var(--accent); }
.fb-status.warn { background: var(--period-soft); color: var(--period); }
.fb-reply { margin-top: 8px !important; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; color: var(--ink); }
.whats-new { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
.whats-new li { padding: 8px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 56px 1fr; gap: 8px; }

@media (max-width: 360px) {
  .tabs a span { font-size: 11px; }
  .help-row { grid-template-columns: 1fr; }
}
