/* Cycle Tracker theme variables — dark defaults (values match the original
   hard-coded palette, so dark mode renders identically). Light overrides below. */
.ct-overlay {
  --ct-bg:#0F172A; --ct-card:#1E293B; --ct-chrome:#0B1120; --ct-hover:#16233C; --ct-hero2:#172033;
  --ct-border:#334155; --ct-cardborder:#2E3D57; --ct-border-2:#2A3852; --ct-line:#273244; --ct-line-2:#24314A; --ct-border-strong:#475569;
  --ct-text:#F1F5F9; --ct-text-2:#CBD5E1; --ct-muted:#9CA9BA; --ct-dim:#64748B; --ct-hint:#8A97A8;
}

/* ============================================================
   Cycle Tracker — ALL styles scoped under .ct-overlay so nothing
   here can touch the existing fitness page. Dark theme, mobile-first.
   ============================================================ */
.ct-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--ct-bg); color: var(--ct-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
  display: none; flex-direction: column;
  transform: translateY(100%); transition: transform 300ms ease-out;
  -webkit-text-size-adjust: 100%;
}
.ct-overlay.ct-shown { display: flex; }
.ct-overlay.ct-open { transform: translateY(0); }
.ct-overlay * { box-sizing: border-box; }
.ct-overlay ::-webkit-scrollbar { width: 8px; height: 8px; }
.ct-overlay ::-webkit-scrollbar-thumb { background: var(--ct-border); border-radius: 8px; }

/* shell: sidebar (desktop) + main; bottom tab bar (mobile) */
.ct-overlay .ct-shell { flex: 1; display: flex; min-height: 0; }
.ct-overlay .ct-side { width: 224px; flex: none; background: var(--ct-chrome); border-right: 1px solid var(--ct-card);
  padding: 14px 10px; overflow-y: auto; display: none; }
.ct-overlay .ct-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px;
  padding: 6px 10px 16px; color: #FCD34D; letter-spacing: .01em; }
