@font-face {
  font-family: "LunaDisplay";
  src: local("Georgia"), local("Times New Roman");
  font-weight: 400 700;
}

:root {
  --rose: #e6233b;
  --rose-light: #ff5a6e;
  --rose-pale: #ffe8ee;
  --coral: #ff6b4a;
  --amber: #ffb347;
  --lavender: #a78bfa;
  --deep-purple: #5b1a8a;
  --teal: #2dd4bf;
  --fertile-green: #34d399;
  --ovulation: #f59e0b;
  --bg: #120818;
  --bg2: #1e0f2e;
  --bg3: #2a1538;
  --card: #1c0f2b;
  --text: #f9f0ff;
  --text-muted: #c4b5fd;
  --border: rgba(167, 139, 250, 0.28);
  --danger: #e6233b;
  --success: #34d399;
  --status-card-bg: linear-gradient(135deg, #2a1040 0%, #1a0828 100%);
}

/* ── Newsroom Light ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f0f0ed;
  --bg2: #e6e6e3;
  --bg3: #d8d8d5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #4b5563;
  --border: rgba(0, 0, 0, 0.18);
  --rose: #374151;
  --rose-light: #4b5563;
  --rose-pale: #f3f4f6;
  --lavender: #374151;
  --deep-purple: #374151;
  --amber: #92400e;
  --coral: #b45309;
  --fertile-green: #166534;
  --ovulation: #92400e;
  --danger: #dc2626;
  --success: #166534;
  --status-card-bg: linear-gradient(135deg, #e6e6e3 0%, #f0f0ed 100%);
}

/* ── Newsroom Dark ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #111827;
  --bg2: #1f2937;
  --bg3: #374151;
  --card: #1f2937;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
  --rose: #6b7280;
  --rose-light: #9ca3af;
  --rose-pale: #374151;
  --lavender: #d1d5db;
  --deep-purple: #4b5563;
  --amber: #fbbf24;
  --coral: #f59e0b;
  --fertile-green: #34d399;
  --ovulation: #fbbf24;
  --danger: #ef4444;
  --success: #34d399;
  --status-card-bg: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* ── Pink Power 🌸 ──────────────────────────────────────────────────────────── */
[data-theme="kawaii"] {
  --bg: #fff0f7;
  --bg2: #ffe4f0;
  --bg3: #ffd6e8;
  --card: #fff8fc;
  --text: #3d1040;
  --text-muted: #7e22ce;
  --border: rgba(244, 63, 142, 0.3);
  --rose: #db2777;
  --rose-light: #ec4899;
  --rose-pale: #ffe4f0;
  --lavender: #9333ea;
  --deep-purple: #7c3aed;
  --amber: #be185d;
  --coral: #ec4899;
  --fertile-green: #15803d;
  --ovulation: #d97706;
  --teal: #0891b2;
  --danger: #db2777;
  --success: #15803d;
  --status-card-bg: linear-gradient(135deg, #ffd6e8 0%, #fff0f7 100%);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 0 6.25rem;
  display: none; /* Hidden by default until unlocked */
}

#lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(env(safe-area-inset-top) + 0.5rem) 1.5rem
    calc(env(safe-area-inset-bottom) + 2rem);
  text-align: center;
  overflow-y: auto;
}
#lock-screen.hidden {
  display: none;
}

.lock-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  padding-top: 0.375rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.375rem);
  }
}

.lock-logo {
  font-family: Georgia, serif;
  font-size: 2.375rem;
  color: var(--lavender);
  margin-bottom: 0.5rem;
}
.lock-logo span {
  color: var(--rose-light);
  font-style: italic;
}
.lock-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.pin-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}
.pin-dots {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.pin-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 0.0625rem solid var(--text-muted);
  background: transparent;
}
.pin-dot.filled {
  background: var(--rose);
  border-color: var(--rose);
}
.pin-dot.error {
  background: var(--danger);
  border-color: var(--danger);
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-0.375rem);
  }
  75% {
    transform: translateX(0.375rem);
  }
}

#lock-screen .pin-label {
  margin-top: auto;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 4.5rem);
  gap: 0.75rem;
  justify-content: center;
}
.num-btn {
  width: 4.5rem;
  height: 4.5rem;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  font-family: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  color: var(--text);
}
.num-btn:active {
  transform: scale(0.88);
  background: rgba(255, 61, 107, 0.2);
  border-color: var(--rose);
}
.num-btn:focus-visible {
  outline: 0.125rem solid var(--rose-light);
  outline-offset: 0.125rem;
}
.num-btn.del {
  font-size: 1.125rem;
}
.num-btn.empty {
  visibility: hidden;
}

.lock-error {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--danger);
  min-height: 1.25rem;
  transition: opacity 0.3s;
}

.lock-first-time {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.lock-first-time strong {
  color: var(--lavender);
}

#onboarding {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(env(safe-area-inset-top) + 1rem) 1.5rem
    calc(env(safe-area-inset-bottom) + 1.25rem);
  gap: 0.5rem;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Prevent flex children from shrinking to fit the viewport.
   Without this, items compress silently and overflow never triggers,
   so the scroll never activates on small screens. */
#onboarding > * {
  flex-shrink: 0;
}
#onboarding.hidden {
  display: none;
}

.onboard-moon {
  font-size: 4rem;
  animation: pulse 3s ease-in-out infinite;
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.logo-onboard {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
}
.onboard-logo {
  font-family: Georgia, serif;
  font-size: 2.5rem;
  color: var(--lavender);
}
.onboard-logo span {
  color: var(--rose-light);
  font-style: italic;
}
.onboard-sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 auto 2rem;
  line-height: 1.6;
  max-width: 20rem;
  text-align: center;
}
.onboard-form {
  width: 100%;
  max-width: 21.25rem;
  margin: 0 auto;
  text-align: left;
}
.onboard-form label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.375rem;
}
.onboard-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  margin-bottom: 1rem;
}
.onboard-form input:focus {
  border-color: rgba(255, 61, 107, 0.6);
}
.onboard-form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.pin-setup-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.5rem 0 0.375rem;
  color: var(--text);
  text-align: center;
}
.pin-setup-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.5;
  text-align: center;
}

.setup-pin-wrap {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.setup-pin-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 0.125rem solid var(--text-muted);
  background: transparent;
}
.setup-pin-dot.filled {
  background: var(--lavender);
  border-color: var(--lavender);
}

