/* ExtraClub · sistema de diseño (docs/design/design-system.md)
   Sin JS, sin estilos en línea, sin recursos externos: compatible con la CSP `default-src 'self'`. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Identidad: azul→cian (dinámico, moderno). El degradado es decorativo; el color de acción
     es un azul más profundo para cumplir contraste AA con texto blanco. */
  --sky: #369afe;
  --cyan: #00fff8;
  --grad-brand: linear-gradient(135deg, #369afe 0%, #00fff8 100%);
  --grad-ai: linear-gradient(135deg, #ff7cb1 0%, #0068ff 100%); /* reservado a funciones de IA */
  --ink-950: #0a1f44;
  --ink-900: #10284f;
  --ink-600: #47597c;
  --ink-400: #7b8bab;
  --line: #e0eaf8;
  --canvas: #f1f7ff;
  --surface: #fff;
  --brand: #0b63e5;
  --brand-600: #084fbc;
  --brand-50: #eaf3ff;
  --brand-ink: #fff;
  --accent: #f5a524;
  --accent-50: #fff3d6;
  --ok: #0f7a4d;
  --ok-50: #e4f6ed;
  --warn: #9a5b00;
  --warn-50: #fff3d6;
  --bad: #b42318;
  --bad-50: #fde9e7;
  --info: #175cd3;
  --info-50: #e6f0fe;
  --violet: #6d3fd6;
  --violet-50: #f0e9fd;
  --r-ctl: 12px;
  --r-card: 16px;
  --r-hero: 24px;
  --shadow: 0 1px 2px rgba(10, 31, 68, .04), 0 8px 24px rgba(11, 99, 229, .07);
  --sidebar: 248px;
  /* Superficies y detalles que antes eran colores fijos (para poder tematizar) */
  --surface-2: #f6faff;
  --ctl-line: #c5d6ee;
  --ctl-line-hover: #9db7dc;
  --dash: #bcd3f5;
  --neutral-chip: #edf0f7;
  --field-bg: #fff;
  --grad-bg: linear-gradient(180deg, #f1f7ff 0%, #fff 60%);
  --grad-soft: linear-gradient(135deg, #dcecff 0%, #d4fffd 100%);
  --grad-soft-2: linear-gradient(135deg, #f1f7ff, #e6fffe);
  --grad-chip: linear-gradient(135deg, #e3f0ff, #dcfffe);
  --soft-line: #d3e4f7;
  --tl-line: #cfe2ff;
  --alert-line: #f5c6c1;
  --alert-bg: linear-gradient(180deg, #fff, #fff7f6);
  --level-ink: #0a5d3a;
  --level-line: #b8e3d0;
  --chip-line: #f3dca0;
  --chip-ink: #6b3f00;
  --row-line: rgba(13, 23, 48, .08);
  --track: rgba(13, 23, 48, .1);
  --next-bg: linear-gradient(135deg, #084fbc 0%, #0b63e5 100%);
  --next-kicker: #bff7ff;
  --hero-avatar-bg: #fff;
  --auth-bg:
    radial-gradient(50rem 32rem at 10% -10%, rgba(54, 154, 254, .28), transparent 60%),
    radial-gradient(44rem 30rem at 105% 5%, rgba(0, 255, 248, .26), transparent 55%),
    linear-gradient(180deg, #f1f7ff 0%, #fff 100%);
  --auth-shadow: 0 24px 60px rgba(11, 99, 229, .16), 0 2px 6px rgba(10, 31, 68, .06);
  --grad-bar: linear-gradient(90deg, var(--sky), #00d8d2);
  --on-accent: #10284f;
  --chart-1: #0b63e5;
  --chart-2: #00b3ad;
  --chart-track: #e3e8f2;
  color-scheme: light;
}

/* ---- Modo oscuro: automático según el sistema, o forzado con data-theme (interruptor) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink-950: #f4f6fb;
    --ink-900: #e6eaf3;
    --ink-600: #a4aec4;
    --ink-400: #7d879e;
    --line: #2e3446;
    --canvas: #0e1118;
    --surface: #171b26;
    --surface-2: #1d2230;
    --brand: #7db3ff;
    --brand-600: #a3c8ff;
    --brand-50: #1b2a48;
    --brand-ink: #0a1a33;
    --accent: #ffb547;
    --accent-50: #3a2a0c;
    --ok: #5fd39a;
    --ok-50: #12301f;
    --warn: #ffc266;
    --warn-50: #3a2a0c;
    --bad: #ff9088;
    --bad-50: #3d1815;
    --info: #8ab4ff;
    --info-50: #16264a;
    --violet: #b79cff;
    --violet-50: #2a1f4d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --ctl-line: #3a4258;
    --ctl-line-hover: #56607c;
    --dash: #3a4258;
    --neutral-chip: #262c3c;
    --field-bg: #111520;
    --grad-bg: linear-gradient(180deg, #0e1118 0%, #0a0d13 100%);
    --grad-soft: linear-gradient(135deg, #1b2a48 0%, #123a3c 100%);
    --grad-soft-2: linear-gradient(135deg, #1a2030, #14303a);
    --grad-chip: linear-gradient(135deg, #1b2a48, #123a3c);
    --soft-line: #2b3a55;
    --tl-line: #33415f;
    --alert-line: #6b2b26;
    --alert-bg: linear-gradient(180deg, #171b26, #26161a);
    --level-ink: #7fe0b0;
    --level-line: #275c43;
    --chip-line: #5c4310;
    --chip-ink: #ffd699;
    --row-line: rgba(255, 255, 255, .08);
    --track: rgba(255, 255, 255, .12);
    --next-bg: linear-gradient(135deg, #123a8a 0%, #1a56c9 100%);
    --next-kicker: #bff7ff;
    --hero-avatar-bg: #171b26;
    --auth-bg:
      radial-gradient(50rem 32rem at 10% -10%, rgba(54, 154, 254, .22), transparent 60%),
      radial-gradient(44rem 30rem at 105% 5%, rgba(0, 255, 248, .12), transparent 55%),
      linear-gradient(180deg, #0e1118 0%, #0a0d13 100%);
    --auth-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    --chart-1: #7db3ff;
    --chart-2: #2fe0d8;
    --chart-track: #2a3040;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink-950: #f4f6fb;
  --ink-900: #e6eaf3;
  --ink-600: #a4aec4;
  --ink-400: #7d879e;
  --line: #2e3446;
  --canvas: #0e1118;
  --surface: #171b26;
  --surface-2: #1d2230;
  --brand: #7db3ff;
  --brand-600: #a3c8ff;
  --brand-50: #1b2a48;
  --brand-ink: #0a1a33;
  --accent: #ffb547;
  --accent-50: #3a2a0c;
  --ok: #5fd39a;
  --ok-50: #12301f;
  --warn: #ffc266;
  --warn-50: #3a2a0c;
  --bad: #ff9088;
  --bad-50: #3d1815;
  --info: #8ab4ff;
  --info-50: #16264a;
  --violet: #b79cff;
  --violet-50: #2a1f4d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --ctl-line: #3a4258;
  --ctl-line-hover: #56607c;
  --dash: #3a4258;
  --neutral-chip: #262c3c;
  --field-bg: #111520;
  --grad-bg: linear-gradient(180deg, #0e1118 0%, #0a0d13 100%);
  --grad-soft: linear-gradient(135deg, #1b2a48 0%, #123a3c 100%);
  --grad-soft-2: linear-gradient(135deg, #1a2030, #14303a);
  --grad-chip: linear-gradient(135deg, #1b2a48, #123a3c);
  --soft-line: #2b3a55;
  --tl-line: #33415f;
  --alert-line: #6b2b26;
  --alert-bg: linear-gradient(180deg, #171b26, #26161a);
  --level-ink: #7fe0b0;
  --level-line: #275c43;
  --chip-line: #5c4310;
  --chip-ink: #ffd699;
  --row-line: rgba(255, 255, 255, .08);
  --track: rgba(255, 255, 255, .12);
  --next-bg: linear-gradient(135deg, #123a8a 0%, #1a56c9 100%);
  --next-kicker: #bff7ff;
  --hero-avatar-bg: #171b26;
  --auth-bg:
    radial-gradient(50rem 32rem at 10% -10%, rgba(54, 154, 254, .22), transparent 60%),
    radial-gradient(44rem 30rem at 105% 5%, rgba(0, 255, 248, .12), transparent 55%),
    linear-gradient(180deg, #0e1118 0%, #0a0d13 100%);
  --auth-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --chart-1: #7db3ff;
  --chart-2: #2fe0d8;
  --chart-track: #2a3040;
  color-scheme: dark;
}

/* ---- Dirección y mentor: estilo «deportivo» (naranja sobre carbón; referencia Sport Dashboard) ----
   La familia y el acceso conservan la identidad azul→cian. */
body.shell-staff,
body.shell-auth {
  --sky: #ff8a1f;
  --cyan: #ff5a36;
  --grad-brand: linear-gradient(135deg, #ff8a1f 0%, #ff5a36 100%);
  --brand: #b8420a;
  --brand-600: #93330a;
  --brand-50: #fff0e4;
  --brand-ink: #fff;
  --canvas: #f6f5f3;
  --surface-2: #faf8f6;
  --line: #e7e2dc;
  --ctl-line: #d6cfc7;
  --ctl-line-hover: #b3a99e;
  --dash: #d8c9bb;
  --neutral-chip: #efebe6;
  --grad-bg: linear-gradient(180deg, #f6f5f3 0%, #fff 70%);
  --grad-bar: linear-gradient(90deg, #ff8a1f, #ff5a36);
  --grad-chip: linear-gradient(135deg, #fff0e4, #ffe4dc);
  --shadow: 0 1px 2px rgba(40, 24, 8, .05), 0 8px 24px rgba(120, 60, 10, .07);
  --auth-bg:
    radial-gradient(50rem 32rem at 10% -10%, rgba(255, 138, 31, .26), transparent 60%),
    radial-gradient(44rem 30rem at 105% 5%, rgba(255, 90, 54, .18), transparent 55%),
    linear-gradient(180deg, #f6f5f3 0%, #fff 100%);
  --auth-shadow: 0 24px 60px rgba(184, 66, 10, .14), 0 2px 6px rgba(40, 24, 8, .06);
  --on-accent: #1b0f04;
  --ink-950: #1a1512;
  --ink-900: #241d18;
  --ink-600: #5b524a;
  --ink-400: #8a7f75;
  --chart-1: #e8590c;
  --chart-2: #c2255c;
  --chart-track: #ece7e1;
  --info: #175cd3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.shell-staff,
  :root:not([data-theme="light"]) body.shell-auth {
    --brand: #ff9a4d;
    --brand-600: #ffb27a;
    --brand-50: #3a2412;
    --brand-ink: #1b0f04;
    --canvas: #0f0f11;
    --surface: #1a1a1d;
    --surface-2: #222226;
    --line: #2e2e33;
    --ctl-line: #3d3d44;
    --ctl-line-hover: #5a5a63;
    --dash: #45454d;
    --neutral-chip: #2a2a2f;
    --field-bg: #121214;
    --ink-950: #f6f6f7;
    --ink-900: #e9e9ec;
    --ink-600: #a8a8b2;
    --ink-400: #80808b;
    --grad-bg:
      radial-gradient(60rem 30rem at 85% -10%, rgba(255, 122, 26, .10), transparent 60%),
      linear-gradient(180deg, #0f0f11 0%, #0b0b0d 100%);
    --grad-chip: linear-gradient(135deg, #3a2412, #3a1a14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
    --auth-bg:
      radial-gradient(50rem 32rem at 10% -10%, rgba(255, 122, 26, .20), transparent 60%),
      radial-gradient(44rem 30rem at 105% 5%, rgba(255, 90, 54, .10), transparent 55%),
      linear-gradient(180deg, #0f0f11 0%, #0b0b0d 100%);
    --auth-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    --chart-1: #ff8a3d;
    --chart-2: #ef5b4c;
    --chart-track: #2e2e34;
    --info: #8ab4ff;
  }
}
:root[data-theme="dark"] body.shell-staff,
:root[data-theme="dark"] body.shell-auth {
  --brand: #ff9a4d;
  --brand-600: #ffb27a;
  --brand-50: #3a2412;
  --brand-ink: #1b0f04;
  --canvas: #0f0f11;
  --surface: #1a1a1d;
  --surface-2: #222226;
  --line: #2e2e33;
  --ctl-line: #3d3d44;
  --ctl-line-hover: #5a5a63;
  --dash: #45454d;
  --neutral-chip: #2a2a2f;
  --field-bg: #121214;
  --ink-950: #f6f6f7;
  --ink-900: #e9e9ec;
  --ink-600: #a8a8b2;
  --ink-400: #80808b;
  --grad-bg:
    radial-gradient(60rem 30rem at 85% -10%, rgba(255, 122, 26, .10), transparent 60%),
    linear-gradient(180deg, #0f0f11 0%, #0b0b0d 100%);
  --grad-chip: linear-gradient(135deg, #3a2412, #3a1a14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
  --auth-bg:
    radial-gradient(50rem 32rem at 10% -10%, rgba(255, 122, 26, .20), transparent 60%),
    radial-gradient(44rem 30rem at 105% 5%, rgba(255, 90, 54, .10), transparent 55%),
    linear-gradient(180deg, #0f0f11 0%, #0b0b0d 100%);
  --auth-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --chart-1: #ff8a3d;
  --chart-2: #ef5b4c;
  --chart-track: #2e2e34;
  --info: #8ab4ff;
}
/* Tema familia: mismo lienzo azul, más aire y calidez solo en los logros (ámbar). */
.theme-family {
  --canvas: #f1f7ff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--grad-bg) fixed, var(--canvas);
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv11", "ss03";
  min-height: 100vh;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink-950); color: var(--canvas); padding: 10px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
.icon { flex: none; }

/* ------------------------------------------------------------------ shells */
.content { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 16px 8px; flex: 1; }
footer { text-align: center; padding: 24px 16px 28px; color: var(--ink-600); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 500; color: inherit; text-decoration: none; letter-spacing: -.01em; }
.brand strong { font-weight: 800; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--grad-brand); color: var(--on-accent); font-weight: 800; }

/* Barra superior simple (acceso y familia) */
.shell-plain .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.shell-plain .top .brand { color: var(--ink-950); }
.shell-plain .top .brand strong { color: var(--brand); }
.shell-plain main { max-width: 720px; }
.who { display: flex; gap: 12px; align-items: center; font-size: .9rem; color: var(--ink-600); }
.who form { margin: 0; }

/* Barra lateral (dirección y mentor) */
.sidebar { background: var(--surface); color: var(--ink-600); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 16px; align-items: center; }
.sidebar .brand { color: var(--ink-950); }
.sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.nav-group { display: contents; }
.nav-title { display: none; }
.sidebar nav a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; color: var(--ink-600); text-decoration: none; white-space: nowrap; font-weight: 600; font-size: .92rem; min-height: 44px; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: var(--brand-50); color: var(--brand-600); }
.sidebar nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand-600); }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-card .user-meta { display: none; }
.user-card form { margin: 0; }
.user-card a { color: inherit; text-decoration: none; }
.btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; padding: 10px; min-height: 44px; border-radius: 10px; }
.sidebar .btn-ghost { color: var(--ink-600); }
.sidebar .btn-ghost span { display: none; }
.btn-ghost:hover { background: var(--brand-50); }
.shell-plain .btn-ghost { color: var(--brand); padding: 6px 8px; }
.shell-plain .btn-ghost:hover { background: var(--brand-50); }

@media (min-width: 960px) {
  .shell-staff { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 22px 14px 14px; overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--line); }
  .sidebar .brand { padding: 4px 10px 22px; font-size: 1.25rem; }
  .sidebar nav { display: block; overflow: visible; grid-row: auto; flex: 1; padding: 0; }
  .nav-group { display: block; margin-bottom: 18px; }
  .nav-title { display: block; margin: 0 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); }
  .sidebar nav a { display: flex; border-radius: 12px; padding: 10px 12px; margin-bottom: 2px; }
  .sidebar nav a[aria-current="page"] { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--sky); }
  .user-card { border-top: 1px solid var(--line); padding: 14px 6px 0; margin-top: 8px; }
  .user-card .user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: .82rem; line-height: 1.3; }
  .user-card .user-meta strong { color: var(--ink-950); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-card .user-meta span { color: var(--ink-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 32px 40px 8px; }
}

/* ------------------------------------------------------------------ tipografía */
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin: .1em 0 .5em; }
h2 { font-size: 1.1rem; line-height: 1.3; font-weight: 700; margin: 1.8em 0 .7em; letter-spacing: -.01em; }
h3 { font-size: 1rem; font-weight: 700; margin: 1.2em 0 .4em; }
p { margin: .5em 0; }
a { color: var(--brand); text-underline-offset: 3px; }
code { font-size: .85em; background: var(--canvas); padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--ink-600); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-600); }

/* ------------------------------------------------------------------ tarjetas y KPIs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; margin: 14px 0; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .chip-icon { grid-row: span 2; }
.stat { container-type: inline-size; }
.stat > div { min-width: 0; }
.stat .n { font-size: clamp(1.15rem, 8cqw, 1.75rem); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.stat .l { color: var(--ink-600); font-size: .85rem; }
.stat.is-alert { border-color: var(--alert-line); background: var(--alert-bg); }
.stat:not(.is-alert) { position: relative; overflow: hidden; }
.stat:not(.is-alert)::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad-brand); opacity: .9; }
.chip-icon { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; background: var(--grad-chip); color: var(--brand); }
.chip-icon.amber { background: var(--accent-50); color: var(--warn); }
.chip-icon.green { background: var(--ok-50); color: var(--ok); }
.chip-icon.violet { background: var(--violet-50); color: var(--violet); }
.chip-icon.blue { background: var(--info-50); color: var(--info); }
.chip-icon.red { background: var(--bad-50); color: var(--bad); }
.section-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.section-link:hover { text-decoration: underline; }
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 16px; background: var(--surface); border: 1px dashed var(--dash); border-radius: var(--r-card); color: var(--ink-600); }
.empty .chip-icon { margin-bottom: 4px; }
.empty strong { color: var(--ink-900); }

/* ------------------------------------------------------------------ avatar y personas */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 800; flex: none; background: var(--brand-50); color: var(--brand); }
.avatar.tone-2 { background: var(--accent-50); color: var(--warn); }
.avatar.tone-3 { background: var(--ok-50); color: var(--ok); }
.avatar.tone-4 { background: var(--violet-50); color: var(--violet); }
.avatar.tone-5 { background: var(--info-50); color: var(--info); }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .sub { display: block; color: var(--ink-600); font-size: .85rem; }

/* ------------------------------------------------------------------ tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); margin: 12px 0; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 700; color: var(--ink-600); text-transform: uppercase; letter-spacing: .08em; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--surface-2); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ formularios */
label { display: block; font-weight: 600; font-size: .92rem; margin: 16px 0 6px; }
input[type=text], input[type=email], input[type=tel], input[type=month], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--ctl-line); border-radius: var(--r-ctl); font: inherit; background: var(--field-bg); color: var(--ink-900); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ctl-line-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); vertical-align: middle; margin-right: 8px; }
.check { display: flex; align-items: flex-start; gap: 4px; font-weight: 400; margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.row.compact { margin-top: 10px; align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: var(--r-ctl); border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s; box-shadow: 0 1px 2px rgba(8, 79, 188, .25); }
button:hover, .btn:hover { background: var(--brand-600); border-color: var(--brand-600); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--brand); border-color: var(--ctl-line); box-shadow: none; }
button.secondary:hover, .btn.secondary:hover { background: var(--brand-50); }
button.link { background: none; border: none; color: var(--brand); padding: 0; min-height: 0; font-weight: 600; box-shadow: none; }
button.link:hover { background: none; text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .btn-ghost:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.flash { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-radius: var(--r-ctl); font-weight: 600; margin: 0 0 16px; }
.flash.ok { background: var(--ok-50); color: var(--ok); }
.flash.error { background: var(--bad-50); color: var(--bad); }

/* ------------------------------------------------------------------ estados */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--neutral-chip); color: var(--ink-600); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.paid, .badge.present, .badge.published, .badge.completed { background: var(--ok-50); color: var(--ok); }
.badge.pending, .badge.saved, .badge.planned, .badge.late, .badge.in_progress { background: var(--warn-50); color: var(--warn); }
.badge.overdue, .badge.absent, .badge.cancelled { background: var(--bad-50); color: var(--bad); }

/* ------------------------------------------------------------------ evaluación (mentor) */
.scores { display: grid; gap: 12px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; box-shadow: var(--shadow); }
.skill .name { font-weight: 700; }
.pills { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.pills > span { display: inline-flex; }
.pills input { position: absolute; opacity: 0; }
.pills label { margin: 0; min-width: 48px; min-height: 48px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--ctl-line); border-radius: var(--r-ctl); cursor: pointer; font-weight: 700; background: var(--field-bg); transition: background .15s, border-color .15s; }
.pills label:hover { border-color: var(--brand); }
.pills label.wide { font-weight: 500; }
.pills input:checked + label { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pills input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

.center { max-width: 420px; margin: 40px auto; padding: 28px; }

/* ------------------------------------------------------------------ camino de la familia */
.journey h1 { font-size: 2rem; }
.hero { border-radius: var(--r-hero); padding: 24px; background: var(--grad-soft); display: flex; gap: 18px; align-items: center; margin: 8px 0 8px; box-shadow: var(--shadow); }
.hero h1 { margin: 0; }
.hero p { margin: 4px 0 0; color: var(--ink-600); }
.hero .avatar { width: 64px; height: 64px; font-size: 1.4rem; background: var(--hero-avatar-bg); color: var(--brand); }
.chapter { margin: 32px 0; }
.chapter > .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--brand); font-weight: 800; }
.chapter > h2 { margin-top: .3em; }
.moment { background: var(--grad-soft); border-radius: var(--r-hero); padding: 26px 24px 22px; font-size: 1.3rem; line-height: 1.45; font-weight: 600; position: relative; color: var(--ink-950); }
.moment::before { content: "“"; font-size: 3.6rem; line-height: 1; position: absolute; top: 4px; left: 14px; color: var(--brand); opacity: .45; }
.moment p { margin: 0; padding-left: 14px; }
.evidence { border-left: 4px solid var(--accent); padding: 10px 14px; margin: 10px 0; background: var(--surface); border-radius: 0 12px 12px 0; }
.growth { background: var(--grad-soft-2); border-radius: var(--r-hero); padding: 8px 20px; border: 1px solid var(--soft-line); }
.skill-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--row-line); }
.skill-row:last-child { border-bottom: 0; }
.skill-row .grow { flex: 1; min-width: 0; }
.level { display: inline-flex; padding: 2px 12px; border-radius: 999px; background: var(--surface); color: var(--level-ink); font-weight: 800; font-size: .85rem; border: 1px solid var(--level-line); margin-left: 4px; }
.level.none { background: var(--surface); color: var(--ink-600); font-weight: 600; border-color: var(--line); }
.bar { display: flex; gap: 4px; margin-top: 8px; }
.bar i { width: 28px; height: 8px; border-radius: 4px; background: var(--track); }
.bar i.on { background: var(--grad-bar); }
.next { background: var(--next-bg); color: #fff; border-radius: var(--r-hero); padding: 24px; font-size: 1.2rem; font-weight: 600; box-shadow: var(--shadow); }
.next .kicker { color: var(--next-kicker); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.next p { margin: .5em 0 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 0 12px 20px; border-left: 3px solid var(--tl-line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 18px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--accent-50); border: 1px solid var(--chip-line); margin: 2px 6px 2px 0; font-weight: 700; color: var(--chip-ink); }
.callout { background: var(--surface); border: 1px dashed var(--dash); border-radius: var(--r-card); padding: 16px 20px; }
.child-card { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.child-card:hover { transform: translateY(-2px); }
.child-card .go { margin-left: auto; color: var(--brand); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.child-card .avatar { width: 52px; height: 52px; font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .hero { flex-direction: column; align-items: flex-start; }
  th, td { padding: 12px; }
}

/* ------------------------------------------------------------------ acceso (login / elegir organización) */
body.shell-auth {
  background: var(--auth-bg);
  background-attachment: fixed;
  color: var(--ink-900);
}
.shell-auth .top { background: transparent; border-bottom: 0; }
.shell-auth .top .brand { color: var(--ink-950); }
.shell-auth .top .brand strong { color: var(--brand); }

.shell-auth .who, .shell-auth .btn-ghost { color: var(--ink-600); }
.shell-auth .btn-ghost:hover { background: var(--brand-50); }
.shell-auth main { max-width: 620px; padding-top: 2vh; }
.shell-auth footer, .shell-auth footer small { color: var(--ink-600); }
.shell-auth h1 { color: var(--ink-950); }
.auth-hero { text-align: center; margin: 0 0 20px; }
.auth-hero h1 { font-size: clamp(1.35rem, 5.8vw, 2.6rem); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.auth-hero h1 span { display: block; white-space: nowrap; }
.auth-hero h1 em { font-style: normal; font-weight: 800; font-size: 1.12em; color: var(--brand); }
.auth-hero p { color: var(--ink-600); font-size: .98rem; line-height: 1.5; max-width: 38ch; margin: 16px auto 0; }
.shell-auth .card { color: var(--ink-900); border: 1px solid var(--line); box-shadow: var(--auth-shadow); border-radius: var(--r-hero); padding: 28px 24px; }
.shell-auth .card h1, .shell-auth .card h2 { color: var(--ink-950); }
.auth-card { max-width: 460px; margin: 0 auto; }
.auth-card h2 { margin-top: 0; font-size: 1.3rem; }
.auth-card .actions button { width: 100%; }
.shell-auth .flash { border-radius: var(--r-ctl); }

/* Reservado a funciones asistidas por IA (identidad: degradado rosa→azul). Hoy no se usa: la IA
   solo propondrá, siempre etiquetada (docs/architecture/ai-boundary.md). */
.ai-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #b8235f 0%, #0055d9 100%); }


/* ------------------------------------------------------------------ interruptor de tema
   Solo aparece si hay JS (theme.js añade .js a <html>); sin JS se sigue el modo del sistema. */
.theme-toggle { display: none; }
.js .theme-toggle { display: inline-flex; }
.theme-toggle { color: var(--ink-600); }
.theme-toggle span { display: none; }
.shell-plain .theme-toggle { padding: 6px 8px; }

/* ------------------------------------------------------------------ estilo deportivo (dirección y mentor) */
.shell-staff .stat { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); padding: 18px 20px; }
.shell-staff .stat:not(.is-alert)::after { top: auto; bottom: 0; height: 3px; opacity: 1; }
.shell-staff .stat .n { font-size: clamp(1.15rem, 8cqw, 2rem); font-weight: 700; letter-spacing: -.03em; }
.shell-staff .stat .l { text-transform: none; }
.shell-staff .card, .shell-staff .table-wrap, .shell-staff .skill { border-radius: 18px; }
.shell-staff h1 { letter-spacing: -.03em; }
.shell-staff .sidebar nav a[aria-current="page"] { color: var(--brand); }
.shell-staff button, .shell-staff .btn { border-radius: 999px; }
.shell-staff .brand-mark { border-radius: 12px; }

/* ------------------------------------------------------------------ gráficas (SVG con atributos, sin estilos en línea) */
.panels { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 14px 0; }
.panels .card { margin: 0; }
.panel-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-600); margin: 0 0 14px; }
.donut { display: grid; grid-template-columns: 148px 1fr; gap: 20px; align-items: center; }
.donut svg { width: 148px; height: 148px; display: block; }
.donut .track { stroke: var(--chart-track); }
.donut .seg-1 { stroke: var(--chart-1); }
.donut .seg-2 { stroke: var(--chart-2); }
.donut .center-n { fill: var(--ink-950); font: 800 20px/1 "Inter", system-ui, sans-serif; text-anchor: middle; }
.donut .center-l { fill: var(--ink-600); font: 500 8px/1 "Inter", system-ui, sans-serif; text-anchor: middle; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li { display: grid; grid-template-columns: 12px 1fr; column-gap: 10px; align-items: center; font-size: .9rem; color: var(--ink-600); }
.legend li::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--chart-track); grid-row: span 2; }
.legend li.seg-1::before { background: var(--chart-1); }
.legend li.seg-2::before { background: var(--chart-2); }
.legend strong { color: var(--ink-950); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .donut { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } }

/* ------------------------------------------------------------------ identidad del club (nombre y logo) */
.brand-stack { min-width: 0; }
.club-id { display: flex; align-items: center; gap: 10px; margin: 6px 0 0 4px; min-width: 0; }
.club-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.club-mark { width: 36px; height: 36px; flex: none; border-radius: 10px; display: inline-grid; place-items: center; font-weight: 800; background: var(--brand-50); color: var(--brand); }
.club-name { font-weight: 700; font-size: .92rem; line-height: 1.25; color: var(--ink-950); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (min-width: 960px) {
  .sidebar .brand { padding-bottom: 6px; }
  .club-id { margin: 0 6px 22px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
}
.branding-form { display: grid; gap: 4px; max-width: 520px; }
.branding-preview { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.branding-preview .club-logo, .branding-preview .club-mark { width: 72px; height: 72px; border-radius: 16px; font-size: 1.6rem; }

/* Acciones por fila: botones uno debajo de otro, sin partir el texto */
td.row-actions { white-space: nowrap; }
td.row-actions form { display: block; margin: 0 0 6px; }
td.row-actions .btn, td.row-actions .muted { display: inline-block; }
details.history { margin-top: 14px; }
details.history > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
form.inline { display: inline; margin: 0; }

/* Acciones de edición plegadas dentro de una fila */
details.edit { margin-top: 6px; }
details.edit > summary { cursor: pointer; font-size: .85rem; }
details.edit[open] { padding: 8px 0; }

/* Botón flotante de contacto por WhatsApp: solo el icono; el número no se muestra. */
.wa-fab { position: fixed; right: 18px; bottom: 18px; z-index: 50; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #25d366; color: #fff; box-shadow: 0 4px 14px rgb(0 0 0 / 0.25); text-decoration: none; }
.wa-fab:hover { filter: brightness(1.06); }
.wa-fab:focus-visible { outline: 3px solid var(--ink-900, #111); outline-offset: 3px; }
@media print { .wa-fab { display: none; } }

.wa-preview { margin: 8px 0 16px; padding: 12px 14px; border-radius: 12px; border-left: 4px solid #25d366; background: var(--surface-2, rgb(127 127 127 / 0.1)); white-space: pre-wrap; }

/* ---- feedback contextual (sin JS) ---- */
details.feedback { position: fixed; right: 82px; bottom: 18px; z-index: 40; max-width: min(360px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 8px 14px; }
details.feedback > summary { cursor: pointer; font-size: .85rem; font-weight: 700; }
details.feedback[open] { padding-bottom: 14px; max-height: 70vh; overflow: auto; }
details.feedback textarea { min-height: 90px; }
@media print { details.feedback, .wa-fab { display: none; } }
