/* ===== RESET & VARS ===== */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
:root {
  --orange:#FC4C02;--orange-h:#e04400;--orange-glow:rgba(252,76,2,.15);
  --bg:#0b0d12;--bg1:#12141c;--bg2:#1a1d28;--bg3:#232735;
  --border:#262a38;--border-l:#353a4c;
  --text:#e8eaf0;--text2:#9da3b8;--text3:#5c6175;
  --green:#22c55e;--blue:#3b82f6;--purple:#a855f7;--red:#ef4444;--yellow:#eab308;
  --radius:12px;--radius-sm:8px;--shadow:0 4px 24px rgba(0,0,0,.35);
}

/* THEME CLAIR (F10) */
html[data-theme="light"] {
  --bg: #f8fafc; --bg1: #ffffff; --bg2: #f1f5f9; --bg3: #e2e8f0;
  --border: #e2e8f0; --border-l: #cbd5e1;
  --text: #0f172a; --text2: #475569; --text3: #64748b;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

html{scroll-behavior:smooth}
/* Transition douce pour le basculement de thème */
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',sans-serif;background:var(--bg);color:var(--text);min-height:100vh;line-height:1.5;transition:background-color 0.3s, color 0.3s}
a{color:inherit;text-decoration:none}

/* ===== UTILITIES ===== */
.mb-2 { margin-bottom: 8px; }
.mt-2 { margin-top: 8px; }

/* ===== OFFLINE BANNER (F9) ===== */
.offline-banner {
  background: var(--yellow);
  color: #854d0e;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  z-index: 1001;
  position: relative;
}
html[data-theme="dark"] .offline-banner { color: #000; }

/* ===== HEADER ===== */
.header{display:flex;align-items:center;justify-content:space-between;padding:0 24px;height:56px;background:var(--bg1);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:1000;backdrop-filter:blur(12px)}
.header-left{display:flex;align-items:center;gap:32px}
.logo-link{display:flex;align-items:center;gap:10px}
.logo{color:var(--orange)}.logo-text{font-size:18px;font-weight:700;letter-spacing:-.3px}
.nav{display:flex;gap:4px}
.nav-link{display:flex;align-items:center;gap:6px;padding:8px 14px;border-radius:var(--radius-sm);font-size:13px;font-weight:500;color:var(--text2);transition:all .2s}
.nav-link:hover{background:var(--bg2);color:var(--text)}
.nav-link.active{background:var(--orange-glow);color:var(--orange)}
.nav-link svg{opacity:.7}.nav-link.active svg{opacity:1;stroke:var(--orange)}
.header-right{display:flex;align-items:center;gap:12px}
.user-info{display:flex;align-items:center;gap:8px}
.user-avatar{width:32px;height:32px;border-radius:50%;object-fit:cover;border:2px solid var(--border)}
.user-name{font-size:13px;font-weight:500;color:var(--text2)}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none; border: none; color: var(--text2); cursor: pointer; padding: 6px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.theme-toggle-btn:hover { color: var(--orange); background: var(--bg2); }

/* Hamburger Menu */
.hamburger{display:none;flex-direction:column;justify-content:space-between;width:20px;height:14px;background:none;border:none;cursor:pointer;z-index:2000;padding:0;margin-left:12px}
.hamburger span{display:block;height:2px;width:100%;background:var(--text);border-radius:2px;transition:all .2s}
.hamburger.open span:nth-child(1){transform:translateY(6px) rotate(45deg)}
.hamburger.open span:nth-child(2){opacity:0}
.hamburger.open span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}

/* ===== MOBILE NAV ===== */
.mobile-nav-overlay{position:fixed;inset:0;background:rgba(11,13,18,.9);z-index:1500;backdrop-filter:blur(8px);align-items:center;justify-content:center;flex-direction:column}
.mobile-nav{display:flex;flex-direction:column;gap:12px;width:100%;max-width:280px;padding:24px;animation:slideUp .25s ease-out}
.mobile-nav-link{display:flex;align-items:center;gap:12px;font-size:16px;font-weight:600;color:var(--text2);padding:14px 20px;border-radius:var(--radius);transition:all .2s;background:var(--bg1);border:1px solid var(--border)}
.mobile-nav-link.active{color:var(--orange);border-color:var(--orange);background:var(--orange-glow)}
.mobile-nav-link:hover{color:var(--text);background:var(--bg2)}
.mobile-nav-link.logout{color:var(--red);border-color:rgba(239,68,68,.2);background:rgba(239,68,68,.05);justify-content:center;margin-top:12px}

/* ===== BUTTONS ===== */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:var(--radius-sm);font-size:13px;font-weight:600;border:none;cursor:pointer;transition:all .15s;white-space:nowrap}
.btn-primary{background:var(--orange);color:#fff}
.btn-primary:hover{background:var(--orange-h);transform:translateY(-1px)}
.btn-primary:disabled{opacity:.5;cursor:not-allowed;transform:none}
.btn-outline{background:transparent;color:var(--text2);border:1px solid var(--border)}
.btn-outline:hover{border-color:var(--border-l);color:var(--text);background:var(--bg2)}
.btn-sm{padding:6px 12px;font-size:12px}.btn-full{width:100%}
.btn-red-outline{background:transparent;color:var(--red);border:1px solid rgba(239,68,68,.3)}
.btn-red-outline:hover{background:rgba(239,68,68,.1);border-color:var(--red)}
.btn-snap{background:var(--blue);color:#fff}.btn-snap:hover{background:#2563eb}
.btn-snap:disabled{opacity:.5;cursor:not-allowed}
.btn-strava{background:var(--orange);color:#fff;font-size:16px;padding:14px 32px;border-radius:var(--radius);font-weight:700}
.btn-strava:hover{background:var(--orange-h);transform:translateY(-2px);box-shadow:0 8px 32px rgba(252,76,2,.3)}
.btn-logout{background:transparent;color:var(--text3);border:1px solid var(--border);padding:6px 14px;font-size:12px}
.btn-logout:hover{color:var(--text);border-color:var(--border-l)}
.syncing svg{animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ===== INPUTS ===== */
.input-field{background:var(--bg1);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:var(--radius-sm);font-size:13px;outline:none;transition:border-color .2s;max-width:100%}
.input-field:focus{border-color:var(--orange)}.input-field::placeholder{color:var(--text3)}
.input-sm{padding:6px 10px;font-size:12px}
.textarea{resize:vertical;font-family:inherit}.search-input{width:220px}

/* Toggle checkbox */
.toggle-row{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px}
.toggle-row input[type="checkbox"]{appearance:none;width:36px;height:20px;background:var(--border);border-radius:10px;position:relative;cursor:pointer;transition:background .2s;flex-shrink:0}
.toggle-row input[type="checkbox"]::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;background:#fff;border-radius:50%;transition:transform .2s}
.toggle-row input[type="checkbox"]:checked{background:var(--orange)}
.toggle-row input[type="checkbox"]:checked::after{transform:translateX(16px)}
.toggle-label{color:var(--text2);font-weight:500}

/* ===== LOGIN ===== */
.login-hero{display:flex;align-items:center;justify-content:center;min-height:calc(100vh - 56px);background:radial-gradient(ellipse at 50% 0%,rgba(252,76,2,.06) 0%,transparent 60%)}
.login-card{text-align:center;padding:60px 48px;max-width:440px;width:100%;background:var(--bg1);border:1px solid var(--border);border-radius:20px;box-shadow:var(--shadow)}
.login-icon{color:var(--orange);margin-bottom:20px}
.login-card h1{font-size:32px;font-weight:800;margin-bottom:8px;letter-spacing:-.5px}
.login-sub{color:var(--text2);font-size:15px;margin-bottom:32px}
.login-features{display:flex;gap:24px;justify-content:center;margin-bottom:36px}
.login-feature{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:12px;color:var(--text2);font-weight:500}
.feat-icon{font-size:24px}

/* ===== CONTAINER ===== */
.page{min-height:calc(100vh - 56px)}.container{max-width:1280px;margin:0 auto;padding:24px}
#mapPage{overflow:hidden}
.page-title{font-size:22px;font-weight:800;margin-bottom:24px;letter-spacing:-.3px}

/* ===== STATS BAR ===== */
.stats-bar{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:24px}
.stat-card{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:20px;transition:border-color .2s}
.stat-card:hover{border-color:var(--border-l)}
.stat-label{font-size:11px;color:var(--text3);text-transform:uppercase;letter-spacing:.8px;margin-bottom:6px;font-weight:600}
.stat-value{font-size:26px;font-weight:800;letter-spacing:-.5px}
.stat-card-period{display:flex;align-items:center;justify-content:center}
.period-selector{display:flex;gap:3px;background:var(--bg);border-radius:var(--radius-sm);padding:3px;flex-wrap:wrap;justify-content:center}
.period-btn{border:none;background:transparent;color:var(--text3);font-size:12px;font-weight:600;padding:6px 10px;border-radius:6px;cursor:pointer;transition:all .15s;white-space:nowrap}
.period-btn:hover{color:var(--text);background:var(--bg2)}
.period-btn.active{background:var(--orange);color:#fff}
.stat-value.orange{color:var(--orange)}.stat-value.green{color:var(--green)}.stat-value.blue{color:var(--blue)}.stat-value.purple{color:var(--purple)}.stat-value.red{color:var(--red)}.stat-value.yellow{color:var(--yellow)}

/* Trend badges */
.stat-trend{display:flex;align-items:center;gap:6px;margin-top:6px}
.trend-badge{font-size:11px;font-weight:700;padding:2px 6px;border-radius:4px;line-height:1.2}
.trend-up{color:#22c55e;background:rgba(34,197,94,.12)}
.trend-down{color:#ef4444;background:rgba(239,68,68,.12)}
.trend-neutral{color:var(--text3);background:var(--bg2)}
.stat-prev{font-size:10px;color:var(--text3);font-weight:500}
.stat-avg{font-size:10px;color:var(--text3);margin-top:4px;font-weight:500;font-style:italic}

/* ===== TOOLBAR ===== */
.toolbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;gap:12px;flex-wrap:wrap}
.toolbar h2{font-size:18px;font-weight:700}.toolbar-right{display:flex;align-items:center;gap:8px}

/* ===== FILTERS PANEL ===== */
.filters-panel{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px;margin-bottom:16px;animation:slideDown .2s ease-out}
@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}
.filters-row{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}
.filter-group{display:flex;flex-direction:column;gap:4px;min-width:120px;flex:1}
.filter-group input[type="number"]{-moz-appearance:textfield;appearance:textfield}
.filter-group input[type="number"]::-webkit-outer-spin-button,.filter-group input[type="number"]::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}
.filter-label{font-size:11px;color:var(--text3);font-weight:600;text-transform:uppercase;letter-spacing:.5px}
.filters-actions{display:flex;gap:8px;margin-top:12px;justify-content:flex-end}
.filters-active-count{font-size:11px;color:var(--orange);font-weight:600;margin-left:4px}

/* Map Advanced Panel */
.map-advanced-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
  animation: slideDown .2s ease-out;
}

/* ===== TOASTS (F3) ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast {
  background: var(--bg1); border: 1px solid var(--border); border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm); padding: 14px 20px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); font-size: 14px; font-weight: 500; color: var(--text);
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-hide { opacity: 0; transform: translateY(-20px); }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-record { border-left-color: var(--yellow); }
.toast-icon { font-size: 18px; }

/* ===== SPOTLIGHT ===== */
.spotlight{display:none;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;margin-bottom:24px;cursor:pointer;transition:border-color .2s}
.spotlight:hover{border-color:var(--orange)}
.spotlight-info{flex:1;padding:20px 24px;min-width:0}
.spotlight-badge{display:inline-block;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;color:var(--orange);background:var(--orange-glow);padding:4px 10px;border-radius:20px;margin-bottom:10px}
.spotlight-header{display:flex;align-items:center;gap:10px;margin-bottom:4px}
.spotlight-header h3{font-size:18px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.spotlight-icon{font-size:22px}
.spotlight-date{font-size:12px;color:var(--text2);margin-bottom:14px}
.spotlight-stats{display:flex;flex-wrap:wrap;gap:16px}
.spotlight-stat{display:flex;flex-direction:column;gap:2px}
.spotlight-stat-val{font-size:16px;font-weight:800;letter-spacing:-.3px}
.spotlight-stat-val.orange{color:var(--orange)}.spotlight-stat-val.blue{color:var(--blue)}.spotlight-stat-val.green{color:var(--green)}.spotlight-stat-val.purple{color:var(--purple)}.spotlight-stat-val.red{color:var(--red)}.spotlight-stat-val.yellow{color:var(--yellow)}
.spotlight-stat-label{font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:.5px;font-weight:600}
.spotlight-map{width:300px;min-height:200px;flex-shrink:0;position:relative}

/* ===== SYNC BAR ===== */
.sync-bar{display:flex;align-items:center;gap:14px;padding:12px 16px;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius-sm);margin-bottom:16px}
.sync-bar-track{flex:1;height:4px;background:var(--border);border-radius:2px;overflow:hidden}
.sync-bar-fill{height:100%;background:var(--orange);border-radius:2px;animation:progress 1.5s ease-in-out infinite}
@keyframes progress{0%{width:5%}50%{width:75%}100%{width:95%}}
#syncText{font-size:12px;color:var(--text2);white-space:nowrap}

/* ===== ACTIVITY GRID ===== */
.activity-grid{display:flex;flex-direction:column;gap:6px}
.date-group-header{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;color:var(--text3);padding:12px 4px 4px;margin-top:8px}
.date-group-header:first-child{margin-top:0}
.activity-card{display:grid;grid-template-columns:52px 1fr auto;gap:14px;align-items:center;padding:14px 18px;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);cursor:pointer;transition:all .2s}
.activity-card:hover{background:var(--bg2);border-color:var(--orange);transform:translateX(2px)}
.activity-icon{width:52px;height:52px;border-radius:var(--radius);display:flex;align-items:center;justify-content:center;font-size:24px;background:var(--orange-glow);flex-shrink:0}
.activity-info{min-width:0}
.activity-info h3{font-size:14px;font-weight:600;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.activity-meta{display:flex;align-items:center;gap:12px;font-size:12px;color:var(--text2);flex-wrap:wrap}
.activity-meta span{display:flex;align-items:center;gap:3px}
.activity-stats{display:flex;gap:20px;text-align:right;align-items:center}
.sparkline{flex-shrink:0;opacity:.7}
.activity-stat-item{display:flex;flex-direction:column}
.activity-stat-val{font-size:14px;font-weight:700}
.activity-stat-label{font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:.5px}
.empty-state{text-align:center;padding:80px 20px;display:flex;flex-direction:column;align-items:center;gap:12px}
.empty-state p{font-size:15px;color:var(--text2)}.text-muted{color:var(--text3)!important;font-size:13px!important}

/* ===== MAP PAGE ===== */
.map-layout{display:flex;height:calc(100vh - 56px)}
.map-sidebar{width:360px;flex-shrink:0;background:var(--bg1);border-right:1px solid var(--border);display:flex;flex-direction:column;position:relative;transition:width .3s ease, border-color .3s;z-index:100}
.map-sidebar.collapsed{width:0;border-right-color:transparent}
.map-sidebar.collapsed > *:not(.sidebar-toggle){display:none}

.sidebar-toggle{position:absolute;right:-14px;top:20px;width:28px;height:28px;background:var(--bg2);border:1px solid var(--border);border-radius:50%;color:var(--text2);display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:1010;transition:all .3s;box-shadow:var(--shadow)}
.sidebar-toggle:hover{background:var(--bg3);color:var(--text);transform:scale(1.1) translateY(0)}
.sidebar-toggle.flipped{right:10px}
.sidebar-toggle.flipped svg{transform:rotate(180deg)}

.sidebar-scroll{flex:1;overflow-y:auto}
.map-container{flex:1;position:relative}.leaflet-map{width:100%;height:100%}
.sidebar-section{padding:16px}
.sidebar-title{font-size:13px;font-weight:700;margin-bottom:10px;text-transform:uppercase;letter-spacing:.5px;color:var(--text2)}
.sidebar-subtitle{font-size:12px;font-weight:600;color:var(--text2);margin-bottom:8px;padding:0 16px}
.sidebar-search{margin-bottom:8px}.sidebar-search .input-field{width:100%}
.sidebar-divider{height:1px;background:var(--border);margin:12px 0}

.vis-controls{display:flex;flex-direction:column;gap:10px;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--border)}
.vis-controls .input-field{width:100%}

.mode-tabs{display:flex;background:var(--bg);border-radius:var(--radius-sm);padding:3px;gap:3px}
.mode-tab{flex:1;padding:8px;border:none;background:transparent;color:var(--text2);font-size:13px;font-weight:600;cursor:pointer;border-radius:6px;transition:all .15s}
.mode-tab.active{background:var(--orange);color:#fff}.mode-tab:not(.active):hover{background:var(--bg2)}

.map-activity-list{display:flex;flex-direction:column;gap:3px}
.map-act-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);cursor:pointer;transition:all .15s;border:1px solid transparent}
.map-act-item:hover{background:var(--bg2);border-color:var(--border)}
.map-act-item.active{background:var(--orange-glow);border-color:var(--orange)}
.map-act-item.dimmed{opacity:.35}
.map-act-icon{font-size:16px;width:24px;text-align:center;flex-shrink:0}
.map-act-info{min-width:0;flex:1}
.map-act-info h4{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.map-act-info p{font-size:11px;color:var(--text3)}

/* Draw form */
.draw-form{display:flex;flex-direction:column;gap:10px}
.draw-info{display:flex;justify-content:space-between;font-size:13px;font-weight:600}
.draw-info span{color:var(--orange)}
.draw-colors{display:flex;gap:6px}
.color-dot{width:28px;height:28px;border-radius:50%;border:2px solid transparent;cursor:pointer;transition:all .15s}
.color-dot.active{border-color:#fff;transform:scale(1.15)}
.draw-actions{display:flex;gap:8px}.draw-actions .btn{flex:1}

.saved-routes-list{padding:0 16px;display:flex;flex-direction:column;gap:4px}
.saved-route-item{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-radius:var(--radius-sm);cursor:pointer;transition:all .15s;border:1px solid transparent}
.saved-route-item:hover{background:var(--bg2);border-color:var(--border)}
.saved-route-left{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.saved-route-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}
.saved-route-info h4{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.saved-route-info p{font-size:11px;color:var(--text3)}
.saved-route-actions{display:flex;gap:2px}
.saved-route-btn{background:none;border:none;color:var(--text3);cursor:pointer;padding:4px;border-radius:4px;font-size:14px;line-height:1;transition:all .15s}
.saved-route-btn:hover{color:var(--text);background:var(--bg3)}
.saved-route-btn.del:hover{color:var(--red);background:rgba(239,68,68,.1)}
.saved-route-btn.snap:hover{color:var(--blue);background:rgba(59,130,246,.1)}

/* ===== MODAL ===== */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;z-index:2000;backdrop-filter:blur(4px);animation:fadeIn .2s}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.modal{background:var(--bg1);border:1px solid var(--border);border-radius:16px;width:95%;max-width:860px;max-height:90vh;overflow-y:auto;position:relative;box-shadow:0 24px 80px rgba(0,0,0,.5);animation:slideUp .25s ease-out}
@keyframes slideUp{from{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}
.modal-close{position:sticky;top:12px;float:right;margin-right:12px;width:36px;height:36px;border-radius:50%;border:none;background:var(--bg2);color:var(--text2);font-size:22px;cursor:pointer;z-index:10;transition:all .15s;display:flex;align-items:center;justify-content:center}
.modal-close:hover{background:var(--bg3);color:var(--text)}
.modal-content{padding:24px 32px 32px}
.modal-header{margin-bottom:24px}
.modal-type{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--orange);background:var(--orange-glow);padding:4px 12px;border-radius:20px;margin-bottom:10px}
.modal-title{font-size:24px;font-weight:800;letter-spacing:-.5px;margin-bottom:4px}
.modal-date{font-size:13px;color:var(--text2)}
.detail-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin-bottom:24px}
.detail-stat{background:var(--bg);padding:16px;border-radius:var(--radius);border:1px solid var(--border)}
.detail-stat-label{font-size:10px;text-transform:uppercase;letter-spacing:.8px;color:var(--text3);margin-bottom:4px;font-weight:600}
.detail-stat-val{font-size:20px;font-weight:800;letter-spacing:-.3px}
.detail-stat-val.orange{color:var(--orange)}.detail-stat-val.green{color:var(--green)}.detail-stat-val.blue{color:var(--blue)}.detail-stat-val.purple{color:var(--purple)}.detail-stat-val.red{color:var(--red)}.detail-stat-val.yellow{color:var(--yellow)}
.detail-map{height:300px;border-radius:var(--radius);overflow:hidden;margin-bottom:16px;border:1px solid var(--border)}
.elevation-profile-wrap{margin-bottom:24px;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);padding:12px;overflow:hidden}
.elevation-profile-wrap canvas{width:100%;height:100px;cursor:crosshair;display:block}
.elevation-profile-info{display:flex;justify-content:space-between;font-size:11px;color:var(--text3);font-weight:600;margin-top:6px;padding:0 4px}
.detail-extra{display:flex;flex-wrap:wrap;gap:24px}
.detail-extra-item{display:flex;flex-direction:column;gap:2px}
.detail-extra-label{font-size:11px;color:var(--text3);font-weight:600;text-transform:uppercase;letter-spacing:.5px}
.detail-extra-val{font-size:14px;font-weight:600}
.detail-actions{display:flex;align-items:center;gap:10px;margin-top:20px;flex-wrap:wrap}
.strava-link{display:inline-flex;align-items:center;gap:6px;padding:10px 20px;background:var(--orange-glow);color:var(--orange);border-radius:var(--radius-sm);font-size:13px;font-weight:600;transition:all .15s}
.strava-link:hover{background:var(--orange);color:#fff}

/* ZONES & SPLITS (F1/F2) */
.zones-section { margin-bottom: 24px; }
.zones-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.zones-bars { display: flex; flex-direction: column; gap: 8px; }
.zone-row { display: grid; grid-template-columns: 110px 1fr 45px 60px; gap: 12px; align-items: center; font-size: 12px; }
.zone-name { color: var(--text); font-weight: 600; white-space: nowrap; }
.zone-bar-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; width: 100%; }
.zone-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.zone-pct { text-align: right; font-weight: 700; color: var(--text2); }
.zone-time { text-align: right; color: var(--text3); }
.zones-note { font-size: 10px; color: var(--text3); margin-top: 8px; font-style: italic; }

.splits-section { margin-bottom: 24px; }
.splits-table { display: flex; flex-direction: column; gap: 4px; }
.splits-header { display: grid; grid-template-columns: 40px 60px 80px 1fr; gap: 12px; font-size: 11px; text-transform: uppercase; color: var(--text3); font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.split-row { display: grid; grid-template-columns: 40px 60px 80px 1fr; gap: 12px; font-size: 13px; align-items: center; padding: 4px 0; }
.split-km { font-weight: 700; color: var(--text); }
.split-time { color: var(--text2); }
.split-pace { font-weight: 600; }
.split-bar-track { height: 6px; background: var(--border); border-radius: 3px; display: flex; flex-direction: row-reverse; }
.split-bar-fill { height: 100%; border-radius: 3px; }

/* CALENDAR HEATMAP (F6) */
.calendar-section { margin-bottom: 32px; overflow-x: auto; padding-bottom: 8px; }
.cal-heatmap-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 700px; }
.cal-months { display: grid; grid-template-columns: auto repeat(53, 1fr); gap: 2px; }
.cal-month-label { font-size: 10px; color: var(--text3); text-align: left; }
.cal-grid { display: grid; gap: 3px; align-items: center; }
.cal-day-label { font-size: 10px; color: var(--text3); text-align: right; padding-right: 6px; height: 12px; line-height: 12px; }
.cal-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--bg2); transition: transform 0.1s; }
.cal-cell:hover:not(.cal-empty) { transform: scale(1.2); cursor: pointer; border: 1px solid var(--border-l); }
.cal-empty { background: transparent; }
.cal-level-0 { background: var(--bg2); }
html[data-theme="dark"] .cal-level-0 { background: #262a38; }
html[data-theme="light"] .cal-level-0 { background: #e2e8f0; }
.cal-level-1 { background: rgba(34, 197, 94, 0.3); }
.cal-level-2 { background: rgba(34, 197, 94, 0.6); }
.cal-level-3 { background: rgba(34, 197, 94, 0.8); }
.cal-level-4 { background: rgba(34, 197, 94, 1); }

/* ===== STATS PAGE ===== */
.stats-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.stats-header .page-title { margin-bottom: 0; }
.stats-filter { flex-shrink: 0; }
.stats-filter .input-field { min-width: 180px; }

/* Moyennes spécifiques par sport */
.avg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.avg-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}
.avg-card:hover {
  border-color: var(--orange);
}
.avg-icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.avg-info {
  min-width: 0;
}
.avg-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.avg-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: 2px;
}