.onboard-numpad {
  display: grid;
  grid-template-columns: repeat(3, 3.75rem);
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.onboard-numpad .num-btn {
  width: 3.75rem;
  height: 3.75rem;
  font-size: 1.25rem;
}

.onboard-start {
  width: 100%;
  background: linear-gradient(135deg, var(--rose), #6366f1, var(--lavender));
  color: white;
  border: none;
  border-radius: 1rem;
  padding: 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.25rem;
}
.onboard-start:active {
  transform: scale(0.97);
}
.onboard-start:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.onboard-step.hidden {
  display: none;
}
.onboard-setup-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 1rem;
}
.onboard-import-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--border);
  background: transparent;
  color: var(--rose-light, #ff6b8a);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}
.onboard-import-btn:hover {
  background: rgba(255, 107, 138, 0.08);
}
.onboard-restore-btn {
  max-width: 21.25rem;
  margin: 1rem auto 0;
}

.onboard-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(env(safe-area-inset-top) + 1rem);
  padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  background: rgba(8, 4, 12, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}
.onboard-setup-overlay.hidden {
  display: none;
}
.onboard-setup-panel {
  width: 100%;
  max-width: 22rem;
  max-height: min(92vh, 40rem);
  overflow-y: auto;
  background: var(--card, #1a1020);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1.25rem 1.5rem;
  text-align: left;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.45);
}
.onboard-setup-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.onboard-setup-back:hover {
  color: var(--rose-light, #ff6b8a);
}

.csv-import-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(env(safe-area-inset-top) + 1rem);
  padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}
.csv-import-overlay.hidden {
  display: none;
}
.csv-import-panel {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: left;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.45);
}
.csv-import-panel--wizard {
  max-width: 26rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.import-wizard-step.hidden {
  display: none;
}
.import-source-btns {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.5rem;
}
.import-source-btn {
  width: 100%;
}
.import-wizard-back {
  width: 100%;
  margin-top: 0.625rem;
}
.import-wizard-actions {
  margin-top: 1rem;
}
.import-review-counts {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.55;
  margin: 0 0 0.75rem;
}
.import-review-warning {
  font-size: 0.8125rem;
  color: var(--warning, #fbbf24);
  line-height: 1.5;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.625rem;
  background: rgba(251, 191, 36, 0.08);
  border-radius: 0.5rem;
  border: 0.0625rem solid rgba(251, 191, 36, 0.25);
}
.import-pattern-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.375rem;
}
.import-flow-pattern-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  border-radius: 0.5rem;
  border: 0.0625rem solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.375rem;
}
.import-flow-pattern-input:focus {
  outline: 0.125rem solid var(--lavender, #a78bfa);
  outline-offset: 0.0625rem;
}
.import-pattern-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.45;
}
.import-pattern-error {
  font-size: 0.8125rem;
  color: var(--danger);
  margin: 0 0 0.5rem;
}
.import-flow-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.5rem 0 0.875rem;
}
.import-preset-btn {
  font-size: 0.75rem;
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
  border: 0.0625rem solid var(--border);
  background: rgba(167, 139, 250, 0.08);
  color: var(--lavender, #a78bfa);
  cursor: pointer;
  font-family: inherit;
}
.import-preset-btn:hover {
  background: rgba(167, 139, 250, 0.18);
}
.import-flow-mode {
  border: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.import-flow-mode legend {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.import-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  margin: 0.375rem 0;
  cursor: pointer;
}
.import-radio-row input {
  margin-top: 0.125rem;
  flex-shrink: 0;
}
.import-report-section {
  margin-bottom: 1rem;
}
.import-report-heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.375rem;
}
.import-report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-height: 8rem;
  overflow-y: auto;
}
.import-report-list li {
  padding: 0.25rem 0;
  border-bottom: 0.0625rem solid var(--border);
  word-break: break-word;
}
.import-report-list--leftovers li {
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
}
.import-report-summary-line {
  font-size: 0.8125rem;
  color: var(--text);
  margin: 0.125rem 0;
  line-height: 1.5;
}
.import-report-summary-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.75rem 0 0.25rem;
  line-height: 1.5;
}
.import-report-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.import-report-actions .apply-btn,
.import-report-actions .btn-outline {
  width: 100%;
}
.btn-outline {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: transparent;
  color: var(--lavender, #a78bfa);
  border: 0.0625rem solid rgba(167, 139, 250, 0.45);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-outline:hover {
  background: rgba(167, 139, 250, 0.12);
}
.csv-import-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}
.csv-import-close:hover {
  color: var(--text);
}
.csv-import-title {
  margin: 0 2rem 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.csv-import-intro,
.csv-import-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 0.75rem;
}
.csv-import-choose-btn {
  width: 100%;
  margin-top: 0.25rem;
}
.csv-import-converter-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 0.0625rem solid var(--border);
}
.csv-import-converter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.csv-import-converter-link {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: rgba(167, 139, 250, 0.1);
  color: var(--lavender, #a78bfa);
  border: 0.0625rem solid rgba(167, 139, 250, 0.3);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.csv-import-converter-link:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.5);
}
.privacy-note {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin: 0.875rem auto 0;
  line-height: 1.6;
  max-width: 20rem;
  text-align: center;
}
.privacy-note span {
  color: var(--teal);
}

