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

:root {
  --bg:          #f0f2f5;
  --sidebar-bg:  #ffffff;
  --card-bg:     #ffffff;
  --border:      #e8eaf0;
  --text:        #1a1f2e;
  --text-muted:  #6b7280;
  --accent:      #1d4ed8;        /* Garmin blue */
  --accent-2025: #f97316;        /* orange – 2025 bars */
  --accent-2024: #bfdbfe;        /* light blue – 2024 bars */
  --running:     #f97316;
  --weight-c:    #7c3aed;
  --sleep-c:     #f59e0b;
  --hrv-c:       #ef4444;
  --active-c:    #3b82f6;
  --green:       #10b981;
  --radius:      14px;
  --shadow:      0 2px 12px rgba(0,0,0,.07);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 200px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
}
.logo-garmin {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}
.logo-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
  display: block;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item:hover { background: #f3f4f6; color: var(--text); }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: #eff6ff;
  font-weight: 600;
}
.nav-item.disabled { opacity: .45; pointer-events: none; }
.nav-icon { font-size: 15px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.btn-settings {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}
.btn-settings:hover { background: var(--bg); }
.btn-refresh {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: background .15s;
}
.btn-refresh:hover    { background: rgba(124,58,237,.08); }
.btn-refresh:disabled { opacity: .5; cursor: not-allowed; }
.sync-status {
  font-size: 11px;
  text-align: center;
  margin-top: 5px;
  min-height: 14px;
}

/* ── Main ── */
.main {
  margin-left: 200px;
  flex: 1;
  padding: 32px 36px;
  max-width: 1400px;
  position: relative;
}

/* ── Page sections ── */
.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 24px 16px;
}

/* ── KPI Grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.kpi-icon { font-size: 20px; margin-bottom: 6px; }
.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.running-color { color: var(--running); }
.weight-color  { color: var(--weight-c); }
.sleep-color   { color: var(--sleep-c); }
.hrv-color     { color: var(--hrv-c); }
.active-color  { color: var(--active-c); }

.comparison-card .comp-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── Chart cards ── */
.charts-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card.wide { /* already in grid */ }

.section-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin-bottom: 14px;
}
.chart-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.chart-title-row .chart-title {
  margin-bottom: 0;
}
.wh-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.wh-daterange {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
}
.wh-label {
  font-size: 11px;
  color: var(--text-light);
}
.wh-daterange input[type="date"] {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.wh-daterange input[type="date"]:focus {
  border-color: var(--accent);
}
.wh-year-toggles {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-light);
}
.wh-year-toggles label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.wh-year-toggles input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Activity list ── */
.activity-list { display: flex; flex-direction: column; gap: 0; }

.activity-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.activity-row:last-child { border-bottom: none; }

.act-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #f3f4f6;
}

