@font-face {
  font-family: Silkscreen;
  src: url('./assets/silkscreen-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Silkscreen;
  src: url('./assets/silkscreen-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Geist;
  src: url('./assets/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fffefe;
  --surface: rgb(255 254 254 / 90%);
  --field-bg: rgb(255 254 254 / 90%);
  --text: #563c4c;
  --muted: #765669;
  --accent: #ce6798;
  --accent-ink: color-mix(in srgb, var(--accent) 74%, #3e1b31);
  --on-accent: #fff;
  --line: color-mix(in srgb, var(--accent) 32%, var(--surface));
  --rule: color-mix(in srgb, var(--accent) 21%, var(--surface));
  --grid: color-mix(in srgb, var(--accent) 11%, transparent);
  --soft: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --shadow: 2px 2px 0 color-mix(in srgb, var(--accent) 15%, transparent);
  --danger: #a13739;
  --heading: Silkscreen, Geist, system-ui, sans-serif;
}
:root[data-appearance="dark"] {
  color-scheme: dark;
  --bg: #171117;
  --surface: rgb(33 24 32 / 90%);
  --field-bg: rgb(23 17 23 / 90%);
  --soft: color-mix(in srgb, color-mix(in srgb, var(--accent) 9%, #211820) 90%, transparent);
  --accent-soft: color-mix(in srgb, color-mix(in srgb, var(--accent) 18%, #211820) 90%, transparent);
  --text: #f4e4ed;
  --muted: #ddc5d4;
  --accent: #f29cc5;
  --accent-ink: var(--accent);
  --on-accent: #24111a;
  --shadow: 2px 2px 0 #100b11;
  --danger: #f7b1a9;
}
/* Keep the browser canvas on the theme background. */
html { background-color: var(--bg); }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 400 15px/1.5 Geist, system-ui, sans-serif;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 10px 10px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1, h2 { font-family: var(--heading); font-weight: 700; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
.shell { width: min(664px, calc(100% - 48px)); margin-inline: auto; }
.diary-title, .detail-view h1 {
  color: var(--bg);
  letter-spacing: .045em;
  text-shadow:
    -1px -1px var(--accent), 1px -1px var(--accent),
    -1px 1px var(--accent), 1px 1px var(--accent),
    2px 2px var(--line);
}
.diary-title {
  white-space: normal; overflow-wrap: anywhere; text-wrap: balance; text-align: center; padding: 37px 0 25px;
  font-size: clamp(18px, 5.3vw, 34px); letter-spacing: .06em; text-transform: uppercase;
}
.diary-title:focus, .detail-view h1:focus { outline: none; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 24px; }
.quick-action {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 5px;
  min-height: 105px; padding: 9px 3px; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); font: 400 11px/1.2 var(--heading);
  letter-spacing: .055em;
  transition: background .15s, box-shadow .15s;
  animation: quick-bob 3.5s ease-in-out infinite;
}
.quick-action:nth-child(2) { animation-delay: .3s; }
.quick-action:nth-child(3) { animation-delay: .6s; }
.quick-action:nth-child(4) { animation-delay: .9s; }
.quick-action:nth-child(5) { animation-delay: 1.2s; }
.quick-action:nth-child(6) { animation-delay: 1.5s; }
.latch-timer-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; margin-bottom: 20px; font-size: 11px; }
.latch-timer-banner button { white-space: nowrap; }
.latch-live { display: grid; gap: 12px; }
.latch-clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.latch-clocks > div { border: 1px solid var(--sheet-line); padding: 12px; display: grid; gap: 6px; text-align: center; }
.latch-clocks span { color: var(--sheet-label); font-size: 11px; }
.latch-clocks strong { font-size: 15px; color: var(--sheet-copy); font-variant-numeric: tabular-nums; }
.latch-controls button { flex: 1; min-height: 44px; }
.event-detail, .recent-entries li { overflow-wrap: anywhere; }
.quick-action > span { position: absolute; left: 8px; top: 6px; color: var(--accent); font: 400 12px/1.2 var(--heading); }
.quick-action img, .event-icon img, .overview-icon { object-fit: contain; image-rendering: pixelated; }
.quick-action:hover { animation-play-state: paused; background: var(--soft); border-color: var(--accent); }
.quick-action:active { animation: none; transform: translateY(2px); box-shadow: 1px 1px 0 var(--line); }
@keyframes quick-bob {
  0%, 17.143%, 100% { transform: translateY(0); }
  8.571% { transform: translateY(-4px); }
}

.dashboard, .activity-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 21px; }
.panel { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.timeline-panel .timeline:empty { display: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 35px; }
.section-heading h2 { color: var(--accent); font-size: 12px; letter-spacing: .065em; }
.detail-link, .detail-back {
  color: var(--accent-ink); font: 400 10px/1.2 var(--heading); white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 35px; gap: 4px;
}
.detail-link:hover .link-label, .detail-back:hover .link-label, .baby-edit:hover { text-decoration: underline; text-underline-offset: 4px; }
.detail-link [aria-hidden="true"], .detail-back [aria-hidden="true"] { font: 400 14px/1 Geist, sans-serif; }
.recent-entries { padding: 0; list-style: none; }
.recent-entries li, .sleep-status p { padding: 7px 10px; font-size: 11px; color: var(--muted); }
.recent-entries li + li, .sleep-status p + p { border-top: 1px solid var(--rule); }
.recent-entries strong, .sleep-status strong { color: var(--accent-ink); font-weight: 650; }

.overview-period, .sample-label { color: var(--muted); font-size: 11px; }
.overview dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview dl > div { display: grid; grid-template-columns: minmax(76px, 1fr) minmax(0, 1fr); align-items: start; gap: 5px; min-width: 0; padding: 6px 10px; }
.overview dl > div:nth-child(even) { border-left: 1px solid var(--rule); }
.overview dl > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
.overview dl > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.overview dt { display: flex; align-items: center; gap: 5px; color: var(--accent-ink); font-weight: 600; font-size: 11px; }
.overview dd { min-width: 0; padding-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; font-weight: 400; text-align: right; overflow-wrap: anywhere; }
.overview-icon { display: block; width: 24px; height: 24px; flex: none; }

.filters { display: flex; gap: 5px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: thin; }
.filters button { min-height: 35px; padding: 4px 9px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.filters button:hover { background: var(--soft); }
.filters button[aria-pressed="true"] { border-color: var(--line); color: var(--accent-ink); background: var(--soft); }
.filters button:focus-visible { outline-offset: -2px; }
.timeline { list-style: none; padding: 0; }
.timeline li + li { border-top: 1px solid var(--rule); }
.timeline-entry {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: 9px;
  width: 100%; border: 0; background: transparent; padding: 7px 9px; min-height: 52px; text-align: left;
}
.timeline-entry:hover { background: var(--soft); }
.event-icon { display: grid; place-items: center; width: 32px; height: 34px; }
.event-icon img { width: 29px; height: 29px; }
.event-description { display: grid; align-content: center; gap: 2px; min-height: 34px; overflow-wrap: anywhere; }
.event-description strong { font-weight: 650; font-size: 11px; line-height: 1.3; }
:root:not([data-visual-theme="gummy"]) .event-description strong { color: var(--accent-ink); }
.event-detail { color: var(--muted); font-size: 10px; }
.timeline-entry time { color: var(--muted); font-weight: 600; font-size: 9px; white-space: nowrap; }
.entry-chevron { color: var(--accent-ink); font-size: 15px; line-height: 1; }
.empty-message { padding: 15px 10px; color: var(--muted); font-size: 13px; }
.diary-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 20px 0 29px; }
.diary-footer .sample-label { margin-right: auto; }
.baby-section { margin-top: 21px; }
.baby-edit { border: 0; background: transparent; padding: 0; }
.baby-panel { padding: 11px 12px; }
.baby-form { display: grid; gap: 10px; }
.baby-form > p { font-size: 12px; color: var(--muted); }
.baby-form .field > span { font: 400 9px/1.5 var(--heading); color: var(--muted); text-transform: uppercase; }
.baby-form input { max-width: 100%; border-radius: 0; font-size: 14px; }
.baby-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.baby-form-actions button { font-size: 12px; border-radius: 0; }
.baby-stats { display: grid; gap: 9px; }
.baby-stats > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: start; }
.baby-stats dt { font-size: 11px; color: var(--muted); }
.baby-stats dd { font-size: 12px; font-weight: 600; color: var(--accent-ink); text-align: right; }
.wake-window-label { display: block; }
.wake-window-ending { white-space: nowrap; }
.wake-info { display: inline-grid; place-items: center; vertical-align: middle; width: 20px; height: 20px; padding: 0; border: 0; background: transparent; color: var(--accent-ink); }
.wake-info > span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid currentColor; border-radius: 50%; font: 600 11px/1 Geist, sans-serif; }
.wake-info:hover, .wake-info[aria-expanded="true"] { background: var(--soft); }
.baby-help { color: var(--muted); font-size: 11px; padding-top: 9px; margin-top: 9px; border-top: 1px solid var(--rule); }
.baby-help a { text-decoration: underline; text-underline-offset: 2px; }

.detail-view { min-width: 0; max-width: 100%; padding: 25px 0 42px; }
.detail-back { min-height: 44px; }
.detail-view h1 { margin: 8px 0 22px; font-size: clamp(21px, 5.8vw, 31px); }
.detail-days { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 16px; }
.detail-day { padding-bottom: 3px; }
.detail-day > h2 { color: var(--accent); padding: 11px 10px; border-bottom: 1px solid var(--rule); font-size: clamp(10px, 3.4vw, 12px); }
.detail-empty { padding: 15px; color: var(--muted); font-size: 13px; }
.history-controls { display: grid; gap: 10px; margin-bottom: 18px; }
.history-date-field > span { font: 400 9px/1.5 var(--heading); color: var(--muted); text-transform: uppercase; }
.history-date-field input { max-width: 100%; border-radius: 0; font: 400 14px/1.4 Geist, sans-serif; background: var(--surface); }
.history-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.history-pagination button {
  min-height: 36px;
  border: 1px solid var(--line);
  padding: 6px 9px;
  background: var(--soft);
  color: var(--accent-ink);
  font: 400 9px/1.4 var(--heading);
  text-transform: uppercase;
}
.history-pagination button:last-child { justify-self: end; }
.history-pagination button:first-child { justify-self: start; }
.history-pagination button:disabled { opacity: .35; cursor: default; }
.history-pagination span { color: var(--muted); font-size: 11px; }

.secondary, .primary, .text-button, .danger-button, .icon-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px;
  border: 1px solid transparent; border-radius: 6px; padding: 8px 14px;
  background: transparent; font-size: 14px; font-weight: 650;
}
.secondary, .icon-button { border-color: var(--line); background: var(--surface); }
.secondary:hover, .icon-button:hover, .text-button:hover { background: var(--soft); }
.icon-button { width: 44px; padding: 0; }
.close-dialog.icon-button { font-size: 23px; line-height: 1; }
.close-mark { position: relative; display: block; width: 18px; height: 18px; }
.close-mark::before, .close-mark::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}
.close-mark::after { transform: rotate(-45deg); }
.settings-button { border-radius: 0; color: var(--accent-ink); font: 400 10px/1.2 var(--heading); }
.primary { background: var(--accent-ink); color: var(--on-accent); padding-inline: 19px; }
.primary:hover { filter: brightness(.93); }
dialog {
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
  width: min(465px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0;
  overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent-ink) 22%, transparent);
}
dialog::backdrop { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
/* Fade the diary itself rather than painting a full-viewport tinted layer. */
body:has(dialog[open]) #app { opacity: .45; }
body:has(dialog[open]) .gummy-background { opacity: .35; }
dialog form { margin: 0; }
.dialog-header, .dialog-footer { display: flex; align-items: center; gap: 10px; padding: 14px 20px; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { color: var(--accent); font-size: clamp(15px, 4.8vw, 20px); }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-footer .primary { min-width: 120px; }
.dialog-footer .danger-text { margin-right: auto; }
.dialog-body { display: grid; gap: 15px; padding: 18px 20px; }
#entry-fields { display: grid; gap: 13px; }
.field { display: grid; gap: 6px; min-width: 0; font-size: 14px; font-weight: 650; }
input, select { min-width: 0; width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--field-bg); }
.input-with-unit { display: flex; align-items: center; position: relative; }
.input-with-unit input { padding-right: 42px; }
.input-with-unit > span { position: absolute; right: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 7px; font-weight: 700; }
.segmented { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--soft); }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input, .sr-only {
  position: absolute; width: 1px; height: 1px; min-height: 0;
  padding: 0; border: none; clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.segmented span { display: grid; place-items: center; min-height: 39px; border: 1px solid transparent; padding: 4px 8px; border-radius: 9px; font-size: 13px; font-weight: 650; }
.segmented label:hover span { background: var(--accent-soft); }
.segmented input:checked + span { background: var(--surface); border-color: var(--line); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-total { text-align: right; font-weight: 700; color: var(--accent-ink); }
.form-error { color: var(--danger); font-size: 13px; font-weight: 650; }
.danger-text { color: var(--danger); }
.confirm-delete { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 10px; font-size: 13px; }
.confirm-delete p { margin-bottom: 8px; }
.danger-button { background: var(--danger); color: var(--surface); }

.settings-body { display: grid; gap: 20px; padding: 22px; min-width: 0; }
.settings-body > * + * { border-top: 1px solid var(--rule); padding-top: 16px; }
.settings-body .field { font-weight: 400; }
.settings-body .field > span, .settings-body legend, .settings-body h3, .sample-setting strong {
  color: var(--accent); font: 400 10px/1.5 var(--heading); letter-spacing: .04em; text-transform: uppercase;
}
.settings-body legend { margin-bottom: 8px; }
.settings-help { margin-top: 7px; color: var(--muted); font: 400 11px/1.5 Geist, system-ui, sans-serif; }
#settings-view input:not([type="radio"]):not([type="checkbox"]) {
  min-height: 44px; border-radius: 0; padding: 0 10px;
  font: 400 14px/1.4 Geist, system-ui, sans-serif;
}
#settings-view .segmented { padding: 0; gap: 0; border: 1px solid var(--line); border-radius: 0; background: var(--surface); }
#settings-view .segmented label + label { border-left: 1px solid var(--line); }
#settings-view .segmented span {
  min-height: 42px; border: 0; border-radius: 0; padding: 5px;
  color: var(--muted); font: 400 10px/1.5 var(--heading); text-transform: uppercase;
}
#settings-view .segmented input:checked + span { background: var(--accent-soft); color: var(--accent-ink); }
.pump-settings { list-style: none; padding: 0; margin-block: 4px 7px; }
.pump-settings li { display: flex; align-items: center; gap: 5px; min-height: 44px; font-size: 12px; border-bottom: 1px solid var(--rule); }
.pump-settings li > span { flex: 1; overflow-wrap: anywhere; }
.pump-settings .text-button { padding-inline: 6px; color: var(--muted); font: 400 9px/1.4 var(--heading); text-transform: uppercase; }
.pump-config-form { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.pump-config-form input { flex: 1; min-width: 110px; }
.pump-config-form .secondary, .pump-config-form .text-button { padding-inline: 10px; font: 400 9px/1.4 var(--heading); text-transform: uppercase; }
#settings-view :is(.secondary, .text-button) { border-radius: 0; }
#settings-error { margin-top: 7px; }
.sample-setting { display: flex; gap: 12px; justify-content: space-between; align-items: center; cursor: pointer; }
.sample-setting span { display: grid; gap: 4px; }
.sample-setting small { color: var(--muted); font: 400 11px/1.5 Geist, system-ui, sans-serif; }
.sample-setting input { flex: none; width: 18px; height: 18px; min-height: 18px; accent-color: var(--accent); }
.medicine-visibility-setting { min-height: 44px; }
#settings-view .medicine-visibility-setting > span { color: var(--muted); font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
#medicine-enabled { appearance: none; -webkit-appearance: none; display: grid; place-content: center; width: 18px; height: 18px; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 0; background: var(--surface); cursor: pointer; }
#medicine-enabled:checked { background: var(--accent-ink); border-color: var(--accent-ink); }
#medicine-enabled:checked::after { content: ''; display: block; width: 8px; height: 5px; margin-top: -2px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg); }
.toast {
  position: fixed; z-index: 4; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 14px);
  max-width: min(420px, calc(100% - 32px)); padding: 12px 16px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 0; box-shadow: var(--shadow); opacity: 0; pointer-events: none; font: 400 10px/1.5 var(--heading); text-align: center;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.cloud-onboarding { position: relative; z-index: 1; padding-bottom: 32px; }
.cloud-welcome { padding: 22px; }
.cloud-welcome h2 { color: var(--accent); font: 400 12px/1.5 var(--heading); text-transform: uppercase; }
.cloud-welcome > p { margin-top: 10px; font-size: 13px; }
.cloud-form { display: grid; gap: 10px; margin-top: 16px; }
.cloud-form .field > span, .cloud-backup-file > span { color: var(--accent); font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
.cloud-welcome input, .cloud-welcome button { border-radius: 0; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cloud-account :is(.secondary, .text-button), .cloud-welcome button { font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
.cloud-account button:disabled, .cloud-welcome button:disabled { opacity: .5; cursor: wait; }
.cloud-account .pump-settings li { gap: 10px; }
.cloud-account .pump-settings li > span { overflow-wrap: anywhere; }
.cloud-account .cloud-form { margin-block: 16px; }
.cloud-backup-file { margin-top: 16px; }
.cloud-account input[type="file"] { height: auto; padding: 9px !important; font-size: 12px !important; }
.cloud-conflict { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--rule); }
.cloud-conflict p { margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
.cloud-account .settings-help { overflow-wrap: anywhere; }
#cloud-invite-result { margin-top: 12px; }

#entry-dialog {
  --sheet-fill: rgb(255 250 253 / 90%);
  --sheet-line: #dfc8d5;
  --sheet-label: #806071;
  --sheet-copy: #765d6e;
  --sheet-selected: #f4a4c8;
  --sheet-primary: #e878aa;
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: min(520px, 100%);
  max-width: none;
  max-height: 90dvh;
  border: 1px solid var(--sheet-line);
  border-radius: 0;
  overflow-x: hidden;
  padding: 25px 22px max(28px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgb(89 60 78 / 16%);
  font-family: Silkscreen, monospace;
}
[data-appearance="dark"] #entry-dialog {
  --sheet-fill: rgb(41 27 37 / 90%);
  --sheet-line: #684459;
  --sheet-label: #c9aebe;
  --sheet-copy: #f4e4ed;
  --sheet-selected: #9e466e;
  --sheet-primary: #f29cc5;
}
#entry-dialog .dialog-header {
  position: relative;
  align-items: flex-start;
  padding: 0;
  margin: 8px 0 0;
  border: 0;
}
#entry-dialog .dialog-header::before {
  content: '';
  position: absolute;
  inset: -21px auto auto 50%;
  translate: -50% 0;
  width: 38px;
  height: 3px;
  background: var(--sheet-line);
}
.sheet-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sheet-title img { flex: none; object-fit: contain; image-rendering: pixelated; }
.sheet-eyebrow { color: var(--sheet-label); font: 400 9px/1.4 var(--heading); letter-spacing: .06em; text-transform: uppercase; }
#entry-dialog .sheet-title h2 { font-size: 15px; margin-top: 2px; }
.sheet-title h2:focus { outline: none; }
#entry-dialog .close-dialog { flex: none; width: 44px; min-height: 44px; border: 0; border-radius: 0; padding: 0; color: var(--sheet-label); }
#entry-dialog .dialog-body { gap: 0; padding: 0; margin-top: 22px; }
.entry-when { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
#entry-dialog .field > span:first-child, #entry-dialog legend {
  font: 400 9px/1.5 var(--heading);
  text-transform: uppercase;
  color: var(--sheet-label);
}
#entry-dialog legend { margin: 0 0 7px; }
#entry-dialog input:not([type="radio"]), #entry-dialog select {
  min-height: 44px;
  border: 1px solid var(--sheet-line);
  border-radius: 0;
  background: var(--sheet-fill);
  padding: 0 11px;
  font: 400 14px/1.4 Geist, Arial, sans-serif;
  color: var(--sheet-copy);
}
#entry-dialog .input-with-unit input { padding-right: 43px; }
#entry-dialog .input-with-unit > span { font: 400 12px/1.4 Geist, Arial, sans-serif; color: var(--sheet-label); }
#entry-dialog input:focus-visible { outline: none; border-color: var(--sheet-primary); box-shadow: 0 0 0 2px rgb(232 120 170 / 12%); }
#entry-dialog input:is([type="date"], [type="time"]) { width: 100%; max-width: 100%; padding: 0 8px; }
#entry-fields { display: grid; gap: 19px; margin-top: 16px; }
.entry-volume { display: grid; gap: 7px; }
.entry-shortcuts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.entry-shortcuts > span { margin-right: auto; color: var(--sheet-label); font: 400 7px/1.4 var(--heading); text-transform: uppercase; }
.entry-shortcuts button {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--sheet-line);
  background: var(--sheet-fill);
  color: var(--sheet-copy);
  font: 400 12px/1.4 Geist, Arial, sans-serif;
}
#entry-time-shortcuts { margin-top: 8px; }
#entry-time-shortcuts button { min-height: 31px; padding-inline: 8px; font-size: 11px; }
.entry-shortcuts button:hover { background: var(--accent-soft); }
.entry-shortcuts button[aria-pressed="true"] { border-color: var(--sheet-primary); background: var(--sheet-selected); color: #fff; }
#entry-dialog .segmented { padding: 0; gap: 0; border: 1px solid var(--sheet-line); border-radius: 0; background: var(--sheet-fill); }
#entry-dialog .segmented label + label { border-left: 1px solid var(--sheet-line); }
#entry-dialog .segmented span {
  min-height: 42px;
  border: 0;
  border-radius: 0;
  padding: 5px;
  font: 400 9px/1.5 var(--heading);
  text-transform: uppercase;
  color: var(--sheet-label);
  overflow-wrap: anywhere;
}
#entry-dialog .milk-choices span { font-size: 10px; }
#entry-dialog .segmented input:checked + span { background: var(--sheet-selected); color: #fff; }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) label { border-left: 0; }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) label:nth-child(even) { border-left: 1px solid var(--sheet-line); }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) label:nth-child(n + 3) { border-top: 1px solid var(--sheet-line); }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) label:last-child:nth-child(odd) { grid-column: 1 / -1; }
#entry-dialog .segmented:is(.pump-choices, .milk-choices, .medicine-choices) span { height: 100%; }
#entry-dialog .split-total { font: 400 12px/1.4 Geist, Arial, sans-serif; }
#entry-dialog .dialog-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  padding: 0;
  margin-top: 22px;
  border: 0;
  background: var(--surface);
}
#entry-dialog .primary {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: var(--sheet-primary);
  color: var(--on-accent);
  font: 400 10px/1.4 var(--heading);
  letter-spacing: .06em;
  text-transform: uppercase;
}
#entry-dialog .danger-text { justify-self: center; margin: 0; font: 400 10px/1.4 var(--heading); }
#entry-dialog .form-error, #entry-dialog .confirm-delete { margin-top: 12px; font-family: Geist, Arial, sans-serif; }

