:root {
  --bg: #ececec;
  --bg-soft: #f5f5f5;
  --surface: #ffffff;
  --text: #2f3033;
  --muted: #6a6b71;
  --line: #e6e8ee;
  --brand: #7f60b6;
  --brand-soft: #efe9fb;
  --danger: #b42318;
  --warning: #b54708;
  --success: #027a48;
  --radius: 14px;
  --shadow: 0 8px 18px -18px rgba(29, 36, 54, 0.34);
  --html-grad-start: #f1f3f7;
  --html-grad-end: #eceff4;
  --glow-a: rgba(127, 96, 182, 0.03);
  --glow-b: rgba(127, 96, 182, 0.025);
  --breadcrumb-surface: #ffffff;
  --breadcrumb-line: #eaedf3;
  --mini-track-bg: #fafafe;
  --mini-track-line: #7f60b6;
  --mini-track-start: #2a9a72;
  --mini-track-end: #d1563f;
  --trend-grid-line-strong: #e8e8ef;
  --trend-grid-line-soft: #f0f0f4;
  color-scheme: light;
}

html[data-theme-resolved="dark"] {
  --bg: #151922;
  --bg-soft: #1a1f2b;
  --surface: #1d2331;
  --text: #eceff7;
  --muted: #aab2c8;
  --line: #313a4f;
  --brand: #a58cdf;
  --brand-soft: #2a2440;
  --danger: #f97066;
  --warning: #f79009;
  --success: #32d583;
  --shadow: 0 14px 28px -24px rgba(5, 8, 18, 0.8);
  --html-grad-start: #111520;
  --html-grad-end: #181d2a;
  --glow-a: rgba(127, 96, 182, 0.12);
  --glow-b: rgba(74, 153, 255, 0.08);
  --breadcrumb-surface: #182132;
  --breadcrumb-line: #3b4760;
  --mini-track-bg: #182132;
  --mini-track-line: #9f87d7;
  --mini-track-start: #41c98a;
  --mini-track-end: #ef8d63;
  --trend-grid-line-strong: #2f384d;
  --trend-grid-line-soft: #252d3f;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Nunito Sans", "Avenir Next", "Segoe UI", sans-serif;
}

html {
  background: linear-gradient(180deg, var(--html-grad-start) 0%, var(--html-grad-end) 100%);
}

body {
  min-height: 100vh;
  position: relative;
  background: transparent;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, var(--glow-a), transparent 28%),
    radial-gradient(circle at 80% 85%, var(--glow-b), transparent 26%);
}

.app-shell {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 1120px;
  padding: 18px 14px 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px 16px;
}

.logo {
  font-size: 1.06rem;
  font-weight: 700;
}

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

.nav button {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.nav button:hover {
  color: var(--text);
}

.nav button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.nav .nav-logout {
  color: var(--muted);
  opacity: 0.7;
  border-bottom-color: transparent;
}

.nav .nav-logout:hover {
  color: var(--danger);
  opacity: 1;
}

.auth-wrap {
  max-width: 480px;
  margin: 58px auto;
  padding: 24px;
}

.h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  letter-spacing: -0.01em;
}

.subtle {
  color: var(--muted);
  margin: 6px 0 0;
}

.form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.upload-options {
  border: 1px solid #dde2ea;
  border-radius: 12px;
  background: #fff;
  padding: 11px 14px;
}

.upload-options > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #51545c;
  user-select: none;
}

.upload-options-body {
  margin-top: 10px;
}

.checkbox-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

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

.drop-zone {
  border: 1.5px dashed #d5dbe6;
  border-radius: 16px;
  background: #fafbfd;
  min-height: 230px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  border-color: #9f86cc;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(127, 96, 182, 0.08);
}

.drop-zone-inner {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  gap: 10px;
  text-align: center;
}

.drop-zone-inner i {
  font-size: 1.55rem;
  color: #8c74bf;
}

