:root {
  --bg: #f6f4f5;
  --card: #ffffff;
  --text: #1f1a1d;
  --muted: #6b6168;
  --border: #e3dde1;
  --grid: #ece7ea;
  --accent: #8a3f6b;
  --accent-text: #ffffff;
  --good: #1a7a4f;
  --bad: #c0392b;
  --notice-bg: #fff6dd;
  --notice-text: #6b5200;
  --field: #ffffff;
  /* Categorical slots 1-3 (validated set, light surface). */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  /* Flow: one hue, light to dark as it gets heavier. */
  --flow-spotting: #f3c3d4;
  --flow-light: #e590b0;
  --flow-medium: #cc4f82;
  --flow-heavy: #8e1f50;
  --period-band: rgba(204, 79, 130, 0.12);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151316;
    --card: #1f1c20;
    --text: #efe9ed;
    --muted: #a99fa6;
    --border: #383238;
    --grid: #2c272c;
    --accent: #e39ac4;
    --accent-text: #26101d;
    --good: #4fce94;
    --bad: #ff7b6b;
    --notice-bg: #3a3214;
    --notice-text: #f3dc8a;
    --field: #19161a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    /* On a dark surface heavier flow is brighter, further from the background. */
    --flow-spotting: #4d2638;
    --flow-light: #833a5c;
    --flow-medium: #c25285;
    --flow-heavy: #f08fb8;
    --period-band: rgba(194, 82, 133, 0.18);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; }
