/* health tab styles. Every class starts with .health- so tabs never collide. */
.health-root, .health-form { position: relative; min-height: 100%; background: #f5f6f8; color: var(--ink); }
.health-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.health-ico { display: inline-block; flex: none; line-height: 0; }
.health-ico svg { display: block; }

/* header + week strip */
.health-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 8px; background: #fff; }
.health-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.health-cal-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.health-cal-btn:active { background: var(--primary-soft); }
.health-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px 10px 14px; background: #fff; }
.health-weekday { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; border: 0; border-radius: 16px; background: none; font: inherit; color: var(--ink-sub); cursor: pointer; }
.health-weekday-name { font-size: 12px; }
.health-weekday-num { font-size: 18px; font-weight: 600; color: var(--ink); }
.health-weekday.is-selected { background: var(--primary-soft); }
.health-weekday.is-selected .health-weekday-name, .health-weekday.is-selected .health-weekday-num { color: var(--primary); font-weight: 800; }
.health-weekday.is-future { cursor: default; }
.health-weekday.is-future .health-weekday-name, .health-weekday.is-future .health-weekday-num { color: #c2c8d4; }
.health-weekday.has-record::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }

/* record cards */
.health-cards { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 24px; }
.health-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 16px 16px 14px; border: 0; border-radius: 22px; background: #fff; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.health-card:active { background: #f1f4fa; }
.health-card-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; }
.health-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.health-card-text small { font-size: 13px; color: var(--ink-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-card-text small.health-card-summary { color: var(--primary); font-weight: 600; }
.health-card-text strong { font-size: 19px; letter-spacing: -0.02em; }
.health-card-done { flex: none; display: grid; place-items: center; }
.health-card-arrow { flex: none; width: 10px; height: 10px; margin: 0 6px 0 2px; border-top: 2px solid #9aa3b5; border-right: 2px solid #9aa3b5; transform: rotate(45deg); }

/* month picker (drops from the top, inside the tab) */
.health-dim { position: absolute; inset: 0; z-index: 5; background: rgba(20, 24, 33, 0.45); }
.health-dim-top { display: flex; align-items: flex-start; }
.health-cal { width: 100%; padding: 14px 14px 18px; background: #fff; border-radius: 0 0 24px 24px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.health-cal-head { position: relative; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0 12px; }
.health-cal-head strong { min-width: 110px; text-align: center; font-size: 18px; }
.health-cal-nav, .health-cal-close { position: relative; width: 36px; height: 36px; border: 0; border-radius: 12px; background: var(--surface); cursor: pointer; }
.health-cal-nav::before { content: ""; position: absolute; top: 13px; width: 9px; height: 9px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.health-cal-prev::before { left: 14px; transform: rotate(45deg); }
.health-cal-next::before { left: 11px; transform: rotate(-135deg); }
.health-cal-close { position: absolute; right: 0; top: 6px; background: none; }
.health-cal-close::before, .health-cal-close::after { content: ""; position: absolute; left: 10px; top: 17px; width: 16px; height: 2px; background: var(--ink-sub); transform: rotate(45deg); }
.health-cal-close::after { transform: rotate(-45deg); }
.health-cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; justify-items: center; }
.health-cal-names { padding-bottom: 4px; font-size: 12px; color: var(--ink-sub); }
.health-cal-day { position: relative; display: grid; place-items: center; width: 40px; height: 40px; margin: 1px 0; border: 0; border-radius: 50%; background: none; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; }
.health-cal-day:disabled { color: #c2c8d4; cursor: default; }
.health-cal-day.is-today { box-shadow: inset 0 0 0 2px var(--primary-soft); font-weight: 700; }
.health-cal-day.is-selected { background: var(--primary); color: #fff; font-weight: 800; }
.health-cal-day.has-record::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
.health-cal-day.is-selected.has-record::after { background: #fff; }

/* form screens */
.health-form { display: flex; flex-direction: column; background: #fff; }
.health-form .topbar strong { font-size: 18px; }
.health-form-day { margin: 2px 20px 0; font-size: 13px; color: var(--ink-sub); }
.health-form-body { flex: 1; padding: 6px 20px 20px; }
.health-field { margin-top: 20px; }
.health-field-label { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--ink-sub); }
.health-hint { margin: 14px 0 0; font-size: 14px; color: var(--ink-sub); }
.health-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.health-chip { border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; background: #fff; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; }
.health-chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.health-time, .health-line, .health-text { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; font: inherit; font-size: 16px; color: var(--ink); }
.health-time { width: auto; min-width: 140px; }
.health-text { resize: none; line-height: 1.5; }
.health-text[hidden] { display: none; }
.health-time:focus, .health-line:focus, .health-text:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.health-radios { display: flex; flex-direction: column; gap: 8px; }
.health-radio { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.health-radio input { position: absolute; opacity: 0; pointer-events: none; }
.health-radio-dot { flex: none; width: 20px; height: 20px; border: 2px solid #b4bccb; border-radius: 50%; }
.health-radio input:checked + .health-radio-dot { border: 6px solid var(--primary); }
.health-radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.health-notice { margin: 0; padding: 14px; border-radius: 14px; background: #fff7e6; color: #8a5a00; font-size: 14px; }
.health-notice[hidden] { display: none; }

/* mood sheet */
.health-sheet-title { margin: 14px 0 18px; font-size: 22px; letter-spacing: -0.03em; }
.health-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.health-mood { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0 8px; border: 2px solid transparent; border-radius: 16px; background: none; font: inherit; font-size: 11px; color: var(--ink-sub); cursor: pointer; word-break: keep-all; }
.health-mood span:last-child { text-align: center; line-height: 1.25; padding: 0 2px; }
.health-mood[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.health-mood-caption { margin: 14px 0 0; text-align: center; font-size: 17px; font-weight: 700; color: var(--primary); min-height: 24px; }

/* exercise tiles + stepper */
.health-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.health-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 10px 4px; border: 2px solid transparent; border-radius: 18px; background: #f3f5f9; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; word-break: keep-all; text-align: center; }
.health-tile[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.health-stepper { display: flex; align-items: center; justify-content: space-between; padding: 8px; border: 1px solid var(--line); border-radius: 18px; }
.health-step-value { font-size: 20px; font-weight: 800; }
.health-step-btn { position: relative; width: 48px; height: 48px; border: 0; border-radius: 14px; background: var(--primary-soft); cursor: pointer; }
.health-step-btn:disabled { opacity: 0.4; cursor: default; }
.health-step-btn::before, .health-step-btn::after { content: ""; position: absolute; left: 15px; top: 23px; width: 18px; height: 2px; border-radius: 2px; background: var(--primary); }
.health-step-btn::after { transform: rotate(90deg); }
.health-step-minus::after { display: none; }

/* sleep slider + scores */
.health-slider { padding: 4px 2px 0; }
.health-range-value { display: block; margin-bottom: 8px; text-align: center; font-size: 24px; font-weight: 800; color: var(--primary); }
.health-range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 32px; margin: 0; background: transparent; cursor: pointer; }
.health-range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--primary) var(--health-pct, 0%), #dfe4ee var(--health-pct, 0%)); }
.health-range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; border: 4px solid #fff; border-radius: 50%; background: var(--primary); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.health-range::-moz-range-track { height: 8px; border-radius: 4px; background: #dfe4ee; }
.health-range::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--primary); }
.health-range::-moz-range-thumb { width: 22px; height: 22px; border: 4px solid #fff; border-radius: 50%; background: var(--primary); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.health-range:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px; }
.health-range-ends { display: flex; justify-content: space-between; margin-top: 2px; font-size: 12px; color: var(--ink-sub); }
.health-scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.health-score { position: relative; height: 48px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); cursor: pointer; }
.health-score[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* sticky save bar, delete confirm */
.health-bar { position: sticky; bottom: 0; z-index: 2; padding: 10px 20px 16px; background: #fff; border-top: 1px solid var(--line); }
.health-bar-row { display: flex; gap: 10px; }
.health-bar-row .btn { flex: 1; }
.health-bar-row .health-delete { flex: 0 0 38%; }
.health-problem { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: #d03a3a; }
.health-problem[hidden] { display: none; }
.health-dim:not(.health-dim-top) { display: grid; place-items: center; padding: 24px; }
.health-dialog { width: 100%; padding: 22px 20px 20px; border-radius: 22px; background: #fff; }
.health-dialog strong { font-size: 18px; }
.health-dialog p { margin: 6px 0 18px; font-size: 14px; color: var(--ink-sub); }
.health-dialog-row { display: flex; gap: 10px; }
.health-dialog-row .btn { flex: 1; }
.health-danger { background: #d03a3a; }
