/* CHealth 0.4 — design tokens, light + dark. Type scale: 12 / 14 / 16 / 18 / 22 / 28 / 36. */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/be-vietnam-pro-vietnamese-400-normal.woff2) format('woff2');
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304,
    U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/be-vietnam-pro-latin-400-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/be-vietnam-pro-vietnamese-500-normal.woff2) format('woff2');
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304,
    U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/be-vietnam-pro-latin-500-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/be-vietnam-pro-vietnamese-600-normal.woff2) format('woff2');
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304,
    U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/be-vietnam-pro-latin-600-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/be-vietnam-pro-vietnamese-700-normal.woff2) format('woff2');
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304,
    U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/be-vietnam-pro-latin-700-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f2f6f4;
  --surface: #ffffff;
  --surface-2: #e8efec;
  --ink: #132d28;
  --muted: #5a6d68;
  --line: #d8e2de;
  --primary: #1f6b58;
  --primary-ink: #ffffff;
  --primary-soft: #d9ebe4;
  --sleep: #5a5fc4;
  --sleep-soft: #e4e5f8;
  --heart: #d4483f;
  --heart-soft: #fae2df;
  --move: #b87708;
  --move-soft: #f7ebd2;
  --food: #3b8a3e;
  --food-soft: #e1f1e0;
  --mind: #0f7c8c;
  --mind-soft: #d9f0f2;
  --ok: #1d6b3f;
  --ok-bg: #dcf1e3;
  --warn: #8a5a00;
  --warn-bg: #fbeecd;
  --crit: #b3261e;
  --crit-bg: #fbe4e2;
  --shadow: 0 1px 2px rgba(19, 45, 40, 0.06), 0 4px 16px rgba(19, 45, 40, 0.05);
  --overlay: rgba(10, 25, 22, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e1614;
    --surface: #16211e;
    --surface-2: #1e2c28;
    --ink: #e3ece9;
    --muted: #9bb0aa;
    --line: #2a3a36;
    --primary: #5fc2a4;
    --primary-ink: #04221a;
    --primary-soft: #1b3a31;
    --sleep: #a3a7ff;
    --sleep-soft: #262a4d;
    --heart: #ff8a80;
    --heart-soft: #42221f;
    --move: #f2b54d;
    --move-soft: #3b2d13;
    --food: #86d188;
    --food-soft: #1d3520;
    --mind: #6fd3df;
    --mind-soft: #173539;
    --ok: #7fd9a2;
    --ok-bg: #16301f;
    --warn: #f3c55a;
    --warn-bg: #3a2e12;
    --crit: #ff8a80;
    --crit-bg: #3d1f1d;
    --shadow: none;
    --overlay: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e1614;
  --surface: #16211e;
  --surface-2: #1e2c28;
  --ink: #e3ece9;
  --muted: #9bb0aa;
  --line: #2a3a36;
  --primary: #5fc2a4;
  --primary-ink: #04221a;
  --primary-soft: #1b3a31;
  --sleep: #a3a7ff;
  --sleep-soft: #262a4d;
  --heart: #ff8a80;
  --heart-soft: #42221f;
  --move: #f2b54d;
  --move-soft: #3b2d13;
  --food: #86d188;
  --food-soft: #1d3520;
  --mind: #6fd3df;
  --mind-soft: #173539;
  --ok: #7fd9a2;
  --ok-bg: #16301f;
  --warn: #f3c55a;
  --warn-bg: #3a2e12;
  --crit: #ff8a80;
  --crit-bg: #3d1f1d;
  --shadow: none;
  --overlay: rgba(0, 0, 0, 0.6);
}

