/* FitAI B2.1 core visual sample: brand character, rounded type and editorial rhythm. */
:root {
  --b21-round: "Microsoft YaHei UI", "Arial Rounded MT Bold", "PingFang SC", "Microsoft YaHei", sans-serif;
  --b21-coral: #ff625b;
  --b21-cyan: #13b8c6;
  --b21-sun: #c8ed56;
  --b21-ink: #121719;
  --b21-hero-radius: 32px;
  --b21-module-radius: 22px;
  --b21-control-radius: 15px;
}

[data-theme="dark"] {
  --b21-ink: #f5faf8;
}

.hero-copy h1,
.manifesto h2,
.experience-intro h2,
.story-step h3,
.trust-lab h2,
.closing h2,
.brand-lockup,
#panel-home h1,
#panel-home h2,
#panel-chat h2,
#panel-chat h3,
#panel-insights h2,
#panel-insights h3,
.b2-action-stage strong,
.b2-signal-card strong {
  font-family: var(--b21-round);
  font-weight: 600;
  letter-spacing: -.012em;
}

/* Original pulse companion: a continuous signal with a restrained micro-expression. */
.pulse-companion { position: relative; display: grid; place-items: center; }
.pulse-companion svg { width: 100%; height: auto; overflow: visible; }
.companion-shell,
.companion-signal,
.companion-expression { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.companion-shell { stroke: rgba(127, 235, 238, .34); stroke-width: 1.5; }
.companion-signal { stroke: var(--b21-cyan); stroke-width: 3.2; filter: drop-shadow(0 0 10px rgba(19,184,198,.4)); }
.companion-expression { stroke: rgba(239,251,249,.76); stroke-width: 1.7; }
.companion-eye { fill: rgba(239,251,249,.86); }
.companion-status-dot { position: absolute; width: 11px; height: 11px; right: 15%; top: 15%; border-radius: 50%; background: var(--b21-coral); box-shadow: 0 0 0 7px rgba(255,98,91,.12), 0 0 24px rgba(255,98,91,.55); }
.fitai-pulse-icon { color: var(--b2-cyan-deep, var(--b21-cyan)); }
.fitai-pulse-icon--companion { color: var(--b21-cyan); }
.sidebar-brand .brand-icon {
  background: transparent !important;
  color: var(--b21-cyan) !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.sidebar-brand .brand-icon svg { width: 34px; height: 34px; }

/* Landing sample: friendlier type, 7:5 editorial balance and a legible first screen. */
body:has(.hero-lab) .hero-lab { grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr); min-height: min(900px, 100svh); gap: clamp(32px, 5vw, 76px); }
body:has(.hero-lab) .hero-copy h1 { max-width: 760px; font-size: clamp(64px, 7.2vw, 106px); line-height: .98; letter-spacing: -.035em; text-wrap: balance; }
body:has(.hero-lab) .hero-copy h1 span { color: var(--b21-coral); -webkit-text-stroke: 0; }
body:has(.hero-lab) .hero-lead { max-width: 610px; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.72; }
body:has(.hero-lab) .hero-signal { min-height: 590px; border-radius: 48px; background: radial-gradient(circle at 48% 42%,rgba(19,184,198,.24),transparent 17rem), radial-gradient(circle at 75% 84%,rgba(200,237,86,.12),transparent 16rem), #11191d; }
body:has(.hero-lab) .pulse-companion--hero { width: min(330px, 72%); z-index: 2; }
body:has(.hero-lab) .hero-signal > svg { opacity: .42; }
body:has(.hero-lab) .manifesto h2,
body:has(.hero-lab) .experience-intro h2,
body:has(.hero-lab) .trust-lab h2 { letter-spacing: -.025em; line-height: 1.12; }

/* Home sample: one dominant action, then a varied horizontal signal narrative. */
#panel-home .b2-home-head h1 { max-width: 820px; font-size: clamp(36px, 5vw, 66px); line-height: 1.08; letter-spacing: -.025em; }
#panel-home .b2-action-stage { grid-template-columns: minmax(0, 7fr) minmax(250px, 5fr); border-radius: var(--b21-hero-radius); }
#panel-home .b2-action-copy h2 { max-width: 660px; font-size: clamp(38px, 5vw, 68px); line-height: 1.03; letter-spacing: -.025em; text-wrap: balance; }
#panel-home .b2-primary-action,
#panel-home .b2-choice { border-radius: var(--b21-control-radius); }
#panel-home .b2-signal-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr) minmax(0, .75fr); align-items: stretch; }
#panel-home .b2-signal-card { min-height: 210px; border-radius: var(--b21-module-radius); }
#panel-home .b2-signal-card:nth-child(2) { min-height: 186px; align-self: end; }
#panel-home .b2-signal-card:nth-child(3) { min-height: 164px; align-self: center; }
#panel-home .b2-paths { border-radius: var(--b21-module-radius); overflow: hidden; }

/* AI coach sample: the companion owns the emotional surface, not every data row. */
#panel-chat { max-width: 1120px; margin-inline: auto; }
#panel-chat .coach-context-bar { margin: 0 0 18px; min-height: 52px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--b21-cyan) 24%, var(--border)); border-radius: var(--b21-control-radius); background: color-mix(in srgb, var(--b21-cyan) 7%, var(--surface)); }
#panel-chat .chat-header { position: relative; min-height: 176px; padding: 32px clamp(26px, 5vw, 54px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--b21-hero-radius); background: radial-gradient(circle at 88% 20%,rgba(19,184,198,.18),transparent 18rem), radial-gradient(circle at 72% 100%,rgba(200,237,86,.1),transparent 16rem), var(--surface); }
#panel-chat .chat-header h2 { max-width: 620px; font-size: clamp(34px, 4vw, 54px); line-height: 1.08; }
#panel-chat .chat-header p { max-width: 560px; margin-top: 9px; color: var(--text2); }
#panel-chat .b21-coach-companion { position: absolute; width: 178px; right: clamp(16px, 5vw, 54px); top: 2px; opacity: .92; }
#panel-chat .chat-body { margin-top: 18px; border-radius: var(--b21-module-radius) var(--b21-module-radius) 0 0; }
#panel-chat .welcome-msg { max-width: 720px; margin: 22px auto; padding: 28px; border: 1px solid var(--border); border-radius: var(--b21-module-radius); background: color-mix(in srgb, var(--surface) 92%, var(--b21-cyan)); }
#panel-chat .welcome-icon { width: 88px; height: 68px; margin: 0 auto 14px; }
#panel-chat .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
#panel-chat .quick-btn { min-height: 48px; border-radius: var(--b21-control-radius); text-align: left; }
#panel-chat .msg-avatar { border-radius: 14px; background: color-mix(in srgb, var(--b21-cyan) 10%, var(--surface)); }

/* Insight sample: editorial hierarchy instead of four interchangeable chart boxes. */
#panel-insights { max-width: 1180px; margin-inline: auto; }
#panel-insights .panel-v2-intro { position: relative; min-height: 220px; padding: clamp(32px, 5vw, 62px); border: 1px solid var(--border); border-radius: var(--b21-hero-radius); overflow: hidden; background: radial-gradient(circle at 86% 18%,rgba(255,98,91,.14),transparent 18rem), radial-gradient(circle at 72% 110%,rgba(19,184,198,.15),transparent 20rem), var(--surface); }
#panel-insights .panel-v2-intro h2 { max-width: 720px; font-size: clamp(38px, 5vw, 64px); line-height: 1.08; letter-spacing: -.025em; }
#panel-insights .b21-insight-mark { position: absolute; right: clamp(20px,5vw,60px); bottom: 26px; width: min(260px,28%); opacity: .7; }
#panel-insights .b21-insight-mark path { fill: none; stroke: var(--b21-cyan); stroke-width: 2.4; stroke-linecap: round; }
#panel-insights .evidence-notice { margin-block: 18px 28px; border-radius: var(--b21-control-radius); }
#panel-insights .charts-row { display: grid; grid-template-columns: 7fr 5fr; gap: 18px; }
#panel-insights .charts-row:nth-of-type(even) { grid-template-columns: 5fr 7fr; }
#panel-insights .chart-card { min-width: 0; min-height: 260px; padding: 26px; border-radius: var(--b21-module-radius); box-shadow: none; }
#panel-insights .chart-card h3 { font-size: 20px; letter-spacing: -.015em; }
#panel-insights .chart-wrap { min-height: 176px; }
#panel-insights .insight-result-row,
#panel-insights .insight-edge { border-radius: 12px; }

@media (max-width: 768px) {
  body:has(.hero-lab) .hero-lab { display: block; min-height: auto; padding: 116px 18px 74px; }
  body:has(.hero-lab) .hero-copy h1 { max-width: 9ch; font-size: clamp(52px, 15vw, 68px); line-height: 1.02; }
  body:has(.hero-lab) .hero-signal { min-height: 390px; margin-top: 58px; border-radius: 30px; }
  #panel-home .b2-home-head h1 { font-size: clamp(35px, 10.5vw, 46px); line-height: 1.08; }
  #panel-home .b2-action-stage { display: block; border-radius: 26px; }
  #panel-home .b2-action-copy h2 { font-size: clamp(36px, 10.5vw, 48px); line-height: 1.06; }
  #panel-home .b2-signal-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76vw, 300px); grid-template-columns: none; gap: 12px; overflow-x: auto; padding: 2px 18px 14px 0; scroll-snap-type: x mandatory; scrollbar-width: none; }
  #panel-home .b2-signal-card,
  #panel-home .b2-signal-card:nth-child(2),
  #panel-home .b2-signal-card:nth-child(3) { min-height: 188px; align-self: stretch; scroll-snap-align: start; }
  #panel-chat .chat-header { min-height: 190px; padding: 28px 24px; }
  #panel-chat .chat-header h2 { max-width: 7ch; font-size: 37px; }
  #panel-chat .chat-header p { max-width: 18ch; }
  #panel-chat .b21-coach-companion { width: 142px; right: 9px; top: 20px; }
  #panel-chat .quick-actions { grid-template-columns: 1fr; }
  #panel-insights .panel-v2-intro { min-height: 244px; padding: 30px 24px; }
  #panel-insights .panel-v2-intro h2 { max-width: 8ch; font-size: 40px; }
  #panel-insights .b21-insight-mark { width: 150px; right: 12px; bottom: 16px; opacity: .48; }
  #panel-insights .charts-row,
  #panel-insights .charts-row:nth-of-type(even) { grid-template-columns: 1fr; padding-inline: 0; }
  #panel-insights .chart-card { width: 100%; min-height: 220px; padding: 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .pulse-companion .companion-signal { stroke-dasharray: 360; animation: b21-companion-listen 3.8s ease-in-out infinite; }
  .pulse-companion .companion-status-dot { animation: b21-status-breathe 2.6s ease-in-out infinite; }
}
@keyframes b21-companion-listen { 0%,100% { stroke-dashoffset: 0; } 50% { stroke-dashoffset: -42; } }
@keyframes b21-status-breathe { 50% { transform: scale(.72); opacity: .72; } }
@media (prefers-reduced-motion: reduce) {
  .pulse-companion *, .b21-coach-companion * { animation: none !important; transition: none !important; }
}

/* Full-product rollout: consistent icon carriers and state language. */
.b21-inline-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; margin-right: 8px; border-radius: 9px; color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 9%, transparent); vertical-align: middle; }
.b21-inline-icon svg { width: 18px; height: 18px; }
.b21-system-icon { display: grid !important; place-items: center; color: var(--b21-cyan); }
.b21-system-icon .b21-inline-icon { width: 100%; height: 100%; margin: 0; background: transparent; }
.b21-system-icon .b21-inline-icon svg { width: min(28px, 72%); height: min(28px, 72%); }
.section-title[data-b21-prefix="true"],
button[data-b21-prefix="true"],
h3[data-b21-prefix="true"],
h4[data-b21-prefix="true"] { display: flex; align-items: center; }