#timeout-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 0.0625rem solid rgba(245, 158, 11, 0.4);
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: var(--amber);
  display: none;
  z-index: 99;
  text-align: center;
}
#timeout-banner.visible {
  display: block;
}

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(0.5rem);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.5rem;
  padding: 1.75rem 1.5rem;
  max-width: 20rem;
  width: 100%;
  text-align: center;
  transform: translateY(1.25rem);
  transition: transform 0.25s;
}
#modal-overlay.visible .modal-box {
  transform: translateY(0);
}
.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}
.modal-title {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.modal-msg {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.375rem;
  white-space: pre-wrap;
}
.modal-btns {
  display: flex;
  gap: 0.625rem;
}
.modal-btn {
  flex: 1;
  padding: 0.8125rem;
  border-radius: 0.875rem;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-btn.primary {
  background: linear-gradient(135deg, var(--rose), #c82050);
  color: white;
}
.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.modal-btn:active {
  transform: scale(0.95);
}

.header {
  padding: 1.25rem 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: Georgia, serif;
  font-size: 1.75rem;
  color: var(--lavender);
}
.logo span {
  color: var(--rose-light);
  font-style: italic;
}
.status-card {
  margin: 1rem 1rem 0;
  background: var(--status-card-bg);
  border: 0.0625rem solid var(--border);
  border-radius: 1.5rem;
  padding: 1.125rem;
  position: relative;
  overflow: hidden;
}
.status-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.status-phase .phase-dot {
  display: block;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.status-title {
  font-family: Georgia, serif;
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.status-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.125rem;
}
.status-subtitle:empty {
  display: none;
}
.status-row {
  display: flex;
  gap: 0.75rem;
}
.status-pill {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 0.875rem;
  padding: 0.625rem 0.75rem;
  text-align: center;
}
.status-pill .val {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1;
}
.status-pill .lbl {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.1875rem;
}

.cycle-bar-wrap {
  margin: 1.125rem 1rem 0;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.125rem;
}
.cycle-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}
.cycle-bar {
  height: 0.625rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.legend-item[hidden] {
  display: none;
}
.legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-marker {
  position: absolute;
  top: -0.1875rem;
  width: 0.125rem;
  height: 1rem;
  background: white;
  border-radius: 0.125rem;
}

.calendar-wrap {
  margin: 2rem 1rem 0;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cal-month {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
}
.cal-nav {
  display: flex;
  gap: 0.5rem;
}
.cal-nav-btn {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--text);
}
.cal-nav-btn:active {
  transform: scale(0.9);
  background: var(--rose);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.125rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.1875rem;
  padding: 0 0.125rem;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.18s;
  user-select: none;
}
.cal-day:active {
  transform: scale(0.85);
}
.cal-day.empty {
  pointer-events: none;
}
.cal-day.other-month {
  color: rgba(255, 255, 255, 0.2);
}
.cal-day.period {
  background: linear-gradient(
    135deg,
    rgba(255, 61, 107, 0.85),
    rgba(255, 107, 74, 0.85)
  );
  color: white;
}
.cal-day.fertile {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
  border: 0.09375rem solid rgba(52, 211, 153, 0.4);
}
.cal-day.ovulation {
  background: rgba(245, 158, 11, 0.85);
  color: white;
}
.cal-day.predicted-period {
  background: rgba(255, 61, 107, 0.13);
  color: var(--rose-light);
  border: 0.09375rem dashed rgba(255, 61, 107, 0.5);
}
.cal-day.tolerance-period {
  color: var(--rose-light);
  border: 0.09375rem dashed rgba(255, 61, 107, 0.35);
}
/* Logged flow intensity — full-circle gradient; heavier = larger solid core */
.cal-day.flow-0 {
  background: rgba(255, 61, 107, 0.18);
  color: var(--rose-light);
  border: 0.09375rem solid rgba(255, 90, 110, 0.75);
}
.cal-day.flow-1,
.cal-day.flow-2,
.cal-day.flow-3,
.cal-day.flow-4 {
  color: white;
  border: none;
}
.cal-day.flow-1 {
  background: radial-gradient(
    circle at center,
    rgb(255, 61, 107) 0%,
    rgb(255, 61, 107) 18%,
    rgb(255, 140, 110) 55%,
    rgb(255, 190, 150) 100%
  );
}
.cal-day.flow-2 {
  background: radial-gradient(
    circle at center,
    rgb(255, 61, 107) 0%,
    rgb(255, 61, 107) 42%,
    rgb(255, 120, 90) 72%,
    rgb(255, 160, 120) 100%
  );
}
.cal-day.flow-3 {
  background: radial-gradient(
    circle at center,
    rgb(255, 61, 107) 0%,
    rgb(255, 61, 107) 68%,
    rgb(255, 100, 80) 88%,
    rgb(255, 130, 100) 100%
  );
}
.cal-day.flow-4 {
  background: radial-gradient(
    circle at center,
    rgb(190, 20, 70) 0%,
    rgb(220, 30, 80) 55%,
    rgb(255, 61, 107) 82%,
    rgb(255, 100, 90) 100%
  );
  box-shadow: inset 0 0 0 0.09375rem rgba(255, 255, 255, 0.35);
}
.cal-day.flow-0::before,
.cal-day.flow-1::before,
.cal-day.flow-2::before,
.cal-day.flow-3::before,
.cal-day.flow-4::before {
  display: none;
}
.cal-day.today::after {
  content: "";
  position: absolute;
  bottom: 0.125rem;
  width: 0.25rem;
  height: 0.25rem;
  background: white;
  border-radius: 50%;
}
.cal-day.has-log::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  width: 0.3125rem;
  height: 0.3125rem;
  background: var(--lavender);
  border-radius: 50%;
}
.cal-day.selected-log {
  box-shadow: 0 0 0 0.15625rem var(--lavender);
}
.cal-day.flow-4.selected-log {
  box-shadow:
    inset 0 0 0 0.09375rem rgba(255, 255, 255, 0.35),
    0 0 0 0.15625rem var(--lavender);
}

.log-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.log-modal-overlay.visible {
  display: flex;
}
.log-panel {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  max-width: 28rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.3s ease;
  box-shadow: 0 1.25rem 3.125rem rgba(0, 0, 0, 0.5);
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(1.25rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  padding-bottom: 0.5rem;
}
.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: end;
  justify-content: end;
  transition: color 0.2s;
  flex-shrink: 0;
}
.close-btn:hover {
  color: var(--text);
}
.log-date-title {
  font-family: Georgia, serif;
  font-size: 1.125rem;
  flex: 1;
}
.log-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.log-btn {
  padding: 0.625rem 0.375rem;
  border-radius: 0.75rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 0.09375rem solid var(--border);
  cursor: pointer;
  font-size: 0.75rem;
  transition: transform 0.2s, opacity 0.2s;
  user-select: none;
}
.log-btn .icon {
  font-size: 1.25rem;
  display: block;
  margin-bottom: 0.25rem;
}
#log-flow-icon {
  display: block;
  white-space: nowrap;
  letter-spacing: -0.22em;
  color: var(--rose);
}
.log-btn:active {
  transform: scale(0.93);
}
.log-btn.active-flow {
  border-color: var(--rose);
  background: rgba(255, 61, 107, 0.15);
  color: var(--rose-light);
}
.log-btn.active-symptom {
  border-color: var(--lavender);
  background: rgba(167, 139, 250, 0.15);
  color: var(--lavender);
}
.log-btn.active-mood {
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.15);
  color: var(--teal);
}
.log-btn.mood-btn {
  grid-column: auto;
}
.mood-sub {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.mood-modal-wrap {
  margin-top: 0.5rem;
}
.mood-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.mood-modal-slider {
  width: 100%;
  cursor: pointer;
}
.flow-modal-wrap {
  margin-top: 0.5rem;
}
.flow-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: -0.22em;
}
.flow-modal-slider {
  width: 100%;
  cursor: pointer;
}
.pain-modal-wrap {
  margin-top: 0.5rem;
}
.pain-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.pain-modal-slider {
  width: 100%;
  cursor: pointer;
}
.log-note {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 0.0625rem solid var(--border);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  outline: none;
  margin-bottom: 0.625rem;
}
.log-note:focus {
  border-color: rgba(167, 139, 250, 0.5);
}

.note-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -0.25rem;
  margin-bottom: 1.5rem;
}
.note-limit {
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.autosave-indicator {
  font-size: 0.6875rem;
  color: var(--teal);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.autosave-indicator.visible {
  opacity: 1;
}
.log-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  width: 100%;
  margin-top: 0.5rem;
}
.log-reset-btn {
  background: transparent;
  border: 0.09375rem solid rgba(226, 87, 74, 0.35);
  border-radius: 0.75rem;
  color: rgba(226, 87, 74, 0.65);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.log-reset-btn:hover {
  color: rgba(226, 87, 74, 0.9);
  border-color: rgba(226, 87, 74, 0.65);
  background: rgba(226, 87, 74, 0.07);
}
.log-reset-btn:active {
  transform: scale(0.96);
}
.log-reset-btn.confirming {
  color: var(--rose);
  border-color: rgba(255, 61, 107, 0.7);
  background: rgba(255, 61, 107, 0.1);
  font-weight: 600;
}
.log-done-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 0.09375rem solid var(--border);
  border-radius: 0.75rem;
  padding: 0.625rem 1.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.log-done-btn:hover {
  background: rgba(255, 255, 255, 0.13);
}
.log-done-btn:active {
  transform: scale(0.97);
}

/* Compact, direct-edit daily log */
.log-entry-mode {
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.125rem;
  text-transform: uppercase;
}
.log-save-status {
  color: var(--text-muted);
  font-size: 0.6875rem;
  margin: -0.375rem 0 0.625rem;
}
.log-accordion {
  border: 0.0625rem solid var(--border);
  border-radius: 0.875rem;
  overflow: hidden;
}
.log-section + .log-section {
  border-top: 0.0625rem solid var(--border);
}
.log-section-head {
  align-items: stretch;
  display: flex;
  min-height: 2.875rem;
}
.log-section-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: grid;
  flex: 1;
  gap: 0.5rem;
  grid-template-columns: 1.5rem auto minmax(0, 1fr) 1rem;
  min-width: 0;
  padding: 0.375rem 0.625rem;
  text-align: left;
}
.log-section-toggle--flow {
  grid-template-columns: auto auto minmax(0, 1fr) 1rem;
}
.log-section-toggle--flow #log-flow-icon {
  margin-left: -0.25rem;
}
.log-section-toggle:focus-visible,
.log-choice:focus-visible,
.log-field-clear:focus-visible {
  outline: 0.125rem solid var(--lavender);
  outline-offset: -0.125rem;
}
.log-section-icon {
  font-size: 1.125rem;
  text-align: center;
}
.log-section-label {
  font-size: 0.8125rem;
  font-weight: 700;
}
.log-section-summary {
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-section-summary.is-set {
  color: var(--text);
}
.log-section-chevron {
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
}
.log-field-clear {
  background: transparent;
  border: 0;
  color: var(--rose-light);
  cursor: pointer;
  display: none;
  font-size: 0.6875rem;
  min-width: 2.75rem;
  padding: 0 0.5rem;
}
.log-field-clear.visible {
  display: block;
}
.log-section-panel {
  background: rgba(255, 255, 255, 0.025);
  border-top: 0.0625rem solid var(--border);
  padding: 0.5rem;
}
.log-section-panel[hidden] {
  display: none;
}
.log-choice-grid {
  display: grid;
  gap: 0.375rem;
}
.log-choice-grid--flow {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.log-choice-grid--mood {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.log-choice {
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 0.0625rem solid var(--border);
  border-radius: 0.625rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.6875rem;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.25rem;
}
.log-choice.selected {
  background: rgba(255, 61, 107, 0.14);
  border-color: var(--rose);
  color: var(--text);
  font-weight: 700;
}
.log-choice-grid--mood .log-choice.selected,
.log-choice--no-pain.selected {
  background: rgba(167, 139, 250, 0.14);
  border-color: var(--lavender);
}
.pain-direct-row {
  align-items: center;
  display: grid;
  gap: 0.625rem;
  grid-template-columns: 5rem minmax(0, 1fr);
}
.pain-direct-slider {
  min-width: 0;
}
.pain-direct-slider label {
  color: var(--text-muted);
  display: block;
  font-size: 0.6875rem;
  line-height: 1;
  text-align: right;
}
.pain-direct-slider input {
  min-height: 2rem;
}
.log-estimated-hint {
  color: var(--amber);
  font-size: 0.6875rem;
  margin-top: 0.375rem;
}
.log-actions {
  background: var(--card);
  bottom: -1.5rem;
  margin: 0.5rem -0.25rem -1.5rem;
  padding: 0.625rem 0.25rem calc(0.75rem + env(safe-area-inset-bottom));
  position: sticky;
  z-index: 2;
}
.log-actions .autosave-indicator {
  flex: 1;
  text-align: center;
}
.log-reset-btn[hidden] {
  display: none;
}

.insights-wrap {
  margin: 1rem 1rem 0;
  display: none;
}
.insights-wrap.visible {
  display: block;
}
.insight-card {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.25rem;
  padding: 1.125rem;
  margin-bottom: 0.75rem;
  overflow: visible;
}
.insight-card h3 {
  font-family: Georgia, serif;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* Flow-first period profile; optional symptom tracks appear only with data. */
.period-profile-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}
.period-profile-heading h3 {
  margin-bottom: 0.125rem;
}
.period-profile-heading p,
.period-profile-footnote {
  color: var(--text-muted);
  font-size: 0.6875rem;
  margin: 0;
}
.period-profile-date {
  color: var(--text-muted);
  font-size: 0.6875rem;
  white-space: nowrap;
}
.period-profile-stats {
  display: grid;
  gap: 0.375rem;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  margin: 0.5rem 0;
}
.profile-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid var(--border);
  border-radius: 0.625rem;
  min-width: 0;
  padding: 0.375rem 0.4375rem;
}
.profile-stat strong,
.profile-stat span {
  display: block;
}
.profile-stat strong {
  font-size: 0.8125rem;
}
.profile-stat span {
  color: var(--text-muted);
  font-size: 0.5625rem;
  margin-top: 0.125rem;
}
.profile-track {
  align-items: center;
  display: grid;
  gap: 0.375rem;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  margin-top: 0.375rem;
}
.profile-track-label {
  color: var(--text-muted);
  font-size: 0.6875rem;
}
.profile-track-days {
  display: grid;
  gap: 0.1875rem;
  grid-template-columns: repeat(var(--profile-days), minmax(0, 1fr));
}
.profile-day {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.25rem;
  display: flex;
  font-size: 0.625rem;
  justify-content: center;
  min-height: 1.5rem;
}
.profile-day--flow-1 { background: rgba(255, 61, 107, 0.28); }
.profile-day--flow-2 { background: rgba(255, 61, 107, 0.56); }
.profile-day--flow-3 { background: rgba(255, 61, 107, 0.88); color: white; }
.profile-day--flow-4 { background: rgba(255, 61, 107, 1); color: white; box-shadow: inset 0 0 0 0.0625rem rgba(255, 255, 255, 0.4); }
.profile-day--pain { background: rgba(255, 140, 0, var(--pain-alpha)); }
.profile-day--mood-low { background: rgba(139, 127, 232, 0.55); }
.profile-day--mood-neutral { background: rgba(167, 139, 250, 0.24); }
.profile-day--mood-high { background: rgba(46, 204, 113, 0.45); }
.period-profile-footnote {
  margin-top: 0.625rem;
}
.history-flow-spark {
  align-items: end;
  display: flex;
  gap: 0.125rem;
  height: 1.5rem;
  justify-content: center;
  min-width: 0;
}
.history-flow-spark span {
  background: var(--rose);
  border-radius: 0.125rem 0.125rem 0 0;
  flex: 1;
  max-width: 0.5rem;
  min-width: 0.1875rem;
  opacity: 0.85;
}
#insight-tabs-card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
/* Desktop tabs styles */
.insight-tabs-nav {
  display: flex;
  flex-wrap: nowrap;
  margin-bottom: -0.0625rem;
  position: relative;
  z-index: 10;
}
.insight-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.5rem;
  background: rgba(167, 139, 250, 0.04);
  border: 0.0625rem solid var(--border);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.4);
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
  text-align: center;
  position: relative;
  opacity: 0.4;
}
.insight-tab-btn::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: #9b7fe0;
  opacity: 0;
  transition: all 0.25s ease;
}
.insight-tab-btn:first-child {
  border-radius: 1.25rem 0 0 0;
}
.insight-tab-btn:last-child {
  border-radius: 0 1.25rem 0 0;
}
.insight-tab-btn + .insight-tab-btn {
  margin-left: -0.0625rem;
}
.insight-tab-btn:hover:not(.active) {
  background: rgba(167, 139, 250, 0.12);
  color: rgba(255, 255, 255, 0.7);
}
.insight-tab-btn.active {
  background: var(--card);
  border-bottom-color: var(--card);
  color: #fff;
  font-weight: 500;
  z-index: 11;
  opacity: 1;
}
.insight-tab-btn.active::after {
  opacity: 1;
  left: 0.75rem;
  right: 0.75rem;
}
.insight-tab-content {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 0 0 1.25rem 1.25rem;
  padding: 1.5rem 1.125rem 1.125rem;
  position: relative;
  z-index: 5;
}