/* Base */
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}
h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 18px;
  font-weight: 600;
}
h3 {
  font-size: 16px;
  font-weight: 600;
}
p {
  margin: 0;
}
a {
  color: var(--primary);
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.tiny {
  font-size: 12px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}
.stack {
  display: grid;
  gap: 12px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(90deg, var(--surface) 0 240px, var(--line) 240px 241px, transparent 241px);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  padding: 0 8px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-ink);
  display: grid;
  place-items: center;
}
.side-nav {
  display: grid;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.side-log {
  margin-top: 4px;
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
}
.main > *,
.section > *,
.card > * {
  min-width: 0;
}
.main {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px 96px;
  display: grid;
  gap: 20px;
  align-content: start;
}
.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 12px;
}
.page-heading {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  overflow-wrap: anywhere;
}
.page-head .page-tools {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  justify-content: flex-end;
}
.page-head > .bell {
  grid-column: 3;
  grid-row: 1;
}
@media (max-width: 720px) {
  .page-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .page-head > .bell {
    grid-column: 2;
  }
  .page-head .page-tools {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
.page-head .sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
}
.tabbar {
  display: none;
}

/* Cards and sections */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px;
}
.section {
  display: grid;
  gap: 12px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.grid-2 {
  align-items: start;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.btn.primary:hover {
  filter: brightness(1.06);
}
.btn.ghost {
  border-color: transparent;
  background: none;
  color: var(--primary);
  padding: 0 8px;
}
.btn.danger,
.btn.ghost.danger {
  color: var(--crit);
}
.btn.block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Chips, pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.pill.crit {
  background: var(--crit-bg);
  color: var(--crit);
}
.pill.info {
  background: var(--primary-soft);
  color: var(--primary);
}
button.pill {
  border: 0;
  cursor: pointer;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
}
.segmented button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* Tones */
.t-sleep {
  --tone: var(--sleep);
  --tone-soft: var(--sleep-soft);
}
.t-heart {
  --tone: var(--heart);
  --tone-soft: var(--heart-soft);
}
.t-move {
  --tone: var(--move);
  --tone-soft: var(--move-soft);
}
.t-food {
  --tone: var(--food);
  --tone-soft: var(--food-soft);
}
.t-mind {
  --tone: var(--mind);
  --tone-soft: var(--mind-soft);
}
.tone-tile {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--tone-soft, var(--surface-2));
  color: var(--tone, var(--muted));
  flex: none;
}

/* Today */
.today-top {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
}
.rings-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.rings-card svg {
  width: 170px;
  height: 170px;
}
.ring-legend {
  display: grid;
  gap: 12px;
}
.ring-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
  border: 0;
  background: none;
  text-align: left;
  padding: 4px 0;
  cursor: pointer;
}
.ring-item .dot {
  color: var(--tone);
  align-self: center;
}
.ring-item .name {
  font-size: 14px;
  color: var(--muted);
}
.ring-item .val {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  grid-column: 2 / 4;
}
.ring-item .val small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.ring-item .pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--tone);
}
.checkin {
  display: grid;
  gap: 14px;
  align-content: start;
}
.faces {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.face {
  display: grid;
  justify-items: center;
  gap: 4px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}
.face span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--ink);
  transition: transform 0.12s;
}
.face span svg {
  width: 28px;
  height: 28px;
}
.face:hover span {
  transform: scale(1.06);
}
.face.on span {
  background: var(--mind);
  color: var(--surface);
}
.energy-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.energy-scale button {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.energy-scale button.on {
  background: var(--mind);
  border-color: var(--mind);
  color: var(--surface);
}
.vitals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tile {
  display: grid;
  gap: 4px;
  align-content: start;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.tile:hover {
  border-color: var(--tone, var(--primary));
}
.tile .t-name {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile .t-name .icon {
  width: 16px;
  height: 16px;
  color: var(--tone);
}
.tile .t-val {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.tile .t-val small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.tile .t-note {
  font-size: 12px;
  color: var(--muted);
}
.tile .t-note.good {
  color: var(--ok);
}
.tile .t-note.watch {
  color: var(--warn);
}
.activity-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.timeline {
  display: grid;
}
.tl-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tl-item:last-child {
  border-bottom: 0;
}
.tl-item b {
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-item .meta {
  font-size: 12px;
  color: var(--muted);
}
.tl-actions {
  display: flex;
  gap: 2px;
}
.sync-pill {
  border: 0;
  cursor: pointer;
}
.notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--ink);
  font-size: 14px;
}
.notice .icon {
  color: var(--warn);
  grid-row: span 2;
}
.notice.crit {
  background: var(--crit-bg);
}
.notice.crit .icon {
  color: var(--crit);
}
.notice.info {
  background: var(--primary-soft);
}
.notice.info .icon {
  color: var(--primary);
}
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

/* Metric detail */
.metric-hero {
  display: grid;
  gap: 8px;
}
.big {
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.big small {
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}
.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart .axis {
  font-size: 11px;
  fill: var(--muted);
}
.chart .grid {
  stroke: var(--line);
}
.chart .bar {
  fill: var(--tone);
  opacity: 0.45;
}
.chart .bar.today {
  opacity: 1;
}
.chart .goal {
  stroke: var(--ink);
  stroke-dasharray: 4 4;
  opacity: 0.55;
}
.chart .band {
  fill: var(--tone-soft);
}
.chart .line {
  fill: none;
  stroke: var(--tone);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .pt {
  fill: var(--surface);
  stroke: var(--tone);
  stroke-width: 2;
}
.legend-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.legend-row i {
  display: inline-block;
  width: 14px;
  height: 3px;
  vertical-align: middle;
  margin-right: 6px;
  background: var(--tone);
}
.legend-row i.dash {
  background: none;
  border-top: 2px dashed var(--ink);
  opacity: 0.6;
}
.legend-row i.band {
  height: 10px;
  background: var(--tone-soft);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 0;
}
.facts div {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
}
.facts dt {
  font-size: 12px;
  color: var(--muted);
}
.facts dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stages {
  display: grid;
  gap: 8px;
}
.stage-row {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.stage-row .bar {
  height: 10px;
  border-radius: 5px;
  background: var(--sleep);
}
.stage-row .val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.hypno .s-W {
  fill: var(--move);
}
.hypno .s-R {
  fill: var(--sleep);
  opacity: 0.8;
}
.hypno .s-L,
.hypno .s-A,
.hypno .s-S {
  fill: var(--sleep);
  opacity: 0.5;
}
.hypno .s-D {
  fill: var(--sleep);
}
details.more > summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  list-style: none;
}
details.more > summary::-webkit-details-marker {
  display: none;
}
.related-records > summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 650;
  color: var(--ink);
}
.related-records[open] > summary { margin-bottom: 16px; }
.related-records > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 5px; }
.heart-alert-threshold {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.heart-alert-threshold legend { padding: 0 6px; font-weight: 650; }
.heart-threshold-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.heart-threshold-options .btn { min-height: 44px; padding: 8px 4px; font-size: 14px; }
.heart-threshold-options [aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.table-wrap {
  overflow-x: auto;
}
.record {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.record:last-child {
  border-bottom: 0;
}
.kv {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
  color: var(--muted);
}
.kv b {
  color: var(--ink);
  font-weight: 600;
}

/* Trends */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.trend-card {
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}
.trend-card svg {
  width: 100%;
  height: 48px;
}
.spark {
  fill: none;
  stroke: var(--tone);
  stroke-width: 2;
}
.spark-area {
  fill: var(--tone-soft);
}

/* Forms */
.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}
.field .hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  font-size: 16px;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
.input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 15px;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.error {
  color: var(--crit);
  font-size: 14px;
  min-height: 0;
}
.error:empty {
  display: none;
}
.pw-wrap {
  position: relative;
}
.pw-wrap .input {
  padding-right: 52px;
}
.pw-wrap .icon-btn {
  position: absolute;
  right: 2px;
  top: 2px;
}
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width 0.2s;
}

/* Composer */
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.picked {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  font-weight: 600;
}
.pick-list {
  display: grid;
  gap: 2px;
  max-height: 460px;
  overflow: auto;
}
.pick {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  padding: 10px 8px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
}
.pick:hover,
.pick.on {
  background: var(--surface-2);
}
.pick small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.pick .icon {
  color: var(--primary);
}

/* Quick sheet */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.quick {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  padding: 6px 0;
  text-align: center;
}
.quick .tone-tile {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}
.recent-list {
  display: grid;
  gap: 6px;
}
.recent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 8px 8px 8px 12px;
  font-size: 14px;
}
.recent span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modal + bottom sheet */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
  animation: fade 0.15s ease-out;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.modal:focus {
  outline: none;
}
.grab {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: translateY(24px);
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 40;
  transition:
    opacity 0.2s,
    transform 0.2s;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: none;
}
.toast.show button {
  pointer-events: auto;
}
.toast button {
  border: 0;
  background: none;
  color: var(--primary-soft);
  font-weight: 700;
  cursor: pointer;
}
body.busy {
  cursor: progress;
}

/* Journal */
.day-group {
  display: grid;
  gap: 4px;
}
.day-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 0 0;
}

/* Library */
.lib {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.lib-list {
  display: grid;
  gap: 2px;
  max-height: 70vh;
  overflow: auto;
}

/* Devices */
.device-card {
  display: grid;
  gap: 12px;
}
.device-head {
  display: flex;
  gap: 14px;
  align-items: center;
}
.source-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.source-row:last-child {
  border-bottom: 0;
}
.source-row.off {
  opacity: 0.55;
}
.settings-list {
  display: grid;
}
.settings-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
}
.settings-item:last-child {
  border-bottom: 0;
}
.settings-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* Rest timer */
.breath {
  width: 220px;
  height: 220px;
  margin: 12px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, var(--mind-soft) 55%, transparent 56%);
  position: relative;
}
.breath::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--mind);
  opacity: 0.35;
}
.breath.running::before {
  animation: breathe 8s ease-in-out infinite;
}
.breath b {
  font-size: 36px;
  font-variant-numeric: tabular-nums;
}
@keyframes breathe {
  50% {
    transform: scale(1.12);
    opacity: 0.7;
  }
}

/* Auth */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
}
.code-box {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 15px;
  word-break: break-all;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  user-select: all;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .shell {
    grid-template-columns: 76px minmax(0, 1fr);
    background: linear-gradient(90deg, var(--surface) 0 76px, var(--line) 76px 77px, transparent 77px);
  }
  .sidebar {
    padding: 20px 10px;
    align-items: center;
  }
  .brand span:not(.brand-mark),
  .nav-item span,
  .side-log span,
  .side-foot .btn span {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .today-top {
    grid-template-columns: 1fr;
  }
  .vitals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone */
@media (max-width: 720px) {
  .shell {
    display: block;
    background: none;
  }
  .sidebar {
    display: none;
  }
  .main {
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }
  h1 {
    font-size: 24px;
  }
  .card {
    padding: 16px;
  }
  .grid-2,
  .composer,
  .lib {
    grid-template-columns: 1fr;
  }
  .rings-card {
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 14px;
  }
  .rings-card svg {
    width: 124px;
    height: 124px;
  }
  .ring-item .val {
    font-size: 16px;
  }
  .vitals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .tile {
    padding: 12px 14px;
  }
  .tile .t-val {
    font-size: 20px;
  }
  .face span {
    width: 44px;
    height: 44px;
  }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    align-items: end;
  }
  .tabbar button {
    display: grid;
    justify-items: center;
    gap: 2px;
    border: 0;
    background: none;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    padding: 4px 0;
    cursor: pointer;
  }
  .tabbar button.active {
    color: var(--primary);
    font-weight: 600;
  }
  .tabbar .fab span.fab-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-ink);
    display: grid;
    place-items: center;
    margin-top: -24px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }
  .tabbar .fab .icon {
    width: 26px;
    height: 26px;
  }
  .overlay.sheet {
    place-items: end stretch;
    padding: 0;
  }
  .overlay.sheet .modal {
    width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 88vh;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: rise 0.2s ease-out;
  }
  .overlay.sheet .grab {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    justify-self: center;
  }
  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .lib.has-detail .lib-list-card {
    display: none;
  }
  .lib:not(.has-detail) .lib-detail {
    display: none;
  }
  .hide-phone {
    display: none !important;
  }
}
@media (min-width: 721px) {
  .show-phone {
    display: none !important;
  }
}
.btn.primary.danger-fill {
  background: var(--crit);
  border-color: var(--crit);
  color: var(--surface);
}
.field,
.field .input,
.field select {
  min-width: 0;
}
input[type='datetime-local'],
input[type='date'] {
  min-width: 0;
  max-width: 100%;
}
.tl-item > div,
.source-row > div,
.settings-item > span {
  min-width: 0;
}
.tl-item .meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .activity-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .activity-row .tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
/* Public pages (/about/, /privacy/) */
.public-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  display: grid;
  gap: 14px;
}
.public-page ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

