:root,
:root[data-theme="light"] {
  --bg: #F2F2F7;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #FFFFFF;
  --surface-2: rgba(235, 235, 242, 0.72);
  --surface-3: #E5E5EA;
  --surface-hover: rgba(248, 248, 252, 0.95);
  --text: #1C1C1E;
  --text-2: #5A5A60;
  --text-3: #74747C;
  --border: rgba(60, 60, 67, 0.10);
  --hairline: rgba(60, 60, 67, 0.18);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.045), 0 1px 2px rgba(0, 0, 0, 0.03);

  /* iOS 26 Liquid Glass Variables (Light) */
  --lg-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.76) 0%, rgba(255, 255, 255, 0.56) 100%);
  --lg-pill-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.94) 0%, rgba(246, 248, 255, 0.78) 100%);
  --lg-border: rgba(255, 255, 255, 0.78);
  --lg-specular:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.92),
    inset 0 -1px 1.5px rgba(255, 255, 255, 0.55),
    inset 1px 0 1px rgba(100, 210, 255, 0.16),
    inset -1px 0 1px rgba(255, 45, 85, 0.10),
    0 12px 32px rgba(15, 23, 42, 0.10),
    0 2px 6px rgba(15, 23, 42, 0.05);
  --lg-pill-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.45),
    0 4px 14px rgba(15, 23, 42, 0.09);

  --input-bg: rgba(235, 235, 240, 0.85);
  --seg-bg: rgba(118, 118, 128, 0.13);
  --seg-active: rgba(255, 255, 255, 0.92);
  --seg-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 8px rgba(0, 0, 0, 0.10);

  --apple-blue: #007AFF;
  --apple-red: #FF2D55;
  --apple-green: #28CD41;
  --apple-teal: #30B0C7;
  --apple-cyan: #32ADE6;
  --apple-indigo: #5856D6;
  --apple-deep: #4338CA;
  --apple-light-sleep: #007AFF;
  --apple-awake: #FF6B4A;
  --apple-orange: #FF9500;
  --apple-purple: #AF52DE;

  --ring-move: #FA114F;
  --ring-ex: #30D158;
  --ring-stand: #00B4F0;
  --ring-track: rgba(120, 120, 128, 0.15);

  --delta-up-bg: rgba(40, 205, 65, 0.13);
  --delta-up-fg: #18862B;
  --delta-down-bg: rgba(255, 45, 85, 0.13);
  --delta-down-fg: #D70039;
  --chart-grid: rgba(60, 60, 67, 0.10);
  --baseline-band: rgba(40, 205, 65, 0.15);

  /* Apple Fitness Metric Colors (Light readable) */
  --fit-yellow: #C88A00;
  --fit-cyan: #0095D9;
  --fit-red: #F51E4A;
  --fit-green: #16A336;
  --fit-purple: #9333EA;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: rgba(28, 28, 30, 0.86);
  --surface-solid: #1C1C1E;
  --surface-2: rgba(44, 44, 46, 0.78);
  --surface-3: #3A3A3C;
  --surface-hover: rgba(40, 40, 44, 0.92);
  --text: #FFFFFF;
  --text-2: #AEAEB2;
  --text-3: #8E8E93;
  --border: rgba(255, 255, 255, 0.11);
  --hairline: rgba(255, 255, 255, 0.18);
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.50);

  /* iOS 26 Liquid Glass Variables (OLED Dark) */
  --lg-bg: linear-gradient(155deg, rgba(48, 48, 54, 0.68) 0%, rgba(26, 26, 30, 0.56) 100%);
  --lg-pill-bg: linear-gradient(155deg, rgba(78, 78, 86, 0.72) 0%, rgba(48, 48, 54, 0.58) 100%);
  --lg-border: rgba(255, 255, 255, 0.20);
  --lg-specular:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.26),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    inset 1px 0 1px rgba(100, 210, 255, 0.12),
    inset -1px 0 1px rgba(255, 55, 95, 0.10),
    0 14px 34px rgba(0, 0, 0, 0.62);
  --lg-pill-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.28),
    inset 0 -1px 1px rgba(255, 255, 255, 0.09),
    0 6px 16px rgba(0, 0, 0, 0.45);

  --input-bg: rgba(44, 44, 46, 0.85);
  --seg-bg: rgba(118, 118, 128, 0.24);
  --seg-active: rgba(74, 74, 80, 0.90);
  --seg-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 2px 8px rgba(0, 0, 0, 0.40);

  --apple-blue: #0A84FF;
  --apple-red: #FF375F;
  --apple-green: #30D158;
  --apple-teal: #64D2FF;
  --apple-cyan: #5AC8FA;
  --apple-indigo: #5E5CE6;
  --apple-deep: #6366F1;
  --apple-light-sleep: #3B82F6;
  --apple-awake: #FF785A;
  --apple-orange: #FF9F0A;
  --apple-purple: #BF5AF2;

  --ring-move: #FA114F;
  --ring-ex: #92E82A;
  --ring-stand: #00E5FF;
  --ring-track: rgba(255, 255, 255, 0.14);

  --delta-up-bg: rgba(48, 209, 88, 0.16);
  --delta-up-fg: #4ADE80;
  --delta-down-bg: rgba(255, 55, 95, 0.16);
  --delta-down-fg: #FF6482;
  --chart-grid: rgba(255, 255, 255, 0.10);
  --baseline-band: rgba(48, 209, 88, 0.18);

  /* Apple Fitness Metric Colors (OLED vibrant) */
  --fit-yellow: #FFD60A;
  --fit-cyan: #32D7EE;
  --fit-red: #FF375F;
  --fit-green: #92E82A;
  --fit-purple: #BF5AF2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Soft Ambient Backdrop Glow for Liquid Glass Refraction */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 42% at 15% 8%, rgba(255, 45, 85, 0.075), transparent 70%),
    radial-gradient(55% 45% at 88% 12%, rgba(50, 173, 230, 0.085), transparent 72%),
    radial-gradient(65% 48% at 50% 92%, rgba(88, 86, 214, 0.065), transparent 72%);
}

