/* Day widgets. Global layout, controls and typography belong to app.css. */
.tone-nutrition { --tone: var(--w-nutrition); }
.tone-protein { --tone: var(--w-protein); }
.tone-sleep { --tone: var(--w-sleep); }
.tone-recovery { --tone: var(--w-recovery); }
.tone-activity { --tone: var(--w-activity); }
.tone-heart { --tone: var(--w-heart); }
.tone-stress { --tone: var(--w-stress); }
.w-tabs { display: flex; gap: 3px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--raised); }
.w-tabs button { flex: 1; min-width: 0; padding: 8px 22px; min-height: 44px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 550; }
.w-tabs button[aria-pressed=true] { color: var(--text); background: var(--panel); }
.w-tabs button:hover { color: var(--text); }
.w-source-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.w-source-line button { min-height: 44px; padding-inline: 4px; font-size: 13px; font-weight: 500; }
.w-source-line .w-device-link { gap: 8px; background: transparent; color: var(--muted); }
.w-device-link i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--muted); }
.w-device-link i[data-connected=true] { background: var(--w-recovery); }
.w-device-link > span:last-child { font-size: 20px; }
.w-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.w-stat { position: relative; display: grid; grid-template-rows: 32px minmax(40px, auto) 1fr; gap: 12px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.w-stat-top { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.25; }
.w-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; color: var(--tone); background: color-mix(in srgb, var(--tone) 9%, transparent); }
.w-icon svg { width: 18px; height: 18px; }
.w-stat-value { display: flex; flex-wrap: wrap; align-items: baseline; align-content: center; gap: 0 5px; font-size: 30px; line-height: 40px; letter-spacing: -.04em; font-weight: 650; font-variant-numeric: tabular-nums; }
.w-stat-value > span { min-width: 0; }
.w-stat-value > small { font-size: 13px; line-height: 20px; font-weight: 450; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.w-duration { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.w-duration > span { display: inline-flex; align-items: baseline; gap: 3px; }
.w-duration small { font-size: 12px; font-weight: 450; line-height: 20px; letter-spacing: 0; color: var(--muted); }
.w-stat-value[data-long=true] { font-size: 22px; line-height: 30px; }
.w-stat-value[data-range=true] { flex-direction: column; align-items: flex-start; justify-content: center; font-size: 22px; line-height: 30px; }
.w-stat[data-missing=true] .w-stat-value { color: var(--muted); }
.w-stat-foot { align-self: start; min-height: 38px; font-size: 12px; line-height: 19px; color: var(--muted); }
.w-target { color: var(--tone); }
.w-goal-track { position: absolute; left: 20px; right: 20px; bottom: 10px; height: 3px; background: color-mix(in srgb, var(--tone) 12%, var(--panel)); border-radius: 3px; overflow: hidden; }
.w-goal-track > span { display: block; height: 100%; border-radius: 3px; background: var(--tone); }
.w-recovery-strip { padding: 16px 20px 20px; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.w-recovery-strip > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.w-recovery-strip h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 550; }
.w-recovery-strip h2 svg { width: 19px; height: 19px; color: var(--w-recovery); }
.w-recovery-strip header button { font-size: 13px; font-weight: 500; padding-inline: 4px; }
.w-recovery-strip dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0; }
.w-recovery-strip dl > div { display: grid; grid-template-rows: 20px 40px 20px; gap: 6px; min-width: 0; }
.w-recovery-strip dl > div + div { border-left: 1px solid var(--line); padding-left: 20px; }
.w-recovery-strip dt { font-size: 13px; line-height: 20px; color: var(--muted); }
.w-recovery-strip dd { display: flex; align-items: baseline; gap: 5px; min-width: 0; margin: 0; }
.w-recovery-strip dd strong { font-size: 29px; line-height: 40px; letter-spacing: -.04em; font-weight: 650; font-variant-numeric: tabular-nums; }
.w-recovery-strip dd > span { color: var(--muted); font-size: 13px; line-height: 20px; }
.w-recovery-strip small { color: var(--muted); font-size: 12px; line-height: 20px; }
.w-section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin: 28px 0 20px; }
.w-section-title h2 { font-size: 22px; }
.w-section-title p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.w-period { display: flex; flex: none; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.w-period button { min-height: 44px; padding: 8px 14px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 13px; }
.w-period button[aria-pressed=true] { color: var(--text); background: var(--raised); }
.w-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.w-chart { min-width: 0; padding: 24px 20px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.w-chart > header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; margin-bottom: 24px; }
.w-kicker { font-size: 12px; line-height: 18px; color: var(--muted); }
.w-chart h3 { font-size: 18px; line-height: 24px; margin-top: 6px; }
.w-chart-average { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.w-chart-average > strong { font-size: 24px; line-height: 30px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.w-chart-average strong small { color: var(--muted); font-size: 12px; font-weight: 450; }
.w-chart-average > span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.w-plot { width: 100%; height: 230px; min-width: 0; touch-action: pan-y; }
.w-tooltip { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: 13px; box-shadow: 0 8px 24px #14203a20; }
.w-chart-data { margin-top: 16px; border-top: 1px solid var(--line); }
.w-chart-data p { margin-bottom: 16px; }
.w-chart-data td:last-child, .w-chart-data th:last-child { text-align: right; }
.w-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; min-height: 220px; padding: 20px; text-align: center; color: var(--muted); }
.w-empty > svg { width: 28px; height: 28px; color: var(--tone); }
.w-empty strong { color: var(--text); font-size: 16px; font-weight: 600; }
.w-empty p { max-width: 32ch; font-size: 14px; }
.w-macros { margin-top: 20px; }
.w-macro-body { display: flex; align-items: center; justify-content: center; gap: 40px; padding: 0 8px 20px; }
.w-pie { position: relative; width: 180px; height: 180px; flex: none; }
.w-pie-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; pointer-events: none; }
.w-pie-center strong { font-size: 16px; }
.w-pie-center small { color: var(--muted); font-size: 12px; }
.w-macro-legend { display: grid; gap: 20px; min-width: 180px; }
.w-macro-legend > div { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.w-macro-legend i { width: 7px; height: 7px; border-radius: 50%; }
.w-macro-legend span { display: flex; flex-direction: column; gap: 4px; }
.w-macro-legend small { color: var(--muted); font-size: 12px; font-weight: 450; }
.w-macro-legend strong { margin-left: auto; font-size: 22px; font-weight: 600; }
.w-macro-legend strong small { margin-left: 2px; }
.w-action-row { display: flex; gap: 12px; margin: 24px 0; }
.w-footnote, .w-empty-text { margin: 16px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.w-sleep-stages { margin-top: 20px; }
.w-sleep-bar { display: flex; gap: 3px; height: 20px; overflow: hidden; border-radius: 6px; margin: 24px 0; }
.w-sleep-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 24px 0; }
.w-sleep-legend > div { display: grid; grid-template-columns: 7px 1fr; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.w-sleep-legend i { width: 7px; height: 7px; align-self: center; border-radius: 50%; }
.w-sleep-legend strong { grid-column: 2; color: var(--text); font-size: 18px; font-weight: 600; white-space: nowrap; }
.w-source-note, .w-extra-trends { margin-top: 24px; border-top: 1px solid var(--line); }
.w-source-note p { font-size: 13px; margin-bottom: 16px; }
.w-extra-trends > .w-charts { margin-top: 8px; }
.w-energy { margin-top: 24px; }
.w-training { min-width: 0; padding: 24px; margin-top: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.w-training > header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.w-training h3 { font-size: 18px; }
.w-training p { font-size: 14px; color: var(--muted); }
.w-training > .text-button { margin-top: 16px; }
.w-workout { display: flex; align-items: center; gap: 14px; padding: 20px 0; border-top: 1px solid var(--line); }
.w-workout > div { min-width: 0; }
.w-workout p { margin-top: 8px; }
.w-review-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; padding: 24px 0; margin-top: 24px; border-top: 1px solid var(--line); }
.w-review-links h3 { font-size: 18px; margin-bottom: 8px; }
.w-review-links p { color: var(--muted); font-size: 13px; }
.w-review-links > div:last-child { display: flex; gap: 8px; }
@media (max-width: 1099px) {
  .w-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .w-charts { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .w-tabs { width: 100%; }
  .w-tabs button { padding: 8px 2px; font-size: 13px; }
  .w-stat-grid { gap: 12px; }
  .w-stat { grid-template-rows: 32px minmax(36px, auto) 1fr; padding: 16px; gap: 10px; border-radius: 12px; }
  .w-stat-value { font-size: 28px; line-height: 36px; }
  .w-goal-track { left: 16px; right: 16px; }

  .w-stat-value[data-long=true], .w-stat-value[data-range=true] { font-size: 20px; }
  .w-stat-top { font-size: 12px; gap: 6px; }
  .w-icon { width: 25px; height: 25px; }
  .w-icon svg { width: 17px; height: 17px; }
  .w-stat-value > small { font-size: 12px; }
  .w-recovery-strip { padding: 12px 16px 18px; margin-top: 12px; }
  .w-recovery-strip dl { gap: 16px; }
  .w-recovery-strip dl > div + div { padding-left: 16px; }
  .w-chart { padding: 20px 16px 8px; }
  .w-chart > header { grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
  .w-chart-average { flex-direction: row; align-items: baseline; gap: 12px; }
  .w-chart h3 { font-size: 18px; }
  .w-plot { height: 220px; }
  .w-macro-body { gap: 24px; padding-inline: 0; }
  .w-pie { width: 132px; height: 132px; }
  .w-macro-legend { min-width: 0; flex: 1; gap: 16px; }
  .w-macro-legend > div { gap: 6px; font-size: 13px; }
  .w-macro-legend strong { font-size: 19px; }
  .w-pie-center strong { font-size: 14px; }
  .w-pie-center small { font-size: 11px; }
  .w-action-row > button { flex: 1; padding-inline: 8px; }
  .w-sleep-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .w-training { padding: 20px; }
  .w-review-links > div:last-child { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .w-stat { padding-inline: 12px; }

  .w-stat-value[data-long=true], .w-stat-value[data-range=true] { font-size: 18px; }
  .w-pie { width: 112px; height: 112px; }
  .w-macro-body { gap: 16px; }
}