.ct-overlay .ct-navitem { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--ct-muted); padding: 11px 12px; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 600; margin-bottom: 2px; transition: background .15s, color .15s; }
.ct-overlay .ct-navitem:hover { background: var(--ct-hover); color: var(--ct-text); }
.ct-overlay .ct-navitem.active { background: var(--ct-hover); color: #fff; box-shadow: inset 3px 0 0 #3B82F6; }
.ct-overlay .ct-navico { font-size: 17px; width: 22px; text-align: center; }

.ct-overlay .ct-mainwrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ct-overlay .ct-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--ct-card); background: var(--ct-chrome); flex: none; }
.ct-overlay .ct-title { font-weight: 800; font-size: 16px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ct-overlay .ct-topbtns { display: flex; align-items: center; gap: 8px; flex: none; }
.ct-overlay .ct-close, .ct-overlay .ct-guidebtn {
  background: var(--ct-card); border: 1px solid var(--ct-border); color: var(--ct-text); border-radius: 9px;
  padding: 9px 13px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.ct-overlay .ct-guidebtn:hover { background: var(--ct-hover); border-color: #3B82F6; color: #fff; }
.ct-overlay .ct-close:hover { background: #EF4444; border-color: #EF4444; color: #fff; }
.ct-overlay .ct-content { flex: 1; overflow-y: auto; padding: 16px 14px 28px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.ct-overlay .ct-footer { flex: none; text-align: center; font-size: 11px; color: var(--ct-dim);
  padding: 10px 12px; border-top: 1px solid var(--ct-card); background: var(--ct-chrome); }

/* bottom tab bar (mobile) */
.ct-overlay .ct-tabs { display: flex; background: var(--ct-chrome); border-top: 1px solid var(--ct-card); flex: none;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  padding-bottom: env(safe-area-inset-bottom); }
.ct-overlay .ct-tabs::-webkit-scrollbar { display: none; }
.ct-overlay .ct-tab { flex: 1 0 auto; min-width: 66px; scroll-snap-align: center; position: relative;
  background: transparent; border: 0; color: var(--ct-muted); padding: 9px 6px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ct-overlay .ct-tab.active { color: #60A5FA; }
.ct-overlay .ct-tab.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%;
  height: 3px; background: #3B82F6; border-radius: 0 0 3px 3px; }
.ct-overlay .ct-tabico { font-size: 18px; }
.ct-overlay .ct-tablbl { font-size: 10px; letter-spacing: .01em; font-weight: 600; }

@media (min-width: 768px) {
  .ct-overlay .ct-side { display: block; }
  .ct-overlay .ct-tabs { display: none; }
  .ct-overlay .ct-content { padding: 22px 26px 32px; }
}

/* cards + layout */
.ct-overlay .ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ct-overlay .ct-card { background: var(--ct-card); border: 1px solid var(--ct-cardborder); border-radius: 14px; padding: 16px 16px;
  margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.28), 0 6px 18px rgba(0,0,0,.14); }
.ct-overlay .ct-grid .ct-card { margin-bottom: 0; }
.ct-overlay .ct-col2 { grid-column: span 2; }
@media (max-width: 700px) { .ct-overlay .ct-col2 { grid-column: span 1; } }
.ct-overlay .ct-card-h { font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ct-muted); margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--ct-border-2); }
.ct-overlay .ct-h3 { font-size: 19px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.01em; }
.ct-overlay .ct-subtle { color: var(--ct-muted); font-size: 13.5px; margin: 0 0 12px; }
.ct-overlay .ct-muted { color: var(--ct-muted); font-size: 13.5px; }
.ct-overlay .ct-hint { color: var(--ct-hint); font-size: 12px; margin-top: 5px; display: block; line-height: 1.45; }
.ct-overlay .ct-accent { color: #60A5FA; }
.ct-overlay .ct-warn { color: #FBBF24; }
.ct-overlay .ct-empty { color: var(--ct-hint); font-size: 13.5px; text-align: center; padding: 20px 14px;
  background: var(--ct-bg); border: 1px dashed var(--ct-border); border-radius: 12px; }
.ct-overlay .ct-loading { color: var(--ct-dim); padding: 40px; text-align: center; }
.ct-overlay .ct-hr { border: 0; border-top: 1px solid var(--ct-cardborder); margin: 16px 0; }
.ct-overlay .ct-list { list-style: none; padding: 0; margin: 4px 0 0; }
.ct-overlay .ct-list li { padding: 9px 0; border-bottom: 1px solid var(--ct-line); font-size: 14px; line-height: 1.45; }
.ct-overlay .ct-list li:last-child { border-bottom: 0; }
.ct-overlay .ct-row-sb { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ct-overlay .ct-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-overlay .ct-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .ct-overlay .ct-3col { grid-template-columns: 1fr 1fr; } }

/* section header (h3 + action) — never let it crush on small screens */
.ct-overlay .ct-row-sb .ct-btn { flex: none; white-space: nowrap; }

/* stats */
.ct-overlay .ct-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-overlay .ct-stat { background: var(--ct-bg); border: 1px solid var(--ct-cardborder); border-radius: 12px; padding: 13px 10px; text-align: center; }
.ct-overlay .ct-stat-n { font-size: 26px; font-weight: 800; color: #60A5FA; line-height: 1.1; }
.ct-overlay .ct-stat-l { font-size: 11.5px; color: var(--ct-muted); margin-top: 3px; }
.ct-overlay .ct-bignext { font-size: 20px; font-weight: 800; }
.ct-overlay .ct-snap { display: flex; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 10px;
  margin-bottom: 8px; background: var(--ct-bg); border-left: 4px solid var(--ct-dim); font-size: 14px; }
.ct-overlay .ct-snap:last-child { margin-bottom: 0; }
.ct-overlay .ct-snap-green { border-left-color: #10B981; }
.ct-overlay .ct-snap-amber { border-left-color: #F59E0B; }
.ct-overlay .ct-snap-red { border-left-color: #EF4444; }
.ct-overlay .ct-snap-muted { border-left-color: var(--ct-dim); }

/* chart boxes */
.ct-overlay .ct-chartbox { position: relative; height: 240px; }
.ct-overlay .ct-chartbox-sm { height: 190px; }
.ct-overlay canvas { max-width: 100%; }

/* forms — 16px inputs prevent iOS zoom-on-focus */
.ct-overlay .ct-field { display: block; margin-bottom: 12px; }
.ct-overlay .ct-flabel { display: block; font-size: 12.5px; font-weight: 600; color: var(--ct-muted); margin-bottom: 5px; }
.ct-overlay .ct-input, .ct-overlay textarea.ct-input, .ct-overlay select.ct-input {
  width: 100%; background: var(--ct-bg); border: 1px solid var(--ct-border); color: var(--ct-text); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; font-family: inherit; line-height: 1.35; transition: border-color .15s, box-shadow .15s; }
.ct-overlay .ct-input:focus { outline: none; border-color: #3B82F6; box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
.ct-overlay input[type="range"] { padding: 0; accent-color: #3B82F6; height: 26px; }
.ct-overlay .ct-btn { background: var(--ct-border); color: var(--ct-text); border: 1px solid var(--ct-border-strong); border-radius: 10px;
  padding: 11px 16px; font-size: 14.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  min-height: 44px; transition: filter .15s, background .15s, border-color .15s; }
.ct-overlay .ct-btn:hover { filter: brightness(1.12); }
.ct-overlay .ct-btn:active { transform: translateY(1px); }
.ct-overlay .ct-btn-primary { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.ct-overlay .ct-btn-ghost { background: transparent; }
.ct-overlay .ct-btn-danger { background: transparent; border-color: #7f1d1d; color: #FCA5A5; }
.ct-overlay .ct-btn-danger:hover { background: #EF4444; color: #fff; border-color: #EF4444; }
.ct-overlay .ct-btn-danger.ct-armed { background: #EF4444; color: #fff; border-color: #EF4444; font-weight: 700; animation: ct-armed-pulse 1s infinite; }
@keyframes ct-armed-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.ct-overlay .ct-btn-sm { padding: 8px 13px; font-size: 13px; min-height: 38px; }
/* action button that follows card content — keep it clear of the block above */
.ct-overlay .ct-mt { display: inline-flex; margin-top: 14px; }
.ct-overlay .ct-btnrow { display: flex; gap: 8px; align-items: center; }
.ct-overlay .ct-btnrow.ct-wrap { flex-wrap: wrap; }
.ct-overlay .ct-x { background: transparent; border: 1px solid var(--ct-border); color: var(--ct-muted); border-radius: 8px;
  width: 32px; height: 32px; flex: none; cursor: pointer; line-height: 1; font-size: 13px; transition: border-color .15s, color .15s; }
.ct-overlay .ct-x:hover { border-color: #EF4444; color: #EF4444; }
.ct-overlay .ct-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em; margin-left: 8px; }
.ct-overlay .ct-badge-green { background: #064E3B; color: #6EE7B7; }
.ct-overlay .ct-badge-blue { background: #1E3A8A; color: #93C5FD; }
.ct-overlay .ct-badge-red { background: #7f1d1d; color: #FCA5A5; }

/* compound builder rows — grid on desktop, tidy wrap on phone */
.ct-overlay .ct-comprow { display: grid; grid-template-columns: 2fr 1fr .8fr 1.3fr auto; gap: 7px; margin-bottom: 8px; align-items: center; }
@media (max-width: 620px) {
  .ct-overlay .ct-comprow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
    background: var(--ct-bg); border: 1px solid var(--ct-border-2); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
  .ct-overlay .ct-comprow > *:nth-child(1) { flex: 1 1 100%; }
  .ct-overlay .ct-comprow > *:nth-child(2) { flex: 2 1 0; }
  .ct-overlay .ct-comprow > *:nth-child(3) { flex: 1 1 0; }
  .ct-overlay .ct-comprow > *:nth-child(4) { flex: 2 1 0; }
  .ct-overlay .ct-comprow > *:nth-child(5) { flex: none; margin-left: auto; }
}

/* tables (horizontal scroll + sticky first column on small screens) */
.ct-overlay .ct-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ct-overlay .ct-table th { text-align: left; color: var(--ct-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; padding: 9px 10px; border-bottom: 1px solid var(--ct-border); white-space: nowrap; }
.ct-overlay .ct-table td { padding: 9px 10px; border-bottom: 1px solid var(--ct-line); white-space: nowrap; }
.ct-overlay .ct-cell-green { color: #6EE7B7; } .ct-overlay .ct-cell-amber { color: #FCD34D; } .ct-overlay .ct-cell-red { color: #FCA5A5; font-weight: 700; }
.ct-overlay .ct-scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.ct-overlay .ct-scrollx .ct-table th:first-child, .ct-overlay .ct-scrollx .ct-table td:first-child {
  position: sticky; left: 0; background: var(--ct-card); }

/* stacked history cards (injections) */
.ct-overlay .ct-histlist { display: flex; flex-direction: column; gap: 8px; }
.ct-overlay .ct-histcard { display: flex; align-items: center; gap: 10px; background: var(--ct-bg);
  border: 1px solid var(--ct-border-2); border-radius: 12px; padding: 11px 12px; }
.ct-overlay .ct-histcard-main { flex: 1; min-width: 0; }
.ct-overlay .ct-histcard-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ct-overlay .ct-histcard-top strong { font-size: 14.5px; }
.ct-overlay .ct-histcard-dose { color: #60A5FA; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.ct-overlay .ct-histcard-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ct-muted); font-size: 12.5px; margin-top: 3px; }
.ct-overlay .ct-dotsep { color: var(--ct-border-strong); }
.ct-overlay .ct-histcard-tag { background: #422006; color: #FCD34D; border-radius: 999px; padding: 1px 8px; font-size: 10.5px; font-weight: 700; text-transform: capitalize; }

/* body map */
.ct-overlay .ct-figures { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.ct-overlay .ct-figure { text-align: center; }
.ct-overlay .ct-bodysvg { width: 130px; height: 260px; background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: 12px; }
.ct-overlay .ct-figlbl { font-size: 12px; color: var(--ct-muted); margin-top: 5px; font-weight: 600; }
.ct-overlay .ct-sitedot { transition: r .1s; }
.ct-overlay .ct-sitedot:hover { stroke: var(--ct-text); }
.ct-overlay .ct-selsite { text-align: center; margin-top: 10px; font-size: 14px; }
.ct-overlay .ct-siterot { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 7px; }
.ct-overlay .ct-siterot-item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px;
  background: var(--ct-bg); border-left: 4px solid var(--ct-dim); font-size: 12.5px; }

/* syringe */
.ct-overlay .ct-pepout { margin-top: 10px; }
.ct-overlay .ct-pepline { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ct-line); font-size: 14px; }
.ct-overlay .ct-syrwrap { margin-top: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ct-overlay .ct-syringe { background: var(--ct-bg); border-radius: 10px; }
.ct-overlay .ct-preset { padding: 9px 0; border-bottom: 1px solid var(--ct-line); }

/* gantt */
.ct-overlay .ct-gantt { display: flex; flex-direction: column; gap: 8px; }
.ct-overlay .ct-gantt-row { display: flex; align-items: center; gap: 10px; }
.ct-overlay .ct-gantt-lbl { width: 96px; flex: none; font-size: 12.5px; color: var(--ct-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 768px) { .ct-overlay .ct-gantt-lbl { width: 130px; } }
.ct-overlay .ct-gantt-track { flex: 1; height: 16px; background: var(--ct-bg); border-radius: 8px; position: relative; }
.ct-overlay .ct-gantt-bar { position: absolute; top: 0; height: 16px; border-radius: 8px; opacity: .9; }

/* tabs pills (lab form) */
.ct-overlay .ct-tabsrow { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.ct-overlay .ct-tabpill { background: var(--ct-bg); border: 1px solid var(--ct-border); color: var(--ct-muted); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ct-overlay .ct-tabpill.on { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.ct-overlay .ct-rangelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; margin: 10px 0; }
.ct-overlay .ct-rangeitem { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--ct-line); }

/* heatmap */
.ct-overlay .ct-heatwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ct-overlay .ct-heat { display: flex; gap: 3px; padding-bottom: 4px; }
.ct-overlay .ct-heatcol { display: flex; flex-direction: column; gap: 3px; }
.ct-overlay .ct-heatcell { width: 14px; height: 14px; border-radius: 3px; background: var(--ct-card); }
.ct-overlay .ct-heatcell.lvl1 { background: #14532D; } .ct-overlay .ct-heatcell.lvl2 { background: #F59E0B66; }
.ct-overlay .ct-heatcell.lvl3 { background: #F59E0B; } .ct-overlay .ct-heatcell.lvl4 { background: #EF4444; }
.ct-overlay .ct-heatkey { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 11.5px; color: var(--ct-hint); }

/* onboarding + gate */
.ct-overlay .ct-onbo, .ct-overlay .ct-gate { max-width: 480px; margin: 24px auto; text-align: center; padding: 0 4px; }
.ct-overlay .ct-slide h2 { margin: 6px 0; }
.ct-overlay .ct-gicon { font-size: 46px; }
.ct-overlay .ct-disc { font-size: 13px; color: var(--ct-muted); line-height: 1.55; margin: 10px 0; text-align: left;
  background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: 12px; padding: 13px 14px; }
.ct-overlay .ct-seg { display: flex; flex-direction: column; gap: 9px; margin: 14px 0; }
.ct-overlay .ct-segbtn { background: var(--ct-bg); border: 1px solid var(--ct-border); color: var(--ct-text); border-radius: 12px;
  padding: 14px; cursor: pointer; font-size: 15px; font-weight: 600; min-height: 48px; transition: border-color .15s, background .15s; }
.ct-overlay .ct-segbtn.on { border-color: #3B82F6; background: var(--ct-hover); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.ct-overlay .ct-onbo-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.ct-overlay .ct-onbo-dots, .ct-overlay .ct-dot { display: inline-flex; gap: 6px; }
.ct-overlay .ct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ct-border); display: inline-block; }
.ct-overlay .ct-dot.on { background: #3B82F6; }

/* guided setup walkthrough */
.ct-overlay .ct-onbo-wide { max-width: 640px; }
.ct-overlay .ct-onbo-head { text-align: center; }
.ct-overlay .ct-onbo-head h2 { margin: 8px 0 6px; font-size: 23px; font-weight: 800; }
.ct-overlay .ct-onbo-step { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ct-dim); margin-bottom: 2px; font-weight: 700; }
.ct-overlay .ct-gicon-sm { font-size: 36px; }
.ct-overlay .ct-getstarted { display: block; width: 100%; margin: 24px 0 8px; padding: 16px; font-size: 16px; }
.ct-overlay .ct-onbo-skip { display: block; width: 100%; margin-top: 8px; color: var(--ct-muted); font-size: 13px; min-height: 40px; }
.ct-overlay .ct-tour { display: grid; gap: 10px; margin: 18px 0 4px; text-align: left; }
.ct-overlay .ct-tour-item { display: flex; gap: 13px; align-items: flex-start; background: var(--ct-bg);
  border: 1px solid var(--ct-border); border-radius: 12px; padding: 13px 15px; }
.ct-overlay .ct-tour-ico { font-size: 24px; flex: none; width: 32px; text-align: center; line-height: 1.2; }
.ct-overlay .ct-tour-item strong { font-size: 14.5px; display: block; margin-bottom: 3px; }
.ct-overlay .ct-onbo-fields { text-align: left; margin: 18px 0 4px; }
.ct-overlay .ct-guide-ol { padding-left: 22px; margin: 8px 0 16px; }
.ct-overlay .ct-guide-ol li { padding: 5px 0; font-size: 14px; line-height: 1.5; }

/* pin pad */
.ct-overlay .ct-pinmsg { color: var(--ct-muted); margin: 12px 0; }
.ct-overlay .ct-pindots { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.ct-overlay .ct-pindot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--ct-border-strong); }
.ct-overlay .ct-pindot.on { background: #3B82F6; border-color: #3B82F6; }
.ct-overlay .ct-pinpad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; justify-content: center; margin-top: 12px; }
.ct-overlay .ct-pinkey { height: 60px; border-radius: 14px; background: var(--ct-card); border: 1px solid var(--ct-border); color: var(--ct-text); font-size: 22px; cursor: pointer; }
.ct-overlay .ct-pinkey:hover { background: var(--ct-border); }

/* toast */
.ct-overlay .ct-toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ct-card); border: 1px solid var(--ct-border); color: var(--ct-text); padding: 12px 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; max-width: 88vw; text-align: center;
  transition: opacity .25s, transform .25s; z-index: 10000; box-shadow: 0 10px 30px rgba(0,0,0,.55); pointer-events: none; }
.ct-overlay .ct-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ct-overlay .ct-toast.err { border-color: #EF4444; color: #FCA5A5; }
.ct-overlay .ct-toast.green { border-color: #10B981; color: #6EE7B7; }
@media (min-width: 768px) { .ct-overlay .ct-toast { bottom: 28px; } }

/* section heads + dashboard hero */
.ct-overlay .ct-sechead { margin-bottom: 12px; }
.ct-overlay .ct-hero { background: linear-gradient(135deg, var(--ct-card), var(--ct-hero2)); border: 1px solid var(--ct-cardborder);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.ct-overlay .ct-hero-t { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.ct-overlay .ct-hero-s { color: var(--ct-muted); font-size: 13.5px; margin-top: 3px; }

/* "More" bottom sheet */
.ct-overlay .ct-more-back { position: fixed; inset: 0; background: rgba(2,6,18,.55); z-index: 10001;
  display: flex; align-items: flex-end; opacity: 0; transition: opacity .2s; }
.ct-overlay .ct-more-back.show { opacity: 1; }
.ct-overlay .ct-more { width: 100%; background: var(--ct-chrome); border-top: 1px solid var(--ct-cardborder);
  border-radius: 16px 16px 0 0; padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .24s ease-out; max-height: 80vh; overflow-y: auto; }
.ct-overlay .ct-more-back.show .ct-more { transform: translateY(0); }
.ct-overlay .ct-more-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ct-overlay .ct-more-h strong { font-size: 15px; }
.ct-overlay .ct-more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ct-overlay .ct-more-item { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--ct-card);
  border: 1px solid var(--ct-cardborder); border-radius: 12px; padding: 14px 8px; color: var(--ct-text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.ct-overlay .ct-more-item.active { border-color: #3B82F6; color: #fff; background: var(--ct-hover); }
.ct-overlay .ct-more-ico { font-size: 22px; }

/* calendar */
.ct-overlay .ct-agenda-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--ct-line); font-size: 14px; }
.ct-overlay .ct-agenda-item:last-child { border-bottom: 0; }
.ct-overlay .ct-agenda-item.ct-snap { border-bottom: 0; margin-bottom: 8px; }
.ct-overlay .ct-agenda-when { color: var(--ct-muted); font-size: 12.5px; white-space: nowrap; }
.ct-overlay .ct-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.ct-overlay .ct-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.ct-overlay .ct-cal-dow span { text-align: center; font-size: 10.5px; color: var(--ct-dim); font-weight: 700; }
.ct-overlay .ct-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ct-overlay .ct-cal-cell { position: relative; aspect-ratio: 1 / 1; background: var(--ct-bg); border: 1px solid var(--ct-line-2);
  border-radius: 8px; color: var(--ct-text-2); font-size: 12px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; padding: 4px 0 0; }
.ct-overlay .ct-cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.ct-overlay .ct-cal-cell.today { border-color: #3B82F6; box-shadow: inset 0 0 0 1px #3B82F6; }
.ct-overlay .ct-cal-num { font-weight: 600; }
.ct-overlay .ct-cal-dots { display: flex; gap: 2px; margin-top: 3px; flex-wrap: wrap; justify-content: center; }
.ct-overlay .ct-cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ct-dim); }
.ct-overlay .ct-cal-dot.inj { background: #3B82F6; } .ct-overlay .ct-cal-dot.dose { background: #FBBF24; }
.ct-overlay .ct-cal-dot.lab { background: #EF4444; } .ct-overlay .ct-cal-dot.sym { background: #F97316; }
.ct-overlay .ct-cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.ct-overlay .ct-cal-leg { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ct-muted); }
.ct-overlay .ct-cal-detail { margin-top: 12px; }
.ct-overlay .ct-cal-detail-h { font-weight: 700; font-size: 13px; margin: 6px 0 2px; color: var(--ct-text-2); }

/* progress photos */
.ct-overlay .ct-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.ct-overlay .ct-photo-card { background: var(--ct-bg); border: 1px solid var(--ct-border-2); border-radius: 12px; overflow: hidden; }
.ct-overlay .ct-photo-card.sel { border-color: #3B82F6; box-shadow: 0 0 0 2px rgba(59,130,246,.4); }
.ct-overlay .ct-photo-thumb { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; cursor: pointer; background: var(--ct-card); }
.ct-overlay .ct-photo-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; font-size: 12px; color: var(--ct-text-2); }
.ct-overlay .ct-photo-sub { padding: 0 9px 9px; font-size: 11.5px; color: var(--ct-muted); }
.ct-overlay .ct-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.ct-overlay .ct-compare-col { text-align: center; font-size: 12px; color: var(--ct-muted); }
.ct-overlay .ct-photo-img { width: 100%; border-radius: 10px; display: block; margin-bottom: 5px; background: var(--ct-card); }

/* guides accordion */
.ct-overlay .ct-acc { border: 1px solid var(--ct-cardborder); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: var(--ct-card); }
.ct-overlay .ct-acc-head { width: 100%; display: flex; align-items: center; gap: 11px; background: transparent;
  border: 0; color: var(--ct-text); padding: 14px 15px; cursor: pointer; text-align: left; font-family: inherit; }
.ct-overlay .ct-acc-ico { font-size: 20px; flex: none; }
.ct-overlay .ct-acc-title { flex: 1; font-weight: 700; font-size: 14.5px; }
.ct-overlay .ct-acc-caret { color: var(--ct-dim); transition: transform .2s; }
.ct-overlay .ct-acc-head.open .ct-acc-caret { transform: rotate(180deg); }
.ct-overlay .ct-acc-body { padding: 0 16px 15px; font-size: 14px; line-height: 1.6; color: var(--ct-text-2); border-top: 1px solid var(--ct-border-2); }
.ct-overlay .ct-acc-body p { margin: 12px 0; }
.ct-overlay .ct-acc-body ul { margin: 10px 0; padding-left: 20px; }
.ct-overlay .ct-acc-body li { margin: 5px 0; }
.ct-overlay .ct-acc-body strong { color: var(--ct-text); }
.ct-overlay .ct-acc-body em { color: #93C5FD; font-style: normal; }

/* dosing charts */
.ct-overlay .ct-dose-open { display: block; width: 100%; margin: 6px 0 4px; }
.ct-overlay .ct-dose-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.ct-overlay .ct-dose-seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.ct-overlay .ct-dose-seg3 .ct-segbtn { padding: 12px 6px; font-size: 13.5px; }
.ct-overlay .ct-dose-list { display: flex; flex-direction: column; gap: 10px; }
.ct-overlay .ct-dose-card { background: var(--ct-card); border: 1px solid var(--ct-cardborder); border-radius: 12px; padding: 14px 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,.24); }
.ct-overlay .ct-dose-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ct-overlay .ct-dose-top strong { font-size: 15.5px; }
.ct-overlay .ct-dose-tag { font-size: 10.5px; font-weight: 700; color: #93C5FD; background: rgba(30,58,138,.35);
  border: 1px solid #1E3A8A; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.ct-overlay .ct-dose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (min-width: 560px) { .ct-overlay .ct-dose-grid { grid-template-columns: repeat(4, 1fr); } }
.ct-overlay .ct-dose-kv { display: flex; flex-direction: column; gap: 2px; }
.ct-overlay .ct-dose-k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ct-dim); font-weight: 700; }
.ct-overlay .ct-dose-v { font-size: 13.5px; color: var(--ct-text); font-weight: 600; }
.ct-overlay .ct-dose-notes { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--ct-border-2); font-size: 12.5px; color: var(--ct-muted); line-height: 1.55; }


/* ============================================================
   LIGHT THEME — toggled by adding .ct-light to the overlay.
   ============================================================ */
.ct-overlay.ct-light {
  --ct-bg:#eef1f6; --ct-card:#ffffff; --ct-chrome:#f4f6fa; --ct-hover:#e7edf7; --ct-hero2:#e9eef7;
  --ct-border:#d4dae4; --ct-cardborder:#dde2ec; --ct-border-2:#e0e5ee; --ct-line:#e5e9f0; --ct-line-2:#e5e9f0; --ct-border-strong:#b9c2d1;
  --ct-text:#16181d; --ct-text-2:#33404f; --ct-muted:#5b6472; --ct-dim:#7a8494; --ct-hint:#6c7684;
}
/* contrast fixes for light: accent text, status text, and white-on-tint spots */
.ct-overlay.ct-light .ct-accent,
.ct-overlay.ct-light .ct-stat-n,
.ct-overlay.ct-light .ct-tab.active,
.ct-overlay.ct-light .ct-histcard-dose { color:#2563eb; }
.ct-overlay.ct-light .ct-navitem.active,
.ct-overlay.ct-light .ct-more-item.active { color:#1d4ed8; }
.ct-overlay.ct-light .ct-guidebtn:hover { color:#16181d; }
.ct-overlay.ct-light .ct-brand { color:#b45309; }
.ct-overlay.ct-light .ct-warn,
.ct-overlay.ct-light .ct-cell-amber { color:#b45309; }
.ct-overlay.ct-light .ct-cell-green { color:#128a4a; }
.ct-overlay.ct-light .ct-cell-red,
.ct-overlay.ct-light .ct-btn-danger,
.ct-overlay.ct-light .ct-toast.err { color:#c0392b; }
.ct-overlay.ct-light .ct-dose-tag { background:rgba(37,99,235,.10); border-color:#bcd0f5; color:#1d4ed8; }
.ct-overlay.ct-light .ct-heatcell { background:#e5e9f0; }
.ct-overlay.ct-light .ct-histcard-tag { background:#fdecc9; color:#8a5a06; }

/* ---- menu / launcher ---- */
.ct-overlay .ct-menu-continue { display: block; width: 100%; margin: 4px 0 16px; }
.ct-overlay .ct-menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ct-overlay .ct-menu-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--ct-card); border: 1px solid var(--ct-cardborder); border-radius: 14px; padding: 15px 15px 16px;
  cursor: pointer; color: var(--ct-text); font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.22); transition: border-color .15s, transform .1s; }
.ct-overlay .ct-menu-tile:hover { border-color: #3B82F6; }
.ct-overlay .ct-menu-tile:active { transform: translateY(1px); }
.ct-overlay .ct-menu-ico { font-size: 26px; line-height: 1; }
.ct-overlay .ct-menu-name { font-weight: 800; font-size: 15px; }
.ct-overlay .ct-menu-desc { font-size: 12px; color: var(--ct-muted); }