.records-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;margin-bottom:32px}
.record-card{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:20px;transition:border-color .2s;cursor:pointer}
.record-card:hover{border-color:var(--orange)}
/* Best week banner */
.best-week-banner{display:flex;align-items:center;gap:16px;background:linear-gradient(135deg,rgba(252,76,2,.08),rgba(34,197,94,.08));border:1px solid var(--border);border-radius:var(--radius);padding:18px 24px;margin-bottom:32px;flex-wrap:wrap}
.best-week-icon{font-size:32px;flex-shrink:0}
.best-week-content{flex:1;min-width:120px}
.best-week-title{font-size:14px;font-weight:700;color:var(--text)}
.best-week-subtitle{font-size:12px;color:var(--text3)}
.best-week-stats{display:flex;gap:20px;flex-wrap:wrap}
.best-week-stat{font-size:12px;color:var(--text2)}
.best-week-stat strong{font-size:15px;font-weight:800;display:block}

.record-label{font-size:11px;color:var(--text3);text-transform:uppercase;letter-spacing:.8px;font-weight:600;margin-bottom:8px}
.record-value{font-size:22px;font-weight:800;margin-bottom:4px;letter-spacing:-.3px}
.record-sub{font-size:12px;color:var(--text2)}
.record-activity{font-size:11px;color:var(--text3);margin-top:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.section-title{font-size:16px;font-weight:700;margin-bottom:16px;display:flex;align-items:center;gap:8px}
.section-title svg{opacity:.5}

/* Sport breakdown */
.sport-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:10px;margin-bottom:32px}
.sport-row{display:flex;align-items:center;gap:12px;padding:14px 16px;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius)}
.sport-icon{font-size:22px;width:36px;text-align:center}
.sport-info{flex:1;min-width:0}
.sport-name{font-size:13px;font-weight:600;margin-bottom:2px}
.sport-detail{font-size:11px;color:var(--text3)}
.sport-bar-wrap{height:4px;background:var(--border);border-radius:2px;margin-top:4px;overflow:hidden}
.sport-bar{height:100%;background:var(--orange);border-radius:2px;transition:width .5s ease}
.sport-count{font-size:18px;font-weight:800;color:var(--orange);min-width:36px;text-align:right}

