/* ============================================================================
   X FACTOR PERFORMANCE — Athlete Management System (demo)
   Design system aligned to the SDA platform's visual language: a clean, neutral
   grayscale shadcn/ui look — white background, near-black "primary", soft gray
   surfaces, hairline borders, Inter type, 10px cards, pill badges, flat
   elevation. Brand colour lives only in the logo; status colour is semantic.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Neutral grayscale (shadcn "neutral") */
  --bg: #ffffff;
  --ink: #171717;          /* foreground / primary (near-black) */
  --ink-2: #262626;
  --charcoal: #404040;
  --muted: #6b6b6b;        /* secondary text */
  --muted-2: #a3a3a3;      /* tertiary / disabled */
  --line: #e5e5e5;         /* hairline border */
  --line-2: #efefef;
  --surface: #f5f5f5;      /* muted surface */
  --surface-2: #fafafa;    /* subtle / sidebar */
  --primary: #171717;
  --primary-fg: #fafafa;
  --primary-hover: #2b2b2b;

  /* chrome accent = primary (no brand colour in UI); tints are neutral gray */
  --accent: #171717;
  --accent-strong: #171717;
  --accent-tint: #f2f2f2;   /* active nav / hover row */
  --accent-bright: #8fd11a; /* brand lime — used ONLY on the dark brand panel */

  /* Semantic status */
  --good: #2e7d4f;
  --good-tint: #e8f2ec;
  --warn: #9a6a0f;
  --warn-tint: #faf0da;
  --bad: #c0392b;
  --bad-tint: #f8e9e7;
  --info: #44506b;
  --info-tint: #eceef3;

  /* Chart series — restrained, distinguishable; semantic where meaningful */
  --c-wellness: #2e7d4f;   /* green = wellness */
  --c-prep: #5b6bb5;       /* muted indigo */
  --c-load-daily: #334155; /* slate */
  --c-load-weekly: #94a3b8;/* light slate */
  --c-bowling: #c0392b;    /* red */
  --c-acute: #334155;
  --c-chronic: #a3a3a3;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 256px;
  --topbar-h: 56px;
  --content-max: 1152px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "rlig" 1, "calt" 1;
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--ink); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .6875rem;
  font-weight: 600;
  color: var(--muted);
}
.mono-num, .num, .value, .time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ============================================================================
   BUTTONS — shadcn recipes
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer;
  font-weight: 500; font-size: .875rem; padding: 0 16px; height: 40px; transition: .15s ease;
  background: var(--primary); color: var(--primary-fg); white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(.5px); }
.btn-accent { background: var(--primary); color: var(--primary-fg); }
.btn-accent:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-subtle, .btn-outline { background: var(--bg); color: var(--ink); border-color: var(--line); }
.btn-subtle:hover, .btn-outline:hover { background: var(--surface); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #a62f24; }
.btn-sm { padding: 0 12px; height: 36px; font-size: .8125rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--bg); cursor: pointer; color: var(--muted); transition: .15s ease;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; background: var(--bg); color: var(--muted); }
.icon-btn.on { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm svg { width: 16px; height: 16px; }
.seg { display: inline-flex; }
.seg .icon-btn { width: 32px; height: 32px; }
.seg .icon-btn svg { width: 17px; height: 17px; }
.seg .icon-btn { border-radius: 0; }
.seg .icon-btn + .icon-btn { margin-left: -1px; }
.seg .icon-btn:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.seg .icon-btn:last-child { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.seg .icon-btn.on { position: relative; z-index: 1; }
.combo, .combo-field { position: relative; }
.combo input { padding-right: 34px; }
.combo-chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: inline-flex; }
.combo-chev svg { width: 16px; height: 16px; }
.combo-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 220px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px;
}
/* inside a scrolling modal body, open in-flow so the list is never clipped */
/* in a modal the list floats over everything (placed by JS), so it is never clipped by the scrolling modal */
.modal .combo-list { position: fixed; z-index: 120; }
.combo-opt { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .875rem; }
.combo-opt:hover { background: var(--surface); }
.combo-opt.sel { font-weight: 600; background: var(--surface); }
.combo-ro { cursor: pointer; caret-color: transparent; }
.combo-empty { padding: 8px 10px; }
.agenda-ev.clickable-card { border-radius: var(--radius-md); padding-inline: 6px; margin-inline: -6px; }

