/* ── Variables ───────────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #1c2330;
  --border:      #30363d;
  --border-soft: #21262d;
  --text:        #e6edf3;
  --text-muted:  #7d8590;
  --text-dim:    #484f58;
  --accent:      #00b4d8;
  --accent-glow: rgba(0,180,216,.15);

  --running:        #4f8ef7;
  --swimming:       #06d6a0;
  --aerobics:       #ffb703;
  --weight_training:#f77f4f;
  --other:          #6b7280;

  --radius:   10px;
  --radius-sm: 6px;
  --font-head: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px;
  margin: auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: 1rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-user {
  font-size: .85rem;
  color: var(--text-muted);
}
.nav-logout {
  font-size: .85rem;
  color: var(--text-muted);
}
.nav-logout:hover { color: var(--text); }

/* Upload button in nav */
.upload-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.upload-btn:hover { background: var(--accent-glow); }

/* ── Main ────────────────────────────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.alert-ok    { background: rgba(6,214,160,.12);  border: 1px solid #06d6a0; color: #06d6a0; }
.alert-error { background: rgba(247,77,79,.12);  border: 1px solid #f74d4f; color: #f74d4f; }

/* ── Stats bar ───────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 140px;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.stat-value {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
}
.stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: .35rem;
}
.chart-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
}

/* ── Toolbar ─────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.filter-tab {
  padding: .3rem .8rem;
  border-radius: 99px;
  font-size: .84rem;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  transition: all .15s;
}
.filter-tab:hover, .filter-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-glow);
  text-decoration: none;
}

/* ── Workout list ────────────────────────────────────────────────── */
.workout-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.workout-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto 28px;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.workout-row:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
}
.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wr-main {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.wr-type {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.wr-date {
  font-size: .8rem;
  color: var(--text-muted);
}
.wr-metrics {
  display: flex;
  gap: 1.5rem;
}
.metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1rem;
}
.metric-val {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
}
.metric-val small { font-size: .7rem; font-family: var(--font-body); color: var(--text-muted); }
.metric-lbl {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.wr-athlete {}
.athlete-pill {
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.wr-arrow { color: var(--text-dim); font-size: 1.1rem; }

/* ── Activity colours (dots + type badges) ───────────────────────── */
.activity-running        { background: var(--running);        color: var(--running);        }
.activity-swimming       { background: var(--swimming);       color: var(--swimming);       }
.activity-aerobics       { background: var(--aerobics);       color: var(--aerobics);       }
.activity-weight_training{ background: var(--weight_training);color: var(--weight_training);}

/* ── Privacy badge ───────────────────────────────────────────────── */
.privacy-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  background: rgba(255,183,3,.15);
  color: #ffb703;
  border: 1px solid rgba(255,183,3,.3);
  margin-left: .4rem;
  vertical-align: middle;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }
.empty-hint  { font-size: .9rem; margin-top: .5rem; }

/* ── Upload modal ────────────────────────────────────────────────── */
.upload-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  z-index: 200;
  width: 90%;
  max-width: 480px;
}
.upload-modal.hidden { display: none; }
.upload-modal-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.upload-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.upload-modal-header h3 {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 150;
}
.modal-backdrop.hidden { display: none; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.drop-zone svg { color: var(--text-muted); margin-bottom: .75rem; }
.drop-zone p { font-size: .9rem; color: var(--text-muted); }
.drop-zone span { color: var(--accent); font-size: .85rem; }
.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-chosen {
  margin: .75rem 0;
  padding: .5rem .75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--accent);
}
.file-chosen.hidden { display: none; }

textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .65rem .85rem;
  font-family: var(--font-body);
  font-size: .9rem;
  resize: vertical;
  margin: .75rem 0;
  outline: none;
}
textarea:focus { border-color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  padding: .55rem 1.25rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-full { width: 100%; text-align: center; }

.btn-secondary {
  display: inline-block;
  padding: .4rem .9rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

.btn-danger {
  display: inline-block;
  padding: .4rem .9rem;
  background: transparent;
  color: #f74d4f;
  border: 1px solid rgba(247,77,79,.4);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(247,77,79,.12); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ── Detail page ─────────────────────────────────────────────────── */
.detail-header {
  margin-bottom: 2rem;
}
.back-link {
  font-size: .85rem;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.detail-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.detail-type-badge {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: .3rem .9rem;
  border-radius: var(--radius-sm);
  color: #000;
}
.detail-date  { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; }
.detail-time  { font-size: 1rem; color: var(--text-muted); margin-left: .4rem; }
.detail-athlete { font-size: .9rem; color: var(--text-muted); margin-left: auto; }
.detail-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.metrics-grid-secondary .metric-card { padding: .85rem 1rem; }
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.metric-big { grid-column: span 1; }
.metric-card-val {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
}
.metric-card-val .unit {
  font-size: .85rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
  margin-left: .2rem;
}
.metric-card-lbl {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: .4rem;
}

.comment-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.comment-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: .4rem; }
.comment-text  { font-size: .95rem; white-space: pre-wrap; }

.detail-meta {
  margin-top: 2rem;
  font-size: .8rem;
  color: var(--text-dim);
}

/* ── Login ───────────────────────────────────────────────────────── */
.login-body { display: flex; min-height: 100vh; }
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; width: 100%; min-height: 100vh; }

.login-left {
  background: linear-gradient(160deg, #0d1117 0%, #0a1628 50%, #0d1117 100%);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -80px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,180,216,.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
  margin-bottom: 2.5rem;
}
.login-tagline {
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 2rem;
}
.login-stats-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.stat-pill {
  padding: .4rem .9rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
  background: var(--surface);
}

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-card h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.75rem;
}
.login-error {
  background: rgba(247,77,79,.12);
  border: 1px solid rgba(247,77,79,.4);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  font-size: .9rem;
  color: #f74d4f;
  margin-bottom: 1rem;
}
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .7rem 1rem;
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }
.login-hint {
  text-align: center;
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .chart-card { display: none; }
  .workout-row { grid-template-columns: 10px 1fr auto 24px; }
  .wr-athlete  { display: none; }
  .wr-metrics  { gap: 1rem; }
  .login-wrap  { grid-template-columns: 1fr; }
  .login-left  { display: none; }
}
@media (max-width: 500px) {
  .stats-bar { grid-template-columns: 1fr; }
  .wr-metrics { display: none; }
}

/* ── Progress bar ────────────────────────────────────────────────── */
.upload-progress { padding: 1.5rem 0 .5rem; text-align: center; }
.upload-progress.hidden { display: none; }
#progress-label {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .12s linear;
}