.pump-rate-help { margin: -9px 0 18px; color: var(--muted); font-size: 12px; }
.pump-day-summary { padding: 8px 10px; color: var(--accent-ink); font-size: 11px; border-bottom: 1px solid var(--rule); }
.pump-chart { min-width: 0; max-width: 100%; padding: 13px 12px 10px; }
.pump-chart h2 { color: var(--accent); font-size: 12px; }
.pump-chart > p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.pump-chart-scroll { width: 100%; min-width: 0; max-width: 100%; margin-top: 14px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.pump-chart-plot { position: relative; width: var(--chart-width); min-width: 100%; height: 200px; }
.pump-chart-line { position: absolute; inset: 0; width: 100%; height: 174px; overflow: visible; }
.pump-chart-grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pump-chart-path { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, var(--bg)); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pump-chart-observation { position: absolute; top: 0; width: 0; }
.pump-chart-value { position: absolute; top: calc(var(--point-y) - 31px); transform: translateX(-50%); color: var(--accent-ink); font-size: 11px; white-space: nowrap; }
.pump-chart-point { position: absolute; top: var(--point-y); display: grid; place-items: center; transform: translate(-50%, -50%); }
.pump-point-art { display: block; object-fit: contain; }
.pump-point-art.pixel-art { image-rendering: pixelated; }
:root[data-visual-theme="gummy"] .pump-point-art { filter: saturate(1.1); }
.pump-chart-date { position: absolute; top: 177px; transform: translateX(-50%); color: var(--muted); font-size: 11px; white-space: nowrap; }

@media (min-width: 640px) {
  #entry-dialog { bottom: 24px; max-height: min(90dvh, calc(100dvh - 48px)); padding: 28px; }
}
@media (max-width: 580px) {
  .shell { width: calc(100% - 32px); }
  .diary-title { padding-block: 29px 20px; }
  .quick-actions { gap: 7px; margin-bottom: 20px; }
  .quick-action { min-height: 90px; font-size: 9px; }
  .quick-action img { width: 44px; height: 44px; }
  .dashboard, .activity-stack { gap: 16px; }
}
@media (max-width: 380px) {
  .diary-title { font-size: 17px; }
}
@media (max-width: 365px) {
  .filters { gap: 2px; }
  .filters button { padding-inline: 7px; }
  .overview dl > div { padding-inline: 6px; }
  .timeline-entry { column-gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .quick-action { animation: none; }
}

:root[data-visual-theme="gummy"] {
  --bg: #fff;
  --surface: rgb(255 255 255 / 90%);
  --text: #5f5c63;
  --muted: #5f5c63;
  --accent: #5f5c63;
  --accent-ink: #5f5c63;
  --on-accent: #ffffff;
  --line: #d4d2d6;
  --rule: #e9e8eb;
  --grid: transparent;
  --soft: #f5f4f6;
  --accent-soft: #e8e6eb;
  --danger: #5f5c63;
  --shadow: 2px 2px 0 rgb(72 66 79 / 9%);
  --gummy-heading: #5f5c63;
  --gummy-quick-bg: rgb(255 255 255 / 90%);
  --gummy-selected: rgb(49 47 53 / 90%);
  --gummy-selected-line: #252329;
  --gummy-action: rgb(49 47 53 / 90%);
  --gummy-action-line: #252329;
  --gummy-action-ink: #ffffff;
}
:root[data-visual-theme="gummy"][data-appearance="dark"] {
  --bg: #19181b;
  --surface: rgb(35 34 38 / 90%);
  --field-bg: rgb(25 24 27 / 90%);
  --text: #d7d3da;
  --muted: #d7d3da;
  --accent: #d7d3da;
  --accent-ink: #d7d3da;
  --on-accent: #27252b;
  --line: #504c55;
  --rule: #353238;
  --soft: rgb(41 38 45 / 90%);
  --accent-soft: rgb(59 53 65 / 90%);
  --danger: #d7d3da;
  --shadow: 2px 2px 0 rgb(0 0 0 / 22%);
  --gummy-heading: #d7d3da;
  --gummy-quick-bg: rgb(35 34 38 / 90%);
  --gummy-selected: rgb(215 211 218 / 90%);
  --gummy-selected-line: #e8e5eb;
  --gummy-action: rgb(215 211 218 / 90%);
  --gummy-action-line: #e8e5eb;
  --gummy-action-ink: #27252b;
}
:root[data-visual-theme="gummy"] #entry-dialog {
  --sheet-fill: var(--soft);
  --sheet-line: var(--line);
  --sheet-label: var(--muted);
  --sheet-copy: var(--text);
  --sheet-selected: var(--gummy-selected);
  --sheet-primary: var(--gummy-action);
}
:root[data-visual-theme="gummy"] [data-activity-icon] { image-rendering: auto; transform: scale(.8); filter: saturate(1.1); }
:root[data-visual-theme="gummy"] .detail-view h1 { color: var(--text); text-shadow: none; }
:root[data-visual-theme="gummy"] .danger-button { color: var(--text); background: var(--accent-soft); }
:root[data-visual-theme="gummy"] .primary { color: var(--gummy-action-ink); background: var(--gummy-action); border-color: var(--gummy-action-line); box-shadow: 2px 2px 0 color-mix(in srgb, var(--gummy-action-line) 30%, transparent); }
:root[data-visual-theme="gummy"] #entry-dialog .primary { border: 1px solid var(--gummy-action-line); }
:root[data-visual-theme="gummy"] :is(#entry-dialog, #settings-view) .segmented input:checked + span,
:root[data-visual-theme="gummy"] #entry-dialog .entry-shortcuts button[aria-pressed="true"] {
  color: var(--gummy-action-ink); background: var(--gummy-selected);
  box-shadow: inset 0 -2px 0 var(--gummy-selected-line);
}
:root[data-visual-theme="gummy"] #entry-dialog .entry-shortcuts button[aria-pressed="true"] { border-color: var(--gummy-selected-line); }
:root[data-visual-theme="gummy"] input::placeholder { color: var(--text); opacity: 1; }
:root[data-visual-theme="gummy"] .quick-action { background: var(--gummy-quick-bg); }
:root[data-visual-theme="gummy"] :is(.section-heading h2, .detail-day > h2, .pump-chart h2, .dialog-header h2) { color: var(--gummy-heading); }
:root[data-visual-theme="gummy"] dialog { box-shadow: 0 8px 30px rgb(45 41 49 / 16%); }
:root[data-visual-theme="gummy"] #entry-dialog input:focus-visible { box-shadow: 0 0 0 2px rgb(115 107 123 / 16%); }
:root[data-visual-theme="gummy"][data-appearance="dark"] dialog { box-shadow: 0 8px 30px rgb(0 0 0 / 25%); }
:root[data-visual-theme="gummy"][data-appearance="dark"] #entry-dialog input:focus-visible { box-shadow: 0 0 0 2px rgb(160 151 170 / 16%); }
body { isolation: isolate; }
.shell { position: relative; z-index: 1; }
.gummy-background { --rain-count: 18; display: none; position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
[data-visual-theme="gummy"] .gummy-background { display: block; }
.gummy-bear {
  position: absolute;
  top: -130px;
  left: var(--x);
  width: 30px;
  opacity: 1;
  animation: gummy-fall 80s calc(-80s / var(--rain-count) * var(--phase)) linear infinite;
  animation-play-state: paused;
}
[data-visual-theme="gummy"] .gummy-bear { animation-play-state: running; }
.gummy-bear img { width: 100%; height: auto; display: block; filter: saturate(1.1); }
@keyframes gummy-fall {
  from { transform: translate3d(-50%, -10px, 0) rotate(-20deg); }
  to { transform: translate3d(-50%, calc(100dvh + 270px), 0) rotate(var(--turn)); }
}
@media (max-width: 580px) {
  .gummy-background { --rain-count: 10; }
  .gummy-bear:nth-child(n + 11) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gummy-bear {
    animation: none;
    top: var(--still-y);
    transform: translateX(-50%) rotate(var(--turn));
  }
}

/* Quiet attribution follows the original diary's time / by-name layout. */
.event-meta { display: grid; justify-items: end; gap: 2px; min-width: 0; max-width: 80px; }
.event-recorder { color: var(--muted); font-size: 9px; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diary-footer { flex-wrap: wrap; padding-bottom: max(29px, env(safe-area-inset-bottom)); }
.home-screen-link { flex-basis: 100%; text-align: center; color: var(--muted); font-size: 11px; }
.nickname-form { display: flex; gap: 8px; margin-top: 10px; }
.nickname-form input { flex: 1; min-width: 0; }
.nickname-form button { flex: none; padding-inline: 12px; font: 400 9px/1.4 var(--heading); text-transform: uppercase; }
#cloud-members li { flex-wrap: wrap; }
#cloud-members li > span { min-width: 120px; }
#home-screen-dialog { border-radius: 0; }
#home-screen-dialog .dialog-header h2 { font-size: 14px; }
#home-screen-dialog .icon-button { flex: none; border: 0; border-radius: 0; background: transparent; }
.home-screen-body { font-size: 13px; }
.home-screen-steps { padding-left: 22px; display: grid; gap: 12px; }
.home-screen-steps li::marker { color: var(--accent-ink); font-weight: 600; }
.guide-source { display: inline-block; margin-top: 12px; color: var(--accent-ink); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented label { min-width: 0; }
.cloud-form, .cloud-actions, .cloud-conflict, .cloud-backup-file { min-width: 0; }
.cloud-actions > button, .cloud-form > button { max-width: 100%; overflow-wrap: anywhere; }
.cloud-backup-file input { max-width: 100%; }
#entry-dialog { overscroll-behavior-y: contain; }
#entry-dialog { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
@media (max-width: 580px), (pointer: coarse) {
  /* Safari focuses fields below 16px by zooming the viewport. Keep manual zoom available. */
  input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea,
  #entry-dialog input:not([type="radio"]), #entry-dialog select,
  #settings-view input:not([type="radio"]):not([type="checkbox"]):not([type="file"]) { font-size: 16px; }
  input:is([type="date"], [type="time"]) { appearance: none; -webkit-appearance: none; min-width: 0; max-width: 100%; }
  input::-webkit-date-and-time-value { min-height: 1.4em; text-align: left; }
  .history-pagination { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 7px; }
  .history-pagination button { min-height: 44px; }
}

#home-screen-dialog { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(520px, 100%); max-width: none; max-height: 90dvh; }
#home-screen-dialog .dialog-footer { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
#home-screen-dialog .segmented { border: 1px solid var(--line); border-radius: 0; padding: 0; gap: 0; background: var(--surface); }
#home-screen-dialog .segmented label + label { border-left: 1px solid var(--line); }
#home-screen-dialog .segmented span { border: 0; border-radius: 0; font-size: 12px; }
#home-screen-dialog .segmented input:checked + span { background: var(--accent-soft); color: var(--accent-ink); }
#home-screen-dialog .primary { border-radius: 0; width: 100%; font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
:root[data-visual-theme="gummy"] #home-screen-dialog .segmented input:checked + span { background: var(--gummy-action); color: var(--gummy-action-ink); }
@media (min-width: 640px) { #home-screen-dialog { bottom: 24px; } }

.settings-page { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.settings-page-footer { display: flex; justify-content: flex-end; padding-top: 18px; }
.settings-page-footer .secondary { border-radius: 0; color: var(--accent-ink); font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
@media (max-width: 380px) { .settings-body { padding: 18px 15px; } }

/* Every theme inherits the same type, spacing and component geometry above. */
:root[data-visual-theme="gingham"] {
  --bg: #fcfdff;
  --surface: rgb(252 253 255 / 90%);
  --field-bg: rgb(252 253 255 / 90%);
  --text: #304e73;
  --muted: #3d628d;
  --accent: #3976c8;
  --accent-ink: #2d64aa;
  --on-accent: #fff;
  --line: #bed8ff;
  --rule: #dceaff;
  --grid: transparent;
  --soft: rgb(237 245 255 / 90%);
  --accent-soft: rgb(219 234 255 / 90%);
  --shadow: 2px 2px 0 rgb(73 137 232 / 12%);
  --danger: #a13739;
  --check: rgb(77 144 252 / 8%);
}
:root[data-visual-theme="gingham"][data-appearance="dark"] {
  --bg: #17243a;
  --surface: rgb(34 50 76 / 90%);
  --field-bg: rgb(25 40 63 / 90%);
  --text: #e3efff;
  --muted: #b3d2fc;
  --accent: #a6ccff;
  --accent-ink: #bedbff;
  --on-accent: #17345b;
  --line: #3d6090;
  --rule: #2a4368;
  --soft: rgb(36 61 96 / 90%);
  --accent-soft: rgb(43 75 120 / 90%);
  --shadow: 2px 2px 0 rgb(0 0 0 / 20%);
  --danger: #f7b1a9;
  --check: rgb(149 194 255 / 5%);
}
[data-visual-theme="gingham"] body {
  background-image: linear-gradient(90deg, var(--check) 50%, transparent 50%), linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 56px 56px;
  background-position: 0 0;
}
:root[data-visual-theme="dairy"] {
  --bg: #f0f9fd;
  --surface: rgb(255 255 255 / 90%);
  --field-bg: rgb(255 255 255 / 90%);
  --text: #233d60;
  --muted: #3d5a7e;
  --accent: #2873bd;
  --accent-ink: #245fa0;
  --on-accent: #fff;
  --line: #93c5e8;
  --rule: #c5e2f3;
  --grid: transparent;
  --soft: rgb(236 247 255 / 90%);
  --accent-soft: rgb(198 230 249 / 90%);
  --shadow: 2px 2px 0 rgb(57 114 162 / 8%);
  --danger: #a14446;
}
:root[data-visual-theme="dairy"][data-appearance="dark"] {
  --bg: #142536;
  --surface: rgb(25 44 62 / 90%);
  --field-bg: rgb(20 37 54 / 90%);
  --text: #e3ebef;
  --muted: #acbfcd;
  --accent: #a6c6dc;
  --accent-ink: #b4d3e7;
  --on-accent: #1f3443;
  --line: #455c6d;
  --rule: #30434f;
  --soft: rgb(39 55 68 / 90%);
  --accent-soft: rgb(49 72 89 / 90%);
  --shadow: 2px 2px 0 rgb(0 0 0 / 20%);
  --danger: #f7b1a9;
}
[data-visual-theme="dairy"] body {
  background-image: none;
}
[data-visual-theme="dairy"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('./assets/dairy-sky-pasture-v2.jpg') right bottom / cover no-repeat;
}
[data-visual-theme="dairy"][data-appearance="dark"] body::before {
  background-image: linear-gradient(rgb(10 27 44 / 82%), rgb(10 27 44 / 82%)), url('./assets/dairy-sky-pasture.jpg');
}
[data-visual-theme="dairy"] body:has(dialog[open])::before {
  opacity: .45;
}
:root[data-visual-theme="honey"] {
  --bg: #fff9e6;
  --surface: rgb(255 254 249 / 90%);
  --field-bg: rgb(255 254 249 / 90%);
  --text: #5b3d30;
  --muted: #795a48;
  --accent: #86583b;
  --accent-ink: #6b4532;
  --on-accent: #fff;
  --line: #dccaab;
  --rule: #eadfc9;
  --grid: transparent;
  --soft: rgb(250 241 219 / 90%);
  --accent-soft: rgb(244 226 188 / 90%);
  --shadow: 2px 2px 0 rgb(108 74 49 / 10%);
  --danger: #a14439;
}
:root[data-visual-theme="honey"][data-appearance="dark"] {
  --bg: #261e1a;
  --surface: rgb(49 38 32 / 90%);
  --field-bg: rgb(38 30 26 / 90%);
  --text: #f1e4dc;
  --muted: #d0b8a7;
  --accent: #dcb799;
  --accent-ink: #edd1ba;
  --on-accent: #3d2a20;
  --line: #6c5443;
  --rule: #4d3c32;
  --soft: rgb(64 47 37 / 90%);
  --accent-soft: rgb(81 58 42 / 90%);
  --shadow: 2px 2px 0 rgb(0 0 0 / 20%);
  --danger: #f7b1a9;
}
[data-visual-theme="honey"] body {
  background-image: none;
}
:root[data-visual-theme="clover"] {
  --bg: #fffef5;
  --surface: rgb(255 255 255 / 90%);
  --field-bg: rgb(255 255 255 / 90%);
  --text: #263c54;
  --muted: #3f5969;
  --accent: #285f2b;
  --accent-ink: #204e26;
  --on-accent: #fff;
  --line: #b7cea7;
  --rule: #e0e8d5;
  --grid: transparent;
  --soft: rgb(239 247 223 / 90%);
  --accent-soft: rgb(224 239 200 / 90%);
  --shadow: 2px 2px 0 rgb(56 92 38 / 8%);
  --danger: #a3443c;
}
:root[data-visual-theme="clover"][data-appearance="dark"] {
  --bg: #19251d;
  --surface: rgb(35 49 39 / 90%);
  --field-bg: rgb(25 37 29 / 90%);
  --text: #e5edee;
  --muted: #b8c9c3;
  --accent: #b6d993;
  --accent-ink: #d0e9b6;
  --on-accent: #203b24;
  --line: #4c6650;
  --rule: #344d39;
  --soft: rgb(42 62 45 / 90%);
  --accent-soft: rgb(53 77 50 / 90%);
  --shadow: 2px 2px 0 rgb(0 0 0 / 20%);
  --danger: #f6b1a6;
}
[data-visual-theme="clover"] body { background-image: none; }
[data-visual-theme="clover"] body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url('./assets/clover-point.png'), url('./assets/clover-point.png'), url('./assets/clover-point.png'), url('./assets/clover-sparkles.svg');
  background-size: 30px 30px, 38px 38px, 25px 25px, 27px 35px;
  background-position: left 10px top 13px, right 14px bottom 20px, left 18px bottom 64px, right 12px top 16px;
  background-repeat: no-repeat;
  opacity: .8;
}
[data-visual-theme="clover"][data-appearance="dark"] body::before { opacity: .4; }
[data-visual-theme="clover"] body:has(dialog[open])::before { opacity: .25; }
/* Kitsch Cove keeps the shared layout, with pearly seaside colours. */
:root[data-visual-theme="kitsch"] {
  --bg: #dceafa;
  --surface: rgb(255 255 255 / 90%);
  --field-bg: rgb(255 255 255 / 90%);
  --text: #4b5961;
  --muted: #6c7b82;
  --accent: #439f95;
  --accent-ink: #327a77;
  --on-accent: #fff;
  --line: #b6d7d7;
  --rule: color-mix(in srgb, var(--line) 55%, transparent);
  --grid: transparent;
  --soft: rgb(225 248 243 / 90%);
  --accent-soft: rgb(211 242 235 / 90%);
  --shadow: 2px 2px 0 rgb(50 122 119 / 8%);
  --danger: #a44851;
  --kitsch-veil: rgb(245 247 255 / 48%);
}
:root[data-visual-theme="kitsch"][data-appearance="dark"] {
  --bg: #271f29;
  --surface: rgb(54 42 53 / 90%);
  --field-bg: rgb(44 34 44 / 90%);
  --text: #f6e8ed;
  --muted: #d8bcc7;
  --accent: #e2a4be;
  --accent-ink: #f0c0d2;
  --on-accent: #39232f;
  --line: #68515f;
  --rule: #51404d;
  --soft: rgb(66 48 61 / 90%);
  --accent-soft: rgb(89 57 76 / 90%);
  --shadow: 2px 2px 0 rgb(0 0 0 / 16%);
  --danger: #f2b1b6;
  --kitsch-veil: rgb(28 22 37 / 80%);
}
[data-visual-theme="kitsch"] body { background-image: none; }
.kitsch-background { display: none; position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
[data-visual-theme="kitsch"] .kitsch-background { display: block; background-color: var(--bg); }
[data-visual-theme="kitsch"] .kitsch-background::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--kitsch-veil), var(--kitsch-veil)), url('./assets/kitsch-iridescent-sparkles.jpg');
  background-position: 70% 40%;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scaleX(-1) scale(1.08);
}
body:has(dialog[open]) .kitsch-background { opacity: .35; }
:root:is([data-visual-theme="dairy"], [data-visual-theme="honey"], [data-visual-theme="clover"], [data-visual-theme="kitsch"]) [data-activity-icon] { image-rendering: auto; }
:root[data-visual-theme="gingham"] [data-activity-icon] { image-rendering: auto; }
/* Match the visible artwork footprint, including each theme's existing padding. */
:root[data-visual-theme="pink"] { --medicine-art-scale: .88; }
:root[data-visual-theme="gummy"] { --medicine-art-scale: .72; }
:root[data-visual-theme="gingham"] { --medicine-art-scale: 1.08; }
:root[data-visual-theme="dairy"] { --medicine-art-scale: 1.04; }
:root[data-visual-theme="honey"] { --medicine-art-scale: 1.024; }
:root[data-visual-theme="clover"] { --medicine-art-scale: .848; }
:root[data-visual-theme="kitsch"] { --medicine-art-scale: .952; }
:root[data-visual-theme] [data-activity-icon="medicine"] { transform: scale(var(--medicine-art-scale, 1)); }
:root:is([data-visual-theme="gingham"], [data-visual-theme="dairy"], [data-visual-theme="honey"], [data-visual-theme="clover"], [data-visual-theme="kitsch"]) #entry-dialog {
  --sheet-fill: var(--surface);
  --sheet-line: var(--line);
  --sheet-label: var(--muted);
  --sheet-copy: var(--text);
  --sheet-selected: var(--accent);
  --sheet-primary: var(--accent);
}
:root:is([data-visual-theme="gingham"], [data-visual-theme="dairy"], [data-visual-theme="honey"], [data-visual-theme="clover"], [data-visual-theme="kitsch"]) #entry-dialog :is(.segmented input:checked + span, .entry-shortcuts button[aria-pressed="true"]) { color: var(--on-accent); }
:root:is([data-visual-theme="gingham"], [data-visual-theme="dairy"], [data-visual-theme="honey"], [data-visual-theme="clover"], [data-visual-theme="kitsch"]) #entry-dialog input:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }

.theme-picker { border: 1px solid var(--line); background: var(--surface); }
.theme-picker summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 10px 12px; list-style: none; cursor: pointer;
  color: var(--accent-ink); font: 400 11px/1.5 var(--heading);
}
.theme-picker summary::-webkit-details-marker { display: none; }
.theme-picker-arrow { width: 7px; height: 7px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.theme-picker[open] .theme-picker-arrow { transform: translateY(2px) rotate(225deg); }
.theme-picker-panel { display: grid; gap: 8px; padding: 8px; border-top: 1px solid var(--line); }
.theme-list { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.theme-option { display: block; position: relative; cursor: pointer; }
.theme-option + .theme-option { border-top: 1px solid var(--rule); }
.theme-option input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; }
.theme-option span { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px; color: var(--muted); font: 400 10px/1.5 var(--heading); }
.theme-option span::before { content: ""; flex: none; width: 12px; height: 12px; border: 1px solid var(--line); border-radius: 50%; }
.theme-option input:checked + span { background: var(--accent-soft); color: var(--accent-ink); }
.theme-option input:checked + span::before { background: var(--accent-ink); border-color: var(--accent-ink); box-shadow: inset 0 0 0 3px var(--surface); }
.theme-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.medicine-quick-log { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 40px; margin: -8px 0 20px; color: var(--muted); font: 400 11px/1.2 var(--heading); letter-spacing: .055em; border: 1px solid var(--line); border-radius: 0; box-shadow: var(--shadow); }
.medicine-quick-log:hover { background: var(--soft); border-color: var(--accent); }
.medicine-quick-log:active { transform: translateY(2px); box-shadow: 1px 1px 0 var(--line); }
.timer-continue { border: 0; padding: 0; background: transparent; }
@media (max-width: 580px) { .medicine-quick-log { font-size: 9px; } }
.medicine-choices span { overflow-wrap: anywhere; }
.medicine-add summary { min-height: 36px; cursor: pointer; font-size: 12px; color: var(--sheet-label); }
.medicine-add-row { display: flex; gap: 8px; align-items: center; }
.medicine-add-row input { flex: 1; }
.medicine-add-row button { flex: none; min-height: 44px; }
#feed-fields { display: grid; gap: 19px; }

#home-view .diary-title.has-bear-logo { padding: 6px 0 9px; line-height: 0; text-shadow: none; }
.brand-bear { display: block; width: 68px; height: 68px; margin-inline: auto; overflow: visible; }
.bear-head-motion { transform-origin: 50% 65%; animation: bear-head-turn 8s ease-in-out 1 both; }
.bear-face { transform-origin: 50% 57%; animation: bear-face-turn 8s ease-in-out 1 both; }
.bear-gaze { animation: bear-look 8s ease-in-out 1 both; }
.bear-milk { transform-box: fill-box; transform-origin: center; animation: bear-milk-wiggle 8s ease-in-out 1 both; }
@keyframes bear-head-turn { 0%, 7%, 50%, 100% { transform: translateY(0) rotate(0); } 14%, 25% { transform: translateY(-2px) rotate(-2.5deg); } 34%, 43% { transform: translateY(-1px) rotate(2deg); } }
@keyframes bear-face-turn { 0%, 7%, 48%, 100% { transform: translate(0, 0) scaleX(1); } 14%, 25% { transform: translate(-11px, 1px) scaleX(.96); } 34%, 43% { transform: translate(11px, 1px) scaleX(.96); } }
@keyframes bear-look { 0%, 7%, 48%, 100% { transform: translateX(0); } 14%, 25% { transform: translateX(-7px); } 34%, 43% { transform: translateX(7px); } }
@keyframes bear-milk-wiggle { 0%, 50%, 70%, 90%, 100% { transform: translateY(0); } 60%, 80% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .brand-bear g, .brand-bear path { animation: none; } }

/* First visit uses the same theme tokens and artwork as the diary. */
.setup-theme-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid var(--line); }
.setup-theme-option { position: relative; min-width: 0; cursor: pointer; }
.setup-theme-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.setup-theme-option span { display: grid; place-content: center; min-height: 44px; padding: 9px 5px; font: 400 10px/1.5 var(--heading); text-align: center; border-bottom: 1px solid var(--line); }
.setup-theme-option:nth-child(odd) span { border-right: 1px solid var(--line); }
.setup-theme-option:last-child { grid-column: 1/-1; }
.setup-theme-option:last-child span { border: 0; }
.setup-theme-option:has(input:checked) span { background: var(--text); color: var(--bg); }
.setup-theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
.setup-step-copy { font-size: 12px; color: var(--muted); margin-top: 8px; }
.setup-theme-legend { color: var(--accent); font: 400 10px/1.5 var(--heading); text-transform: uppercase; margin-bottom: 8px; }
#cloud-profile-setup fieldset { padding: 0; border: 0; min-width: 0; }
#setup-preview { padding: 12px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.preview-caption { font: 400 9px/1.5 var(--heading); text-transform: uppercase; color: var(--muted); }
.setup-preview-brand { margin-block: 6px; }
.preview-quick-actions { gap: 6px; margin-bottom: 16px; }
.preview-quick-actions .quick-action { min-height: 79px; font-size: 9px; animation: none; }
.preview-quick-actions .quick-action img { width: 38px; height: 38px; }
:root:not([data-visual-theme="pink"]) .preview-quick-actions img { image-rendering: auto; }
.preview-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.preview-summary h3 { grid-column: 1/-1; font: 400 11px/1.5 var(--heading); color: var(--accent); }
.preview-summary span { font-size: 11px; display: flex; justify-content: space-between; gap: 8px; }
.preview-summary strong { font-weight: 400; }
.preview-record { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 11px; }
.preview-record img { object-fit: contain; }
.preview-record span { flex: 1; min-width: 0; }
.preview-record strong, .preview-record small { display: block; }
.preview-record > small { text-align: right; }
.preview-record small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.preview-appearance { display: flex; gap: 8px; }
.preview-appearance button { flex: 1; }
.cloud-recovery-list { list-style: none; padding: 0; margin-top: 8px; }
.cloud-recovery-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--rule); padding: 10px 0; font-size: 11px; }
.cloud-recovery-list li > span { min-width: 0; overflow-wrap: anywhere; }
.cloud-recovery-list button { flex: none; }
.cloud-recovery-list small { display: block; font-size: 10px; color: var(--muted); }
.cloud-account details { margin-top: 18px; }
.cloud-account summary { cursor: pointer; font: 400 10px/1.5 var(--heading); text-transform: uppercase; color: var(--accent); }
.cloud-danger { border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 16px; }
.cloud-danger h3 { color: var(--danger); }
.account-action-sheet { padding: 22px; }
.account-action-sheet h2 { font: 700 14px/1.4 var(--heading); color: var(--sheet-title); margin-block: 14px; }
.account-action-sheet p { font-size: 12px; margin-bottom: 14px; color: var(--sheet-copy); }
.account-action-sheet .field { margin-bottom: 16px; }
.account-action-sheet .cloud-actions button { flex: 1; }
.account-action-sheet .backup-action { margin-bottom: 12px; }
.utility-view { padding-block: 28px; }
.utility-view h1 { font-size: 18px; color: var(--accent); margin: 20px 0; }
.utility-view h2 { font: 400 12px/1.5 var(--heading); color: var(--accent); margin-block: 20px 10px; }
.utility-view p { font-size: 12px; margin-bottom: 12px; }
.usage-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-block: 18px; }
.usage-metric { border: 1px solid var(--line); background: var(--surface); padding: 12px; min-width: 0; }
.usage-metric dt { font-size: 11px; color: var(--muted); }
.usage-metric dd { font-size: 20px; color: var(--text); margin-top: 5px; }
.utility-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 18px; font: 400 9px/1.5 var(--heading); color: var(--muted); text-transform: uppercase; }
@media (max-width: 380px) { .cloud-welcome { padding: 15px; } .setup-theme-option span { font-size: 9px; } }

