.public-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  padding: 20px;
  font-size: 12px;
}
.public-links a { color: #a8b3c7; text-underline-offset: 4px; }
.public-links a:hover { color: #f8fafc; }
body:has(#authView:not([hidden])) > footer.public-links { display: none; }

:root {
  color-scheme: dark;
  --canvas: #0f1117;
  --sidebar: #0b0d13;
  --surface: rgba(26, 29, 39, 0.72);
  --surface-strong: #1a1d27;
  --surface-soft: rgba(255, 255, 255, 0.03);
  --text: #f8fafc;
  --muted: #94a3b8;
  --quiet: #64748b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent-start: #6366f1;
  --accent-end: #8b5cf6;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow-accent: 0 10px 24px rgba(99, 102, 241, 0.28);
  --font:
    "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: ui-monospace, "SFMono-Regular", "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -20%, rgba(99, 102, 241, 0.08), transparent 30%),
    var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

[hidden] {
  display: none !important;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  box-shadow: var(--shadow-accent);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: contain;
}

.brand-mark-large {
  width: 64px;
  height: 64px;
  margin: 0 auto 26px;
  border-radius: 16px;
}

.brand-mark-large img {
  width: 100%;
  height: 100%;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(100deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.22);
}

.primary-button:hover:not(:disabled) {
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.36);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: transparent;
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(139, 92, 246, 0.5);
  color: var(--text);
  background: var(--accent-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.08);
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.08);
}

.status-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.08);
}

.backend-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--quiet);
  font-size: 0.75rem;
}

/* Authentication */

.auth-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  overflow: hidden;
}

.auth-story,
.auth-access {
  position: relative;
  min-height: 100vh;
}

.auth-story {
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}

.auth-story::after {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 96%, rgba(255, 255, 255, 0.025)),
    var(--canvas);
  content: "";
}

.auth-aurora {
  position: absolute;
  z-index: -2;
  width: min(55vw, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.1) 38%, transparent 70%);
  filter: blur(24px);
}

.auth-wave {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: max(720px, 100%);
  max-width: none;
  opacity: 0.72;
  transform: translate(-50%, -50%);
}

.brand-story {
  width: min(440px, calc(100% - 64px));
  text-align: center;
}

.brand-story h1,
.brand-story p {
  margin: 0;
}

.brand-story h1 {
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.8));
  background-clip: text;
  color: transparent;
  font-size: clamp(2.8rem, 4vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brand-promise {
  margin-top: 18px !important;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.65;
}

.brand-features {
  display: grid;
  width: fit-content;
  gap: 12px;
  margin: 48px auto 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
  text-align: left;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.brand-features li > span {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.1);
}

.brand-features img {
  width: 16px;
  height: 16px;
}

.auth-access {
  display: grid;
  place-items: center;
}

.auth-access::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 256px;
  height: 256px;
  border-bottom-left-radius: 100%;
  background: linear-gradient(225deg, rgba(99, 102, 241, 0.05), transparent 70%);
  content: "";
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: min(448px, calc(100% - 56px));
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 58px;
  margin-bottom: 32px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 7px;
  background: rgba(26, 29, 39, 0.5);
}

.auth-tab {
  border: 0;
  border-radius: 8px;
  color: var(--quiet);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  color: #fff;
  background: linear-gradient(105deg, var(--accent-start), var(--accent-end));
}

.auth-copy h2,
.auth-copy p {
  margin: 0;
}

.auth-copy h2 {
  font-size: 1.5rem;
  line-height: 1.35;
}

.auth-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.875rem;
}

.auth-form {
  display: none;
  margin-top: 24px;
}

.auth-form.active {
  display: block;
  animation: fade-up 220ms ease both;
}

.auth-form label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.auth-form .sms-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  line-height: 1.6;
  cursor: pointer;
}

.sms-consent-label input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--accent-start);
}