/* Bar chart */
.chart-container{margin-bottom:32px}
.chart-canvas-wrap{position:relative;height:260px;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:16px}
.bar-chart{display:flex;align-items:flex-end;gap:4px;height:160px;padding:0 4px}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}
.bar-fill{width:100%;min-height:2px;background:var(--orange);border-radius:3px 3px 0 0;transition:height .5s ease;position:relative}
.bar-fill:hover{opacity:.8}
.bar-label{font-size:10px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;text-align:center}
.bar-val{font-size:10px;color:var(--text2);font-weight:600}
.chart-legend{display:flex;gap:16px;margin-top:8px;font-size:11px;color:var(--text3)}

/* Weekday / hour heatmap */
.heatmap-row{display:flex;gap:6px;margin-bottom:32px;align-items:flex-end;justify-content:center}
.heat-col{display:flex;flex-direction:column;align-items:center;gap:4px}
.heat-cell{border-radius:4px;transition:all .2s}
.heat-label{font-size:10px;color:var(--text3)}

/* KPI row */
.kpi-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:32px}
.kpi-card{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:16px;text-align:center}
.kpi-val{font-size:28px;font-weight:800;letter-spacing:-.5px}
.kpi-label{font-size:11px;color:var(--text3);text-transform:uppercase;margin-top:4px;font-weight:600;letter-spacing:.5px}

