:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
  --bg: #171510;
  --surface: #1d1a15;
  --surface-hover: #29251e;
  --text: #eee6d5;
  --muted: #c0b7a6;
  --subtle: #b4ab99;
  --border: #484136;
  --accent: #bcc995;
  --accent-strong: #3b442c;
  --button-text: #20251a;
  --focus: #d4dfaf;
  --error-bg: #462923;
  --error-text: #f5c5b7;
  --badge-bg: #303627;
  --green-bg: #697b43;
  --green-text: #f5f0df;
  --yellow-bg: #4e4029;
  --yellow-text: #efdcaa;
  --red-bg: #593127;
  --red-text: #f7c7b3;
  --shadow: none;
  --training: #d28361;
  --training-bg: #3f2b22;
  --serif: Georgia, "Times New Roman", serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4eee2;
  --surface: #faf7f0;
  --surface-hover: #e9e2d4;
  --text: #29261e;
  --muted: #635d4f;
  --subtle: #635d4f;
  --border: #c9c0ae;
  --accent: #536630;
  --accent-strong: #485b29;
  --button-text: #faf7f0;
  --focus: #536630;
  --error-bg: #fbe8e0;
  --error-text: #842e1c;
  --badge-bg: #e7ebd8;
  --green-bg: #dde7c6;
  --green-text: #35491e;
  --yellow-bg: #f8e9c7;
  --yellow-text: #725019;
  --red-bg: #f8e1d6;
  --red-text: #87341e;
  --shadow: none;
  --training: #9a4b2e;
  --training-bg: #f2e2d6;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f4eee2;
    --surface: #faf7f0;
    --surface-hover: #e9e2d4;
    --text: #29261e;
    --muted: #635d4f;
    --subtle: #635d4f;
    --border: #c9c0ae;
    --accent: #536630;
    --accent-strong: #485b29;
    --button-text: #faf7f0;
    --focus: #536630;
    --error-bg: #fbe8e0;
    --error-text: #842e1c;
    --badge-bg: #e7ebd8;
    --green-bg: #dde7c6;
    --green-text: #35491e;
    --yellow-bg: #f8e9c7;
    --yellow-text: #725019;
    --red-bg: #f8e1d6;
    --red-text: #87341e;
    --shadow: none;
  --training: #9a4b2e;
  --training-bg: #f2e2d6;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: .85rem max(1rem, calc((100% - 1120px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-size: 1.15rem; font-weight: 750; color: var(--accent); text-decoration: none; letter-spacing: -.03em; }
