/* ==========================================================================
   Nivel UP · CRM (panel interno). Reutiliza los tokens de marca (tokens.css).
   Layout: barra lateral + área de contenido. Sobrio, legible, sin motion pesado.
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream-2);
}

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Estructura --- */
.crm {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.crm__side {
  background: var(--azul-ink);
  color: #dbe6ff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.crm__brand { display: flex; align-items: center; gap: 10px; }
.crm__brand img { height: 30px; }
.crm__brand small { color: #9fb6e8; font-weight: 600; letter-spacing: .02em; }

.crm__nav { display: flex; flex-direction: column; gap: 2px; }
.crm__nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: #c9d8f5;
  font-weight: 600;
  font-size: 14.5px;
}
.crm__nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.crm__nav a.is-active { background: var(--azul); color: #fff; }
.crm__nav i { font-size: 18px; }
.crm__nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7e95c9; margin: 12px 12px 4px; }

.crm__side-foot { margin-top: auto; font-size: 13px; color: #9fb6e8; }
.crm__user { display: flex; flex-direction: column; gap: 8px; }
.crm__user strong { color: #fff; }

.crm__main { display: flex; flex-direction: column; min-width: 0; }
.crm__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.crm__top h1 { font-family: var(--font-display); font-size: 21px; margin: 0; color: var(--ink); }
.crm__crumbs { font-size: 13px; color: var(--muted); }
.crm__crumbs a { color: var(--muted); }

.crm__content { padding: 26px 28px 60px; max-width: 1100px; width: 100%; }

/* --- Tarjetas de métrica (dashboard) --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.kpi {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--sh-soft);
}
.kpi__n { font-family: var(--font-display); font-size: 32px; font-weight: 800; color: var(--azul-deep); line-height: 1; }
.kpi__l { color: var(--muted); font-weight: 600; font-size: 13.5px; margin-top: 8px; }

/* --- Botones --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-pill);
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .12s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--coral); color: #fff; box-shadow: var(--sh-coral); }
.btn--primary:hover { background: var(--coral-deep); }
.btn--ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--azul); color: var(--azul); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--danger { background: #fff; color: #c0392b; border-color: #f0c8c2; }
.btn--danger:hover { background: #fdecea; }

/* --- Cabecera de página con acción --- */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.pagehead h2 { font-family: var(--font-display); font-size: 24px; margin: 0; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }

/* --- Tablas --- */
.tablecard { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-soft); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th, table.data td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); }
table.data th { background: var(--cream); color: var(--body); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafcff; }
.t-actions { display: flex; gap: 8px; justify-content: flex-end; }
.t-empty { padding: 40px; text-align: center; color: var(--muted); }

/* --- Badges --- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; }
.badge--on { background: var(--c-deportes-bg); color: var(--verde-deep); }
.badge--off { background: #f1eee9; color: var(--muted); }
.badge--cat { background: var(--cream-2); color: var(--azul-deep); }

/* --- Formularios --- */
.formcard { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 26px 28px; box-shadow: var(--sh-soft); max-width: 720px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=time],
.field select, .field textarea {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--paper);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(46,107,240,.14);
}
.field--check { display: flex; align-items: center; gap: 9px; }
.field--check label { margin: 0; }
.field--check input { width: 18px; height: 18px; }
.field .errors { color: #c0392b; font-size: 13px; margin-top: 5px; list-style: none; padding: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* --- Flash --- */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 12px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; }
.flash--ok { background: var(--c-deportes-bg); color: var(--verde-deep); }
.flash--error { background: #fdecea; color: #c0392b; }
.flash--info { background: var(--c-academia-bg); color: var(--azul-deep); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--azul-ink), var(--azul-deep)); }
.login-card { background: var(--white); border-radius: var(--r-lg); padding: 34px 32px; width: 100%; max-width: 400px; box-shadow: var(--sh-card); }
.login-card img { height: 38px; margin-bottom: 6px; }
.login-card h1 { font-family: var(--font-display); font-size: 22px; margin: 10px 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card .btn--primary { width: 100%; justify-content: center; margin-top: 6px; }

/* --- Responsive --- */
@media (max-width: 860px) {
  .crm { grid-template-columns: 1fr; }
  .crm__side { position: static; height: auto; flex-direction: column; }
  .crm__nav { flex-direction: row; flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
}
