/* 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: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/assets/fonts/plus-jakarta-sans-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: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/assets/fonts/plus-jakarta-sans-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 {
  --ink-950: #0d1730;
  --ink-900: #16223f;
  --ink-600: #4b5675;
  --ink-400: #7c86a2;
  --line: #e3e8f2;
  --canvas: #f4f6fb;
  --surface: #fff;
  --brand: #4a3fe0;
  --brand-600: #3a30c4;
  --brand-50: #eeedfd;
  --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(13, 23, 48, .05), 0 8px 24px rgba(13, 23, 48, .06);
  --sidebar: 248px;
  color-scheme: light;
}
/* Tema familia: más cálido, sin barra lateral. */
.theme-family {
  --canvas: #fff7ed;
  --brand: #d9480f;
  --brand-600: #b83a08;
  --brand-50: #ffe9dc;
  --line: #f3e3d0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--canvas);
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink-950); color: #fff; 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: linear-gradient(135deg, var(--brand), #7b6cf6); color: #fff; 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(--ink-950); color: #cbd3ea; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 16px; align-items: center; }
.sidebar .brand { color: #fff; }
.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: #cbd3ea; 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: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a[aria-current="page"] { background: rgba(122, 108, 246, .28); color: #fff; }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-card .user-meta { display: none; }
.user-card form { margin: 0; }
.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: #cbd3ea; }
.sidebar .btn-ghost span { display: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.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; }
  .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: #7f8bb0; }
  .sidebar nav a { display: flex; border-radius: 12px; padding: 10px 12px; margin-bottom: 2px; }
  .sidebar nav a[aria-current="page"] { background: rgba(122, 108, 246, .22); box-shadow: inset 3px 0 0 #8c80ff; }
  .user-card { border-top: 1px solid rgba(255, 255, 255, .1); 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: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-card .user-meta span { color: #93a0c6; 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(210px, 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 .n { font-size: 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: #f5c6c1; background: linear-gradient(180deg, #fff, #fff7f6); }
.chip-icon { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; background: var(--brand-50); 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 #cfd7e8; 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); }
.sidebar .avatar { background: rgba(255, 255, 255, .12); color: #fff; }
.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: #fafbfe; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafbfe; }
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=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid #ccd4e6; border-radius: var(--r-ctl); font: inherit; background: #fff; 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: #aab5d0; }
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(58, 48, 196, .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: #fff; color: var(--brand); border-color: #cfd6ee; 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: #edf0f7; 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 #ccd4e6; border-radius: var(--r-ctl); cursor: pointer; font-weight: 700; background: #fff; 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: linear-gradient(135deg, #ffe8c2 0%, #ffd0c0 100%); 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: #7a3300; }
.hero .avatar { width: 64px; height: 64px; font-size: 1.4rem; background: #fff; 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: linear-gradient(135deg, #ffe8c2, #ffd0c0); border-radius: var(--r-hero); padding: 26px 24px 22px; font-size: 1.3rem; line-height: 1.45; font-weight: 600; position: relative; color: #4a1d00; }
.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: #fff; border-radius: 0 12px 12px 0; }
.growth { background: linear-gradient(135deg, #e6f8f1, #e3edff); border-radius: var(--r-hero); padding: 8px 20px; border: 1px solid #d5e6ee; }
.skill-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid rgba(13, 23, 48, .08); }
.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: #fff; color: #0a5d3a; font-weight: 800; font-size: .85rem; border: 1px solid #b8e3d0; margin-left: 4px; }
.level.none { background: #fff; 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: rgba(13, 23, 48, .1); }
.bar i.on { background: var(--brand); }
.next { background: linear-gradient(135deg, var(--brand), #f08a3c); color: #fff; border-radius: var(--r-hero); padding: 24px; font-size: 1.2rem; font-weight: 600; box-shadow: var(--shadow); }
.next .kicker { color: #ffe9d6; 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 #f0d9bd; 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 #f3dca0; margin: 2px 6px 2px 0; font-weight: 700; color: #6b3f00; }
.callout { background: var(--surface); border: 1px dashed #d9c6ad; 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:
    radial-gradient(60rem 40rem at 12% -10%, rgba(140, 128, 255, .55), transparent 60%),
    radial-gradient(50rem 36rem at 105% 10%, rgba(245, 165, 36, .38), transparent 55%),
    radial-gradient(45rem 34rem at 50% 120%, rgba(58, 48, 196, .6), transparent 60%),
    linear-gradient(160deg, #1c1670 0%, #4a3fe0 48%, #7b6cf6 100%);
  background-attachment: fixed;
  color: #fff;
}
.shell-auth .top { background: transparent; border-bottom: 0; }
.shell-auth .top .brand, .shell-auth .top .brand strong { color: #fff; }
.shell-auth .brand-mark { background: #fff; color: var(--brand); }
.shell-auth .who, .shell-auth .btn-ghost { color: #fff; }
.shell-auth .btn-ghost:hover { background: rgba(255, 255, 255, .14); }
.shell-auth main { max-width: 620px; padding-top: 2vh; }
.shell-auth footer, .shell-auth footer small { color: rgba(255, 255, 255, .8); }
.shell-auth h1 { color: #fff; }
.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(--accent); }
.auth-hero p { color: rgba(255, 255, 255, .88); font-size: .98rem; line-height: 1.5; max-width: 38ch; margin: 16px auto 0; }
.shell-auth .card { color: var(--ink-900); border: 0; box-shadow: 0 24px 60px rgba(13, 10, 80, .45), 0 2px 6px rgba(13, 10, 80, .2); 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); }