/* Remaining app panels share the same editorial canvas. */
#panel-health,
#panel-dashboard,
#panel-history,
#panel-plan,
#panel-pose,
#panel-exercises,
#panel-exercise-library,
#panel-settings { width: min(1180px, 100%); margin-inline: auto; }

#panel-health h2, #panel-health h3, #panel-health h4,
#panel-dashboard h2, #panel-dashboard h3, #panel-dashboard h4,
#panel-history h2, #panel-history h3,
#panel-plan h2, #panel-plan h3,
#panel-pose h2, #panel-pose h3,
#panel-exercises h2, #panel-exercises h3,
#panel-exercise-library h2, #panel-exercise-library h3,
#panel-settings h2, #panel-settings h3,
.onboarding-card h2, .onboarding-card h3 {
  font-family: var(--b21-round);
  font-weight: 600;
  letter-spacing: -.012em;
}

.panel-header { min-height: 76px; padding: 20px 28px; align-items: center; }
.panel-header h2 { font-size: clamp(27px, 3vw, 40px); }
.panel-v2-intro { border-radius: var(--b21-hero-radius); }

.stat-card,
.record-card,
.chart-card,
.analysis-card,
.settings-section,
.plan-day-card,
.history-content,
.pose-container,
.exlib-card,
.exlib-modal-content {
  border-radius: var(--b21-module-radius) !important;
  border-color: color-mix(in srgb, var(--border) 84%, var(--b21-cyan)) !important;
  box-shadow: none !important;
}