/* ---------- 0.5: targets, sleep, favourites, videos, paging ---------- */
.progress {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--tone-soft, var(--surface-2));
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--tone, var(--primary));
}
.progress.done i {
  background: var(--ok);
}
.progress.over i {
  background: var(--crit);
}
.t-pct {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--tone);
}
.t-pct.done {
  color: var(--ok);
}
.t-pct.over {
  color: var(--crit);
}
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.food-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.food-grid .water-tile {
  grid-column: 1 / -1;
}
.goal-grid.food-grid > .tile:last-child:nth-child(odd) {
  grid-column: auto;
}
.goal-grid .tile,
.vitals .tile {
  gap: 6px;
}
.vitals.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ring-item .rest {
  grid-column: 2 / 4;
}
.water-tile {
  cursor: default;
}
.water-tile .actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}
.sleep-tile {
  width: 100%;
}
.mini-stages {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  gap: 2px;
}
.mini-stages i {
  display: block;
  height: 100%;
}
.hypno .s-W,
i.s-W,
.sw.s-W,
.range-fill.s-W {
  fill: var(--move);
  background: var(--move);
}
.hypno .s-R,
i.s-R,
.sw.s-R,
.range-fill.s-R {
  fill: var(--sleep);
  background: var(--sleep);
  opacity: 0.8;
}
.hypno .s-L,
.hypno .s-A,
.hypno .s-S,
i.s-L,
i.s-A,
.sw.s-L,
.range-fill.s-L {
  fill: var(--sleep);
  background: var(--sleep);
  opacity: 0.45;
}
.hypno .s-D,
i.s-D,
.sw.s-D,
.range-fill.s-D {
  fill: var(--sleep);
  background: var(--sleep);
  opacity: 1;
}
.hypno .oob,
.sw.oob {
  fill: var(--heart);
  background: var(--heart);
}
.sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
}
.sleep-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}
.stage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}
.stage-item {
  display: grid;
  gap: 6px;
}
.range-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.range-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--line);
}
.range-fill {
  position: absolute;
  left: 0;
  top: 3px;
  height: 6px;
  border-radius: 3px;
}
.zones {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--muted);
}
.zones i,
.zone-bar i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.z1 {
  background: var(--move);
}
.z2 {
  background: var(--heart);
  opacity: 0.75;
}
.z3 {
  background: var(--heart);
}
.zone-row {
  display: grid;
  grid-template-columns: 56px 1fr 40px;
  gap: 10px;
  align-items: center;
}
.zone-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}
.zone-bar i {
  height: 100%;
  width: auto;
  margin: 0;
  border-radius: 0;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-top: 12px;
}
.pager button {
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.pager button.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}
.pager span {
  margin-left: 8px;
}
.pick-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.pick-row .pick {
  flex: 1;
  min-width: 0;
}
.star.on,
.icon.filled {
  color: var(--move);
}
.icon.filled {
  fill: currentColor;
}
.fav-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.goal-set {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.warn-text {
  color: var(--warn);
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.video-card {
  display: grid;
  gap: 10px;
  align-content: start;
}
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.video-frame iframe,
.video-thumb,
.video-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}
.video-thumb {
  padding: 0;
  cursor: pointer;
  background: #000;
}
.video-thumb .play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: grid;
  place-items: center;
}
.video-thumb .play .icon {
  width: 28px;
  height: 28px;
  fill: currentColor;
}
.video-meta {
  display: grid;
  gap: 4px;
}
@media (max-width: 1024px) {
  .sleep-top {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .goal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .goal-grid > .tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .vitals.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vitals.three > .tile:last-child {
    grid-column: 1 / -1;
  }
  .stage-list {
    grid-template-columns: 1fr;
  }
  .water-tile {
    grid-column: 1 / -1;
  }
}
.big-axis .axis {
  font-size: 13px;
}
.range-band {
  background: var(--muted);
  opacity: 0.28;
}
.vitals.five {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.between,
.section-head {
  flex-wrap: wrap;
}

/* ---------- 0.6: insights, video strip ---------- */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.insight {
  display: grid;
  gap: 8px;
  align-content: start;
  border-left: 4px solid var(--tone, var(--primary));
}
.insight.lvl-attention,
.insight.lvl-care {
  border-left-color: var(--warn);
}
.insight.lvl-positive {
  border-left-color: var(--ok);
}
.insight .ask {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  color: var(--primary);
  font-weight: 500;
}
.insight .ask .icon {
  width: 16px;
  height: 16px;
  margin-top: 3px;
}
.insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.insight-actions .btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  white-space: normal;
  text-align: left;
}
.home-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}
.video-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.video-strip .video-meta .actions .btn.ghost {
  display: none;
}
@media (max-width: 1024px) {
  .home-bottom {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .insight-grid {
    grid-template-columns: 1fr;
  }
  .video-strip {
    grid-template-columns: 1fr;
  }
}

/* ---------- 0.7: expandable video ---------- */
.video-expand {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.video-expand:hover {
  background: rgba(0, 0, 0, 0.8);
}
.video-frame:fullscreen {
  border-radius: 0;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}
.video-frame:fullscreen .video-expand,
.video-frame.theater .video-expand {
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  right: 12px;
  width: 44px;
  height: 44px;
}
.video-frame.theater {
  position: fixed;
  inset: 0;
  z-index: 80;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}
.video-frame.theater iframe {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100%, calc(100vh * 16 / 9));
  height: auto;
  max-height: 100%;
  aspect-ratio: 16 / 9;
}
body.theater-open {
  overflow: hidden;
}

/* Session-only Bluetooth heart rate on Today and its detail screen. */
.live-hr-tile {
  border-color: var(--heart-soft);
}
.live-hr-heart {
  display: inline-block;
  color: var(--heart);
  font-size: 20px;
  line-height: 1;
  transform-origin: center;
}
.live-hr-heart.large {
  font-size: 72px;
  margin: 8px 0;
}
[data-heart-surface].is-live .live-hr-heart {
  animation: live-hr-beat 1.15s ease-in-out infinite;
}
@keyframes live-hr-beat {
  0%,
  100% {
    transform: scale(1);
  }
  18% {
    transform: scale(1.14);
  }
  37% {
    transform: scale(1);
  }
  56% {
    transform: scale(1.08);
  }
}
.live-hr-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: stretch;
}
.live-hr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 28px;
}
.live-hr-panel .pill {
  white-space: normal;
}
.live-hr-value {
  font-size: 58px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.live-hr-value small {
  font-size: 19px;
  font-weight: 500;
  color: var(--muted);
}
.live-hr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.live-hr-chart {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.live-hr-chart svg {
  width: 100%;
  height: auto;
}
.live-hr-chart svg text {
  fill: var(--muted);
  font-size: 13px;
}
.live-hr-chart #live-hr-chart {
  flex: 1;
}
.live-hr-period {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}
.live-hr-period button {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.live-hr-period button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.live-hr-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}
.live-hr-facts {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}
.live-hr-facts b {
  color: var(--heart);
}
@media (max-width: 760px) {
  .live-hr-grid {
    grid-template-columns: 1fr;
  }
  .live-hr-panel {
    padding: 22px;
  }
  .live-hr-value {
    font-size: 48px;
  }
  .live-hr-chart .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-heart-surface].is-live .live-hr-heart {
    animation: none;
  }
}

/* ---------- 0.8: Today pager, medical ---------- */
.top-pager {
  display: grid;
  gap: 10px;
  overflow: hidden;
}
.top-pages {
  display: flex;
  align-items: flex-start;
  transition: transform 0.25s ease-out;
  touch-action: pan-y;
  will-change: transform;
}
.top-page {
  flex: 0 0 100%;
  min-width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
.top-page.on,
.top-pages.sliding .top-page {
  height: auto;
  overflow: visible;
  visibility: visible;
}
.top-pager .rings-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.top-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-dots button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  background: var(--line);
  cursor: pointer;
  padding: 0;
}
.top-dots button.on {
  background: var(--primary);
  width: 22px;
  border-radius: 5px;
}
.top-dots span {
  margin-left: 4px;
}
.page2 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.page2 .readiness-tile {
  grid-column: 1 / -1;
}
.page2 .tile:not(.readiness-tile) {
  grid-column: span 2;
}
.page3-note {
  margin: 8px 0 0;
}
@media (max-width: 760px) {
  .page2 {
    grid-template-columns: 1fr 1fr;
  }
  .page2 .readiness-tile {
    grid-column: 1 / -1;
  }
  .page2 .tile:not(.readiness-tile) {
    grid-column: span 1;
  }
  .page2 .tile:not(.readiness-tile):last-child {
    grid-column: 1 / -1;
  }
}
.page2 .tile {
  padding: 12px 14px;
  gap: 4px;
}
.page3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}
.page3 .tile {
  padding: 10px 12px;
  gap: 2px;
}
.page3 .readiness-tile {
  grid-column: 1 / -1;
  padding: 14px;
}
.page3 .tile .t-val {
  font-size: 18px;
}
.gauge {
  width: 110px;
  flex: none;
}
.readiness-tile {
  text-align: left;
}
.dose-list {
  display: grid;
}
.dose-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.dose-row:last-child {
  border-bottom: 0;
}
.dose-row.taken b {
  color: var(--muted);
}
.dose-row .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}
.tl-item.done {
  opacity: 0.6;
}
label.chip input:checked + * {
  font-weight: 700;
}