/* ── Workout row checkboxes ──────────────────────────────────────── */
.workout-row-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.row-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.workout-row-wrap .workout-row { flex: 1; }

/* Select-all in toolbar */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.select-all-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .84rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.select-all-wrap input { accent-color: var(--accent); cursor: pointer; }

/* ── Bulk action bar ─────────────────────────────────────────────── */
.bulk-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--accent);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 80;
}
.bulk-bar.hidden { display: none; }
.bulk-count {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: auto;
}

/* ── Duplicate review page ───────────────────────────────────────── */
.review-header { margin-bottom: 1.75rem; }
.review-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  margin: .5rem 0 1rem;
}
.review-subtitle { color: var(--text-muted); font-size: .95rem; }

.review-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }

.review-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
}
.review-filename {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.review-existing { font-size: .9rem; }

.review-card-right { display: flex; gap: .75rem; flex-shrink: 0; }
.review-option { cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.review-option input { accent-color: var(--accent); }
.review-option-label {
  padding: .3rem .75rem;
  border-radius: 99px;
  font-size: .84rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all .12s;
}
.review-option input:checked + .review-option-label.skip    { border-color: #ffb703; color: #ffb703; background: rgba(255,183,3,.1); }
.review-option input:checked + .review-option-label.replace { border-color: #f77f4f; color: #f77f4f; background: rgba(247,127,79,.1); }

.review-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding-top: .5rem;
}

/* ── Type selector ───────────────────────────────────────────────── */
.type-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .35rem .65rem;
  font-family: var(--font-body);
  font-size: .85rem;
  cursor: pointer;
  outline: none;
}
.type-select:focus { border-color: var(--accent); }

.retype-form {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Calisthenics dot colour (same as legacy weight_training) */
.activity-calisthenics { background: var(--weight_training); color: var(--weight_training); }

/* Bulk retype panel */
#bulk-retype-wrap form {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* New activity type dot colours */
.activity-inline_skating { background: #a855f7; color: #a855f7; }
.activity-walking        { background: #84cc16; color: #84cc16; }
.activity-paddling       { background: #0ea5e9; color: #0ea5e9; }

/* ── Row comment button ──────────────────────────────────────────── */
.row-comment-btn {
  background: none;
  border: none;
  font-size: .95rem;
  opacity: .25;
  cursor: pointer;
  padding: .2rem .3rem;
  border-radius: var(--radius-sm);
  transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.workout-row:hover ~ .row-comment-btn,
.workout-row-wrap:hover .row-comment-btn { opacity: .55; }
.row-comment-btn:hover                   { opacity: 1 !important; background: var(--surface-2); }
.row-comment-btn.has-comment             { opacity: .75; }
.row-comment-btn.has-comment:hover       { opacity: 1; }

.row-comment-placeholder {
  font-size: .85rem;
  opacity: .4;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* Sauna temperature card highlight */
.metric-sauna .metric-card-val { color: #f97316; }
.metric-sauna .metric-card-lbl { color: #f97316; opacity: .7; }