.stat-card { min-height: 122px; padding: 20px; gap: 14px; background: color-mix(in srgb, var(--surface) 96%, var(--b21-cyan)); }
.stat-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--b21-cyan) 42%, var(--border)) !important; }
.stat-card-icon { width: 44px; height: 44px; border-radius: 14px; color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 10%, transparent); }
/* Center every rendering path, not just converted legacy icons. */
.stat-card-icon,
.empty-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  line-height: 0;
}
.stat-card-icon > span,
.empty-icon > span {
  display: grid;
  place-items: center;
  line-height: 0;
  margin: 0;
}
.stat-card-icon svg,
.empty-icon svg { display: block; }
.stat-card-info { min-width: 0; }
.stat-card-label { overflow-wrap: anywhere; }
.stat-card-val { font-family: var(--b21-round); font-weight: 600; letter-spacing: -.018em; }
.stat-card-action {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stat-card-action-note {
  margin-top: 7px;
  color: var(--b21-cyan);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.stat-card-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--b21-cyan) 48%, transparent);
  outline-offset: 3px;
}

.chart-card { min-height: 300px; padding: 26px; background: color-mix(in srgb, var(--surface) 97%, var(--b21-cyan)); }
.chart-card h3 { font-size: 18px; font-weight: 600; }
.chart-card-hint { color: var(--b21-cyan); font-size: 11px; }
.chart-wrap { min-height: 220px; }
.analysis-card { padding: 22px; background: var(--surface); }

