/* ==========================================================================
   Ganga Electrónica · Afiliados — interfaz de aplicación (panel + admin)
   Rediseño 2026. Mismos tokens que la parte pública, sin recursos externos.
   Los nombres de clase se conservan: el rediseño es puramente visual.
   ========================================================================== */

:root {
  --v-50:  #f4f8e8;
  --v-100: #e6f0cb;
  --v-200: #d0e39c;
  --v-300: #b4d165;
  --v-400: #99bd35;
  --v-500: #7ca106;
  --v-600: #648304;
  --v-700: #4d6604;
  --v-800: #3b4e06;

  --n-0:   #ffffff;
  --n-25:  #fbfcfb;
  --n-50:  #f6f8f7;
  --n-100: #eceff0;
  --n-200: #dfe4e6;
  --n-300: #c3cbcf;
  --n-400: #8d989f;
  --n-500: #5f6b73;
  --n-600: #455057;
  --n-700: #313a40;
  --n-800: #1e262b;
  --n-900: #12181c;
  --n-950: #0a0e11;

  /* Alias heredados */
  --acento: var(--v-500);
  --acento-oscuro: var(--v-600);
  --acento-suave: var(--v-50);
  --texto: var(--n-800);
  --texto-suave: var(--n-500);
  --borde: var(--n-200);
  --fondo: var(--n-50);
  --blanco: var(--n-0);
  --ok: #157f47;
  --ok-bg: #e7f5ed;
  --ok-bd: #bfe3cf;
  --aviso: #a86500;
  --aviso-bg: #fff6e5;
  --aviso-bd: #f5dcb0;
  --error: #c0392b;
  --error-bg: #fdecea;
  --error-bd: #f5c6c2;

  --radio: 14px;
  --radio-sm: 9px;
  --radio-full: 999px;
  --sombra: 0 1px 2px rgba(10,14,17,.05), 0 2px 8px rgba(10,14,17,.04);
  --sombra-md: 0 2px 4px rgba(10,14,17,.04), 0 12px 28px rgba(10,14,17,.07);
  --sombra-verde: 0 6px 22px rgba(124,161,6,.25);
  --paso: cubic-bezier(.22, 1, .36, 1);

  --t-xs: .78rem;
  --t-sm: .875rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

[x-cloak] { display: none !important; }

a { color: var(--v-700); text-underline-offset: .16em; }

h1 { font-size: 1.6rem; margin: 0 0 .3rem; letter-spacing: -.03em; font-weight: 750; }
h2 { font-size: 1.12rem; margin: 0 0 1rem; letter-spacing: -.02em; font-weight: 700; }
h3 { font-size: 1rem; margin: 0 0 .5rem; letter-spacing: -.015em; font-weight: 650; }

.silencio { color: var(--texto-suave); font-size: var(--t-sm); }
.centrado { text-align: center; }
.derecha { text-align: right; }

::selection { background: var(--v-200); color: var(--n-900); }
:focus-visible { outline: 2px solid var(--v-500); outline-offset: 2px; border-radius: 5px; }

/* ---------------------------------------------------------------- cabecera */
.cabecera {
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--borde);
  padding: .8rem 1.35rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 40;
}
/* Logo real de marca en la cabecera de la aplicación (fondo claro). */
.marca {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; color: var(--n-900);
}
/* Igual que en la parte pública: por debajo de ~38px "electrónica" no se lee. */
.marca img { height: 40px; width: auto; display: block; }
@media (max-width: 560px) { .marca img { height: 32px; } }
.marca .sufijo {
  font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--v-700); background: var(--v-50); border: 1px solid var(--v-100);
  border-radius: var(--radio-full); padding: .1rem .5rem; line-height: 1.5;
}
.usuario {
  font-size: var(--t-sm); color: var(--texto-suave);
  display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}

/* -------------------------------------------------------------------- menú */
.menu {
  background: var(--blanco);
  border-bottom: 1px solid var(--borde);
  display: flex; gap: .2rem;
  padding: .5rem 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky; top: 61px; z-index: 30;
}
.menu::-webkit-scrollbar { display: none; }
.menu button {
  background: none; border: none; border-radius: var(--radio-full);
  padding: .5rem 1rem; font: inherit; font-size: .9rem; font-weight: 550;
  color: var(--texto-suave); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background .2s, color .2s;
}
.menu button:hover { color: var(--n-900); background: var(--n-50); }
.menu button.activo {
  color: var(--v-800); background: var(--v-50);
  box-shadow: inset 0 0 0 1px var(--v-100);
  font-weight: 650;
}