/* ===== MARKER CLUSTERS ===== */
.marker-cluster{border-radius:50%!important}
.marker-cluster div{width:30px;height:30px;margin:5px;text-align:center;border-radius:50%;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;color:#fff}
.marker-cluster-small{background:rgba(252,76,2,.4)}.marker-cluster-small div{background:rgba(252,76,2,.8)}
.marker-cluster-medium{background:rgba(252,76,2,.5)}.marker-cluster-medium div{background:rgba(252,76,2,.9)}
.marker-cluster-large{background:rgba(252,76,2,.6)}.marker-cluster-large div{background:var(--orange)}

/* ===== GOALS ===== */
.goals-section{margin-bottom:32px}
.goals-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.goals-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.goal-card{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:16px;transition:border-color .2s}
.goal-card:hover{border-color:var(--border-l)}
.goal-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.goal-card-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.goal-progress-text{font-size:12px;color:var(--text2);margin-bottom:8px}
.goal-current{font-weight:700;color:var(--orange)}
.goal-target{color:var(--text3)}
.goal-bar-wrap{height:6px;background:var(--border);border-radius:3px;overflow:hidden;margin-bottom:6px}
.goal-bar{height:100%;background:var(--orange);border-radius:3px;transition:width .5s ease}
.goal-footer{display:flex;justify-content:space-between;font-size:11px}
.goal-pct{font-weight:700;color:var(--orange)}
.goal-period{color:var(--text3)}
.goal-form{display:flex;flex-wrap:wrap;gap:8px;padding:16px;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);margin-top:12px;align-items:flex-end}
.goal-form .input-field{flex:1;min-width:120px}
.goal-form-actions{display:flex;gap:6px}