#panel-dashboard .dash-grid,
#panel-health .dash-grid,
#panel-exercises .dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 14px; padding-inline: 28px; }
#panel-dashboard .dash-grid > .stat-card { grid-column: span 3; }
#panel-health .dash-grid > .stat-card { grid-column: span 3; }
#panel-health .dash-grid > .stat-card:nth-child(1),
#panel-health .dash-grid > .stat-card:nth-child(2) { grid-column: span 6; min-height: 144px; }
#panel-exercises .dash-grid > .stat-card { grid-column: span 4; }
#panel-dashboard .charts-row,
#panel-health .charts-row,
#panel-exercises .charts-row { display: grid; grid-template-columns: 7fr 5fr; gap: 18px; padding-inline: 28px; }
#panel-dashboard .charts-row:nth-of-type(even),
#panel-health .charts-row:nth-of-type(even),
#panel-exercises .charts-row:nth-of-type(even) { grid-template-columns: 5fr 7fr; }

/* History and plan read as timelines, not spreadsheet/card walls. */
.history-subnav { width: max-content; max-width: calc(100% - 56px); margin: 0 28px 18px; padding: 5px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.subnav-btn { min-height: 42px; padding-inline: 18px; border-radius: 12px; }
.history-content { margin: 0 28px 28px; overflow: auto; background: var(--surface); }
.history-content table { border-collapse: separate; border-spacing: 0; }
.history-content th { background: color-mix(in srgb, var(--b21-cyan) 6%, var(--surface)); }
.history-content th, .history-content td { padding: 15px 17px; }

#plan-content { padding: 0 28px 30px !important; }
.plan-day-card { margin-bottom: 12px; overflow: hidden; background: var(--surface); }
.plan-day-card.today { border-color: var(--b21-coral) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--b21-coral) 12%, transparent) !important; }
.plan-day-head { min-height: 68px; padding: 15px 18px; }
.plan-day-icon { width: 38px; height: 38px; border-radius: 13px; background: color-mix(in srgb, var(--b21-cyan) 9%, transparent); }
.plan-day-focus { border-radius: 999px; background: color-mix(in srgb, var(--b21-cyan) 10%, transparent); color: var(--b21-cyan); }
.plan-complete-btn { min-height: 46px; border-radius: var(--b21-control-radius); }