.act-name {
  font-weight: 600;
  font-size: 13.5px;
}
.act-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.act-stats {
  display: flex;
  gap: 10px;
  align-items: center;
}
.act-stat {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: #f3f4f6;
}
.act-stat.dist { color: var(--running); background: #fff7ed; }
.act-stat.dur  { color: var(--accent);  background: #eff6ff; }
.act-stat.hr   { color: var(--hrv-c);   background: #fef2f2; }

/* ── Activities Table ── */
.activities-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.activities-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
}
.activities-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.activities-table tr:hover td { background: #f9fafb; }
.activities-table .td-name { font-weight: 600; }
.td-dist { color: var(--running); font-weight: 700; }
.td-hr   { color: var(--hrv-c); font-weight: 700; }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Tweaks panel ── */
.tweaks-panel {
  position: fixed;
  top: 64px; right: 20px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  width: 200px;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.tweaks-panel.open { display: block; }

.tweaks-row { margin-bottom: 14px; }
.tweaks-row:last-child { margin-bottom: 0; }
.tweaks-row label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.tweaks-row select, .tweaks-row input[type=range] {
  width: 100%;
  border-radius: 6px;
  border: none;
  background: #334155;
  color: #e2e8f0;
  padding: 5px 8px;
  font-size: 12px;
}
.tweaks-row input[type=range] { padding: 4px 0; }

/* ── Klikbare kaart ── */
.clickable-card {
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.clickable-card:hover {
  box-shadow: 0 4px 20px rgba(124,58,237,.18);
  transform: translateY(-2px);
}
.card-link-hint {
  font-size: 13px;
  color: var(--weight-c);
  margin-left: 4px;
  opacity: 0.7;
}

/* ── Placeholder ── */
.placeholder-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ── Weight detail page ── */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.btn-back {
  flex-shrink: 0;
  margin-top: 4px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--weight-c);
  transition: background .15s;
}
.btn-back:hover { background: #f5f3ff; }

.wd-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.wd-toggle-row {
  display: flex;
  gap: 16px;
}

.wd-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.wd-toggle input { cursor: pointer; }

.wd-table-wrap {
  max-height: 400px;
  overflow-y: auto;
}
.wd-table td { font-size: 13px; }
.wd-table td:nth-child(2) { color: var(--weight-c); }

/* ── Alcohol Challenge ── */
.alc-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.alc-progress-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.alc-progress-track {
  height: 18px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}
.alc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 99px;
  transition: width 0.6s ease;
}
.alc-progress-dates {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.alc-legend { display: flex; align-items: center; font-size: 12px; color: var(--text-muted); }

.alc-main-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
.alc-form-col {
  position: sticky;
  top: 16px;
}
.alc-legend-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 4px;
}
.alc-legend-dot.free   { background: #10b981; }
.alc-legend-dot.drank  { background: #ef4444; }
.alc-legend-dot.future { background: #e5e7eb; }

.alc-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.alc-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
  position: relative;
}
.alc-day:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.alc-day.free    { background: #d1fae5; color: #065f46; }
.alc-day.drank   { background: #fee2e2; color: #991b1b; }
.alc-day.future  { background: #f3f4f6; color: #9ca3af; cursor: default; }
.alc-day.future:hover { transform: none; box-shadow: none; }
.alc-day.today   { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.25); }
.alc-day.selected { border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,0.3); }
.alc-day-num  { font-size: 16px; line-height: 1; }
.alc-day-mon  { font-size: 9px; font-weight: 400; opacity: 0.7; margin-top: 2px; }
.alc-day-dot  {
  width: 5px; height: 5px; border-radius: 50%;
  position: absolute; bottom: 5px;
}
.alc-day.free  .alc-day-dot { background: #059669; }
.alc-day.drank .alc-day-dot { background: #dc2626; }

.alc-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 500px;
}
.alc-date-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.alc-toggle-row { display: flex; gap: 10px; }
.alc-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.alc-btn-free.active  { background: #d1fae5; border-color: #10b981; color: #065f46; }
.alc-btn-drank.active { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.alc-btn:not(.active):hover { border-color: var(--accent); }
.alc-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
}
.alc-textarea:focus { outline: none; border-color: var(--accent); }
.alc-save-btn {
  align-self: flex-start;
  padding: 9px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.alc-save-btn:hover { opacity: 0.88; }
.alc-save-msg { font-size: 13px; font-weight: 500; }

/* ── Roken challenge: smk-day klasse (alc-day met eigen querySelectorAll scope) ── */
.smk-day { /* inherits alc-day styles; only needed to scope JS querySelectorAll */ }

/* ── Gewicht detail: weekend markering ── */
.wd-weekend-row { background: #faf5ff !important; }
.wd-weekend-row td:first-child { border-left: 3px solid #7c3aed; }
.wd-weekend-badge {
  display: inline-block;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
  text-transform: uppercase;
}
.wd-toggle-weekend { border-left: 1px solid #e2e8f0; margin-left: 6px; padding-left: 12px; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Triathlon ── */
.tri-settings-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.tri-setting-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tri-setting-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: .4px;
}
.tri-setting-group input[type="date"] {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.tri-setting-group input[type="date"]:focus { border-color: var(--accent); outline: none; }
.tri-status-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  margin-left: auto;
}
.tri-days-badge {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

/* Week grid */
.tri-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
@media (max-width: 1200px) { .tri-week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 800px)  { .tri-week-grid { grid-template-columns: repeat(2, 1fr); } }

.tri-day-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: var(--card);
  min-height: 90px;
}
.tri-day-card.tri-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,58,237,.15);
}
.tri-day-card.tri-rest { background: #f8fafc; opacity: .7; }
.tri-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.tri-day-name { font-size: 11px; font-weight: 700; color: var(--text); text-transform: uppercase; }
.tri-day-date { font-size: 10px; color: var(--text-light); }

.tri-session {
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid #e2e8f0;
  padding: 5px 6px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 5px;
  background: #f8fafc;
  font-size: 12px;
}
.tri-session-done { background: #f0fdf4; }
.tri-session-extra { opacity: .75; }
.tri-session-rest { border-left-color: #e2e8f0; color: var(--text-light); }
.tri-sport-icon { font-size: 14px; flex-shrink: 0; }
.tri-session-info { flex: 1; min-width: 0; }
.tri-sport-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tri-session-meta { font-size: 10px; color: var(--text-light); }
.tri-done-mark { font-size: 12px; color: #10b981; font-weight: 700; }
.tri-extra-mark { color: #f59e0b; }

/* Full schedule */
.tri-schema-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.tri-schema-header .chart-title { margin-bottom: 0; }
.tri-week-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.tri-filter-btn {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: var(--card);
  color: var(--text-light);
  cursor: pointer;
}
.tri-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tri-week-row {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.tri-week-row.tri-week-current { background: #f5f3ff; border-radius: 8px; padding: 10px; margin: 4px -4px; }
.tri-week-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.tri-now-badge {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}
.tri-week-sessions { display: flex; flex-wrap: wrap; gap: 6px; }
.tri-week-session {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  border-left: 3px solid var(--tri-color, #94a3b8);
  background: #f8fafc;
  font-size: 11px;
}
.tri-ws-desc { font-weight: 600; color: var(--text); }
.tri-ws-meta { color: var(--text-light); font-size: 10px; }

/* Edit table */
.tri-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-tri-action {
  padding: 5px 12px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.btn-tri-action:hover { border-color: var(--accent); color: var(--accent); }
.btn-tri-add { border-color: var(--accent); color: var(--accent); }
.tri-edit-info {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.tri-table-wrap { overflow-x: auto; }
.tri-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tri-edit-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 6px 8px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.tri-edit-table td { padding: 4px 4px; border-bottom: 1px solid #f1f5f9; }
.tri-inp {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
}
.tri-inp:focus { border-color: var(--accent); outline: none; }
.tri-inp-sm { width: 60px; }
.tri-inp-wide { min-width: 160px; }
.tri-save-btn, .tri-del-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.tri-save-btn:hover { background: #f0fdf4; }
.tri-del-btn:hover  { background: #fef2f2; }
.tri-save-pending { background: #fef3c7 !important; border-radius: 4px; }

/* ── Mallorca Doel pagina ────────────────────────────────────────────────── */

/* Progress bar */
.mal-progress-wrap {
  margin-top: 8px;
}
.mal-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.mal-progress-bar-bg {
  height: 20px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}
.mal-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #10b981);
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
  min-width: 4px;
}
.mal-progress-sublabels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Stats grid */
.mal-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.mal-stat-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color 0.2s;
}
.mal-stat-item.mal-ok   { border-color: #10b981; background: #f0fdf4; }
.mal-stat-item.mal-warn { border-color: #f97316; background: #fff7ed; }
.mal-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.mal-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.mal-stat-item.mal-ok   .mal-stat-value { color: #059669; }
.mal-stat-item.mal-warn .mal-stat-value { color: #ea580c; }

/* Motivatie banner */
.mal-motivation-card {
  background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%);
  color: #fff;
  border: none;
}
.mal-motivation-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.mal-motivation-icon {
  font-size: 48px;
  line-height: 1;
  flex-shrink: 0;
}
.mal-motivation-text {
  flex: 1;
  min-width: 200px;
}
.mal-motivation-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: 0.8;
  margin-bottom: 6px;
}
.mal-motivation-msg {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
.mal-motivation-stats {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}
.mal-mini-stat {
  text-align: center;
}
.mal-mini-val {
  font-size: 22px;
  font-weight: 800;
}
.mal-mini-label {
  font-size: 11px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.mal-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.mal-badge-ok   { background: rgba(16,185,129,.25); color: #d1fae5; }
.mal-badge-warn { background: rgba(249,115,22,.25);  color: #ffedd5; }

/* ── Persoonlijke Records pagina ─────────────────────────────────────────── */
.section-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
  margin: 24px 0 12px;
  padding-left: 4px;
}

.pr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.pr-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.pr-card-icon {
  font-size: 22px;
  margin-bottom: 6px;
}
.pr-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pr-card-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
}
.pr-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pr-table-wrap {
  overflow-x: auto;
}
.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pr-table th {
  background: var(--bg);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.pr-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.pr-table tbody tr:hover { background: #f8fafc; }
.pr-table-gold   td { background: #fefce8; }
.pr-table-silver td { background: #f8fafc; }
.pr-table-bronze td { background: #fff7ed; }

/* ── Training Planner pagina ─────────────────────────────────────────────── */
.tr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .tr-layout { grid-template-columns: 1fr; } }

.tr-cal-section { margin-top: 0; }

/* Sport tabs */
.tr-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.tr-builder-header .chart-title { margin-bottom: 0; }
.tr-sport-tabs { display: flex; gap: 6px; }
.tr-sport-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.tr-sport-btn:hover  { border-color: var(--accent); color: var(--accent); }
.tr-sport-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Name/desc inputs */
.tr-name-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  margin-bottom: 8px;
  box-sizing: border-box;
}
.tr-name-input:focus { outline: none; border-color: var(--accent); }
.tr-desc-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 14px;
  box-sizing: border-box;
}
.tr-desc-input:focus { outline: none; border-color: var(--accent); }

/* Steps list */
.tr-steps-list {
  min-height: 60px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Step card */
.tr-step-card {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
}
.tr-step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 10px;
  min-width: 72px;
  gap: 4px;
  flex-shrink: 0;
}
.tr-step-icon  { font-size: 18px; line-height: 1; }
.tr-step-label { font-size: 11px; font-weight: 700; text-align: center; color: var(--text); }

.tr-step-controls {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tr-step-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tr-inp {
  padding: 4px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
}
.tr-inp:focus { outline: none; border-color: var(--accent); }
.tr-end-type  { min-width: 85px; }
.tr-end-value { width: 56px; }
.tr-end-unit  { min-width: 50px; }
.tr-target-type { min-width: 150px; }
.tr-target-min, .tr-target-max { width: 55px; }
.tr-target-dash { font-weight: 700; color: var(--text-muted); }

.tr-step-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  background: #f8fafc;
  flex-shrink: 0;
}
.tr-step-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text-muted);
  transition: background .1s;
}
.tr-step-btn:hover     { background: #e5e7eb; color: var(--text); }
.tr-step-del:hover     { background: #fee2e2; color: #ef4444; }

/* Repeat block */
.tr-repeat-block {
  border: 2px solid #818cf8;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f3ff;
}
.tr-repeat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #ede9fe;
  flex-wrap: wrap;
}
.tr-repeat-icon { font-size: 16px; }
.tr-repeat-header label { font-size: 13px; font-weight: 700; color: #5b21b6; }
.tr-repeat-count { width: 50px; padding: 3px 6px; font-size: 13px; font-weight: 700; border: 1px solid #c4b5fd; border-radius: 6px; background: #fff; }
.tr-repeat-header span { font-size: 13px; color: #6d28d9; }
.tr-repeat-add-btns { display: flex; gap: 6px; margin-left: 4px; }
.tr-repeat-steps {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tr-repeat-steps .tr-step-card {
  border-color: #c4b5fd;
  background: #fff;
}

/* Add buttons */
.tr-add-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.tr-add-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all .15s;
  background: var(--bg);
}
.tr-add-warmup   { border-color: #f59e0b; color: #b45309; }
.tr-add-warmup:hover   { background: #fffbeb; }
.tr-add-interval { border-color: #818cf8; color: #4338ca; }
.tr-add-interval:hover { background: #eef2ff; }
.tr-add-run      { border-color: #ef4444; color: #b91c1c; }
.tr-add-run:hover      { background: #fef2f2; }
.tr-add-recovery { border-color: #34d399; color: #065f46; }
.tr-add-recovery:hover { background: #ecfdf5; }
.tr-add-cooldown { border-color: #60a5fa; color: #1e40af; }
.tr-add-cooldown:hover { background: #eff6ff; }
.tr-add-rest     { border-color: #94a3b8; color: #475569; }
.tr-add-rest:hover     { background: #f8fafc; }

/* Actions */
.tr-actions { display: flex; gap: 10px; align-items: center; }
.tr-save-btn {
  padding: 9px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.tr-save-btn:hover { opacity: 0.88; }
.tr-clear-btn {
  padding: 9px 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tr-clear-btn:hover { background: #fef2f2; color: #ef4444; border-color: #ef4444; }
.tr-status { font-size: 13px; font-weight: 500; margin-top: 8px; min-height: 18px; }

/* Library */
.tr-lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tr-lib-header .chart-title { margin-bottom: 0; }
.tr-refresh-lib-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
}
.tr-refresh-lib-btn:hover { border-color: var(--accent); }

.tr-hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: #1e40af;
  font-weight: 500;
  margin-bottom: 10px;
}

.tr-library { display: flex; flex-direction: column; gap: 6px; max-height: 400px; overflow-y: auto; }
.tr-loading  { font-size: 13px; color: var(--text-muted); padding: 12px 4px; }
.tr-lib-error { font-size: 12px; color: #ef4444; padding: 10px 4px; line-height: 1.5; }
.tr-lib-empty { font-size: 13px; color: var(--text-muted); padding: 12px 4px; line-height: 1.6; }

.tr-lib-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color .15s;
  cursor: default;
}
.tr-lib-card:hover { border-color: #93c5fd; }
.tr-lib-selected   { border-color: var(--accent) !important; background: #eff6ff !important; }
.tr-lib-icon  { font-size: 20px; flex-shrink: 0; }
.tr-lib-info  { flex: 1; min-width: 0; }
.tr-lib-name  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-lib-meta  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tr-lib-btns  { display: flex; gap: 4px; flex-shrink: 0; }
.tr-lib-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 13px;
  transition: background .1s;
}
.tr-lib-btn-plan:hover { background: #eff6ff; border-color: var(--accent); }
.tr-lib-btn-del:hover  { background: #fef2f2; border-color: #ef4444; }

/* Kalender */
.tr-cal-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tr-cal-nav-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background .1s;
}
.tr-cal-nav-btn:hover { background: #eff6ff; color: var(--accent); }
.tr-cal-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  align-items: center;
}
.tr-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.tr-dot-planned { background: #6366f1; }
.tr-dot-done    { background: #10b981; }

.tr-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.tr-cal-weekdays span {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 3px 0;
}

.tr-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.tr-cal-cell {
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 7px;
  font-size: 11px;
  position: relative;
  background: var(--bg);
  transition: border-color .1s, background .1s;
  vertical-align: top;
}
.tr-cal-cell.tr-cal-empty  { border-color: transparent; background: transparent; }
.tr-cal-cell.tr-cal-past   { background: #f9fafb; }
.tr-cal-cell.tr-cal-today  { border-color: var(--accent); background: #eff6ff; }
.tr-cal-cell.tr-cal-selectable { cursor: pointer; }
.tr-cal-cell.tr-cal-selectable:hover { border-color: #6366f1; background: #eef2ff; }

/* Drag-and-drop states */
.tr-cal-cell.tr-drag-over {
  border-color: var(--accent) !important;
  background: #dbeafe !important;
  border-style: dashed !important;
}
.tr-lib-card.tr-dragging   { opacity: 0.45; box-shadow: 0 4px 14px rgba(29,78,216,.25); }
.tr-cal-workout.tr-dragging { opacity: 0.4; }

/* Drag hint in library */
.tr-drag-hint {
  background: #f0fdf4;
  border: 1px dashed #6ee7b7;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #065f46;
  font-weight: 500;
  margin-bottom: 10px;
  text-align: center;
  transition: opacity .2s;
}

/* Drop tip in calendar header */
.tr-cal-drop-tip {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

.tr-cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}
.tr-cal-today .tr-cal-day-num {
  color: var(--accent);
}
.tr-cal-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 2px;
  vertical-align: middle;
}
.tr-cal-workout {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  transition: box-shadow .1s, opacity .1s;
  line-height: 1.3;
}
.tr-cal-workout:hover { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.tr-cal-workout * { pointer-events: none; }
.tr-cal-workout .tr-cal-unschedule { pointer-events: auto; }
.tr-cal-wicon { font-size: 13px; flex-shrink: 0; }
.tr-cal-wname {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.tr-cal-unschedule {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 10px;
  color: #9ca3af;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity .1s;
}
.tr-cal-workout:hover .tr-cal-unschedule { opacity: 1; }
.tr-cal-unschedule:hover { color: #ef4444; }

/* Activity card (gedaan) */
.tr-cal-activity {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 5px;
  padding: 4px 6px;
  margin-top: 3px;
  font-size: 11px;
}
.tr-cal-aicon { font-size: 12px; }
.tr-cal-aname {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-cal-ameta { font-size: 10px; color: var(--text-muted); }