/* ===== PROFILE PAGE ===== */
.profile-id-card{display:flex;align-items:center;background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:20px 24px;margin-bottom:20px}
.profile-id-left{display:flex;align-items:center;gap:16px}
.profile-avatar{width:72px;height:72px;border-radius:50%;object-fit:cover;border:3px solid var(--border);flex-shrink:0}
.profile-avatar-placeholder{width:72px;height:72px;border-radius:50%;background:var(--bg2);border:3px solid var(--border);display:flex;align-items:center;justify-content:center;color:var(--text3);flex-shrink:0}
.profile-id-name{font-size:20px;font-weight:800;letter-spacing:-.3px}
.profile-id-username{font-size:13px;color:var(--text3);margin-top:2px}
.profile-summary{margin-bottom:8px}
.profile-kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
.profile-kpi{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:16px;text-align:center;transition:border-color .2s}
.profile-kpi:hover{border-color:var(--border-l)}
.profile-kpi-val{font-size:24px;font-weight:800;letter-spacing:-.5px}
.profile-kpi-label{font-size:11px;color:var(--text3);text-transform:uppercase;margin-top:4px;font-weight:600;letter-spacing:.5px}
.profile-form{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:24px}
.profile-form-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.profile-field{display:flex;flex-direction:column;gap:6px}
.profile-field label{font-size:11px;color:var(--text3);text-transform:uppercase;letter-spacing:.5px;font-weight:600}
.profile-form-actions{display:flex;align-items:center;gap:12px;margin-top:20px}
.profile-save-msg{font-size:13px;font-weight:600;color:var(--green);opacity:0;transition:opacity .3s}
.profile-save-msg.visible{opacity:1}

