/* ==========================================================================
   Tapizcenter · Verificador de Transferencias
   Sistema de diseño — paleta institucional #10069F / #007AB7 / #161616 / #F8F4EC
   ========================================================================== */

:root {
  /* Marca */
  --marca:        #10069f;
  --marca-alt:    #007ab7;
  --tinta:        #161616;
  --crema:        #f8f4ec;

  /* Superficies (claro) */
  --fondo:        #e8e5dd;
  --panel:        #ffffff;
  --panel-2:      #efece4;
  --borde:        #d0cabd;
  --borde-fuerte: #aaa294;

  /* Texto */
  --texto:        #161616;
  --texto-2:      #5d5b57;
  --texto-3:      #726e66;

  /* Estados */
  --ok:           #17794a;
  --ok-suave:     #e8f5ee;
  --alerta:       #9a6b00;
  --alerta-suave: #fdf3dd;
  --error:        #b3261e;
  --error-suave:  #fdecea;
  --info-suave:   #e9f2fb;

  /* Formas */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sombra-1: 0 1px 2px rgba(22,22,22,.08);
  --sombra-2: 0 2px 10px rgba(22,22,22,.11);
  --sombra-3: 0 12px 32px rgba(22,22,22,.18);

  --lateral: 248px;
  --cabecera: 60px;

  --fuente: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
            Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

[data-tema="oscuro"] {
  --fondo:        #0c0c10;
  --panel:        #212129;
  --panel-2:      #292930;
  --borde:        #3e3e47;
  --borde-fuerte: #54545f;
  --texto:        #eceae5;
  --texto-2:      #a5a29b;
  --texto-3:      #949089;
  --marca:        #4b3ef0;
  --marca-alt:    #2f9fdc;
  --ok:           #4ac48a;
  --ok-suave:     #14301f;
  --alerta:       #e0b452;
  --alerta-suave: #322709;
  --error:        #f08379;
  --error-suave:  #35130f;
  --info-suave:   #0f2033;
  --sombra-1: 0 1px 2px rgba(0,0,0,.4);
  --sombra-2: 0 2px 8px rgba(0,0,0,.45);
  --sombra-3: 0 12px 32px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.012em; line-height: 1.25; }
h1 { font-size: 1.32rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .94rem; }

:focus-visible {
  outline: 2px solid var(--marca-alt);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: color-mix(in srgb, var(--marca-alt) 25%, transparent); }

/* ============================================================ Estructura == */

.app { display: flex; min-height: 100vh; }

/* ---- Barra lateral ---- */
.lateral {
  width: var(--lateral);
  flex: 0 0 var(--lateral);
  background: var(--marca);
  color: var(--crema);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.lateral__marca {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(248,244,236,.14);
}
.lateral__logo { width: 104px; aspect-ratio: 700 / 344; color: var(--crema); flex: 0 0 auto; }
.lateral__logo svg { width: 100%; height: 100%; display: block; }
.lateral__titulo { font-size: 1.2rem; font-weight: 700; letter-spacing: .08em; line-height: 1.2; }
.lateral__sub {
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(248,244,236,.62);
  margin-top: 2px;
}

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav__grupo {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: rgba(248,244,236,.45);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: rgba(248,244,236,.82);
  font-size: .89rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .13s, color .13s;
}
.nav a:hover { background: rgba(248,244,236,.09); color: var(--crema); text-decoration: none; }
.nav a.activo { background: var(--crema); color: var(--marca); font-weight: 620; }
.nav a.activo .ico { opacity: 1; }
.nav .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .78; }
.nav .globo {
  margin-left: auto;
  background: var(--marca-alt);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}
.nav a.activo .globo { background: var(--marca); color: var(--crema); }
/* En modo oscuro --marca-alt es un celeste claro: blanco sobre ese fondo no llega al
   contraste mínimo (AA). Se usa un azul más oscuro fijo, solo para este globo. */
[data-tema="oscuro"] .nav .globo { background: #007ab7; }

.lateral__pie {
  padding: 12px;
  border-top: 1px solid rgba(248,244,236,.14);
  font-size: .72rem;
  color: rgba(248,244,236,.5);
}

/* ---- Contenido ---- */
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.cabecera {
  height: var(--cabecera);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 30;
}
.cabecera__titulo { flex: 1; min-width: 0; }
.cabecera__titulo p { margin: 0; font-size: .78rem; color: var(--texto-2); }

.contenido { padding: 22px; flex: 1; max-width: 1560px; width: 100%; }

.menu-movil {
  display: none;
  background: none;
  border: 0;
  color: var(--texto);
  padding: 7px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.menu-movil:hover { background: var(--panel-2); }

/* ================================================================ Piezas == */

.tarjeta {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r-lg);
  box-shadow: var(--sombra-1);
}
.tarjeta__cab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--borde);
}
.tarjeta__cab h3 { flex: 1; }
.tarjeta__cuerpo { padding: 16px; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid-reportes { grid-template-columns: minmax(280px, 340px) 1fr; align-items: start; }

/* ---- KPI ---- */
.kpi {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sombra-1);
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--marca);
}
.kpi--alt::before { background: var(--marca-alt); }
.kpi--ok::before { background: var(--ok); }
.kpi--alerta::before { background: var(--alerta); }
.kpi__etq {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--texto-3);
  font-weight: 620;
}
.kpi__valor {
  font-size: 1.62rem;
  font-weight: 680;
  letter-spacing: -.02em;
  margin: 5px 0 2px;
  font-variant-numeric: tabular-nums;
}
.kpi__valor.chico { font-size: 1.2rem; }
.kpi__nota { font-size: .76rem; color: var(--texto-2); display: flex; align-items: center; gap: 5px; }