.sms-consent p {
  margin: 8px 0 0 26px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input-shell:focus-within {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-shell > img {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
}

.input-shell input,
.input-shell select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: 0;
  padding: 0 44px;
  color: var(--text);
  background: transparent;
  font-size: 0.875rem;
}

.input-shell select {
  appearance: none;
  padding: 0 34px 0 14px;
  cursor: pointer;
}

.input-shell select option {
  color: var(--text);
  background: var(--surface-strong);
}

.input-shell input::placeholder {
  color: var(--quiet);
  opacity: 1;
}

.input-shell-plain input {
  padding: 0 14px;
}

.input-action {
  position: absolute;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  border: 0;
  place-items: center;
  background: transparent;
  cursor: pointer;
}

.input-action img {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.identity-row {
  grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
}

.phone-identity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.phone-identity-row.phone-mode {
  grid-template-columns: auto minmax(0, 1fr);
}

.calling-code-shell select,
.calling-code-shell input {
  width: 104px;
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.verification-row .secondary-button {
  min-width: 112px;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
}

.auth-switch {
  margin: 26px 0 0;
  color: var(--quiet);
  font-size: 0.875rem;
  text-align: center;
}

.auth-switch button {
  border: 0;
  padding: 0;
  color: #818cf8;
  background: transparent;
  font-weight: 500;
  cursor: pointer;
}

.auth-api-state {
  justify-content: center;
  margin-top: 24px;
}

/* Signed-in app shell */

.app-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  padding: 28px 17px 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(99, 102, 241, 0.08), transparent 34%),
    var(--sidebar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

.app-nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 9px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item img {
  width: 20px;
  height: 20px;
  opacity: 0.72;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.17), rgba(139, 92, 246, 0.11));
}

.nav-item.active img {
  opacity: 1;
}

.sidebar-system {
  margin-top: auto;
  padding: 14px 12px;
}

.profile-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: var(--surface-soft);
}

.profile-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(139, 92, 246, 0.8));
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.profile-copy strong,
.profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: 0.77rem;
  font-weight: 600;
}

.profile-copy small {
  color: var(--quiet);
  font-size: 0.65rem;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  place-items: center;
  border-radius: 7px;
  color: var(--quiet);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.app-main {
  min-width: 0;
  padding: 42px 38px 56px;
}

.app-view {
  width: min(1196px, 100%);
  margin: 0 auto;
}

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

.page-header h1,
.page-header p {
  margin: 0;
}

.page-header h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.25rem);
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.page-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.875rem;
}

.snapshot-meta {
  position: relative;
  display: grid;
  min-width: 208px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 15px 11px 19px;
  background: var(--surface-soft);
}

.snapshot-meta::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--accent-start), var(--accent-end));
  content: "";
}

.snapshot-meta strong,
.snapshot-meta small {
  display: block;
}

.snapshot-meta strong {
  margin-top: 2px;
  font-family: var(--font-data);
  font-size: 0.82rem;
  font-weight: 600;
}

.snapshot-meta small {
  color: var(--quiet);
  font-size: 0.65rem;
}

.snapshot-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.snapshot-label i,
.score-freshness i {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background:
    radial-gradient(circle at 8% 50%, rgba(99, 102, 241, 0.12), transparent 20%),
    var(--surface);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state h2 {
  font-size: 1rem;
}

.empty-state p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-state .primary-button {
  margin-left: auto;
  white-space: nowrap;
}

.empty-orbit {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  box-shadow: var(--shadow-accent);
}

.empty-orbit img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
}

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

.score-card,
.trend-panel,
.activity-panel,
.metrics-panel,
.connection-summary,
.provider-row {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.018), transparent 45%),
    var(--surface);
}

.score-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  border-radius: 12px;
  padding: 18px;
}

.score-card::after {
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.09);
  filter: blur(28px);
  content: "";
}

.score-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.score-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-glyph {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.86));
  font-size: 1rem;
}

.score-heading h2,
.score-heading p {
  margin: 0;
}

.score-heading h2 {
  font-size: 0.9rem;
  font-weight: 600;
}

.score-heading p {
  color: var(--quiet);
  font-family: var(--font-data);
  font-size: 0.68rem;
}

.provider-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.66rem;
}

.score-number {
  margin-top: 14px;
  font-family: var(--font-data);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-number span {
  margin-left: 4px;
  color: var(--quiet);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
}

.score-rating {
  margin: 5px 0 0;
  color: #a78bfa;
  font-size: 0.75rem;
}

.score-track {
  height: 5px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.score-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c7cff, #c084fc);
}

.score-freshness {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.score-freshness.stale {
  color: var(--warning);
}

.score-freshness.stale i {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.trend-panel,
.activity-panel,
.metrics-panel {
  border-radius: 12px;
}

.trend-panel {
  margin-top: 18px;
  padding: 18px 18px 10px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.panel-heading p {
  margin: 0;
}

.panel-heading h2 {
  font-size: 0.95rem;
}

.panel-heading p {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 0.7rem;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.trend-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--quiet);
  font-size: 0.68rem;
}

.trend-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.trend-chart {
  min-height: 220px;
  margin-top: 12px;
}

.trend-svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

.trend-grid-line {
  stroke: rgba(148, 163, 184, 0.12);
  stroke-dasharray: 4 4;
}

.trend-axis-label {
  fill: var(--quiet);
  font-family: var(--font);
  font-size: 10px;
}

.trend-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.35));
}