/* ===== BEST EFFORTS SHOWCASE ===== */
.best-efforts-showcase{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-bottom:32px}
.effort-card{background:var(--bg1);border:1px solid var(--border);border-radius:var(--radius);padding:20px;cursor:pointer;transition:all .25s}
.effort-card:hover{border-color:var(--orange);transform:translateY(-3px);box-shadow:0 8px 24px rgba(252,76,2,.15)}
.effort-card-empty{cursor:default;opacity:.5}
.effort-card-empty:hover{border-color:var(--border);transform:none;box-shadow:none}
.effort-card-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.effort-distance{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.8px;color:var(--orange)}
.effort-pace{font-size:11px;font-weight:700;color:#fff;background:var(--blue);padding:3px 10px;border-radius:20px}
.effort-time{font-size:28px;font-weight:800;letter-spacing:-.5px;margin-bottom:8px}
.effort-bar-wrap{height:6px;background:var(--border);border-radius:3px;overflow:hidden;margin-bottom:10px}
.effort-bar{height:100%;background:linear-gradient(90deg,var(--orange),var(--yellow));border-radius:3px;transition:width .5s ease}
.effort-detail{font-size:11px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ===== LEAFLET OVERRIDES ===== */
.leaflet-container{background:var(--bg)!important}
.leaflet-control-zoom a{background:var(--bg2)!important;color:var(--text)!important;border-color:var(--border)!important}
.leaflet-control-zoom a:hover{background:var(--bg3)!important}
.leaflet-popup-content-wrapper{background:var(--bg1);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);box-shadow:var(--shadow)}
.leaflet-popup-tip{background:var(--bg1)}
.leaflet-popup-content{margin:10px 14px;font-size:13px}.leaflet-popup-content b{font-weight:600}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar{width:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--border-l)}