.topbar nav { display: flex; gap: .85rem; flex: 1; flex-wrap: wrap; }
.topbar nav a, .link-button { color: var(--text); text-decoration: none; font-size: .9rem; }
.topbar nav a:hover, .link-button:hover { color: var(--accent); text-decoration: underline; }
.topbar nav a[aria-current="page"] { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: .35em; }
.theme-control { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .83rem; }
.theme-control select { min-width: 5.6rem; font: inherit; padding: .35rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); }
.logout-form { margin-left: auto; }
.link-button { border: 0; background: none; cursor: pointer; padding: .4rem; }
.page { max-width: 1120px; margin: 1.4rem auto; padding: 0 1rem; min-height: calc(100vh - 170px); }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.045em; margin-bottom: .5rem; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.today-heading { margin-bottom: .45rem; }
.today-heading h1 { font-size: 2rem; margin: 0; }
.today-heading .eyebrow { margin-bottom: .25rem; }
.eyebrow { text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; font-weight: 700; color: var(--subtle); margin-bottom: .6rem; }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1.1rem 0; }
.daily-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: .7rem 0 .5rem; }
.card, .panel, .login-card, .empty-state, .filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.1rem; box-shadow: var(--shadow);
}
.card p:last-child, .panel p:last-child { margin-bottom: 0; }
.metric-card { min-width: 0; padding: .95rem; }
.metric-card .eyebrow { line-height: 1.25; min-height: 1.8em; margin-bottom: .3rem; }
.metric-card .muted { font-size: .85rem; line-height: 1.35; }
.metric { font-size: 2.25rem; font-weight: 750; letter-spacing: -.06em; margin: .3rem 0; line-height: 1.1; }
.metric span { font-size: 1rem; margin-left: .15rem; letter-spacing: 0; }
.metric.empty, .metric-pending { color: var(--subtle); }
.metric-card-pending .metric-pending { font-variant-numeric: tabular-nums; }
.metric-placeholder { font-size: 1.05rem; font-weight: 700; line-height: 1.2; margin: .55rem 0; }
.metric-detail { font-size: .85rem; font-weight: 650; margin: .4rem 0; }
.metric-caveat { font-size: .82rem; color: var(--muted); line-height: 1.35; margin: .6rem 0 0; }
.recovery-label { display: inline-block; border-radius: 999px; padding: .22rem .55rem; font-size: .78rem; font-weight: 700; }
.recovery-green { background: var(--green-bg); color: var(--green-text); }
.recovery-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.recovery-red { background: var(--red-bg); color: var(--red-text); }
.source-note { color: var(--muted); font-size: .85rem; margin: .65rem 0 1.2rem; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.section-heading h2 { margin-bottom: .35rem; }
.panel { margin: 1rem 0; }
.badge { font-size: .75rem; font-weight: 650; border: 1px solid var(--border); border-radius: 99px; color: var(--text); background: var(--badge-bg); padding: .35rem .65rem; white-space: nowrap; }
.entry-list, .exercise-list { padding-left: 1.2rem; }
.entry-list li { margin: .65rem 0; }
.entry-list span { margin-left: .5rem; }
.entry-list time, .workout-card time { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.filters { display: flex; align-items: end; gap: .8rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.filters label, .stack label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 600; }
.filters input, .stack input, .classification-form input, .classification-form select {
  font: inherit; padding: .65rem .7rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0;
}
.filters button, button, .button { font: inherit; }
.primary, .secondary, .button.secondary, .filters button, .classification-form button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1px solid var(--border); border-radius: 9px; padding: .6rem 1rem;
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer;
}
.primary { background: var(--accent); border-color: var(--accent); color: var(--button-text); font-weight: 700; }
.primary:hover { filter: brightness(.9); }
.secondary:hover, .button.secondary:hover, .filters button:hover, .classification-form button:hover { background: var(--surface-hover); }
.workout-card { margin: 1rem 0; }
.exercise-list li { padding: .25rem 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: .75rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notice { border-radius: 9px; padding: .8rem; background: var(--surface-hover); color: var(--text); }
.error { background: var(--error-bg); color: var(--error-text); }
.login-card { max-width: 440px; margin: 4rem auto; padding: 2rem; }
.stack { display: grid; gap: .75rem; }
.stack .primary { margin-top: .5rem; }
.site-footer { max-width: 1120px; margin: 0 auto; padding: 1.3rem 1rem 2rem; color: var(--muted); font-size: .82rem; }
.empty-state { margin: 1rem 0; }
.filters .check-label { display: flex; align-items: center; gap: .5rem; }
.filters input[type="checkbox"] { min-width: 0; width: 1rem; height: 1rem; }
.classification-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: .55rem; min-width: 560px; }
.classification-form label { display: grid; gap: .25rem; font-size: .8rem; }
.classification-form input, .classification-form select { padding: .45rem; }
.classification-form button { min-height: 38px; }
@media (max-width: 680px) {
  .topbar { gap: .5rem; padding: .65rem 1.25rem; }
  .topbar nav { order: 4; flex-basis: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
  .topbar nav a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: .35rem .2rem; border-radius: 8px; font-size: .8rem; text-align: center; }
  .topbar nav a[aria-current="page"] { background: var(--badge-bg); }
  .theme-control { margin-left: auto; }
  .theme-control select, .link-button { min-height: 44px; }
  .logout-form { margin-left: 0; }
  .page { margin-top: .9rem; padding-inline: 1.25rem; }
  .site-footer { padding-inline: 1.25rem; }
  .page-heading { align-items: start; flex-direction: column; }
  .daily-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .metric-card { padding: .7rem; }
  .metric-card .eyebrow { font-size: .64rem; min-height: 1.6em; }
  .metric { font-size: 1.85rem; }
  .metric span { font-size: .82rem; }
  .metric-card .muted { font-size: .85rem; }
  .login-card { margin: 2.5rem auto; padding: 1.4rem; }
  .section-heading { align-items: start; flex-direction: column; }
  .filters label, .filters input { width: 100%; }
  .filters button { width: 100%; }
  .classification-form button { min-height: 44px; }
}
/* Salud uses dated reading rows so long histories stay scannable. */
.health-heading { margin-bottom: .8rem; }
.health-periods { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .8rem; }
.period-links, .period-custom { display: flex; gap: .45rem; align-items: end; flex-wrap: wrap; }
.period-link { display: inline-flex; align-items: center; min-height: 44px; padding: .65rem .85rem; border-radius: 8px; color: var(--text); text-decoration: none; border: 1px solid var(--border); }
.period-link.selected { background: var(--accent); color: var(--button-text); border-color: var(--accent); font-weight: 700; }
.period-custom label { display: grid; gap: .25rem; color: var(--muted); font-size: .78rem; }
.period-custom input { font: inherit; padding: .55rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.period-custom button { min-height: 44px; padding: .55rem .8rem; background: var(--surface-hover); color: var(--text); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.health-body, .health-section { margin: 1.2rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.health-section-head { display: flex; align-items: start; justify-content: space-between; gap: 1.5rem; }
.health-section-head h2 { font-size: 1.45rem; margin: 0 0 .4rem; }
.health-section-head .eyebrow { margin-bottom: .25rem; }
.health-section-head .muted { font-size: .87rem; margin: 0 0 .8rem; }
.health-feature { display: grid; gap: .16rem; min-width: 11rem; text-align: right; }
.health-feature span, .health-feature time { color: var(--muted); font-size: .76rem; }
.health-feature strong { color: var(--accent); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.body-readings, .coverage-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: .6rem 0 0; }
.body-readings div, .coverage-list div { border-top: 1px solid var(--border); padding-top: .8rem; }
.body-readings dt, .coverage-list dt { color: var(--muted); font-size: .83rem; }
.body-readings dd, .coverage-list dd { margin: .3rem 0; font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.body-readings small { display: block; color: var(--muted); line-height: 1.4; }
.health-timeline { border-top: 1px solid var(--border); }
.health-reading { border-bottom: 1px solid var(--border); }
.health-reading summary { display: grid; grid-template-columns: minmax(8.5rem, 1fr) minmax(7rem, 1fr) minmax(8rem, 1fr) auto; gap: .8rem; align-items: center; cursor: pointer; padding: .88rem .25rem; list-style: none; }
.health-reading summary::-webkit-details-marker { display: none; }
.health-reading summary:hover { background: var(--surface-hover); }
.health-reading summary time { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.health-reading summary span { color: var(--muted); font-size: .8rem; }
.health-reading summary strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.health-reading summary .detail-action { color: var(--accent); text-align: right; }
.health-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; margin: 0; padding: .5rem .75rem 1rem; background: var(--bg); border-radius: 8px; }
.health-fields div { display: flex; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--border); padding: .45rem 0; font-size: .82rem; }
.health-fields dt { color: var(--muted); }
.health-fields dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 680px) {
  .health-section-head { display: block; }
  .health-feature { text-align: left; margin-bottom: .8rem; }
  .body-readings, .coverage-list { grid-template-columns: 1fr; gap: .5rem; }
  .health-reading summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .3rem .5rem; }
  .health-reading summary span:nth-child(2) { display: none; }
  .health-reading summary .detail-action { display: none; }
  .health-fields { grid-template-columns: 1fr; padding: .5rem; }
  .period-custom label { flex: 1 1 8rem; }
  .period-custom input { width: 100%; }
}

/* Neo Health: local system fonts, editorial hierarchy and quiet surfaces. */
body { line-height: 1.5; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(2.75rem, 6vw, 5rem); line-height: 1.06; }
h2 { font-size: 1.55rem; }
.eyebrow { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: .74rem; letter-spacing: .13em; font-weight: 600; }
.topbar { padding: 1.25rem max(1.5rem, calc((100% - 1480px) / 2)); background: var(--bg); gap: 1.4rem; }
.brand { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; color: var(--text); white-space: nowrap; }
.topbar nav { justify-content: center; gap: clamp(.5rem, 1.8vw, 1.5rem); }
.topbar nav a { font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; padding-block: .65rem; }
.topbar nav a[aria-current="page"] { color: var(--text); text-decoration-thickness: 2px; text-underline-offset: .8rem; }
.page { max-width: 1480px; margin: 2rem auto; padding: 0 1.5rem; }
.site-footer { max-width: 1480px; padding-inline: 1.5rem; border-top: 1px solid var(--border); }
.card, .panel, .login-card, .empty-state, .filters, .health-body, .health-section, .health-periods { border-radius: 3px; }
.primary, .secondary, .button.secondary, .filters button, input, select, textarea { border-radius: 4px; }
.today-heading { margin-bottom: 1.5rem; }
.today-heading h1 { font-size: clamp(5rem, 10vw, 9rem); line-height: .98; margin: .4rem 0 .8rem; }
.today-intro { font-family: var(--serif); font-style: italic; font-size: clamp(1.25rem, 2.7vw, 2rem); color: var(--muted); margin: 0; }
.daily-metrics { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 1.5rem; align-items: stretch; }
.recovery-hero { display: flex; flex-direction: column; align-items: start; justify-content: center; padding: clamp(1.5rem, 4vw, 3.5rem); }
.recovery-hero .eyebrow { order: 2; margin: 1rem 0; }
.recovery-hero .metric { font-family: var(--serif); font-weight: 400; font-size: clamp(6rem, 14vw, 14rem); letter-spacing: -.065em; line-height: 1; margin: 0; }
.recovery-hero .metric span { font-size: .55em; }
.recovery-hero .recovery-label { order: 3; font-size: 1rem; padding: .4rem 1rem; font-weight: 500; }
.recovery-hero .muted { order: 4; font-style: italic; margin-top: 2rem; }
.recovery-hero .metric-placeholder { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 5vw, 4rem); }
.today-readings { display: grid; gap: .6rem; min-width: 0; }
.today-readings .metric-card { display: grid; grid-template-columns: minmax(7rem, .6fr) minmax(0, 1fr); gap: .25rem 1rem; padding: 1rem 1.25rem; }
.today-readings .eyebrow { grid-column: 1; grid-row: 1 / span 3; font-family: var(--serif); font-size: 1.65rem; text-transform: none; letter-spacing: -.03em; color: var(--text); font-weight: 400; margin: 0; align-self: center; }
.today-readings .metric { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; margin: 0; }
.today-readings .metric-detail, .today-readings .muted, .today-readings .metric-caveat { grid-column: 2; margin: 0; font-size: .84rem; line-height: 1.4; }
.today-readings .metric-placeholder { grid-column: 2; }
.training-ticket { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; padding: 1.2rem 1.5rem; border: 1px solid var(--border); border-left: 1rem solid var(--training); border-radius: 3px; background: var(--surface); min-width: 0; }
.training-ticket h2 { font-size: 1.45rem; margin-bottom: .25rem; overflow-wrap: anywhere; }
.training-ticket .eyebrow { color: var(--training); margin-bottom: .25rem; }
.training-ticket p:last-child { margin: 0; font-size: .85rem; }
.training-ticket a { color: var(--training); font-size: .85rem; flex: none; }
.privacy-page { max-width: 55rem; margin-inline: auto; }
@media (max-width: 1050px) {
  .topbar nav { order: 4; flex-basis: 100%; justify-content: space-between; }
  .theme-control { margin-left: auto; }
}
@media (max-width: 680px) {
  .topbar { padding: .8rem 1.25rem; gap: .6rem; }
  .brand { font-size: 1.8rem; }
  .topbar nav { gap: .3rem; }
  .topbar nav a { text-transform: none; font-size: .8rem; letter-spacing: 0; padding-inline: .1rem; }
  .page { padding-inline: 1.25rem; margin-top: 1.5rem; }
  .daily-metrics { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .recovery-hero { padding: 1.5rem; }
  .recovery-hero .metric { font-size: clamp(6rem, 28vw, 9rem); }
  .recovery-hero .muted { margin-top: 1.25rem; }
  .today-readings .metric-card { grid-template-columns: minmax(5rem, .55fr) minmax(0, 1fr); gap: .3rem .8rem; padding: 1rem; }
  .today-readings .eyebrow { font-size: 1.3rem; }
  .today-readings .metric { font-size: 1.8rem; }
  .training-ticket { align-items: start; flex-direction: column; padding: 1rem; border-left-width: .6rem; }
}
