/* Health owns its layout and chart styling; existing app themes remain authoritative. */
.lm-health-page,.lm-health-widget,.lm-health-dialog{--health-ink:var(--lm-text,#182640);--health-muted:var(--lm-muted,#8793a8);--health-border:var(--lm-border,#e9edf5);--health-surface:var(--lm-card,#fff);--health-soft:var(--lm-surface-2,var(--lm-bg,#f6f8fc));color:var(--health-ink)}
.lm-health-page{max-width:1500px;margin:0 auto;padding-bottom:20px}
.lm-health-page h1{font-size:30px;font-weight:750;letter-spacing:-.8px;margin:3px 0 5px}
.lm-health-page h2,.lm-health-dialog h2{font-size:16px;font-weight:700;margin:0}
.lm-health-page p{margin:5px 0 0;color:var(--health-muted);font-size:13px}
.lm-health-page .blue,.lm-health-widget .blue{color:#3988eb}.lm-health-page .teal{color:#24b9ad}.lm-health-page .violet,.lm-health-widget .violet{color:#8967e7}.lm-health-page .rose,.lm-health-widget .rose{color:#e77991}
.lm-health-muted{color:var(--health-muted);font-size:12px}
.lm-health-page-head{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}
.lm-health-eyebrow{color:var(--health-muted);font-size:10px;letter-spacing:1.8px;font-weight:700}
.lm-health-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.lm-health-head-actions .btn{border-radius:10px;font-size:12px;padding:10px 13px;font-weight:600;white-space:nowrap}
.lm-health-page .btn-primary{background:#3988eb;border-color:#3988eb}.lm-health-page .btn-light{background:var(--health-surface);border:1px solid var(--health-border);color:var(--health-ink)}
.lm-health-connection{font-size:12px;display:grid;grid-template-columns:9px auto;column-gap:6px;color:var(--health-ink);text-decoration:none;margin-right:8px;white-space:nowrap}
.lm-health-connection small{grid-column:2;color:var(--health-muted);font-size:10px}
.lm-health-status-dot{width:6px;height:6px;border-radius:50%;background:#a4afbe;margin-top:6px}.lm-health-status-dot.connected{background:#28b985}
.lm-health-card{background:var(--health-surface);border:1px solid var(--health-border);border-radius:15px;padding:22px;box-shadow:0 3px 13px #00000003;min-width:0}
.lm-health-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:20px}
.lm-health-stat>div{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--health-muted)}
.lm-health-stat>div i{display:grid;place-items:center;width:33px;height:33px;border-radius:10px;background:var(--health-soft);font-size:18px}
.lm-health-stat>strong{display:block;font-size:29px;font-weight:700;letter-spacing:-.6px;margin:8px 0 4px}
.lm-health-stat>strong small{font-size:12px;font-weight:400;color:var(--health-muted);letter-spacing:0}
.lm-health-main-grid{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(285px,1fr);gap:20px;margin-bottom:20px;align-items:stretch}
.lm-health-section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}
.lm-health-section-head p{font-size:11px}.lm-health-section-head>.form-select{max-width:140px;font-size:11px;border-color:var(--health-border);background-color:var(--health-surface);color:var(--health-ink)}
.lm-health-tabs{display:flex;gap:22px;border-bottom:1px solid var(--health-border);margin-bottom:20px}
.lm-health-tabs button{border:0;background:none;padding:0 0 12px;font-size:12px;font-weight:600;color:var(--health-muted);border-bottom:2px solid transparent;cursor:pointer}
.lm-health-tabs button.active{color:#3988eb;border-color:#3988eb}
.lm-health-chart-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:12px}
.lm-health-chart-head>div>small{display:block;color:var(--health-muted);font-size:11px}.lm-health-chart-head strong{font-size:29px;font-weight:700;letter-spacing:-.6px;display:block;margin-top:6px}
.lm-health-chart-head strong small{font-size:12px;color:var(--health-muted);font-weight:400}.lm-health-chart-head>.form-select{max-width:140px;font-size:12px}
.lm-health-period-change{font-size:17px;color:var(--health-ink);text-align:right}.lm-health-period-change small{display:block;font-size:10px;color:var(--health-muted);margin-top:5px}
.lm-health-chart{width:100%;min-height:190px;display:flex;flex-direction:column;justify-content:center}.lm-health-chart svg{display:block;width:100%;height:auto;overflow:visible}.lm-health-chart:not(.is-compact) svg{min-height:160px;max-height:270px}
.lm-health-grid line{stroke:var(--health-border);stroke-dasharray:3 5}.lm-health-grid text{font-size:10px;fill:var(--health-muted)}
.lm-health-chart.is-compact{min-height:0}.lm-health-chart.is-compact svg{height:58px;preserve-aspect-ratio:none}
.lm-health-chart.is-compact .lm-health-empty{min-height:64px;gap:5px;padding:5px;font-size:11px}.lm-health-chart.is-compact .lm-health-empty i,.lm-health-chart.is-compact .lm-health-empty strong{display:none}
.lm-health-chart-footer{display:flex;justify-content:space-between;gap:10px;font-size:10px;color:var(--health-muted);margin-top:16px;padding-top:15px;border-top:1px solid var(--health-border)}.lm-health-chart-footer i{font-size:5px;vertical-align:middle;margin-right:4px}
.lm-health-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;min-height:190px;color:var(--health-muted);font-size:12px;text-align:center;padding:20px}.lm-health-empty i{font-size:26px;color:var(--health-muted)}.lm-health-empty strong{font-size:13px;color:var(--health-ink)}.lm-health-empty-short{min-height:130px}
.lm-health-side-stack{display:grid;gap:20px;grid-template-rows:auto 1fr}.lm-health-activity .lm-health-section-head{margin-bottom:10px}
.lm-health-steps{display:flex;align-items:baseline;gap:8px;margin:6px 0 13px}.lm-health-steps strong{font-size:29px;letter-spacing:-.8px}.lm-health-steps span{font-size:11px;color:var(--health-muted)}
.lm-health-progress{height:5px;background:var(--health-soft);border-radius:10px;overflow:hidden}.lm-health-progress>span{height:100%;display:block;background:linear-gradient(90deg,#3988eb,#61adff);border-radius:10px;transition:width .2s}
.lm-health-goal{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:9px;font-size:10px;color:var(--health-muted)}.lm-health-goal input{width:65px;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--health-muted);font-size:10px;padding:2px}.lm-health-goal input:focus{border-color:#3988eb;outline:0}
.lm-health-activity-detail{display:flex;gap:26px;margin-top:16px;font-size:10px;color:var(--health-muted)}.lm-health-activity-detail strong{font-size:16px;color:var(--health-ink);font-weight:600;margin-right:2px}
.lm-health-recent{padding-top:18px;padding-bottom:14px}.lm-health-recent h2{font-size:14px}.lm-health-recent .lm-health-section-head{margin-bottom:5px}
.lm-health-recent-row{display:flex;align-items:center;gap:8px;padding:11px 0;border-bottom:1px solid var(--health-border)}.lm-health-recent-row:last-child{border-bottom:0}.lm-health-recent-row>span{flex:1;min-width:0}.lm-health-recent-row strong{font-size:11px;display:block;font-weight:600}.lm-health-recent-row small{font-size:9px;color:var(--health-muted);display:block;margin-top:4px}.lm-health-recent-row b{font-size:13px;white-space:nowrap;font-weight:600}.lm-health-recent-row b small{display:inline;font-weight:400}
.lm-health-text-btn,.lm-health-icon-btn{border:0;background:transparent;color:#3988eb;cursor:pointer;font-size:11px;padding:5px 6px;border-radius:6px}.lm-health-icon-btn{color:var(--health-muted);font-size:13px}.lm-health-text-btn:hover,.lm-health-icon-btn:hover{background:var(--health-soft)}.lm-health-page button:disabled,.lm-health-dialog button:disabled{cursor:default;opacity:.45}
.lm-health-bottom-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;margin-bottom:20px}.lm-health-section-head h2 i{margin-right:5px}
.lm-health-badge{background:var(--health-soft);padding:5px 9px;border-radius:6px;font-size:10px;white-space:nowrap}
.lm-health-sleep-total{display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin:15px 0 25px}.lm-health-sleep-total strong{font-size:28px;letter-spacing:-.6px}.lm-health-sleep-total>span{font-size:10px;color:var(--health-muted)}
.lm-health-sleep-timeline{position:relative;height:65px;border-bottom:1px solid var(--health-border);margin:15px 0 22px;background:var(--health-soft);border-radius:8px;overflow:hidden}.lm-health-sleep-timeline>span{position:absolute;height:18px;min-width:1px;background:#8c6ae8;top:29px}.lm-health-sleep-timeline>span.deep{top:43px;background:#6045bc}.lm-health-sleep-timeline>span.rem{top:15px;background:#b2a0f4}.lm-health-sleep-timeline>span.awake,.lm-health-sleep-timeline>span.restless{top:0;background:#f1ba8b}.lm-health-sleep-timeline>span.asleep{top:29px;background:#8c6ae8}
.lm-health-sleep-legend{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.lm-health-sleep-legend span{font-size:10px;color:var(--health-muted);display:flex;align-items:center;gap:5px}.lm-health-sleep-legend i{width:5px;height:5px;border-radius:50%;background:#8c6ae8}.lm-health-sleep-legend i.deep{background:#6045bc}.lm-health-sleep-legend i.rem{background:#b2a0f4}.lm-health-sleep-legend i.awake{background:#f1ba8b}.lm-health-sleep-legend strong{font-size:13px;display:block;margin-top:8px}
.lm-health-vital-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;border-top:1px solid var(--health-border);padding-top:17px}.lm-health-vital-grid>div>span{font-size:9px;color:var(--health-muted);display:block;min-height:24px}.lm-health-vital-grid strong{font-size:20px;display:block;font-weight:650;white-space:nowrap}.lm-health-vital-grid strong small{font-size:10px;font-weight:400;color:var(--health-muted)}.lm-health-vital-grid>div>small{font-size:8px;display:block;color:var(--health-muted);margin-top:5px}.lm-health-page .lm-health-footnote{font-size:10px;margin-top:15px;line-height:1.6}
.lm-health-source-note{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px 20px;font-size:10px;color:var(--health-muted);padding:17px 3px}.lm-health-source-note details,.lm-health-source-note p{width:100%;font-size:11px;margin:0}.lm-health-source-note summary{cursor:pointer}.lm-health-source-note ul{margin:10px 0}
.lm-health-notice,.lm-health-sync{font-size:12px;background:var(--health-surface);border:1px solid var(--health-border);border-radius:10px;padding:12px 15px;margin-bottom:16px}.lm-health-sync{display:flex;justify-content:space-between;align-items:center}.lm-health-notice{color:#2f9678}.lm-health-page>.alert{font-size:12px}
.lm-health-dialog{border:1px solid var(--health-border);border-radius:18px;padding:26px;width:min(450px,calc(100vw - 24px));max-height:90vh;background:var(--health-surface);box-shadow:0 20px 80px #00000035}.lm-health-dialog::backdrop{background:#00000070;backdrop-filter:blur(3px)}.lm-health-dialog header{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px}.lm-health-dialog header small{font-size:9px;color:var(--health-muted);letter-spacing:1.7px;display:block;margin-bottom:7px}.lm-health-dialog h2{font-size:20px}.lm-health-dialog label{display:block;font-size:12px;font-weight:600;margin:15px 0}.lm-health-dialog label small{color:var(--health-muted);font-weight:400}.lm-health-dialog .form-control,.lm-health-dialog .form-select{margin-top:7px;font-size:13px;background:var(--health-surface);color:var(--health-ink);border-color:var(--health-border)}.lm-health-dialog p{font-size:11px}.lm-health-dialog footer{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}.lm-health-dialog .btn{font-size:12px;border-radius:8px}
.lm-health-widget{display:flex;flex-direction:column;height:100%;min-height:0;padding-top:3px;overflow:auto;scrollbar-width:thin}
.lm-health-widget-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px}.lm-health-widget-stats>a{color:var(--health-ink);text-decoration:none;min-width:0}.lm-health-widget-stats>a>span{font-size:10px;color:var(--health-muted);display:block;white-space:nowrap}.lm-health-widget-stats i{margin-right:3px}.lm-health-widget-stats strong{font-size:20px;font-weight:650;letter-spacing:-.5px;display:block;margin:7px 0 2px;white-space:nowrap}.lm-health-widget-stats strong small{font-size:9px;font-weight:400;letter-spacing:0}.lm-health-widget-stats>a>small{color:var(--health-muted);font-size:8px;display:block}
.lm-health-widget-trend{display:flex;justify-content:space-between;align-items:center;gap:6px;border-top:1px solid var(--health-border);padding:9px 0;min-height:60px}.lm-health-widget-trend>span{font-size:10px;flex:1;min-width:0}.lm-health-widget-trend>span>small{display:block;font-size:8px;color:var(--health-muted);margin-top:5px}.lm-health-widget-trend>.lm-health-chart{width:40%}.lm-health-widget-trend .is-compact svg{height:43px}.lm-health-widget-trend>.lm-health-muted{font-size:9px;text-align:right}
.lm-health-widget-steps{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:10px;margin:4px 0 8px}.lm-health-widget-steps small{font-size:9px;color:var(--health-muted)}.lm-health-widget footer{margin-top:auto;padding-top:12px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:9px}.lm-health-widget footer>span{color:var(--health-muted)}.lm-health-widget footer a{text-decoration:none;font-weight:600;color:#3988eb;white-space:nowrap}
/* Match the application's neutral controls, including focus states from legacy global CSS. */
.lm-app.theme-dark .lm-health-page .btn-light {
    background:var(--health-surface);
    border-color:var(--health-border);
    color:var(--health-ink);
}
.lm-app.theme-dark .lm-health-page .btn-light:hover,
.lm-app.theme-dark .lm-health-page .btn-light:focus {
    background:var(--health-soft);
    border-color:var(--lm-action-border,#78a99b);
    color:var(--health-ink);
}
.lm-app.theme-dark .lm-health-page .form-control,
.lm-app.theme-dark .lm-health-page .form-select,
.lm-app.theme-dark .lm-health-page .lm-health-goal input {
    background-color:var(--health-soft);
    border-color:var(--health-border);
    color:var(--health-ink);
    color-scheme:dark;
}
.lm-app.theme-dark .lm-health-page .form-control:focus,
.lm-app.theme-dark .lm-health-page .form-select:focus,
.lm-app.theme-dark .lm-health-page .lm-health-goal input:focus {
    background-color:var(--health-soft);
    border-color:var(--lm-action-border,#78a99b);
    color:var(--health-ink);
    box-shadow:0 0 0 .2rem color-mix(in srgb,var(--lm-action,#5f8f82) 20%,transparent);
}
@media(max-width:1150px){.lm-health-page-head{align-items:flex-start;flex-direction:column}.lm-health-main-grid{grid-template-columns:minmax(0,1.5fr) minmax(260px,1fr)}.lm-health-card{padding:18px}.lm-health-stat>strong{font-size:25px}.lm-health-bottom-grid{grid-template-columns:1fr}.lm-health-vital-grid>div>span{min-height:0}.lm-health-widget-stats strong{font-size:18px}}
@media(max-width:760px){.lm-health-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.lm-health-main-grid{grid-template-columns:1fr}.lm-health-side-stack{grid-template-columns:1fr 1fr;grid-template-rows:auto;gap:12px}.lm-health-page-head{gap:15px}.lm-health-head-actions{gap:8px}.lm-health-head-actions .btn{font-size:11px;padding:9px}.lm-health-chart:not(.is-compact) svg{min-height:130px}.lm-health-activity-detail{gap:15px}.lm-health-recent-row small{font-size:8px}}
@media(max-width:480px){.lm-health-side-stack{grid-template-columns:1fr}.lm-health-head-actions{width:100%}.lm-health-connection{width:100%;margin-bottom:3px}.lm-health-stat{padding:15px}.lm-health-stat>strong{font-size:24px}.lm-health-vital-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.lm-health-tabs{gap:18px}.lm-health-section-head h2{font-size:14px}.lm-health-page>.lm-health-source-note{font-size:9px}.lm-health-chart-head{flex-wrap:wrap}.lm-health-period-change{font-size:14px}.lm-health-widget-stats{gap:5px}.lm-health-widget-stats strong{font-size:17px}}
/* Shared date navigation and interactive history. Theme surfaces come from the app. */
.lm-health-history-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-bottom:20px}
.lm-health-chart{position:relative}.lm-health-chart svg{touch-action:pan-y}.lm-health-chart svg g[role=button]{cursor:pointer;outline:none}.lm-health-chart svg g[role=button]:focus-visible{filter:drop-shadow(0 0 3px currentColor)}
.lm-health-tooltip{position:absolute;top:4px;transform:translateX(-50%);z-index:5;display:flex;flex-direction:column;gap:3px;padding:9px 12px;background:var(--health-surface);color:var(--health-ink);border:1px solid var(--health-border);border-radius:8px;box-shadow:0 4px 18px #0003;pointer-events:none;font-size:11px;width:180px;max-width:100%;white-space:normal}.lm-health-tooltip strong{font-size:13px}.lm-health-tooltip small,.lm-health-tooltip span{color:var(--health-muted);font-size:10px}
.lm-health-chart.is-compact .lm-health-tooltip{top:auto;bottom:100%}.lm-health-activity-detail{margin:10px 0 20px;flex-wrap:wrap}.lm-health-vital-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.lm-health-sleep-timeline>button{position:absolute;border:0;cursor:pointer;height:18px;min-width:1px;padding:0;top:29px;background:#8c6ae8}.lm-health-sleep-timeline>button.deep{top:43px;background:#6045bc}.lm-health-sleep-timeline>button.rem{top:15px;background:#b2a0f4}.lm-health-sleep-timeline>button.awake,.lm-health-sleep-timeline>button.restless{top:0;background:#f1ba8b}.lm-health-sleep-timeline>button:focus-visible{outline:2px solid var(--health-ink);outline-offset:-2px}.lm-health-stage-detail{background:var(--health-soft);padding:8px;border-radius:6px;font-size:11px;margin-bottom:12px}
.lm-health-manage{margin-top:20px;border-top:1px solid var(--health-border);padding-top:14px;font-size:11px}.lm-health-manage summary{cursor:pointer;color:var(--health-muted)}.lm-health-entry{display:flex;align-items:center;flex-wrap:wrap;gap:5px;padding:9px 0;border-bottom:1px solid var(--health-border)}.lm-health-entry>span:first-child{flex:1;min-width:140px}
.lm-health-period {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 18px;
    padding: 9px 12px;
    background: var(--health-surface);
    border: 1px solid var(--health-border);
    border-radius: 10px;
}
.lm-health-day-controls, .lm-health-range-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.lm-health-period button, .lm-health-period input, .lm-health-period select {
    min-height: 34px;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid var(--health-border);
    border-radius: 7px;
    background: var(--health-soft);
    color: var(--health-ink);
    font-size: 12px;
}
.lm-health-period button:disabled { opacity: .5; }
.lm-health-range-controls span { margin-left: 4px; }
.theme-dark .lm-health-period { color-scheme: dark; }
.lm-app.theme-dark .lm-health-period input {
    background: var(--health-soft);
    border-color: var(--health-border);
    color: var(--health-ink);
}
.lm-health-page .lm-health-chart:has(.lm-health-empty) { min-height: 0; }
.lm-health-page .lm-health-empty { min-height: 70px; padding: 12px 0; }
.lm-health-page .lm-health-empty i { display: none; }
.lm-health-page .lm-health-grid text { font-size: 11px; }
.lm-health-heart-reading { text-align: right; }
.lm-health-heart-reading strong { display: block; font-size: 24px; line-height: 1.1; }
.lm-health-heart-reading small { font-size: 11px; color: var(--health-muted); }
.lm-health-no-samples { padding: 10px 0; }
.lm-health-vitals .lm-health-chart { margin: 0 0 12px; }
.lm-health-vitals .lm-health-section-head { align-items: flex-start; }
@media (max-width: 850px) {
    .lm-health-history-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .lm-health-period { gap: 8px; }
    .lm-health-period button, .lm-health-period input, .lm-health-period select { min-height: 40px; }
    .lm-health-activity-detail { gap: 14px; }
}