.delta { font-weight: 640; font-size: .76rem; display: inline-flex; align-items: center; gap: 2px; }
.delta--sube { color: var(--ok); }
.delta--baja { color: var(--error); }
.delta--igual { color: var(--texto-3); }

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--borde-fuerte);
  background: var(--panel);
  color: var(--texto);
  font: inherit;
  font-size: .86rem;
  font-weight: 550;
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .06s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--panel-2); border-color: var(--texto-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 15px; height: 15px; }

.btn--primario {
  background: var(--marca);
  border-color: var(--marca);
  color: #fff;
}
.btn--primario:hover {
  background: color-mix(in srgb, var(--marca) 86%, #000);
  border-color: color-mix(in srgb, var(--marca) 86%, #000);
}
.btn--alt { background: var(--marca-alt); border-color: var(--marca-alt); color: #fff; }
.btn--alt:hover { background: color-mix(in srgb, var(--marca-alt) 86%, #000); }
.btn--peligro { color: var(--error); border-color: color-mix(in srgb, var(--error) 40%, transparent); }
.btn--peligro:hover { background: var(--error-suave); }
.btn--sm { padding: 5px 10px; font-size: .79rem; }
.btn--icono { padding: 7px; }
.btn--fantasma { border-color: transparent; background: transparent; }
.btn--fantasma:hover { background: var(--panel-2); border-color: var(--borde); }

/* ---- Formularios ---- */
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label, .etq {
  font-size: .78rem;
  font-weight: 600;
  color: var(--texto-2);
}
input[type="text"], input[type="password"], input[type="date"], input[type="number"],
input[type="email"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--borde-fuerte);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--texto);
  font: inherit;
  font-size: .88rem;
  transition: border-color .13s, box-shadow .13s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--marca-alt);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--marca-alt) 16%, transparent);
}
input::placeholder { color: var(--texto-3); }
textarea { resize: vertical; min-height: 68px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8880' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.check:hover { background: var(--panel-2); }
.check input { margin: 2px 0 0; width: 15px; height: 15px; accent-color: var(--marca); flex: 0 0 auto; }
.check__txt { font-size: .85rem; }
.check__txt small { display: block; color: var(--texto-3); font-size: .74rem; }

.interruptor { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
/* Oculto visualmente pero NO display:none: así sigue alcanzable con Tab y puede
   recibir foco de teclado (con display:none el checkbox queda inutilizable sin mouse). */
.interruptor input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.interruptor i {
  width: 36px; height: 20px;
  background: var(--borde-fuerte);
  border-radius: 10px;
  position: relative;
  transition: background .16s;
  flex: 0 0 auto;
}
.interruptor i::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .16s;
  box-shadow: var(--sombra-1);
}
.interruptor input:checked + i { background: var(--marca); }
.interruptor input:checked + i::after { transform: translateX(16px); }
.interruptor input:focus-visible + i { outline: 2px solid var(--marca-alt); outline-offset: 2px; }

/* ---- Lista de opciones con icono + interruptor (permisos, cuentas, correos) --- */
.opciones-grupo + .opciones-grupo { margin-top: 18px; }
.opciones-grupo__titulo {
  font-size: .71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--texto-3);
  margin: 0 0 6px 4px;
}
.opciones-lista {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px;
}
.opcion {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--borde);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.opcion:hover { background: var(--panel-2); border-color: var(--borde-fuerte); }
.opcion:has(input:checked) {
  background: var(--info-suave);
  border-color: color-mix(in srgb, var(--marca-alt) 40%, transparent);
}
.opcion__icono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--borde-fuerte);
  color: var(--texto-2);
  font-size: .78rem;
  font-weight: 700;
  transition: background .12s, color .12s, border-color .12s;
}
.opcion__icono .ico { width: 16px; height: 16px; }
.opcion:has(input:checked) .opcion__icono {
  background: var(--marca);
  border-color: var(--marca);
  color: #fff;
}
.opcion__icono--redondo {
  border-radius: 50%;
  background: var(--c, var(--marca));
  border-color: color-mix(in srgb, var(--c, var(--marca)) 60%, black 8%);
  color: #fff;
}
.opcion:has(input:checked) .opcion__icono--redondo { background: var(--c, var(--marca)); }
.opcion__texto { flex: 1; min-width: 0; }
.opcion__texto b { display: block; font-size: .85rem; font-weight: 600; }
.opcion__texto small { display: block; color: var(--texto-3); font-size: .73rem; margin-top: 1px; }
.opcion .interruptor { flex: 0 0 auto; }