/* Movement tools and library use calmer framing around the actual media. */
.pose-container { margin: 0 28px 28px; padding: 18px; background: var(--surface); overflow: hidden; }
.pose-video-wrap { border-radius: 18px; overflow: hidden; }
.ex-btn, .exlib-filter-btn { min-height: 42px; border-radius: 12px !important; }
.exlib-layout { gap: 22px; padding: 0 28px 30px; }
.exlib-filters { width: 190px; padding: 18px; border: 1px solid var(--border); border-radius: var(--b21-module-radius); background: var(--surface); }
.exlib-grid { grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 16px; justify-content: stretch; }
.exlib-card { background: var(--surface); }
.exlib-gif-wrap { height: 190px; background: color-mix(in srgb, var(--b21-cyan) 4%, var(--bg3)); }
.exlib-info { padding: 13px 14px 15px; }
.exlib-name { font-family: var(--b21-round); font-size: 14px; font-weight: 600; }
.exlib-filter-btn.active { color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 10%, transparent); }

/* Settings become a readable sequence with explicit group boundaries. */
#panel-settings .settings-section { width: min(940px, calc(100% - 56px)); margin: 0 auto 16px; padding: 26px; background: var(--surface); }
#panel-settings .settings-section h3 { margin-bottom: 14px; font-size: 18px; }
#panel-settings input,
#panel-settings select,
#panel-settings button,
.style-btn { min-height: 44px; border-radius: var(--b21-control-radius) !important; }
.import-area { border-radius: var(--b21-module-radius); border-style: solid; background: color-mix(in srgb, var(--b21-cyan) 5%, var(--surface)); }
.import-icon { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 16px; background: color-mix(in srgb, var(--b21-cyan) 10%, transparent); }