:root[data-theme="dark"] body::before {
  background:
    radial-gradient(60% 42% at 15% 8%, rgba(255, 55, 95, 0.11), transparent 70%),
    radial-gradient(55% 45% at 88% 12%, rgba(10, 132, 255, 0.11), transparent 72%),
    radial-gradient(65% 48% at 50% 92%, rgba(94, 92, 230, 0.09), transparent 72%);
}

button,
input {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.svg-defs {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* Theme Icon Visibility */
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }

/* -----------------------------------------------------------------------
   iOS 26 Liquid Glass Surface Layer (backdrop refraction isolated to ::before)
----------------------------------------------------------------------- */
.liquid-glass,
.liquid-pill,
.liquid-card {
  isolation: isolate;
  border: 1px solid var(--lg-border);
}

.liquid-pill,
.liquid-card {
  position: relative;
}

.liquid-glass::before,
.liquid-pill::before,
.liquid-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: var(--lg-bg);
  backdrop-filter: blur(22px) saturate(195%);
  -webkit-backdrop-filter: blur(22px) saturate(195%);
  box-shadow: var(--lg-specular);
}

.liquid-pill::before {
  background: var(--lg-pill-bg);
  box-shadow: var(--lg-pill-shadow);
}

@supports (backdrop-filter: url(#lg-refract-pill)) {
  .liquid-glass::before,
  .liquid-pill::before {
    backdrop-filter: url(#lg-refract-pill) blur(20px) saturate(195%);
  }
}

.liquid-glass > *,
.liquid-pill > *,
.liquid-card > * {
  position: relative;
  z-index: 2;
}

.circle-nav-btn::before {
  background: var(--lg-pill-bg);
  box-shadow: var(--lg-pill-shadow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -----------------------------------------------------------------------
   Auth Gate
----------------------------------------------------------------------- */
.auth-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.auth-theme-pos {
  position: fixed !important;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  border-radius: 28px;
  padding: 32px 26px;
}

.auth-hero {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(255, 45, 85, 0.18);
  margin-bottom: 12px;
}

.auth-hero h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-hero p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.ios-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ios-input:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.ios-btn-primary {
  width: 100%;
  margin-top: 14px;
  min-height: 46px;
  padding: 11px 18px;
  border: none;
  border-radius: 14px;
  background: var(--apple-blue);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s cubic-bezier(0.22, 1, 0.36, 1);
}

.ios-btn-primary:hover { opacity: 0.92; }
.ios-btn-primary:active { transform: scale(0.985); }
.ios-btn-primary:disabled { opacity: 0.55; cursor: default; }

.ios-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-solid);
  color: var(--apple-blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s ease;
}

.ios-btn-secondary:hover { background: var(--surface-2); }
.ios-btn-secondary:active { transform: scale(0.95); }

.ios-btn-danger {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--apple-red);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.err-text {
  min-height: 18px;
  margin: 10px 0 0;
  text-align: center;
  color: var(--apple-red);
  font-size: 13px;
}

.icon-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.icon-circle-btn:active {
  transform: scale(0.92);
}

.icon-circle-btn svg {
  width: 18px;
  height: 18px;
}

/* -----------------------------------------------------------------------
   Shell Navigation (Desktop Sidebar + Mobile Liquid Dock)
----------------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 232px;
  padding: 20px 14px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-top {
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar-brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-util-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-util-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-util-btn svg {
  width: 18px;
  height: 18px;
}

.danger-text {
  color: var(--apple-red) !important;
}

.mobile-header,
.bottom-dock,
.wo-mobile-back-bar,
.mobile-only {
  display: none;
}

/* Main Content */
.main-content {
  margin-left: 232px;
  padding: 26px 28px 60px;
}

.tab-panel {
  max-width: 1080px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.large-title {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.desktop-sync-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--delta-up-fg);
  background: var(--delta-up-bg);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 22px 2px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-sub {
  font-size: 12px;
  color: var(--text-2);
}

.text-link-btn {
  border: none;
  background: transparent;
  color: var(--apple-blue);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}

/* -----------------------------------------------------------------------
   Cards
----------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.interactive-card {
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s ease;
}

.interactive-card:hover { transform: translateY(-1px); }
.interactive-card:active {
  transform: scale(0.975);
  transition-duration: 0.1s;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-note {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-2);
}

.dot-badge {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------
   Tab 1: Summary
----------------------------------------------------------------------- */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.hero-card {
  padding: 18px 20px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hero-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.cat-dot {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cat-dot svg {
  width: 14px;
  height: 14px;
}

.hero-meta-date {
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rings-body {
  display: flex;
  align-items: center;
  gap: 18px;
}

.rings-svg-wrap {
  width: 114px;
  height: 114px;
  flex-shrink: 0;
}

.rings-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ring-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ring-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ring-swatch {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ring-val {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ring-goal {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

.sleep-hero-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sleep-big {
  font-size: 31px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.sleep-score-pill {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(88, 86, 214, 0.13);
  color: var(--apple-indigo);
  white-space: nowrap;
}

.stage-pill-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}

.stage-seg {
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
}

.sleep-hero-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-2);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 15px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.metric-card:hover { transform: translateY(-1px); }
.metric-card:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.metric-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.metric-icon-inline {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon-inline svg {
  width: 15px;
  height: 15px;
}

.metric-date-chev {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.metric-card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.metric-left { min-width: 0; }

.metric-num-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: nowrap;
}

.metric-num {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.metric-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-spark {
  width: 132px;
  height: 48px;
  flex-shrink: 0;
}

/* Grouped List */
.grouped-card {
  padding: 2px 0;
  overflow: hidden;
}

.grouped-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.grouped-row:last-child { border-bottom: none; }
.grouped-row:hover { background: var(--surface-hover); }

.grouped-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wo-sport-badge,
.cat-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wo-sport-badge {
  background: rgba(40, 205, 65, 0.13);
  color: var(--apple-green);
}

.wo-sport-badge svg {
  width: 19px;
  height: 19px;
}

.cat-icon-box svg {
  width: 22px;
  height: 22px;
}

.grouped-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grouped-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.grouped-row-right {
  text-align: right;
  flex-shrink: 0;
}

.grouped-val {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.grouped-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}

.gps-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
}

/* -----------------------------------------------------------------------
   Pixel-Exact Apple Health Metric Detail View Stack
----------------------------------------------------------------------- */
.detail-nav-bar {
  position: sticky;
  top: max(6px, env(safe-area-inset-top));
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 6px 2px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--bg) 52%, transparent 100%);
}

.circle-nav-btn {
  position: relative;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.circle-nav-btn:active {
  transform: scale(0.92);
}

.circle-nav-btn .chev-svg {
  width: 21px;
  height: 21px;
  margin-left: -2px;
}

.circle-nav-btn svg:not(.chev-svg) {
  width: 18px;
  height: 18px;
}

.detail-nav-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-nav-bar .detail-nav-title,
.wo-mobile-back-bar .detail-nav-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 120px);
  pointer-events: none;
  z-index: 2;
}

#detail-theme-btn,
#all-health-theme-btn,
.back-pill-btn,
.pill-action-btn {
  position: relative;
  z-index: 3;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scope-seg {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 4px;
  border-radius: 999px;
  background: var(--seg-bg);
  gap: 0;
}

.scope-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 4px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.scope-seg:not(.has-thumb) .scope-btn.active {
  background: var(--seg-active);
  box-shadow: var(--seg-shadow);
}

.scope-btn:active {
  transform: scale(0.96);
}

.seg-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--seg-count, 5));
  border-radius: 999px;
  background: var(--seg-active);
  box-shadow: var(--seg-shadow);
  z-index: 1;
  pointer-events: none;
  transform: translateX(calc(var(--seg-idx, 0) * 100%));
  transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
}

.apple-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px 16px 18px;
  box-shadow: var(--shadow-card);
}

.period-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stepper-arrow {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s ease;
}

.stepper-arrow:active:not(:disabled) {
  transform: scale(0.88);
  transition-duration: 0.08s;
}

.stepper-arrow:disabled {
  opacity: 0.30;
  cursor: default;
}

.stepper-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.scrub-hero {
  min-height: 76px;
  margin-bottom: 10px;
}

.scrub-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.scrub-main-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.scrub-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
}

.scrub-unit {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-2);
}

.scrub-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
}

.svg-chart-wrap {
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.apple-svg-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.scrub-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

/* Highlights Card */
.highlights-section-title {
  margin: 4px 4px 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.highlight-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.highlight-badge {
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.highlight-insight {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.hl-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hl-bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hl-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.hl-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.hl-track {
  height: 11px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  width: 100%;
}

.hl-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 10px;
}

.hl-fill.muted-fill {
  background: var(--text-3) !important;
  opacity: 0.65;
}

.hl-val {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

/* Sleep Amounts (各阶段时长占比 Apple Health high-contrast layout) */
.sleep-amount-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 6px 2px 4px;
}

.sleep-amount-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sleep-amount-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sleep-amount-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sleep-amount-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.sleep-amount-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sleep-amount-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sleep-amount-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-left: 4px;
}

.sleep-amount-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.sleep-amount-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 8px;
  transform-origin: left center;
  animation: barFillRight 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

/* iOS 18 Overnight Vitals, Recent Trends, Athletic & Running Form Cards */
.vitals-header-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--delta-up-bg);
  color: var(--delta-up-fg);
}

.vitals-header-pill.warn {
  background: var(--delta-down-bg);
  color: var(--delta-down-fg);
}

.vitals-list {
  display: flex;
  flex-direction: column;
}

.vitals-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.vitals-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.vitals-row:first-child {
  padding-top: 2px;
}

.vitals-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.vitals-val {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.vitals-val.outlier {
  color: var(--apple-red);
}

.vitals-bar-wrap {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
}

.vitals-bar-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
}

.vitals-typical-band {
  position: absolute;
  left: 25%;
  width: 50%;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: rgba(48, 176, 199, 0.28);
}

.vitals-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--apple-teal);
  border: 2px solid var(--surface-solid);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.vitals-dot.outlier {
  background: var(--apple-red);
}

