@font-face {
  font-family: Kanit;
  src: url("/fonts/kanit-regular-thai.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: Kanit;
  src: url("/fonts/kanit-regular-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Kanit;
  src: url("/fonts/kanit-bold-thai.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: Kanit;
  src: url("/fonts/kanit-bold-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: dark;
  --app-font: Kanit, "Leelawadee UI", "Noto Sans Thai", Arial, sans-serif;
  font-family: var(--app-font);
  color: #f2f4fa;
  background: #101114;
  --muted: #a6afbf;
  --line: #30343b;
  --panel: #1b1e23;
  --lime: #83e6b6;
  --purple: #c0afff;
  --blue: #73c9fa;
  --amber: #ffbc83;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
h1, h2, p { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
.app { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: #15171b; border-right: 1px solid #282b31; display: flex; flex-direction: column; padding: 28px 17px 23px; }
.brand { display: flex; align-items: center; gap: 9px; color: #f6f7fb; font: 700 1.06rem var(--app-font); letter-spacing: .03em; white-space: nowrap; }
.sidebar .brand { margin-left: 12px; }
.brand-mark { display: block; flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid #437367; }
nav { display: grid; gap: 6px; margin-top: 51px; }
nav button { display: flex; align-items: center; gap: 12px; border: 1px solid transparent; color: #aab3c3; background: none; padding: 8px 11px; min-height: 44px; border-radius: 9px; text-align: left; font-weight: 650; }
nav button:hover { background: #1b222d; }
nav button[aria-current] { background: #20342e; border-color: #34564b; color: #bef7dc; }
.nav-icon { width: 21px; text-align: center; font: 700 1.16rem Arial, sans-serif; }
.sidebar-source { display: grid; gap: 3px; padding: 13px 12px; margin-top: auto; border: 1px solid #2a313c; border-radius: 11px; }
.sidebar-source span, .sidebar-source small { color: var(--muted); font-size: .83rem; }
.sidebar-source strong { font-size: .94rem; }
main { min-width: 0; }
.topbar { background: #15171b; border-bottom: 1px solid #282b31; min-height: 66px; padding: 10px clamp(18px, 3.4vw, 56px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top-context { color: #b2bbc9; font-size: .95rem; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.mobile-brand { display: none; }
.source-chip { display: flex; align-items: center; gap: 7px; color: #c5ccda; font-size: .84rem; white-space: nowrap; }
.source-chip i { background: var(--amber); border-radius: 50%; width: 7px; height: 7px; flex-shrink: 0; }
.source-chip[data-active="mi"] i, .source-chip[data-active="garmin"] i { background: var(--lime); }
.connect, .secondary { border-radius: 9px; min-height: 42px; padding: 8px 14px; font-size: .91rem; font-weight: 750; }
.connect { color: #172115; background: var(--lime); border: 1px solid transparent; }
.connect:hover { background: #baf5d8; }
.secondary { background: transparent; border: 1px solid #454e5f; color: #f0f2fa; }
.secondary:hover { background: #29313e; }
.content { max-width: 1380px; margin: auto; padding: 29px clamp(18px, 3.4vw, 56px) 20px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 23px; }
.eyebrow { color: #b6c0d0; font-size: .89rem; font-weight: 750; }
h1 { font-size: clamp(2rem, 4.1vw, 3.25rem); line-height: 1.23; letter-spacing: -.04em; margin-top: 5px; }
h1:focus { outline: none; }
.date-control { display: flex; align-items: center; border: 1px solid #313a47; border-radius: 9px; background: #151a22; white-space: nowrap; }
.date-control > span { min-width: 61px; text-align: center; color: #e0e4ed; font-size: .89rem; }
.date-arrow { width: 36px; height: 38px; color: #e0e4ed; background: transparent; border: 0; font: 1.5rem Arial, sans-serif; border-radius: 7px; }
.date-arrow:hover:enabled { background: #252d39; }
.notice { padding: 10px 14px; color: #ffd9ae; background: #30291f; border: 1px solid #584735; border-radius: 9px; margin-bottom: 14px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 21px; }
.panel.connect-view { background: linear-gradient(135deg, #202c29, var(--panel) 75%); padding: clamp(20px, 4vw, 40px); }
.connect-view p { color: #c2cbd2; margin-top: 7px; }
.connect-view-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.panel h2, .section-heading h2 { font-size: 1.23rem; line-height: 1.35; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr); gap: 15px; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 239px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: radial-gradient(ellipse at 88% 75%, #233c35 0, transparent 67%), #182521; border-color: #36584b; }
.hero::after { content: ""; z-index: -1; position: absolute; inset: 0; background: repeating-linear-gradient(125deg, transparent 0 31px, #83e6b619 32px 33px, transparent 34px 83px); mask-image: linear-gradient(90deg, transparent 18%, black 100%); }
.hero-copy { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; }
.hero .eyebrow { letter-spacing: .16em; color: var(--lime); font: 700 .78rem var(--app-font); }
.hero h2 { line-height: 1.2; font-size: clamp(1.4rem, 2.65vw, 2.1rem); margin: 8px 0 12px; }
.hero p:not(.eyebrow) { color: #d0ddcf; font-size: .96rem; max-width: 32ch; }
.text-button { background: none; border: 0; color: #a5edc9; font-weight: 750; padding: 2px 0; font-size: .92rem; min-height: 34px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: white; }
.hero .text-button { margin-top: 14px; }
.meter { --ring-width: 11px; width: clamp(112px, 16vw, 173px); aspect-ratio: 1; position: relative; flex: none; display: grid; place-items: center; }
.meter-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 200deg, var(--meter-color) 0 var(--sweep), #8e97a345 var(--sweep) 320deg, transparent 320deg); mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring-width) - 1px), black calc(100% - var(--ring-width)), black calc(100% - 1px), transparent 100%); }
.meter-value { padding-top: 2px; display: grid; justify-items: center; gap: 4px; }
.meter-value strong { font: 700 clamp(2.3rem, 5.5vw, 4rem)/1 var(--app-font); letter-spacing: -.045em; color: #f3f5f6; font-variant-numeric: tabular-nums; }
.meter-value span { color: #d0d8d5; font-size: .83rem; white-space: nowrap; }
.score-panel { background: linear-gradient(155deg, #24292e, #191c21 62%); }
.score-help { border: 1px solid transparent; border-radius: 50%; width: 36px; height: 36px; color: #b7c2cf; background: transparent; font: 1.2rem Arial, sans-serif; }
.score-help:hover { background: #ffffff12; }
.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.daily-score { display: grid; place-items: center; align-content: start; gap: 3px; min-width: 0; min-height: 175px; color: inherit; padding: 12px 4px 11px; border: 1px solid color-mix(in srgb, var(--metric-color) 21%, #23262b); border-radius: 15px; background: radial-gradient(ellipse at 50% 28%, color-mix(in srgb, var(--metric-color) 12%, #1b1e23), #1b1e23 83%); }
.daily-score:hover { border-color: var(--metric-color); }
.daily-score-recovery { --metric-color: var(--lime); }
.daily-score-sleep { --metric-color: var(--purple); }
.daily-score-stress { --metric-color: var(--amber); }
.meter-compact { --ring-width: 8px; width: min(108px, 95%); margin-bottom: 5px; }
.meter-compact .meter-value strong { font-size: clamp(1.95rem, 3.2vw, 2.75rem); }
.daily-score b { color: var(--metric-color); font-size: 1rem; }
.daily-score small { color: #bec4ce; font-size: .8rem; }
.battery-panel { --energy: #83e6b6; background: linear-gradient(145deg, #202a29, #1b1e23 72%); }
.battery-medium { --energy: #8bdacf; }
.battery-low { --energy: #f0bf85; }
.battery-very-low { --energy: #f2a29b; }
.battery-missing, .battery-stale { --energy: #c4cbd3; }
.battery-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.battery-layout { margin-top: 8px; }
.readiness-panel { margin-bottom: 12px; }
.readiness-panel .battery-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 32%); gap: 21px; align-items: center; }
.battery-main { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 15px; }
.meter-battery { --ring-width: 10px; width: clamp(112px, 14vw, 152px); }
.meter-battery .meter-value { gap: 5px; }
.meter-battery .meter-value strong { font-size: clamp(2rem, 4.3vw, 3rem); }
.meter-battery .meter-value small { color: var(--muted); font-size: .83rem; font-weight: 400; letter-spacing: 0; }
.meter-battery .meter-value span { font-size: .81rem; text-align: center; line-height: 1.2; }
.battery-source, .battery-meta { color: #bec7d1; font-size: .82rem; }
.battery-state { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.battery-status { color: var(--energy); font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.battery-emoji { display: inline-grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--energy) 13%, #22292b); font: 1.16rem/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.battery-emoji.is-current { animation: battery-float 2.8s ease-in-out infinite; }
.battery-high .battery-emoji.is-current { animation-duration: 1.9s; }
.battery-low .battery-emoji.is-current, .battery-very-low .battery-emoji.is-current { animation: battery-breathe 4.2s ease-in-out infinite; }
@keyframes battery-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes battery-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(.89); } }
@media (prefers-reduced-motion: reduce) { .battery-state .battery-emoji.is-current { animation: none; } }
.battery-guidance { margin-top: 5px; font-size: .94rem; color: #ebf0f3; max-width: 36ch; }
.readiness-context { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.balance-item { display: grid; gap: 4px; place-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; background: #15191d; color: #e2e8ed; min-width: 0; }
.balance-item:hover { border-color: #718b83; }
.balance-item span { font-size: .86rem; text-align: center; }
.balance-item strong { font-size: 1.43rem; line-height: 1; }
.balance-recovery { color: var(--lime); }
.balance-stress { color: var(--amber); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.vitals-heading { margin: 23px 0 10px; }
.vitals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.overview-grid + .vitals-grid { margin-top: 15px; }
.vital { display: grid; align-content: start; gap: 8px; min-height: 111px; border-radius: 15px; padding: 14px; background: #1b1e23; border: 1px solid var(--line); min-width: 0; }
.vital span { color: #c4ccda; font-size: .89rem; }
.vital strong { font-size: clamp(1.12rem, 2vw, 1.65rem); line-height: 1.15; letter-spacing: -.025em; }
.vital small { color: #aeb9c9; font-size: .79rem; font-weight: 550; }
.vital .vital-hint { font-size: .81rem; color: #95a3b8; }
.lower-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr); gap: 15px; }
.full-trend { margin-top: 15px; }
.range, .provider-switch { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: #10141c; border: 1px solid #303846; }
.range button, .provider-switch button { color: #b6c0d0; background: transparent; border: 0; border-radius: 6px; padding: 4px 7px; min-height: 30px; white-space: nowrap; font-size: .83rem; }
.range button[aria-pressed="true"], .provider-switch button[aria-pressed="true"] { color: #f4f6fb; background: #354052; }
.trend canvas { display: block; width: 100%; height: 145px; margin-top: 11px; }
.chart-labels { margin-left: 27px; display: flex; justify-content: space-between; color: var(--muted); font-size: .79rem; }
.chart-data { color: var(--muted); margin-top: 8px; font-size: .8rem; }
.chart-data summary { cursor: pointer; width: max-content; }
.chart-data div { display: grid; grid-template-columns: repeat(auto-fit, minmax(83px, 1fr)); gap: 5px; margin-top: 6px; }
.chart-data b { color: #eef2f8; }
.activity-list { list-style: none; margin: 11px 0 0; padding: 0; }
.activity-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.activity-list b { font-size: .95rem; overflow-wrap: anywhere; }
.activity-list small { display: block; font-size: .83rem; color: var(--muted); }
.activity-icon { display: grid; place-items: center; width: 33px; height: 33px; color: var(--blue); background: #273a49; border-radius: 9px; }
.empty { color: var(--muted); font-size: .96rem; margin-top: 12px; }
.sleep-hero { background: radial-gradient(ellipse at 85% 60%, #393454 0, transparent 68%), #26223b; border-color: #484363; }
.sleep-hero .eyebrow { color: var(--purple); }
.sleep-hero::after { background: repeating-linear-gradient(125deg, transparent 0 31px, #b9b4ff20 32px 33px, transparent 34px 83px); }
.stress-hero { background: radial-gradient(ellipse at 85% 60%, #4a382a 0, transparent 70%), #2b2220; border-color: #5a473b; }
.stress-hero .eyebrow { color: var(--amber); }
.stress-hero::after { background: repeating-linear-gradient(125deg, transparent 0 31px, #ffbc8324 32px 33px, transparent 34px 83px); }
.stage-bar { display: flex; height: 16px; gap: 3px; margin: 18px 0 13px; }
.stage-bar i { border-radius: 4px; }
.stage-key { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.stage-key div { display: grid; gap: 3px; }
.stage-key span { display: flex; align-items: center; gap: 5px; font-size: .86rem; color: var(--muted); }
.stage-key i { width: 7px; height: 7px; border-radius: 50%; }
.stage-key b { font-size: .87rem; }
.detail-value { font-weight: 700; margin-top: 7px; }
.detail-list { margin-top: 8px; }
.detail-list > div { display: flex; justify-content: space-between; align-items: center; min-height: 42px; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border: 0; }
.detail-list span { font-size: .95rem; }
.detail-list span small { display: block; }
.detail-list small { color: var(--muted); font-size: .81rem; font-weight: 500; }
.detail-list b { white-space: nowrap; font-size: 1.08rem; }
.vital-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
footer { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 21px; padding-top: 11px; border-top: 1px solid #252d38; color: #9da9bd; font-size: .81rem; }
footer span:first-child { color: #e2e6ef; font-weight: 750; }
footer button { background: none; border: 0; padding: 0; color: #bac6da; margin-left: auto; text-decoration: underline; text-underline-offset: 3px; }
dialog { border-radius: 15px; border: 1px solid #40495a; width: min(92vw, 490px); max-height: 90dvh; background: #171d26; color: #f5f6fa; padding: 22px; }
dialog::backdrop { background: #05070bc9; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-top h2 { font-size: 1.45rem; }
.icon-button { color: #f5f6fa; border: 1px solid #465163; background: #232c39; border-radius: 7px; width: 34px; height: 34px; font-size: 1.25rem; }
dialog p { margin: 13px 0 6px; color: #d1d9e6; }
dialog a { color: var(--lime); display: inline-block; margin: 5px 0; }
dialog code { overflow-wrap: anywhere; }
dialog label { display: block; margin: 12px 0 5px; font-weight: 650; }
dialog input { width: 100%; border-radius: 7px; min-height: 44px; padding: 8px; color: #fff; background: #0e141d; border: 1px solid #465163; }
dialog input::file-selector-button { margin-right: 8px; }
dialog small { display: block; margin-top: 6px; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 13px; }
.connection-status { color: #ffd8a1; }
.provider-switch { margin-top: 11px; width: fit-content; }
.provider-switch button { font-size: .88rem; padding-inline: 10px; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 176px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .panel { padding: 16px; }
  .vital-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { height: auto; position: fixed; top: auto; inset-inline: 0; bottom: 0; z-index: 5; padding: 5px 8px max(5px, env(safe-area-inset-bottom)); background: #16181d; border: 0; border-top: 1px solid #343940; }
  .sidebar .brand, .sidebar-source, .top-context { display: none; }
  nav { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; gap: 2px; }
  nav button { flex-direction: column; justify-content: center; text-align: center; gap: 3px; padding: 3px 1px; min-height: 52px; font-size: .8rem; white-space: nowrap; }
  .nav-icon { font-size: 1.15rem; }
  .mobile-brand { display: flex; }
  .topbar { min-height: 62px; }
  .content { padding-top: 22px; padding-bottom: 78px; }
  .meter { width: clamp(110px, 22vw, 163px); }
}
@media (max-width: 550px) {
  .content { padding-inline: 13px; }
  .topbar { padding-inline: 13px; }
  .top-actions { gap: 6px; }
  .topbar .brand { font-size: .78rem; letter-spacing: .1em; gap: 6px; }
  .topbar .brand-mark { width: 26px; height: 26px; }
  .source-chip { font-size: .72rem; gap: 4px; }
  .topbar .connect { font-size: .78rem; min-height: 35px; padding: 4px 7px; }
  .overview-grid, .lower-grid, .vital-sections { grid-template-columns: 1fr; gap: 11px; }
  .readiness-panel .battery-layout { grid-template-columns: 1fr; gap: 13px; }
  .battery-main { gap: 10px; }
  .hero { min-height: 175px; padding: 15px; }
  .meter { --ring-width: 8px; width: 109px; }
  .meter-battery { width: clamp(113px, 34vw, 142px); }
  .score-panel { padding: 11px; }
  .score-panel > .section-heading { padding-inline: 3px; }
  .score-grid { gap: 6px; margin-top: 6px; }
  .daily-score { min-height: 133px; border-radius: 12px; }
  .daily-score b { font-size: .9rem; }
  .daily-score small { font-size: .76rem; }
  .meter-compact { --ring-width: 6px; width: min(78px, 94%); margin-bottom: 1px; }
  .meter-compact .meter-value strong { font-size: clamp(1.55rem, 7vw, 2rem); }
  .vitals-heading { margin-top: 17px; }
  .vitals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .vital { min-height: 88px; padding: 11px; gap: 5px; }
  .heading { margin-bottom: 15px; }
  .date-arrow { width: 31px; height: 33px; }
  .date-control > span { min-width: 48px; }
}
@media (max-width: 360px) {
  .topbar .brand { letter-spacing: .045em; gap: 4px; }
  .topbar .brand-mark { width: 23px; height: 23px; }
  .daily-score { min-height: 119px; }
  .daily-score small { font-size: .75rem; }
}
