/* ============================================================================
   Chasing Better — shared base stylesheet.

   Loaded by every athlete-facing page (not the one-off porto-sintra taper
   report, which has its own unrelated palette). Holds the CSS that was
   previously copy-pasted near-identically into every page's own <style>
   block — the drawer/backdrop chrome especially, which caused two real bugs
   this session when a new page forgot to include it.

   Deliberately does NOT include: .btn, .msg, .pill, .card h3, .metric's
   interactive states — these mean genuinely different things on different
   pages (a full-width gradient CTA on login.html vs. a bordered secondary
   button on core.html, for example), so unifying them under one rule would
   just force a visual change on whichever pages didn't get it that way
   originally. Those stay page-specific, defined after this file loads.

   .drawer / .hamburger / .cbc-topbar's SECOND, higher-specificity layer is
   injected at runtime by js/cbc-ui.js (search that file for "one hamburger
   definition shared by every page") — this file only supplies the base
   positioning/box-model CSS a page needs before that JS runs.
   ============================================================================ */

:root{
  color-scheme:dark;
  --bg:#0a0e14;
  --panel:#121821;
  --panel-2:#0f141c;
  --line:#1e2733;
  --txt:#e6edf3;
  --muted:#7d8896;
  --accent:#00e5a0;      /* neon green */
  --accent-2:#2ec5ff;    /* cyan */
  --warn:#ffb020;
  --hot:#ff4d5e;
  --grad:linear-gradient(135deg,#00e5a0,#2ec5ff);
  /* discipline accents — only used on run/swim dashboards, harmless elsewhere */
  --run:#ff7a45; --run-2:#ffb020; --run-grad:linear-gradient(135deg,#ff7a45,#ffb020);
  --swim:#3fa9f5; --swim-2:#2ec5ff; --swim-grad:linear-gradient(135deg,#3fa9f5,#2ec5ff);
  --bg-glow:#10202a;     /* first stop of the body background gradient — override per page if needed */
}

*{box-sizing:border-box;margin:0;padding:0}
body{
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
  background:radial-gradient(1200px 600px at 80% -10%,var(--bg-glow) 0%,var(--bg) 55%);
  color:var(--txt);
  min-height:100vh;
}

/* ---- topbar (utility/detail pages: calendar, profile, ride/run/swim-detail, workout, gear, nutrition, coach-history) ---- */
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px;flex-wrap:wrap;gap:14px}
.back{display:inline-flex;align-items:center;gap:9px;font-size:13px;font-weight:600;color:var(--accent);
  text-decoration:none;background:rgba(0,229,160,.08);border:1px solid rgba(0,229,160,.3);
  padding:9px 15px;border-radius:10px;transition:background .15s,transform .1s}
.back:hover{background:rgba(0,229,160,.16);transform:translateX(-2px)}
.crumb{font-size:12px;color:var(--muted)}.crumb b{color:var(--txt)}

/* ---- header (overview-style pages: core, dashboard, cycle/run/swim-dashboard) ---- */
header{display:flex;align-items:center;justify-content:space-between;margin-bottom:26px;flex-wrap:wrap;gap:16px}
.brand{display:flex;align-items:center;gap:14px}
.brand h1{font-size:20px;font-weight:700;letter-spacing:-.3px}
.brand p{font-size:12px;color:var(--muted);margin-top:2px}
.header-right{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted)}
.logo{width:44px;height:44px;border-radius:12px;background:var(--grad);display:flex;align-items:center;justify-content:center;font-size:22px}
.avatar{width:38px;height:38px;min-width:38px;min-height:38px;flex:0 0 38px;aspect-ratio:1;border-radius:50%;background:var(--grad);
  display:flex;align-items:center;justify-content:center;font-weight:700;color:#04121a;text-decoration:none;cursor:pointer;
  background-size:cover;background-position:center;border:2px solid transparent;transition:.15s;overflow:hidden}
.avatar:hover{border-color:var(--accent)}

/* ---- drawer + backdrop — identical on every app-shell page ---- */
.hamburger{width:40px;height:40px;border-radius:11px;background:var(--panel);border:1px solid var(--line);color:var(--txt);
  cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0;transition:.15s}
.hamburger:hover{border-color:#33414f;background:var(--panel-2)}
.drawer{position:fixed;top:0;left:0;height:100%;width:272px;background:#0d141c;border-right:1px solid var(--line);
  z-index:1001;transform:translateX(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);padding:22px 18px;
  display:flex;flex-direction:column;gap:4px;box-shadow:10px 0 40px rgba(0,0,0,.45);overflow-y:auto}
.drawer.open{transform:translateX(0)}
.drawer-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.drawer-head .dt{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:700}
.drawer-head .dt .dlogo{width:30px;height:30px;border-radius:8px;background:var(--grad);display:flex;align-items:center;justify-content:center;font-size:16px}
.drawer-close{background:none;border:none;color:var(--muted);font-size:24px;cursor:pointer;line-height:1;padding:0 4px}
.drawer-close:hover{color:var(--txt)}
.drawer a{display:flex;align-items:center;gap:12px;padding:11px 13px;border-radius:10px;color:var(--txt);
  text-decoration:none;font-size:14px;font-weight:600;transition:.15s;border:1px solid transparent}
.drawer a:hover{background:var(--panel)}
.drawer a.active{background:rgba(0,229,160,.1);color:var(--accent);border-color:rgba(0,229,160,.3)}
.drawer a .mi{font-size:17px;width:22px;text-align:center}
.drawer .sec{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--muted);margin:16px 0 6px;padding-left:6px}
.drawer .dfoot{margin-top:auto;padding-top:16px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}
.backdrop{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1000;opacity:0;visibility:hidden;transition:.25s}
.backdrop.open{opacity:1;visibility:visible}