.vitals-range-txt {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trends-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trend-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 13px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trend-card:active {
  transform: scale(0.97);
}

.trend-arrow-badge {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-2);
}

.trend-arrow-badge.good {
  background: var(--delta-up-bg);
  color: var(--delta-up-fg);
}

.trend-arrow-badge.warn {
  background: rgba(255, 149, 0, 0.16);
  color: var(--apple-orange);
}

.trend-info {
  min-width: 0;
  flex: 1;
}

.trend-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.trend-main {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.trend-sub {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.athletic-grid .metric-card:nth-child(3) {
  grid-column: span 2;
}

.race-pred-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.race-pred-tile {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 12px 14px;
}

.race-pred-dist {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.race-pred-time {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  color: var(--apple-green);
}

.race-pred-pace {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.wo-training-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.wo-tbadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.balance-gauge-wrap {
  margin: 4px 0 12px;
}

.balance-lr-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.balance-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: visible;
}

.balance-ideal-zone {
  position: absolute;
  left: 38%;
  width: 24%;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: rgba(48, 209, 88, 0.25);
}

.balance-center-tick {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 2px;
  transform: translateX(-50%);
  background: var(--text-3);
  border-radius: 2px;
}

.balance-marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--fit-cyan);
  border: 2px solid var(--surface-solid);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.posture-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.posture-seg {
  display: inline-flex;
  background: var(--seg-bg);
  padding: 2px;
  border-radius: 10px;
  gap: 2px;
}

.chart-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Sleep Stage Summary Rows in Detail */
.sleep-stage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.stage-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.sleep-mode-seg {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 12px;
  padding: 3px;
  border-radius: 999px;
  background: var(--seg-bg);
  gap: 0;
  width: 100%;
}

.sleep-mode-seg .seg-thumb {
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--seg-count, 2));
  border-radius: 999px;
}