.drop-zone-inner strong {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.drop-zone-inner [data-dropzone-text] {
  margin-top: -2px;
  font-size: 1.05rem;
  white-space: pre-line;
  line-height: 1.45;
}

.upload-shell h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.upload-intro {
  margin: 0 0 10px;
}

.upload-shell .form {
  gap: 14px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #4e4f55;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: inherit;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid rgba(127, 96, 182, 0.3);
  outline-offset: 1px;
}

.btn,
button.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  transition: filter 0.18s ease;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-secondary {
  background: #f2f2f6;
  color: #4d4f54;
}

.btn-danger {
  background: #fde8e7;
  color: var(--danger);
}

.btn-danger-sm {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  min-width: 84px;
}

.grid {
  display: grid;
  gap: 10px;
}

.metric {
  padding: 14px;
  background: #fff;
}

.metric h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.metric .value {
  margin-top: 8px;
  font-size: 1.45rem;
  font-weight: 700;
}

.metric .tone-success { color: var(--success); }
.metric .tone-warning { color: var(--warning); }
.metric .tone-danger { color: var(--danger); }

.section {
  margin-top: 10px;
  padding: 16px;
}

.section h2 {
  margin: 0 0 10px;
  font-size: 1.14rem;
  font-weight: 700;
}

.profile-shell {
  padding: 18px;
}

.profile-account-strip {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-submenu {
  margin-top: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.profile-nav-tile {
  appearance: none;
  border: 1px solid #e2e4ea;
  border-radius: 12px;
  background: #fff;
  padding: 18px 16px;
  min-height: 120px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #3c4150;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.profile-nav-tile:hover {
  border-color: #cfc5ea;
  box-shadow: 0 8px 20px -20px rgba(73, 47, 110, 0.45);
}

.profile-nav-tile:focus-visible {
  outline: 2px solid rgba(127, 96, 182, 0.35);
  outline-offset: 1px;
}

.profile-nav-tile.active {
  border-color: #bca8e6;
  background: #f7f2ff;
  box-shadow: 0 12px 24px -22px rgba(73, 47, 110, 0.55);
}

.profile-nav-tile i {
  margin-top: 2px;
  color: #7f60b6;
  font-size: 0.92rem;
}

.profile-nav-copy {
  display: grid;
  gap: 2px;
}

.profile-nav-copy strong {
  font-size: 1.05rem;
  line-height: 1.2;
  color: #383d4b;
}

.profile-nav-copy small {
  font-size: 0.85rem;
  color: #7c8090;
}

.profile-panel-wrap {
  margin-top: 12px;
}

.profile-panel {
  padding: 14px;
}

.profile-panel-focus {
  margin-top: 0;
}

.profile-panel .btn {
  margin-top: 10px;
  width: 100%;
}

.profile-panel .btn-secondary,
.profile-panel .btn-primary {
  background: var(--brand);
  color: #fff;
}

.profile-panel .btn-secondary:hover,
.profile-panel .btn-primary:hover {
  filter: brightness(1.04);
}

.profile-panel h3,
.profile-note h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #4f4a5d;
}

.profile-keyline {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
  background: #f8f9fd;
  padding: 9px 11px;
}

.profile-form {
  margin-top: 10px;
}

.profile-note {
  margin-top: 10px;
  padding: 14px;
}

.profile-sync-meta {
  margin-top: 8px;
}

.profile-error-note {
  color: var(--danger);
}

.profile-danger {
  margin-top: 10px;
  padding: 14px;
  border-color: #f2d4d2;
  background: #fff8f7;
}

.profile-danger .btn {
  margin-top: 10px;
}

.ai-feedback-card h2,
.ai-dashboard-card h2,
.activity-ai-highlight h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-feedback-card h2 i,
.ai-dashboard-card h2 i,
.activity-ai-highlight h3 i {
  color: #7f60b6;
  font-size: 0.92em;
}

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

.section-head-row h2,
.section-head-row h3 {
  margin: 0;
}

.ai-feedback-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn-ai-wand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  font-size: 0.86rem;
  font-weight: 700;
}

.btn-ai-wand i {
  font-size: 0.86em;
  color: #7f60b6;
}

.ai-current-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand);
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.ai-compact-action {
  padding-top: 11px;
  padding-bottom: 11px;
}

.ai-compact-action .ai-feedback-actions {
  margin-top: 0;
}

.ai-inline-hint {
  font-size: 0.82rem;
  color: #7a8090;
}

.ai-feedback-empty {
  margin-top: 10px;
}

.ai-empty-icon {
  color: var(--brand);
  opacity: 0.5;
  margin-right: 4px;
}

.ai-feedback-output {
  margin-top: 10px;
  border: 1px solid #e5e9f2;
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
}

.ai-feedback-output p {
  margin: 0;
  color: #404656;
  line-height: 1.5;
  white-space: normal;
}

.ai-feedback-output p:empty {
  height: 0.5em;
}

.ai-feedback-output p + p:not(:empty) {
  margin-top: 2px;
}

.ai-feedback-meta {
  margin-bottom: 8px !important;
  font-size: 0.76rem;
  color: #7b8191 !important;
  letter-spacing: 0.01em;
}

.ai-dashboard-card {
  padding-top: 14px;
}

.ai-dashboard-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.ai-dashboard-panel {
  border: 1px solid #e5e9f2;
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
}

.ai-dashboard-panel h3 {
  margin: 0;
  font-size: 0.92rem;
  color: #4f4a5d;
}

.ai-today-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.focus-card {
  padding: 18px;
}

.focus-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.focus-main {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  margin-top: 12px;
}

.focus-main > div:last-child {
  min-width: 0;
}

.focus-label {
  font-size: clamp(1.35rem, 2.2vw, 2.15rem);
  font-weight: 800;
  line-height: 1.03;
  margin-bottom: 6px;
  white-space: nowrap;
}

.focus-main .subtle {
  margin-top: 4px;
}

.readiness-ring {
  --readiness: 0;
  --readiness-color: var(--brand);
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--readiness-color) calc(var(--readiness) * 1%), #ececf1 0);
  position: relative;
}

.readiness-high {
  --readiness-color: #2a9a72;
}

.readiness-moderate {
  --readiness-color: #7f60b6;
}

.readiness-low {
  --readiness-color: #d1563f;
}

.readiness-ring::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
}

.readiness-ring span {
  position: relative;
  z-index: 1;
  font-size: 1.2rem;
  font-weight: 700;
  color: #4f4a5d;
}

.status-gauge {
  --status: 50;
  --status-color: var(--brand);
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--status-color) calc(var(--status) * 1%), #ececf1 0);
  position: relative;
}

.status-gauge::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
}

.status-gauge span {
  position: relative;
  z-index: 1;
  font-size: 1.2rem;
  font-weight: 700;
  color: #4f4a5d;
}

.status-maintaining {
  --status-color: #7f60b6;
}

.status-productive {
  --status-color: #2a9a72;
}

.status-overreaching {
  --status-color: #d1563f;
}

.status-detraining {
  --status-color: #b48a3c;
}

.status-empty {
  --status-color: #d7dbe5;
}

/* ── Training status spectrum ─────────────────────────────── */

.training-spectrum {
  margin-top: 10px;
  width: 100%;
}

.training-spectrum-bar {
  position: relative;
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.training-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
  opacity: 0.85;
}

.training-zone-detraining {
  background: #b48a3c;
}