.wrap { max-width: 640px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 0.6rem; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.topnav { display: flex; gap: 4px; margin-bottom: 12px; padding: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.topnav a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.topnav a.active { background: var(--accent); color: var(--accent-text); }

.monthbar { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 4px 0 12px; }
.monthbar h1 { flex: 1; text-align: center; }
.arrow { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; line-height: 1; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.arrow.disabled { opacity: 0.3; }
.badge { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 2px 8px;
  border-radius: 999px; background: var(--border); color: var(--muted);
  font-size: 0.7rem; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 12px; }
.card.narrow { margin-top: 10vh; }
.card.narrow h1 { margin-bottom: 0.8rem; }

label { display: block; margin: 0.7rem 0 0.25rem; font-size: 0.85rem; color: var(--muted); }
.optional { font-weight: normal; opacity: 0.8; }
input[type=text], input[type=email], input[type=password], input[type=date] {
  width: 100%; min-height: 44px; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--field); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  -webkit-appearance: none; appearance: none; }
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

button, .button { display: inline-block; min-height: 44px; margin-top: 0.9rem; padding: 0.55rem 1.1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 600; text-align: center; text-decoration: none;
  cursor: pointer; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent);
  color: var(--accent-text); }
button.danger { color: var(--bad); }
button.link { min-height: 0; margin-top: 0.8rem; padding: 0; border: none; background: none;
  font-size: 0.85rem; font-weight: normal; text-decoration: underline; }
button.icon { min-height: 0; width: 36px; height: 36px; margin: 0; padding: 0; border: none;
  background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.block { display: block; width: 100%; }
.flush { margin-top: 0; }
.card > .button.block:first-child { margin-top: 0; }

.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.segmented button, .segmented a { flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 40px; margin: 0; padding: 6px 4px; border: 0; border-radius: 7px; background: none;
  color: var(--muted); font-size: 0.9rem; font-weight: 600; text-align: center; text-decoration: none; }
.segmented [aria-selected=true], .segmented a.active { background: var(--accent); color: var(--accent-text); }
.segmented [aria-selected=true] .count { background: transparent; color: inherit; }
.segmented .count { display: inline-block; margin-left: 2px; padding: 1px 6px; border-radius: 999px;
  font-size: 0.75rem; cursor: inherit; }
.row-form { display: flex; gap: 8px; align-items: stretch; }
.row-form input { flex: 1; min-width: 0; }
.row-form button { margin-top: 0; white-space: nowrap; }

.inline-form { margin-top: 12px; text-align: left; }
.inline-form summary { color: var(--accent); font-size: 0.9rem; cursor: pointer; padding: 4px 0; }
.inline-form .row-form { margin-top: 8px; }
.hint { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.count { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px;
  background: var(--border); color: var(--muted); font-size: 0.75rem; font-weight: 600; }

.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; align-items: center; gap: 8px; padding: 10px 0;
  border-top: 1px solid var(--border); }
.lines li:first-child { border-top: none; padding-top: 2px; }
.hint + .lines { margin-top: 10px; }
.line-main { flex: 1; min-width: 0; }
.line-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.meta { display: block; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }

.choices { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0;
  font-size: 1rem; color: var(--text); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.choice .meta { display: inline; }

.flash { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 0.9rem;
  line-height: 1.4; border: 1px solid var(--border); background: var(--card); }
.flash.ok { color: var(--good); }
.flash.error { color: var(--bad); }
.flash.notice { background: var(--notice-bg); color: var(--notice-text); border-color: transparent; }
form .flash { margin: 12px 0 0; }

.wrap.wide { max-width: 980px; }
h3 { font-size: 0.9rem; margin: 1.1rem 0 0.4rem; color: var(--muted); }
.page-title { margin: 0 0 12px; font-size: 1.35rem; overflow-wrap: anywhere; }
.crumbs { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.badge.warn { background: var(--notice-bg); color: var(--notice-text); }
input[type=search], input[type=tel], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--field); color: var(--text);
  font: inherit; font-size: 16px; }
input[type=search], input[type=tel], input[type=time] { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; }
select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 > div { min-width: 0; }
.row-form select { flex: 1; min-width: 0; }
.row-form .button { margin-top: 0; }
a.line-main { color: inherit; text-decoration: none; }
button.line-main { min-height: 0; margin: 0; padding: 0; border: none; border-radius: 6px;
  background: none; font-weight: normal; text-align: left; }
.note { display: block; margin-top: 2px; font-size: 0.9rem; white-space: pre-line; overflow-wrap: anywhere; }
.chev { color: var(--muted); font-size: 1.3rem; }
.line-main.has-chev { display: flex; align-items: center; gap: 8px; }
.line-text { flex: 1; min-width: 0; }
a.line-main, button.line-main, a.person-name { border-radius: 6px; }
a.line-main:active, button.line-main:active, a.person-name:active {
  background: color-mix(in srgb, var(--text) 8%, transparent); }
@media (hover: hover) {
  a.line-main:hover, button.line-main:hover, a.person-name:hover {
    background: color-mix(in srgb, var(--text) 5%, transparent); }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips a, .chips button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--muted); font-size: 0.85rem; font-weight: 600;
  text-decoration: none; }
.chips button { min-height: 0; margin: 0; }
.chips a.active, .chips button[aria-pressed=true] { background: var(--accent); border-color: var(--accent);
  color: var(--accent-text); }
.chips a.active .count, .chips button[aria-pressed=true] .count { background: transparent; color: inherit; }

.search { position: relative; margin-bottom: 12px; }
.search input { padding-right: 2.8rem; }
input[type=search]::-webkit-search-cancel-button { display: none; }
.clear { position: absolute; top: 0; right: 0; width: 2.8rem; height: 100%; min-height: 0;
  margin: 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1.5rem;
  line-height: 1; }

.monthbar h1 { position: relative; }
.monthbar button.arrow { margin: 0; padding: 0; cursor: pointer; }
.monthbar .caret { margin-left: 6px; font-size: 0.7em; color: var(--muted); }
.pick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.section { margin-bottom: 12px; padding: 0; overflow: hidden; }
.section > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  font-weight: 700; cursor: pointer; list-style: none; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: "›"; margin-left: auto; color: var(--muted);
  font-size: 1.3rem; transition: transform 0.15s; }
.section[open] > summary::after { transform: rotate(90deg); }
.section-body { padding: 0 16px 14px; }
.section-body h3:first-child { margin-top: 0; }
dialog { width: min(94vw, 480px); max-height: 92vh; padding: 16px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
/* The toast sits above the round add button. */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 88px);
  transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 0.7rem 1rem;
  border-radius: 10px; background: var(--text); color: var(--bg); font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); z-index: 40; }