.trend-point {
  stroke: var(--surface-strong);
  stroke-width: 2;
}

.overview-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.activity-panel,
.metrics-panel {
  min-width: 0;
  padding: 18px;
}

.event-list,
.metric-list {
  margin-top: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.35fr) repeat(3, minmax(74px, 0.72fr));
  gap: 12px;
  align-items: center;
  min-height: 72px;
  border-top: 1px solid var(--line);
}

.event-row:first-child,
.metric-row:first-child {
  border-top-color: transparent;
}

.event-primary-info {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.event-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 50%;
  color: #c4b5fd;
  background: rgba(99, 102, 241, 0.16);
}

.event-icon.workout {
  border-color: rgba(74, 222, 128, 0.35);
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
}

.event-row strong,
.event-row small,
.metric-row strong,
.metric-row small {
  display: block;
}

.event-row strong,
.metric-row strong {
  font-size: 0.76rem;
  font-weight: 600;
}

.event-row small,
.metric-row small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 0.64rem;
}

.event-stat {
  min-width: 0;
}

.event-summary-unavailable {
  grid-column: 2 / -1;
  min-width: 0;
}

.event-stat strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  border-top: 1px solid var(--line);
}

.metric-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.metric-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  color: #c4b5fd;
  background: rgba(99, 102, 241, 0.15);
  font-size: 0.68rem;
}

.metric-value {
  color: #dbe4f0;
  font-family: var(--font-data);
  font-size: 0.76rem;
  white-space: nowrap;
}

/* Provider data */

.provider-data-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.provider-data-card {
  --provider-accent: #8b5cf6;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--provider-accent) 8%, transparent), transparent 38%),
    var(--surface);
}

.provider-data-card::before {
  position: absolute;
  top: 0;
  right: 20px;
  left: 20px;
  height: 2px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--provider-accent), transparent);
  content: "";
  opacity: 0.72;
}

.provider-data-card[data-provider="oura"] {
  --provider-accent: #a78bfa;
}

.provider-data-card[data-provider="whoop"] {
  --provider-accent: #60a5fa;
}

.provider-data-card[data-provider="apple"] {
  --provider-accent: #fb7185;
}

.provider-data-card-header,
.provider-data-name,
.provider-data-name > div,
.provider-measure > span,
.provider-event {
  display: flex;
  align-items: center;
}

.provider-data-card-header {
  justify-content: space-between;
  gap: 14px;
}

.provider-data-name {
  min-width: 0;
  gap: 12px;
}

.provider-data-name > div {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
}

.provider-data-name h2,
.provider-data-name small {
  margin: 0;
}

.provider-data-name h2 {
  font-size: 1.05rem;
}

.provider-data-name small,
.provider-data-state {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 0.65rem;
}

.provider-data-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--provider-accent) 38%, transparent);
  border-radius: 50%;
  color: #f8fafc;
  background: color-mix(in srgb, var(--provider-accent) 16%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--provider-accent) 22%, transparent);
  font-weight: 800;
}

.provider-data-state {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
}

.provider-data-state.is-connected {
  border-color: rgba(74, 222, 128, 0.2);
  color: var(--success);
  background: rgba(34, 197, 94, 0.07);
}

.provider-score-list {
  display: flex;
  min-height: 52px;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
}

.provider-score-pill {
  display: grid;
  min-width: 78px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.018);
}

.provider-score-pill small {
  color: var(--quiet);
  font-size: 0.61rem;
}

.provider-score-pill strong {
  font-family: var(--font-data);
  font-size: 0.86rem;
}

.provider-data-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.provider-data-columns section {
  min-width: 0;
}