@media (max-width: 720px) {
  .top-pager .rings-card {
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 14px;
  }
  .top-pager .rings-card svg {
    width: 124px;
    height: 124px;
  }
  .page3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dose-row {
    grid-template-columns: 48px 1fr;
  }
  .dose-row > .row {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
.tile > * {
  min-width: 0;
  max-width: 100%;
}
.tile .pill {
  white-space: normal;
  text-align: left;
  width: fit-content;
}
.tile .t-val {
  overflow-wrap: anywhere;
}

/* ---------- 0.9: gia đình, cồn, nước, chuông thông báo ---------- */
.page-head .actions {
  align-items: center;
}
.page-head .actions:empty {
  display: none;
}
.calendar-shortcut,
.bell {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
}
.bell.has-new {
  color: var(--ink);
}
.bell .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--crit);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: min(60vh, 520px);
  overflow: auto;
}
.notice-item button {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-left: 4px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.notice-item button > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.notice-item.new button {
  background: var(--primary-soft);
}
.notice-item.reminder button {
  border-left-color: var(--primary);
}
.notice-item.attention button {
  border-left-color: var(--warn);
}
.notice-item.care button {
  border-left-color: var(--crit);
}
.stack.indent {
  padding-left: 22px;
}
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.family-night-picker {
  overflow-x: auto;
  flex-wrap: nowrap;
  margin: 12px 0;
  padding-bottom: 4px;
}
.family-night-picker button {
  flex: none;
}
.member {
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
}
button.member:hover {
  border-color: var(--primary);
}
.member.has-alerts {
  border-color: var(--warn);
}
.member .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  flex: none;
}
.member .row > span:last-child {
  display: grid;
  min-width: 0;
}
.member .row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.facts.mini {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.facts.mini div {
  padding: 6px 8px;
}
.facts.mini dt {
  font-size: 11px;
}
.facts.mini dd {
  font-size: 14px;
}
.water-btns {
  flex-wrap: wrap;
  gap: 6px;
}
.water-btns .btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
.alcohol-tile {
  cursor: default;
}
.home-bottom.one {
  grid-template-columns: 1fr;
}
@media (max-width: 560px) {
  .member-grid {
    grid-template-columns: 1fr;
  }
}
details.ref-block > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
details.ref-block[open] > summary {
  margin-bottom: 10px;
}
details.ref-note {
  margin-top: 4px;
}
details.ref-note > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* ---- 0.9.4 Y tế: lịch tháng, tệp đính kèm, hồ sơ ---- */
.calendar-card .cal-head h2 {
  margin: 0;
}
.calendar {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}
.cal-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-labels span {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
}
.cal-day {
  min-height: 74px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 3px;
  cursor: pointer;
  min-width: 0;
}
.cal-day.outside {
  opacity: 0.45;
}
.cal-day.today .num {
  background: var(--primary);
  color: #fff;
}
.cal-day.on {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}
.cal-day .num {
  font-size: 13px;
  font-weight: 600;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
}
.cal-ev {
  font-size: 11px;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-ev.vaccine {
  background: var(--warn-bg);
}
.cal-ev.done {
  text-decoration: line-through;
  opacity: 0.6;
}
.cal-more {
  font-size: 11px;
  color: var(--muted);
}
.cal-detail {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.cal-detail h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
@media (max-width: 720px) {
  .cal-day {
    min-height: 54px;
    padding: 4px;
  }
  .cal-ev {
    font-size: 0;
    height: 6px;
    padding: 0;
    border-radius: 3px;
  }
  .cal-ev svg {
    display: none;
  }
}
.lab-group {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lab-form-group summary {
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}
.disease-grid .tile .t-val {
  font-size: 20px;
}
.attach-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}
.attach {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.attach-thumb {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 0;
  background: var(--surface-2);
  cursor: pointer;
}
.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-file {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  max-width: 260px;
}
.attach-file svg {
  grid-row: span 2;
}
.attach-file span {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-file small {
  font-size: 11px;
  color: var(--muted);
}
.attach-view {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
}
.attach-view.pdf {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
}
.file-btn {
  cursor: pointer;
  justify-self: start;
}
.safety {
  margin-bottom: 12px;
}
.safety .pill {
  margin: 2px 4px 2px 0;
}
.doctor-card .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  flex: none;
}
.doctor-card .row > span:last-child {
  display: grid;
  min-width: 0;
}
.notice-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.notice-item .notice-dose {
  width: auto;
  display: inline-flex;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  border-left: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}

/* ---- 0.9.4 family: relative's screens ---- */
.member-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.member-title .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  flex: none;
}
.member-banner {
  margin-bottom: 12px;
}
.member-medical .tile {
  min-width: 0;
}

/* Vùng nhịp tim tham khảo (0.9.7) */
.zone-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
}
.zone-pill.z-light {
  color: var(--ink);
}
.zone-pill.z-moderate {
  color: #1f6b58;
  background: color-mix(in srgb, #1f6b58 14%, var(--surface-2));
}
.zone-pill.z-vigorous {
  color: #b35c00;
  background: color-mix(in srgb, #ff9f1c 22%, var(--surface-2));
}
.zone-pill.z-peak {
  color: var(--heart);
  background: color-mix(in srgb, var(--heart) 18%, var(--surface-2));
}
.live-hr-chart .zone-line {
  stroke-dasharray: 4 5;
  stroke-width: 1.2;
}
.live-hr-chart .zone-line.z-vigorous,
.live-hr-chart .zone-label.z-vigorous {
  stroke: #ff9f1c;
  fill: #b35c00;
}
.live-hr-chart .zone-line.z-peak,
.live-hr-chart .zone-label.z-peak {
  stroke: var(--heart);
  fill: var(--heart);
}
.live-hr-chart .zone-label {
  font-size: 9px;
}
.live-hr-chart .live-hr-day {
  margin: 8px 0 4px;
  width: max-content;
}
.live-hr-chart .legend-row i.heart {
  background: var(--heart);
}
.live-hr-chart .legend-row i.muted {
  background: var(--muted);
}
.live-hr-panel.compact {
  margin-bottom: 12px;
}
.live-hr-panel.compact .live-hr-heart.large {
  font-size: 52px;
}

/* ---------- 0.9.8: video bài tập (nhà cung cấp, tìm kiếm, tệp trên máy) ---------- */
.video-frame.portrait {
  aspect-ratio: 9 / 16;
  width: min(100%, 290px);
  margin: 0 auto;
}
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.video-thumb.placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #1f6b58, #0e1614);
}
.video-thumb.placeholder .provider {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 12px;
  opacity: 0.85;
}
.video-thumb.placeholder.tiktok {
  background: linear-gradient(135deg, #111, #2a2a2a);
}
.video-thumb.placeholder.facebook {
  background: linear-gradient(135deg, #1b4f9c, #0b2a5a);
}
.video-thumb.placeholder.file {
  background: linear-gradient(135deg, #3b3f58, #15172a);
}
.video-search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}
.video-search .input {
  flex: 1;
}
.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.video-tags span,
.video-tags button {
  font-size: 11px;
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
}
.video-tags button:hover,
.video-tags button:focus-visible {
  background: color-mix(in srgb, #1f6b58 16%, var(--surface-2));
  color: #1f6b58;
}
.video-offline {
  font-size: 11px;
  color: #1f6b58;
}
.video-offline.missing {
  color: var(--muted);
}

/* 0.9.8b: thẻ video đều chiều cao, nút gọn hàng; form thêm video không tràn ở màn hẹp */
.video-grid {
  align-items: stretch;
}
.video-grid .video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 0 0 4px;
}
.video-grid .video-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.video-grid .video-meta > b {
  font-size: 16px;
  line-height: 1.3;
}
.video-grid .video-meta .actions {
  margin-top: auto;
  padding-top: 6px;
  gap: 8px;
}
.video-meta .actions .btn {
  margin: 0;
  white-space: nowrap;
}
.video-meta .actions .btn.ghost {
  padding-left: 10px;
  padding-right: 10px;
}
#video-form .form-grid > .field,
#video-form .form-grid .input,
#video-form .form-grid select {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
#video-form .seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
#video-form .seg .check {
  margin: 0;
}
@media (max-width: 560px) {
  #video-form .form-grid {
    grid-template-columns: 1fr;
  }
  .video-grid .video-meta > b {
    font-size: 15px;
  }
}
.modal .recent {
  align-items: center;
}
.modal .recent > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.video-grid .video-meta .actions .btn {
  flex: 1 1 100%;
  justify-content: center;
}
.video-grid .video-meta .actions .btn.ghost {
  border: 1px solid var(--line);
}
/* Hộp thoại không bị nội dung dài đẩy rộng quá màn hình (các dòng .recent vốn không xuống dòng) */
.modal {
  overflow-x: hidden;
}
.modal > * {
  min-width: 0;
}
.modal .recent > span:first-child,
.modal .recent > span:first-child span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.modal .recent .icon-btn {
  flex: 0 0 auto;
}

/* Thẻ video: tên video của bạn là nút mở màn sửa; dải video ở Hôm nay cũng cao đều */
.video-title-btn {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.video-title-btn b {
  font-size: 16px;
  line-height: 1.3;
}
.video-title-btn .icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  color: var(--muted);
}
.video-title-btn:hover b,
.video-title-btn:focus-visible b {
  color: var(--accent, #1f6b58);
  text-decoration: underline;
}
.video-strip .video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.video-strip .video-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.video-strip .video-meta .actions {
  margin-top: auto;
  padding-top: 6px;
}
.video-strip .video-meta .actions .btn {
  flex: 1 1 100%;
  justify-content: center;
}
.recent-btn {
  width: 100%;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.recent-btn:hover,
.recent-btn:focus-visible {
  background: var(--surface-3, #e3ebe7);
}
.recent-btn .icon {
  flex: 0 0 auto;
  color: var(--muted);
}
.btn.ghost.danger {
  color: var(--crit);
}

/* ---------- 0.10: Giao diện Đơn giản ---------- */
.simple-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.simple-switch > div {
  flex: 1 1 260px;
  display: grid;
  gap: 2px;
}
.seg-opt {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.seg-opt:has(input:checked) {
  background: var(--surface);
  box-shadow: var(--shadow);
}
.simple-shell {
  --s-primary: #1f6b58;
  --s-primary-soft: #d9ebe4;
  --s-water: #1d5fa3;
  --s-water-soft: #eef4fb;
  --s-heart: #b3261e;
  --s-pill: #5b3fa6;
  --s-pill-soft: #efeaf9;
  --s-ink: #15201c;
  --s-sub: #3a4f48;
  --s-line: #d5e3de;
  --s-bg: #ffffff;
  --s-bg2: #f4f9f7;
  --s-warn: #c77d00;
  --s-warn-bg: #fff7e6;
  --s-warn-ink: #5e3d00;
  --s-ok: #1d6b3f;
  --s-ok-bg: #dcf1e3;
  --s-ok-ink: #14532d;
  --s-crit-bg: #fbe4e2;
  --s-crit-ink: #7a1b15;
  --s-font: 20px;
  --s-num: 44px;
  --s-btn: 64px;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--s-bg);
  color: var(--s-ink);
  font-size: var(--s-font);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
}
.simple-shell.font-vua {
  --s-font: 18px;
  --s-num: 38px;
  --s-btn: 58px;
}
.simple-shell.font-rat-to {
  --s-font: 23px;
  --s-num: 52px;
  --s-btn: 72px;
}
:root[data-theme='dark'] .simple-shell {
  --s-ink: #f2f6f4;
  --s-sub: #c4d2cd;
  --s-line: #3a4a45;
  --s-bg: #0e1614;
  --s-bg2: #16211e;
  --s-primary-soft: #1f3b33;
  --s-water-soft: #16283d;
  --s-pill-soft: #26203f;
  --s-warn-bg: #3a2a08;
  --s-warn-ink: #ffd98a;
  --s-ok-bg: #143321;
  --s-ok-ink: #a9e5bf;
  --s-crit-bg: #3d1512;
  --s-crit-ink: #ffb3ad;
}
.simple-shell * {
  box-sizing: border-box;
}
.simple-shell button,
.simple-shell input {
  font-family: inherit;
}
.s-head {
  padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
  background: var(--s-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}
.s-head.s-water {
  background: var(--s-water);
}
.s-head.s-heart {
  background: var(--s-heart);
}
.s-head.s-pill,
.s-head.s-sleep {
  background: var(--s-pill);
}
.s-head > div {
  flex: 1 1 auto;
  min-width: 0;
}
.s-head h1 {
  margin: 0;
  font-size: calc(var(--s-font) + 8px);
  font-weight: 800;
  line-height: 1.15;
}
.s-head p {
  margin: 2px 0 0;
  font-size: var(--s-font);
  opacity: 0.95;
}
.s-home-head {
  padding-top: calc(28px + env(safe-area-inset-top));
}
.s-back,
.s-speak {
  flex: none;
  min-width: 56px;
  height: 56px;
  padding: 0 12px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: var(--s-font);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  cursor: pointer;
}
.s-speak {
  width: 56px;
  padding: 0;
  border-radius: 28px;
}
.s-head .icon {
  width: 26px;
  height: 26px;
}
.s-main {
  flex: 1 1 auto;
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.s-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.s-grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.s-h2 {
  margin: 4px 0 0;
  font-size: calc(var(--s-font) + 2px);
  font-weight: 800;
}
.s-h3 {
  font-size: var(--s-font);
  font-weight: 800;
}
.s-name {
  font-size: calc(var(--s-font) - 1px);
  font-weight: 700;
  color: var(--s-sub);
}
.s-val {
  font-size: var(--s-num);
  font-weight: 800;
  line-height: 1;
  color: var(--s-ink);
  font-variant-numeric: tabular-nums;
}
.s-val small {
  font-size: 0.55em;
  font-weight: 700;
}
.s-val.ok {
  color: var(--s-primary);
}
.s-note {
  font-size: calc(var(--s-font) - 2px);
  font-weight: 500;
  color: var(--s-sub);
}
.s-note.ok {
  color: var(--s-primary);
  font-weight: 700;
}
.s-note.warn {
  color: var(--s-warn-ink);
  font-weight: 700;
}
.s-note.crit {
  color: var(--s-heart);
  font-weight: 700;
}
.s-note.center {
  text-align: center;
}
.s-stat,
.s-tile {
  border: 2px solid var(--s-line);
  border-radius: 20px;
  padding: 14px 16px;
  background: var(--s-bg2);
  color: var(--s-ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  min-width: 0;
}
.s-tile {
  cursor: pointer;
}
.s-tile:active {
  background: var(--s-primary-soft);
}
.s-bar {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: var(--s-line);
  overflow: hidden;
}
.s-bar i {
  display: block;
  height: 100%;
  background: var(--s-warn);
}
.s-notice {
  border: 3px solid var(--s-line);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--s-bg2);
}
.s-notice > div {
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.s-notice b {
  font-size: var(--s-font);
}
.s-notice span {
  font-size: calc(var(--s-font) - 2px);
}
.s-notice.warn {
  border-color: var(--s-warn);
  background: var(--s-warn-bg);
  color: var(--s-warn-ink);
}
.s-notice.ok {
  border-color: var(--s-ok);
  background: var(--s-ok-bg);
  color: var(--s-ok-ink);
}
.s-notice.crit {
  border-color: var(--s-heart);
  background: var(--s-crit-bg);
  color: var(--s-crit-ink);
}
.s-notice.info {
  border-color: var(--s-line);
}
.s-ic {
  flex: none;
  display: inline-flex;
}
.s-ic .icon,
.s-row > .icon {
  width: 36px;
  height: 36px;
}
.s-big {
  min-height: 120px;
  border: 0;
  border-radius: 22px;
  padding: 16px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  background: var(--s-primary);
}
.s-big .icon {
  width: 40px;
  height: 40px;
}
.s-big span {
  font-size: calc(var(--s-font) + 3px);
  font-weight: 800;
  line-height: 1.15;
  display: grid;
}
.s-big small {
  font-size: calc(var(--s-font) - 2px);
  font-weight: 500;
}
.s-big.t-water {
  background: var(--s-water);
}
.s-big.t-heart {
  background: var(--s-heart);
}
.s-big.t-pill {
  background: var(--s-pill);
}
.s-card {
  border: 2px solid var(--s-line);
  border-radius: 20px;
  padding: 14px 16px;
  background: var(--s-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.s-card.empty {
  align-items: center;
  text-align: center;
  background: var(--s-bg2);
}
.s-card.empty .icon {
  width: 44px;
  height: 44px;
  color: var(--s-sub);
}
.s-card.s-note {
  background: var(--s-bg2);
}
.s-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.s-row > div {
  flex: 1 1 auto;
  min-width: 0;
}
.s-right {
  text-align: right;
  align-items: flex-end;
}
.s-cal > .s-grid2 > div {
  display: grid;
  gap: 4px;
}
.s-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: var(--s-primary-soft);
  color: var(--s-primary);
  font-size: 24px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.s-btn {
  min-height: var(--s-btn);
  border-radius: 18px;
  border: 0;
  padding: 10px 16px;
  background: var(--s-primary);
  color: #fff;
  font-size: calc(var(--s-font) + 2px);
  font-weight: 800;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}
.s-btn .icon {
  width: 28px;
  height: 28px;
}
.s-btn.s-done {
  flex-direction: row;
  gap: 10px;
}
.s-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.s-btn small {
  font-size: calc(var(--s-font) - 3px);
  font-weight: 500;
}
.s-btn.outline {
  background: var(--s-bg);
  color: var(--s-primary);
  border: 3px solid var(--s-primary);
}
.s-btn.outline.water {
  color: var(--s-water);
  border-color: var(--s-water);
}
.s-btn.ghost {
  background: var(--s-bg);
  color: var(--s-sub);
  border: 2px solid var(--s-line);
  font-size: var(--s-font);
  font-weight: 700;
  flex-direction: row;
  gap: 8px;
}
.s-btn.s-small {
  width: auto;
  min-height: 56px;
  padding: 0 16px;
  font-size: var(--s-font);
  flex: none;
}
.s-btn.s-small.warn {
  background: var(--s-warn);
}
.s-foot {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--s-line);
  background: var(--s-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.s-foot.s-grid2 {
  display: grid;
}
.s-tabs {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 8px calc(12px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--s-line);
  background: var(--s-bg);
}
.s-tabs button {
  min-height: 72px;
  border: 0;
  border-radius: 18px;
  background: none;
  color: var(--s-ink);
  font-size: calc(var(--s-font) - 2px);
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.s-tabs button .icon {
  width: 30px;
  height: 30px;
}
.s-tabs button.on {
  background: var(--s-primary-soft);
  color: var(--s-primary);
  font-weight: 800;
}
.s-chips {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
}
.s-chips.s-wrap {
  display: flex;
  flex-wrap: wrap;
}
.s-chips button {
  min-height: 60px;
  border-radius: 16px;
  border: 2px solid var(--s-primary);
  background: var(--s-bg);
  color: var(--s-primary);
  font-size: calc(var(--s-font) - 1px);
  font-weight: 800;
  cursor: pointer;
  padding: 0 10px;
}
.s-chips button.on {
  background: var(--s-primary);
  color: #fff;
}
.s-portions button.on {
  background: var(--s-primary-soft);
  color: var(--s-ink);
  border-width: 3px;
}
.s-dash {
  min-height: 64px;
  border-radius: 18px;
  border: 3px dashed var(--s-water);
  background: var(--s-water-soft);
  color: var(--s-water);
  font-size: calc(var(--s-font) - 2px);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 0 8px;
}
.s-dash .icon {
  width: 28px;
  height: 28px;
}
.s-food {
  min-height: 112px;
  border-radius: 20px;
  border: 2px solid var(--s-line);
  background: var(--s-bg2);
  color: var(--s-ink);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}
.s-food.on {
  border: 3px solid var(--s-primary);
  background: var(--s-primary-soft);
}
.s-check {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: var(--s-bg);
  border: 2px solid var(--s-line);
  color: var(--s-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.s-food.on .s-check {
  background: var(--s-primary);
  border-color: var(--s-primary);
  color: #fff;
}
.s-food-name {
  font-size: calc(var(--s-font) + 1px);
  font-weight: 800;
  line-height: 1.15;
  display: grid;
}
.s-food-name small,
.s-item small {
  font-size: calc(var(--s-font) - 3px);
  font-weight: 500;
  color: var(--s-sub);
}
.s-field {
  display: grid;
  gap: 8px;
}
.s-field > span:first-child {
  font-size: calc(var(--s-font) - 1px);
  font-weight: 700;
  color: var(--s-sub);
}
.s-input {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 3px solid var(--s-primary);
  border-radius: 20px;
  padding: 0 14px;
  background: var(--s-bg);
}
.s-input .icon {
  width: 28px;
  height: 28px;
  color: var(--s-primary);
}
.s-input {
  min-width: 0;
}
.s-input input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 66px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--s-ink);
  font-size: calc(var(--s-font) + 5px);
  font-weight: 700;
}
.s-clear {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 0;
  background: var(--s-line);
  color: var(--s-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.s-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.s-item {
  min-height: 76px;
  border-radius: 18px;
  border: 2px solid var(--s-line);
  background: var(--s-bg);
  color: var(--s-ink);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.s-item.static {
  cursor: default;
}
.s-item > span:not(.s-avatar):not(.s-call) {
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.s-item b {
  font-size: calc(var(--s-font) + 1px);
  font-weight: 800;
}
.s-item > .icon {
  width: 26px;
  height: 26px;
  color: var(--s-sub);
}
.s-person.primary {
  border: 3px solid var(--s-primary);
  background: var(--s-bg2);
}
.s-call {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  border: 2px solid var(--s-primary);
  color: var(--s-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.s-person.primary .s-call {
  background: var(--s-primary);
  color: #fff;
}
.s-call .icon {
  width: 30px;
  height: 30px;
}
.s-sos {
  min-height: 110px;
  border-radius: 26px;
  background: var(--s-heart);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}
.s-sos.off {
  background: var(--s-bg2);
  color: var(--s-sub);
  border: 2px dashed var(--s-line);
}
.s-sos .icon {
  width: 48px;
  height: 48px;
  flex: none;
}
.s-sos span {
  display: grid;
  gap: 4px;
}
.s-sos b {
  font-size: calc(var(--s-font) + 6px);
  font-weight: 800;
  line-height: 1.1;
}
.s-sos small {
  font-size: calc(var(--s-font) - 2px);
  font-weight: 500;
}
.s-center {
  text-align: center;
  display: grid;
  gap: 6px;
  justify-items: center;
}
.s-huge {
  font-size: calc(var(--s-num) + 14px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.s-huge small {
  font-size: 0.5em;
  font-weight: 700;
}
.s-huge.water {
  color: var(--s-water);
}
.s-cups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 4px;
}
.s-cups span {
  height: 80px;
  border-radius: 14px 14px 20px 20px;
  background: var(--s-water-soft);
  border: 3px dashed #7fa4d1;
}
.s-cups span.full {
  background: var(--s-water);
  border: 3px solid var(--s-water);
}
.s-big-water {
  min-height: 140px;
  border-radius: 28px;
  border: 0;
  background: var(--s-water);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.s-big-water .icon {
  width: 52px;
  height: 52px;
}
.s-big-water span {
  font-size: calc(var(--s-font) + 8px);
  font-weight: 800;
}
.s-big-water small {
  font-size: calc(var(--s-font) - 1px);
  font-weight: 500;
}
.s-num {
  border-radius: 20px;
  border: 2px solid var(--s-line);
  background: var(--s-bg);
  color: var(--s-ink);
  padding: 10px 6px;
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: pointer;
}
.s-num.on {
  border: 4px solid var(--s-heart);
}
.s-digits {
  font-size: var(--s-num);
  font-weight: 800;
  line-height: 1;
  min-height: 1em;
  font-variant-numeric: tabular-nums;
}
.s-digits i {
  color: var(--s-line);
  font-style: normal;
}
.s-num small {
  font-size: calc(var(--s-font) - 4px);
  color: var(--s-sub);
}
.s-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.s-keys button {
  min-height: 70px;
  border-radius: 18px;
  border: 2px solid var(--s-line);
  background: var(--s-bg2);
  color: var(--s-ink);
  font-size: 32px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.s-keys button .icon {
  width: 34px;
  height: 34px;
}
.s-keys button.next {
  border-color: var(--s-primary);
  background: var(--s-primary-soft);
  color: var(--s-primary);
  font-size: var(--s-font);
}
.s-dose {
  border-radius: 22px;
  border: 2px solid var(--s-line);
  background: var(--s-bg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.s-dose .s-row {
  display: flex;
}
.s-dose .s-row > div {
  display: grid;
  gap: 2px;
}
.s-dose .s-ic {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--s-line);
  color: var(--s-sub);
  align-items: center;
  justify-content: center;
  flex: none;
}
.s-dose b {
  font-size: calc(var(--s-font) + 3px);
}
.s-dose.ok {
  border: 3px solid var(--s-ok);
  background: var(--s-ok-bg);
  color: var(--s-ok-ink);
}
.s-dose.ok .s-ic {
  background: var(--s-ok);
  color: #fff;
}
.s-dose.ok .s-name,
.s-dose.ok .s-note {
  color: var(--s-ok-ink);
}
.s-dose.warn {
  border: 4px solid var(--s-warn);
  background: var(--s-warn-bg);
}
.s-dose.warn .s-ic {
  background: var(--s-warn);
  color: #fff;
}
.s-dose.warn .s-name {
  color: var(--s-warn-ink);
}
.s-dose.muted {
  opacity: 0.7;
}
.s-dose-actions {
  grid-template-columns: 2fr 1fr;
}
.s-sleep-top {
  display: flex;
}
.s-sleep-top > div:first-child {
  display: grid;
  gap: 4px;
}
.s-ring {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 48px;
  border: 5px solid var(--s-ok);
  background: var(--s-ok-bg);
  color: var(--s-ok-ink);
  display: grid;
  place-content: center;
  justify-items: center;
  line-height: 1;
}
.s-ring b {
  font-size: 34px;
}
.s-ring span {
  font-size: 14px;
  font-weight: 700;
}
.s-ring.fair {
  border-color: var(--s-warn);
  background: var(--s-warn-bg);
  color: var(--s-warn-ink);
}
.s-ring.poor {
  border-color: var(--s-heart);
  background: var(--s-crit-bg);
  color: var(--s-crit-ink);
}
.s-stages {
  display: flex;
  height: 26px;
  border-radius: 13px;
  overflow: hidden;
}
.s-stages i {
  display: block;
  height: 100%;
}
.s-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: calc(var(--s-font) - 2px);
}
.s-legend i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: none;
}
.s-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  height: 120px;
}
.s-bars i {
  display: block;
  border-radius: 8px 8px 4px 4px;
  background: #b9a8ec;
  min-height: 4px;
}
.s-bars i.low {
  background: var(--s-warn);
}
.s-bars i.on {
  background: var(--s-pill);
}
.s-bars-x {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
  font-size: calc(var(--s-font) - 4px);
  font-weight: 700;
  color: var(--s-sub);
}
.s-bars-x .on {
  color: var(--s-pill);
}
@media (max-width: 400px) {
  .simple-shell {
    --s-num: 38px;
  }
  .s-grid3 {
    gap: 6px;
  }
}

/* Bài tập: filters, per-day records and compact manual composer. */
.workout-summary { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:16px; }
.workout-summary .big { font-size:28px; }
.workout-filters input, .workout-filters select, .workout-day input,
.workout-composer input, .workout-composer select, .workout-composer textarea { font-size:16px; min-width:0; }
.workout-time summary { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.workout-time .form-grid { margin-top:12px; }
.workout-composer .more > .form-grid { margin-top:12px; }
.workout-history-date { padding-top:16px; }
.workout-day .between { gap:12px; flex-wrap:wrap; }
.workout-day .field { max-width:100%; }
@media(max-width:480px) { .workout-day > .between { align-items:stretch; flex-direction:column; } .workout-summary .big { font-size:24px; } }

.workout-composer details.more > summary::before { content:'▸'; display:inline-block; margin-right:6px; }
.workout-composer details.more[open] > summary::before { transform:rotate(90deg); }
.workout-library { align-self:start; }
.workout-library > summary { cursor:pointer; font-weight:600; }
.workout-library[open] > summary { margin-bottom:16px; }

.workout-composer select, .workout-filters select { min-height:44px; width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); }
.workout-composer select, .workout-filters select {
  appearance:none; -webkit-appearance:none; padding-right:34px;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 17px) 50%,calc(100% - 12px) 50%; background-size:5px 5px; background-repeat:no-repeat;
}

/* Grouped trends and compact manual time. */
.trend-group { margin: 24px 0; }
.trend-group h3 { margin-bottom: 12px; }
.log-time .form-grid { margin-top: 12px; }
#log-form input, #log-form select, #log-form textarea, #medical-form input { font-size: 16px; }

/* Digestive journal: shared mobile form and one event history. */
#digestive-form input, #digestive-form select, #digestive-form textarea { font-size:16px; }
#digestive-form select { width:100%; min-height:44px; }
.digestive-symptoms { border:1px solid var(--line); border-radius:12px; padding:12px; min-width:0; }
.digestive-symptom-options { display:grid; gap:8px; margin-top:10px; }
.digestive-symptom-options .check { min-height:36px; }
.digestive-bowel[hidden] { display:none !important; }
.digestive-time .form-grid { margin-top:12px; }
.digestive-view .between { flex-wrap:wrap; }
.digestive-view .record .facts dd { overflow-wrap:anywhere; }

.digestive-guidance { border-left:3px solid var(--primary); padding-left:12px; }
.digestive-guidance-content { font-size:16px; line-height:1.55; overflow-wrap:anywhere; }
.digestive-guidance-content p { margin:12px 0; }
#digestive-form .form-grid { align-items:start; }
#digestive-form select {
  appearance:none; -webkit-appearance:none; padding-right:34px;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 17px) 50%,calc(100% - 12px) 50%; background-size:5px 5px; background-repeat:no-repeat;
}

/* BL-005/006: small visual marker with a full touch and keyboard target. */
.info-letter{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;color:var(--primary);cursor:pointer}.info-letter i{font-family:Georgia,serif;font-style:italic;font-size:16px}.info-letter:focus-visible,[data-heart-zone]:focus-visible{outline:2px solid var(--primary);outline-offset:2px}button[data-heart-zone]{min-height:44px;cursor:pointer;white-space:normal;text-align:center;font-family:inherit}#bristol-help{font-weight:normal;font-size:15px}#bristol-help li{margin:8px 0}

/* 0.15 article and nutrition summaries */
.article-card .video-meta{padding:18px;gap:10px}.article-preview{line-height:1.55;margin:0;overflow-wrap:anywhere}.article-body{line-height:1.7;overflow-wrap:anywhere;max-width:76ch}.video-article .video-frame{min-height:200px;margin:20px 0}.video-article video,.video-article iframe{width:100%;height:100%;min-height:200px}.nutrient-coverage{display:block;font-size:11px;color:var(--muted);font-weight:400}.nutrition-table th:first-child{min-width:130px}.nutrition-table td{min-width:90px}.facts .link-btn{font:inherit;text-align:left;min-height:36px}.facts .link-btn svg{width:14px;height:14px}

.facts > div:has(.readiness-metric){position:relative}
.readiness-metric::after{content:"";position:absolute;inset:0;border-radius:10px}
.readiness-metric:focus-visible::after{outline:2px solid currentColor;outline-offset:2px}
.nutrition-swipe{display:none}
@media(max-width:600px){.nutrition-swipe{display:block}}

/* 0.15.1: exercise previews and nutrition report controls */
.article-card > .video-frame{margin:0;min-width:0}.exercise-controls{display:flex;gap:8px;flex-wrap:wrap}.metric-tools{display:flex;align-items:center;gap:12px;justify-content:space-between;flex-wrap:wrap}.nutrition-report{line-height:1.65;overflow-wrap:anywhere}.nutrition-report h3{margin-top:20px}.nutrition-report .table th,.nutrition-report .table td{min-width:130px;overflow-wrap:normal}.nutrition-ai-tools{display:flex;gap:10px;flex-wrap:wrap;align-items:center}

/* Exercise actions stay next to the detail title, including narrow screens. */
.exercise-detail-head .page-head {grid-template-columns:minmax(0,1fr) auto auto}
.exercise-detail-head .page-head .page-tools {grid-column:2;grid-row:1;padding-top:30px}
.exercise-detail-head .page-head > .bell {grid-column:3}
.exercise-menu {position:relative}
.exercise-detail-tools {display:flex;align-items:center;gap:8px}
.exercise-visibility {display:grid;place-items:center;color:var(--muted);width:24px;height:32px;flex:none}
.exercise-visibility .icon {width:18px;height:18px}
.exercise-menu > summary {list-style:none;cursor:pointer;width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--line);border-radius:12px;font-size:26px}
.exercise-menu > summary::-webkit-details-marker {display:none}
.exercise-menu-items {position:absolute;right:0;top:48px;z-index:30;display:grid;min-width:168px;background:var(--surface);padding:8px;border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 24px #0002}
.exercise-menu-items .btn {justify-content:flex-start;white-space:nowrap}
.exercise-home .video-search {margin:14px 0 10px}
.exercise-home .chips {margin-bottom:14px}

/* Medical workspace: inherit shell, typography and theme tokens. */
.medical-context { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin:18px 0; }
.medical-context > .field { flex:1; min-width:200px; max-width:520px; }
.medical-context select, .medical-filter select, [name=medical-timeline-date],
#medical-document-form select, #medical-form select {
  appearance:none; -webkit-appearance:none; min-height:44px; padding-right:34px; color:var(--ink);
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 17px) 50%,calc(100% - 12px) 50%; background-size:5px 5px; background-repeat:no-repeat;
}
.medical-case-head { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.medical-case-head h2 { margin:6px 0; }
.medical-case-head .eyebrow { font-size:11px; letter-spacing:.12em; font-weight:700; opacity:.65; }
.medical-subviews { display:flex; width:fit-content; max-width:100%; }
.medical-subviews button { min-height:44px; white-space:normal; }
.medical-shortcuts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.medical-shortcut { display:flex; align-items:center; gap:10px; text-align:left; color:inherit; font:inherit; cursor:pointer; padding:16px; }
.medical-shortcut b { margin-left:auto; font-size:20px; }
.medical-document-title { flex:1; min-width:0; overflow-wrap:anywhere; }
.medical-document-title .link-btn { text-align:left; font-weight:600; }
.medical-document .kv { flex-wrap:wrap; }
.medical-document .between { gap:12px; }
.medical-document p { margin:10px 0; }
.medical-hash { display:block; overflow-wrap:anywhere; font-size:11px; }
.medical-links { border:0; padding:10px 0; display:grid; gap:8px; max-height:220px; overflow:auto; }
.medical-links legend { font-weight:600; }
.medical-note-links { padding:0 0 18px; }
#medical-document-review .actions { flex-wrap:wrap; }
#medical-document-form input[type=file] { max-width:100%; }
#medical-document-review [hidden], #medical-document-form[hidden] { display:none; }
.medical-filter .between { flex-wrap:wrap; gap:12px; }
@media(max-width:600px) {
 .medical-case-head { align-items:flex-start; flex-direction:column; }
 .medical-shortcuts { gap:6px; }
 .medical-shortcut { flex-direction:column; padding:12px 6px; text-align:center; font-size:12px; gap:6px; }
 .medical-shortcut b { margin:0; }.medical-shortcut > svg:last-child { display:none; }
 .medical-context { align-items:stretch; }.medical-context > .field { max-width:none; }
 .medical-subviews { width:100%; }.medical-subviews button { flex:1; padding:10px 8px; }
}

/* Medical content must shrink inside grid/flex items, including URLs and imported notes. */
.medical-view, .medical-view .card, .medical-view .record, .note-card,
.medical-document, .medical-lab-history { min-width:0; max-width:100%; overflow-wrap:anywhere; }
.medical-view .record, .note-card, .medical-document { grid-template-columns:minmax(0,1fr); }
.medical-view .record > *, .note-card > *, .medical-view .tl-item > div,
.medical-view .between > *, .medical-view .kv > *, .medical-links label,
.modal .facts > div, .modal .facts dd { min-width:0; max-width:100%; overflow-wrap:anywhere; }
.medical-view .link-btn, .note-card .link-btn, .medical-view .btn,
.medical-document .link-btn, .medical-lab-history .link-btn,
.medical-links label { white-space:normal; overflow-wrap:anywhere; text-align:left; }
.medical-view .tl-item .meta, .note-card .small { white-space:normal; }
.medical-view .tl-actions { flex-shrink:0; }
.medical-view .medical-note-links, .medical-timeline-links { flex-wrap:wrap; gap:8px; }
.medical-view .btn, .note-card .btn, .medical-timeline-links .btn { max-width:100%; }
.treatment-progress { padding:16px; border:1px solid var(--line); border-left:4px solid var(--primary); border-radius:14px; background:var(--bg); }
.treatment-progress > div { display:grid; gap:4px; margin:12px 0; }
.treatment-label { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:8px 0; }
.medical-lab-history .segmented { display:flex; flex-wrap:wrap; }
.medical-lab-history .segmented button { min-height:44px; }
.medical-lab-history table { width:100%; }
.medical-lab-history td { padding:10px 6px; overflow-wrap:anywhere; }
.lab-value { min-height:44px; text-align:left; }
#medical-document-filter input, #medical-document-form input,
#medical-form select, #medical-form textarea { font-size:16px; }
/* Prevent double-tap smart zoom on navigation, while preserving pinch zoom and scroll. */
.tabbar, .side-nav, .tabbar button, .side-nav button { touch-action:manipulation; }
@media(max-width:480px) {
  .medical-view .tl-item { flex-wrap:wrap; }
  .medical-view .tl-item > div:not(.tl-actions) { flex:1; }
  .medical-view .tl-actions { margin-left:auto; }
  .medical-timeline-links .btn { font-size:12px; padding:8px; }
}
.medical-view .tl-item { align-items:flex-start; }
#medical-note-search { display:flex; flex-wrap:wrap; gap:8px; align-items:end; margin:16px 0; }
#medical-note-search .field { flex:1; min-width:180px; }
#medical-note-search input { font-size:16px; }
.medical-view .lab-value { display:block; flex:1 1 220px; }
.medical-lab-history td:first-child { white-space:nowrap; font-size:12px; }
.medical-lab-history th { font-size:13px; }

.page-head > .home-shortcuts { grid-column:3; grid-row:1; display:flex; align-items:center; gap:8px; }
@media (max-width:720px) { .page-head > .home-shortcuts { grid-column:2; } }
@media (min-width:721px) { .medical-view > .chips[role=tablist] { flex-wrap:wrap; } }

.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.calendar-toolbar .field { margin: 0; }
.calendar-meal > div { min-width: 0; overflow-wrap: anywhere; }

.cal-day { touch-action: manipulation; }
.cal-ev.medication { background: color-mix(in srgb, var(--primary) 24%, var(--surface)); }
.medication-fields, .medication-record .kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.medication-fields .field, .medication-fields input, .medication-fields select {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.medication-fields .field { margin: 0; }
.medication-hours {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.medication-hours legend { margin-bottom: 6px; font-weight: 600; }
.med-time-slot { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.med-time-slot input { flex: 1; }
.med-time-slot:only-child [data-action="med-time-remove"] { visibility: hidden; }
.meds-toolbar { display: flex; align-items: center; gap: 12px; }
.meds-toolbar .btn { flex: none; }
.medication-record { overflow-wrap: anywhere; }
@media (max-width: 580px) {
  .medication-fields, .medication-record .kv { grid-template-columns: minmax(0, 1fr); }
  .meds-toolbar { flex-direction: column; align-items: start; }
}

.dose-row > div { min-width: 0; overflow-wrap: anywhere; }
.dose-row > div > .tiny { display: block; }