/* ---- grid + span utilities (12-column) ---- */
.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:18px}
.span3{grid-column:span 3}.span4{grid-column:span 4}.span5{grid-column:span 5}
.span6{grid-column:span 6}.span7{grid-column:span 7}.span8{grid-column:span 8}.span12{grid-column:span 12}
@media(max-width:900px){.span3,.span4,.span5,.span6,.span7,.span8{grid-column:span 12}}
/* short aliases used by ride/run/swim-detail.html's own JS-generated markup —
   same 12-col grid, just a shorter class name; kept as aliases rather than
   renaming every generated-HTML reference in those three files */
.s5{grid-column:span 5}.s7{grid-column:span 7}.s12{grid-column:span 12}
@media(max-width:1000px){.s5,.s7{grid-column:span 12}}

/* ---- card shell (h3 sizing/weight is page-specific — dashboards want a small
   muted eyebrow label, core.html wants a bold heading, so that one rule is
   deliberately left for each page to set itself) ---- */
.card{background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:20px}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.card-head h3{margin-bottom:0}

/* ---- generic status badge (activity-detail pages) ---- */
.badge{font-size:11px;font-weight:700;letter-spacing:.5px;padding:5px 11px;border-radius:20px}

/* ---- footer caption ---- */
.foot{margin-top:28px;text-align:center;color:var(--muted);font-size:12px}

/* ---- filterable chart legend + canvas sizing (both class names supported:
   .swatch is dashboard.html's naming, .sw is ride/run/swim-detail's) ---- */
.chart-legend{display:flex;gap:16px;flex-wrap:wrap}
.chart-legend label{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600;color:var(--txt);cursor:pointer;user-select:none;transition:opacity .15s}
.chart-legend label.off{opacity:.4}
.chart-legend input{appearance:none;-webkit-appearance:none;width:15px;height:15px;border:1.5px solid var(--muted);
  border-radius:4px;cursor:pointer;position:relative;flex-shrink:0;transition:background .15s,border-color .15s}
.chart-legend input:checked{background:var(--accent);border-color:var(--accent)}
.chart-legend input:checked::after{content:"✓";position:absolute;top:-2px;left:1.5px;font-size:12px;color:#04121a;font-weight:900}
.chart-legend .swatch,.chart-legend .sw{width:20px;height:0;border-top:3px solid;border-radius:2px}
.chart-legend .swatch.dash,.chart-legend .sw.dash{border-top-style:dashed}
canvas{max-width:100%}
/* height varies genuinely by page family (210/230/300px) — each page sets its
   own .chart-box{height:...} / .chart-box.sm{height:...}, this is just the shared bit */
.chart-box{position:relative}

/* ---- activity-detail stat tiles (ride/run/swim-detail) ---- */
.stat-groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin-bottom:18px}
.sg{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:12px 16px}
.sg-t{font-size:10px;letter-spacing:1.2px;text-transform:uppercase;color:var(--muted);margin-bottom:9px}
.sg-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(92px,1fr));gap:10px}
.stat-tile{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:14px 16px}
.stat-tile .v{font-size:21px;font-weight:800;line-height:1}
.stat-tile .v small{font-size:12px;color:var(--muted);font-weight:600}
.stat-tile .k{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;margin-top:7px}
.stat-tile .v.green{color:var(--accent)}.stat-tile .v.amber{color:var(--warn)}.stat-tile .v.red{color:var(--hot)}.stat-tile .v.blue{color:var(--accent-2)}

/* ---- activity-detail table (splits) ---- */
table{width:100%;border-collapse:collapse;font-size:13px}
thead th{text-align:right;font-size:10.5px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);font-weight:600;padding:0 10px 11px;border-bottom:1px solid var(--line)}
thead th:first-child{text-align:left}
tbody td{text-align:right;padding:11px 10px;border-bottom:1px solid var(--line)}
tbody td:first-child{text-align:left;font-weight:600}
tbody tr:last-child td{border-bottom:none}

/* ---- Leaflet dark-theme blend (ride/run/swim-detail route maps) ---- */
#mapDiv{position:absolute;inset:0;border-radius:12px;z-index:1;background:#0b1118}
.leaflet-tile{filter:brightness(.72) contrast(1.06) saturate(.75)}
.leaflet-control-attribution{background:rgba(10,14,20,.7)!important;color:#7d8896!important;font-size:9px!important}
.leaflet-control-attribution a{color:#9fb2c3!important}