/* C1 local Apple Health import: preview before any formal database write. */
.import-area { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 5px; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.import-area:hover, .import-area:focus-visible, .import-area.is-dragging { border-color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 9%, var(--surface)); outline: none; }
.import-area.is-dragging { transform: translateY(-2px); }
.import-icon { display: grid; place-items: center; color: var(--b21-cyan); }
.import-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.c1-import-result { margin-top: 14px !important; }
.c1-progress, .c1-import-error, .c1-import-success, .c1-preview-card { padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, var(--b21-cyan)); }
.c1-progress { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 4px 10px; }
.c1-progress small { grid-column: 2; color: var(--text3); }
.c1-progress-track { grid-column: 2; width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.c1-progress-bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--b21-coral), var(--b21-cyan)); transition: width .25s ease; }
.c1-progress-value { grid-column: 2; color: var(--text3); font-variant-numeric: tabular-nums; }
.c1-workout-conflicts { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border-radius: 18px; background: color-mix(in srgb, var(--b21-coral) 10%, var(--surface)); }
.c1-workout-conflict { display: grid; gap: 6px; }
.c1-workout-resolution { min-height: 44px; border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; background: var(--surface); color: var(--text); }
.c1-spinner { width: 18px; height: 18px; grid-row: span 2; border: 2px solid color-mix(in srgb, var(--b21-cyan) 22%, transparent); border-top-color: var(--b21-cyan); border-radius: 50%; animation: c1-spin .8s linear infinite; }
@keyframes c1-spin { to { transform: rotate(1turn); } }
.c1-eyebrow { color: var(--b21-cyan); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.c1-preview-card h4 { margin: 5px 0 2px; font-family: var(--b21-round); font-size: 20px; }
.c1-preview-range, .c1-limit, .c1-import-error p, .c1-import-success p { margin: 5px 0 0; color: var(--text3); line-height: 1.6; }
.c1-metric-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.c1-metric-chip { padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--b21-cyan) 9%, transparent); color: var(--text2); }
.c1-preview-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 14px; }
.c1-preview-stat { min-height: 72px; display: grid; place-items: center; align-content: center; border-radius: 14px; background: var(--bg2); }
.c1-preview-stat strong { font-family: var(--b21-round); font-size: 22px; }
.c1-preview-stat span { color: var(--text3); font-size: 11px; }
.c1-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.c1-actions .btn { min-height: 46px; }
.c1-history-title { margin: 24px 0 10px; font-family: var(--b21-round); font-size: 15px; }
.c1-import-history { display: grid; gap: 8px; }
.c1-history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--bg2); }
.c1-history-copy { display: grid; gap: 3px; min-width: 0; }
.c1-history-copy span, .c1-history-empty { color: var(--text3); font-size: 12px; }
.c1-import-error { border-color: color-mix(in srgb, var(--b21-coral) 34%, var(--border)); }
.c1-import-success { border-color: color-mix(in srgb, var(--b21-cyan) 34%, var(--border)); }

@media (prefers-reduced-motion: reduce) {
  .c1-spinner { animation: none; border-color: var(--b21-cyan); }
  .import-area { transition: none; }
}

/* Empty, loading and error states use the signal system without pretending data exists. */
.empty-state { min-height: 170px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px dashed color-mix(in srgb, var(--b21-cyan) 24%, var(--border)); border-radius: 18px; background: color-mix(in srgb, var(--b21-cyan) 4%, transparent); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 5px; border-radius: 17px; color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 9%, transparent); }
.empty-state.compact { min-height: 116px; }
.empty-cta { min-height: 44px; display: inline-grid; place-items: center; }
.error, [role="alert"] { border-radius: var(--b21-control-radius); }