.training-zone-maintaining {
  background: #7f60b6;
}

.training-zone-productive {
  background: #2a9a72;
}

.training-zone-overreaching {
  background: #d1563f;
}

.training-spectrum-marker {
  --pos: 50;
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: calc(var(--pos) * 1% - 5px);
  width: 10px;
  border-radius: 4px;
  background: #fff;
  border: 2.5px solid var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease;
}

html[data-theme-resolved="dark"] .training-spectrum-marker {
  background: var(--surface);
  border-color: #fff;
}

html[data-theme-resolved="dark"] .training-zone {
  opacity: 1;
}

.distance-chart {
  margin-top: 8px;
}

.load-corridor-chart {
  margin-top: 8px;
}

.load-corridor-canvas {
  position: relative;
}

.load-corridor-svg {
  width: 100%;
  height: 220px;
  border: 1px solid #ececf1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f9 100%);
  display: block;
}

.load-grid-line {
  stroke-width: 1;
}

.load-grid-strong {
  stroke: #d7d8de;
}

.load-grid-soft {
  stroke: #e5e6eb;
}

.load-corridor-band {
  fill: rgba(76, 138, 216, 0.17);
}

.load-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.load-line-acute {
  stroke: #7f60b6;
}

.load-line-chronic {
  stroke: #3f76c5;
}

.load-hit-zone {
  cursor: crosshair;
}

.load-hover-cursor {
  stroke: #8fa4cc;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.load-hover-point {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.load-hover-point-acute {
  fill: #7f60b6;
}

.load-hover-point-chronic {
  fill: #3f76c5;
}

[data-load-chart].is-hovering .load-hover-cursor,
[data-load-chart].is-hovering .load-hover-point {
  opacity: 1;
}

.load-assessment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.load-assessment-optimal {
  background: #eaf7ef;
  border-color: #cde8d8;
  color: #226847;
}

.load-assessment-high {
  background: #fff4e8;
  border-color: #f3dac0;
  color: #9c541e;
}

.load-assessment-low {
  background: #e9f0ff;
  border-color: #cddcff;
  color: #2c5eb6;
}

.load-assessment-excessive {
  background: #ffeceb;
  border-color: #f7cfcc;
  color: #9f251f;
}

.load-chart-legend {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.79rem;
}

.load-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.load-swatch {
  width: 12px;
  height: 3px;
  border-radius: 99px;
  display: inline-block;
}

.load-swatch-acute {
  background: #7f60b6;
}

.load-swatch-chronic {
  background: #3f76c5;
}

.load-swatch-corridor {
  height: 8px;
  border-radius: 4px;
  background: rgba(76, 138, 216, 0.28);
}