.sleep-mode-seg .seg-btn {
  position: relative;
  z-index: 2;
  border-radius: 999px;
  transition: color 0.2s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.sleep-mode-seg.has-thumb .seg-btn.active {
  background: transparent;
  box-shadow: none;
}

/* Apple Fitness Week Strip & Tri-Rings */
.fitness-week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 14px 12px;
  box-shadow: var(--shadow-card);
}

.fitness-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.week-day-btn {
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.16s ease;
}

.week-day-btn:active:not(:disabled) {
  transform: scale(0.92);
  transition-duration: 0.08s;
}

.week-day-btn.selected {
  background: var(--surface-2);
}

.week-day-btn.future {
  opacity: 0.35;
}

.wk-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.wk-num {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fitness-big-rings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.fitness-big-svg-wrap {
  width: 168px;
  height: 168px;
}

.fitness-tri-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tri-stat-box {
  text-align: center;
}

.tri-stat-lbl {
  font-size: 12px;
  font-weight: 700;
}

.tri-stat-num {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.tri-stat-goal {
  font-size: 11px;
  color: var(--text-2);
}

.hourly-triple-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hourly-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-card);
}

/* Emotion Bar */
.emo-bar-wrap {
  margin-top: 8px;
}

.emo-pill-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  margin: 8px 0;
}

/* Show All Data Drawer */
.all-data-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--apple-blue);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.all-data-list {
  margin-top: 10px;
}

/* Isolated Daytime Nap Card */
.nap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 15px 18px;
  box-shadow: var(--shadow-card);
}

.nap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.nap-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--apple-purple);
}