/* ===== RESPONSIVE ===== */

/* -- Tablet / small desktop -- */
@media(max-width:1024px){
  .stats-bar{grid-template-columns:repeat(3,1fr)}
  .records-grid{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
  .avg-grid{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}
}

/* -- Map stacking -- */
@media(max-width:900px){
  .map-layout{flex-direction:column}
  .map-sidebar{width:100%;max-height:35vh;border-right:none;border-bottom:1px solid var(--border);overflow-y:auto}
  .map-sidebar.collapsed{max-height:0;border-bottom-color:transparent;overflow:hidden}
  .map-container{flex:1;min-height:50vh}
  .sidebar-toggle{top:auto;bottom:-14px;right:50%;transform:translateX(50%)}
  .sidebar-toggle svg{transform:rotate(-90deg)}
  .sidebar-toggle.flipped{bottom:10px;right:50%;transform:translateX(50%)}
  .sidebar-toggle.flipped svg{transform:rotate(90deg)}
}

/* -- Mobile -- */
@media(max-width:768px){
  /* Header */
  .header{padding:0 12px;height:50px}
  .nav{display:none!important}
  .hamburger{display:flex!important}
  .user-name{display:none}
  .btn-logout{display:none}
  .logo-text{font-size:16px}

  /* Container */
  .container{padding:12px}

  /* Login */
  .login-card{padding:36px 24px;border-radius:16px}
  .login-card h1{font-size:26px}
  .login-sub{font-size:13px;margin-bottom:24px}
  .login-features{gap:16px;margin-bottom:28px}
  .btn-strava{font-size:14px;padding:12px 24px}

  /* Stats bar */
  .stats-bar{grid-template-columns:repeat(2,1fr);gap:8px}
  .stat-card{padding:14px}
  .stat-value{font-size:20px}
  .stat-label{font-size:10px}
  .stat-card-period{grid-column:1/-1}
  .period-selector{width:100%;justify-content:center;gap:2px}
  .period-btn{padding:6px 8px;font-size:11px}

  /* Spotlight */
  .spotlight{flex-direction:column!important}
  .spotlight-info{padding:16px}
  .spotlight-header h3{font-size:15px}
  .spotlight-map{width:100%;height:160px}
  .spotlight-stats{gap:12px}
  .spotlight-stat-val{font-size:14px}

  /* Toolbar */
  .toolbar{flex-direction:column;align-items:stretch;gap:8px}
  .toolbar h2{font-size:16px}
  .toolbar-right{display:grid;grid-template-columns:1fr auto auto;gap:6px}
  .search-input{width:100%}
  .sync-label{display:none}

  /* Filters */
  .filters-panel{padding:12px}
  .filters-row{flex-direction:column;gap:8px}
  .filter-group{min-width:100%}

  /* Activity cards */
  .activity-card{grid-template-columns:40px 1fr;gap:10px;padding:10px 12px}
  .activity-icon{width:40px;height:40px;font-size:20px}
  .activity-info h3{font-size:13px}
  .activity-meta{font-size:11px;gap:8px}
  .activity-stats{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,1fr);gap:6px;text-align:center}
  .sparkline{display:none}
  .activity-stat-val{font-size:12px}
  .activity-stat-label{font-size:9px}

  /* Modal */
  .modal{width:100%;max-width:100%;border-radius:12px 12px 0 0;max-height:95vh;margin-top:auto}
  .modal-content{padding:16px}
  .modal-title{font-size:18px}
  .modal-date{font-size:12px}
  .detail-stats{grid-template-columns:repeat(2,1fr);gap:8px}
  .detail-stat{padding:12px}
  .detail-stat-val{font-size:16px}
  .detail-map{height:220px}
  .elevation-profile-wrap{padding:8px}
  .detail-actions{flex-direction:column}
  .detail-actions .strava-link,.detail-actions .btn{width:100%;justify-content:center}

  /* Stats page */
  .stats-header{flex-direction:column;align-items:stretch}
  .stats-filter .input-field{min-width:100%;width:100%}
  .kpi-row{grid-template-columns:repeat(2,1fr);gap:8px}
  .kpi-val{font-size:22px}
  .records-grid{grid-template-columns:1fr}
  .record-value{font-size:18px}
  .avg-grid{grid-template-columns:1fr}
  .sport-grid{grid-template-columns:1fr}
  .sport-row{cursor:pointer}

  /* Charts */
  .chart-canvas-wrap{height:200px;padding:10px}
  .heatmap-row{overflow-x:auto;justify-content:flex-start;padding-bottom:8px;-webkit-overflow-scrolling:touch}
  .heatmap-hours{flex-wrap:nowrap}

  /* Goals */
  .goals-grid{grid-template-columns:1fr}
  .goal-form{flex-direction:column}
  .goal-form .input-field{min-width:100%;width:100%}
  .goal-form-actions{width:100%;justify-content:stretch}
  .goal-form-actions .btn{flex:1}

  /* Profile */
  .profile-form-grid{grid-template-columns:repeat(2,1fr)}
  .profile-kpi-grid{grid-template-columns:repeat(2,1fr);gap:8px}
  .profile-kpi-val{font-size:20px}
  .profile-id-name{font-size:17px}

  /* Best efforts */
  .best-efforts-showcase{grid-template-columns:1fr}
  .effort-time{font-size:24px}

  /* Map sidebar mobile */
  .map-sidebar{max-height:30vh}
  .sidebar-section{padding:10px}
  .map-act-info h4{font-size:11px}
  
  .zone-row { grid-template-columns: 80px 1fr 35px 50px; }
  .split-row, .splits-header { grid-template-columns: 35px 50px 70px 1fr; gap: 8px; font-size: 11px; }
}