/* --------------------------------------------------------------- contenedor */
.envoltorio { max-width: 1160px; margin: 0 auto; padding: 1.75rem 1.35rem 4rem; }
.estrecho { max-width: 520px; }
@media (max-width: 560px) { .envoltorio { padding: 1.25rem 1rem 3rem; } }

.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 560px) { .tarjeta { padding: 1.15rem 1.1rem; } }

/* ------------------------------------------------------------------ cifras */
.cifras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: .9rem;
  margin-bottom: 1.1rem;
}
.cifra {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--sombra);
  position: relative; overflow: hidden;
  transition: transform .25s var(--paso), box-shadow .25s;
}
.cifra:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); }
.cifra .etiqueta {
  font-size: .74rem; color: var(--texto-suave); margin-bottom: .45rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 650;
}
.cifra .valor {
  font-size: 1.85rem; font-weight: 800; line-height: 1.05;
  letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  color: var(--n-900);
}
.cifra .valor.acento {
  background: linear-gradient(120deg, var(--v-600), var(--v-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cifra .pie { font-size: var(--t-xs); color: var(--texto-suave); margin-top: .35rem; }
.cifra .pie a { font-weight: 600; text-decoration: none; }
.cifra .pie a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ saldo */
.saldo {
  background: linear-gradient(150deg, var(--n-900), var(--n-800) 65%, #253317);
  border: 1px solid transparent;
  border-radius: var(--radio);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.1rem;
  color: #fff;
  position: relative; overflow: hidden;
  box-shadow: var(--sombra-md);
}
.saldo::after {
  content: ""; position: absolute; width: 240px; height: 240px; right: -80px; top: -110px;
  background: radial-gradient(circle, rgba(124,161,6,.38), transparent 68%);
  pointer-events: none;
}
.saldo .titular { font-weight: 700; margin-bottom: .55rem; letter-spacing: -.02em; font-size: 1.02rem; }
.saldo .silencio { color: #aab5bb; }
.saldo strong { color: var(--v-300); }
.barra {
  height: 9px; background: rgba(255,255,255,.14);
  border-radius: var(--radio-full); overflow: hidden; margin: .7rem 0 .4rem;
}
.barra > div {
  height: 100%; border-radius: var(--radio-full);
  background: linear-gradient(90deg, var(--v-400), var(--v-300));
  box-shadow: 0 0 14px rgba(153,189,53,.6);
  transition: width .6s var(--paso);
}

/* -------------------------------------------------------------- formularios */
label {
  display: block; font-size: var(--t-sm); font-weight: 650;
  margin: .95rem 0 .3rem; color: var(--n-700);
}
input, select, textarea {
  width: 100%;
  padding: .62rem .8rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radio-sm);
  font: inherit; font-size: .95rem;
  background: var(--blanco);
  color: var(--texto);
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder, textarea::placeholder { color: var(--n-400); }
input:hover, select:hover, textarea:hover { border-color: var(--n-400); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--v-500);
  box-shadow: 0 0 0 3px rgba(124,161,6,.16);
}
textarea { min-height: 96px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.1rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238d989f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5.5 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center;
}
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 620px) { .fila { grid-template-columns: 1fr; } }

.casilla {
  display: flex; align-items: flex-start; gap: .65rem; margin: 1.1rem 0;
  background: var(--n-50); border: 1px solid var(--borde);
  border-radius: var(--radio-sm); padding: .8rem .9rem;
}
.casilla input { width: auto; margin-top: .18rem; accent-color: var(--v-500); flex: none; }
.casilla label { margin: 0; font-weight: 400; font-size: .9rem; color: var(--n-600); }

/* ----------------------------------------------------------------- botones */
button.boton, .boton {
  background: var(--v-500); color: #fff;
  border: 1px solid transparent; border-radius: var(--radio-full);
  padding: .62rem 1.25rem; font: inherit; font-size: .92rem; font-weight: 650;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: .45rem; text-decoration: none; white-space: nowrap;
  transition: transform .18s var(--paso), box-shadow .22s, background .2s;
  box-shadow: 0 1px 2px rgba(10,14,17,.06);
}
button.boton:hover, .boton:hover {
  background: var(--v-600); transform: translateY(-1px); box-shadow: var(--sombra-verde);
}
button.boton:active, .boton:active { transform: translateY(0); }
button.boton:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
button.secundario, .boton.secundario {
  background: var(--blanco); color: var(--n-700); border-color: var(--n-300); box-shadow: none;
}
button.secundario:hover, .boton.secundario:hover {
  background: var(--n-50); border-color: var(--n-400); color: var(--n-900);
  box-shadow: var(--sombra); transform: translateY(-1px);
}
.acciones { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }

/* ------------------------------------------------------------------ avisos */
.aviso {
  padding: .8rem 1rem; border-radius: var(--radio-sm); margin: .85rem 0;
  font-size: .9rem; border: 1px solid transparent; border-left-width: 3px;
}
.aviso.error { background: var(--error-bg); color: #97291d; border-color: var(--error-bd); border-left-color: var(--error); }
.aviso.ok { background: var(--ok-bg); color: #106336; border-color: var(--ok-bd); border-left-color: var(--ok); }
.aviso.info { background: var(--v-50); color: var(--v-800); border-color: var(--v-100); border-left-color: var(--v-500); }
.aviso.atencion { background: var(--aviso-bg); color: #7a5410; border-color: var(--aviso-bd); border-left-color: #d99b16; }

/* ------------------------------------------------------------------ tablas */
.tabla-scroll {
  overflow-x: auto; border: 1px solid var(--borde);
  border-radius: var(--radio-sm); background: var(--blanco);
}
.tarjeta .tabla-scroll { border: none; border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--n-100); }
th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--texto-suave); font-weight: 700; background: var(--n-25);
  border-bottom: 1px solid var(--borde); position: sticky; top: 0;
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--n-25); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- etiquetas */
.etiqueta-estado {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .18rem .6rem; border-radius: var(--radio-full);
  font-size: .74rem; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.etiqueta-estado::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  opacity: .8; flex: none;
}
.e-pendiente { background: var(--aviso-bg); color: var(--aviso); border-color: var(--aviso-bd); }
.e-confirmada { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.e-anulada { background: var(--error-bg); color: var(--error); border-color: var(--error-bd); }
.e-en_revision { background: #eef2f6; color: #48586a; border-color: #d8e0e8; }
.e-pagado { background: var(--v-50); color: var(--v-700); border-color: var(--v-100); }

/* ------------------------------------------------------------------ gráfico */
.grafico { width: 100%; height: 170px; display: block; overflow: visible; }
.grafico rect { fill: url(#gradBarra); rx: 3; transition: opacity .2s; }
.grafico rect:hover { opacity: .78; }
.grafico line { stroke: var(--n-200); }
.grafico text { font-size: 10px; fill: var(--texto-suave); }

/* --------------------------------------------------------------- copiar url */
.copiable { display: flex; gap: .45rem; align-items: center; }
.copiable code {
  flex: 1; background: var(--n-50); border: 1px solid var(--borde);
  border-radius: var(--radio-sm); padding: .55rem .7rem;
  font-size: .82rem; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: var(--n-700);
}

/* --------------------------------------------------------------- resultados */
.resultado {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: .7rem .85rem; border: 1px solid var(--borde);
  border-radius: var(--radio-sm); margin-bottom: .45rem;
  transition: border-color .2s, background .2s, transform .2s var(--paso);
}
.resultado:hover {
  border-color: var(--v-300); background: var(--v-50); transform: translateX(2px);
}

/* ---------------------------------------------------------------- registro */
.pasos { display: flex; gap: .5rem; margin-bottom: 1.4rem; font-size: .84rem; }
.paso {
  flex: 1; padding: .55rem .5rem; text-align: center; border-radius: var(--radio-full);
  background: var(--n-100); color: var(--texto-suave); font-weight: 600;
  transition: background .25s, color .25s;
}
.paso.activo { background: var(--v-500); color: #fff; box-shadow: var(--sombra-verde); }
.paso.hecho { background: var(--v-50); color: var(--v-700); box-shadow: inset 0 0 0 1px var(--v-100); }

.lista-limpia { padding-left: 0; margin: .6rem 0; list-style: none; display: grid; gap: .45rem; }
.lista-limpia li { position: relative; padding-left: 1.35rem; font-size: .92rem; }
.lista-limpia li::before {
  content: ""; position: absolute; left: .25rem; top: .58em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--v-400);
}

/* -------------------------------------------------- accesos públicos (login) */
.acceso-marco {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
  background:
    radial-gradient(46% 40% at 15% 0%, rgba(124,161,6,.12), transparent 60%),
    radial-gradient(40% 40% at 90% 100%, rgba(124,161,6,.10), transparent 62%),
    var(--fondo);
}
.acceso-marco .envoltorio { padding-top: 0; padding-bottom: 0; width: 100%; }
.acceso-marca {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.4rem; text-decoration: none;
}
.acceso-marca img { height: 56px; width: auto; display: block; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .cifra:hover, .resultado:hover, button.boton:hover, .boton:hover { transform: none; }
}