/* Onboarding reserves the companion surface for guidance and keeps choices concrete. */
.onboarding-overlay { background: color-mix(in srgb, #0c1215 78%, transparent); backdrop-filter: blur(18px); }
.onboarding-card { width: min(620px, calc(100% - 28px)); max-height: min(820px, calc(100dvh - 28px)); padding: clamp(24px,5vw,42px); border: 1px solid color-mix(in srgb, var(--border) 76%, var(--b21-cyan)); border-radius: 32px; background: var(--surface); }
.onboarding-step h2 { font-size: clamp(28px,5vw,42px); line-height: 1.1; }
.ob-icon { width: 78px; height: 62px; margin: 0 auto 14px; border-radius: 22px; color: var(--b21-cyan); background: color-mix(in srgb, var(--b21-cyan) 8%, transparent); }
.ob-goal-btn, .ob-pain-btn, .ob-freq-btn { min-height: 58px; border-radius: var(--b21-control-radius) !important; }
.ob-goal-btn .b21-inline-icon, .ob-pain-btn .b21-inline-icon { margin-right: 10px; }

/* Authentication uses the same performance palette and original companion. */
.auth-page-b2 { --b21-auth-dark: #11191d; }
.auth-page-b2 .shell { border-radius: 34px; box-shadow: 0 30px 90px rgba(20,35,38,.14); }
.auth-page-b2 .context { background: radial-gradient(circle at 24% 18%,rgba(19,184,198,.25),transparent 18rem), radial-gradient(circle at 86% 90%,rgba(255,98,91,.24),transparent 20rem), var(--b21-auth-dark); }
.auth-page-b2 .context::after { border-color: rgba(19,184,198,.13); }
.auth-page-b2 .brand,
.auth-page-b2 .context-copy h1,
.auth-page-b2 .auth-head h2 { font-family: var(--b21-round); font-weight: 600; letter-spacing: -.012em; }
.auth-page-b2 .mark { color: var(--b21-cyan); background: transparent; }
.auth-page-b2 .mark svg { width: 34px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.auth-page-b2 .mark circle { fill: var(--b21-coral); stroke: none; }
.auth-page-b2 .context-copy { max-width: 410px; padding-bottom: 96px; }
.auth-page-b2 .context-copy h1 { line-height: 1.08; }
.auth-page-b2 .b21-auth-companion { position: absolute; width: 210px; right: 26px; bottom: 48px; opacity: .82; }
.auth-page-b2 .auth .btn { border-radius: var(--b21-control-radius); background: var(--b21-coral); }
.auth-page-b2 .form input { border-radius: var(--b21-control-radius); }

@media (max-width: 900px) {
  #panel-dashboard .dash-grid > .stat-card,
  #panel-health .dash-grid > .stat-card,
  #panel-health .dash-grid > .stat-card:nth-child(1),
  #panel-health .dash-grid > .stat-card:nth-child(2),
  #panel-exercises .dash-grid > .stat-card { grid-column: span 6; min-height: 112px; }
  #panel-dashboard .charts-row,
  #panel-health .charts-row,
  #panel-exercises .charts-row,
  #panel-dashboard .charts-row:nth-of-type(even),
  #panel-health .charts-row:nth-of-type(even),
  #panel-exercises .charts-row:nth-of-type(even) { grid-template-columns: 1fr; }
  .exlib-layout { flex-direction: column; }
  .exlib-filters { width: 100%; display: flex; gap: 10px; overflow-x: auto; padding: 12px; }
}

@media (max-width: 768px) {
  .panel-header { min-height: 62px; padding: 14px 16px; }
  #panel-dashboard .dash-grid,
  #panel-health .dash-grid,
  #panel-exercises .dash-grid { padding-inline: 0; gap: 10px; }
  #panel-dashboard .charts-row,
  #panel-health .charts-row,
  #panel-exercises .charts-row { padding-inline: 0; gap: 12px; }
  .stat-card { min-height: 104px; padding: 14px; }
  .chart-card { min-height: 246px; padding: 20px; }
  .chart-wrap { min-height: 180px; }
  .history-subnav { max-width: 100%; margin: 0 0 14px; }
  .history-content { margin: 0 0 20px; }
  #plan-content { padding: 0 0 22px !important; }
  .pose-container { margin: 0 0 20px; padding: 10px; }
  .exlib-layout { padding: 0 0 22px; }
  .exlib-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 0; }
  .exlib-gif-wrap { height: 150px; }
  #panel-settings .settings-section { width: 100%; padding: 20px 16px; }
  .c1-preview-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .c1-history-item { align-items: flex-start; flex-direction: column; }
  .c1-history-item .btn { width: 100%; }
  .onboarding-card { border-radius: 26px; }
  .auth-page-b2 .context { min-height: 270px; }
  .auth-page-b2 .context-copy { padding: 22px 0 72px; }
  .auth-page-b2 .b21-auth-companion { width: 150px; right: 16px; bottom: 18px; }
}
.workout-source { display: block; margin-top: .3rem; font-size: .75rem; color: var(--text3); }
.c1-quality-details { margin-block: 1rem; min-width: 0; }
.c1-quality-details summary { min-height: 44px; cursor: pointer; padding-block: .75rem; }
.c1-quality-row { padding-block: .8rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.c1-quality-row p { margin-block: .4rem; }
/* C1 details keep long provenance readable on small screens. */
.detail-data-status { margin: 8px 24px 16px; color: var(--text2); line-height: 1.6; }
.detail-stat-unit { font: 400 14px/1.4 var(--font-body, sans-serif); color: var(--text3); }
#detail-table .detail-source { min-width: 160px; max-width: 420px; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