.provider-data-columns h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.provider-measure,
.provider-event {
  min-height: 46px;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.provider-measure:first-child,
.provider-event:first-child {
  border-top: 0;
}

.provider-measure > span {
  min-width: 0;
  gap: 8px;
}

.provider-measure i,
.provider-event > i {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--provider-accent);
  background: color-mix(in srgb, var(--provider-accent) 12%, transparent);
  font-size: 0.62rem;
  font-style: normal;
}

.provider-event > i.workout {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.provider-measure span span,
.provider-event span {
  min-width: 0;
}

.provider-measure strong,
.provider-measure small,
.provider-event strong,
.provider-event small {
  display: block;
}

.provider-measure strong,
.provider-event strong {
  overflow: hidden;
  font-size: 0.69rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-measure small,
.provider-event small {
  margin-top: 2px;
  color: var(--quiet);
  font-size: 0.58rem;
}

.provider-measure b,
.provider-event b {
  flex: 0 0 auto;
  color: #dbe4f0;
  font-family: var(--font-data);
  font-size: 0.68rem;
  font-weight: 600;
}

.provider-data-empty {
  margin: 10px 0;
  color: var(--quiet);
  font-size: 0.66rem;
}

/* Connections */

.connection-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 12px;
  padding: 18px 20px;
}

.connection-summary > div {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 13px;
  border-left: 1px solid var(--line);
  padding: 0 24px;
}

.connection-summary > div:first-child {
  border-left: 0;
  padding-left: 0;
}

.connection-summary > div:last-child {
  padding-right: 0;
}

.connection-summary strong,
.connection-summary small {
  display: block;
}

.connection-summary strong {
  font-size: 0.84rem;
  font-weight: 500;
}

.connection-summary small {
  margin-top: 4px;
  color: var(--quiet);
  font-size: 0.68rem;
}

.summary-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
}

.summary-icon img {
  width: 19px;
  height: 19px;
}

.summary-clock {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 1.25rem;
}

.provider-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.provider-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) minmax(220px, 0.78fr) minmax(190px, 0.58fr);
  gap: 26px;
  align-items: center;
  min-height: 196px;
  border-radius: 12px;
  padding: 24px;
}

.provider-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 20px;
}

.provider-emblem {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.08) 50%, transparent 70%);
}

.oura-emblem::before {
  width: 40px;
  height: 40px;
  border: 5px solid #e2e8f0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(15, 17, 23, 0.7),
    0 0 22px rgba(99, 102, 241, 0.42);
  content: "";
}

.whoop-emblem {
  color: #f8fafc;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.15em;
}

.google-health-emblem {
  color: #f8fafc;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 22px rgba(99, 102, 241, 0.46);
}

.apple-emblem {
  border: 1px solid rgba(248, 113, 113, 0.22);
  color: #fb7185;
  background:
    radial-gradient(circle, rgba(244, 63, 94, 0.2), rgba(139, 92, 246, 0.07) 55%, transparent 72%);
  font-size: 2rem;
  text-shadow: 0 0 22px rgba(244, 63, 94, 0.42);
}

.provider-identity h2,
.provider-identity p {
  margin: 0;
}

.provider-identity h2 {
  font-size: 1.4rem;
}

.provider-identity p {
  max-width: 370px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.55;
}

.provider-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

.provider-status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--quiet);
  content: "";
}

.provider-status.connected {
  color: var(--success);
}

.provider-status.connected::before {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.45);
}

.provider-status.warning {
  color: var(--warning);
}

.provider-status.warning::before {
  background: var(--warning);
}

.provider-data {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.75rem;
  list-style: none;
}

.provider-data li {
  position: relative;
  padding-left: 18px;
}

.provider-data li::before {
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #818cf8;
  content: "";
}

.provider-actions {
  display: grid;
  gap: 9px;
}

.provider-actions button {
  width: 100%;
}

.apple-import-form {
  align-content: center;
}

.archive-picker {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.34);
  border-radius: 9px;
  padding: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.archive-picker:hover {
  border-color: rgba(167, 139, 250, 0.62);
  background: rgba(99, 102, 241, 0.07);
}

.archive-picker:focus-within {
  outline: 2px solid rgba(167, 139, 250, 0.9);
  outline-offset: 2px;
}

.archive-picker-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 8px;
  color: #ddd6fe;
  background: rgba(99, 102, 241, 0.18);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.archive-picker strong,
.archive-picker small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-picker strong {
  max-width: 150px;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 600;
}

.archive-picker small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 0.58rem;
}

.archive-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.apple-import-progress {
  display: grid;
  gap: 6px;
}