/* Interruptor "maestro" (ver todo): queda visualmente elevado del resto para
   marcar que manda sobre la lista de abajo. */
.opcion--maestra {
  background: var(--panel-2);
  border-color: var(--borde);
  margin-bottom: 8px;
}
.opcion--maestra:hover { background: var(--panel-2); }

.barra-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: flex-end;
}
.barra-filtros .campo { min-width: 132px; flex: 0 1 auto; }
.barra-filtros .campo--ancho { flex: 1 1 220px; }

/* ---- Tablas ---- */
.tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.datos { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.datos th {
  text-align: left;
  padding: 9px 12px;
  font-size: .71rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--texto-3);
  font-weight: 650;
  border-bottom: 1px solid var(--borde);
  white-space: nowrap;
  background: var(--panel-2);
  position: sticky;
  top: 0;
}
table.datos td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}
table.datos tbody tr { transition: background .1s; }
table.datos tbody tr:hover { background: var(--panel-2); }
table.datos tbody tr.clicable { cursor: pointer; }
table.datos .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.datos .mono { font-family: var(--mono); font-size: .8rem; }

/* ---- Etiquetas de estado ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 620;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill--ok { background: var(--ok-suave); color: var(--ok); }
.pill--pendiente { background: var(--alerta-suave); color: var(--alerta); }
.pill--info { background: var(--info-suave); color: var(--marca-alt); }
.pill--neutro { background: var(--panel-2); color: var(--texto-2); border-color: var(--borde); }
.pill--error { background: var(--error-suave); color: var(--error); }

/* Transferencia revisada: quién y cuándo, en verde, en el lugar del botón "Revisar" */
.revisada {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 168px;
  padding: 4px 10px 4px 8px;
  background: var(--ok-suave);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: var(--r-sm);
  font: inherit;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease;
}
.revisada:hover { border-color: var(--ok); }
.revisada .ico { width: 15px; height: 15px; flex: none; }
.revisada__txt { display: flex; flex-direction: column; min-width: 0; }
.revisada__txt b { font-size: .78rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.revisada__txt small { font-size: .68rem; opacity: .8; white-space: nowrap; }
.pill .punto { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.banco-tag {
  --c: var(--marca-alt);                      /* cada cuenta bancaria pone el suyo (style="--c:#hex") */
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--c) 14%, var(--panel));
  color: color-mix(in srgb, var(--c) 78%, var(--texto));
  font-size: .74rem;
  font-weight: 620;
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
}