.toast.is-error { background: var(--bad); color: #fff; }
.toast a { color: inherit; font-weight: 700; }
.table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 0.9rem;
  font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left;
  vertical-align: top; }
.table th { color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.table.sortable th { cursor: pointer; user-select: none; }
.table.sortable th:not([aria-sort])::after { content: " ⇅"; opacity: 0.45; }
.table.sortable th[aria-sort=ascending]::after { content: " ▲"; }
.table.sortable th[aria-sort=descending]::after { content: " ▼"; }
.table td.num, .table th.num { text-align: right; }
.table.merge .choice { min-height: 0; align-items: flex-start; font-size: 0.9rem; overflow-wrap: anywhere; }
.table.merge .same { color: var(--muted); }
.table a { color: inherit; }
.scroll { overflow-x: auto; }
.tiles { display: grid; gap: 8px; margin-bottom: 8px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.two { grid-template-columns: repeat(2, 1fr); }
.tile { min-width: 0; padding: 12px 8px; border: 1px solid var(--border); border-radius: 10px;
  text-align: center; }
.tile strong { display: block; font-size: 1.8rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { font-size: 0.8rem; color: var(--muted); }
.chart { position: relative; height: 280px; }
.chart.short { height: 200px; }

/* --- Health tracker ------------------------------------------------------ */
.toast { bottom: calc(env(safe-area-inset-bottom) + 24px); }
button.small, .button.small { min-height: 34px; padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.arrow:disabled { opacity: 0.3; cursor: default; }
input[type=number] { width: 100%; min-height: 44px; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--field); color: var(--text); font: inherit; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { margin: 0; }
.badge.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* Today */
.cycle-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: -4px 0 12px;
  min-height: 1.6rem; }
.pill { padding: 3px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; }
.pill.warn { background: var(--notice-bg); color: var(--notice-text); border-color: transparent; }
.flow-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.flow-pick button { margin: 0; padding: 0.4rem 0.2rem; min-height: 44px; font-size: 0.85rem; }
.flow-pick button[aria-checked=true] { background: var(--accent); border-color: var(--accent);
  color: var(--accent-text); }
.flow-pick button.flow-spotting[aria-checked=true] { background: var(--flow-spotting); border-color: var(--flow-spotting); color: var(--text); }
.flow-pick button.flow-light[aria-checked=true] { background: var(--flow-light); border-color: var(--flow-light); color: #1f1a1d; }
.flow-pick button.flow-medium[aria-checked=true] { background: var(--flow-medium); border-color: var(--flow-medium); color: #fff; }
.flow-pick button.flow-heavy[aria-checked=true] { background: var(--flow-heavy); border-color: var(--flow-heavy); color: var(--card); }
.group h2 { color: var(--muted); font-size: 0.85rem; }
.item { padding: 10px 0; border-top: 1px solid var(--border); }
.group > .item:first-child, .group > h2 + .item, .section-body > .item:first-child { border-top: none; padding-top: 2px; }
.item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.item-name { flex: 1 1 0; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.item-head .badge { margin-left: 0; }
.note-btn { width: 36px; height: 32px; margin-left: auto; display: flex; align-items: center; justify-content: center; }
.note-btn.has-note { color: var(--accent); }
.answers { display: flex; gap: 6px; }
.answer { flex: 1; margin: 0; min-height: 44px; padding: 0.4rem 0.3rem; font-size: 0.95rem;
  border: 2px solid var(--opt); background: var(--card); color: var(--text); position: relative; }
.answer::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px;
  border-radius: 50%; background: var(--opt); vertical-align: 0; }
.answer[aria-pressed=true] { background: var(--opt); color: var(--opt-text); }
.answer[aria-pressed=true]::before { background: var(--opt-text); content: "✓"; width: auto; height: auto;
  background: none; color: var(--opt-text); }
.details { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.detail-label { font-size: 0.85rem; color: var(--muted); margin-right: 2px; }
.detail { margin: 0; min-height: 38px; padding: 0.3rem 1rem; border-radius: 999px; font-size: 0.9rem; }
.detail[aria-checked=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.item-note { margin-top: 8px; min-height: 40px !important; }
.empty { text-align: center; }

/* Settings */
.summary-h2 { font-weight: 700; cursor: pointer; padding: 2px 0; }
.items li { padding: 6px 0; }
.swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }
.add-row { margin-top: 12px; }
[data-opt-add] { display: block; }
.opt-head, .opt-row { display: grid; grid-template-columns: 48px 1fr 1fr 36px; gap: 6px; align-items: center; }
.opt-head { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.opt-row { margin-bottom: 6px; }
.opt-row input[type=color] { width: 48px; height: 44px; padding: 2px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--field); }
.opt-row select { min-width: 0; }
.opt-used { grid-column: 2 / 4; margin-top: -2px; font-size: 0.75rem; color: var(--muted); }
.segmented .seg { flex: 1; position: relative; display: flex; margin: 0; }
.segmented .seg input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .seg span { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 6px 4px; border-radius: 7px; color: var(--muted); font-size: 0.9rem; font-weight: 600;
  text-align: center; cursor: pointer; }
.segmented .seg input:checked + span { background: var(--accent); color: var(--accent-text); }
.segmented .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.weekday-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 8px; padding: 0; border: 0; }
.daychip { position: relative; margin: 0; }
.daychip input { position: absolute; opacity: 0; }
.daychip span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.daychip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.daychip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.flush-label { margin-top: 0; }
.danger-zone { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.stat-cell { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 6px; }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-cell strong { font-size: 1.3rem; }

/* Reports */
.controls-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.controls-row .chips { margin: 0; flex: 1 1 auto; }
.cycle-nav { display: flex; gap: 4px; }
.cycle-nav[hidden] { display: none; }
.cycle-nav button { min-width: 40px; margin: 0; padding: 4px 10px; font-size: 1.2rem; line-height: 1; }
.controls-row select { width: auto; min-width: 160px; flex: 0 1 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; font-size: 0.8rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { display: inline-block; width: 12px; height: 12px; margin: 0; border-radius: 3px; }
.legend .key.dot-key { border-radius: 50%; }
.key.notdue, .heat td.notdue { background: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 5px); }
.key.empty, .heat td.empty { background: none; box-shadow: inset 0 0 0 1px var(--border); }
.key.future, .heat td.future { background: none; box-shadow: inset 0 0 0 1px var(--muted); border-radius: 2px; }
.flow-spotting { --f: var(--flow-spotting); }
.flow-light { --f: var(--flow-light); }
.flow-medium { --f: var(--flow-medium); }
.flow-heavy { --f: var(--flow-heavy); }
.key.flow-spotting, .key.flow-light, .key.flow-medium, .key.flow-heavy,
.heat td.flow-spotting, .heat td.flow-light, .heat td.flow-medium, .heat td.flow-heavy { background: var(--f); }
.grid-scroll { margin: 0 -4px; padding: 0 4px 4px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 0.75rem; }
.heat th { position: sticky; left: 0; z-index: 1; padding: 0 8px 0 0; background: var(--card);
  text-align: left; font-weight: normal; white-space: nowrap; }
.heat tbody th .rowhead { display: flex; align-items: center; gap: 6px; width: 150px; }
.heat th .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.heat th .pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.heat.overlay tbody th .rowhead { width: 92px; }
.table.nowrap td, .table.nowrap th { white-space: nowrap; }
.marker-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.marker-pick select { width: auto; flex: 0 1 220px; min-height: 36px; padding: 0.3rem 0.5rem; }
.marker-chip { margin: 0; min-height: 36px; padding: 0.3rem 0.8rem; border-radius: 999px;
  border: 2px solid var(--chip); background: var(--card); font-size: 0.85rem; }
.marker-chip::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--chip); }
.marker-chip::after { content: "×"; margin-left: 8px; color: var(--muted); }
.heat thead th { position: static; padding: 0; color: var(--muted); font-size: 0.65rem; text-align: center; }
.heat thead th.corner, .heat thead tr.cycle-days th:first-child { position: sticky; left: 0; text-align: left; }
.heat thead th.month { text-align: left; white-space: nowrap; overflow: visible; max-width: 0; }
.heat thead th.cd.start { color: var(--text); font-weight: 700; }
.heat thead th.sunday { color: var(--text); }
.heat td { width: 10px; min-width: 10px; height: 14px; padding: 0; border-radius: 2px; text-align: center;
  font-size: 0.6rem; font-weight: 700; line-height: 1; }
.heat.large td { width: 20px; min-width: 20px; height: 20px; }
.heat td.start { box-shadow: -2px 0 0 0 var(--text); }
.heat td.empty.start { box-shadow: -2px 0 0 0 var(--text), inset 0 0 0 1px var(--border); }
.heat td.noted { background-image: radial-gradient(circle at 80% 20%, currentColor 1.5px, transparent 2px); }
.heat tr.period-row th, .heat tr.notes-row th { font-weight: 600; }
.heat td.has-note { background: radial-gradient(circle, var(--accent) 3px, transparent 3.5px); }
#day-note { margin-top: 4px; }
.heat.overlay td { width: 16px; min-width: 16px; height: 18px; }
.heat.overlay td.none { background: none; }
.heat.overlay td.due-end { box-shadow: inset 0 0 0 2px var(--text); }
.dots { display: flex; gap: 1px; justify-content: center; align-items: center; height: 100%; }
.dot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 0 1px var(--card); }
.tile strong { font-size: 1.5rem; }
@media (max-width: 480px) {
  .tiles.three { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tile strong { font-size: 1.2rem; }
  .flow-pick button { font-size: 0.78rem; }
}
.heading-label { display: inline; margin: 0; font-size: inherit; color: inherit; }

/* Checkbox items and search on the Today page */
.item.is-check { padding: 4px 0; }
.check-head { margin-bottom: 0; }
.tick { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 44px;
  margin: 0; color: var(--text); font-size: 1rem; cursor: pointer; }
.tick input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--opt, var(--accent)); cursor: pointer; }
.tick .item-name { flex: 1 1 0; }
.none-found { text-align: center; color: var(--muted); }
.flush-seg { margin-bottom: 4px; }
.section .count { margin-left: 4px; }

/* Answered items fold to one line */
.item.is-compact { padding: 2px 0; }
.compact { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0;
  padding: 4px 2px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font-weight: normal; text-align: left; }
.compact:active { background: color-mix(in srgb, var(--text) 8%, transparent); }
.compact .item-name { flex: 1 1 0; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.compact-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.compact-answer { flex: none; color: var(--muted); font-size: 0.9rem; }
.compact-note { flex: none; color: var(--accent); }
.item.is-compact + .item.is-compact { border-top-color: transparent; }

#trend-item { width: auto; max-width: 60%; min-height: 40px; }
.heat tbody th .rowhead.link { cursor: pointer; }
.heat tbody th .rowhead.link .name { text-decoration: underline; text-decoration-color: var(--border);
  text-underline-offset: 3px; }
.chart-empty { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }

/* Unsaved changes on a settings form. */
.unsaved-mark { display: block; margin: 8px 0; color: var(--notice-text); font-weight: 600; }
.unsaved-mark::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: currentColor; vertical-align: middle; }
.unsaved-mark[hidden] { display: none; }

/* Reports grid: the collapsible "Normally hidden" group. */
.heat .group-head th { padding-top: 10px; }
.heat .group-toggle { display: flex; align-items: center; gap: 6px; width: 150px; margin: 0; padding: 4px 0;
  min-height: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; }
.heat .group-toggle::before { content: "▸"; color: var(--muted); }
.heat .group-toggle[aria-expanded=true]::before { content: "▾"; }
.heat .group-toggle .count { margin-left: auto; color: var(--muted); font-weight: 400; }
.heat td.group-fill { background: none; border: 0; }
.heat .none-row th { color: var(--muted); font-weight: 400; padding: 6px 0; }