@media (max-width: 767px) {
  .insight-tabs-nav {
    display: none;
  }
  .insight-tab-content {
    display: block !important; /* Force show all sections on mobile */
    background: var(--card);
    border: 0.0625rem solid var(--border);
    border-radius: 1.25rem;
    padding: 1.125rem;
    margin-bottom: 0.75rem;
  }
  .mobile-only-title {
    display: block;
    font-family: Georgia, serif;
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
}
@media (min-width: 768px) {
  .mobile-only-title {
    display: none !important;
  }
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.875rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  transition: transform 0.2s;
}
.stat-box:hover {
  background: rgba(255, 255, 255, 0.08);
}
.stat-box .big {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.125rem;
}
.stat-box .sm {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}
.cycle-stats-panel {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.0625rem solid var(--border);
}
.stats-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.875rem;
  row-gap: 0.125rem;
  margin-bottom: 0.75rem;
}
.stats-section--overall {
  padding-top: 0.75rem;
  border-top: 0.0625rem solid var(--border);
}
.stats-section-title {
  align-self: center;
  grid-column: 1;
  margin: 0 0 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.stats-section-hint {
  align-self: center;
  grid-column: 2;
  margin: 0 0 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: right;
}
.stats-section--overall .stats-section-title {
  grid-column: 1 / -1;
}
.stats-flag {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}
.stats-flag--caution {
  background: rgba(245, 158, 11, 0.1);
  border: 0.0625rem solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
}
.stats-flag--irregular {
  background: rgba(255, 107, 74, 0.1);
  border: 0.0625rem solid rgba(255, 107, 74, 0.3);
  color: var(--rose);
}
.history-row--shifted .history-len {
  box-shadow: inset 0 0 0 0.0625rem rgba(245, 158, 11, 0.5);
}
.shift-banner {
  display: none;
  background: rgba(255, 107, 74, 0.1);
  border: 0.0625rem solid rgba(255, 107, 74, 0.3);
  padding: 0.375rem 0.75rem;
  border-radius: 0.625rem;
  margin: 0 0 0.75rem;
  color: var(--rose);
  font-weight: 500;
  font-size: 0.75rem;
  width: fit-content;
  align-items: center;
  gap: 0.375rem;
}
.spread-banner {
  display: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.625rem;
  margin: 0 0 1rem;
  font-weight: 500;
  font-size: 0.75rem;
  width: fit-content;
  align-items: center;
  gap: 0.375rem;
}
.spread-banner--caution {
  background: rgba(245, 158, 11, 0.1);
  border: 0.0625rem solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
}
.spread-banner--irregular {
  background: rgba(255, 107, 74, 0.1);
  border: 0.0625rem solid rgba(255, 107, 74, 0.3);
  color: var(--rose);
}
.stats-row {
  border-bottom: 0.0625rem solid var(--border);
  display: block;
  min-width: 0;
  padding: 0.375rem 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.stats-row span {
  display: block;
}
.stats-row span:last-child {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.125rem;
}
.history-expand-btn {
  background: none;
  border: 0.0625rem solid var(--border);
  border-radius: 0.5rem;
  color: var(--rose-light, #ff6b8a);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  display: block;
  width: 100%;
}
.history-expand-btn:hover {
  background: rgba(255, 61, 107, 0.08);
}
.history-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}
.history-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.history-count-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}
.history-share-icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.history-share-icon-btn:hover {
  color: var(--rose-light, #ff6b8a);
  background: rgba(255, 61, 107, 0.08);
}
.history-share-icon-btn svg {
  display: block;
}
.history-col-labels {
  display: grid;
  grid-template-columns: minmax(5rem, 1.45fr) 0.42fr 0.62fr 0.75fr 0.38fr 0.25fr;
  gap: 0.2rem;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 0.0625rem solid var(--border);
  margin-bottom: 0.125rem;
}
.history-col-labels span:not(:first-child) {
  text-align: center;
}
.history-col-labels--chart,
.history-row.history-row--chart {
  grid-template-columns:
    minmax(5rem, 1.35fr)
    0.42fr
    0.62fr
    minmax(6.5rem, 1.35fr);
}
.history-pattern-key {
  align-items: center;
  display: flex;
  font-size: 0.5rem;
  gap: 0.45rem;
  justify-content: center;
  letter-spacing: 0;
  overflow: hidden;
  text-transform: none;
  white-space: nowrap;
}
.history-pattern-key-item {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.15rem;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
@media (min-width: 30rem) {
  .history-col-labels--chart .history-pattern-key,
  .history-row--chart .history-daily-chart {
    margin-left: 0.625rem;
    width: calc(100% - 0.625rem);
  }
}
.history-pattern-key-item::before {
  background: currentColor;
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  height: 0.125rem;
  width: 0.45rem;
}
.history-pattern-key-item--flow {
  color: #ff3d6b;
}
.history-pattern-key-item--flow::before {
  border-radius: 0.0625rem 0.0625rem 0 0;
  height: 0.4rem;
  width: 0.3rem;
}
.history-pattern-key-item--pain {
  color: #f59e0b;
}
.history-pattern-key-item--mood {
  color: #a78bfa;
}
.history-row {
  display: grid;
  grid-template-columns: minmax(5rem, 1.45fr) 0.42fr 0.62fr 0.75fr 0.38fr 0.25fr;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0;
  border-bottom: 0.0625rem solid var(--border);
  font-size: 0.8125rem;
}
.history-row .history-date {
  font-size: 0.6875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-fullpage-body .history-row {
  grid-template-columns:
    minmax(5rem, 1.35fr)
    0.42fr
    0.62fr
    minmax(6.5rem, 1.35fr);
}
.history-row:last-child {
  border-bottom: none;
}
.history-dur {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
}
.history-len {
  font-weight: 600;
  padding: 0.1875rem 0.375rem;
  border-radius: 0.5rem;
  font-size: 0.6875rem;
  text-align: center;
}
.history-pain {
  color: var(--text-muted);
  font-size: 0.6875rem;
  text-align: center;
}
.history-mood {
  font-size: 0.875rem;
  text-align: center;
}
.history-daily-chart {
  background: var(--bg2);
  border-radius: 0.3rem;
  display: block;
  height: 1.625rem;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}
.history-daily-chart-bg {
  fill: var(--bg2);
  stroke: var(--border);
  stroke-width: 1;
}
.history-daily-chart-divider {
  stroke: var(--border);
  stroke-width: 0.6;
}
.history-daily-chart-flow {
  fill: #ff3d6b;
}
.history-daily-chart-line-halo {
  fill: none;
  stroke: var(--bg2);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.history-daily-chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}
.history-daily-chart-line--pain {
  stroke: #f59e0b;
}
.history-daily-chart-line--mood {
  stroke: #a78bfa;
}
.history-daily-chart-point {
  stroke: var(--bg2);
  stroke-width: 0.45;
  vector-effect: non-scaling-stroke;
}
.history-daily-chart-point--pain {
  fill: #f59e0b;
}
.history-daily-chart-point--mood-low {
  fill: #8b7fe8;
}
.history-daily-chart-point--mood-neutral {
  fill: #a78bfa;
}
.history-daily-chart-point--mood-high {
  fill: #2ecc71;
}
/* Full-page history overlay */
.history-fullpage-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 900;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-fullpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.0625rem solid var(--border);
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-sizing: border-box;
}
.history-fullpage-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
}
.history-fullpage-close:hover {
  background: rgba(255, 255, 255, 0.07);
}
.history-fullpage-subheader {
  display: grid;
  grid-template-columns:
    minmax(5rem, 1.35fr)
    0.42fr
    0.62fr
    minmax(6.5rem, 1.35fr);
  gap: 0.2rem;
  padding: 0.5rem 0;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 0.0625rem solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.history-fullpage-subheader span:not(:first-child) {
  text-align: center;
}
.history-fullpage-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 0 1.25rem;
  box-sizing: border-box;
}
.info-box {
  background: rgba(167, 139, 250, 0.1);
  border: 0.0625rem solid rgba(167, 139, 250, 0.25);
  border-radius: 0.875rem;
  padding: 0.875rem;
  font-size: 0.8125rem;
  color: #c4b5fd;
  line-height: 1.6;
}

.settings-wrap {
  margin: 1rem 1rem 0;
  display: none;
}
.settings-wrap.visible {
  display: block;
}

.settings-tabs-nav {
  display: none;
}

/* Support tab mode: show only About + Support sections */
#view-about.support-mode .settings-section {
  display: none;
}

#view-about.support-mode #about-core-section,
#view-about.support-mode #support-section {
  display: block;
}