/* ---- Estado de sincronización ---- */
.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--texto-2);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  background: var(--panel-2);
}
.sync .punto { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.sync.err .punto { background: var(--error); }
.sync.trabajando .punto { background: var(--marca-alt); animation: latir 1.1s infinite; }
@keyframes latir { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---- Menú de usuario ---- */
.usuario-menu { position: relative; }
.usuario-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 5px 9px 5px 5px;
  cursor: pointer;
  color: var(--texto);
  font: inherit;
}
.usuario-btn:hover { background: var(--panel-2); border-color: var(--borde); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--marca);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.usuario-btn__txt { text-align: left; line-height: 1.2; }
.usuario-btn__txt b { font-size: .84rem; font-weight: 620; display: block; }
.usuario-btn__txt span { font-size: .7rem; color: var(--texto-3); text-transform: capitalize; }

.desplegable {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  min-width: 212px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r-md);
  box-shadow: var(--sombra-3);
  padding: 5px;
  z-index: 60;
  display: none;
}
.desplegable.abierto { display: block; }
.desplegable button, .desplegable a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: .85rem;
  color: var(--texto);
  cursor: pointer;
  text-align: left;
}
.desplegable button:hover, .desplegable a:hover { background: var(--panel-2); text-decoration: none; }
.desplegable hr { border: 0; border-top: 1px solid var(--borde); margin: 5px 0; }
.desplegable .peligro { color: var(--error); }

/* ---- Modal ---- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(22,22,22,.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal-fondo.abierto { display: flex; }
.modal {
  background: var(--panel);
  border-radius: var(--r-lg);
  box-shadow: var(--sombra-3);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: aparecer .16s ease-out;
}
.modal--ancho { max-width: 860px; }
.modal--angosto { max-width: 430px; }
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.modal__cab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--borde);
}
.modal__cab h2 { flex: 1; }
.modal__cuerpo { padding: 18px; overflow-y: auto; }
.modal__pie {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--borde);
  background: var(--panel-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-wrap: wrap;
}

/* ---- Confirmación (ventana propia, en lugar de la del navegador) ---- */
#modal-confirmar { z-index: 110; }               /* por encima de otra ventana abierta */
.confirmar__cuerpo { display: flex; gap: 14px; align-items: flex-start; padding: 22px 20px 20px; }
.confirmar__icono {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--alerta-suave);
  color: var(--alerta);
}
.confirmar__icono .ico { width: 20px; height: 20px; }
.confirmar--peligro .confirmar__icono { background: var(--error-suave); color: var(--error); }
.confirmar--info .confirmar__icono { background: var(--info-suave); color: var(--marca-alt); }
.confirmar__txt { min-width: 0; }
.confirmar__txt h2 { font-size: 1.05rem; margin: 2px 0 6px; }
.confirmar__txt p { margin: 0; color: var(--texto-2); line-height: 1.5; font-size: .9rem; overflow-wrap: anywhere; }
.btn--rojo { background: var(--error); border-color: var(--error); color: #fff; }
.btn--rojo:hover { filter: brightness(1.08); }

/* ---- Avisos ---- */
.aviso {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  font-size: .85rem;
  border: 1px solid transparent;
  margin-bottom: 14px;
}
.aviso--error { background: var(--error-suave); color: var(--error); border-color: color-mix(in srgb, var(--error) 22%, transparent); }
.aviso--ok { background: var(--ok-suave); color: var(--ok); }
.aviso--info { background: var(--info-suave); color: var(--marca-alt); }
.aviso--alerta { background: var(--alerta-suave); color: var(--alerta); }
.aviso .ico { flex: 0 0 17px; width: 17px; height: 17px; margin-top: 1px; }

/* ---- QR para crear la contraseña de aplicación de Gmail (formulario de correo) ---- */
.qr-ayuda {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--borde);
  border-radius: var(--r-md);
  background: var(--panel-2);
  font-size: .85rem;
  line-height: 1.45;
}
.qr-ayuda__qr {
  flex: none;
  width: 132px;
  height: 132px;
  padding: 4px;
  background: #fff;                /* el QR necesita fondo claro, también en el tema oscuro */
  border-radius: 6px;
}
.qr-ayuda__txt { min-width: 0; }
.qr-ayuda__txt ol { margin: 6px 0; padding-left: 18px; }
.qr-ayuda__txt li { margin-bottom: 3px; }
.qr-ayuda__txt a { overflow-wrap: anywhere; }