.apple-import-progress[hidden] {
  display: none;
}

.apple-import-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--quiet);
  font-size: 0.6rem;
}

.apple-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.apple-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb7185, #a78bfa);
  transition: width 240ms ease;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin 0.75s linear infinite;
}

/* Toasts */

.toast-region {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(380px, calc(100% - 40px));
  gap: 8px;
  pointer-events: none;
}

.message {
  border: 1px solid var(--line-strong);
  border-left: 3px solid #818cf8;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(19, 22, 31, 0.96);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  animation:
    toast-in 220ms ease both,
    toast-out 200ms ease 4.8s forwards;
}

.message.error {
  border-left-color: var(--danger);
  color: #fecdd3;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sidebar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .app-main {
    padding-right: 24px;
    padding-left: 24px;
  }

  .provider-row {
    grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.7fr);
  }

  .provider-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .auth-view {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .auth-story,
  .auth-access {
    min-height: auto;
  }

  .auth-story {
    min-height: 300px;
    padding: 56px 24px 34px;
  }

  .brand-mark-large {
    margin-bottom: 18px;
  }

  .brand-story h1 {
    font-size: 2.75rem;
  }

  .brand-promise {
    font-size: 1rem;
  }

  .brand-features {
    display: none;
  }

  .auth-access {
    align-items: start;
    padding: 36px 0 60px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    top: 0;
    display: grid;
    width: 100%;
    height: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 16px;
    background: rgba(11, 13, 19, 0.94);
    backdrop-filter: blur(18px);
  }

  .sidebar-brand > span:last-child,
  .sidebar-system,
  .profile-copy {
    display: none;
  }

  .app-nav {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 0;
  }

  .nav-item {
    min-height: 42px;
    padding: 0 12px;
  }

  .nav-item img {
    width: 18px;
    height: 18px;
  }

  .profile-card {
    border: 0;
    padding: 0;
    background: transparent;
  }

  .profile-avatar {
    display: none;
  }

  .app-main {
    padding: 28px 18px 48px;
  }

  .score-grid {
    grid-template-columns: 1fr 1fr;
  }

  .score-card:first-child {
    grid-column: 1 / -1;
  }

  .overview-lower {
    grid-template-columns: 1fr;
  }

  .connection-summary {
    grid-template-columns: 1fr;
  }

  .connection-summary > div,
  .connection-summary > div:first-child,
  .connection-summary > div:last-child {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 14px 0;
  }

  .connection-summary > div:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .connection-summary > div:last-child {
    padding-bottom: 0;
  }

  .provider-row {
    grid-template-columns: 1fr;
  }

  .provider-data-board {
    grid-template-columns: 1fr;
  }

  .provider-actions {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .auth-story {
    min-height: 260px;
    padding-top: 42px;
  }

  .brand-story {
    width: min(100% - 36px, 440px);
  }

  .brand-story h1 {
    font-size: 2.3rem;
  }

  .brand-mark-large {
    width: 54px;
    height: 54px;
  }

  .auth-panel {
    width: min(100% - 32px, 448px);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    grid-template-columns: auto 1fr auto;
    padding: 8px 10px;
  }

  .sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .app-nav {
    justify-content: flex-start;
    margin-left: 8px;
  }

  .nav-item {
    gap: 7px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .page-header {
    display: block;
  }

  .snapshot-meta {
    width: fit-content;
    min-width: 0;
    margin-top: 14px;
  }

  .empty-state {
    display: grid;
    text-align: center;
  }

  .empty-orbit {
    margin: 0 auto;
  }

  .empty-state .primary-button {
    width: 100%;
    margin: 2px 0 0;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }

  .score-card:first-child {
    grid-column: auto;
  }

  .panel-heading {
    display: block;
  }

  .trend-legend {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .event-row {
    grid-template-columns: minmax(130px, 1fr) 1fr;
    padding: 12px 0;
  }

  .event-row.summary-unavailable {
    grid-template-columns: 1fr;
  }

  .event-stat:nth-last-child(-n + 2) {
    display: none;
  }

  .event-summary-unavailable {
    grid-column: 1;
    padding-left: 44px;
  }

  .provider-row {
    gap: 18px;
    padding: 20px;
  }

  .provider-data-columns {
    grid-template-columns: 1fr;
  }

  .provider-identity {
    align-items: flex-start;
  }

  .provider-emblem {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .provider-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
