/* Daily health journal. Loaded after the existing chart and data components. */
:root {
  --ink: #243750;
  --muted: #596b83;
  --soft-muted: #64758b;
  --canvas: #edf2f8;
  --paper: #ffffff;
  --line: #dbe3ee;
  --teal: #3562ce;
  --teal-deep: #294fa9;
  --teal-soft: #e5edfd;
  --teal-pale: #f1f5fe;
  --coral: #bd4a5b;
  --coral-soft: #fae9ed;
  --violet: #7864ad;
  --shadow: none;
  --radius: 24px;
  font-family: "PingFang SC", "Microsoft YaHei", "DengXian", sans-serif;
  font-size: 15px;
}

body { background: var(--canvas); line-height: 1.6; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid #3562ce;
  outline-offset: 3px;
}
.ui-icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { width: min(100%, 1320px); padding: 0 40px 30px; }
.topbar { min-height: 104px; border-bottom: 1px solid var(--line); }
.brand-lockup { gap: 13px; }
.brand-mark { width: 46px; height: 46px; border-radius: 15px; background: var(--ink); box-shadow: none; transform: none; }
.brand-mark svg { width: 34px; height: 34px; }
.brand-lockup h1 { font-size: 21px; font-weight: 700; letter-spacing: .015em; }
.brand-caption { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.icon-button { min-height: 44px; border-radius: 10px; background: transparent; color: var(--ink); gap: 9px; }
.main-content { grid-template-columns: 156px minmax(0, 1fr); align-items: start; gap: 26px 28px; }
.backup-banner { grid-column: 1 / -1; margin-top: 20px; }
.backup-banner .text-button { flex-shrink: 0; white-space: nowrap; padding-inline: 8px; }
.intro-row { grid-column: 1 / -1; padding: 18px 0 0; align-items: center; gap: 10px; }
.intro-row > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
.day-label { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.intro-row h2 { max-width: none; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.6; letter-spacing: 0; }
.intro-copy { display: block; margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.privacy-pill { padding: 0; color: var(--muted); background: none; border: none; border-radius: 0; font-size: 12px; font-weight: 500; }
.status-dot { background: #328570; width: 6px; height: 6px; box-shadow: none; }
.page-nav { position: sticky; top: 24px; grid-template-columns: 1fr; gap: 8px; padding: 0; border: none; background: none; border-radius: 0; }
.page-tab { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 18px; font-size: 15px; font-weight: 600; border-radius: 12px; text-align: left; }
.page-tab.is-active { color: var(--teal-deep); background: #dce7fb; box-shadow: none; }
.page-tab:hover { background: #e2eaf6; }
.page-view { grid-column: 2; grid-row: auto; }
.dashboard-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 24px; align-items: start; }
.card { background: var(--paper); padding: 28px; border: none; border-radius: var(--radius); box-shadow: none; }
.card::after { content: none; }
.card-header { margin-bottom: 24px; gap: 12px; }
.card h3 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.card-description { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.today-card { background: var(--paper); border-radius: var(--radius); }
.eyebrow, .card-index { display: none; }
.field, .weight-field { color: var(--ink); font-size: 13px; font-weight: 600; gap: 8px; }
.field small, .weight-field small { font-size: 11px; color: var(--muted); }
.field-grid { gap: 14px; }
.field input, .field textarea, .small-input-wrap input { min-height: 46px; border-radius: 10px; border-color: var(--line); background: #f8fafd; font-size: 15px; font-weight: 500; }
.field input[type="date"] { min-height: 46px; font-size: 14px; padding-left: 12px; }
.field input:focus, .field textarea:focus, .weight-input-wrap input:focus, .small-input-wrap input:focus { border-color: #3562ce; box-shadow: 0 0 0 3px #e5edfd; }
.field textarea { resize: vertical; min-height: 66px; }
.segmented-control { min-height: 46px; border-radius: 10px; background: #f0f3f8; border: none; }
.segment { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; min-height: 40px; border-radius: 8px; }
.segment.is-active { color: var(--teal-deep); box-shadow: 0 1px 4px #24375012; }
.period-icon { width: 17px; height: 17px; }
.weight-field { margin: 26px 0 20px; }
.weight-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.weight-label-row small { font-weight: 400; }
.weight-input-wrap { display: flex; align-items: center; gap: 14px; border: 1px solid #d4def0; border-radius: 15px; padding: 10px 18px; background: #f3f6fc; transition: border-color 160ms ease, box-shadow 160ms ease; }
.weight-input-wrap:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px #e5edfd; background: #f7faff; }
.weight-input-wrap input { height: 72px; padding: 0; border: none; border-radius: 0; background: transparent; font-family: "Bahnschrift", "DIN Alternate", "Arial", sans-serif; font-size: 48px; font-weight: 500; color: var(--ink); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.weight-input-wrap input::placeholder { color: #94a3bb; opacity: 1; }
.weight-input-wrap input:focus { border: none; background: transparent; box-shadow: none; outline: none; }
.weight-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; }
.weight-input-wrap b { position: static; transform: none; flex: 0 0 auto; padding: 5px 10px; border-radius: 8px; background: #e4ebf8; color: #4a6085; font-size: 16px; font-weight: 600; }
.weight-unit-hint { font-weight: 400; }
.form-hint { font-size: 11px; margin-top: 14px; }
.form-actions { gap: 12px; }
.primary-button, .secondary-button, .text-button { min-height: 46px; font-size: 13px; font-weight: 600; border-radius: 10px; gap: 8px; }
.primary-button { background: var(--teal); box-shadow: none; padding: 0 24px; }
.primary-button:hover { background: var(--teal-deep); }
.secondary-button { color: var(--ink); background: #f4f7fb; border-color: var(--line); }
.secondary-button:hover { background: #e5edfd; }
.form-actions .primary-button { flex: 1; }
.text-button { color: var(--teal-deep); }
.icon-button:hover, .primary-button:hover, .secondary-button:hover, .text-button:hover { transform: none; }
.form-error { font-size: 12px; }
.form-error:empty { margin: 0; min-height: 0; }
.health-sync-actions { margin-top: 16px; }
#healthSyncButton { width: 100%; background: transparent; border-color: #cfdbee; color: var(--teal-deep); }
#healthSyncButton:not(:disabled):hover { background: var(--teal-pale); }
.previous-day-summary { margin-top: 24px; padding-top: 20px; border-top-color: var(--line); }
.previous-day-summary-header h4 { font-size: 14px; }
.previous-day-date { font-size: 11px; }
.previous-day-record { background: #f6f8fc; padding: 13px; border-radius: 10px; }
.previous-day-record-label { font-size: 12px; }
.previous-day-record-value { font-size: 23px; font-variant-numeric: tabular-nums; }
.previous-day-change { font-size: 11px; }
.today-content { gap: 20px; }
.today-card .card-header { margin-bottom: 18px; }
.today-card .today-pulse { padding: 0; border: none; }
.today-card .today-content { gap: 20px; }
.today-card .today-metric-label { margin-bottom: 4px; color: #465a73; font-size: 14px; }
.today-card .today-number { font-size: 46px; letter-spacing: -.025em; }
.today-card .today-date { color: #465a73; font-size: 13px; }
.overview-metrics { display: grid; gap: 6px; }
.today-card .overview-result-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); align-items: baseline; min-height: 32px; gap: 4px 16px; color: #465a73; font-size: 14px; line-height: 1.6; }
.today-card .overview-result-row > strong, .today-card .overview-value { margin-left: 0; color: var(--ink); font-size: 16px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.today-card .overview-value { display: flex; justify-content: flex-end; align-items: baseline; flex-wrap: wrap; gap: 0 5px; }
.today-card .overview-value strong { font-size: inherit; font-weight: inherit; }
.today-card .overview-value small { color: #465a73; font-size: 14px; font-weight: 400; }
.today-card .overview-result-row > .status-badge { grid-column: 2; justify-self: end; padding: 0; min-height: 0; background: none; border: none; font-size: 13px; }
.today-card .overview-details { border: none; font-size: 14px; }
.today-card .overview-details-body { padding: 8px 0 0; border-radius: 0; background: none; }
.today-card .overview-details-body dt, .today-card .overview-details-body p { color: #465a73; }
.today-card .overview-details-body p { font-size: 13px; }
.today-card .overview-stale-note { padding: 0; border-radius: 0; background: none; font-size: 13px; }
.today-card .card-header { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.display-unit-control { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; flex-shrink: 0; }
.display-unit-control button { min-width: 42px; min-height: 40px; padding: 0 9px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.display-unit-control button[aria-pressed="true"] { background: var(--teal-soft); color: var(--teal-deep); }
.overview-reading { display: grid; gap: 2px; text-align: right; }
.overview-reading strong { color: var(--ink); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.overview-reading small { color: #465a73; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.entry-context { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.entry-context summary { display: list-item; min-height: 44px; line-height: 44px; cursor: pointer; color: var(--teal-deep); }
.entry-context summary span { margin-left: 8px; color: var(--muted); font-size: 12px; }
.entry-context-body { padding: 8px 0; }
.entry-context-body > p { margin: 10px 0 0; font-size: 12px; line-height: 1.7; }
.event-options { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 14px 0 0; border: none; }
.event-options legend { padding: 0; margin-bottom: 4px; color: var(--ink); font-weight: 600; }
.event-options label { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.event-options label[hidden] { display: none; }
.event-options input { width: 17px; height: 17px; accent-color: var(--teal); }
.history-context { grid-column: 2 / -1; margin-top: -2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.chart-data-note, .chart-events-hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; line-height: 1.7; }
.chart-events-hint { margin-top: 8px; }
.analysis-insights { margin: 24px 0; }
.analysis-insights h4 { margin: 0 0 12px; color: var(--ink); font-size: 16px; }
.analysis-insights dl, .stage-review-dl { margin: 0; }
.analysis-insights dl > div, .stage-review-dl > div { display: flex; justify-content: space-between; gap: 14px; margin: 8px 0; font-size: 14px; }
.analysis-insights dt, .stage-review-dl dt { color: var(--muted); }
.analysis-insights dd, .stage-review-dl dd { margin: 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.analysis-insights dd small { display: block; font-size: 12px; color: var(--muted); }
.analysis-insights > p, .stage-review-copy { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 10px 0 0; }
.overview-details.stage-review-details { border: none; margin: 16px 0 24px; }
.stage-review-details .overview-details-body { padding: 8px 0; background: none; }
.legend-bar.high { background: #7864ad; }
.legend-bar.normal { background: #328570; }
.today-card .status-badge.high { color: #7864ad; }
.today-card .status-badge.low { color: #3975b5; }
.trend-speed-summary { margin: 24px 0; }
.trend-speed-summary h4 { font-size: 16px; margin: 0 0 10px; color: var(--ink); }
.analysis-main-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: 21px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.analysis-main-value small { font-size: 14px; font-weight: 400; }
.analysis-insights .overview-details, .trend-speed-summary .overview-details { border: none; margin-top: 8px; }
.comparison-details dd small { display: block; font-size: 12px; color: var(--muted); }
.range-select-label { display: grid; gap: 3px; }
.chart-range-caption { font-size: 12px; color: var(--muted); }
.day-events-copy { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.overview-details.forecast-details, .overview-details.delta-analysis-details { border: none; margin: 10px 0; }
.delta-analysis-details .delta-chart-section { margin: 8px 0; padding-top: 0; border: none; }
#overnightStatus { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
#overnightStatus h4 { margin: 0 0 5px; color: var(--ink); font-size: 15px; }
#overnightStatus p { margin: 0; line-height: 1.8; }
.calendar-stat .monthly-change { font-size: 16px; flex-wrap: wrap; text-align: right; overflow-wrap: anywhere; }
.month-count-details { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.month-count-details summary { cursor: pointer; min-height: 44px; line-height: 44px; }
.month-count-details p { line-height: 1.8; margin: 0; }
.month-latest { margin-top: 8px; }
.calendar-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.calendar-stats .calendar-stat { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 6px 0; }
.calendar-stats .calendar-stat strong { margin-left: 0; text-align: left; }
.calendar-stats > p { grid-column: 1 / -1; margin: 0; }
.overview-direction-note { color: #465a73; font-size: 13px; line-height: 1.7; }
.today-card .overview-result-row > .overview-reading { min-width: 0; }
.today-metric-label { margin-bottom: 9px; font-size: 13px; color: var(--muted); }
.overview-result-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 36px; color: var(--muted); font-size: 13px; }
.overview-result-row > strong { margin-left: auto; color: var(--ink); font-weight: 600; text-align: right; }
.overview-pace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 20px 0; border-block: 1px solid #cad6e8; }
.overview-pace > span { font-size: 13px; color: var(--muted); }
.overview-pace > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.overview-pace strong { color: var(--ink); font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.overview-pace small { color: var(--muted); font-size: 12px; }
.overview-details { border-top: 1px solid #cad6e8; font-size: 13px; }
.overview-details summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; color: var(--teal-deep); cursor: pointer; list-style: none; }
.overview-details summary::-webkit-details-marker { display: none; }
.overview-details summary .ui-icon { width: 18px; height: 18px; }
.overview-details[open] summary .ui-icon { transform: rotate(180deg); }
.overview-details-body { padding: 12px 14px; border-radius: 10px; background: #ffffff70; }
.overview-details-body dl { margin: 0; }
.overview-details-body dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.overview-details-body dt { color: var(--muted); }
.overview-details-body dd { margin: 0; color: var(--ink); text-align: right; }
.overview-details-body p { margin: 12px 0 0; font-size: 12px; line-height: 1.8; color: var(--muted); }
.overview-stale-note { padding: 9px 12px; border-radius: 8px; font-size: 12px; color: #805313; background: #fff3d8; }
.weekly-comparison { font-size: 13px; line-height: 1.8; }
.stale-note { color: #8b5915; font-size: 12px; }
.analysis-data-status { grid-column: 1 / -1; padding: 12px 14px; color: var(--muted); background: #f3f6fc; border-radius: 10px; font-size: 12px; line-height: 1.8; }
.analysis-data-status.is-stale { background: #fff3d8; color: #805313; }
.stage-mode-control { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: min(100%, 360px); padding: 4px; border-radius: 11px; background: #edf1f7; }
.stage-mode-button { min-height: 44px; padding: 8px 12px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.stage-mode-button.is-active { color: var(--teal-deep); background: #fff; box-shadow: 0 1px 4px #24375012; font-weight: 600; }
.stage-mode-button:not(.is-active):hover { background: #e1e8f3; }
.field select { min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #f8fafd; font-size: 14px; }
.stage-help, .stage-history-empty { font-size: 12px; color: var(--muted); line-height: 1.8; }
.stage-help { margin: 12px 0 18px; }
.stage-history-section { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 24px; }
.stage-history-section h4 { margin: 0; font-size: 19px; }
#stageHistoryList { display: grid; gap: 16px; }
.stage-history-item { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #f8fafd; }
.stage-history-item summary { display: block; padding: 18px 20px 0; cursor: pointer; list-style: none; }
.stage-history-item summary::-webkit-details-marker { display: none; }
.stage-history-meta-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.stage-history-reason { color: var(--ink); font-weight: 600; }
.stage-history-period { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-top: 12px; color: var(--ink); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stage-history-date-separator { color: var(--muted); font-weight: 400; }
.stage-history-weights { display: grid; grid-template-columns: 1fr 1fr; margin: 20px 0 16px; gap: 20px; }
.stage-history-weights > span + span { padding-left: 20px; border-left: 1px solid var(--line); }
.stage-history-field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stage-history-weights strong { color: var(--ink); font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stage-history-weights small { font-size: 13px; color: var(--muted); font-weight: 400; }
.stage-history-progress-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.stage-history-progress-row > strong { margin-left: auto; color: var(--ink); font-size: 15px; font-weight: 650; }
.stage-history-result { color: #216450; font-size: 12px; }
.stage-history-progress-track { display: block; height: 6px; overflow: hidden; border-radius: 6px; background: #dce4f0; margin-top: 10px; }
.stage-history-progress-track > span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.stage-history-disclosure { display: flex; align-items: center; justify-content: space-between; min-height: 46px; margin-top: 12px; border-top: 1px solid var(--line); color: var(--teal-deep); font-size: 13px; }
.stage-history-disclosure .ui-icon { width: 18px; height: 18px; }
.stage-history-hide, .stage-history-fold[open] .stage-history-show { display: none; }
.stage-history-fold[open] .stage-history-hide { display: inline; }
.stage-history-fold[open] .stage-history-disclosure .ui-icon { transform: rotate(180deg); }
.stage-history-actions { display: flex; justify-content: flex-end; padding: 4px 14px; border-top: 1px solid var(--line); background: #fff; }
.stage-history-delete { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border: none; border-radius: 8px; background: transparent; color: #a73749; font-size: 13px; }
.stage-history-delete:hover { background: #fae9ed; }
.stage-history-delete .ui-icon { width: 17px; height: 17px; }
.progress-method-details { margin-top: 20px; border-color: var(--line); }
.summary-stats > .overview-details, .trend-stale-note { grid-column: 1 / -1; }
.summary-stats > .overview-details { border-color: var(--line); }
.trend-stale-note { margin: 0; }
.summary-stat-value.trend-value > strong { font-size: inherit; font-weight: inherit; }
.summary-stat-value.trend-value > small { margin-left: 5px; font-size: 11px; }
.stage-history-details { padding: 0 20px 18px; background: #fff; border-top: 1px solid var(--line); }
.stage-history-details dl { margin: 0; padding-top: 10px; }
.stage-history-details dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 14px; }
.stage-history-details dt { color: var(--muted); }
.stage-history-details dd { margin: 0; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.stage-history-data-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
@media (max-width: 420px) {
  .stage-history-item summary { padding: 16px 14px 0; }
  .stage-history-details { padding: 0 14px 16px; }
  .stage-history-period { font-size: 16px; gap: 8px; }
  .stage-history-weights { gap: 14px; }
  .stage-history-weights > span + span { padding-left: 14px; }
  .stage-history-weights strong { font-size: 22px; }
}
.today-pulse { padding: 15px 0 22px; border-color: #cad6e8; }
.today-number { font-family: "Bahnschrift", "DIN Alternate", "Arial", sans-serif; font-size: 56px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.today-number small { font-size: 15px; font-weight: 500; }
.today-date { font-size: 12px; margin-top: 5px; }
.today-label { font-size: 12px; max-width: 115px; }
.today-label strong { color: var(--ink); font-weight: 600; }
.record-pills { gap: 8px; }
.record-pill { font-size: 12px; min-height: 36px; border-radius: 8px; padding: 0 10px; background: #ffffff60; border-color: #c9d7eb; font-weight: 500; }
.record-pill.is-done { color: #216450; background: #e4f2ed; border-color: #c0dcd2; }
.mini-insight { padding: 18px 0 0; border-radius: 0; background: none; border-top: 1px solid #cad6e8; gap: 10px; }
.mini-insight-title { font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.mini-insight-copy { font-size: 12px; line-height: 1.8; color: var(--muted); }
.pace-grid { gap: 18px; }
.status-badge { font-size: 10px; min-height: 25px; font-weight: 500; }
.status-badge.neutral { color: #4a5c77; background: #d3def1; }
.analysis-header { margin-bottom: 26px; }
.range-select-label select { font-size: 13px; min-height: 44px; background: #f6f8fc; border-color: var(--line); color: var(--ink); }
.progress-dashboard { padding: 0 0 24px; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; margin-bottom: 24px; }
.progress-dashboard-header { margin-bottom: 18px; flex-wrap: wrap; }
.progress-dashboard-header h4 { font-size: 16px; }
.progress-dashboard-header > span { font-size: 11px; }
.progress-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.progress-card { border: none; border-radius: 0; background: transparent; padding: 0 18px 0 0; border-right: 1px solid var(--line); }
.progress-card:last-child { border-right: none; padding-right: 0; }
.progress-card-head { font-size: 13px; }
.progress-card-head b { display: none; }
.progress-status { font-size: 11px; }
.progress-card > p { font-size: 11px; min-height: 0; line-height: 1.8; }
.progress-card > p.progress-rule-note { font-size: 10px; }
.progress-empty-title { font-size: 16px; }
.summary-stats { gap: 12px; }
.summary-stat { background: #f3f6fc; border: none; border-radius: 12px; padding: 16px; }
.summary-stat-label { font-size: 12px; color: var(--muted); }
.summary-stat-value { font-size: 22px; font-variant-numeric: tabular-nums; }
.summary-stat-detail { font-size: 11px; color: var(--muted); }
.previous-day-record { border-color: var(--line); }
#weightChart text, #deltaChart text { fill: var(--muted); }
.chart-legend { font-size: 12px; gap: 18px; }
.chart-empty { gap: 10px; font-size: 13px; padding: 0 15px; }
.chart-empty strong { font-size: 15px; }
.empty-icon { background: #edf2fb; color: var(--teal); }
.delta-chart-section { margin-top: 24px; padding-top: 24px; border-color: var(--line); }
.delta-chart-header h4 { font-size: 16px; }
.delta-range-note { font-size: 11px; }
.chart-tooltip { font-size: 12px; white-space: normal; width: max-content; }
.weight-calendar { margin: 22px 0 26px; padding: 0; border: none; border-radius: 0; background: none; }
.calendar-toolbar h4 { font-size: 16px; }
.calendar-nav-button { width: 42px; height: 42px; background: #f3f6fc; border: none; color: var(--ink); }
.calendar-nav strong { font-size: 13px; }
.calendar-stat { padding: 12px 16px; }
.calendar-stat span { font-size: 12px; }
.calendar-stats p, .calendar-legend { font-size: 11px; }
.calendar-weekdays span { font-size: 12px; padding: 12px 4px; font-weight: 500; }
.calendar-grid { border-color: var(--line); border-radius: 12px; }
.calendar-day { border-color: var(--line); min-height: 98px; padding: 10px; }
.calendar-day.is-outside { background: #f8fafd; }
.calendar-day.is-today { background: #edf3fe; }
.calendar-date-number { font-size: 12px; }
.calendar-weight strong { font-size: 17px; }
.calendar-weight-unit { font-size: 10px; }
.calendar-delta { font-size: 11px; }
.history-view-hint { font-size: 12px; margin-bottom: 18px; }
.history-empty { font-size: 13px; background: #f8fafd; border-color: var(--line); }
.history-day { background: #fff; padding: 18px 0; border: none; border-top: 1px solid var(--line); border-radius: 0; }
.history-date { font-size: 14px; }
.history-delta { font-size: 12px; }
.history-entry { grid-template-columns: 50px minmax(90px, 1fr) auto; padding-top: 12px; gap: 12px; }
.history-period { font-size: 11px; min-height: 28px; }
.history-weight { font-size: 17px; font-variant-numeric: tabular-nums; }
.history-note { font-size: 12px; }
.tiny-button { min-height: 40px; padding: 6px 8px; font-size: 12px; }
.history-older { background: #f8fafd; border-color: var(--line); border-radius: 12px; }
.history-older summary { font-size: 13px; min-height: 48px; }
.settings-body { margin-top: 26px; }
.section-copy { font-size: 13px; line-height: 1.8; }
.settings-label { font-size: 15px; margin-bottom: 14px; }
.settings-divider { margin: 28px 0; }
.settings-unit { font-size: 12px; }
.settings-summary:focus-visible { outline-color: var(--teal); }
.settings-actions .primary-button { flex: 0 0 auto; min-width: 150px; }
.app-footer { padding-top: 30px; font-size: 11px; color: var(--muted); }
.toast { background: var(--ink); font-size: 13px; border-radius: 10px; box-shadow: 0 6px 24px #24375026; }

@media (max-width: 1100px) {
  .app-shell { padding-inline: 24px; }
  .main-content { grid-template-columns: 120px minmax(0, 1fr); gap: 22px; }
  .page-tab { padding-inline: 14px; gap: 10px; }
  .dashboard-grid { gap: 18px; }
  .card { padding: 24px; }
  .field-grid { grid-template-columns: 1fr; }
  .today-pulse { flex-wrap: wrap; gap: 16px; }
  .today-label { text-align: left; max-width: none; }
  .pace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .main-content { grid-template-columns: 1fr; gap: 20px; }
  .page-view { grid-column: 1; }
  .page-nav { position: static; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 5px; background: #fff; border-radius: 14px; }
  .page-tab { justify-content: center; min-height: 46px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .today-pulse { flex-wrap: nowrap; }
  .today-label { text-align: right; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 18px calc(106px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 82px; }
  .brand-lockup h1 { font-size: 18px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand-mark svg { width: 29px; height: 29px; }
  .brand-caption { font-size: 11px; }
  .icon-button { padding: 0 12px; }
  .main-content { gap: 18px; }
  .intro-row { padding: 12px 2px 0; display: block; }
  .intro-row > div:first-child { display: grid; gap: 3px; }
  .day-label { font-size: 12px; margin-bottom: 0; }
  .intro-row h2 { font-size: 12px; max-width: none; line-height: 1.6; }
  .intro-copy { display: none; }
  .privacy-pill { margin-top: 4px; font-size: 11px; }
  .page-nav { position: fixed; z-index: 10; inset: auto 0 0; border-top: 1px solid var(--line); border-radius: 0; padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); gap: 6px; background: #fffffff5; backdrop-filter: blur(16px); }
  .page-tab { flex-direction: column; gap: 3px; min-height: 54px; border-radius: 10px; padding: 5px; font-size: 11px; }
  .page-tab .ui-icon { width: 22px; height: 22px; }
  .page-tab.is-active { background: #edf3fe; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 18px; }
  .card { padding: 24px 22px; border-radius: 20px; }
  .card-header { margin-bottom: 22px; }
  .entry-card .card-header { margin-bottom: 22px; }
  .card h3 { font-size: 20px; }
  .card-description { font-size: 12px; }
  .entry-card .field-grid { gap: 12px; }
  .entry-card .weight-field { margin: 20px 0; }
  .entry-card .weight-input-wrap input { height: 64px; font-size: 44px; padding: 0; }
  .entry-card .field input, .entry-card .field textarea { font-size: 16px; }
  .entry-card .form-actions { margin-top: 18px; }
  .today-card { border-radius: 20px; }
  .today-pulse { flex-wrap: nowrap; }
  .today-number { font-size: 48px; }
  .pace-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
  .progress-card-grid { grid-template-columns: 1fr; gap: 20px; }
  .progress-card { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
  .progress-card:last-child { border-bottom: none; padding-bottom: 0; }
  .progress-value-row { margin-top: 12px; }
  .summary-stat-value { font-size: 19px; }
  .summary-stat { padding: 14px 12px; }
  .summary-stat-value.trend-value { white-space: normal; }
  .delta-chart-header { gap: 12px; }
  .weight-calendar { margin-inline: 0; }
  .calendar-toolbar { flex-wrap: wrap; }
  .calendar-day { min-height: 78px; padding: 6px 3px; }
  .calendar-weight { display: block; }
  .calendar-weight strong { font-size: 13px; }
  .calendar-weight-unit { font-size: 8px; }
  .calendar-delta { font-size: 9px; }
  .calendar-stats { gap: 8px; }
  .calendar-stat { padding: 10px 12px; }
  .calendar-stat span { font-size: 11px; }
  .calendar-legend { font-size: 10px; gap: 8px; }
  .history-entry { grid-template-columns: 44px minmax(65px, 1fr) auto; gap: 7px; }
  .history-note { display: none; }
  .history-actions { grid-column: 3; gap: 0; }
  .history-weight { font-size: 16px; }
  .tiny-button { padding-inline: 7px; }
  .history-delta { font-size: 11px; }
  .settings-progress-grid { grid-template-columns: 1fr; }
  .settings-progress-grid.stage-fields { grid-template-columns: 1fr 1fr; }
  .toast { top: auto; bottom: calc(90px + env(safe-area-inset-bottom)); }
  .page-view :is(button, input, select, summary, [tabindex]) { scroll-margin-block: 100px; }
}
@media (max-width: 420px) {
  .app-shell { padding-inline: 12px; }
  .card { padding: 22px 18px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field input[type="date"] { padding-left: 8px; padding-right: 30px; }
  .date-input-icon { right: 9px; width: 14px; }
  .segment { gap: 4px; font-size: 12px; }
  .period-icon { width: 15px; height: 15px; }
  .pace-grid, .settings-progress-grid.stage-fields { grid-template-columns: 1fr; }
  .analysis-header { flex-wrap: wrap; }
  .summary-stat-label { white-space: normal; }
  .calendar-nav { width: 100%; }
  .calendar-day { min-height: 84px; }
  .calendar-stats p { font-size: 11px; }
  .calendar-weight strong { font-size: 12px; }
  .app-footer { flex-wrap: wrap; gap: 4px; font-size: 10px; }
  .history-day-head { flex-wrap: wrap; }
}
/* Trend sections use related quiet fills instead of separator rules. */
#trendPage { padding: 0; border: none; background: transparent; box-shadow: none; }
#trendPage:not([hidden]) { display: grid; gap: 16px; }
#trendPage > .trend-chart-card,
#trendPage > #longerComparison,
#trendPage > #summaryStats,
#trendPage > #progressDashboard,
#trendPage > #goalStagePanel,
#trendPage > .delta-analysis-details {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: none;
  border-radius: 20px;
  box-shadow: none;
}
#trendPage > .trend-chart-card { background: #fff; }
#trendPage > #longerComparison { background: #fff; }
#trendPage > #summaryStats { background: #fff; }
#trendPage > #progressDashboard { background: #fff; }
#trendPage > #goalStagePanel { background: #fff; }
#trendPage > .delta-analysis-details { background: #fff; }
#trendPage #stageReviewPanel:empty { display: none; }
#trendPage .goal-stage-panel { display: grid; gap: 8px; }
#trendPage .goal-stage-panel > h4 { margin: 0 0 6px; color: var(--ink); font-size: 16px; }
#trendPage .overview-details { border: none; }
#trendPage .overview-details-body { padding: 10px 0 0; border-radius: 0; background: transparent; }
#trendPage #forecastPanel > details,
#trendPage #stageReviewPanel > details { margin: 0; }
#trendPage .progress-card-grid { gap: 14px; }
#trendPage .progress-card,
#trendPage .progress-card:last-child { padding: 18px; border: none; border-radius: 14px; background: transparent; }
#trendPage .progress-card.stage { background: transparent; }
#trendPage .goal-progress-track {
  height: 12px;
  margin: 10px 0 12px;
  border-radius: 999px;
  background: #eeeaf5;
  --plan-marker-color: #6d5c94;
}
#trendPage .goal-progress-fill { background: #70549f; }
#trendPage .goal-progress-track.stage {
  height: 10px;
  background: #eeeaf5;
  --plan-marker-color: #6d5c94;
}
#trendPage .goal-progress-track.stage .goal-progress-fill { background: #8b73af; }
#trendPage .progress-marker {
  z-index: 1;
  top: -4px;
  bottom: -4px;
  height: auto;
  width: 2px;
  border-radius: 1px;
  background: var(--plan-marker-color);
  clip-path: none;
  box-shadow: 0 0 0 2px #fff;
  transform: translateX(-50%);
  pointer-events: none;
}
#trendPage .progress-method-details { margin-top: 12px; }
#trendPage .delta-chart-section { margin-bottom: 0; border: none; }
#trendPage .chart-events-hint { margin-bottom: 0; }
/* Consistent typography within each heading level, with section accent colors. */
#trendPage > .trend-chart-card { --module-title: #294fa9; }
#trendPage > .delta-analysis-details { --module-title: #276f79; }
#trendPage > #longerComparison { --module-title: #426298; }
#trendPage > #summaryStats { --module-title: #2b7563; }
#trendPage > #progressDashboard {
  --module-title: #69558f;
  --progress-ink: #594474;
  --progress-muted: #756386;
}
#trendPage #progressDashboard :is(
  .progress-value-row > strong,
  .progress-empty-title,
  .progress-method-details > summary,
  .overview-details-body dd
) { color: var(--progress-ink); }
#trendPage #progressDashboard :is(
  .progress-dashboard-header > span,
  .progress-value-row small,
  .progress-status,
  .progress-card > p,
  .overview-details-body dt,
  .overview-details-body p
) { color: var(--progress-muted); }
#trendPage > #goalStagePanel { --module-title: #4a627f; }
#trendPage :is(
  .analysis-header h3,
  .delta-analysis-details > summary,
  .delta-chart-header h4,
  #overnightStatus h4,
  .analysis-insights > h4,
  .trend-speed-summary > h4,
  .progress-dashboard-header h4,
  .progress-card-head,
  .goal-stage-panel > h4,
  .forecast-details > summary,
  .stage-review-details > summary
) {
  font-family: inherit;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--module-title, var(--ink));
}
#trendPage :is(
  .analysis-header h3,
  .delta-analysis-details > summary,
  .analysis-insights > h4,
  .trend-speed-summary > h4,
  .progress-dashboard-header h4,
  .goal-stage-panel > h4
) { font-size: 18px; font-weight: 700; }
#trendPage :is(
  .delta-chart-header h4,
  #overnightStatus h4,
  .progress-card-head,
  .forecast-details > summary,
  .stage-review-details > summary
) { font-size: 15px; font-weight: 600; }
@media (max-width: 760px) {
  #trendPage > .trend-chart-card,
  #trendPage > #longerComparison,
  #trendPage > #summaryStats,
  #trendPage > #progressDashboard,
  #trendPage > #goalStagePanel,
  #trendPage > .delta-analysis-details { padding: 20px; border-radius: 18px; }
}
@media (max-width: 420px) {
  #trendPage > .trend-chart-card,
  #trendPage > #longerComparison,
  #trendPage > #summaryStats,
  #trendPage > #progressDashboard,
  #trendPage > #goalStagePanel,
  #trendPage > .delta-analysis-details { padding: 18px; }
  #trendPage .progress-card,
  #trendPage .progress-card:last-child { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