/* ---- Notificaciones flotantes ---- */
#tostadas {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  max-width: min(370px, calc(100vw - 36px));
}
.tostada {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-left: 3px solid var(--marca);
  border-radius: var(--r-md);
  padding: 11px 14px;
  box-shadow: var(--sombra-3);
  font-size: .86rem;
  animation: entrar .2s ease-out;
}
.tostada.ok { border-left-color: var(--ok); }
.tostada.error { border-left-color: var(--error); }
.tostada b { display: block; margin-bottom: 1px; }
@keyframes entrar { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ---- Vacío / carga ---- */
.vacio { text-align: center; padding: 46px 20px; color: var(--texto-3); }
.vacio .ico { width: 36px; height: 36px; margin-bottom: 10px; opacity: .45; }
.vacio p { margin: 4px 0; }
.vacio b { color: var(--texto-2); font-size: .95rem; }

.esqueleto {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--borde) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: brillo 1.3s infinite;
  border-radius: var(--r-sm);
  height: 13px;
}
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- Paginación ---- */
.paginacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  padding: 12px 16px;
  border-top: 1px solid var(--borde);
  font-size: .82rem;
  color: var(--texto-2);
  flex-wrap: wrap;
}
.paginacion__btns { display: flex; gap: 6px; }

/* ---- Gráficos ---- */
.lienzo { position: relative; height: 250px; }
.lienzo--bajo { height: 175px; }

/* ---- Listas compactas ---- */
.lista-compacta { display: flex; flex-direction: column; }
.lista-compacta li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--borde);
  font-size: .85rem;
}
.lista-compacta li:last-child { border-bottom: 0; }
.lista-compacta ul, .lista-compacta { list-style: none; margin: 0; padding: 0; }
.lista-compacta .rank {
  width: 21px; height: 21px;
  border-radius: var(--r-xs);
  background: var(--panel-2);
  border: 1px solid var(--borde);
  display: grid;
  place-items: center;
  font-size: .71rem;
  font-weight: 700;
  color: var(--texto-2);
  flex: 0 0 auto;
}
.lista-compacta .crece { flex: 1; min-width: 0; }
.lista-compacta .crece b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-compacta .crece small { color: var(--texto-3); font-size: .74rem; }

.barra-prop { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.barra-prop > i { display: block; height: 100%; background: var(--marca-alt); border-radius: 3px; }

/* ---- Detalle de transferencia ---- */
.dato-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 13px; }
.dato { }
.dato dt { font-size: .71rem; text-transform: uppercase; letter-spacing: .07em; color: var(--texto-3); font-weight: 620; }
.dato dd { margin: 2px 0 0; font-size: .92rem; font-weight: 550; word-break: break-word; }
.cuerpo-correo {
  background: var(--panel-2);
  border: 1px solid var(--borde);
  border-radius: var(--r-md);
  padding: 13px;
  font-size: .82rem;
  line-height: 1.6;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--texto-2);
}

.adj-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--borde);
  border-radius: var(--r-sm);
  margin-bottom: 7px;
  font-size: .84rem;
}
.adj-item .crece { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lista-casillas .adj-item { flex-wrap: wrap; }   /* en pantallas angostas los botones bajan en vez de salirse */

/* Vista previa del ticket en Configuración › Impresora (papel blanco sobre fondo gris) */
.ticket-preview {
  display: block;
  width: 100%;
  height: 560px;
  border: 1px solid var(--borde);
  border-radius: var(--r-sm);
  background: #e9e8e5;
}

/* ================================================================= Login == */

.login-pagina {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.login-arte {
  background: var(--marca);
  color: var(--crema);
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-arte::after {
  content: "";
  position: absolute;
  right: -160px;
  bottom: -190px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  border: 78px solid rgba(248,244,236,.05);
}
.login-arte__logo { width: 190px; color: var(--crema); position: relative; z-index: 1; }
.login-arte__logo svg { width: 100%; height: auto; display: block; }
.login-arte h1 { font-size: 1.9rem; line-height: 1.2; max-width: 15ch; position: relative; z-index: 1; }
.login-arte p { color: rgba(248,244,236,.72); max-width: 42ch; position: relative; z-index: 1; }
.login-arte__pie { font-size: .74rem; color: rgba(248,244,236,.5); position: relative; z-index: 1; }

.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--panel);
}
.login-caja { width: 100%; max-width: 355px; }
.login-caja h2 { font-size: 1.42rem; margin-bottom: 4px; }
.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--marca-alt);
          cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.enlace:hover { color: var(--texto); }
.login-caja > p { color: var(--texto-2); margin: 0 0 24px; font-size: .88rem; }
.login-caja .campo { margin-bottom: 14px; }
.login-caja .btn { width: 100%; padding: 11px; font-size: .92rem; margin-top: 6px; }
.login-movil-marca { display: none; }