#cloud-action-dialog { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(520px,100%); max-width: none; max-height: 90dvh; border-radius: 0; padding: 26px 22px max(28px,env(safe-area-inset-bottom)); }
#cloud-action-dialog h2 { color: var(--accent); padding-right: 28px; }
#cloud-action-dialog p { color: var(--text); }
#cloud-action-dialog .close-dialog:not(.secondary) { position: absolute; right: 12px; top: 10px; width: 44px; height: 44px; padding: 0; border: 0; color: var(--muted); }
#cloud-action-dialog input { border-radius: 0; }
#cloud-action-dialog .field > span { font: 400 10px/1.5 var(--heading); color: var(--accent); }
#cloud-action-dialog button { font: 400 10px/1.5 var(--heading); text-transform: uppercase; border-radius: 0; }
@media (hover:none) and (pointer:coarse) { #cloud-profile-setup input:not([type=radio]), #cloud-action-dialog input { font-size: 16px; } }

.preview-appearance button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.settings-tabs { display: flex; margin: 18px 0 14px; border: 1px solid var(--line); background: var(--surface); }
.settings-tabs [role="tab"] { flex: 1; min-height: 44px; padding: 10px; border: 0; border-radius: 0; background: transparent; color: var(--text); font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
.settings-tabs [role="tab"] + [role="tab"] { border-left: 1px solid var(--line); }
.settings-tabs [aria-selected="true"] { background: var(--accent-ink); color: var(--on-accent); }
.settings-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
#entry-dialog #confirm-delete { border: 1px solid var(--sheet-line); border-radius: 0; background: var(--sheet-fill); color: var(--sheet-copy); padding: 14px; font: 400 12px/1.5 Geist,system-ui,sans-serif; }
#entry-dialog #confirm-delete .confirm-delete-title { margin: 0 0 8px; color: var(--sheet-label); font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
#entry-dialog #confirm-delete .confirm-delete-help { margin: 0 0 14px; color: var(--sheet-copy); font-size: 11px; }
.confirm-delete-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
#entry-dialog .confirm-delete-actions button { min-height: 44px; margin: 0; border-radius: 0; padding: 9px 6px; font: 400 10px/1.5 var(--heading); text-transform: uppercase; }
#entry-dialog .confirm-delete-actions .secondary { border: 1px solid var(--sheet-line); background: var(--sheet-fill); color: var(--sheet-copy); }
#entry-dialog:has(#confirm-delete:not([hidden])) .dialog-footer { display: none; }

.page-title-form { margin-top: 6px; }
#settings-view .page-title-form .secondary { font: 400 10px/1.5 var(--heading); text-transform: uppercase; padding-inline: 14px; }
#save-page-title:disabled { opacity: .5; cursor: default; }
#settings-view .cloud-account .text-button { border: 1px solid var(--line); background: var(--soft); color: var(--text); box-shadow: var(--shadow); }
#settings-view .cloud-account .text-button:hover, #settings-view .cloud-account .text-button:active { background: var(--accent-soft); }
/* Center the close mark in its finger-sized target without a native button tile. */
dialog .icon-button:has(.close-mark) { appearance: none; -webkit-appearance: none; display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
dialog .close-mark { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Public help remains accessible before sign-in and uses the diary's theme. */
.public-links { display:flex; flex-wrap:wrap; gap:10px 18px; width:100%; justify-content:center; font-size:11px; padding-top:10px; }
.public-links a, .signin-privacy a, .help-panel a:not(.secondary) { color:var(--text); text-underline-offset:3px; }
.signin-privacy { color:var(--muted); font-size:11px; margin-top:12px; }
.help-panel { margin-block:16px; padding:18px; overflow-wrap:anywhere; }
.help-panel h2:first-child { margin-top:0; }
.help-panel details { border-top:1px solid var(--rule); padding-block:12px; }
.help-panel summary { cursor:pointer; font-size:12px; font-weight:600; color:var(--text); }
.help-panel details p { margin-top:10px; }
.help-panel p:last-child { margin-bottom:0; }
.support-contact { display:inline-block; margin-block:4px 8px; }
.public-page .utility-view h1 { color:var(--text); }