/* -- Small mobile -- */
@media(max-width:480px){
  .container{padding:8px}
  .header{padding:0 8px}

  /* Login */
  .login-card{padding:28px 16px;margin:0 8px}
  .login-card h1{font-size:22px}
  .login-features{flex-direction:column;gap:10px}

  /* Stats bar */
  .stats-bar{grid-template-columns:1fr 1fr;gap:6px}
  .stat-card{padding:10px}
  .stat-value{font-size:18px}
  .period-btn{font-size:9px;padding:4px 5px}

  /* Activity cards */
  .activity-card{grid-template-columns:36px 1fr;gap:8px;padding:8px 10px}
  .activity-icon{width:36px;height:36px;font-size:18px;border-radius:var(--radius-sm)}
  .activity-stats{grid-template-columns:repeat(2,1fr)}

  /* Modal bottom sheet style */
  .modal-overlay{align-items:flex-end}
  .modal{border-radius:16px 16px 0 0;max-height:92vh}
  .modal-content{padding:12px}
  .modal-title{font-size:16px}
  .detail-stats{grid-template-columns:1fr 1fr;gap:6px}
  .detail-stat{padding:10px}
  .detail-stat-val{font-size:14px}
  .detail-map{height:180px}

  /* Stats page */
  .kpi-row{grid-template-columns:1fr 1fr;gap:6px}
  .kpi-val{font-size:18px}
  .section-title{font-size:14px}
  .chart-canvas-wrap{height:180px;padding:8px}

  /* Profile */
  .profile-form-grid{grid-template-columns:1fr}
  .profile-id-card{padding:16px}
  .profile-avatar{width:56px;height:56px}
  .profile-avatar-placeholder{width:56px;height:56px}
  .profile-id-name{font-size:16px}
  .profile-form{padding:16px}

  /* Best efforts */
  .effort-time{font-size:20px}

  /* Spotlight */
  .spotlight-stats{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
  .spotlight-map{height:140px}
}

/* ===== INFINITE SCROLL SPINNER ===== */
.infinite-spinner{display:flex;justify-content:center;padding:16px;color:var(--text3)}
.spin{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ===== DASHBOARD CUSTOMIZATION ===== */
#statsBar.is-customizing .stat-card[data-id]{cursor:grab;border:1px dashed var(--orange);position:relative}
#statsBar.is-customizing .stat-card[data-id]:active{cursor:grabbing}
.stat-card.dragging{opacity:.4;transform:scale(.97)}
.stat-card.drag-over{border:1px solid var(--orange)!important;background:var(--orange-glow)!important}
.drag-handle{position:absolute;top:4px;left:6px;font-size:16px;color:var(--text3);cursor:grab;line-height:1;user-select:none}
.hide-card-btn{position:absolute;top:2px;right:4px;background:none;border:none;color:var(--text3);font-size:16px;cursor:pointer;line-height:1;padding:2px 4px}
.hide-card-btn:hover{color:var(--red)}
#customizeBtn.active{background:var(--orange);color:#fff;border-color:var(--orange)}

/* ===== PACE/HR CHART MODAL ===== */
.splits-pace-chart-wrap{margin:16px 0;background:var(--bg2);border-radius:var(--radius);padding:12px 16px}
.splits-pace-chart-wrap h4{color:var(--text2);font-size:13px;margin-bottom:10px}
.splits-pace-chart-canvas{height:180px;position:relative}

/* ===== INTENSITY MAP LEGEND ===== */
.intensity-legend{display:flex;align-items:center;gap:6px;margin-top:6px;padding:4px 8px;background:var(--bg2);border-radius:6px;font-size:11px;color:var(--text3)}
.intensity-legend-bar{height:8px;flex:1;border-radius:4px;background:linear-gradient(to right,#22c55e,#eab308,#ef4444)}

/* ===== HR ANALYSIS SECTION ===== */
.hr-analysis-grid{display:grid;grid-template-columns:auto 1fr 1.5fr;gap:16px;align-items:start;margin:8px 0 16px}
.hr-analysis-kpis{display:flex;flex-direction:column;gap:8px}
.hr-chart-wrap{min-height:200px;position:relative}
.hr-monthly-wrap{min-height:180px;position:relative}
@media(max-width:768px){
  .hr-analysis-grid{grid-template-columns:1fr}
}