.clave-wrap { position: relative; }
.clave-wrap input { padding-right: 40px; }
.clave-ojo {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 7px;
  cursor: pointer;
  color: var(--texto-3);
  border-radius: var(--r-sm);
}
.clave-ojo:hover { color: var(--texto); }

/* ============================================================== Reportes == */

.reporte-previa {
  background: var(--panel-2);
  border: 1px dashed var(--borde-fuerte);
  border-radius: var(--r-md);
  padding: 16px;
}
.resumen-linea {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--borde-fuerte);
  font-size: .87rem;
}
.resumen-linea:last-child { border-bottom: 0; }
.resumen-linea b { font-variant-numeric: tabular-nums; }
.resumen-linea.total {
  border-top: 2px solid var(--texto);
  border-bottom: 0;
  margin-top: 6px;
  padding-top: 10px;
  font-size: 1rem;
  font-weight: 680;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--borde-fuerte);
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  font-size: .81rem;
  color: var(--texto-2);
  transition: all .12s;
}
.chip:hover { border-color: var(--marca-alt); color: var(--texto); }
.chip.activo { background: var(--marca); border-color: var(--marca); color: #fff; font-weight: 600; }

/* ================================================================ Utils == */

.fila { display: flex; align-items: center; gap: 10px; }
.fila--entre { justify-content: space-between; }
.fila--fin { justify-content: flex-end; }
.crece { flex: 1; min-width: 0; }
.envuelve { flex-wrap: wrap; }
.apilado { display: flex; flex-direction: column; gap: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.tenue { color: var(--texto-3); }
.suave { color: var(--texto-2); }
.chico { font-size: .8rem; }
.mini { font-size: .73rem; }
.negrita { font-weight: 640; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.centro { text-align: center; }
.derecha { text-align: right; }
.oculto { display: none !important; }
.solo-lectura { opacity: .55; pointer-events: none; }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================ Responsive == */

.velo-movil {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22,22,22,.5);
  z-index: 39;
}
.velo-movil.abierto { display: block; }

@media (max-width: 1000px) {
  .lateral {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--sombra-3);
  }
  .lateral.abierta { transform: none; }
  .menu-movil { display: inline-flex; }
  .contenido { padding: 16px; }
  .grid-reportes { grid-template-columns: 1fr; }
  .cabecera { padding: 0 14px; }
  .usuario-btn__txt { display: none; }
  .login-pagina { grid-template-columns: 1fr; }
  .login-arte { display: none; }
  .login-movil-marca {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 26px;
  }
  .login-movil-marca .logo { width: 44px; height: 44px; color: var(--marca); }
  .login-movil-marca .logo svg { width: 100%; height: 100%; }
  .login-movil-marca b { font-size: 1.05rem; letter-spacing: .05em; display: block; }
  .login-movil-marca span { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--texto-3); }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  .contenido { padding: 12px; }
  .cabecera { height: auto; min-height: 56px; padding: 8px 12px; }
  h1 { font-size: 1.12rem; }
  .grid { gap: 12px; }
  .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi { padding: 12px 13px; }
  .kpi__valor { font-size: 1.32rem; }
  .barra-filtros .campo { min-width: 100%; }
  .barra-filtros .campo--mitad { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); }
  .modal { max-height: 94vh; }
  .modal__pie { justify-content: stretch; }
  .modal__pie .btn { flex: 1; }
  /* en el teléfono la confirmación sale desde abajo, con botones grandes para el pulgar */
  #modal-confirmar { align-items: flex-end; padding: 0; }
  #modal-confirmar .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  #modal-confirmar .modal__pie { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  #modal-confirmar .modal__pie .btn { padding-top: 11px; padding-bottom: 11px; }
  table.datos { font-size: .82rem; }
  table.datos th, table.datos td { padding: 8px 9px; }
  .ocultar-movil { display: none !important; }
  #tostadas { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .lienzo { height: 210px; }
  .paginacion { justify-content: center; }
}