/* ============================================================================
   CARDS & LAYOUT HELPERS
   ============================================================================ */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: .9375rem; font-weight: 600; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ============================================================================
   BADGES / PILLS / FLAGS — tinted /15 status
   ============================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .75rem;
  font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); color: var(--muted); border: 1px solid transparent;
}
.badge svg { width: 13px; height: 13px; }
.badge.good { background: var(--good-tint); color: var(--good); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.bad  { background: var(--bad-tint); color: var(--bad); }
.badge.info { background: var(--info-tint); color: var(--info); }
.badge.accent { background: var(--surface); color: var(--ink); border-color: var(--line); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); } .dot.muted { background: var(--muted-2); }

/* ============================================================================
   LOGIN SCREEN
   ============================================================================ */
.auth {
  min-height: 100dvh; display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--bg);
}
.auth-mobile-brand { display: none; }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(165deg, #171717, #1f1f1f 60%, #141414);
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; opacity: .4;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.025) 0 2px, transparent 2px 52px);
  pointer-events: none;
}
.auth-logo { width: 232px; height: auto; align-self: flex-start; }
.auth-hero h1 { font-size: 2.25rem; max-width: 13ch; font-weight: 600; letter-spacing: -0.02em; }
.auth-hero .accent-text { color: var(--accent-bright); }
.auth-hero p { color: #a3a3a3; margin-top: 16px; max-width: 44ch; font-size: .9375rem; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; }
.auth-feat { display: flex; gap: 10px; align-items: flex-start; color: #d4d4d4; font-size: .9rem; }
.auth-feat svg { flex: none; margin-top: 1px; width: 18px; height: 18px; color: var(--accent-bright); }

.auth-panel {
  background: var(--surface-2); padding: 52px 48px; display: flex; flex-direction: column;
  justify-content: center; overflow-y: auto;
}
.auth-panel-inner { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-panel-inner h2 { margin: 4px 0 6px; }
.auth-lead { margin: 0 0 18px; }
.auth-msg { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); font-size: .875rem; margin-bottom: 14px; }
.auth-msg svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.auth-msg.bad { background: #fbeceb; border-color: #f0c8c4; color: #8a2a20; }
.auth-who { display: flex; align-items: center; gap: 8px; font-size: .875rem; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 16px; width: fit-content; max-width: 100%; }
.auth-who svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.auth-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .875rem; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-btn[disabled] { opacity: .5; cursor: not-allowed; }
.auth-alt { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; margin-top: 16px; }
.auth-code { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; height: 56px; }
.btn-block svg { width: 18px; height: 18px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--ink); color: #fff; font-weight: 600;
  width: 36px; height: 36px; font-size: .8125rem; letter-spacing: .01em; flex: none;
}
.avatar.accent { background: var(--ink); color: #fff; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  background: var(--ink); color: #fff; display: flex; align-items: center;
  gap: 14px; padding: 0 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 24px; }
.topbar .brand .divline { width: 1px; height: 20px; background: rgba(255,255,255,.16); }
.topbar .brand .sub { font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: #a3a3a3; font-weight: 600; }
.topbar .spacer { flex: 1; }

.athlete-switch {
  display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-md); padding: 4px 6px 4px 10px;
  color: #fff; cursor: pointer; font-size: .8125rem; font-weight: 500;
}
.athlete-switch:hover { background: rgba(255,255,255,.12); }
.athlete-switch svg { width: 16px; height: 16px; opacity: .8; }
.athlete-switch select {
  background: transparent; border: none; color: #fff; font-weight: 500;
  font-family: inherit; font-size: .8125rem; cursor: pointer; padding: 4px; outline: none;
}
.athlete-switch select option { color: #111; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: #fff; font: inherit; cursor: pointer; }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.user-chip .nm { display: block; font-size: .8125rem; font-weight: 500; }
.user-chip .rl { display: block; font-size: .625rem; color: #a3a3a3; text-transform: uppercase; letter-spacing: .08em; }
.user-chip .uc-chev { display: inline-flex; color: #a3a3a3; }
.user-chip .uc-chev svg { width: 16px; height: 16px; }
.topbar .menu { min-width: 180px; color: var(--ink); }
/* on the dark bar the initials need a light circle to read as one */
.user-chip .avatar, .user-chip .avatar.accent { background: #fff; color: var(--ink); width: 32px; height: 32px; font-size: .75rem; font-weight: 700; }

.layout { display: flex; min-height: calc(100dvh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface-2); border-right: 1px solid var(--line);
  padding: 16px 12px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
  overflow-y: auto; display: flex; flex-direction: column;
}
.nav-group-label { padding: 14px 10px 6px; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--charcoal); font-weight: 500; font-size: .875rem; cursor: pointer; margin-bottom: 2px; transition: .12s ease;
}
.nav-item svg { flex: none; color: var(--muted); width: 18px; height: 18px; }
.nav-item:hover { background: var(--accent-tint); }
.nav-item.active { background: var(--accent-tint); color: var(--ink); font-weight: 600; }
.nav-item.active svg { color: var(--ink); }
.nav-item .nav-badge { margin-left: auto; }

.main { flex: 1; min-width: 0; padding: 32px 28px 40px; }
.main > * { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 4px; }

.mobile-nav { display: none; }
.hamburger { display: none; }

/* ============================================================================
   STAT TILES
   ============================================================================ */
.stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.stat .label { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 1.875rem; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .875rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat .sub { font-size: .75rem; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--good); } .trend-down { color: var(--bad); }

/* ============================================================================
   FORM CONTROLS — check-in
   ============================================================================ */
.field { margin-bottom: 22px; }
.field > label.q { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: 4px; }
.field .hint { font-size: .8125rem; color: var(--muted); margin-bottom: 10px; }

.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale.sc-10 .scale-opt { min-width: 40px; }
.scale-opt {
  flex: 1; min-width: 52px; border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius-md); padding: 12px 4px; text-align: center; cursor: pointer;
  font-weight: 600; font-size: 1.05rem; color: var(--charcoal); transition: .12s ease; user-select: none;
  font-variant-numeric: tabular-nums;
}
.scale-opt:hover { border-color: var(--ink); }
.scale-opt.sel { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.scale-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 6px; }

.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice {
  border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-md);
  padding: 9px 15px; cursor: pointer; font-weight: 500; font-size: .875rem; color: var(--charcoal); transition: .12s ease;
}
.choice:hover { border-color: var(--ink); }
.choice.sel { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.choice.sel.ok { background: var(--good); border-color: var(--good); }
.choice.sel.warn { background: var(--warn); border-color: var(--warn); }
.choice.sel.bad { background: var(--bad); border-color: var(--bad); }

input[type="text"], input[type="number"], input[type="time"], input[type="date"],
input[type="email"], input[type="password"], textarea, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 12px; height: 40px;
  font-family: inherit; font-size: .875rem; color: var(--ink); background: var(--bg);
}
textarea { padding: 10px 12px; height: auto; }
/* iOS Safari draws date/time fields natively: it ignores width, centres the value and
   collapses the height when empty — make them behave like the other inputs */
input[type="time"], input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-height: 40px; line-height: 40px; text-align: left; }
input[type="time"]::-webkit-date-and-time-value, input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
textarea { resize: vertical; min-height: 72px; }
label.lbl { display: block; font-size: .8125rem; font-weight: 500; color: var(--charcoal); margin-bottom: 6px; }

.score-ring { display: flex; align-items: center; gap: 16px; }

/* ============================================================================
   ACCORDION
   ============================================================================ */
.acc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); margin-bottom: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; user-select: none; }
.acc-head:hover { background: var(--surface-2); }
.acc.done:not(.open) .acc-head { background: var(--good-tint); }
.acc.done { border-color: #cfe6d8; }
.acc-ic { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: var(--muted); font-weight: 600; font-size: .85rem; flex: none; }
.acc-ic svg { width: 16px; height: 16px; }
.acc.done .acc-ic { background: var(--good); color: #fff; }
.acc-title { font-weight: 600; font-size: .95rem; flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.acc-sum { font-weight: 500; font-size: .8125rem; color: var(--muted); }
.acc-chev { color: var(--muted-2); transition: transform .15s ease; display: inline-flex; flex: none; }
.acc-chev svg { width: 18px; height: 18px; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { padding: 18px 20px 20px; border-top: 1px solid var(--line-2); }

/* training-load session rows */
.concern-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; background: var(--surface-2); }
.concern-card .field:last-child { margin-bottom: 0; }
.sess { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; background: var(--surface-2); }
/* both rows share one column grid so the dropdowns and the RPE / duration boxes line up */
.sess-row1 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px; gap: 12px; align-items: center; margin-bottom: 12px; }
.sess-row1 .icon-btn { justify-self: end; }
.sess-row1 select, .sess-row1 input { width: 100%; min-width: 0; }
.sess-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px; gap: 12px; align-items: end; }
.sess-au { text-align: right; }
.sess-au .au { font-size: 1.2rem; font-weight: 700; }

/* admin contextual athlete picker */
.ath-picker { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 10px; height: 40px; background: var(--bg); cursor: pointer; }
.ath-picker svg { width: 16px; height: 16px; color: var(--muted); }
.ath-picker { font: inherit; font-size: .875rem; font-weight: 500; color: var(--ink); }
.ath-picker-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ath-picker-chev { display: inline-flex; color: var(--muted); }
.ath-combo { position: relative; }
.ath-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 260px; max-width: calc(100vw - 28px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.ath-search { height: 36px; margin-bottom: 4px; }
.ath-list { max-height: 166px; overflow-y: auto; }   /* about three athletes, then scroll */
.ath-list .combo-opt { padding: 7px 10px; line-height: 1.3; }

.load-row {
  display: grid; grid-template-columns: 1.4fr 90px 90px 1fr; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.load-row .cat { font-weight: 500; }
.load-row .au { font-weight: 600; text-align: right; }
.na-toggle { font-size: .75rem; color: var(--muted); cursor: pointer; }

/* ============================================================================
   TABLES
   ============================================================================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.tbl th {
  text-align: left; font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 500; padding: 11px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
/* keep each cell on one line; .table-wrap scrolls sideways on narrow screens instead of squashing rows */
table.tbl td, table.tbl th { white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* athlete name cell (table + cards) */
.trow-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tmeta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tname { font-weight: 600; white-space: nowrap; }
.tsub { font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* ============================================================================
   ATTENTION GRID (admin dashboard)
   ============================================================================ */
.attn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.attn-item {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; background: var(--bg);
}
.attn-item .avatar { width: 34px; height: 34px; font-size: .78rem; }
.attn-body { flex: 1; min-width: 0; }
.attn-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.attn-name { font-weight: 600; font-size: .9rem; }
.attn-item .btn { flex: none; align-self: center; }
.clickable-card { cursor: pointer; transition: .12s ease; }
.clickable-card:hover { background: var(--surface-2); border-color: var(--muted-2); }

/* mobile athlete overview cards (desktop uses the table) */
.ath-mobile { display: none; }
.ath-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; background: var(--bg); }
.ath-card:last-child { margin-bottom: 0; }
.ath-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ath-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.ath-card-stats > div { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; min-width: 0; }
.ath-card-stats .acs-l { font-size: .625rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.ath-card-stats .badge { font-size: .72rem; }

/* ============================================================================
   PROGRAM CARDS
   ============================================================================ */
.prog-card { padding: 20px; display: flex; flex-direction: column; }
.prog-card:hover { box-shadow: var(--shadow); }
.prog-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.prog-card-head .chev { margin-left: auto; color: var(--muted-2); display: inline-flex; }
.prog-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.prog-icon svg { width: 20px; height: 20px; }
.prog-card h3 { margin-bottom: 6px; }
.prog-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 16px; }
.prog-card-foot .chev, .prog-card-foot svg { width: 14px; height: 14px; vertical-align: -2px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.pbar { display: inline-block; width: 84px; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* ============================================================================
   SECURITY / FEATURE ITEMS (settings)
   ============================================================================ */
.sec-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); }
.sec-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }
.sec-ic svg { width: 18px; height: 18px; }
.sec-t { font-weight: 600; font-size: .875rem; margin-bottom: 2px; }

/* ============================================================================
   CHARTS
   ============================================================================ */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 12px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 500;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  color: var(--charcoal); background: var(--bg); user-select: none; transition: .12s ease;
}
.legend-item:hover { background: var(--surface); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-item.off { opacity: .4; }
.legend-item.off .swatch { background: var(--muted-2) !important; }
svg.chart { width: 100%; height: auto; display: block; }
/* side-by-side charts: equal-height cards, charts aligned to the bottom whatever the legend wraps to */
.chart-pair > .card { display: flex; flex-direction: column; }
.chart-pair > .card > .card-pad { flex: 1; display: flex; flex-direction: column; }
.chart-pair svg.chart { margin-top: auto; }
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line-2); }
.chart-tip {
  position: fixed; z-index: 60; background: var(--ink); color: #fff; padding: 8px 10px;
  border-radius: var(--radius-md); font-size: .75rem; pointer-events: none; box-shadow: var(--shadow-lg);
  max-width: 220px;
}
.chart-tip .tt-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart-tip b { font-weight: 600; }

.acwr-zones { display: flex; gap: 6px; font-size: .75rem; color: var(--muted); }

/* ============================================================================
   CALENDAR
   ============================================================================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--surface-2); padding: 8px; text-align: center; font-size: .6875rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { background: var(--bg); min-height: 104px; min-width: 0; padding: 7px; display: flex; flex-direction: column; gap: 4px; }
.cal-head { flex-wrap: wrap; gap: 10px; }
.cal-nav strong { min-width: 140px; text-align: center; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell .daynum { font-size: .8125rem; font-weight: 600; color: var(--charcoal); }
.cal-cell.today .daynum { background: var(--ink); color: #fff; border-radius: 999px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-ev {
  font-size: .6875rem; font-weight: 500; padding: 3px 7px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid;
}
.cal-ev.done { opacity: .5; text-decoration: line-through; }
.agenda-day { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.agenda-day .d { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.agenda-ev { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.agenda-ev .time { font-size: .8125rem; color: var(--muted); width: 84px; flex: none; font-variant-numeric: tabular-nums; }
.agenda-ev .bar { width: 3px; align-self: stretch; border-radius: 3px; flex: none; }

/* sliding day view */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.day-strip::-webkit-scrollbar { height: 6px; }
.day-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.day-chip { flex: none; width: 52px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-md); padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; scroll-snap-align: center; transition: .12s ease; }
.day-chip:hover { border-color: var(--ink); }
.day-chip .dc-dow { font-size: .625rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.day-chip .dc-num { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-chip .dc-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-bright); }
.day-chip.today { border-color: var(--muted-2); }
.day-chip.sel { background: var(--primary); border-color: var(--primary); }
.day-chip.sel .dc-dow, .day-chip.sel .dc-num { color: var(--primary-fg); }
.day-chip.sel .dc-dot { background: #fff; }

/* event type colours — muted, accessible */
.evt-gym { background:#eef1fb; color:#3a4aa0; border-color:#3a4aa0 !important; }
.evt-run { background:#fbf1e6; color:#b06514; border-color:#b06514 !important; }
.evt-rehab { background:#f1ecfa; color:#6340b8; border-color:#6340b8 !important; }
.evt-skills { background:#e8f2ec; color:#2e7d4f; border-color:#2e7d4f !important; }
.evt-match { background:#f8e9e7; color:#c0392b; border-color:#c0392b !important; }
.evt-travel { background:#eceef3; color:#44506b; border-color:#44506b !important; }
.evt-rest { background:#f2f2f2; color:#6b6b6b; border-color:#a3a3a3 !important; }
.evt-medical { background:#e8f2ec; color:#1f6b40; border-color:#1f6b40 !important; }
.evt-meeting { background:#e6f3f5; color:#17707f; border-color:#17707f !important; }
.evt-other { background:#f2f2f2; color:#555; border-color:#999 !important; }

/* ============================================================================
   MODAL + TOAST
   ============================================================================ */
#modal-root:empty, #toast-root:empty { display: none; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 88vh; max-height: 88dvh; /* vh fallback where dvh is unsupported */
  overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  animation: pop .14s ease;
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--bg); align-items: center; }

#toast-root { position: fixed; top: 16px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: .875rem; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: pop .14s ease;
  max-width: 340px;
}
.toast .ic { color: var(--accent-bright); flex: none; }
.toast svg { width: 16px; height: 16px; }

.notice {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; font-size: .8125rem; color: var(--charcoal); line-height: 1.55;
}
.notice svg { width: 16px; height: 16px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { color: var(--muted-2); margin-bottom: 10px; width: 24px; height: 24px; }

.prog-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 8px; }
.prog-item .pnum { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; color: var(--muted); }
.prog-item .pdetail, .prog-ex .pdetail { font-size: .8125rem; color: var(--muted); }
.prog-check { width: 22px; height: 22px; border: 1.5px solid var(--line); border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.prog-check.done { background: var(--primary); border-color: var(--primary); color: #fff; }
.prog-check svg { width: 14px; height: 14px; }
.prog-ex { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 8px; }
.prog-ex.done { border-color: var(--good); }
.sess-load { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 16px; }
.sess-load .au { font-size: 1.3rem; font-weight: 700; }
.saved-note { display: inline-flex; align-items: center; gap: 4px; transition: color .2s; }
.saved-note svg { width: 14px; height: 14px; }
.saved-note.flash { color: var(--good); }
.prog-sets { margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line-2); margin-left: 2px; }
.prog-set { display: grid; grid-template-columns: 44px 1fr 96px 22px; gap: 10px; align-items: center; padding: 5px 0; }
.prog-set .set-n { font-size: .75rem; font-weight: 600; color: var(--muted); }
.prog-set .set-target { font-size: .875rem; }
.prog-set.done .set-n, .prog-set.done .set-target { color: var(--muted); text-decoration: line-through; }
.prog-set .set-w { height: 34px; padding: 0 10px; font-size: .875rem; }
.ev-prog-list { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 4px 8px; }
.ev-prog-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.ev-prog-row:last-child { border-bottom: 0; }
/* dropdown menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 260px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font: inherit; font-size: .875rem; color: var(--ink); text-align: left; }
.menu-item:hover { background: var(--surface); }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-item[disabled] { opacity: .5; cursor: not-allowed; background: none; }
/* content variants: .desk-only above phone width, .mob-only on phones */
.mob-only { display: none !important; }
.acc { scroll-margin-top: 72px; }
/* phones & tablets: tables become stacked cards; form text ≥16px so iOS doesn't zoom in
   on focus (that zoom is what made forms / popups drag sideways) */
@media (max-width: 1000px) {
  .ath-table { display: none; }
  .ath-mobile { display: block; }
  .ath-mobile.card-pad { padding: 0; }
  .ath-mobile .ath-card { border: 0; border-radius: 0; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  .ath-mobile .ath-card:last-child { border-bottom: 0; }
  .ath-mobile .ath-card-head { margin-bottom: 10px; }
  .ath-mobile .ath-card-stats { gap: 10px 8px; }
  /* Needs attention: same full-width rows with dividers */
  .acc-list { padding: 0; }
  .acc-list .attn-grid { grid-template-columns: 1fr; gap: 0; }
  .acc-list .attn-item { border: 0; border-radius: 0; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  .acc-list .attn-item:last-child { border-bottom: 0; }
}
@media (max-width: 760px), (pointer: coarse) {
  input, select, textarea, .ms-search, .tags-input { font-size: 16px !important; }
}
/* athlete profile header: identity left, icon actions top-right */
.prof-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.prof-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.prof-text { min-width: 0; }
.prof-text h1 { margin: 2px 0; overflow-wrap: anywhere; }
.prof-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.prof-filters-card { margin-bottom: 16px; }
.prof-filters { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
/* date range as a segmented control */
.range-sel { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.range-sel .choice { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; font-size: .8125rem; font-weight: 600; color: var(--muted); }
.range-sel .choice:hover { color: var(--ink); }
.range-sel .choice.sel { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.range-select { display: none; }
/* calendar header: title + athlete picker + add on one row */
.cal-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 760px) {
  .cal-page-head { flex-wrap: nowrap; align-items: center; }
  .cal-title { min-width: 0; }
  .cal-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-actions .ath-picker { padding: 0 8px; }
  .cal-actions .ath-picker > svg { display: none; }
  .cal-actions .ath-picker-name { max-width: 96px; }
  .cal-add { width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; }
  .desk-only { display: none !important; }
  /* session workout: full-width exercise rows separated by dividers */
  .session-prog > .card-pad { padding: 14px 0 0; }
  .session-prog .stack > :not(.prog-ex) { margin-left: 16px; margin-right: 16px; }
  .session-prog .stack { gap: 12px; }
  .session-prog .prog-ex { border: 0; border-radius: 0; margin: 0; padding: 14px 16px; border-top: 1px solid var(--line-2); }
  .session-prog .prog-ex.done { background: #f4faf6; }
  .session-prog .prog-sets { padding-left: 10px; }
  .stat-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px; }
  .stat-row-3 .stat { padding: 12px 10px; min-width: 0; }
  .stat-row-3 .stat .label { font-size: .72rem; }
  .stat-row-3 .stat .value { font-size: 1.35rem; }
  .stat-row-3 .stat .value small { font-size: .7rem; }
  .stat-row-3 .stat svg { max-width: 100%; }
  .mob-only { display: block !important; }
  .scale.mob-only { display: grid !important; }
  /* preparedness / session RPE: all 10 on one line */
  .scale.sc-10 { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
  .scale.sc-10 .scale-opt { min-width: 0; padding: 0; height: 40px; font-size: .875rem; }
  /* load sessions: category, type, RPE and duration each on their own line */
  .sess-row1 { grid-template-columns: 1fr 40px; }
  .sess-row1 > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .sess-rpe { margin-bottom: 12px; }
  .sess-row2 { grid-template-columns: minmax(0, 1fr) 90px; }
  /* submit / cancel: full container width */
  .ci-actions { flex-direction: column-reverse; align-items: stretch; }
  .ci-actions .btn { width: 100%; height: 48px; justify-content: center; }
  /* date range: dropdown on the right, flag chips on the left */
  .range-sel { display: none; }
  .range-select { display: block; width: 116px !important; flex: none; height: 36px; padding: 0 28px 0 12px; font-weight: 600; }
  .prof-filters { flex-wrap: nowrap; align-items: flex-start; gap: 10px; padding: 12px 14px; }
  .prof-filters .flags-row { flex: 1; min-width: 0; }
  .prof-filters .flags-row .row { gap: 6px !important; }
  .prof-filters .badge { font-size: .72rem; }
  .prof-head .avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
  .prof-head h1 { font-size: 1.25rem; }
  .prof-actions .icon-btn { width: 34px; height: 34px; }
  .agenda-ev .time { width: 58px; font-size: .75rem; }
  .agenda-ev { gap: 8px; }
  .agenda-ev .btn { padding: 0 10px; }
}
/* free-text tag input: chips wrap on their own lines above a plain text box + Add,
   so adding teams never stretches the box */
.tags { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.tags > .tags-box { display: contents; }
.tags .ms-chip { order: -1; }
.tags::after { content: ""; order: -1; flex-basis: 100%; height: 0; }
.tags .tags-input { flex: 1 1 0; min-width: 0; }
.tags > .btn { height: 40px; flex: none; }
/* multi-select dropdown */
.prog-filter { max-width: 420px; margin-bottom: 16px; }
.ms { position: relative; }
.ms-trigger { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); cursor: pointer; }
.ms-trigger:hover, .ms-trigger[aria-expanded="true"] { border-color: var(--ink); }
.ms-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ms-ph { color: var(--muted); font-size: .875rem; padding-left: 6px; }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .8rem; font-weight: 500; }
.ms-x { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); }
.ms-x:hover { background: var(--line); color: var(--ink); }
.ms-x svg { width: 12px; height: 12px; }
.ms-chev { color: var(--muted); display: inline-flex; flex: none; }
.ms-chev svg { width: 16px; height: 16px; }
.ms-pop { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.modal .ms-pop { position: fixed; z-index: 120; right: auto; }
.ms-search { height: 36px; font-size: .875rem; margin-bottom: 4px; }
.ms-list { max-height: 220px; overflow-y: auto; }
.ms-opt { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; font-size: .875rem; }
.ms-opt:hover { background: var(--surface); }
.ms-box { width: 18px; height: 18px; flex: none; border: 1.5px solid var(--line); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; }
.ms-opt.sel .ms-box { background: var(--primary); border-color: var(--primary); color: #fff; }
.ms-box svg { width: 12px; height: 12px; }
.ms-add { color: var(--ink); font-weight: 600; }
.ms-add svg { width: 16px; height: 16px; }
.ms-empty { padding: 8px; }
.ms-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-2); margin-top: 4px; padding: 6px 2px 0 8px; }
/* program editor: one card per exercise, name on its own line */
.pe-row { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px; }
.pe-top { display: flex; align-items: center; gap: 8px; }
.pe-top .pnum { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; color: var(--muted); flex: none; }
.pe-top input { font-weight: 600; }
.pe-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding-left: 30px; }
.pe-fields .full { grid-column: 1 / -1; }
.pe-fields label, .ev-item-grid label { display: flex; flex-direction: column; gap: 3px; }
.pe-fields .lbl-sm { font-size: .72rem; font-weight: 600; color: var(--muted); }
.pe-fields input { height: 34px; padding: 0 10px; font-size: .875rem; }
@media (max-width: 640px) { .pe-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 0; } }
.rt { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--bg); }
.rt-bar { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.rt-bar .rt-b { font-weight: 800; font-size: .875rem; color: var(--ink); width: 28px; height: 28px; }
.rt-area { min-height: 120px; max-height: 320px; overflow-y: auto; padding: 10px 12px; font-size: .9rem; line-height: 1.5; outline: none; }
.rt-area strong, .rt-area b { font-weight: 700; }
.rt:focus-within { border-color: var(--ink); }
.prog-brief { background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--ink); border-radius: var(--radius-md); padding: 14px 16px; font-size: .9rem; line-height: 1.55; }
.prog-brief .brief-block + .brief-block { margin-top: 12px; }
.prog-brief .brief-h { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.prog-brief strong { font-weight: 700; }
.session-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .875rem; margin-top: 6px; }
.session-meta span { display: inline-flex; align-items: center; gap: 6px; }
.session-meta svg { width: 16px; height: 16px; }
.ev-prog-row.editing { align-items: flex-start; background: var(--surface-2); margin: 0 -8px; padding: 10px 8px; }
.ev-item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ev-item-grid .full { grid-column: 1 / -1; }
.ev-item-grid label { display: flex; flex-direction: column; gap: 3px; }
.ev-item-grid .lbl-sm { font-size: .72rem; font-weight: 600; color: var(--muted); }
.ev-item-grid input { height: 34px; padding: 0 10px; font-size: .875rem; }
@media (max-width: 560px) { .ev-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ev-prog-row .pnum { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; color: var(--muted); flex: none; }

/* icon sizing defaults in content */
.nav-item svg, .btn svg, .badge svg, .icon-btn svg { flex: none; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .cal-ev-t { display: none; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; justify-content: center; background: transparent; padding: 36px 20px 4px; }
  .auth-mobile-brand img { width: 184px; height: auto; }
  /* phones: one continuous light page — logo at the top, form straight underneath */
  .auth { background: var(--surface-2); grid-template-rows: auto 1fr; }
  .auth-panel { padding: 28px 20px; min-height: auto; justify-content: flex-start; padding-top: 32px; }
  .g-3 { grid-template-columns: 1fr; }
  .g-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 28px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .main > * { max-width: none; }
  .no-mobile { display: none !important; }
  .topbar .brand .sub, .topbar .brand .divline { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .athlete-switch { padding: 4px 4px 4px 8px; }
  .athlete-switch select { max-width: 96px; }
  .attn-grid { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: inline-flex; }
  h1 { font-size: 1.35rem; }
  .load-row { grid-template-columns: 1fr 70px 70px; }
  .load-row .au { grid-column: 1 / -1; text-align: left; }
  .mobile-nav {
    /* the home-indicator inset moves the pill up rather than padding it out, so it
       keeps its shape as Safari's toolbar shows and hides */
    display: flex; position: fixed; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; z-index: 40;
    background: rgba(250,250,250,.96); border: 1px solid var(--line); border-radius: 999px;
    padding: 6px; justify-content: space-around; box-shadow: var(--shadow-lg); backdrop-filter: blur(8px);
  }
  .mobile-nav .mn-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .625rem;
    font-weight: 500; color: var(--muted); padding: 6px 8px; cursor: pointer; border-radius: 999px; flex: 1;
  }
  .mobile-nav .mn-item svg { width: 18px; height: 18px; }
  .mobile-nav .mn-item.active { color: var(--ink); background: var(--accent-tint); }
  .cal-cell { min-height: 56px; padding: 5px; }
  .cal-dow { padding: 6px 2px; font-size: .625rem; }
  .cal-nav { width: 100%; justify-content: space-between; }
  .cal-nav strong { min-width: 0; }
  .cal-cell .cal-ev { display: none; }
  .cal-cell .ev-dots { display: flex; gap: 3px; flex-wrap: wrap; }
  .cal-cell .ev-dots .d { width: 6px; height: 6px; border-radius: 50%; }
}
@media (min-width: 761px) { .ev-dots { display: none; } }

.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; background: var(--bg); z-index: 46; padding: 16px 12px; box-shadow: var(--shadow-lg); overflow-y: auto; animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(-100%); } to { transform: none; } }

@media print {
  .topbar, .sidebar, .mobile-nav, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