.nap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.nap-time {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.nap-dur {
  font-size: 17px;
  font-weight: 800;
  color: var(--apple-purple);
  font-variant-numeric: tabular-nums;
}

/* Apple Fitness Workouts List & Detail Cards */
.workout-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.wo-list-item {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 13px 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.14s ease, background-color 0.14s ease, transform 0.12s ease;
}

.wo-list-item:hover { background: var(--surface-hover); }
.wo-list-item:active { transform: scale(0.985); }
.wo-list-item.active {
  border-color: var(--fit-green);
  background: rgba(48, 209, 88, 0.08);
}

.wo-list-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wo-list-circle,
.fit-circle-badge {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(48, 209, 88, 0.16);
  color: var(--fit-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wo-list-circle svg,
.fit-circle-badge svg {
  width: 22px;
  height: 22px;
}

.wo-list-sport {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.wo-list-big {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fit-cyan);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 2px;
}

.wo-list-sub {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.wo-list-right {
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.fit-empty-msg {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
}

.fit-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.fit-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.fit-sport-name {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fit-sub-time {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.fit-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

.fit-stat-cell {
  min-width: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.fit-stat-cell.no-border {
  border-bottom: none;
  padding-bottom: 2px;
}

.fit-stat-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.fit-stat-val {
  margin-top: 2px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.fit-stat-unit {
  font-size: 14px;
  font-weight: 700;
  margin-left: 2px;
}

.pace-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.pace-legend-txt {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}

.pace-legend-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF3B30 0%, #FF9500 25%, #FFD60A 50%, #8CE026 75%, #28CD41 100%);
}

/* HR Zones List */
.hr-zones-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.hr-zone-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
}

.hr-zone-meta {
  min-width: 0;
}

.hr-zone-name {
  font-size: 12px;
  font-weight: 700;
}

.hr-zone-bpm {
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.hr-zone-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.hr-zone-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}

.hr-zone-dur {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Apple Fitness Splits Visual List */
.splits-list {
  display: flex;
  flex-direction: column;
}

.split-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.split-row:last-child { border-bottom: none; }

.split-idx {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}

.split-bar-wrap {
  min-width: 0;
}

.split-bar-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.split-pace-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--fit-cyan);
}

.split-fast-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(48, 209, 88, 0.16);
  color: var(--fit-green);
}

.split-bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.split-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--fit-cyan);
}

.split-right {
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
}

.split-hr {
  font-weight: 700;
  color: var(--fit-red);
}

/* -----------------------------------------------------------------------
   Tab 2: Workouts & GPS Routes
----------------------------------------------------------------------- */
.workouts-toolbar { margin-bottom: 14px; }

.subtle-caption {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 8px;
}

.h-scroll-pills {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  max-width: 100%;
}

.h-scroll-pills::-webkit-scrollbar { display: none; }

.chip-pill {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.chip-pill.active {
  background: var(--apple-blue);
  color: #FFFFFF;
  border-color: transparent;
}

.workouts-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 4px;
}

.wo-card-btn {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 13px 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.wo-card-btn:hover { background: var(--surface-hover); }
.wo-card-btn.active {
  border-color: var(--apple-blue);
  background: rgba(0, 122, 255, 0.07);
}

.wo-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.wo-card-date {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.wo-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.day-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.day-tile-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.day-tile-val {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#workout-map {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 330px;
  background: var(--surface-2);
}

#workout-map .leaflet-overlay-pane svg path {
  shape-rendering: geometricPrecision;
}

#workout-map .leaflet-zoom-animated {
  will-change: auto !important;
}

.chart-box-sm {
  width: 100%;
  height: 230px;
}

.empty-inline-box {
  padding: 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  border: 1px dashed var(--hairline);
  border-radius: 16px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
}

tr:last-child td { border-bottom: none; }

/* -----------------------------------------------------------------------
   Tab 3: Browse (Day Snapshot Controls)
----------------------------------------------------------------------- */
.day-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.day-nav-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 4px 8px;
}

.circle-step-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.circle-step-btn:disabled { opacity: 0.35; cursor: default; }

.ios-date-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  padding: 4px 4px;
}

/* -----------------------------------------------------------------------
   Tab 4: More / Settings
----------------------------------------------------------------------- */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.row-title { font-size: 15px; font-weight: 600; }
.row-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.segmented-control {
  display: inline-flex;
  background: var(--seg-bg);
  padding: 3px;
  border-radius: 12px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seg-btn.active {
  background: var(--seg-active);
  box-shadow: var(--seg-shadow);
}

.kv-list { display: flex; flex-direction: column; }

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kv-row:last-child { border-bottom: none; }
.kv-k { color: var(--text-2); }
.kv-v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.code-block {
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 120;
  pointer-events: none;
}

/* -----------------------------------------------------------------------
   Mobile Responsive (< 960px) + iOS 26 Liquid Glass Floating Dock
----------------------------------------------------------------------- */
@media (max-width: 959px) {
  .sidebar { display: none; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 40;
    margin: 8px 12px 4px;
    height: 52px;
    padding: 0 12px 0 14px;
    border-radius: 999px;
  }

  .mobile-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .mobile-brand-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    flex-shrink: 0;
  }

  .mobile-page-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .mobile-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .sync-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--delta-up-bg);
    color: var(--delta-up-fg);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
  }

  .sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
  }

  .main-content {
    margin-left: 0;
    padding: 10px 14px calc(98px + env(safe-area-inset-bottom));
  }

  .app-shell.detail-active .main-content {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .app-shell.detail-active .mobile-header,
  .app-shell.detail-active .bottom-dock,
  .app-shell.wo-detail-active .mobile-header,
  .app-shell.wo-detail-active .bottom-dock,
  .app-shell.wo-detail-active #tab-workouts > .page-head,
  .app-shell.wo-detail-active #tab-workouts > .workouts-toolbar {
    display: none !important;
  }

  .app-shell.wo-detail-active .main-content {
    padding-top: 8px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .page-head .large-title,
  .desktop-sync-tag {
    display: none;
  }

  .page-head { margin-bottom: 10px; }
  .mobile-only { display: block; }

  .hero-grid,
  .hourly-triple-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 15px;
    border-radius: 20px;
  }

  /* Mobile Workouts Master-Detail */
  .workouts-layout { display: block; }
  .workout-list { max-height: none; overflow: visible; padding-right: 0; }
  .workout-detail-panel { display: none; }
  .workouts-layout.mobile-detail-open .workout-list { display: none; }
  .workouts-layout.mobile-detail-open .workout-detail-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .workouts-layout.mobile-detail-open .wo-mobile-back-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 46px;
    position: sticky;
    top: max(6px, env(safe-area-inset-top));
    z-index: 60;
    padding: 6px 2px;
    margin: 0 0 12px;
    background: linear-gradient(180deg, var(--bg) 52%, transparent 100%);
  }

  .back-pill-btn {
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .pill-action-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  #workout-map { height: 265px; }

  /* Floating iOS 26 Liquid Glass Capsule Bottom Dock */
  .bottom-dock {
    display: block;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 50;
    border-radius: 999px;
    padding: 5px;
    transition: left 0.28s cubic-bezier(0.32, 0.72, 0, 1),
                right 0.28s cubic-bezier(0.32, 0.72, 0, 1),
                padding 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .bottom-dock.dock-compact {
    left: 44px;
    right: 44px;
    padding: 3px 4px;
  }

  .bottom-dock-inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .dock-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 25%;
    border-radius: 999px;
    background: var(--lg-pill-bg);
    border: 1px solid var(--lg-border);
    box-shadow: var(--lg-pill-shadow);
    z-index: 1;
    pointer-events: none;
    transform: translateX(calc(var(--active-idx, 0) * 100%));
    transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .dock-indicator.dragging {
    transition: transform 0.04s linear !important;
    transform: translateX(calc(var(--active-idx, 0) * 100%)) scale(1.045);
    box-shadow: var(--lg-pill-shadow), 0 6px 20px rgba(0, 122, 255, 0.16);
  }

  .bottom-tab-btn {
    position: relative;
    z-index: 2;
    border: none;
    background: transparent;
    color: var(--text-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 2px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.16s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), min-height 0.26s ease, gap 0.22s ease;
  }

  .bottom-tab-btn span {
    max-height: 14px;
    opacity: 1;
    transition: max-height 0.24s ease, opacity 0.18s ease;
  }

  .bottom-dock.dock-compact .bottom-tab-btn {
    min-height: 38px;
    gap: 0;
  }

  .bottom-dock.dock-compact .bottom-tab-btn span {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
  }

  .bottom-tab-btn svg {
    width: 21px;
    height: 21px;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bottom-tab-btn.active {
    color: var(--apple-blue);
  }

  .bottom-tab-btn.active svg {
    transform: scale(1.08);
  }

  .bottom-tab-btn:active {
    transform: scale(0.92);
    transition-duration: 0.08s;
  }
}

@media (max-width: 640px) {
  .summary-grid { grid-template-columns: 1fr; }
  .athletic-grid .metric-card:nth-child(3) { grid-column: auto; }
  .day-metrics-grid, .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rings-body { gap: 14px; }
  .rings-svg-wrap { width: 102px; height: 102px; }
  .metric-spark { width: 124px; height: 44px; }
  .scrub-value { font-size: 30px; }
  .fit-stat-val { font-size: 24px; }
  .hr-zone-row { grid-template-columns: 92px minmax(0, 1fr) 56px; }
  .card-header .action-group #wo-gpx-btn { display: none !important; }
  .vitals-row { grid-template-columns: 96px minmax(0, 1fr) 64px; gap: 8px; }
}

/* -----------------------------------------------------------------------
   Apple Native-Grade Smooth Animation Engine (V6)
----------------------------------------------------------------------- */

/* 1. Activity Rings Sweep Animation */
.ring-fg {
  stroke-dashoffset: var(--target-offset);
  animation: ringSweep 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--ring-delay, 0ms) both;
}

@keyframes ringSweep {
  from {
    stroke-dashoffset: var(--circ);
  }
  to {
    stroke-dashoffset: var(--target-offset);
  }
}

/* 2. SVG Chart Elements (Bars, Range Capsules, Sleep Blocks & Bridges) */
.svg-bar-grow {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: barGrowUp 0.52s cubic-bezier(0.22, 1, 0.36, 1) var(--stagger, 0ms) backwards;
  transition:
    opacity 0.14s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes barGrowUp {
  from {
    transform: scaleY(0.05);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
  }
}

.svg-cap-expand {
  transform-box: fill-box;
  transform-origin: center center;
  animation: capExpand 0.52s cubic-bezier(0.22, 1, 0.36, 1) var(--stagger, 0ms) backwards;
  transition:
    opacity 0.14s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes capExpand {
  from {
    transform: scaleY(0.12);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
  }
}

.svg-sleep-block {
  transform-box: fill-box;
  transform-origin: center center;
  animation: sleepBlockIn 0.46s cubic-bezier(0.22, 1, 0.36, 1) var(--stagger, 0ms) backwards;
  transition: opacity 0.14s ease;
}

@keyframes sleepBlockIn {
  from {
    opacity: 0;
    transform: translateY(4px) scaleY(0.76);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.svg-sleep-bridge {
  animation: fadeIn 0.50s ease calc(var(--stagger, 0ms) + 60ms) backwards;
  transition: opacity 0.14s ease;
}

.svg-sleep-glow {
  animation: sleepGlowIn 0.52s ease calc(var(--stagger, 0ms) + 60ms) backwards;
  transition: opacity 0.16s ease;
}

@keyframes sleepGlowIn {
  from { opacity: 0; }
  to { opacity: var(--glow-op, 0.44); }
}

.svg-line-draw {
  animation: fadeIn 0.55s ease 0.05s backwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 3. Magnetic Scrubbing Highlight & Cursor Line */
.scrub-cursor-line {
  transition: transform 0.065s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.14s ease;
}

.scrub-cursor-line.no-glide {
  transition: opacity 0.12s ease !important;
}

[data-slot].scrub-hit {
  opacity: 1 !important;
}

[data-slot].scrub-dim {
  opacity: 0.22 !important;
}

.svg-sleep-bridge.scrub-hit {
  opacity: 0.90 !important;
}

.svg-sleep-bridge.scrub-dim {
  opacity: 0.14 !important;
}

[data-glow-slot].scrub-glow-hit {
  opacity: 0.72 !important;
}

[data-glow-slot].scrub-glow-dim {
  opacity: 0 !important;
}

/* 3b. Directional Chart Morph & Gaode Dark Tile Filter */
.chart-slide-prev {
  animation: chartSlidePrev 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.chart-slide-next {
  animation: chartSlideNext 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.chart-crossfade {
  animation: chartCrossfade 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes chartSlidePrev {
  from {
    opacity: 0;
    transform: translate(-16px, 0);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes chartSlideNext {
  from {
    opacity: 0;
    transform: translate(16px, 0);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes chartCrossfade {
  from {
    opacity: 0.15;
    transform: scale(0.992);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gaode-dark-tiles .leaflet-tile-pane {
  filter: invert(92%) hue-rotate(185deg) brightness(95%) contrast(92%);
}

/* 4. iOS Navigation Push / Pop & Staggered Card Entrance */
.ios-view-enter {
  animation: iosPushIn 0.34s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.ios-view-pop {
  animation: iosPopIn 0.34s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.ios-view-exit-right {
  animation: iosExitRight 0.20s cubic-bezier(0.32, 0.72, 0, 1) both;
  pointer-events: none;
}

@keyframes iosPushIn {
  from {
    opacity: 0.15;
    transform: translate(26%, 0);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes iosPopIn {
  from {
    opacity: 0.25;
    transform: translate(-20%, 0);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes iosExitRight {
  from {
    opacity: 1;
    transform: translate(0, 0);
  }
  to {
    opacity: 0;
    transform: translate(30%, 0);
  }
}

.stagger-card {
  animation: cardRiseIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--card-idx, 0) * 45ms) both;
}

@keyframes cardRiseIn {
  from {
    opacity: 0;
    transform: translate(0, 12px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

/* 5. Progress Bar Fill Right Animation */
.hl-fill,
.hr-zone-fill,
.split-bar-fill {
  transform-origin: left center;
  animation: barFillRight 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes barFillRight {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* 6. Accordion Spring Drawer ("显示所有数据") */
.accordion-drawer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition:
    grid-template-rows 0.36s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.26s ease,
    margin-top 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.accordion-drawer.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 10px;
}

.accordion-inner {
  overflow: hidden;
  min-height: 0;
}

.chev-rot {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.all-data-btn.open .chev-rot {
  transform: rotate(180deg);
}

.nav-item.active .tab-heart-path,
.bottom-tab-btn.active .tab-heart-path {
  fill: currentColor;
}

.num-lg {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.unit-sm {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin: 0 3px 0 2px;
}

#summary-cards-grid .metric-spark,
.ah-spark {
  width: 112px;
  height: 42px;
  flex-shrink: 0;
}

.all-health-entry-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 12px;
  padding: 15px 18px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.all-health-entry-btn .chev {
  font-size: 20px;
  line-height: 1;
  color: var(--text-3);
}

.highlights-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hl-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 15px 16px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hl-insight-card:active {
  transform: scale(0.985);
}

.hl-in-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hl-in-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.hl-in-cat svg {
  width: 15px;
  height: 15px;
}

.hl-in-date {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.hl-in-stmt {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.hl-in-div {
  height: 1px;
  background: var(--hairline);
  margin: 2px 0;
}

.hl-in-chart {
  width: 100%;
  overflow: hidden;
}

.hl-in-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.ah-section-title {
  margin: 12px 4px 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.ah-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ah-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 15px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ah-card:hover {
  transform: translateY(-1px);
}

.ah-card:active {
  transform: scale(0.98);
}

.ah-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ah-card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.ah-val-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.ah-sub-lbl {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 2px;
}

/* V14 Minimalist Apple Health Pro Modules & Progressive Disclosure */
.readiness-min-card {
  margin-top: 12px;
}

.pro-hero-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0 10px;
}

.pro-hero-num {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pro-hero-unit {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
}

.pro-hero-status {
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
}

.apple-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 10px;
}

.apple-stat-strip.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.apple-stat-lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.apple-stat-val {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.apple-stat-val-sm {
  font-size: 16px;
}

.apple-stat-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apple-disclosure-wrap {
  margin-top: 12px;
  border-top: 1px solid var(--hairline);
  padding-top: 2px;
}

.apple-disclosure-btn {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--apple-blue);
  cursor: pointer;
  text-align: left;
}

.apple-disclosure-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.apple-disclosure-btn.open .chev-rot {
  transform: rotate(180deg);
}

.apple-disclosure-body {
  padding-top: 6px;
}

.apple-section-disclosure {
  display: flex;
  flex-direction: column;
}

.apple-section-disclosure .accordion-drawer.open {
  margin-top: 10px;
}

.kv-meta-muted {
  font-weight: 500;
  color: var(--text-2);
}

.pro-note-text {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.52;
  color: var(--text-2);
}

.pro-risk-inline {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.48;
  color: var(--text);
}

.risk-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  margin-top: 6px;
  background: var(--apple-green);
}

.pro-risk-inline.warn .risk-dot {
  background: var(--apple-orange);
}

.pro-risk-inline.high .risk-dot {
  background: var(--apple-red);
}

.coach-tips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.coach-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.coach-tip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--apple-blue);
  flex-shrink: 0;
  margin-top: 7px;
}

.pro-seg {
  grid-template-columns: repeat(3, 1fr);
}

.polar-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  margin: 6px 0 2px;
}

.polar-seg-piece {
  height: 100%;
  border-radius: 4px;
  min-width: 3px;
}

.mini-pill-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--seg-bg);
  gap: 2px;
}

.mini-pill-btn {
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
}

.mini-pill-btn.active {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: var(--seg-shadow);
}

.heatmap-readout {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.heatmap-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 2px;
}

.heatmap-cell {
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.heatmap-cell.selected {
  stroke: var(--text);
  stroke-width: 1.6;
}

.drift-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.drift-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.drift-row:last-child {
  border-bottom: none;
}

.drift-lbl {
  font-weight: 600;
  color: var(--text-2);
}

.drift-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.drift-delta-txt {
  font-size: 12px;
  font-weight: 700;
  min-width: 56px;
  text-align: right;
}

.drift-delta-txt.good {
  color: var(--apple-green);
}

.drift-delta-txt.warn {
  color: var(--apple-orange);
}

.drift-delta-txt.neutral {
  color: var(--text-2);
}

.aerobic-run-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.aerobic-run-row:first-child {
  border-top: 1px solid var(--hairline);
}

.aerobic-run-row:last-child {
  border-bottom: none;
}

.aerobic-run-row:hover {
  background: var(--surface-hover);
}

.anim-done,
.no-anim-replay .ring-fg,
.no-anim-replay .svg-bar-grow,
.no-anim-replay .svg-cap-expand,
.no-anim-replay .svg-sleep-block,
.no-anim-replay .svg-sleep-bridge,
.no-anim-replay .svg-sleep-glow,
.no-anim-replay .svg-line-draw,
.no-anim-replay .stagger-card,
.no-anim-replay .hl-fill,
.no-anim-replay .sleep-amount-fill,
.no-anim-replay .hr-zone-fill,
.no-anim-replay .split-bar-fill {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ring-fg,
  .svg-bar-grow,
  .svg-cap-expand,
  .svg-sleep-block,
  .svg-sleep-bridge,
  .svg-sleep-glow,
  .svg-line-draw,
  .chart-slide-prev,
  .chart-slide-next,
  .chart-crossfade,
  .ios-view-enter,
  .ios-view-pop,
  .ios-view-exit-right,
  .stagger-card,
  .hl-fill,
  .sleep-amount-fill,
  .hr-zone-fill,
  .split-bar-fill {
    animation: none !important;
  }
  .seg-thumb,
  .dock-indicator,
  .scrub-cursor-line,
  .accordion-drawer,
  .chev-rot {
    transition: none !important;
  }
}

[hidden]{display:none!important}
.source-note {font-size:.85rem;line-height:1.5;color:var(--text-secondary);padding-block:10px}
.source-note summary {cursor:pointer;font-weight:600}
.source-note p {margin:.6em 0}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}

.chart-mode{display:flex;align-items:center;justify-content:space-between;padding:8px 4px;font-weight:700}
.compact-training :is(.hr-zones-list,#wo-ele-card .kv-list){display:none}
.compact-training #wo-ele-card:not(:has(svg)){display:none}
.compact-training :is(#wo-pace-card,#wo-hr-card,#wo-ele-card,#wo-cadence-card){padding-block:12px}
.seg-time{display:block;color:var(--text-secondary,#737780);font-variant-numeric:tabular-nums;margin-top:4px}
.source-scroll{max-height:20rem;overflow:auto}

.workout-detail-panel>.card{scroll-margin-top:72px}

#metric-detail-body[data-mounted-metric="sleep"] .scrub-sub-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-height:3.2rem;gap:8px}
#metric-detail-body[data-mounted-metric="sleep"] #scrub-sub{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;line-height:1.25;font-variant-numeric:tabular-nums}
#metric-detail-body[data-mounted-metric="sleep"] #scrub-sub:not(:has(.sleep-reading)){display:block}
#scrub-badges .status-pill{white-space:nowrap}
.sleep-reading{display:grid;gap:3px}.sleep-reading small{font-size:.7rem}.sleep-reading strong{font-size:clamp(10px,2.8vw,13px);white-space:nowrap}
.training-overlay{position:fixed;inset:0;margin:0;padding:0;width:100vw;height:100dvh;max-width:none;max-height:none;border:0;background:var(--bg);color:var(--text);overflow:hidden}
.training-overlay::backdrop{background:var(--bg)}
.overlay-stage{box-sizing:border-box;width:100%;height:100%;padding:12px max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left));display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:6px}
.overlay-stage header,.overlay-legend{display:flex;align-items:center;gap:12px}
.overlay-stage header strong{font-size:18px}.overlay-stage header span,.overlay-stage output{font-size:12px;color:var(--text-secondary,#70747b)}
.overlay-stage header button{margin-left:auto}.overlay-stage button,.overlay-legend label{color:var(--text);background:var(--surface-solid,#fff);border:1px solid var(--separator,#bbb7);border-radius:9px;padding:5px 9px}
.overlay-legend{flex-wrap:wrap;gap:5px}.overlay-legend label{font-size:12px;white-space:nowrap}.overlay-legend input{accent-color:var(--series-color);vertical-align:middle;margin:0 4px 0 0}
.overlay-stage svg{width:100%;height:100%;min-height:0;touch-action:none}.overlay-stage svg text{font-size:11px;fill:currentColor}.overlay-stage output{min-height:2.4em;font-variant-numeric:tabular-nums}
@media(orientation:portrait){.overlay-stage{position:absolute;left:100%;top:0;transform-origin:top left;transform:rotate(90deg);width:100dvh;height:100vw}}
.overlay-legend label{display:inline-flex;align-items:center;gap:5px;cursor:pointer}
.overlay-legend label::before{content:"";width:9px;height:9px;border:2px solid var(--series-color);border-radius:50%;box-sizing:border-box}
.overlay-legend label:has(:checked)::before{background:var(--series-color)}
.overlay-legend label:has(:checked){border-color:var(--series-color)}
.overlay-legend label:has(:focus-visible){outline:2px solid currentColor}
.overlay-legend input{position:absolute;opacity:0;width:1px;height:1px}