.load-hover-readout-inline {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 7px 10px;
  border: 1px solid #d7deef;
  border-radius: 10px;
  background: rgba(246, 249, 255, 0.9);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  line-height: 1.1;
  color: #56607a;
  pointer-events: none;
  max-width: min(100%, 560px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 3;
}

.load-hover-readout-inline .load-hover-date {
  font-weight: 700;
  color: #3f5077;
  margin-right: 2px;
}

.distance-bars {
  height: 184px;
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  padding: 10px 8px 8px;
  border: 1px solid #ececf1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f9 100%);
}

.distance-bar-col {
  height: 100%;
  display: flex;
  align-items: end;
}

.distance-bar-fill {
  --h: 0;
  width: 100%;
  min-height: 2px;
  height: calc(var(--h) * 1%);
  border-radius: 6px;
  background: linear-gradient(180deg, #9e87ca 0%, #7f60b6 100%);
}

.distance-axis {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-charts-wrap {
  margin-top: 0;
}

.detail-charts-wrap h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.trend-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.trend-card {
  padding: 12px;
  border-color: #e9e7ef;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.trend-head h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.trend-current {
  font-size: 0.83rem;
  font-weight: 700;
  color: #4f4a5d;
  background: #f4f1fa;
  border: 1px solid #e5dcf4;
  padding: 4px 9px;
  border-radius: 999px;
}

.trend-svg {
  width: 100%;
  height: 134px;
  border: 1px solid #ececf1;
  border-radius: 10px;
  background: #fff;
  margin-top: 8px;
}

.trend-range {
  margin-top: 7px;
  font-size: 0.82rem;
  color: var(--muted);
}

.activity-detail-shell {
  padding: 18px;
  border-color: #dfe3eb;
  background:
    radial-gradient(1200px 320px at -8% -25%, rgba(69, 127, 255, 0.08), transparent 54%),
    radial-gradient(900px 260px at 110% -15%, rgba(42, 154, 114, 0.08), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e1e7f0;
}

.activity-detail-titleline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-detail-titleline .btn-back {
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.activity-detail-titlewrap {
  min-width: 0;
  flex: 1 1 auto;
}

.activity-detail-titlewrap h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  letter-spacing: -0.015em;
  line-height: 1.02;
}

.btn-title-edit {
  margin: 0;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #d8deea;
  background: #ffffff;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.btn-title-edit:hover {
  background: #f6f3fc;
  border-color: #cdbfe9;
}

.btn-title-edit i {
  color: #6f6191;
  font-size: 0.72rem;
}

.activity-detail-subline {
  margin-top: 7px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-detail-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid #d8e0ee;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
  color: #5b6578;
  font-size: 0.76rem;
  font-weight: 700;
}

.activity-detail-date i {
  color: #8b8f9a;
}

.activity-detail-source {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ai-inline {
  margin: 0;
  white-space: nowrap;
  min-height: 34px;
  padding: 7px 11px;
}

.source-missing-fit {
  margin: 0;
  font-size: 0.78rem;
}

.activity-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(42vw, 420px);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d8dff0;
  background: linear-gradient(180deg, #f6f9ff 0%, #eef4ff 100%);
  color: #405276;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-detail-subline .activity-source-chip {
  max-width: min(52vw, 520px);
  border-color: #dbe2ef;
  background: #f7f9fd;
  color: #5e6778;
}

.activity-source-chip.muted {
  border-color: #e5e9ef;
  background: linear-gradient(180deg, #f9fafb 0%, #f2f4f7 100%);
  color: #626a77;
}

.activity-detail-stack {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.activity-detail-block {
  margin: 0;
}

.activity-detail-shell .detail-charts-wrap {
  border: 1px solid #dde5f1;
  border-radius: 14px;
  padding: 15px;
  background: linear-gradient(180deg, #fdfdff 0%, #f7faff 100%);
}

.activity-detail-shell .detail-charts-wrap h3 {
  margin: 0 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #343948;
}

.activity-detail-shell .detail-charts-wrap h3 i {
  color: #4f6fb3;
  font-size: 0.9em;
}

.activity-detail-shell .trend-card {
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 20px -22px rgba(31, 52, 96, 0.35);
}

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

.activity-kpi {
  padding: 12px 14px;
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: 0 8px 20px -22px rgba(32, 58, 106, 0.28);
}

.activity-kpi h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.activity-kpi h3 i {
  color: #8b8f9a;
}

.activity-kpi .value {
  margin-top: 6px;
  font-size: clamp(1.65rem, 2.1vw, 2rem);
  letter-spacing: -0.01em;
}

.columns {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.4fr 1fr;
}

.activity-subhead {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: #596073;
}

.activity-recent-wrap + .activity-months-wrap {
  margin-top: 16px;
}

.activity-month-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.month-summary-card {
  border: 1px solid #e4e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 12px 13px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.month-summary-card:hover,
.month-summary-card:focus-visible {
  border-color: #d2d9e8;
  box-shadow: 0 10px 24px -24px rgba(40, 49, 68, 0.38);
  transform: translateY(-1px);
}

.month-summary-card-static {
  cursor: default;
}

.month-summary-card-static:hover,
.month-summary-card-static:focus-visible {
  border-color: #e4e8f0;
  box-shadow: none;
  transform: none;
}

.month-summary-card h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #353a49;
}

.month-summary-stats {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.month-summary-stats .month-stat-item {
  margin: 0;
  border: 1px solid #e6eaf3;
  border-radius: 10px;
  background: #fbfcff;
  padding: 8px 9px;
  display: grid;
  gap: 3px;
}

.month-summary-stats .month-stat-item small {
  font-size: 0.72rem;
  color: #7b8396;
  letter-spacing: 0.01em;
}

.month-summary-stats .month-stat-item strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #495167;
}

.month-summary-stats-full {
  margin-bottom: 12px;
  border: 1px solid #e4e8f0;
  border-radius: 12px;
  padding: 10px;
  background: #fbfcff;
}

.month-summary-stats-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.month-stat-load-up strong {
  color: #2b7a55;
}

.month-stat-load-down strong {
  color: #b04c24;
}

.month-stat-load-neutral strong {
  color: #67718a;
}

.month-activity-list {
  margin-top: 4px;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.activity-month-group {
  margin-top: 18px;
}

.activity-month-group:first-of-type {
  margin-top: 10px;
}

.activity-month-title {
  margin: 0 0 10px;
  padding: 0 2px 6px;
  border-bottom: 1px solid #eceff5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #55596b;
  letter-spacing: 0.01em;
}

.activity-month-count {
  font-size: 0.79rem;
  font-weight: 700;
  color: #8a8f9e;
  letter-spacing: 0;
}

.activity-item {
  border: 1px solid #e4e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.activity-item:hover,
.activity-item:focus-visible {
  border-color: #d2d9e8;
  box-shadow: 0 10px 24px -24px rgba(40, 49, 68, 0.38);
  transform: translateY(-1px);
}

.activity-content {
  min-width: 0;
}

.activity-track-mini svg {
  width: 84px;
  height: 60px;
  border: 1px solid var(--breadcrumb-line);
  border-radius: 10px;
  background: var(--breadcrumb-surface);
  overflow: hidden;
}

.track-mini-empty {
  width: 84px;
  height: 60px;
  border: 1px dashed var(--breadcrumb-line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--breadcrumb-surface);
  color: #9aa0ae;
}

.latest-activity {
  margin-top: 4px;
}

.activity-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

.activity-item .meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.activity-note-preview {
  margin: 8px 0 0;
  font-size: 0.81rem;
  color: #6a6e7b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-note-preview i {
  color: #969cac;
  flex: 0 0 auto;
}

.activity-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  color: #626877;
  margin-top: 5px;
}

.activity-meta-line > span {
  white-space: nowrap;
}

.activity-meta-line > span + span::before {
  content: "\00b7";
  margin: 0 8px;
  color: #adb2c0;
}

.activity-meta-line .meta-dim {
  color: #818795;
}

.meta-icon i {
  color: #8e9099;
}

.activity-sport-line {
  margin-top: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sport-kind-minimal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #667084;
}

.sport-kind-minimal i {
  font-size: 0.76rem;
  color: #7f60b6;
}

.sport-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #f2eefb;
  color: #61458f;
}

.sport-kind i {
  font-size: 0.72rem;
}

.effect-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.effect-badge-compact {
  padding: 3px 9px;
  font-size: 0.7rem;
}

.effect-badge-regular {
  padding: 4px 11px;
  font-size: 0.74rem;
}

.effect-recovery {
  background: #eef7f1;
  border-color: #d4eadb;
  color: #2b7a55;
}

.effect-base {
  background: #f0ecfb;
  border-color: #ded2f6;
  color: #6b4ca6;
}

.effect-hills {
  background: #f7efe7;
  border-color: #eedbc8;
  color: #9b5d26;
}

.effect-threshold {
  background: #fff1e9;
  border-color: #f7d8c7;
  color: #b05424;
}

.effect-vo2 {
  background: #feeef1;
  border-color: #f6d2da;
  color: #b1395a;
}

.effect-mixed {
  background: #f2f3f7;
  border-color: #dfe2ea;
  color: #596076;
}

.intensity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.intensity-badge-compact {
  padding: 3px 9px;
  font-size: 0.7rem;
}

.intensity-badge-regular {
  padding: 4px 11px;
  font-size: 0.74rem;
}

.intensity-low {
  background: #e8f0ff;
  border-color: #c5d7ff;
  color: #255ecf;
}

.intensity-moderate {
  background: #fff6db;
  border-color: #f3df99;
  color: #8a6500;
}

.intensity-high {
  background: #fff0e4;
  border-color: #f4d2b5;
  color: #b65516;
}

.intensity-extreme {
  background: #ffe8ec;
  border-color: #f5c5cf;
  color: #b31b3f;
}

.activity-item button {
  border: 1px solid #d8d8df;
  background: #fff;
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
}

.activity-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.activity-actions .btn-text-danger {
  color: var(--danger);
  border-color: #f1cecb;
}

.activity-note-preview span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.detail-focus-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.activity-detail-shell .focus-card {
  padding: 16px;
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px -24px rgba(28, 49, 92, 0.35);
}

.activity-detail-shell .focus-card h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.activity-detail-shell .focus-card h3 i {
  color: #4e6eb0;
  font-size: 0.9em;
}

.activity-note-card {
  margin-top: 0;
  padding: 14px;
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-track-card {
  margin-top: 0;
  padding: 14px;
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-ai-highlight {
  margin-top: 0;
  padding: 14px;
  border-color: #dfe6f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-ai-highlight h3 {
  font-size: 0.95rem;
  color: #4f4a5d;
}

.activity-ai-highlight .ai-feedback-output {
  margin-top: 8px;
  background: #fff;
}

.activity-note-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #4f4a5d;
}

.activity-track-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #4f4a5d;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.activity-detail-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.activity-detail-bottom-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

.danger-zone {
  width: 100%;
}

.danger-zone-summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 8px 0;
  text-align: right;
  list-style: none;
}

.danger-zone-summary::-webkit-details-marker {
  display: none;
}

.danger-zone-summary i {
  margin-right: 4px;
}

.danger-zone-summary:hover {
  color: var(--danger);
}

.danger-zone[open] .activity-detail-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.activity-detail-actions {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 6px;
}

.activity-detail-actions .footer-note {
  margin: 0;
  text-align: right;
}

.activity-detail-actions .btn { white-space: nowrap; }

.track-breadcrumb-canvas {
  width: 100%;
  aspect-ratio: 320 / 170;
  max-height: 260px;
  border: 1px solid var(--breadcrumb-line);
  border-radius: 10px;
  background: var(--breadcrumb-surface);
  overflow: hidden;
}

.track-breadcrumb-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  display: grid;
  gap: 8px;
  max-width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 10px 26px -22px rgba(40, 40, 40, 0.55);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast i {
  flex: 0 0 auto;
  width: 1em;
  text-align: center;
}

.toast span {
  display: block;
}

.toast-info {
  background: #f4eefc;
  border-color: #dfd1f4;
  color: #5d3f91;
}

.toast-loading {
  background: #eef4ff;
  border-color: #d1def8;
  color: #2e568f;
}

.toast-spinner {
  animation: toast-spin 0.95s linear infinite;
}

.toast-success {
  background: #ebf8f2;
  border-color: #cdeedd;
  color: #1d6c4f;
}

.toast-warning {
  background: #fff4eb;
  border-color: #f7e0cd;
  color: #8e4f17;
}

.toast-error {
  background: #feeceb;
  border-color: #f7cdca;
  color: #8d1f17;
}

@keyframes toast-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

canvas {
  width: 100%;
  min-height: 260px;
  border: 1px solid #ececf1;
  border-radius: 12px;
  background: #fff;
}

.footer-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #7c7f88;
}

.footer-note code {
  padding: 1px 5px;
  border-radius: 6px;
  border: 1px solid #dce2ee;
  background: #f7f9fe;
  color: #4a5570;
}

html[data-theme-resolved="dark"] .card,
html[data-theme-resolved="dark"] .upload-options,
html[data-theme-resolved="dark"] .activity-item,
html[data-theme-resolved="dark"] .activity-detail-shell,
html[data-theme-resolved="dark"] .activity-detail-shell .detail-charts-wrap,
html[data-theme-resolved="dark"] .trend-card,
html[data-theme-resolved="dark"] .ai-dashboard-panel,
html[data-theme-resolved="dark"] .profile-danger,
html[data-theme-resolved="dark"] .ai-feedback-output,
html[data-theme-resolved="dark"] .activity-ai-highlight .ai-feedback-output {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--text);
}

html[data-theme-resolved="dark"] .activity-detail-head {
  border-bottom-color: var(--line);
}

html[data-theme-resolved="dark"] .profile-nav-tile {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

html[data-theme-resolved="dark"] .month-summary-card,
html[data-theme-resolved="dark"] .month-summary-stats-full {
  border-color: var(--line);
  background: var(--surface);
}

html[data-theme-resolved="dark"] .activity-subhead,
html[data-theme-resolved="dark"] .month-summary-card h4 {
  color: var(--text);
}

html[data-theme-resolved="dark"] .month-summary-stats .month-stat-item {
  border-color: var(--line);
  background: #171e2c;
}

html[data-theme-resolved="dark"] .month-summary-stats .month-stat-item small {
  color: #9aa7bf;
}

html[data-theme-resolved="dark"] .month-summary-stats .month-stat-item strong {
  color: var(--text);
}

html[data-theme-resolved="dark"] .month-stat-load-up strong {
  color: #9ce0be;
}

html[data-theme-resolved="dark"] .month-stat-load-down strong {
  color: #f4b39d;
}

html[data-theme-resolved="dark"] .month-stat-load-neutral strong {
  color: #c6cfde;
}

html[data-theme-resolved="dark"] .profile-nav-tile:hover {
  border-color: #4f6086;
}

html[data-theme-resolved="dark"] .profile-nav-tile.active {
  border-color: #6f5da7;
  background: #1d2538;
}

html[data-theme-resolved="dark"] .profile-nav-copy strong {
  color: var(--text);
}

html[data-theme-resolved="dark"] .profile-nav-copy small {
  color: var(--muted);
}

html[data-theme-resolved="dark"] .profile-keyline {
  border-color: var(--line);
  background: #141a27;
}

html[data-theme-resolved="dark"] label,
html[data-theme-resolved="dark"] .profile-panel h3,
html[data-theme-resolved="dark"] .profile-note h3,
html[data-theme-resolved="dark"] .ai-dashboard-panel h3,
html[data-theme-resolved="dark"] .trend-head h4,
html[data-theme-resolved="dark"] .trend-current,
html[data-theme-resolved="dark"] .focus-label {
  color: var(--text) !important;
}

html[data-theme-resolved="dark"] input,
html[data-theme-resolved="dark"] select,
html[data-theme-resolved="dark"] textarea,
html[data-theme-resolved="dark"] .btn-secondary,
html[data-theme-resolved="dark"] .btn-title-edit {
  background: #141a27;
  border-color: var(--line);
  color: var(--text);
}

html[data-theme-resolved="dark"] .profile-panel .btn-secondary,
html[data-theme-resolved="dark"] .profile-panel .btn-primary {
  background: var(--brand);
  border-color: transparent;
  color: #ffffff;
}

html[data-theme-resolved="dark"] .btn-title-edit i,
html[data-theme-resolved="dark"] .btn-ai-wand i {
  color: var(--brand);
}

html[data-theme-resolved="dark"] .drop-zone {
  border-color: #495068;
  background: #141a27;
}

html[data-theme-resolved="dark"] .drop-zone:hover,
html[data-theme-resolved="dark"] .drop-zone.is-dragover {
  border-color: var(--brand);
  background: #171e2c;
}

html[data-theme-resolved="dark"] .drop-zone-inner i {
  color: var(--brand);
}

html[data-theme-resolved="dark"] .meta-dim,
html[data-theme-resolved="dark"] .footer-note,
html[data-theme-resolved="dark"] .subtle,
html[data-theme-resolved="dark"] .trend-range,
html[data-theme-resolved="dark"] .activity-meta-line,
html[data-theme-resolved="dark"] .ai-feedback-meta {
  color: var(--muted) !important;
}

html[data-theme-resolved="dark"] .activity-month-title,
html[data-theme-resolved="dark"] .activity-title,
html[data-theme-resolved="dark"] .section h2 {
  color: var(--text);
}

html[data-theme-resolved="dark"] .activity-ai-highlight h3,
html[data-theme-resolved="dark"] .activity-detail-shell .detail-charts-wrap h3,
html[data-theme-resolved="dark"] .activity-note-card h3,
html[data-theme-resolved="dark"] .activity-track-card h3,
html[data-theme-resolved="dark"] .activity-kpi h3 {
  color: var(--text) !important;
}

html[data-theme-resolved="dark"] .activity-ai-highlight h3 i,
html[data-theme-resolved="dark"] .activity-detail-shell .detail-charts-wrap h3 i,
html[data-theme-resolved="dark"] .activity-track-card h3 i,
html[data-theme-resolved="dark"] .activity-kpi h3 i {
  color: var(--brand) !important;
}

html[data-theme-resolved="dark"] .distance-bars {
  border-color: var(--line);
  background: linear-gradient(180deg, #171e2c 0%, #131927 100%);
}

html[data-theme-resolved="dark"] .load-corridor-svg {
  border-color: var(--line);
  background: linear-gradient(180deg, #171e2c 0%, #131927 100%);
}

html[data-theme-resolved="dark"] .load-grid-strong {
  stroke: #3a4154;
}

html[data-theme-resolved="dark"] .load-grid-soft {
  stroke: #2e3445;
}

html[data-theme-resolved="dark"] .load-corridor-band {
  fill: rgba(120, 164, 230, 0.18);
}

html[data-theme-resolved="dark"] .load-line-acute {
  stroke: #b79be8;
}

html[data-theme-resolved="dark"] .load-line-chronic {
  stroke: #79a8f2;
}

html[data-theme-resolved="dark"] .load-assessment-optimal {
  background: #1f3d2f;
  border-color: #305b46;
  color: #bde9cf;
}

html[data-theme-resolved="dark"] .load-assessment-high {
  background: #3d2d1f;
  border-color: #62452d;
  color: #f5d2ae;
}

html[data-theme-resolved="dark"] .load-assessment-low {
  background: #1d2c46;
  border-color: #334f7f;
  color: #c8dbff;
}

html[data-theme-resolved="dark"] .load-assessment-excessive {
  background: #422427;
  border-color: #69383d;
  color: #ffcfd4;
}

html[data-theme-resolved="dark"] .load-hover-cursor {
  stroke: #9fb6df;
}

html[data-theme-resolved="dark"] .load-hover-point-acute {
  fill: #b79be8;
}

html[data-theme-resolved="dark"] .load-hover-point-chronic {
  fill: #79a8f2;
}

html[data-theme-resolved="dark"] .load-hover-readout-inline {
  border-color: #3f4c69;
  background: rgba(20, 28, 43, 0.9);
  color: #c4cfe1;
}

html[data-theme-resolved="dark"] .load-hover-readout-inline .load-hover-date {
  color: #e2ecff;
}

html[data-theme-resolved="dark"] .distance-bar-fill {
  background: linear-gradient(180deg, #baa4ea 0%, #9a7fdd 100%);
}

html[data-theme-resolved="dark"] .activity-track-mini svg,
html[data-theme-resolved="dark"] .track-breadcrumb-canvas {
  border-color: var(--breadcrumb-line);
  background: var(--breadcrumb-surface);
}

html[data-theme-resolved="dark"] .activity-detail-date,
html[data-theme-resolved="dark"] .activity-source-chip {
  border-color: var(--line);
  background: #171e2c;
  color: #c6cfde;
}

html[data-theme-resolved="dark"] .trend-current {
  background: #1c2333;
  border-color: var(--line);
  color: #d2d9ea !important;
}

html[data-theme-resolved="dark"] .ai-feedback-output p,
html[data-theme-resolved="dark"] .activity-note-preview,
html[data-theme-resolved="dark"] .activity-note-preview i,
html[data-theme-resolved="dark"] .activity-month-count,
html[data-theme-resolved="dark"] .sport-kind-minimal {
  color: var(--muted) !important;
}

html[data-theme-resolved="dark"] .sport-kind-minimal i {
  color: var(--brand) !important;
}

html[data-theme-resolved="dark"] .sport-kind {
  border-color: var(--line);
  background: #2a2440;
  color: #d6c9f8;
}

html[data-theme-resolved="dark"] .effect-recovery {
  background: #173426;
  border-color: #2d5c44;
  color: #aee9c9;
}

html[data-theme-resolved="dark"] .effect-base {
  background: #2a2440;
  border-color: #4a3f6d;
  color: #dacdfc;
}

html[data-theme-resolved="dark"] .effect-hills {
  background: #3a2d1f;
  border-color: #69543a;
  color: #f0cfa9;
}

html[data-theme-resolved="dark"] .effect-threshold {
  background: #46271d;
  border-color: #7b4331;
  color: #ffc5a6;
}

html[data-theme-resolved="dark"] .effect-vo2 {
  background: #4a1f2b;
  border-color: #81374a;
  color: #ffb7c8;
}

html[data-theme-resolved="dark"] .effect-mixed {
  background: #252c3c;
  border-color: #3f475c;
  color: #c3cbde;
}

html[data-theme-resolved="dark"] .intensity-low {
  background: #1b2a4a;
  border-color: #2d4b84;
  color: #9dc2ff;
}

html[data-theme-resolved="dark"] .intensity-moderate {
  background: #3a331b;
  border-color: #675b2f;
  color: #f1dd94;
}

html[data-theme-resolved="dark"] .intensity-high {
  background: #422919;
  border-color: #7a4827;
  color: #ffc08e;
}

html[data-theme-resolved="dark"] .intensity-extreme {
  background: #4a1f29;
  border-color: #803344;
  color: #ffb2c2;
}

html[data-theme-resolved="dark"] .status-gauge,
html[data-theme-resolved="dark"] .readiness-ring {
  background: conic-gradient(var(--status-color, var(--readiness-color)) calc(var(--status, var(--readiness)) * 1%), #30384c 0);
}

html[data-theme-resolved="dark"] .status-gauge::after,
html[data-theme-resolved="dark"] .readiness-ring::after {
  background: #161b28;
}

html[data-theme-resolved="dark"] .status-gauge span,
html[data-theme-resolved="dark"] .readiness-ring span {
  background: transparent;
  color: var(--text);
}

html[data-theme-resolved="dark"] .trend-svg {
  background: #141a26;
  border-color: var(--line);
}

html[data-theme-resolved="dark"] .trend-svg line {
  stroke: #2d3547;
}

html[data-theme-resolved="dark"] .activity-track-mini,
html[data-theme-resolved="dark"] .track-mini-empty {
  background: var(--breadcrumb-surface);
  border-color: var(--breadcrumb-line);
}

html[data-theme-resolved="dark"] .toast-info {
  background: #2a2440;
  border-color: #493b70;
  color: #ded3fb;
}

html[data-theme-resolved="dark"] .toast-loading {
  background: #1c2b44;
  border-color: #314d79;
  color: #d2e5ff;
}

html[data-theme-resolved="dark"] .toast-success {
  background: #193629;
  border-color: #2f5b46;
  color: #c8f3dc;
}

html[data-theme-resolved="dark"] .toast-warning {
  background: #3a2a18;
  border-color: #5c4228;
  color: #f6dfc4;
}

html[data-theme-resolved="dark"] .toast-error {
  background: #402324;
  border-color: #633437;
  color: #ffd4d7;
}

html[data-theme-resolved="dark"] .footer-note code {
  border-color: var(--line);
  background: #121828;
  color: #b8c3dc;
}

@media (max-width: 980px) {
  .columns {
    grid-template-columns: 1fr;
  }

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

  .activity-kpi-grid {
    grid-template-columns: 1fr;
  }

  .detail-focus-grid {
    grid-template-columns: 1fr;
  }

  .activity-detail-foot {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .activity-detail-actions {
    justify-items: start;
  }

  .month-summary-stats,
  .month-summary-stats-compact,
  .month-summary-stats-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .profile-account-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .app-shell {
    max-width: 430px;
    padding: 12px 8px 38px;
  }

  .header {
    padding: 12px;
  }

  .focus-main {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .focus-label {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
  }

  .activity-detail-shell {
    padding: 14px;
  }

  .activity-detail-head {
    display: grid;
    gap: 8px;
  }

  .activity-detail-source {
    margin-top: 0;
    justify-content: flex-start;
  }

  .btn-ai-inline {
    justify-self: start;
    min-height: 32px;
  }

  .activity-source-chip {
    max-width: min(100%, 90vw);
  }

  .activity-detail-actions {
    justify-items: start;
  }

  .month-summary-stats,
  .month-summary-stats-compact,
  .month-summary-stats-full {
    grid-template-columns: minmax(0, 1fr);
  }

  .activity-detail-actions .footer-note {
    text-align: left;
  }

  .activity-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
  }

  .drop-zone {
    min-height: 190px;
    padding: 16px;
  }

  .drop-zone-inner strong {
    font-size: 1.26rem;
  }

  .drop-zone-inner [data-dropzone-text] {
    font-size: 0.95rem;
  }

  .activity-content {
    min-width: 0;
  }

  .activity-track-mini {
    display: none;
  }

  .section-head-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

/* ── Wizard ─────────────────────────────────────────────────────────────── */

.wizard-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.wizard-card {
  width: 100%;
  max-width: 520px;
  padding: 36px 32px;
}

.wizard-progress {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 28px;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
}

.wizard-step-label {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.wizard-step-active .wizard-step-label {
  color: var(--brand);
  font-weight: 600;
}

.wizard-step-done .wizard-step-label {
  color: var(--brand);
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s;
}

.wizard-dot-active {
  background: var(--brand);
  transform: scale(1.2);
}

.wizard-dot-done {
  background: var(--brand-soft);
  border: 2px solid var(--brand);
}

.wizard-body h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.wizard-body p {
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.55;
}

.wizard-button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Shared AI config card in wizard */
.wizard-ai-shared-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--brand) 30%, var(--border));
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.wizard-ai-shared-icon {
  font-size: 1.6rem;
  color: var(--brand);
  flex-shrink: 0;
}

.wizard-ai-shared-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wizard-ai-shared-info strong {
  font-size: 1rem;
}

.wizard-ai-shared-info span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.wizard-ai-shared-check {
  font-size: 1.3rem;
  color: var(--brand);
  flex-shrink: 0;
}

/* Subtle own-AI escape link */
.wizard-own-ai-link {
  text-align: center;
  margin-top: 16px;
  margin-bottom: 0;
}
.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}
.field-hint a {
  color: var(--accent, #6366f1);
  text-decoration: none;
}
.field-hint a:hover {
  text-decoration: underline;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--text);
}

.wizard-feature-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.wizard-feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-feature-list li i {
  color: var(--brand);
  width: 18px;
  text-align: center;
}

.wizard-section-label {
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── AI Mode Tabs ───────────────────────────────────────────────────────── */

.ai-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--surface-alt, color-mix(in srgb, var(--text) 8%, var(--surface)));
  border-radius: 12px;
  padding: 4px;
}

.ai-mode-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.ai-mode-tab i {
  font-size: 1.2rem;
}

.ai-mode-tab:hover:not(.ai-mode-tab-active) {
  color: var(--text);
}

.ai-mode-tab-active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.ai-mode-info-box {
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

/* ── Round icon button ──────────────────────────────────────────────────── */

.btn-icon-round {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Upload modal ───────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-alt, color-mix(in srgb, var(--text) 8%, var(--surface)));
}

/* ── Nav credits badge ──────────────────────────────────────────────────── */

.nav-credits {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  cursor: default;
  user-select: none;
  margin-left: auto;
}

.nav-credits-ok {
  background: var(--brand-soft, color-mix(in srgb, var(--brand) 12%, transparent));
  color: var(--brand);
}

.nav-credits-low {
  background: #fff3cd;
  color: #7a5300;
}

html[data-theme-resolved="dark"] .nav-credits-low {
  background: #3a2a00;
  color: #f5c842;
}

.nav-credits-empty {
  background: #fde8e8;
  color: #c0392b;
}

html[data-theme-resolved="dark"] .nav-credits-empty {
  background: #3a0a0a;
  color: #e74c3c;
}

/* ── AI Credits ─────────────────────────────────────────────────────────── */

.ai-credits-bar {
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.ai-credits-unlimited {
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-credits-ok {
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.ai-credits-low {
  background: #fff8ee;
  border: 1px solid #f5c97a;
}

html[data-theme-resolved="dark"] .ai-credits-low {
  background: #2a2010;
  border-color: #6b4f10;
}

.ai-credits-empty {
  background: #fff2f2;
  border: 1px solid #f9a8a8;
}

html[data-theme-resolved="dark"] .ai-credits-empty {
  background: #2a1010;
  border-color: #7a2020;
}

.ai-credits-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.ai-credits-track {
  height: 5px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 6px;
}

.ai-credits-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--brand);
  transition: width 0.3s;
}

.ai-credits-empty .ai-credits-fill {
  background: var(--danger);
}

.ai-credits-low .ai-credits-fill {
  background: var(--warning);
}

.ai-credits-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

/* ── Admin ──────────────────────────────────────────────────────────────── */

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
}

.btn-xs {
  font-size: 0.78rem;
  padding: 4px 10px;
}

.admin-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-config-card {
  padding: 16px 18px;
}

.admin-config-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-config-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