.settings-section {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.25rem;
  padding: 1.125rem;
  margin-bottom: 0.75rem;
}
.settings-section h3 {
  font-family: Georgia, serif;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.field-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.field-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.75rem 0.875rem;
  color: white;
  font-family: inherit;
  font-size: 0.9375rem;
  outline: none;
  margin-bottom: 0.875rem;
}
.field-input option {
  background: var(--card);
  color: var(--text);
}
.field-input:focus {
  border-color: rgba(255, 61, 107, 0.5);
}
.field-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
.apply-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--rose), #c82050);
  color: white;
  border: none;
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.apply-btn:active {
  transform: scale(0.97);
}
.setting-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.setting-row .field-input {
  flex: 1;
  margin-bottom: 0;
}
.setting-save-btn {
  background: rgba(255, 61, 107, 0.15);
  color: var(--rose-light, #ff6b8a);
  border: 0.0625rem solid rgba(255, 61, 107, 0.3);
  border-radius: 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.setting-save-btn:hover {
  background: rgba(255, 61, 107, 0.25);
}
.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.toggle-row {
  margin-top: 1rem;
}
.toggle-row .field-hint {
  margin: 0.375rem 0 0 1.75rem;
}
.toggle-row + .field-label {
  margin-top: 1.5rem;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--rose);
  cursor: pointer;
  flex-shrink: 0;
}
.danger-btn {
  width: 100%;
  background: rgba(255, 61, 107, 0.1);
  border: 0.0625rem solid rgba(255, 61, 107, 0.4);
  color: var(--rose);
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.625rem;
}
.danger-btn:active {
  transform: scale(0.97);
}
.sec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(52, 211, 153, 0.12);
  border: 0.0625rem solid rgba(52, 211, 153, 0.3);
  border-radius: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  color: var(--teal);
  margin-bottom: 0.75rem;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  background: rgba(26, 16, 37, 0.92);
  backdrop-filter: blur(1.25rem);
  -webkit-backdrop-filter: blur(1.25rem);
  border-top: 0.0625rem solid var(--border);
  display: none; /* Hidden by default until unlocked */
  padding: 0.625rem 0 max(0.625rem, env(safe-area-inset-bottom));
  z-index: 100;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  cursor: pointer;
  font-size: 0.625rem;
  color: var(--text-muted);
  transition: opacity 0.2s, transform 0.2s;
  user-select: none;
  padding: 0.25rem 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bnav-item .icon {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  stroke-width: 1.5;
  fill: none;
  line-height: 1;
}

.bnav-item .icon svg {
  display: block;
  margin: auto;
}
.bnav-item.active {
  color: var(--rose-light);
}

@media (min-width: 600px) {
  #app,
  .bottom-nav {
    max-width: 37.5rem;
  }
  .cal-day {
    font-size: 0.9375rem;
  }
}

/* Logo Images */
.logo-lock {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
}

/* Forgot PIN Button */.forgot-pin-wrapper {
  text-align: center;
  margin-top: 1.25rem;
}

.forgot-pin-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Onboarding Tagline */
.onboard-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.5rem auto 1.5rem;
  text-align: center;
  max-width: 28rem;
}

