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

:root {
  --dark:   #080c14;
  --navy:   #0d1526;
  --card:   #111827;
  --card2:  #161f30;
  --blue:   #00c8ff;
  --blue2:  #0088dd;
  --orange: #ff5f1f;
  --green:  #00e676;
  --red:    #ff4444;
  --yellow: #ffd600;
  --text:   #e8edf5;
  --muted:  #8896a8;
  --border: rgba(0,200,255,0.12);
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --bottom-nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { font-family: 'Inter', sans-serif; background: var(--dark); color: var(--text); min-height: 100vh; }

/* ══════════════════════ AUTH ══════════════════════ */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: radial-gradient(ellipse at 30% 50%, rgba(0,136,221,0.08) 0%, transparent 70%), var(--dark); }
.auth-box { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.auth-logo { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 900; color: var(--blue); text-align: center; margin-bottom: .5rem; }
.auth-logo span { color: var(--orange); }
.auth-subtitle { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 2rem; }
.auth-tabs { display: flex; background: var(--navy); border-radius: 10px; padding: 3px; margin-bottom: 1.5rem; }
.auth-tab { flex: 1; text-align: center; padding: .6rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); transition: all .2s; }
.auth-tab.active { background: var(--blue2); color: white; }
.auth-pay-notice { margin-top: 1.5rem; text-align: center; padding: 1rem; background: rgba(0,230,118,0.06); border: 1px solid rgba(0,230,118,0.15); border-radius: 8px; }
.auth-pay-status { font-size: .8rem; color: var(--green); font-weight: 600; }
.auth-pay-sub { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.auth-pay-btn { display: inline-block; margin-top: .5rem; background: var(--orange); color: white; padding: .4rem 1rem; border-radius: 6px; font-size: .8rem; font-weight: 700; text-decoration: none; }

/* ══════════════════════ FORMS ══════════════════════ */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
input, select, textarea { width: 100%; background: var(--navy); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; color: var(--text); font-size: .95rem; font-family: 'Inter', sans-serif; transition: border-color .2s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[type="checkbox"] { width: auto; margin-right: .5rem; }
select option { background: var(--navy); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.info-box { background: rgba(0,200,255,0.05); border: 1px solid var(--border); border-radius: 8px; padding: .9rem 1rem; font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ══════════════════════ BUTTONS ══════════════════════ */
.btn { display: inline-flex; align-items: center; gap: .5rem; justify-content: center; padding: .75rem 1.5rem; border-radius: 8px; border: none; cursor: pointer; font-size: .9rem; font-weight: 600; font-family: 'Inter', sans-serif; transition: all .2s; text-decoration: none; }
.btn-blue   { background: var(--blue2); color: white; }
.btn-blue:hover { background: var(--blue); transform: translateY(-1px); }
.btn-orange { background: var(--orange); color: white; box-shadow: 0 0 20px rgba(255,95,31,0.3); }
.btn-orange:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(255,95,31,0.5); }
.btn-ghost  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: rgba(255,68,68,0.15); border: 1px solid rgba(255,68,68,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(255,68,68,0.25); }
.btn-green  { background: rgba(0,230,118,0.15); border: 1px solid rgba(0,230,118,0.3); color: var(--green); }
.btn-green:hover { background: rgba(0,230,118,0.25); }
.btn-sm  { padding: .4rem .9rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn-google { width: 100%; background: white; color: #333; border: 1px solid #ddd; padding: .75rem; border-radius: 8px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .75rem; font-size: .95rem; transition: all .2s; margin-top: .75rem; }
.btn-google:hover { background: #f5f5f5; }
.divider { text-align: center; color: var(--muted); font-size: .8rem; margin: 1rem 0; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.divider::before { left: 0; } .divider::after { right: 0; }

/* ══════════════════════ APP LAYOUT ══════════════════════ */
.app-layout { display: flex; min-height: 100vh; position: relative; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 200;
  overflow-y: auto;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar-logo { padding: 1.25rem 1.5rem; font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; font-weight: 900; color: var(--blue); flex-shrink: 0; }
.sidebar-logo span { color: var(--orange); }
.sidebar-user { padding: .5rem 1.5rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; color: white; flex-shrink: 0; }
.user-name  { font-weight: 600; font-size: .88rem; }
.user-email { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.nav-section { padding: .75rem 0; }
.nav-section-title { padding: .25rem 1.5rem; font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.5rem; color: var(--muted); cursor: pointer; transition: all .2s; font-size: .88rem; font-weight: 500; border-left: 3px solid transparent; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav-item.active { color: var(--blue); background: rgba(0,200,255,0.06); border-left-color: var(--blue); }
.nav-item .icon { font-size: 1.05rem; min-width: 20px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding: 1rem; border-top: 1px solid var(--border); }
.sidebar-pay-link { display: block; margin-top: .75rem; text-align: center; color: var(--orange); font-size: .78rem; font-weight: 600; text-decoration: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 190; backdrop-filter: blur(2px); }

/* APP RIGHT COLUMN */
.app-right { margin-left: var(--sidebar-w); flex: 1; min-width: 0; overflow-x: hidden; display: flex; flex-direction: column; min-height: 100vh; }

/* ══════════════════════ TOPBAR ══════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(13,21,38,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; }
.topbar-logo { font-family: 'Barlow Condensed', sans-serif; font-size: 1.4rem; font-weight: 900; color: var(--blue); display: none; /* hidden desktop, shown mobile */ }
.topbar-logo span { color: var(--orange); }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: .4rem; flex-direction: column; gap: 5px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all .2s; }

/* PMC PILLS — always visible in topbar */
.pmc-pills { display: flex; gap: .5rem; flex: 1; justify-content: center; }
.pmc-pill {
  display: flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .3rem .7rem;
  cursor: default;
  transition: border-color .2s;
  min-width: 80px;
}
.pmc-pill:hover { border-color: rgba(0,200,255,0.3); }
.pill-label { font-size: .62rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--muted); min-width: 24px; }
.pill-value { font-family: 'Barlow Condensed', sans-serif; font-size: 1.25rem; font-weight: 900; line-height: 1; min-width: 30px; text-align: right; }
.pill-sub { font-size: .6rem; color: var(--muted); display: none; /* shown on wider screens */ }
.pmc-pill-ctl .pill-value { color: var(--blue); }
.pmc-pill-atl .pill-value { color: var(--orange); }
.pmc-pill-tss .pill-value { color: var(--muted); }
/* TSB color changes dynamically via JS class */
.pmc-pill-tsb.form-good  .pill-value { color: var(--green); }
.pmc-pill-tsb.form-warn  .pill-value { color: var(--yellow); }
.pmc-pill-tsb.form-tired .pill-value { color: var(--orange); }
.pmc-pill-tsb.form-over  .pill-value { color: var(--red); }
.pmc-pill-tsb            .pill-value { color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.topbar-date { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.user-avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: var(--blue2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: white; cursor: pointer; flex-shrink: 0; }

/* ══════════════════════ MAIN CONTENT ══════════════════════ */
.main-content { flex: 1; padding: 2rem; min-width: 0; overflow-x: hidden; }
.page { display: none; max-width: 100%; box-sizing: border-box; }
.page.active { display: block; }

/* PAGE HEADERS */
.page-header { margin-bottom: 2rem; }
.page-title { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 900; text-transform: uppercase; }
.page-title .accent { color: var(--blue); }
.page-subtitle { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* CARDS */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; min-width: 0; }
.card-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1.05rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 1rem; color: var(--blue); }

/* GRIDS */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; min-width: 0; }

/* STAT CARDS */
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.stat-card .s-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.stat-card .s-value { font-family: 'Barlow Condensed', sans-serif; font-size: 2.2rem; font-weight: 900; margin: .3rem 0; }
.stat-card .s-sub { font-size: .75rem; color: var(--muted); }
.stat-card.blue   .s-value { color: var(--blue); }
.stat-card.orange .s-value { color: var(--orange); }
.stat-card.green  .s-value { color: var(--green); }
.stat-card.red    .s-value { color: var(--red); }

/* PMC CHART */
.pmc-container { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem; }
.pmc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .5rem; }
#pmcChart { width: 100%; height: 200px; }

/* WORKOUT CARDS */
.workout-list { display: flex; flex-direction: column; gap: .75rem; }
.workout-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; transition: all .2s; cursor: pointer; }
.workout-card:hover { border-color: rgba(0,200,255,0.25); }
.workout-card.completed { border-left: 3px solid var(--green); opacity: .8; }
.workout-card.today { border-left: 3px solid var(--blue); }
.wc-sport-icon { font-size: 1.8rem; min-width: 40px; text-align: center; }
.wc-info { flex: 1; min-width: 0; }
.wc-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-meta  { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.wc-badges { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 4px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.badge-blue   { background: rgba(0,200,255,0.12); color: var(--blue); }
.badge-orange { background: rgba(255,95,31,0.12); color: var(--orange); }
.badge-green  { background: rgba(0,230,118,0.12); color: var(--green); }
.badge-muted  { background: rgba(136,150,168,0.12); color: var(--muted); }
.wc-tss { text-align: right; flex-shrink: 0; }
.wc-tss .tss-num { font-family: 'Barlow Condensed', sans-serif; font-size: 1.5rem; font-weight: 900; color: var(--blue); }
.wc-tss .tss-label { font-size: .65rem; color: var(--muted); text-transform: uppercase; }
.wc-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ZONES */
.zones-table { width: 100%; border-collapse: collapse; }
.zones-table th { padding: .6rem 1rem; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.zones-table td { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: .9rem; }
.zones-table tr:last-child td { border-bottom: none; }
.zone-bar { height: 6px; border-radius: 3px; display: inline-block; min-width: 40px; }
.z1{background:#6ec6ff}.z2{background:#00c8ff}.z3{background:#00e676}.z4{background:#ffd600}.z5{background:#ff9800}.z6{background:#ff5f1f}.z7{background:#ff1744}

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 80px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1.4rem; font-weight: 900; text-transform: uppercase; color: var(--blue); }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.5rem; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* DAYS SELECTOR */
.days-selector { display: flex; gap: .5rem; flex-wrap: wrap; }
.day-btn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .85rem; transition: all .2s; font-family: 'Inter', sans-serif; }
.day-btn.selected { background: var(--blue2); border-color: var(--blue); color: white; }
.day-btn:hover:not(.selected) { border-color: var(--blue); color: var(--blue); }

/* WEEK TABS */
.week-nav { display: flex; gap: .5rem; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: .5rem; }
.week-tab { padding: .5rem 1.2rem; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-size: .85rem; font-weight: 600; white-space: nowrap; transition: all .2s; font-family: 'Inter', sans-serif; }
.week-tab.active { background: var(--blue2); border-color: var(--blue); color: white; }
.week-tab:hover:not(.active) { border-color: var(--blue); color: var(--blue); }

/* WEEKS SELECTOR */
.weeks-selector { display: flex; gap: 1rem; margin: 1rem 0; }
.week-opt { flex: 1; text-align: center; padding: 1.25rem; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; transition: all .2s; }
.week-opt:hover { border-color: var(--blue); }
.week-opt.selected { border-color: var(--blue); background: rgba(0,200,255,0.08); }
.week-opt .w-num { font-family: 'Barlow Condensed', sans-serif; font-size: 2.5rem; font-weight: 900; color: var(--blue); }
.week-opt .w-label { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* NUTRITION */
.nutrition-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.meal-card { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.meal-type { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--blue); font-weight: 600; margin-bottom: .3rem; }
.meal-name { font-weight: 700; font-size: 1rem; margin-bottom: .5rem; }
.meal-desc { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; line-height: 1.5; }
.meal-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: .5rem; }
.meal-price { color: var(--green); font-weight: 700; }

/* QA */
.qa-container { max-width: 800px; }
.qa-messages { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; max-height: 500px; overflow-y: auto; }
.qa-msg { padding: 1rem 1.25rem; border-radius: 12px; max-width: 85%; line-height: 1.6; font-size: .9rem; }
.qa-msg.user { background: rgba(0,136,221,0.15); border: 1px solid rgba(0,136,221,0.2); align-self: flex-end; }
.qa-msg.ai   { background: var(--card2); border: 1px solid var(--border); align-self: flex-start; }
.qa-input-row { display: flex; gap: 1rem; }
.qa-input-row input { flex: 1; }

/* ADMIN */
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 600px; }
.admin-table th { padding: .75rem 1rem; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.prompt-textarea { min-height: 400px; font-family: monospace; font-size: .82rem; line-height: 1.6; }

/* RACE PRIORITY */
.priority-a { background: rgba(255,95,31,0.15); color: var(--orange); border: 1px solid rgba(255,95,31,0.3); padding: .2rem .7rem; border-radius: 4px; font-size: .75rem; font-weight: 700; }
.priority-b { background: rgba(136,150,168,0.15); color: var(--muted); border: 1px solid rgba(136,150,168,0.2); padding: .2rem .7rem; border-radius: 4px; font-size: .75rem; font-weight: 700; }

/* TOAST */
.toast-container { position: fixed; top: 5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .75rem; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1.2rem; font-size: .9rem; display: flex; align-items: center; gap: .75rem; box-shadow: 0 8px 30px rgba(0,0,0,0.4); animation: slideIn .3s ease; max-width: 320px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* LOADING / EMPTY */
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; gap: 1rem; color: var(--muted); }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }

/* ══════════════════════ BOTTOM NAV (MOBILE) ══════════════════════ */
.bottom-nav {
  display: none; /* hidden desktop */
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: rgba(13,21,38,0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 150;
  padding: 0 .25rem;
  padding-bottom: env(safe-area-inset-bottom);
  display: none;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: .5rem .25rem; background: none; border: none;
  cursor: pointer; color: var(--muted); transition: color .2s;
  font-family: 'Inter', sans-serif; border-radius: 8px;
}
.bnav-item:active { background: rgba(255,255,255,0.05); }
.bnav-item.active { color: var(--blue); }
.bnav-icon  { font-size: 1.35rem; line-height: 1; }
.bnav-label { font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ══════════════════════ WEEKLY BRIEF ══════════════════════ */
.brief-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem 2rem; position: relative; overflow: hidden; }
.brief-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--blue), var(--orange), var(--green)); }
.brief-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.brief-header-left { display: flex; flex-direction: column; gap: .4rem; }
.brief-week-label { font-size: .7rem; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); font-weight: 600; }
.brief-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1.7rem; font-weight: 900; text-transform: uppercase; line-height: 1; }
.brief-badges { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .3rem; }
.brief-phase { display: inline-block; padding: .25rem .8rem; border-radius: 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.phase-base    { background: rgba(0,200,255,0.12); color: var(--blue); }
.phase-build   { background: rgba(255,95,31,0.12); color: var(--orange); }
.phase-pico    { background: rgba(255,214,0,0.12); color: var(--yellow); }
.phase-carrera { background: rgba(0,230,118,0.12); color: var(--green); }
.phase-descarga{ background: rgba(136,150,168,0.12); color: var(--muted); }
.phase-transición { background: rgba(136,150,168,0.12); color: var(--muted); }
.brief-race-badge { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,95,31,0.1); border: 1px solid rgba(255,95,31,0.25); border-radius: 4px; padding: .25rem .75rem; font-size: .72rem; font-weight: 700; color: var(--orange); }
.brief-tss-badge  { display: inline-flex; align-items: center; gap: .4rem; background: rgba(0,200,255,0.08); border: 1px solid var(--border); border-radius: 4px; padding: .25rem .75rem; font-size: .72rem; font-weight: 600; color: var(--blue); }
.brief-refresh { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; font-size: .75rem; padding: .35rem .75rem; white-space: nowrap; transition: all .2s; font-family: 'Inter', sans-serif; }
.brief-refresh:hover { border-color: var(--blue); color: var(--blue); }
.brief-goal { background: rgba(0,200,255,0.05); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; padding: .85rem 1.1rem; margin-bottom: 1.25rem; font-size: .92rem; font-weight: 500; }
.brief-goal .goal-label { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--blue); font-weight: 700; margin-bottom: .3rem; }
.brief-body { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: start; }
.brief-message { font-size: .92rem; color: var(--text); line-height: 1.75; margin-bottom: 1.25rem; }
.brief-focus { display: flex; flex-direction: column; gap: .5rem; min-width: 190px; }
.focus-title { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; margin-bottom: .2rem; }
.focus-item { display: flex; align-items: center; gap: .6rem; font-size: .82rem; background: var(--card2); border-radius: 6px; padding: .5rem .75rem; }
.focus-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.brief-alert { background: rgba(255,214,0,0.07); border: 1px solid rgba(255,214,0,0.2); border-radius: 8px; padding: .75rem 1rem; font-size: .85rem; color: var(--yellow); margin-bottom: 1.1rem; display: flex; gap: .6rem; }
.brief-race-context { background: rgba(255,95,31,0.05); border: 1px solid rgba(255,95,31,0.15); border-radius: 8px; padding: .75rem 1rem; font-size: .85rem; margin-bottom: 1.1rem; }
.brief-race-context .rc-label { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--orange); font-weight: 700; margin-bottom: .3rem; }
.brief-motivation { font-style: italic; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }

/* ══════════════════════ WIDER SCREENS: show pill labels ══════════════════════ */
@media (min-width: 1100px) {
  .pill-sub { display: block; }
  .pmc-pill { min-width: 90px; flex-direction: column; align-items: flex-start; padding: .4rem .85rem; gap: 0; }
  .pill-label { margin-bottom: 0; }
  .pill-value { font-size: 1.4rem; }
}

/* ══════════════════════ MOBILE ══════════════════════ */
@media (max-width: 768px) {
  /* Sidebar hidden offscreen, slides in */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* No left margin on mobile */
  .app-right { margin-left: 0; padding-bottom: var(--bottom-nav-h); }

  /* Show hamburger + logo in topbar */
  .hamburger { display: flex; }
  .topbar-logo { display: block; }
  .topbar { padding: 0 1rem; gap: .5rem; }
  .topbar-date { display: none; }

  /* PMC pills — compact on mobile */
  .pmc-pills { gap: .35rem; }
  .pmc-pill { min-width: unset; padding: .3rem .5rem; }
  .pill-label { font-size: .58rem; min-width: unset; }
  .pill-value { font-size: 1.05rem; min-width: unset; }
  .pmc-pill-tss { display: none; } /* hide TSS pill on very small screens */

  /* Show bottom nav */
  .bottom-nav { display: grid; }

  /* Content padding */
  .main-content { padding: 1.25rem 1rem; }

  /* Grids collapse */
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .brief-body { grid-template-columns: 1fr; }
  .brief-focus { flex-direction: row; flex-wrap: wrap; min-width: unset; }
  .brief-card { padding: 1.25rem; }
  .weeks-selector { gap: .5rem; }

  /* Modals full screen on mobile */
  .modal { max-height: 85vh; border-radius: 16px 16px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; margin: 0; border-bottom: none; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

@media (max-width: 400px) {
  .pmc-pill-atl { display: none; } /* ultra small: only CTL + TSB */
}

/* ── CYCLING SPECIALTY CHIPS ── */
.spec-opt {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--card2);
  color: var(--muted); cursor: pointer; font-size: .82rem;
  font-family: 'Inter', sans-serif; font-weight: 500;
  transition: all .15s; user-select: none;
}
.spec-opt:hover  { border-color: var(--blue); color: var(--text); }
.spec-opt.active { border-color: var(--blue); background: rgba(0,200,255,0.1); color: var(--blue); font-weight: 600; }

/* ── CYCLING SPECIALTY — native checkbox chips ── */
.cyc-spec-label {
  display: inline-flex; align-items: center;
  padding: .42rem .95rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--card2);
  color: var(--muted); cursor: pointer; font-size: .82rem;
  font-family: 'Inter', sans-serif; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
  user-select: none; gap: .4rem;
}
.cyc-spec-label:hover {
  border-color: var(--blue); color: var(--text);
}
.cyc-spec-label input.cyc-spec-cb {
  /* Visually hidden but fully functional — !important overrides global input[type=checkbox] rule */
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  /* Do NOT set pointer-events:none — the label click must reach the input */
}
.cyc-spec-label:has(input.cyc-spec-cb:checked),
.cyc-spec-label.active {
  border-color: var(--blue);
  background: rgba(0, 200, 255, 0.12);
  color: var(--blue);
  font-weight: 600;
}
