/* ============================================================================
   /app — the logged-in coach area
   ----------------------------------------------------------------------------
   Tokens come from /shared/theme.css. Nothing here invents a colour, a radius
   or a font — /app must read as the same product as the hub and soccer.html.
   Layout: fixed 244px sidebar + fluid main. Below 900px the sidebar becomes a
   slide-over drawer and a bottom tab bar takes over primary navigation.
   ========================================================================== */

:root {
  --app-sidebar:   244px;
  --app-topbar:    68px;
  --app-tabbar:    74px;
  --app-gutter:    32px;
  --sidebar-bg:    #0c160c;
}

body.kq-app {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.kq-app * { box-sizing: border-box; }
/* Anchors carry no colour of their own. Nearly every link here IS a
   component — a button, a tab, a table row, a nav item — and a blanket
   `body.kq-app a { color: … }` rule (specificity 0,1,2) silently beat every
   one of those single-class rules: primary buttons ended up yellow-on-yellow.
   Keep this at the lowest possible specificity and let components decide. */
a { color: inherit; text-decoration: none; }
.link { color: var(--accent); text-decoration: underline; }
.link:hover { color: var(--accent-dark); }
.report-text a { color: var(--accent); text-decoration: underline; }
.ic { flex-shrink: 0; }
.u  { font-size: .62em; }
.sm { font-size: 12px; }
.muted { color: var(--text-muted); }
.disp {
  font-family: var(--font-display);
  letter-spacing: .04em;
  font-weight: 400;
}

/* ── Shell ─────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.app-side {
  width: var(--app-sidebar);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1.5px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-side-logo { padding: 0 6px 22px; display: block; }
.app-side-logo img { width: 164px; height: auto; display: block; }

.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  background: none; border: none; width: 100%; text-align: left;
  font-family: var(--font-body); cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.on { background: rgba(232,245,49,.10); color: var(--accent); font-weight: 700; }

.side-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 12px 9px;
}
.side-teams { display: flex; flex-direction: column; gap: 2px; }
.team-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: none; border: none; width: 100%; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--text-muted); text-align: left;
}
.team-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.team-link.on { background: rgba(232,245,49,.10); color: var(--accent); font-weight: 700; }
.team-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.18); flex-shrink: 0; }
.team-link.on .team-dot { background: var(--accent); }
.team-name { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-fmt { font-size: 10px; font-weight: 700; opacity: .8; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.plan-card {
  background: rgba(232,245,49,.07);
  border: 1px solid rgba(232,245,49,.22);
  border-radius: 12px; padding: 12px 13px;
}
.plan-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.plan-name { font-family: var(--font-display); font-size: 16px; color: var(--accent); letter-spacing: .04em; }
.plan-slots { font-size: 11px; color: var(--text-muted); }
.plan-bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,.10); overflow: hidden; }
.plan-bar i { display: block; height: 100%; background: var(--accent); }
.plan-link {
  font-size: 11px; color: var(--text-muted); margin-top: 9px;
  background: none; border: none; padding: 0; cursor: pointer; font-family: var(--font-body);
}
.plan-link:hover { color: var(--accent); }

.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(232,245,49,.16); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.side-user-meta { flex-grow: 1; min-width: 0; }
.side-user-name { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-sub  { font-size: 10px; color: var(--text-muted); }
.side-signout {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex;
}
.side-signout:hover { color: var(--red); background: rgba(255,255,255,.04); }

/* ── Main column ───────────────────────────────────────────────────────── */
.app-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

.app-top {
  min-height: var(--app-topbar);
  flex-shrink: 0;
  border-bottom: 1.5px solid var(--card-border);
  background: rgba(10,20,10,.92);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px var(--app-gutter);
  position: sticky; top: 0; z-index: 40;
}
.top-left  { min-width: 0; display: flex; align-items: center; gap: 12px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.top-title { font-family: var(--font-display); font-size: 26px; color: var(--text); line-height: 1.1; letter-spacing: .04em; }
.top-sub   { font-size: 12px; color: var(--text-muted); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); min-width: 0; flex-wrap: wrap; }
.crumbs a, .crumbs button {
  color: var(--text-muted); background: none; border: none; padding: 0;
  font: inherit; cursor: pointer;
}
.crumbs a:hover, .crumbs button:hover { color: var(--text); }
.crumbs .here { color: var(--text); font-weight: 600; }
.burger { display: none; }

.app-view { padding: 26px var(--app-gutter) 44px; display: flex; flex-direction: column; gap: 22px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.b {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  padding: 11px 18px; min-height: 42px;
  border: 1.5px solid var(--card-border);
  background: rgba(255,255,255,.05); color: var(--text);
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.b:hover { border-color: var(--accent); color: var(--accent); }
a.b, a.b:hover { text-decoration: none; }
.b-y { background: var(--accent); color: #1a2e10; border-color: var(--accent); }
.b-y:hover { filter: brightness(1.08); background: var(--accent); color: #1a2e10; border-color: var(--accent); }
.b-sm { padding: 8px 13px; min-height: 36px; font-size: 12px; }
.b-icon { padding: 9px; min-width: 38px; }
.b-quiet { font-weight: 500; color: var(--text-muted); }

/* ── Cards / grid ──────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card-accent { border-color: rgba(232,245,49,.28); }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.g-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
.col { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex-grow: 1; min-width: 0; }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-title { font-family: var(--font-display); font-size: 22px; letter-spacing: .04em; color: var(--text); }
.sec-right { font-size: 12px; color: var(--text-muted); }
.card-title { font-family: var(--font-display); font-size: 19px; letter-spacing: .04em; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--accent); }
.lbl { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.lbl-a { color: var(--accent); }

/* ── KPI ───────────────────────────────────────────────────────────────── */
.kpi { background: var(--card); border: 1.5px solid var(--card-border); border-radius: var(--radius); padding: 15px 17px; }
.kpi-val { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--accent); letter-spacing: .02em; }
.kpi-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 5px; }
.kpi-flat { background: rgba(255,255,255,.04); border: none; border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; }
.kpi-flat .kpi-val { font-size: 24px; }
.kpi-val small { font-size: 12px; color: var(--text-muted); }

/* ── Result chips / pills ──────────────────────────────────────────────── */
.res {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.res-lg { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
.res.w { background: rgba(76,175,80,.18);  color: var(--green); }
.res.d { background: rgba(255,152,0,.18);  color: var(--orange); }
.res.l { background: rgba(255,87,34,.18);  color: var(--red); }
.ribbon { display: inline-flex; gap: 5px; }
.pill {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: rgba(232,245,49,.10);
  border: 1px solid rgba(232,245,49,.30); border-radius: 20px; padding: 2px 9px;
  white-space: nowrap;
}
.pill-ok   { color: var(--green);  background: rgba(76,175,80,.12);  border-color: rgba(76,175,80,.35); }
.pill-warn { color: var(--orange); background: rgba(255,152,0,.12);  border-color: rgba(255,152,0,.35); }
.pill-dim  { color: var(--text-muted); background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.10); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--card-border); overflow-x: auto; }
.tab {
  padding: 11px 16px; border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; min-width: 640px; }
table.t th {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); text-align: left; padding: 0 8px 10px 0; white-space: nowrap;
}
table.t td {
  font-size: 13px; color: var(--text); padding: 11px 8px 11px 0;
  border-top: 1px solid rgba(255,255,255,.06); white-space: nowrap;
}
/* Right-aligned columns had no left padding, so two of them collided as soon
   as a label outgrew its width hint: Spanish printed "TENDENCIAPUNTUACION"
   as one word. The gutter goes on the left so the last column stays flush. */
table.t th.r, table.t td.r { text-align: right; padding-right: 0; padding-left: 10px; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: rgba(255,255,255,.03); }
table.t tbody tr.static { cursor: default; }
table.t tbody tr.static:hover td { background: none; }
.t-name { font-weight: 600; }
.t-score { font-family: var(--font-display); font-size: 22px; color: var(--accent); letter-spacing: .02em; }
.t-score.dim { color: var(--text-muted); }

/* ── Lists ─────────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid rgba(255,255,255,.06);
  background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; cursor: pointer; font-family: var(--font-body); color: var(--text); text-align: left;
}
.list-row:first-child { border-top: none; }
.list-row:hover { background: rgba(255,255,255,.03); }
.list-main { font-size: 13px; font-weight: 600; }
.list-sub  { font-size: 11px; color: var(--text-muted); }
.list-score { font-size: 12px; font-weight: 700; color: var(--accent); }
.list-score.dim { color: var(--text-muted); }
.list-date { width: 64px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); }

.alert-row { display: flex; gap: 11px; align-items: flex-start; padding: 0 0 13px; border-bottom: 1px solid rgba(255,255,255,.06); }
.alert-row:last-child { padding-bottom: 0; border-bottom: none; }
.alert-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-dot.warn   { background: var(--orange); }
.alert-dot.danger { background: var(--red); }
.alert-dot.info   { background: var(--blue); }
.alert-title { font-size: 13px; font-weight: 600; color: var(--text); }
.alert-body  { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

.quote {
  font-size: 13px; color: var(--text); line-height: 1.55;
  border-left: 2px solid rgba(232,245,49,.45); padding-left: 12px;
}
.report-text { font-size: 13.5px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.report-text h1, .report-text h2, .report-text h3 { font-family: var(--font-display); font-size: 18px; letter-spacing: .04em; margin: 16px 0 6px; color: var(--accent); }
.report-text strong { color: var(--text); font-weight: 700; }

/* ── Hero (last match) ─────────────────────────────────────────────────── */
.hero-last {
  background: linear-gradient(120deg, #14210f 0%, var(--card) 62%);
  border-color: rgba(232,245,49,.32);
  display: flex; flex-direction: column; gap: 16px;
}
.hero-score { font-family: var(--font-display); font-size: 32px; color: var(--text); line-height: 1.05; letter-spacing: .04em; }
.hero-score .sc { color: var(--accent); }
.hero-meta { display: flex; align-items: center; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.hero-meta span { display: flex; align-items: center; gap: 6px; }
.hero-stats { display: flex; gap: 10px; border-top: 1px solid var(--card-border); padding-top: 14px; flex-wrap: wrap; }
.hero-stats > div { flex-grow: 1; min-width: 92px; }
.hero-stats .kpi-val { font-size: 26px; }

/* ── Charts ────────────────────────────────────────────────────────────── */
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.chart .ax { fill: var(--text-muted); font-family: var(--font-body); font-size: 10px; }
.chart .ax-on { fill: var(--text); font-weight: 600; }
.chart .ax-dim { fill: var(--text-muted); opacity: .7; font-size: 9px; }
.chart .bar { fill: rgba(59,139,212,.55); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--accent); }
.chart-empty { color: var(--text-muted); font-size: 13px; padding: 28px 0; text-align: center; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.spark { vertical-align: middle; }

.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-lbl { width: 120px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.bar-track { flex-grow: 1; height: 12px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; }
.bar-val { width: 48px; text-align: right; font-size: 13px; font-weight: 600; }

.periods { display: flex; flex-direction: column; gap: 5px; }
.period-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.period-row { display: flex; gap: 4px; height: 30px; }
.period-cell {
  flex-grow: 1; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text);
}
.period-labels { display: flex; gap: 4px; font-size: 10px; color: var(--text-muted); }
.period-labels span { flex-grow: 1; text-align: center; }

.pips { display: flex; gap: 6px; }
.pip { flex-grow: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.10); }
.pip.on { background: var(--green); }

/* ── Empty / loading ───────────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-ic { color: var(--text-muted); opacity: .5; margin-bottom: 12px; }
.empty-title { font-family: var(--font-display); font-size: 22px; letter-spacing: .04em; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; max-width: 420px; margin: 0 auto 18px; line-height: 1.5; }
.skeleton { display: flex; flex-direction: column; gap: 16px; }
.sk {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 37%, rgba(255,255,255,.04) 63%);
  background-size: 400% 100%;
  animation: skShine 1.3s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes skShine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── Language picker (top bar) ─────────────────────────────────────────── */
.lang-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px 0 11px; min-height: 42px;
  border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05); color: var(--text-muted);
  cursor: pointer;
}
.lang-pick:hover { border-color: var(--accent); color: var(--accent); }
.lang-pick select {
  appearance: none; -webkit-appearance: none;
  background: none; border: none; outline: none; cursor: pointer;
  color: inherit; font-family: var(--font-body); font-size: 12px; font-weight: 700;
  padding: 0 2px 0 0; letter-spacing: .04em;
}
.lang-pick select option { background: var(--card); color: var(--text); }

/* ── Guide (slide-over) ────────────────────────────────────────────────── */
.guide {
  position: fixed; top: 0; right: 0; z-index: 70;
  width: min(520px, 100%); height: 100vh;
  background: var(--card); border-left: 1.5px solid var(--card-border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transform: translateX(103%);
  transition: transform .24s ease;
  outline: none;
}
body.guide-open .guide { transform: translateX(0); }
.guide-scrim { position: fixed; inset: 0; z-index: 65; background: var(--overlay); display: none; }
body.guide-open .guide-scrim { display: block; }
.guide-head {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px;
  border-bottom: 1.5px solid var(--card-border);
}
.guide-body {
  flex-grow: 1; min-height: 0; overflow-y: auto;
  padding: 20px 22px calc(40px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 20px;
  -webkit-overflow-scrolling: touch;
}
.guide-intro { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.guide-sec { display: flex; flex-direction: column; gap: 8px; }
.guide-sec-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 18px; letter-spacing: .04em; color: var(--text);
}
.guide-sec-head .ic { color: var(--accent); }
.guide-sec p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.guide-sec p b { color: var(--text); font-weight: 700; }
.guide-score {
  background: rgba(232,245,49,.05);
  border: 1px solid rgba(232,245,49,.22);
  border-radius: var(--radius); padding: 16px 18px;
}
.guide-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.guide-list li { font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.guide-list li b { color: var(--text); font-weight: 700; }

/* ── First-run onboarding ──────────────────────────────────────────────── */
.ob { display: flex; flex-direction: column; gap: 26px; padding: 32px 34px; }
.ob-head { max-width: 64ch; }
.ob-title { font-family: var(--font-display); font-size: 34px; letter-spacing: .04em; color: var(--text); margin: 0 0 10px; line-height: 1.1; }
.ob-lead { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-muted); }
.ob-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.ob-step { display: flex; gap: 14px; align-items: flex-start; }
.ob-num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  background: rgba(232,245,49,.12); color: var(--accent);
  border: 1px solid rgba(232,245,49,.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px;
}
.ob-step-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.ob-step-body { font-size: 13px; line-height: 1.55; color: var(--text-muted); }
.ob-cta { align-self: flex-start; padding: 14px 26px; font-size: 15px; }

/* ── Mobile ────────────────────────────────────────────────────────────── */
.app-tabbar { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  :root { --app-gutter: 16px; }

  .app-side {
    position: fixed; top: 0; left: 0; z-index: 60;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  body.drawer-open .app-side { transform: translateX(0); }
  body.drawer-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: var(--overlay);
  }
  .burger { display: inline-flex; }
  .app-view { padding-bottom: calc(var(--app-tabbar) + 28px + env(safe-area-inset-bottom, 0px)); }

  .g-main, .g-2, .g-3, .g-4, .g-5, .g-6, .g-hero { grid-template-columns: minmax(0, 1fr); }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-title { font-size: 22px; }
  .hero-score { font-size: 24px; }
  .sec-title { font-size: 19px; }

  .app-tabbar {
    display: flex; align-items: flex-start;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(var(--app-tabbar) + env(safe-area-inset-bottom, 0px));
    padding: 8px 8px env(safe-area-inset-bottom, 0px);
    background: rgba(10,20,10,.97);
    border-top: 1.5px solid var(--card-border);
    backdrop-filter: blur(16px);
  }
  .tabbar-item {
    flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 52px; border: none; background: none; cursor: pointer;
    color: var(--text-muted); font-family: var(--font-body); font-size: 10px; font-weight: 600;
  }
  .tabbar-item.on { color: var(--accent); }
  .tabbar-fab {
    width: 50px; height: 50px; border-radius: 16px;
    background: var(--accent); color: #1a2e10;
    display: flex; align-items: center; justify-content: center;
    margin-top: -16px; box-shadow: 0 6px 18px rgba(232,245,49,.22);
  }
  /* Four inline stats in a team card do not fit 390px at full size. */
  .kpi-flat .kpi-val { font-size: 20px; }
  .kpi-flat .kpi-lbl { font-size: 9px; letter-spacing: .04em; }
  .kpi-flat { padding: 9px 5px; }
  .b { min-height: 44px; }
  .b-sm { min-height: 40px; }
  .bar-lbl { width: 90px; }
  .guide { width: 100%; border-left: none; }
  .ob { padding: 24px 20px; gap: 22px; }
  .ob-title { font-size: 27px; }
  .ob-steps { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ob-cta { width: 100%; }
}

@media (max-width: 560px) {
  .hero-stats > div { min-width: 0; flex-basis: 45%; }
  .app-top { flex-wrap: wrap; row-gap: 10px; }
  .top-left, .top-right { flex-basis: 100%; }
  .top-right { justify-content: flex-start; }
  .top-right .b { flex-grow: 1; }
  /* Secondary columns in the long tables. The score is the column the
     coach came for, so it must survive on a phone. */
  table.t { min-width: 0; }
  table.t .hide-sm { display: none; }
}