/* ================================================================ Print === */
@media print {
  .lateral, .cabecera, .no-imprimir, #tostadas { display: none !important; }
  .contenido { padding: 0; }
  body { background: #fff; }
  .tarjeta { border: 1px solid #ccc; box-shadow: none; }

  /* Se imprime siempre con la paleta clara: si no, con el tema oscuro activo el
     texto (--texto claro) queda invisible sobre el fondo blanco forzado de arriba,
     y las tarjetas/kpis/pills (--panel oscuro) quedan como recuadros negros. */
  :root, [data-tema="oscuro"] {
    --fondo: #e8e5dd !important;
    --panel: #ffffff !important;
    --panel-2: #efece4 !important;
    --borde: #d0cabd !important;
    --borde-fuerte: #aaa294 !important;
    --texto: #161616 !important;
    --texto-2: #5d5b57 !important;
    --texto-3: #726e66 !important;
    --marca: #10069f !important;
    --marca-alt: #007ab7 !important;
    --ok: #17794a !important;
    --ok-suave: #e8f5ee !important;
    --alerta: #9a6b00 !important;
    --alerta-suave: #fdf3dd !important;
    --error: #b3261e !important;
    --error-suave: #fdecea !important;
    --info-suave: #e9f2fb !important;
  }
}


/* ========================================================= Configuración == */

[hidden] { display: none !important; }

/* Pestañas de la página (Correos · Datos a detectar · Impresora térmica) */
.pestanas { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--borde); margin-bottom: 18px; }
.pestana {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  font: inherit; font-size: .92rem; color: var(--texto-2); padding: 10px 16px; white-space: nowrap;
}
.pestana:hover { color: var(--texto); }
.pestana.activo { color: var(--marca); border-bottom-color: var(--marca); font-weight: 620; }

/* Pestañas del editor de usuario: acceso (qué puede hacer) vs. alcance (qué ve) */
#u-tabs { margin-bottom: 16px; }
#u-tabs .pestana { display: inline-flex; align-items: center; gap: 7px; }
#u-tabs .pestana .ico { width: 15px; height: 15px; }

.cfg-barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* Cada correo es una tarjeta con sus cuentas bancarias */
.correo__cab { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--borde); }
.correo__id b { font-size: 1rem; margin-right: 6px; }
.correo__cuerpo { padding: 14px 16px; }

.cuenta { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--borde); border-radius: var(--r-md); margin-bottom: 8px; flex-wrap: wrap; }
.cuenta__color { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--borde-fuerte); background: var(--c); cursor: pointer; padding: 0; }
.cuenta__color:hover { box-shadow: 0 0 0 2px var(--marca-alt); }
.cuenta__nombre { flex: 0 1 170px; min-width: 110px; font: inherit; font-weight: 620; border: 1px solid transparent; background: transparent; padding: 5px 7px; border-radius: var(--r-sm); color: inherit; }
.cuenta__nombre:hover { border-color: var(--borde); }
.cuenta__nombre:focus { border-color: var(--marca-alt); background: var(--panel); outline: none; }
.cuenta .fichas { flex: 3 1 240px; align-items: center; }
.form-cuenta { border: 1px dashed var(--borde-fuerte); border-radius: var(--r-md); padding: 12px; margin-top: 8px; }
.punto-c { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }

/* Fichas (palabras, etiquetas, remitentes, rótulos) */
.fichas { display: flex; flex-wrap: wrap; gap: 7px; }
.ficha { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--borde-fuerte); font-size: .81rem; }
.ficha__x { border: 0; background: transparent; cursor: pointer; color: var(--texto-3); padding: 3px; border-radius: 50%; display: grid; place-items: center; }
.ficha__x:hover { background: var(--error-suave); color: var(--error); }
.ficha--sug { border-style: dashed; background: transparent; color: var(--texto-2); padding: 4px 11px; cursor: pointer; font: inherit; font-size: .81rem; }
.ficha--sug:hover { border-color: var(--marca-alt); color: var(--texto); }
.ficha-nueva { border: 1px dashed var(--borde-fuerte); background: transparent; border-radius: 999px; font: inherit; font-size: .81rem; padding: 4px 11px; width: 150px; color: inherit; }
.ficha-nueva:focus { outline: none; border-color: var(--marca-alt); border-style: solid; }
.sug-tit { font-size: .76rem; color: var(--texto-3); margin: 14px 0 7px; }

/* Paleta de colores de una cuenta */
.paleta { position: absolute; z-index: 90; background: var(--panel); border: 1px solid var(--borde-fuerte); border-radius: var(--r-md); box-shadow: var(--sombra-3); padding: 11px; width: 218px; }
.paleta__rejilla { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.paleta__c { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0; }
.paleta__c:hover, .paleta__c.activo { border-color: var(--texto); }
.paleta__pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .78rem; color: var(--texto-2); }
.paleta__pie input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--borde-fuerte); border-radius: var(--r-xs); background: none; cursor: pointer; }