/* Beta Warning Box */
.beta-warning {
  background: rgba(255, 179, 71, 0.12);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0 auto 1.25rem;
  max-width: 21.25rem;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: #fcd68a;
  line-height: 1.5;
}

/* Reminder Banner */
.reminder-banner {
  display: none; /* Controlled by JS */
  background: rgba(245, 158, 11, 0.1);
  border: 0.0625rem solid rgba(245, 158, 11, 0.3);
  padding: 0.375rem 0.75rem;
  border-radius: 0.625rem;
  margin: 0.25rem 0 1.25rem;
  color: var(--amber);
  font-weight: 500;
  font-size: 0.75rem;
  width: fit-content;
  align-items: center;
  gap: 0.375rem;
}

/* Legend Dot Colors */
/* Legend dots are hardcoded to match the cycle bar's hardcoded gradients */
.legend-dot--shifted {
  background: var(--amber);
  box-shadow: 0 0 0 0.0625rem rgba(245, 158, 11, 0.5);
}
.legend-dot--rose     { background: #FF3D6B; }
.legend-dot--fertile  { background: #34D399; }
.legend-dot--ovulation{ background: #F59E0B; }
.legend-dot--lavender { background: #A78BFA; }
.legend-dot--neutral  { background: #64748B; }

/* Calendar Empty State */
.calendar-empty-text {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  margin: 0 0 1.25rem;
}

/* Stat Box Colors */
.stat-color--rose {
  color: var(--rose);
}

.stat-color--lavender {
  color: var(--lavender);
}

.stat-color--teal {
  color: var(--teal);
}

.stat-color--fertile {
  color: var(--fertile-green);
}

/* Chart Download Button */
.flex-spacer {
  flex: 1;
}

.chart-export-btn {
  border: none;
  background: rgba(167, 139, 250, 0.15);
  color: #e9ddff;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 34px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.chart-export-btn:hover {
  background: rgba(167, 139, 250, 0.25);
  color: #fff;
}

.chart-export-btn svg {
  opacity: 0.8;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Chart Controls */
.chart-controls-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 0.5rem 0;
}


.chart-select {
  width: auto;
  min-width: 0;
  flex-shrink: 1;
  padding: 0 2rem 0 0.75rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  color: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  height: 34px;
}

.chart-select option {
  background: #1a1a2e;
  color: white;
}

/* Chart canvas — fills container on mobile */
.chart-container {
  width: 100%;
}

.chart-canvas {
  width: 100% !important;
  max-width: 100%;
  display: block;
}

/* Chart Legend */
.chart-legend {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0;
  margin-top: 0.5rem;
}

.legend-items {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0 0.5rem;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.legend-item--period,
.legend-item--ovulation,
.legend-item--flow,
.legend-item--pain,
.legend-item--mood {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.68rem;
}

.legend-item--period::before,
.legend-item--ovulation::before,
.legend-item--flow::before,
.legend-item--pain::before,
.legend-item--mood::before {
  content: "";
  display: inline-block;
  width: 0.25rem;
  height: 0.6rem;
  background-color: currentColor;
  border-radius: 0.125rem;
  flex-shrink: 0;
}

.legend-item--period {
  color: #ff3d6b;
  padding: 0.25rem 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--ovulation {
  color: #ffd700;
  padding: 0.25rem 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--flow {
  color: #ff3d6b;
  padding: 0.25rem 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--pain {
  color: #ff6b4a;
  padding: 0.25rem 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--mood {
  color: #8b7fe8;
  padding: 0.25rem 0.2rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

/* Empty History State */
.empty-history {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Info Box Variants */
.info-box--success {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.07);
  color: #6ee7b7;
}

.info-box--warning {
  border-color: rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.08);
  color: #fcd68a;
}

.info-box--security {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  margin-bottom: 0.625rem;
}

.info-box--data-warning {
  border-color: rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.08);
  color: #fcd68a;
  margin-bottom: 0.625rem;
}

.info-box--margin {
  margin-bottom: 0.75rem;
}

.info-box--fork {
  border-color: rgba(230, 35, 59, 0.25);
  background: rgba(230, 35, 59, 0.06);
  color: #f4a0b0;
}

.backup-status {
  font-size: 0.85rem;
  padding: 0.5rem 0 0.25rem;
  color: #c4b5fd;
}

.backup-status--warn {
  color: #fcd68a;
  font-weight: 600;
}

.backup-status--ok {
  color: #c4b5fd;
}

/* Accessibility Link */
.accessibility-link {
  color: var(--teal);
  text-decoration: underline;
}

/* Support Link */
.support-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(50deg, #0070e0, #b9dcff);
  color: white;
  text-decoration: none;
  border-radius: 0.875rem;
  border: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.support-link:hover {
  transform: translateY(-2px);
}

.support-link:active {
  transform: translateY(0);
}

.support-link:focus-visible {
  outline: 2px solid rgba(185, 220, 255, 0.65);
  outline-offset: 2px;
}

.support-paypal-logo {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.support-paypal-logo svg {
  width: 4.6rem;
  height: auto;
  display: block;
}

/* Button Variants */
.btn--install {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  margin-bottom: 0.625rem;
}

.btn--change-pin {
  background: linear-gradient(135deg, var(--lavender), #6d28d9);
  margin-bottom: 0;
}

.btn--export {
  background: linear-gradient(135deg, var(--teal), #0d9488);
  margin-top: 0.625rem;
  margin-bottom: 0.625rem;
}

.btn--import {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
  margin-bottom: 0.625rem;
}

.btn--import-drip {
  display: block;
  text-align: center;
  text-decoration: none;
  background: transparent;
  color: var(--rose);
  border: 2px solid var(--rose);
  margin-bottom: 0.625rem;
}

.btn--export-app {
  display: block;
  text-align: center;
  background: transparent;
  color: var(--lavender);
  border: 2px solid var(--lavender);
  margin-bottom: 0.625rem;
}
.export-format-option .csv-import-note {
  margin: 0.375rem 0 0;
}

.hidden {
  display: none !important;
}

.settings-section--nested {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 0.0625rem solid var(--border);
}

.settings-section--nested h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.btn--secondary {
  background: transparent;
  color: var(--text-muted);
  border: 0.0625rem solid var(--border);
  margin-top: 0.5rem;
  margin-bottom: 0.625rem;
}

.btn--drive-sync {
  margin-bottom: 0.625rem;
}

.drive-auto-row {
  margin-top: 0.75rem;
}

.drive-auto-row + .field-hint {
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* Tab Switching Animation */
.settings-wrap,
.insights-wrap,
#view-calendar {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Optional Light Theme variables (Fallback to dark mode) */
@media (prefers-color-scheme: light) {
  /* You can expand these in the future to fully support light mode */
  /* :root {
      --bg: #ffffff;
      --card: #f9f9f9;
      --text: #333333;
  } */
}

/* ── Toast notification ─────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  max-width: min(20rem, calc(100vw - 2rem));
  text-align: center;
  white-space: normal;
  box-sizing: border-box;
}
#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Theme picker ────────────────────────────────────────────────────────────── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
  margin-top: 0.75rem;
}
.theme-option {
  position: relative;
  cursor: pointer;
}
.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 0.125rem solid transparent;
  transition: border-color 0.15s;
  user-select: none;
}
.theme-option input:checked + .theme-swatch {
  border-color: var(--lavender);
}
.theme-swatch__dots {
  display: flex;
  gap: 0.3rem;
}
.theme-swatch__dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}
.theme-swatch__name {
  font-size: 0.78rem;
  font-weight: 600;
  /* default; overridden per swatch below so text is always legible */
  color: var(--text);
}
/* Hardcoded text colours so each swatch reads correctly in any active theme */
.ts-default-bg .theme-swatch__name { color: #f9f0ff; }
.ts-dark-bg    .theme-swatch__name { color: #f9fafb; }
.ts-light-bg   .theme-swatch__name { color: #1a1a1a; }
.ts-kawaii-bg  .theme-swatch__name { color: #3d1040; }

/* Swatch palette colours (hard-coded so they look right in any active theme) */
.ts-default  { background: #120818; }
.ts-default-a { background: #a78bfa; }
.ts-default-b { background: #e6233b; }
.ts-default-bg { background: #1c0f2b; border: 1px solid rgba(167,139,250,0.3); }

.ts-light    { background: #f0f0ed; border: 1px solid #ccc; }
.ts-light-a  { background: #374151; }
.ts-light-b  { background: #4b5563; }
.ts-light-bg { background: #ffffff; border: 1px solid #ddd; }

.ts-dark     { background: #111827; }
.ts-dark-a   { background: #d1d5db; }
.ts-dark-b   { background: #6b7280; }
.ts-dark-bg  { background: #1f2937; border: 1px solid rgba(255,255,255,0.08); }

.ts-kawaii   { background: #fff0f7; border: 1px solid #f9a8d4; }
.ts-kawaii-a { background: #c084fc; }
.ts-kawaii-b { background: #f43f8e; }
.ts-kawaii-bg { background: #fff8fc; border: 1px solid #f9a8d4; }

/* ── Calendar nav disabled state ────────────────────────────────────────────── */
.cal-nav-btn.nav-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}


/* ── Status empty hint ───────────────────────────────────────────────────────── */
.status-empty-hint {
  font-family: Georgia, serif;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.25rem 0 0.75rem;
}
.status-empty-hint.hidden {
  display: none;
}

/* ── Predictions tab (3 columns: start, end, duration) ──────────────────────── */
.pred-col-labels,
.pred-row {
  grid-template-columns: 5fr 5fr 2fr;
}

/* ── History legend ─────────────────────────────────────────────────────────── */
.history-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.history-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Log panel sticky header: already defined above, properties merged ───────── */

/* ── Auto-fill info banner ───────────────────────────────────────────────────── */
.autofill-banner.hidden {
  display: none;
}
.autofill-banner {
  position: fixed;
  bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px) + 0.625rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 2rem), 30rem);
  background: var(--card);
  border: 0.0625rem solid rgba(167, 139, 250, 0.45);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  z-index: 150;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  animation: bannerSlideUp 0.2s ease;
}
@keyframes bannerSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(0.5rem); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.autofill-banner__msg {
  flex: 1 1 100%;
  color: var(--text);
  line-height: 1.4;
}
.autofill-banner__link {
  color: var(--lavender);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.8125rem;
}
.autofill-banner__link:hover { text-decoration: underline; }
.autofill-banner__backup-wrap {
  white-space: nowrap;
  flex-shrink: 0;
}
.autofill-banner__backup-pre {
  color: var(--text);
}
.autofill-banner__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 0.125rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Status import hint ──────────────────────────────────────────────────── */
#status-import-hint.hidden {
  display: none;
}
.status-import-link {
  color: var(--lavender);
  text-decoration: none;
  font-size: 0.875rem;
}
.status-import-link:hover {
  text-decoration: underline;
}

/* ── Light-background theme: input/control fixes ─────────────────────────── */
/* .field-input uses rgba(255,255,255,...) which is invisible on white/pink cards */
[data-theme="light"] .field-input,
[data-theme="kawaii"] .field-input {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text);
}
[data-theme="light"] .field-input:focus,
[data-theme="kawaii"] .field-input:focus {
  border-color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .field-input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="kawaii"] .field-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}
[data-theme="light"] .setting-save-btn {
  background: rgba(55, 65, 81, 0.1);
  color: #374151;
  border-color: rgba(55, 65, 81, 0.3);
}
[data-theme="kawaii"] .setting-save-btn {
  background: rgba(219, 39, 119, 0.1);
  color: var(--rose);
  border-color: rgba(219, 39, 119, 0.3);
}
[data-theme="light"] .setting-save-btn:hover,
[data-theme="kawaii"] .setting-save-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .log-btn,
[data-theme="kawaii"] .log-btn {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .log-note,
[data-theme="kawaii"] .log-note {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}
[data-theme="light"] .modal-btn.secondary,
[data-theme="kawaii"] .modal-btn.secondary {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .status-pill,
[data-theme="kawaii"] .status-pill {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .cycle-bar,
[data-theme="kawaii"] .cycle-bar {
  background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .stat-box,
[data-theme="kawaii"] .stat-box {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .stat-box:hover,
[data-theme="kawaii"] .stat-box:hover {
  background: rgba(0, 0, 0, 0.08);
}
/* Info boxes: swap hardcoded dark-only tints to theme variables */
[data-theme="light"] .info-box,
[data-theme="kawaii"] .info-box {
  color: var(--text-muted);
}
[data-theme="light"] .info-box--success,
[data-theme="kawaii"] .info-box--success {
  color: var(--success);
}
[data-theme="light"] .info-box--warning,
[data-theme="kawaii"] .info-box--warning {
  color: var(--amber);
}
[data-theme="light"] .info-box--security,
[data-theme="kawaii"] .info-box--security {
  color: var(--lavender);
}
[data-theme="light"] .info-box--data-warning,
[data-theme="kawaii"] .info-box--data-warning {
  color: var(--amber);
}
[data-theme="light"] .info-box--fork,
[data-theme="kawaii"] .info-box--fork {
  color: var(--rose);
}
[data-theme="light"] .backup-status,
[data-theme="kawaii"] .backup-status {
  color: var(--text-muted);
}
[data-theme="light"] .backup-status--ok,
[data-theme="kawaii"] .backup-status--ok {
  color: var(--success);
}
[data-theme="light"] .beta-warning,
[data-theme="kawaii"] .beta-warning {
  color: var(--amber);
}
/* Chart select: white text/arrow invisible on light bg */
[data-theme="light"] .chart-select,
[data-theme="kawaii"] .chart-select {
  background-color: rgba(0, 0, 0, 0.05);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231a1a1a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text);
}
[data-theme="light"] .chart-select option,
[data-theme="kawaii"] .chart-select option {
  background: var(--card);
  color: var(--text);
}
[data-theme="light"] .import-preset-btn,
[data-theme="kawaii"] .import-preset-btn {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .import-preset-btn:hover,
[data-theme="kawaii"] .import-preset-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .btn-outline,
[data-theme="kawaii"] .btn-outline {
  border-color: var(--border);
}
[data-theme="light"] .btn-outline:hover,
[data-theme="kawaii"] .btn-outline:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Privacy choices shown before printing period history */
.print-options-overlay {
  align-items: center;
  background: rgba(8, 5, 15, 0.72);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 3000;
}
.print-options-overlay.visible {
  display: flex;
}
.print-options-box {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 1.25rem 3.125rem rgba(0, 0, 0, 0.45);
  max-width: 24rem;
  padding: 1rem;
  width: 100%;
}
.print-options-title {
  font-family: Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
}
.print-options-box > p {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0.375rem 0 0.75rem;
}
.print-option-row {
  align-items: center;
  border-top: 0.0625rem solid var(--border);
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.5rem 0.25rem;
}
.print-option-row input {
  accent-color: var(--rose);
  height: 1.125rem;
  width: 1.125rem;
}
.print-option-row strong,
.print-option-row small {
  display: block;
}
.print-option-row strong {
  font-size: 0.8125rem;
}
.print-option-row small {
  color: var(--text-muted);
  font-size: 0.6875rem;
  margin-top: 0.125rem;
}
.print-options-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

@media (max-width: 37.5rem) {
  .log-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .log-panel {
    border-bottom: 0;
    border-radius: 1.125rem 1.125rem 0 0;
    max-height: min(88dvh, 43rem);
    padding: 0.875rem 0.875rem 1rem;
  }
  .log-header {
    margin-bottom: 0.5rem;
  }
  .log-choice-grid--flow {
    gap: 0.25rem;
  }
  .log-choice-grid--flow .log-choice {
    font-size: 0.625rem;
    padding-inline: 0.125rem;
  }
  .log-new-cycle-row {
    margin-top: 0.5rem;
  }
  .print-options-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .print-options-box {
    border-bottom: 0;
    border-radius: 1rem 1rem 0 0;
    max-width: none;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  }
}

/* ── Print-only cycle summary ─────────────────────────────────────────────── */
.print-summary {
  display: none;
}
@media print {
  body > *:not(.print-summary) {
    display: none !important;
  }
  .print-summary {
    display: block !important;
    position: static;
    width: 100%;
    background: #fff;
    color: #1a1a1a;
    font-family: Georgia, "Times New Roman", serif;
    padding: 0;
  }
  .print-summary__title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 0.125rem;
  }
  .print-summary__generated {
    font-size: 0.8125rem;
    color: #555;
    margin: 0 0 1.25rem;
  }
  .print-summary__section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 0.0625rem solid #999;
  }
  .print-summary__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  .print-summary__stat-label {
    color: #555;
    font-size: 0.75rem;
  }
  .print-summary__stat-value {
    font-weight: 700;
    font-size: 1.125rem;
  }
  .print-summary__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
  }
  .print-summary__table th,
  .print-summary__table td {
    text-align: left;
    padding: 0.375rem 0.5rem;
    border-bottom: 0.0625rem solid #ccc;
  }
  .print-summary__table th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
  }
  .print-summary__note {
    display: block;
    color: #666;
    font-size: 0.75rem;
    margin-top: 0.125rem;
  }
  .print-summary__disclaimer {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 0.0625rem solid #999;
    font-size: 0.75rem;
    color: #555;
    line-height: 1.5;
  }
}
