:root {
  color-scheme: light dark;
  --canvas: #f4f1e9;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #17312f;
  --muted: #66736f;
  --placeholder: #87928e;
  --line: #d7ddd8;
  --primary: #165f5a;
  --primary-strong: #0d4b47;
  --primary-soft: #dcece8;
  --danger: #a33b36;
  --shadow: 0 12px 34px rgb(30 52 49 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }
html.modal-open { overflow: hidden; }

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 8%, rgb(120 188 173 / 13%), transparent 25rem),
    var(--canvas);
}

button, input, select, textarea { font: inherit; }
input::placeholder, textarea::placeholder { color: var(--placeholder); font-weight: 400; opacity: 1; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--primary); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0.45rem; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.02; letter-spacing: -0.045em; }
h1:focus { outline: none; }
h2 { margin-bottom: 0; font-size: clamp(1.35rem, 3vw, 1.8rem); letter-spacing: -0.025em; }

.app-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0.75rem max(1rem, calc((100vw - 1160px) / 2));
  border-bottom: 1px solid rgb(23 49 47 / 10%);
  background: rgb(244 241 233 / 88%);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { margin-top: 0.2rem; color: var(--muted); font-size: 0.74rem; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: white; background: var(--primary); }
.brand-mark svg { width: 26px; height: 26px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.75; }
.brand-mark svg path:last-child { fill: currentColor; stroke: none; }
.environment-badge { padding: 0.22rem 0.48rem; border: 1px solid #d29b42; border-radius: 999px; background: #fff2d6; color: #6d542d; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.primary-nav { display: flex; align-items: center; gap: 0.2rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.primary-nav a { min-width: 76px; padding: 0.48rem 0.8rem; border-radius: 999px; color: var(--muted); font-size: 0.8rem; font-weight: 750; text-align: center; text-decoration: none; }
.primary-nav a:hover { color: var(--ink); background: var(--primary-soft); }
.primary-nav a.active { background: var(--primary); color: white; }
.nav-label-compact { display: none; }
.account-menu { position: relative; display: flex; align-items: center; gap: 0.75rem; }
.desktop-account-content { display: flex; align-items: center; gap: 0.75rem; }
.account-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid rgb(29 110 103 / 24%); border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.02em; }
.account-action-group { display: flex; align-items: center; gap: 0.4rem; }
.account-name { display: flex; min-width: 0; max-width: min(40vw, 320px); flex-direction: column; align-items: flex-end; line-height: 1.15; }
.account-name small { margin-bottom: 0.2rem; color: var(--muted); font-size: 0.68rem; }
.account-name strong { overflow: hidden; max-width: 100%; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.account-action { min-height: 42px; padding: 0.62rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-weight: 650; text-decoration: none; white-space: nowrap; }
.reconnect-action { border-color: var(--primary); background: var(--primary); color: white; }
.account-action:disabled { cursor: wait; opacity: 0.65; }
.mobile-account-trigger, .mobile-account-panel, .mobile-account-scrim { display: none; }
.signout-error { max-width: 1100px; margin: 0.75rem auto 0; padding: 0.75rem 1rem; border: 1px solid #e3b0ab; border-radius: 12px; background: #fff1ef; color: #7e2f2a; font-size: 0.82rem; }
.identity-loading { color: var(--muted); font-size: 0.82rem; }
.app-shell { width: min(1160px, calc(100% - 2rem)); min-height: calc(100vh - 240px); margin: 0 auto; padding: 3rem 0 5rem; }
.app-footer { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; padding: 0 0 2.5rem; }
.medical-disclaimer { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.8rem; margin: 0; padding: 0.85rem 1rem; border: 1px solid #d9bd7a; border-radius: 14px; background: #fff7e5; color: #5f4c24; font-size: 0.78rem; line-height: 1.5; }
.medical-disclaimer strong { white-space: nowrap; }
.medical-disclaimer p { margin: 0; }
.medical-disclaimer a { color: inherit; font-weight: 700; }
.footer-links { display: flex; justify-content: center; gap: 0.55rem; margin: 0.8rem 0 0; color: var(--muted); font-size: 0.72rem; }
.footer-links a { color: var(--muted); }
.app-build-info { display: flex; justify-content: center; gap: 0.4rem; margin: 0.45rem 0 0; color: var(--muted); font-size: 0.68rem; }
.consent-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; overflow-y: auto; place-items: center; padding: 1rem; background: rgb(12 33 31 / 72%); backdrop-filter: blur(6px); }
.consent-dialog { width: min(680px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.5rem; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-strong); box-shadow: 0 30px 70px rgb(7 28 26 / 38%); }
.consent-dialog.first-use-dialog { width: min(1060px, 100%); }
.consent-dialog h2 { margin-bottom: 0.55rem; }
.consent-intro { margin-bottom: 1.2rem; color: var(--muted); line-height: 1.55; }
.returning-user-signin { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-bottom: 1rem; padding: 1rem 1.1rem; border: 1px solid #9dcfc8; border-radius: 16px; background: #eefaf8; }
.returning-user-signin h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.returning-user-signin p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.returning-user-signin .button { flex: 0 0 auto; white-space: nowrap; }
.new-user-heading { display: flex; align-items: center; gap: 0.75rem; margin: 1.1rem 0; color: var(--muted); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.new-user-heading::before, .new-user-heading::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.void-diary-definition { margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 14px; background: var(--surface); }
.void-diary-definition h3 { margin: 0 0 0.45rem; font-size: 1rem; }
.void-diary-definition p { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.void-diary-definition p:last-child { margin-bottom: 0; }
.void-diary-definition strong { color: var(--ink); }
.dashboard-preference-content:not([hidden]) { display: contents; }
.dashboard-preference-loading { margin: 1rem 0; }
.consent-version { margin: -0.8rem 0 1rem; color: var(--muted); font-size: 0.7rem; }
.consent-loading { padding: 2.5rem 1rem; color: var(--muted); text-align: center; }
.health-warning { margin-bottom: 1rem; padding: 1rem; border: 1px solid #d9bd7a; border-radius: 14px; background: #fff7e5; color: #5f4c24; }
.health-warning strong { display: block; margin-bottom: 0.35rem; }
.health-warning p { margin: 0 0 0.55rem; font-size: 0.84rem; line-height: 1.5; }
.health-warning p:last-child { margin-bottom: 0; }
.consent-terms { margin-bottom: 1rem; background: var(--surface); }
.consent-terms > summary { padding: 0.1rem; }
.consent-terms > div { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.consent-terms h3 { margin: 0 0 0.65rem; font-size: 1rem; }
.consent-terms p { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.consent-terms p:last-child { margin-bottom: 0; }
.consent-terms strong { color: var(--ink); }
.consent-checks { display: grid; gap: 0.65rem; }
.consent-checks label { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 0.84rem; font-weight: 650; line-height: 1.45; }
.consent-checks input { width: 20px; height: 20px; flex: 0 0 20px; margin: 0.05rem 0 0; accent-color: var(--primary); }
.consent-error { margin: 1rem 0 0; padding: 0.75rem 0.85rem; border: 1px solid #e3b0ab; border-radius: 10px; background: #fcedeb; color: var(--danger); font-size: 0.82rem; }
.consent-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.consent-signout { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.first-use-actions { justify-content: space-between; }
.product-previews { margin: 0 0 1.1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--canvas); }
.product-previews > header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.product-previews h3 { margin: 0; font-size: 1.05rem; }
.product-previews > header small { max-width: 280px; color: var(--muted); font-size: 0.7rem; text-align: right; }
.product-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.product-preview-grid figure { min-width: 0; margin: 0; }
.product-preview-frame { aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 5px 18px rgb(30 52 49 / 8%); }
.product-preview-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.product-preview-grid figcaption { display: grid; gap: 0.15rem; padding: 0.55rem 0.2rem 0; }
.product-preview-grid figcaption strong { font-size: 0.78rem; }
.product-preview-grid figcaption span { color: var(--muted); font-size: 0.69rem; line-height: 1.4; }

.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.intro { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.eyebrow { margin-bottom: 0.45rem; color: var(--primary); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.diary-status { display: flex; max-width: 360px; align-items: center; gap: 0.65rem; color: var(--muted); }
.diary-status > span:last-child { display: grid; gap: 0.05rem; }
.diary-status strong { color: var(--ink); font-size: 0.82rem; }
.diary-status small { font-size: 0.72rem; line-height: 1.35; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #a36c2f; box-shadow: 0 0 0 4px rgb(163 108 47 / 12%); }
.status-dot.online { background: #278167; box-shadow: 0 0 0 4px rgb(39 129 103 / 13%); }
.message { margin-bottom: 1.5rem; padding: 0.9rem 1rem; border: 1px solid #acd2c7; border-radius: 13px; background: #e8f5f1; }
.message.error, .form-error { border-color: #e3b0ab; background: #fcedeb; color: var(--danger); }
.storage-confirmation, .data-transfer-prompt { display: grid; gap: 0.65rem; }
.data-transfer-prompt > span { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.storage-confirmation > div, .data-transfer-prompt > div { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.mobile-only { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.signed-out-welcome { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(230px, 0.7fr); gap: 1.5rem; margin: 0 0 2rem; padding: 1.3rem; border: 1px solid #9ec8bd; border-radius: 20px; background: linear-gradient(135deg, var(--surface), var(--primary-soft)); }
.signed-out-welcome h2 { margin-bottom: 0.55rem; }
.signed-out-welcome p:not(.eyebrow) { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.signed-out-welcome p.local-storage-notice { margin-top: 0.75rem; padding: 0.65rem 0.75rem; border-left: 3px solid var(--primary); border-radius: 8px; background: var(--surface); }
.local-storage-notice strong { color: var(--ink); }
.signed-out-welcome ul { align-self: center; margin: 0; padding-left: 1.3rem; color: var(--muted); font-size: 0.8rem; line-height: 1.7; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.welcome-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.offline-account-notice { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin: 0 0 2rem; padding: 1.1rem 1.25rem; border: 1px solid #d8b46b; border-radius: 18px; background: #fff7e5; }
.offline-account-notice h2 { margin-bottom: 0.35rem; font-size: 1.2rem; }
.offline-account-notice p:not(.eyebrow) { max-width: 760px; margin: 0; color: #65532e; font-size: 0.82rem; line-height: 1.5; }
.offline-account-notice .button { flex: 0 0 auto; text-decoration: none; }

.help-panel { margin: -0.65rem 0 2rem; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgb(255 253 248 / 55%); }
.help-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.9rem; list-style: none; }
.help-panel > summary::-webkit-details-marker { display: none; }
.help-panel > summary::after { content: "+"; flex: 0 0 auto; color: var(--muted); font-size: 1.25rem; font-weight: 500; line-height: 1; }
.help-panel[open] > summary::after { content: "−"; }
.help-panel > summary span { font-weight: 750; }
.help-panel > summary small { margin-left: auto; color: var(--muted); font-size: 0.78rem; font-weight: 500; }
.help-content { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 1rem; border-top: 1px solid var(--line); }
.help-content section { min-width: 0; }
.help-content h3 { margin: 0 0 0.45rem; font-size: 0.95rem; }
.help-content p { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.help-content p:last-child { margin-bottom: 0; }
.help-content strong { color: var(--ink); }
.help-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin: 0; padding: 0 1rem 1rem; font-size: 0.78rem; }

.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1rem; }
.heading-with-help { display: flex; align-items: center; gap: 0.45rem; }
.quick-heading-actions { display: flex; align-items: center; gap: 0.55rem; }
.quick-more { position: relative; }
.quick-more-toggle { display: inline-flex; min-height: 36px; align-items: center; gap: 0.28rem; padding: 0.35rem 0.65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--primary); cursor: pointer; font-size: 0.76rem; font-weight: 800; }
.quick-more-toggle:hover, .quick-more-toggle:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.quick-more-toggle:disabled { cursor: not-allowed; opacity: 0.5; }
.quick-more-toggle > span { font-size: 1rem; line-height: 1; }
.quick-more-menu { position: absolute; z-index: 30; top: calc(100% + 0.4rem); right: 0; display: grid; width: min(320px, calc(100vw - 2rem)); padding: 0.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.quick-more-menu > button { display: grid; min-height: 54px; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 0.65rem; padding: 0.48rem 0.55rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.quick-more-menu > button:hover, .quick-more-menu > button:focus-visible { background: var(--primary-soft); }
.quick-more-menu > button:disabled { cursor: not-allowed; opacity: 0.5; }
.quick-more-menu .event-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 0.76rem; }
.quick-more-menu button > span:last-child { display: grid; gap: 0.1rem; }
.quick-more-menu strong { font-size: 0.8rem; }
.quick-more-menu small { color: var(--muted); font-size: 0.68rem; line-height: 1.3; }
.quick-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.8rem; }
.quick-card { display: flex; min-height: 145px; flex-direction: column; align-items: flex-start; gap: 0.38rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); box-shadow: 0 3px 12px rgb(30 52 49 / 4%); cursor: pointer; text-align: left; transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease; }
.quick-card:hover { transform: translateY(-2px); border-color: #9cb8b0; box-shadow: var(--shadow); }
.quick-card:active { transform: translateY(0); }
.quick-card:disabled { cursor: not-allowed; opacity: 0.52; transform: none; }
.quick-card strong { margin-top: auto; font-size: 0.96rem; }
.quick-card small { color: var(--muted); line-height: 1.3; }

.event-icon { position: relative; display: inline-grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 14px; background: #e1e8e5; color: #35524e; font-weight: 800; }
.event-confidence { position: absolute; right: -4px; bottom: -4px; display: grid; width: 17px; height: 17px; place-items: center; border: 2px solid var(--surface); border-radius: 50%; background: var(--surface-strong); color: var(--primary); font-size: 0.58rem; font-style: normal; font-weight: 900; line-height: 1; }
.event-confidence.estimated, .event-confidence.approximate { color: #8a651f; }
.event-confidence.unknown, .event-confidence.uncertain { color: #7a526c; }
.event-confidence.active { color: #397e94; }
.event-icon.drink { background: #dceefa; color: #246286; }
.event-icon.urge { background: #f4e1ee; color: #8c3d71; }
.event-icon.release { background: #e3e5f7; color: #4c5692; }
.event-icon.measure, .event-icon.outputmeasurement { background: #dceee8; color: #246f5d; }
.event-icon.stool { background: #eee3d6; color: #7a5635; }
.event-icon.sleep { background: #e7e2f3; color: #62518a; }
.event-icon.context, .event-icon.contextnote { background: #eee9d1; color: #71632c; }

.active-strip { display: grid; gap: 0.7rem; margin: 0 0 2rem; padding: 0.8rem; border: 1px solid #a8c9bd; border-radius: 18px; background: #e9f4f0; }
.active-strip > div { display: flex; min-width: 0; align-items: center; gap: 0.8rem; }
.active-strip > div + div { padding-top: 0.7rem; border-top: 1px solid rgb(80 140 121 / 22%); }
.active-strip-copy { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.active-strip-copy strong { margin-right: 0.2rem; }
.active-strip .button { flex: 0 0 auto; margin-left: auto; }

.insights-section { margin-top: 3.75rem; }
.insight-title { align-items: center; }
.range-field { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.range-field select { min-height: 42px; padding: 0.5rem 2rem 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; }
.insight-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 3px 12px rgb(30 52 49 / 4%); }
.insight-card-heading { display: flex; min-height: 48px; align-items: flex-start; justify-content: space-between; gap: 0.45rem; }
.insight-label { color: var(--muted); font-size: 0.75rem; font-weight: 750; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.045em; }
.insight-card .badge { flex: 0 0 auto; }
.insight-value { display: block; overflow-wrap: anywhere; margin: 0.3rem 0 0.6rem; font-size: clamp(1.3rem, 2.2vw, 1.85rem); line-height: 1.1; letter-spacing: -0.025em; }
.insight-detail, .insight-provenance { margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.insight-provenance { margin-top: 0.45rem; font-size: 0.7rem; }
.insight-breakdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; margin: 0.3rem 0 0.7rem; }
.insight-breakdown span { display: flex; min-width: 0; flex-direction: column; padding: 0.45rem; border-radius: 10px; background: var(--primary-soft); text-align: center; }
.insight-breakdown strong { font-size: 1.2rem; }
.insight-breakdown small { overflow: hidden; color: var(--muted); font-size: 0.65rem; text-overflow: ellipsis; }
.insight-note { max-width: 940px; margin: 0.8rem 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.insight-note strong { color: var(--ink); }

.timeline-section { margin-top: 3.75rem; }
.timeline-title { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.timeline-heading { display: flex; align-items: center; gap: 0.65rem; }
.timeline-toggle { display: inline-flex; min-height: 36px; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--primary); cursor: pointer; font-size: 0.75rem; font-weight: 750; }
.timeline-toggle:hover { border-color: #9cb8b0; background: var(--primary-soft); }
.timeline-toggle span { font-size: 1rem; line-height: 0.75; }
.export-actions { display: flex; gap: 0.5rem; }
.timeline-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; max-width: 860px; margin: -0.35rem 0 0.25rem; }
.day-navigator { display: flex; align-items: center; gap: 0.4rem; }
.day-button { display: grid; width: 40px; min-height: 40px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 750; }
.day-button:hover { border-color: #9cb8b0; background: var(--primary-soft); }
.date-picker input { min-height: 40px; padding: 0.45rem 0.65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.compact-text { min-height: 40px; padding: 0.4rem 0.55rem; }
.timeline-meta { display: flex; max-width: 860px; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.65rem; }
.timeline-date-label { margin: 0; color: var(--muted); font-size: 0.76rem; font-weight: 650; }
.timeline-options { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: 0.45rem; }
.timeline-option { display: grid; gap: 0.16rem; color: var(--muted); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.035em; text-transform: uppercase; }
.timeline-option select { min-height: 38px; padding: 0.35rem 1.8rem 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 0.7rem; font-weight: 700; letter-spacing: normal; text-transform: none; }
.timeline-filter { position: relative; min-width: 104px; min-height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.timeline-filter > summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0.55rem; list-style: none; color: var(--ink); font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.timeline-filter > summary::-webkit-details-marker { display: none; }
.timeline-filter > summary::after { color: var(--primary); content: "▾"; }
.timeline-filter[open] > summary::after { transform: rotate(180deg); }
.timeline-filter-popover { position: absolute; z-index: 12; top: calc(100% + 0.4rem); right: 0; display: grid; width: 250px; padding: 0.75rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-strong); box-shadow: var(--shadow); }
.timeline-filter-popover > strong { padding-right: 5.5rem; font-size: 0.76rem; }
.timeline-filter-popover > label { display: flex; min-height: 34px; align-items: center; gap: 0.55rem; color: var(--ink); cursor: pointer; font-size: 0.72rem; }
.timeline-filter-popover input { width: 17px; height: 17px; accent-color: var(--primary); }
.timeline-filter-actions { position: absolute; top: 0.52rem; right: 0.55rem; display: flex; gap: 0.15rem; }
.timeline-filter-actions button { min-height: 26px; padding: 0.2rem 0.35rem; border: 0; border-radius: 6px; background: transparent; color: var(--primary); cursor: pointer; font-size: 0.64rem; font-weight: 750; }
.timeline-filter-actions button:hover { background: var(--primary-soft); }
.timeline-view-switch { display: inline-grid; flex: 0 0 auto; grid-template-columns: 1fr 1fr; padding: 0.2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.timeline-view-switch button { min-height: 30px; padding: 0.25rem 0.55rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.7rem; font-weight: 750; }
.timeline-view-switch button[aria-pressed="true"] { background: var(--primary); color: white; }
.text-button, .icon-button, .close-button { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-weight: 700; }
.text-button { min-height: 42px; padding: 0.55rem 0.7rem; }
.icon-button { min-height: 38px; padding: 0.35rem 0.55rem; border-radius: 9px; }
.icon-button:hover { background: var(--primary-soft); }
.timeline { max-width: 860px; }
.timeline-load-sentinel { max-width: 860px; padding: 0.8rem; color: var(--muted); font-size: 0.76rem; text-align: center; }
.timeline-item { display: grid; grid-template-columns: 62px 1fr; }
.timeline-rail { position: relative; display: flex; justify-content: flex-start; padding-top: 1rem; }
.timeline-rail::after { position: absolute; z-index: -1; top: 0; bottom: 0; left: 21px; width: 1px; background: var(--line); content: ""; }
.timeline-card { margin: 0.65rem 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.timeline-card-content { display: block; padding: 1rem 1.1rem; background: var(--surface); }
.timeline-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.timeline-card-title { display: flex; flex-direction: column; gap: 0.18rem; }
.timeline-card p { margin: 0.65rem 0; color: var(--muted); line-height: 1.5; }
.event-time { color: var(--muted); font-size: 0.8rem; }
.timeline-rows { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.timeline-row-columns,
.timeline-row-summary { display: grid; grid-template-columns: 42px minmax(0, 1fr) 120px 78px 78px 20px; align-items: center; gap: 0.55rem; }
.timeline-row-columns { min-height: 28px; padding: 0.25rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--primary-soft); color: var(--muted); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.timeline-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin: 0; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); color: var(--ink); font-size: 0.75rem; }
.timeline-group-heading small { color: var(--muted); font-size: 0.62rem; font-weight: 650; }
.timeline-cards .timeline-group-heading { margin-top: 0.85rem; border: 0; border-radius: 10px; }
.timeline-cards .timeline-group-heading:first-child { margin-top: 0; }
.timeline-row-columns .in,
.timeline-row-columns .out { text-align: right; }
.timeline-row { border-bottom: 1px solid var(--line); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-row-summary { width: 100%; min-height: 54px; padding: 0.35rem 0.75rem; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.timeline-row-summary:hover,
.timeline-row.expanded { background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface)); }
.timeline-row-summary:focus-visible { position: relative; z-index: 1; outline: 3px solid rgb(22 95 90 / 25%); outline-offset: -3px; }
.timeline-row-summary .event-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; font-size: 0.78rem; }
.timeline-row-label { display: grid; min-width: 0; gap: 0.12rem; }
.timeline-row-titleline { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
.timeline-row-titleline strong { overflow: hidden; font-size: 0.82rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.timeline-row-label small { overflow: hidden; color: var(--muted); font-size: 0.68rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.row-tag { display: inline-flex; min-height: 18px; align-items: center; padding: 0.08rem 0.32rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.56rem; font-weight: 800; line-height: 1; text-transform: uppercase; }
.row-tag.measured { border-color: #a6cdc1; background: #e6f3ef; color: #246957; }
.row-tag.estimated { border-color: #ddc894; background: #fff4d9; color: #725c26; }
.row-tag.imported { border-color: #b8c4db; background: #edf1f8; color: #4f6385; }
.row-tag.pending { border-color: #b6c3ce; background: #edf2f5; color: #536674; }
.timeline-row-time { color: var(--muted); font-size: 0.69rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline-volume { justify-self: stretch; padding: 0.22rem 0.35rem; border-radius: 7px; color: #8a9491; font-size: 0.68rem; font-variant-numeric: tabular-nums; font-weight: 750; text-align: right; white-space: nowrap; }
.timeline-volume.in.has-value { background: #e3f1fa; color: #285f7e; }
.timeline-volume.out.has-value { background: #eceaf8; color: #56528a; }
.timeline-row-chevron { color: var(--primary); font-size: 1rem; font-weight: 800; text-align: center; }
.timeline-row-details { padding: 0.65rem 0.75rem 0.75rem 4.85rem; border-top: 1px solid var(--line); }
.timeline-row-details > p { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.timeline-row-detail-footer { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 0.6rem; }
.timeline-entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; margin-left: auto; }
.swipe-edit-action { display: none; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0.18rem 0.5rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.badge.measured { border-color: #a6cdc1; background: #e6f3ef; color: #246957; }
.badge.estimated { border-color: #ddc894; background: #fff4d9; color: #725c26; }
.badge.imported { border-color: #b8c4db; background: #edf1f8; color: #4f6385; }
.badge.imputed { border-color: #d6b7d0; background: #f5eaf2; color: #77516e; }
.badge.mixed { border-color: #c2b9da; background: #eeeaf7; color: #645a82; }
.badge.insufficient { border-color: #c6cdca; background: #f1f3f2; color: #67736f; }
.badge.pending { border-color: #b6c3ce; background: #edf2f5; color: #536674; }
.empty-state { padding: 2.5rem; border: 1px dashed #b9c4bd; border-radius: 18px; color: var(--muted); text-align: center; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; overflow-y: auto; place-items: center; padding: 1rem; background: rgb(12 33 31 / 60%); backdrop-filter: blur(4px); }
.editor { width: min(680px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.4rem; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-strong); box-shadow: 0 30px 70px rgb(7 28 26 / 35%); }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.3rem; }
.close-button { width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 1.7rem; }
.close-button:hover { background: var(--primary-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.nested { margin-top: 0.9rem; }
.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.42rem; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.field > span { display: flex; min-height: 24px; align-items: center; }
.field-label { display: grid; min-height: 24px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.35rem; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 0.72rem 0.8rem; border: 1px solid #bac6c0; border-radius: 11px; outline: none; background: var(--surface); color: var(--ink); font-weight: 500; }
.field-hint { color: var(--muted); font-size: 0.68rem; font-weight: 500; line-height: 1.4; }
.confidence-input { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: stretch; gap: 0.4rem; }
.confidence-input > input { min-width: 0; }
.confidence-picker { position: relative; display: flex; }
.confidence-trigger { display: grid; width: 42px; min-height: 48px; padding: 0; place-items: center; border: 1px solid #bac6c0; border-radius: 11px; background: var(--surface); color: var(--primary); cursor: pointer; font-size: 1rem; font-weight: 900; line-height: 1; }
.confidence-trigger:hover, .confidence-trigger:focus-visible, .confidence-trigger[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgb(22 95 90 / 12%); }
.confidence-trigger.estimated, .confidence-trigger.approximate { color: #8a651f; }
.confidence-trigger.unknown, .confidence-trigger.uncertain { color: #7a526c; }
.confidence-popover { position: absolute; z-index: 20; top: calc(100% + 0.35rem); right: 0; display: grid; width: min(250px, calc(100vw - 3rem)); padding: 0.35rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); box-shadow: var(--shadow); }
.confidence-popover button { display: grid; min-height: 48px; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto auto; gap: 0 0.45rem; padding: 0.45rem 0.55rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.confidence-popover button:hover, .confidence-popover button:focus-visible, .confidence-popover button[aria-selected="true"] { background: var(--primary-soft); }
.confidence-popover button > span { grid-row: 1 / -1; align-self: center; color: var(--primary); font-size: 1rem; font-weight: 900; text-align: center; }
.confidence-popover button > strong { font-size: 0.73rem; }
.confidence-popover button > small { color: var(--muted); font-size: 0.64rem; font-weight: 500; line-height: 1.25; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(22 95 90 / 12%); }
.check-field { display: flex; min-height: 48px; align-items: center; gap: 0.65rem; padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.check-field input { width: 20px; height: 20px; accent-color: var(--primary); }
.check-field.detailed { align-items: flex-start; }
.check-field.detailed input { flex: 0 0 auto; margin-top: 0.1rem; }
.check-field.detailed span { display: flex; flex-direction: column; gap: 0.2rem; }
.check-field.detailed strong { font-size: 0.78rem; }
.check-field.detailed small { color: var(--muted); font-size: 0.68rem; font-weight: 500; line-height: 1.35; }
details { padding: 0.8rem; border: 1px solid var(--line); border-radius: 12px; }
summary { color: var(--primary); cursor: pointer; font-weight: 700; }
.field-help { position: relative; width: 24px; height: 24px; min-width: 24px; padding: 0; border: 0; border-radius: 0; }
.field-help > summary { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line); border-radius: 50%; list-style: none; background: var(--surface); color: var(--primary); font-size: 0.72rem; font-weight: 800; line-height: 1; }
.field-help > summary::-webkit-details-marker { display: none; }
.field-help > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.field-help[open] > summary { background: var(--primary-soft); }
.field-help > div { position: absolute; z-index: 10; top: calc(100% + 0.4rem); right: 0; width: 18rem; max-width: calc(100vw - 4rem); padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-top: 3px solid var(--primary); border-radius: 9px; background: var(--surface-strong); box-shadow: var(--shadow); color: var(--muted); font-size: 0.72rem; font-weight: 500; line-height: 1.45; }
.field-help > div strong { display: block; margin-bottom: 0.15rem; color: var(--ink); font-size: 0.74rem; }
.field-help > div p { margin: 0; }
.severity { margin: 0; padding: 0.9rem; border: 1px solid var(--line); border-radius: 12px; }
.severity input { width: 100%; accent-color: var(--primary); }
.scale-definitions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.35rem; margin: 0.45rem 0 0; padding: 0; color: var(--muted); font-size: 0.63rem; list-style: none; }
.scale-definitions li { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; text-align: center; }
.scale-definitions strong { color: var(--ink); font-size: 0.7rem; }
.form-guidance { margin: 0; padding: 0.75rem 0.85rem; border-left: 4px solid #b45884; border-radius: 0 10px 10px 0; background: #fbf1f6; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.form-guidance strong { color: var(--ink); }
.calculation { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.2rem 0.8rem; margin: 0; padding: 0.8rem; border-radius: 11px; background: var(--primary-soft); }
.calculation > span { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.calculation > strong { font-size: 0.95rem; }
.calculation > small { grid-column: 1 / -1; color: var(--muted); font-size: 0.68rem; line-height: 1.4; }
.suggestion-button { align-self: flex-start; padding: 0.45rem 0.6rem; border: 1px solid var(--primary); border-radius: 9px; background: var(--primary-soft); color: var(--primary); cursor: pointer; font-size: 0.7rem; font-weight: 750; }
.drink-presets { display: flex; flex-direction: column; gap: 0.5rem; }
.drink-presets > span { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.drink-presets > small { color: var(--muted); font-size: 0.68rem; line-height: 1.4; }
.drink-preset-options { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.drink-preset-button { display: flex; min-height: 44px; align-items: center; gap: 0.45rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); cursor: pointer; }
.drink-preset-button:hover, .drink-preset-button:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.drink-preset-button strong { font-size: 0.76rem; }
.drink-preset-button small { color: var(--muted); font-size: 0.67rem; }
.form-error { margin: 1rem 0 0; padding: 0.8rem; border: 1px solid; border-radius: 10px; }
.editor-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.action-spacer { flex: 1; }
.button { min-height: 46px; padding: 0.68rem 1rem; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 750; }
.button:disabled { cursor: not-allowed; opacity: 0.5; }
.text-button:disabled, .day-button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: 0.48; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-strong); }
.button.secondary { border-color: var(--line); background: var(--surface); }
.button.danger { background: var(--danger); color: white; }
.button.compact { min-height: 38px; padding: 0.45rem 0.8rem; font-size: 0.82rem; }
.danger-text { color: var(--danger); }
.loading-card { width: min(420px, calc(100% - 2rem)); margin: 20vh auto; padding: 2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: center; }
#blazor-error-ui { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: none; max-width: 500px; padding: 1rem; border-radius: 12px; background: #fcedeb; color: #5f2824; box-shadow: var(--shadow); }
#blazor-error-ui .dismiss { float: right; border: 0; background: transparent; }

@media (max-width: 980px) {
  .product-preview-grid { grid-template-columns: repeat(3, minmax(230px, 1fr)); overflow-x: auto; padding-bottom: 0.35rem; scroll-snap-type: x proximity; }
  .product-preview-grid figure { scroll-snap-align: start; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subjective-card { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.45rem; }
  .eyebrow { font-size: 0.8rem; }
  .app-header { min-height: 58px; padding: 0.45rem 0.6rem; background: var(--canvas); backdrop-filter: none; }
  .app-shell { width: min(100% - 1.2rem, 1160px); padding: 1rem 0 4rem; }
  .app-footer { width: min(100% - 1.2rem, 1160px); padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .brand { gap: 0.5rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand-copy { display: flex; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 0.92rem; }
  .environment-badge { max-width: 4.5rem; overflow: hidden; padding-inline: 0.35rem; text-overflow: ellipsis; white-space: nowrap; }
  .primary-nav { position: fixed; z-index: 30; right: 0.6rem; bottom: max(0.6rem, env(safe-area-inset-bottom)); left: 0.6rem; justify-content: center; gap: 0.1rem; padding: 0.35rem; border-radius: 16px; box-shadow: 0 12px 34px rgb(7 28 26 / 25%); }
  .primary-nav a { overflow: hidden; min-width: 0; min-height: 44px; flex: 1 1 0; padding: 0.6rem 0.15rem; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
  .nav-label-wide { display: none; }
  .nav-label-compact { display: inline; }
  .primary-nav .secondary-nav-link { display: none; }
  .desktop-account-content { display: none; }
  .mobile-account-trigger { position: relative; z-index: 62; display: flex; min-width: 52px; min-height: 44px; align-items: center; justify-content: center; gap: 0.15rem; padding: 0.2rem 0.3rem 0.2rem 0.2rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
  .mobile-account-trigger .account-avatar { width: 36px; height: 36px; flex-basis: 36px; }
  .mobile-account-trigger svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
  .mobile-account-scrim { position: fixed; z-index: 60; inset: 0; display: block; padding: 0; border: 0; background: rgb(7 28 26 / 30%); cursor: default; }
  .mobile-account-panel { position: absolute; z-index: 61; top: calc(100% + 0.5rem); right: 0; display: block; width: min(20rem, calc(100vw - 1.2rem)); max-height: calc(100dvh - 5rem); overflow-y: auto; padding: 0.85rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-strong); box-shadow: 0 22px 55px rgb(7 28 26 / 28%); }
  .mobile-account-identity { display: flex; min-width: 0; align-items: center; gap: 0.7rem; padding: 0.15rem 0.15rem 0.8rem; }
  .mobile-account-identity > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 0.15rem; }
  .mobile-account-identity small { color: var(--muted); font-size: 0.7rem; }
  .mobile-account-identity strong { overflow-wrap: anywhere; font-size: 0.92rem; }
  .mobile-menu-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; padding: 0.7rem 0; border-block: 1px solid var(--line); }
  .mobile-menu-links a { display: grid; min-height: 44px; place-items: center; padding: 0.55rem 0.75rem; border-radius: 11px; background: var(--canvas); color: var(--ink); font-size: 0.86rem; font-weight: 700; text-decoration: none; }
  .mobile-account-actions { display: flex; gap: 0.5rem; padding-top: 0.75rem; }
  .mobile-account-actions .account-action { min-height: 44px; flex: 1; padding: 0.55rem 0.75rem; font-size: 0.86rem; text-align: center; }
  .medical-disclaimer { grid-template-columns: 1fr; gap: 0.2rem; padding: 0.7rem 0.75rem; font-size: 0.82rem; }
  .medical-disclaimer strong { white-space: normal; }
  .consent-backdrop { align-items: end; padding: 0.25rem; }
  .consent-dialog { max-height: calc(100vh - 0.5rem); padding: 1rem; border-radius: 18px; }
  .consent-intro { margin-bottom: 0.9rem; font-size: 0.92rem; }
  .returning-user-signin { align-items: stretch; flex-direction: column; gap: 0.75rem; padding: 0.85rem; }
  .returning-user-signin p { font-size: 0.86rem; }
  .returning-user-signin .button { justify-content: center; text-align: center; }
  .health-warning { padding: 0.8rem; }
  .health-warning p, .consent-terms p { font-size: 0.86rem; }
  .consent-checks label { gap: 0.55rem; padding: 0.7rem; font-size: 0.88rem; }
  .consent-actions { position: sticky; bottom: -1rem; flex-direction: column-reverse; margin-inline: -1rem; padding: 0.8rem 1rem 1rem; background: var(--surface-strong); }
  .consent-actions .button { width: 100%; justify-content: center; text-align: center; }
  .product-previews { margin-inline: -0.15rem; padding: 0.75rem; }
  .product-previews > header { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
  .product-previews > header small { text-align: left; }
  .dashboard-heading { align-items: stretch; flex-direction: column; gap: 0.75rem; margin-bottom: 1.35rem; }
  .dashboard-heading .eyebrow { margin-bottom: 0.25rem; }
  .intro { display: none; }
  .diary-status { max-width: none; }
  .diary-status strong { font-size: 0.9rem; }
  .diary-status small { font-size: 0.82rem; }
  .help-panel { margin: 0 0 1.35rem; }
  .help-panel > summary { position: relative; align-items: flex-start; flex-direction: column; gap: 0.15rem; padding: 0.65rem 0.75rem; }
  .help-panel > summary small { margin-left: 0; padding-right: 1.5rem; font-size: 0.82rem; }
  .help-panel > summary::after { position: absolute; align-self: flex-end; }
  .help-content { grid-template-columns: 1fr; gap: 1rem; padding: 0.8rem; }
  .help-content h3 { font-size: 1rem; }
  .help-content p, .help-links { font-size: 0.86rem; }
  .help-links { padding: 0 0.8rem 0.8rem; }
  .signed-out-welcome { grid-template-columns: 1fr; gap: 0.8rem; padding: 1rem; border-radius: 16px; }
  .signed-out-welcome ul { display: none; }
  .signed-out-welcome p:not(.eyebrow) { font-size: 0.9rem; }
  .welcome-actions .button { min-height: 44px; padding: 0.55rem 0.7rem; font-size: 0.84rem; }
  .offline-account-notice { align-items: stretch; flex-direction: column; gap: 0.8rem; padding: 1rem; }
  .offline-account-notice .button { align-self: flex-start; }
  .active-strip { gap: 0.6rem; margin-bottom: 1.35rem; padding: 0.7rem; }
  .active-strip > div { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 0.6rem; }
  .active-strip > div + div { padding-top: 0.6rem; }
  .active-strip .event-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 0.78rem; }
  .active-strip-copy { font-size: 0.86rem; }
  .active-strip .button { min-height: 40px; padding: 0.45rem 0.65rem; }
  .quick-section .section-title { align-items: end; margin-bottom: 0.65rem; }
  .quick-heading-actions { gap: 0.35rem; }
  .quick-more-toggle { min-height: 34px; padding: 0.3rem 0.5rem; font-size: 0.72rem; }
  .quick-more-menu { max-height: min(430px, calc(100vh - 9rem)); overflow-y: auto; }
  .quick-more-menu > button { min-height: 58px; }
  .quick-more-menu strong { font-size: 0.88rem; }
  .quick-more-menu small { font-size: 0.78rem; }
  .mobile-only { display: inline; }
  .quick-hint { color: var(--muted); font-size: 0.82rem; }
  .quick-grid { display: flex; padding: 0 0 0.45rem; overflow-x: auto; gap: 0.55rem; scroll-padding-inline: 0.6rem; scroll-snap-type: x proximity; scrollbar-width: none; }
  .quick-grid::-webkit-scrollbar { display: none; }
  .quick-card { min-width: 116px; min-height: 76px; flex: 0 0 116px; flex-direction: row; align-items: center; gap: 0.55rem; padding: 0.65rem; border-radius: 14px; scroll-snap-align: start; }
  .quick-card .event-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 0.78rem; }
  .quick-card strong { margin-top: 0; font-size: 0.9rem; line-height: 1.15; }
  .quick-card small { display: none; }
  .insights-section { margin-top: 1.7rem; }
  .insight-title { align-items: flex-end; gap: 0.6rem; margin-bottom: 0.35rem; }
  .insight-title .eyebrow { display: none; }
  .range-field { align-items: flex-end; flex-direction: column; gap: 0.15rem; font-size: 0.8rem; }
  .range-field select { min-height: 40px; max-width: 145px; padding-block: 0.3rem; font-size: 0.84rem; }
  .insights-section > .quick-hint { display: block; margin-bottom: 0.45rem; }
  .insights-grid { display: flex; padding: 0 0 0.45rem; overflow-x: auto; gap: 0.55rem; scroll-padding-inline: 0.6rem; scroll-snap-type: x proximity; scrollbar-width: none; }
  .insights-grid::-webkit-scrollbar { display: none; }
  .insight-card, .subjective-card { min-width: min(340px, calc(100vw - 3rem)); flex: 0 0 min(340px, calc(100vw - 3rem)); padding: 1rem; border-radius: 16px; scroll-snap-align: start; }
  .insight-card-heading { min-height: 42px; }
  .insight-label { font-size: 0.8rem; }
  .insight-value { margin: 0.2rem 0 0.5rem; font-size: 1.65rem; }
  .insight-detail { font-size: 0.86rem; }
  .insight-provenance { font-size: 0.8rem; }
  .insight-note { margin-top: 0.6rem; font-size: 0.82rem; line-height: 1.45; }
  .timeline-section { margin-top: 1.7rem; }
  .timeline-title { align-items: center; gap: 0.4rem; margin-bottom: 0.45rem; padding-bottom: 0.55rem; }
  .timeline-title .eyebrow { display: none; }
  .timeline-heading { gap: 0.35rem; }
  .timeline-toggle { min-height: 36px; padding: 0.25rem 0.45rem; font-size: 0.8rem; }
  .export-actions { gap: 0; }
  .export-actions .text-button { min-height: 40px; padding: 0.35rem 0.45rem; font-size: 0.82rem; }
  .timeline-toolbar { align-items: stretch; gap: 0.3rem; margin: 0 0 0.15rem; }
  .day-navigator { min-width: 0; gap: 0.25rem; }
  .day-button { width: 34px; min-height: 36px; flex: 0 0 34px; }
  .date-picker { min-width: 0; }
  .date-picker input { width: 142px; max-width: 100%; min-height: 40px; padding: 0.35rem 0.4rem; font-size: 0.82rem; }
  .compact-text { min-height: 40px; padding: 0.25rem 0.35rem; font-size: 0.8rem; }
  .timeline-meta { align-items: stretch; flex-direction: column; gap: 0.4rem; margin-bottom: 0.45rem; }
  .timeline-swipe-hint { display: block; margin: 0 0 0.45rem; }
  .timeline-date-label { min-width: 0; font-size: 0.82rem; line-height: 1.35; }
  .timeline-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; justify-content: stretch; gap: 0.35rem; }
  .timeline-option { font-size: 0.76rem; }
  .timeline-option select { width: 100%; min-height: 40px; font-size: 0.82rem; }
  .timeline-filter { width: 100%; min-width: 0; min-height: 36px; }
  .timeline-filter > summary { min-height: 38px; font-size: 0.82rem; }
  .timeline-filter-popover { right: auto; left: 0; width: min(270px, calc(100vw - 2rem)); }
  .timeline-view-switch { width: 100%; }
  .timeline-view-switch button { min-height: 34px; padding: 0.2rem 0.42rem; font-size: 0.78rem; }
  .timeline-row-columns,
  .timeline-row-summary { grid-template-columns: 34px minmax(0, 1fr) 48px 48px 16px; gap: 0.35rem; }
  .timeline-row-columns { padding: 0.3rem 0.45rem; font-size: 0.68rem; }
  .timeline-group-heading { padding: 0.52rem 0.55rem; font-size: 0.82rem; }
  .timeline-group-heading small { font-size: 0.74rem; }
  .timeline-row-columns > span:nth-child(3),
  .timeline-row-time { display: none; }
  .timeline-row-summary { min-height: 60px; padding: 0.4rem 0.45rem; }
  .timeline-row-summary .event-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; font-size: 0.72rem; }
  .timeline-row-titleline { gap: 0.18rem; }
  .timeline-row-titleline strong { font-size: 0.9rem; }
  .timeline-row-label small { font-size: 0.78rem; line-height: 1.35; }
  .row-tag { min-height: 18px; padding-inline: 0.28rem; font-size: 0.64rem; }
  .timeline-row-titleline .row-tag.pending { display: none; }
  .timeline-volume { padding: 0.18rem 0.2rem; font-size: 0.72rem; }
  .timeline-row-details { padding: 0.55rem 0.55rem 0.65rem 2.8rem; }
  .timeline-row-details > p { font-size: 0.86rem; }
  .timeline-row-detail-footer { align-items: flex-end; flex-direction: column; }
  .timeline-item { grid-template-columns: 38px minmax(0, 1fr); }
  .timeline-rail { padding-top: 0.65rem; }
  .timeline-rail::after { display: none; }
  .timeline-rail .event-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; font-size: 0.75rem; }
  .timeline-card { margin: 0.3rem 0; border-radius: 13px; }
  .timeline-card-content { padding: 0.85rem; }
  .timeline-card-heading { gap: 0.5rem; }
  .timeline-card-title { gap: 0.08rem; }
  .timeline-card-heading strong { font-size: 1rem; }
  .timeline-card p { margin: 0.45rem 0; font-size: 0.9rem; line-height: 1.4; }
  .event-time { font-size: 0.82rem; }
  .icon-button { min-height: 40px; padding: 0.25rem 0.5rem; font-size: 0.84rem; }
  .badges { gap: 0.25rem; }
  .badge { min-height: 24px; padding: 0.12rem 0.4rem; font-size: 0.74rem; }
  .empty-state { padding: 1.5rem 1rem; font-size: 0.92rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.nested { gap: 0.75rem; }
  .form-grid > *, .field, .confidence-input { min-width: 0; }
  .field { font-size: 0.9rem; }
  .field input, .field select, .field textarea { max-width: 100%; font-size: 1rem; }
  .check-field.detailed strong, .drink-presets > span { font-size: 0.88rem; }
  .check-field.detailed small, .drink-presets > small, .calculation > small, .field-help > div { font-size: 0.82rem; }
  .confidence-popover button > strong { font-size: 0.86rem; }
  .confidence-popover button > small { font-size: 0.78rem; }
  input[type="date"], input[type="time"], input[type="datetime-local"] { display: block; width: 100%; max-width: 100%; min-width: 0; }
  .scale-definitions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; }
  .scale-definitions li { text-align: left; }
  .full { grid-column: auto; }
  .editor { width: 100%; max-width: 100%; max-height: calc(100vh - 0.5rem); padding: 1rem; overflow-x: hidden; border-radius: 18px; }
  .modal-backdrop { align-items: end; padding: 0.25rem; }
  .editor-actions { position: sticky; bottom: -1rem; flex-wrap: wrap; margin-inline: -1rem; padding: 0.8rem 1rem 1rem; background: var(--surface-strong); }
  .swipe-edit-item { position: relative; overflow: hidden; }
  .swipe-edit-action { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; display: flex; width: 78px; align-items: center; justify-content: center; border: 0; background: var(--primary); color: white; cursor: pointer; font-size: 0.86rem; font-weight: 750; }
  .swipe-edit-action:disabled { opacity: 0.5; }
  .swipe-edit-content { position: relative; z-index: 1; width: 100%; background: var(--surface); touch-action: pan-y; transition: transform 160ms ease-out; will-change: transform; }
  .swipe-edit-item[data-swipe-open="true"] .swipe-edit-content,
  .swipe-edit-action:focus-visible + .swipe-edit-content { transform: translateX(-78px); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #12201f;
    --surface: #192a28;
    --surface-strong: #203330;
    --ink: #e9f2ef;
    --muted: #a9bab5;
    --placeholder: #81928d;
    --line: #3b4e4a;
    --primary: #75c7ba;
    --primary-strong: #5fb3a6;
    --primary-soft: #294842;
    --shadow: 0 12px 34px rgb(0 0 0 / 25%);
  }
  .app-header { background: rgb(18 32 31 / 88%); }
  .brand-mark, .button.primary { background: #3b8f83; }
  .button.primary:hover { background: #347d73; }
  .message { background: #193b34; }
  .message.error, .form-error { background: #412824; }
  .medical-disclaimer { border-color: #806d3c; background: #362f1f; color: #eadcae; }
  .health-warning { border-color: #806d3c; background: #362f1f; color: #eadcae; }
  .consent-error { background: #412824; }
  .help-panel { background: rgb(25 42 40 / 65%); }
  .row-tag.measured { border-color: #397362; background: #21473c; color: #a9dccc; }
  .row-tag.estimated { border-color: #75633a; background: #443a24; color: #ead69d; }
  .row-tag.imported { border-color: #52617d; background: #293349; color: #bac7e3; }
  .row-tag.pending { border-color: #526572; background: #273740; color: #bdced8; }
  .timeline-volume.in.has-value { background: #1f3c4b; color: #aed8f0; }
  .timeline-volume.out.has-value { background: #302f50; color: #c6c2ef; }
}

.public-preview {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.public-preview figcaption {
  margin-bottom: 1rem;
}

.public-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: .5rem;
}
