/* ==========================================================================
   Cobranza AA — estilos (mockup)
   Identidad: "Manual de Identidad básico, AA.pdf"
   Nomenclatura BEM: bloque__elemento--variante
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables de marca
   -------------------------------------------------------------------------- */
:root {
  /* Colores del manual (p. 9) */
  --aa-azul:        #2d4775; /* Principal · Pantone 4142 C */
  --aa-azul-medio:  #4d66ae; /* Secundario · Pantone 414 C */
  --aa-azul-claro:  #74a7d6; /* Secundario · Pantone 284 C */
  --aa-gris:        #7a7b87; /* Secundario · Pantone 6340 C */
  --aa-naranja:     #e88533; /* Complementario · Pantone 7414 C (solo acentos) */

  /* Interfaz */
  --fondo:          #f4f6fa;
  --superficie:     #ffffff;
  --texto:          #1f2a3d;
  --texto-sec:      #5d6170;
  --borde:          #dfe4ee;
  --borde-fuerte:   #c6cedd;

  /* Estados (derivados de la paleta) */
  --ok:             #2f7d5b;
  --ok-fondo:       #e6f3ed;
  --alerta:         #9a5b14;
  --alerta-fondo:   #fcefe2;
  --error:          #b3261e;
  --error-fondo:    #fbe9e7;
  --info-fondo:     #e8eef9;

  /* Tipografía.
     La marca usa DIN Next LT Pro (Black para títulos y cifras; Light/Regular para texto;
     títulos en versión Condensed). DIN es una fuente PAGA: mientras no haya licencia web,
     se carga Barlow / Barlow Condensed desde Google Fonts como sustituto visual cercano.
     Si DIN está instalada en el equipo, se usa primero. */
  --fuente-titulos: "DIN Next LT Pro", "Barlow Condensed", "Arial Narrow", sans-serif;
  --fuente-texto:   "DIN Next LT Pro", "Barlow", Arial, sans-serif;

  --radio:          10px;
  --sombra:         0 1px 2px rgba(45, 71, 117, .06), 0 4px 14px rgba(45, 71, 117, .07);
  --ancho-max:      1200px;
  --margen:         24px;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente-texto);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--fuente-titulos); margin: 0; }
a { color: var(--aa-azul-medio); }
code {
  font-family: Consolas, "Courier New", monospace;
  font-size: .85em;
  background: var(--info-fondo);
  padding: 1px 5px;
  border-radius: 4px;
}
.muted { color: var(--texto-sec); font-size: .9em; }

/* --------------------------------------------------------------------------
   3. Barra superior, franja de marca y aviso
   -------------------------------------------------------------------------- */
.topbar { background: var(--aa-azul); color: #fff; }

.topbar__inner {
  max-width: var(--ancho-max);
  margin: 0 auto;
  padding: 12px var(--margen);
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 28px;
}

.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo__mark { width: 38px; height: 40px; flex: none; }
.logo__text { display: flex; flex-direction: column; line-height: 1; }
.logo__name { font-family: var(--fuente-titulos); font-weight: 800; font-size: 21px; letter-spacing: .2px; }
.logo__tagline { font-family: var(--fuente-titulos); font-weight: 400; font-size: 8.5px; letter-spacing: .6px; text-transform: uppercase; margin-top: 4px; }

.topbar__app {
  display: flex;
  flex-direction: column;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, .28);
  line-height: 1.15;
}
.topbar__app-name { font-family: var(--fuente-titulos); font-weight: 900; font-size: 20px; }
.topbar__app-area { font-weight: 300; font-size: 13px; color: #d5def0; }

.nav { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.nav__item {
  color: #e7ecf6;
  text-decoration: none;
  font-family: var(--fuente-titulos);
  font-weight: 600;
  font-size: 16px;
  padding: 8px 12px;
  border-bottom: 3px solid transparent;
}
.nav__item:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, .35); }
.nav__item--active { color: #fff; border-bottom-color: var(--aa-naranja); }

.brand-strip {
  height: 5px;
  background: linear-gradient(90deg,
    var(--aa-azul) 0 25%, var(--aa-naranja) 25% 50%,
    var(--aa-azul-medio) 50% 75%, var(--aa-gris) 75% 100%);
}

.notice {
  max-width: var(--ancho-max);
  margin: 16px auto 0;
  padding: 9px 14px;
  background: var(--alerta-fondo);
  border: 1px dashed var(--aa-naranja);
  border-radius: var(--radio);
  color: var(--alerta);
  font-size: 14px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   4. Estructura de página
   -------------------------------------------------------------------------- */
.page {
  max-width: var(--ancho-max);
  margin: 0 auto;
  padding: 22px var(--margen) 40px;
  display: grid;
  gap: 20px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head__eyebrow {
  margin: 0 0 2px;
  color: var(--aa-azul-medio);
  font-family: var(--fuente-titulos);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.page-head__title { font-weight: 900; font-size: 36px; line-height: 1.05; color: var(--aa-azul); }
.page-head__lead { margin: 6px 0 0; color: var(--texto-sec); font-weight: 300; font-size: 16px; max-width: 680px; }

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.footer {
  max-width: var(--ancho-max);
  margin: 0 auto;
  padding: 18px var(--margen) 28px;
  border-top: 1px solid var(--borde);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--texto-sec);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   5. Tarjetas y KPIs
   -------------------------------------------------------------------------- */
.card {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
  min-width: 0;
}
.card__title { font-weight: 800; font-size: 20px; color: var(--aa-azul); margin-bottom: 14px; }
.card__foot { margin: 14px 0 0; color: var(--texto-sec); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--aa-azul); }
.kpis .kpi:nth-child(2) { border-top-color: var(--aa-azul-medio); }
.kpis .kpi:nth-child(3) { border-top-color: var(--aa-azul-claro); }
.kpis .kpi:nth-child(4) { border-top-color: var(--aa-gris); }
.kpi__label { color: var(--texto-sec); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.kpi__value { font-family: var(--fuente-titulos); font-weight: 900; font-size: 34px; line-height: 1.1; color: var(--aa-azul); }
.kpi__value--accent { color: var(--aa-naranja); }
.kpi__note { color: var(--texto-sec); font-weight: 300; font-size: 13px; }
.kpis--compact .kpi__value { font-size: 28px; }

/* --------------------------------------------------------------------------
   6. Botones, insignias y formularios
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-family: var(--fuente-titulos);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}
.btn--primary { background: var(--aa-naranja); color: #fff; border: 1px solid var(--aa-naranja); }
.btn--primary:hover { background: #d4742a; }
.btn--secondary { background: #fff; color: var(--aa-azul); border: 1.5px solid var(--aa-azul); }
.btn--secondary:hover { background: var(--info-fondo); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--ok     { background: var(--ok-fondo);     color: var(--ok); }
.badge--alerta { background: var(--alerta-fondo); color: var(--alerta); }
.badge--error  { background: var(--error-fondo);  color: var(--error); }
.badge--info   { background: var(--info-fondo);   color: var(--aa-azul-medio); }
.badge--neutro { background: #eef0f4;             color: var(--texto-sec); }

.form { display: grid; gap: 14px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form__field { display: grid; gap: 5px; min-width: 0; }
.form__label { font-size: 13px; font-weight: 600; color: var(--texto-sec); }
.form__input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--borde-fuerte);
  border-radius: 8px;
  background: #fff;
  color: var(--texto);
  font: inherit;
}
.form__input:focus { outline: 2px solid var(--aa-azul-claro); outline-offset: 1px; border-color: var(--aa-azul-medio); }
.form__input[readonly] { background: var(--fondo); color: var(--texto-sec); }
.form__group { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.form__check { display: flex; align-items: center; gap: 8px; }
.form__check input { accent-color: var(--aa-azul); }
.form__hint { margin: 0; color: var(--texto-sec); font-weight: 300; font-size: 13px; }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.form .form__actions { margin-top: 4px; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; margin-bottom: 16px; }
.filters__search { grid-column: span 2; }

/* --------------------------------------------------------------------------
   7. Tablas
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--texto-sec);
  font-weight: 600;
  padding: 9px 10px;
  border-bottom: 2px solid var(--borde);
  background: var(--fondo);
}
.table td { padding: 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.table tbody tr:hover { background: #f8f9fc; }
.table tfoot td { font-weight: 600; color: var(--texto-sec); border-bottom: 0; }
.table__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table__nowrap { white-space: nowrap; }
.table__strong { font-weight: 600; color: var(--aa-azul); }
.table__neg { color: var(--ok); }
.table__contact { white-space: nowrap; }
.codeudor { min-width: 160px; }

/* Seguimiento de pagos: reglas */
.checklist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; font-size: 13.5px; }
.checklist li { display: grid; grid-template-columns: 118px 1fr; gap: 10px; align-items: start; }
.checklist .badge { justify-self: start; }

/* Destinatarios por contrato (columnas Correo y WSP) */
.dest { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dest__item { display: grid; grid-template-columns: 74px auto; align-items: center; gap: 6px; }
.dest__rol { font-size: 11.5px; color: var(--texto-sec); }
.dest__link { text-decoration: none; }
.dest__link:hover .badge { text-decoration: underline; }
.badge--sm { font-size: 11px; padding: 1px 8px; justify-self: start; }

/* Columnas ocultables de Contratos */
.th-col { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.table__num .th-col { justify-content: flex-end; }
.th-col__x {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-size: 14px; line-height: 1; text-decoration: none; color: var(--texto-sec);
  opacity: .35; transition: opacity .15s, background .15s, color .15s;
}
th:hover .th-col__x, .th-col__x:focus-visible { opacity: 1; }
.th-col__x:hover { background: var(--aa-azul-medio); color: #fff; }
.columnas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 13px; }
.columnas__label { color: var(--texto-sec); }
.columnas__chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--aa-azul-medio); color: var(--aa-azul-medio); text-decoration: none; font-weight: 600;
}
.columnas__chip:hover { background: var(--aa-azul-medio); color: #fff; }
.columnas__todas { color: var(--aa-azul-medio); font-weight: 600; }
.codeudor__extra { font-size: 11.5px; font-weight: 600; color: var(--aa-azul-medio); cursor: help; }

.file {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  color: var(--aa-azul-medio);
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   8. Componentes del proceso (pasos, barras, reglas, progreso)
   -------------------------------------------------------------------------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  border-left: 4px solid var(--aa-gris);
}
.step--ok { border-left-color: var(--aa-azul); }
.step--proceso { border-left-color: var(--aa-naranja); }
.step__num {
  grid-row: span 2;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--aa-azul);
  color: #fff;
  font-family: var(--fuente-titulos);
  font-weight: 900;
  font-size: 18px;
}
.step--pendiente .step__num { background: var(--aa-gris); }
.step__body { display: flex; flex-direction: column; min-width: 0; }
.step__title { font-family: var(--fuente-titulos); font-weight: 800; font-size: 17px; color: var(--aa-azul); text-decoration: none; }
.step__title:hover { text-decoration: underline; }
.step__detail { color: var(--texto-sec); font-size: 13px; }
.step .badge { grid-column: 2; justify-self: start; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bars__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bars__name { font-weight: 600; }
.bars__value { font-family: var(--fuente-titulos); font-weight: 800; color: var(--aa-azul); }
.bars__track { height: 10px; border-radius: 6px; background: var(--info-fondo); margin: 5px 0 3px; overflow: hidden; }
.bars__fill { display: block; height: 100%; background: var(--aa-azul-medio); border-radius: 6px; }
.bars__row:first-child .bars__fill { background: var(--aa-azul); }
.bars__meta { color: var(--texto-sec); font-size: 12.5px; }

.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: regla; }
.rules__item {
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--borde); border-radius: 8px;
  counter-increment: regla;
}
.rules__item > div { display: flex; flex-direction: column; min-width: 0; }
.rules__name { font-weight: 600; color: var(--aa-azul); }
.rules__name::before { content: counter(regla) ". "; color: var(--aa-naranja); font-weight: 800; }
.rules__detail { color: var(--texto-sec); font-size: 13px; }
.rules__value { font-family: var(--fuente-titulos); font-weight: 800; color: var(--aa-azul); white-space: nowrap; }

.progress__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.progress__value { font-family: var(--fuente-titulos); font-weight: 900; font-size: 40px; color: var(--aa-azul); line-height: 1; }
.progress__meta { color: var(--texto-sec); }
.progress__track { height: 14px; border-radius: 8px; background: var(--info-fondo); margin: 10px 0 16px; overflow: hidden; }
.progress__fill { display: block; height: 100%; background: var(--aa-azul); border-right: 4px solid var(--aa-naranja); }

.stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stats__item { background: var(--fondo); border-radius: 8px; padding: 10px 12px; }
.stats dt { color: var(--texto-sec); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stats dd { margin: 0; font-family: var(--fuente-titulos); font-weight: 800; font-size: 22px; color: var(--aa-azul); }

/* --------------------------------------------------------------------------
   9. Sesión, modo de envío y vista previa de correo
   -------------------------------------------------------------------------- */
.session__status { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--fuente-titulos); font-weight: 800; font-size: 22px; color: var(--ok); }
.session__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-fondo); }
.session__list { margin: 0 0 12px; display: grid; gap: 8px; }
.session__list div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--borde); padding-bottom: 6px; }
.session__list dt { color: var(--texto-sec); font-size: 13px; }
.session__list dd { margin: 0; font-weight: 600; text-align: right; }

.mode {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 12px 16px; border-radius: var(--radio);
  background: var(--info-fondo); border: 1px solid var(--aa-azul-claro); color: var(--aa-azul);
}
.mode--test { background: var(--alerta-fondo); border-color: var(--aa-naranja); color: var(--alerta); }
.mode__title { font-family: var(--fuente-titulos); font-weight: 900; font-size: 18px; text-transform: uppercase; letter-spacing: .5px; }

.mail { border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.mail__meta { margin: 0; padding: 12px 14px; background: var(--fondo); display: grid; gap: 4px; font-size: 13.5px; }
.mail__meta div { display: grid; grid-template-columns: 60px 1fr; gap: 8px; }
.mail__meta dt { color: var(--texto-sec); }
.mail__meta dd { margin: 0; overflow-wrap: anywhere; }
.mail__body { padding: 14px 16px; font-size: 14.5px; }
.mail__body p { margin: 0 0 10px; }
.mail__heading { font-family: var(--fuente-titulos); font-weight: 900; font-size: 18px; color: var(--aa-azul); }
.mail__attach { margin: 0; padding: 10px 14px; border-top: 1px solid var(--borde); display: flex; align-items: center; gap: 8px; font-size: 13px; overflow-wrap: anywhere; }
.mail__clip { flex: none; background: var(--error); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 3px; }

/* --------------------------------------------------------------------------
   10. App funcional: mensajes, trabajos en curso y estados vacíos
   -------------------------------------------------------------------------- */
.flash { padding: 11px 14px; border-radius: var(--radio); border: 1px solid; font-size: 14.5px; }
.flash--ok    { background: var(--ok-fondo);     border-color: #b9dccb; color: var(--ok); }
.flash--error { background: var(--error-fondo);  border-color: #f0c1bc; color: var(--error); }
.flash--info  { background: var(--info-fondo);   border-color: var(--aa-azul-claro); color: var(--aa-azul); }

.job__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.job__head .card__title { margin-bottom: 4px; }
.job__meta { margin: 0 0 10px; color: var(--texto-sec); font-size: 13px; }
.job__log {
  margin: 0 0 12px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  background: #1f2a3d;
  color: #e6ebf5;
  border-radius: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.table__log { font-size: 13.5px; word-break: break-word; }

/* Cartera por categoría (Panel) */
.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cat {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px;
  border: 1px solid var(--borde); border-radius: var(--radio); border-top: 4px solid var(--aa-gris);
  color: inherit; text-decoration: none;
}
.cat:hover { background: #f8f9fc; }
.cat--cat1 { border-top-color: var(--aa-azul-claro); }
.cat--cat2 { border-top-color: var(--aa-azul-medio); }
.cat--cat3 { border-top-color: var(--aa-naranja); }
.cat__nombre { font-family: var(--fuente-titulos); font-weight: 900; font-size: 20px; color: var(--aa-azul); }
.cat__regla { color: var(--texto-sec); font-size: 13px; }
.cat__saldo { font-family: var(--fuente-titulos); font-weight: 800; font-size: 24px; color: var(--aa-azul); margin-top: 6px; }
.cat__track { height: 8px; border-radius: 6px; background: var(--info-fondo); overflow: hidden; margin: 4px 0 2px; }
.cat__fill { display: block; height: 100%; background: var(--aa-azul-medio); }
.cat--cat3 .cat__fill { background: var(--aa-naranja); }
.cat__meta { color: var(--texto-sec); font-size: 12.5px; }
.empty p { margin: 0 0 14px; color: var(--texto-sec); }
.form--spaced { margin-top: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   11. Seguimiento WSP (vista tipo WhatsApp Web)
   Colores de chat propios de la vista; la marca se mantiene en barra, botones y fichas.
   -------------------------------------------------------------------------- */
:root {
  --wsp-fondo-chat: #efeae2;
  --wsp-saliente:   #d9fdd3;
  --wsp-entrante:   #ffffff;
  --wsp-head:       #f0f2f5;
  --wsp-verde:      #25a35a;
  --wsp-leido:      #3b9ddd;
}

.wsp {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  height: 760px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.wsp:not(.wsp--abierto) { grid-template-columns: 340px minmax(0, 1fr); }

/* Chat en vivo */
.wsp__vivo-envio { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--wsp-head); }
.wsp__vivo-envio .wsp__responder { padding: 6px 14px; }
.wsp__vivo-envio .wsp__responder:first-child { padding-top: 10px; }
.wsp__vivo-envio .wsp__responder:last-child { padding-bottom: 10px; }
.wsp__vivo-envio .wsp__responder-input { flex: 1 1 0; min-width: 0; }
.wsp__vivo-envio .wsp__vars { flex: 0.7 1 0; }
.wsp__ejemplo { font-size: 11px; color: var(--texto-sec); font-style: italic; }
.wsp__pasos { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 4px; }
.wsp__aviso { margin: 10px 0 0; font-size: 13px; }
.wsp__refrescar { margin-top: 12px; width: 100%; }

/* Columna WSP en Contratos */
.wsp-col { display: inline-flex; flex-direction: column; gap: 2px; text-decoration: none; }
.wsp-col__meta { font-size: 11.5px; color: var(--texto-sec); }
.wsp-col:hover .badge { text-decoration: underline; }

/* Lista de chats */
.wsp__lista { display: flex; flex-direction: column; border-right: 1px solid var(--borde); min-height: 0; }
.wsp__lista-head { padding: 14px 16px 6px; display: flex; flex-direction: column; }
.wsp__lista-titulo { font-family: var(--fuente-titulos); font-weight: 900; font-size: 22px; color: var(--aa-azul); }
.wsp__linea { color: var(--texto-sec); font-size: 12.5px; }
.wsp__buscar { padding: 6px 12px; }
.wsp__buscar-input {
  width: 100%; min-height: 36px; padding: 6px 12px;
  border: 0; border-radius: 8px; background: var(--wsp-head); font: inherit; font-size: 14px;
}
.wsp__buscar-input:focus { outline: 2px solid var(--aa-azul-claro); }
.wsp__filtros { display: flex; gap: 6px; padding: 4px 12px 10px; overflow-x: auto; }
.wsp__chip {
  flex: none; padding: 4px 11px; border-radius: 999px; background: var(--wsp-head);
  color: var(--texto-sec); font-size: 13px; text-decoration: none;
}
.wsp__chip--activo { background: var(--info-fondo); color: var(--aa-azul); font-weight: 600; }
.wsp__chats { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.wsp__chat {
  display: flex; gap: 12px; padding: 11px 14px; color: inherit; text-decoration: none;
  border-bottom: 1px solid #eef0f4;
}
.wsp__chat:hover { background: #f5f6f8; }
.wsp__chat--activo { background: var(--info-fondo); }
.wsp__chat-cuerpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wsp__chat-cuerpo .badge { align-self: flex-start; margin-top: 3px; }
.wsp__chat-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.wsp__chat-nombre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsp__chat-hora { flex: none; font-size: 12px; color: var(--texto-sec); }
.wsp__chat-hora--nuevo { color: var(--wsp-verde); font-weight: 600; }
.wsp__chat-meta { font-size: 12px; color: var(--aa-azul-medio); }
.wsp__chat-preview { font-size: 13.5px; color: var(--texto-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsp__no-leidos {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--wsp-verde); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.wsp__vacio { padding: 20px 16px; color: var(--texto-sec); }

.wsp__avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-family: var(--fuente-titulos); font-weight: 800; font-size: 17px;
  background: var(--aa-azul-medio);
}
.wsp__avatar--codeudor { background: var(--aa-gris); }
.wsp__avatar--prueba { background: var(--wsp-verde); text-transform: uppercase; }

/* Conversación */
.wsp__conversacion { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wsp-fondo-chat); }
.wsp__conv-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--wsp-head); border-bottom: 1px solid var(--borde);
}
.wsp__ventana { margin-left: auto; flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.wsp__ventana--abierta { background: var(--ok-fondo); color: var(--ok); }
.wsp__ventana--cerrada { background: #e4e6ea; color: var(--texto-sec); }
.wsp__plantilla { background: transparent; padding: 0; font-size: 11.5px; color: var(--aa-azul-medio); }
.wsp__volver { display: none; text-decoration: none; color: var(--aa-azul); font-size: 22px; padding: 0 4px; }
.wsp__conv-datos { display: flex; flex-direction: column; min-width: 0; }
.wsp__conv-nombre { font-weight: 600; }
.wsp__conv-sub { font-size: 12.5px; color: var(--texto-sec); overflow-wrap: anywhere; }

/* column-reverse: el chat abre mostrando el último mensaje (sin JavaScript) */
.wsp__mensajes { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column-reverse; }
.wsp__mensajes-in { display: flex; flex-direction: column; gap: 6px; }
.wsp__dia { text-align: center; margin: 8px 0; }
.wsp__dia span {
  background: #fff; color: var(--texto-sec); font-size: 12px; padding: 4px 12px;
  border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.wsp__msg {
  max-width: min(78%, 560px); padding: 6px 9px 4px; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); display: flex; flex-direction: column; font-size: 14.5px;
}
.wsp__msg--saliente { align-self: flex-end; background: var(--wsp-saliente); border-top-right-radius: 2px; }
.wsp__msg--entrante { align-self: flex-start; background: var(--wsp-entrante); border-top-left-radius: 2px; }
.wsp__msg--error { background: #fdecea; }
.wsp__autor { font-size: 12px; font-weight: 600; color: var(--aa-azul-medio); margin-bottom: 2px; }
.wsp__texto { white-space: pre-line; overflow-wrap: anywhere; }
.wsp__error-detalle { margin-top: 4px; font-size: 12.5px; color: var(--error); }
.wsp__pie { align-self: flex-end; display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--texto-sec); margin-top: 2px; }
.wsp__check { letter-spacing: -3px; padding-right: 3px; color: var(--texto-sec); }
.wsp__check--leido { color: var(--wsp-leido); }
.wsp__check--error { color: var(--error); font-weight: 700; letter-spacing: 0; }

.wsp__adjunto {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-bottom: 6px;
  background: rgba(0, 0, 0, .05); border-radius: 6px;
}
.wsp__adjunto-icono { flex: none; background: var(--error); color: #fff; font-size: 10px; font-weight: 700; padding: 6px 5px; border-radius: 3px; }
.wsp__adjunto-datos { display: flex; flex-direction: column; min-width: 0; }
.wsp__adjunto-nombre { font-size: 13.5px; overflow-wrap: anywhere; }
.wsp__adjunto-meta { font-size: 11.5px; color: var(--texto-sec); }

.wsp__responder { display: flex; gap: 10px; padding: 10px 14px; background: var(--wsp-head); }
.wsp__responder-input { flex: 1; min-width: 0; min-height: 40px; padding: 8px 14px; border: 0; border-radius: 8px; font: inherit; }
.wsp__responder-input:focus { outline: 2px solid var(--aa-azul-claro); }
.wsp__enviar {
  flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--aa-naranja); color: #fff; font-size: 17px; cursor: pointer;
}

.wsp__bienvenida {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px; background: var(--wsp-head); color: var(--texto-sec);
}
.wsp__bienvenida-icono { font-size: 46px; }
.wsp__bienvenida h2 { font-weight: 800; font-size: 24px; color: var(--aa-azul); margin: 10px 0 6px; }
.wsp__bienvenida p { margin: 0; max-width: 360px; }

/* Ficha de seguimiento */
.wsp__ficha { border-left: 1px solid var(--borde); padding: 16px; overflow-y: auto; min-height: 0; }
.wsp__ficha .card__title { margin-bottom: 8px; }
.wsp__datos { margin: 14px 0; display: grid; gap: 8px; }
.wsp__datos div { border-bottom: 1px solid var(--borde); padding-bottom: 6px; }
.wsp__datos dt { font-size: 12px; color: var(--texto-sec); }
.wsp__datos dd { margin: 0; font-weight: 600; font-size: 14px; }
.wsp__saldo { font-family: var(--fuente-titulos); font-size: 19px !important; color: var(--aa-azul); }
.wsp__subtitulo { font-weight: 800; font-size: 16px; color: var(--aa-azul); margin: 14px 0 8px; }
.wsp__escala { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.wsp__escala-paso { display: flex; align-items: center; gap: 8px; color: var(--texto-sec); }
.wsp__escala-num {
  flex: none; width: 30px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  background: #eef0f4; font-family: var(--fuente-titulos); font-weight: 800; font-size: 13px;
}
.wsp__escala-paso--hecho .wsp__escala-num { background: var(--aa-azul); color: #fff; }
.wsp__escala-paso--actual { color: var(--texto); font-weight: 600; }
.wsp__escala-paso--actual .wsp__escala-num { background: var(--aa-naranja); color: #fff; }
.wsp__relacionados { margin: 0; padding-left: 18px; font-size: 14px; }
.wsp__acciones { display: grid; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------------------
   12. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .topbar__inner { grid-template-columns: auto 1fr; }
  .nav { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* La ficha de seguimiento pasa debajo de la conversación */
  .wsp, .wsp:not(.wsp--abierto) { grid-template-columns: 300px minmax(0, 1fr); height: auto; }
  .wsp__lista, .wsp__conversacion { height: 640px; }
  .wsp__ficha { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--borde); }
  .wsp__acciones { grid-template-columns: repeat(3, auto); justify-content: start; }
}

@media (max-width: 900px) {
  /* Celular/tableta: se ve la lista o el chat abierto, no ambos */
  .wsp, .wsp:not(.wsp--abierto) { grid-template-columns: 1fr; }
  .wsp--abierto .wsp__lista { display: none; }
  .wsp:not(.wsp--abierto) .wsp__conversacion { display: none; }
  .wsp__lista { border-right: 0; height: 560px; }
  .wsp__volver { display: inline; }
  .wsp__vivo-envio .wsp__responder { flex-wrap: wrap; }
  .wsp__vivo-envio .wsp__vars { flex: 1 1 100%; order: 2; }
  .wsp__mensajes { padding: 12px; }
  .wsp__acciones { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .grid--2, .grid--2-1 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters__search { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  :root { --margen: 16px; }
  .notice { margin: 12px var(--margen) 0; }
  .topbar__inner { grid-template-columns: 1fr; gap: 10px; }
  .topbar__app { padding-left: 0; border-left: 0; }
  .nav { overflow-x: auto; flex-wrap: nowrap; margin: 0 calc(var(--margen) * -1); padding: 0 var(--margen); }
  .nav__item { flex: none; padding: 8px 10px; }
  .page-head__title { font-size: 30px; }
  .steps { grid-template-columns: 1fr; }
  .form__row, .filters { grid-template-columns: 1fr; }
  .kpi__value { font-size: 28px; }
  .card { padding: 16px; }
  .btn { width: 100%; }
}

/* Recaudo diario (panel) */
.recaudo__col { min-width: 180px; }
.recaudo__track { display: block; height: 8px; border-radius: 999px; background: var(--info-fondo); overflow: hidden; margin-bottom: 4px; }
.recaudo__fill { display: block; height: 100%; background: var(--aa-azul-medio); border-radius: 999px; }

/* Compromisos de pago */
.card__head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card__head-row .card__title { margin-bottom: 0; }
.comentario { min-width: 260px; max-width: 520px; white-space: pre-line; overflow-wrap: anywhere; }
.card__subtitle { font-weight: 800; font-size: 16px; color: var(--aa-azul); margin: 22px 0 6px; }
.form__textarea { resize: vertical; min-height: 72px; font-family: inherit; width: 100%; }
.inline-form { display: inline; margin-left: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--error); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.th-orden { color: inherit; text-decoration: none; white-space: nowrap; }
.th-orden:hover { text-decoration: underline; }
.acciones-fila { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.acciones-fila .inline-form { margin-left: 0; }
.btn--sm { padding: 4px 10px; font-size: 12px; }

/* Archivos recibidos por WhatsApp */
.wsp__media { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.wsp__media-img { display: block; max-width: 240px; max-height: 260px; border-radius: 8px; object-fit: cover; }
.wsp__media-audio { width: 240px; max-width: 100%; height: 36px; }
.wsp__media-video { max-width: 260px; border-radius: 8px; }
.wsp__media-meta { font-size: 11.5px; color: var(--texto-sec); }
.wsp__adjunto--link { text-decoration: none; color: inherit; }

/* Periodo de cobranza (panel) */
.ciclos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ciclo { border: 1px solid var(--borde, #e3e7ee); border-top: 4px solid var(--aa-gris); border-radius: 10px; padding: 14px 16px; }
.ciclo--activo { border-top-color: var(--aa-azul); }
.ciclo__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ciclo__nombre { font-weight: 800; font-size: 17px; color: var(--aa-azul); }
.ciclo__fecha { font-size: 12.5px; color: var(--texto-sec); white-space: nowrap; }
.ciclo__rango { font-size: 12.5px; color: var(--texto-sec); margin: 6px 0 10px; }
.ciclo__pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ciclo__paso { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.ciclo__paso .badge { flex: none; min-width: 84px; text-align: center; }

/* Franja del periodo (todas las páginas) */
.periodo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; max-width: var(--ancho-max); margin: 12px auto 0;
  padding: 8px 16px; background: #fff; border: 1px solid var(--borde, #e3e7ee); border-left: 4px solid var(--aa-azul);
  border-radius: 8px; font-size: 13px; color: var(--aa-azul); }
.periodo-bar__muted, .periodo-bar__prox { color: var(--texto-sec); }
.periodo-bar__link { margin-left: auto; font-weight: 600; }
@media (max-width: 640px) { .periodo-bar { margin: 12px 16px 0; } .periodo-bar__link { margin-left: 0; } }

.aviso-gestion { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: var(--alerta-fondo, #fff4e5);
  border: 1px solid #f3d3a8; color: #8a4b0f; font-size: 14px; }
.aviso-gestion a { margin-left: 6px; font-weight: 600; }

/* Contratos: filtros rápidos y cambios del ciclo 2 */
.rapidos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.rapido { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--borde, #d9dee8); background: #fff; color: var(--aa-azul); text-decoration: none; }
.rapido b { font-weight: 700; color: var(--aa-azul-medio); }
.rapido:hover { border-color: var(--aa-azul-medio); }
.rapido--activo { background: var(--aa-azul); border-color: var(--aa-azul); color: #fff; }
.rapido--activo b { color: #fff; }
.saldo-delta { font-size: 11.5px; font-weight: 600; color: #b25b12; }
.saldo-delta--baja { color: var(--ok); }

/* ── Historial de periodos y avance por ciclo ── */
.lista-simple { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.lista-simple li { line-height: 1.45; }
.delta { font-size: 12px; font-weight: 700; white-space: nowrap; }
.delta--sube { color: var(--ok); }
.delta--baja { color: var(--error); }
.stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats--2 .stats__item .muted { display: block; margin-top: 4px; }
@media (max-width: 720px) { .stats--2 { grid-template-columns: 1fr; } }

/* ── Bandeja de WhatsApp (producción) ── */
.wsp__textarea { resize: none; max-height: 140px; line-height: 1.4; padding-top: 10px; }
.wsp__responder .btn--sm { align-self: center; white-space: nowrap; }
.wsp__bloqueo { margin: 0; padding: 10px 14px; font-size: 13px; color: var(--texto-sec); background: var(--wsp-head); }
.wsp__cita { display: block; border-left: 3px solid var(--aa-azul-claro); padding: 2px 8px; margin-bottom: 4px;
  font-size: 12.5px; color: var(--texto-sec); background: rgba(0, 0, 0, .04); border-radius: 4px; }
.wsp__plantilla-envio { padding: 6px 14px 10px; background: var(--wsp-head); font-size: 13.5px; }
.wsp__plantilla-envio summary { cursor: pointer; font-weight: 700; color: var(--aa-azul); padding: 4px 0; }
.wsp__plantilla-form { display: grid; gap: 8px; margin-top: 6px; }
.wsp__vars-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
/* Vista previa de la plantilla: burbuja saliente como la verá el cliente */
.wsp__previa { display: grid; gap: 4px; }
.wsp__previa-titulo { font-size: 12px; font-weight: 600; color: var(--texto-sec); }
.wsp__previa-burbuja { justify-self: end; max-width: 92%; max-height: 220px; overflow-y: auto; white-space: pre-line;
  background: #d9fdd3; border-radius: 8px 0 8px 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.wsp__previa-dato { background: rgba(0, 51, 102, .10); color: inherit; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.wsp__previa-falta { background: #ffe2c4; color: #9a4a00; border-radius: 3px; padding: 0 3px; font-weight: 600; }
.wsp__plantilla-form .btn { justify-self: start; }
.wsp__ficha-form { display: grid; gap: 10px; margin-top: 6px; }
.wsp__ficha-form .btn, .wsp__vincular .btn { justify-self: start; }
.wsp__vincular { margin-top: 14px; font-size: 13.5px; }
.wsp__vincular summary { cursor: pointer; font-weight: 700; color: var(--aa-azul); margin-bottom: 8px; }
.wsp__refresco { margin-top: 8px; }

/* Bandeja: mensaje que se está enviando (aparece antes de la respuesta de Meta) */
.wsp__msg--pendiente { opacity: .65; }


/* hidden siempre oculta, aunque la clase defina display (p. ej. .form__field) */
[hidden] { display: none !important; }

/* Bandeja: nota de voz. Sin texto se ve el micrófono; con texto, el botón ➤ (como en WhatsApp). */
.wsp__mic { display: inline-flex; align-items: center; justify-content: center; }
.wsp__responder--con-texto .wsp__mic,
.wsp__responder:not(.wsp__responder--con-texto) .wsp__enviar--texto { display: none; }
.wsp__responder--grabando > .wsp__textarea,
.wsp__responder--grabando > .wsp__mic,
.wsp__responder--grabando > .wsp__enviar--texto { display: none; }
.wsp__grabador { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
  background: #fff; border-radius: 8px; padding: 0 6px 0 10px; }
.wsp__grab-vivo { flex: 1; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.wsp__grab-punto { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: wsp-latido 1s ease-in-out infinite; }
@keyframes wsp-latido { 50% { opacity: .25; } }
.wsp__grab-tiempo { font-weight: 700; }
.wsp__grab-limite { font-size: 12px; }
.wsp__grab-audio { flex: 1; min-width: 0; height: 36px; }
.wsp__grab-btn { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent;
  color: var(--texto-sec); font-size: 16px; cursor: pointer; }
.wsp__grab-btn:hover { background: rgba(0, 0, 0, .06); }
.wsp__grabador .wsp__enviar { margin: 4px 0; }

/* Bandeja: ficha con pestañas (Deuda · Compromisos · Gestión) */
.wsp__ficha-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wsp__ficha-head .card__title { margin: 0; }
.wsp__contrato { margin: 10px 0 0; display: grid; gap: 2px; font-size: 13.5px; }
.wsp__contrato-num { font-weight: 800; color: var(--aa-azul); font-size: 15px; }
.wsp__contrato-nombre { font-weight: 600; }
.wsp__coincide { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #fff7ec; border: 1px solid #ffd9ad;
  display: grid; gap: 6px; font-size: 12.5px; }
.wsp__coincide-titulo { font-weight: 700; color: #9a4a00; }
.wsp__coincide-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wsp__tabs { display: flex; gap: 2px; margin: 14px 0 12px; border-bottom: 2px solid var(--borde); }
.wsp__tab { flex: 1; border: 0; background: none; padding: 8px 4px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--texto-sec); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.wsp__tab:hover { color: var(--aa-azul); }
.wsp__tab--activa { color: var(--aa-azul); border-bottom-color: var(--aa-naranja); }
.wsp__tab-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--borde);
  font-size: 11px; line-height: 18px; color: var(--texto); }
.wsp__vacio-ficha { font-size: 13px; margin: 6px 0; }
.wsp__deuda, .wsp__comp-actual { display: grid; gap: 4px; justify-items: start; padding: 10px 12px; border-radius: 8px;
  background: var(--wsp-head); margin-bottom: 10px; font-size: 13px; }
.wsp__deuda-label { font-size: 12px; color: var(--texto-sec); font-weight: 600; }
.wsp__deuda-nota { font-size: 11.5px; }
.wsp__deuda .wsp__saldo { font-size: 24px !important; font-weight: 800; line-height: 1.1; }
.wsp__datos--2 { grid-template-columns: 1fr 1fr; column-gap: 12px; margin-top: 4px; }
.wsp__datos--2 dd { font-size: 13px; }
.wsp__datos-ancho { grid-column: 1 / -1; }
.wsp__conceptos { font-weight: 400 !important; font-size: 12.5px !important; overflow-wrap: anywhere; }
.wsp__mora { font-weight: 700; }
.wsp__mora--alta { color: #c62828; }
.wsp__mora--media { color: #b45309; }
.wsp__mora--baja { color: #2e7d32; }
.wsp__links { font-size: 12.5px; margin: 8px 0 0; }
.wsp__comp-linea { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.wsp__comp-com { font-style: italic; color: var(--texto-sec); font-size: 12.5px; }
.wsp__comp-nuevo { margin: 4px 0 6px; font-size: 13.5px; }
.wsp__comp-nuevo summary { cursor: pointer; font-weight: 700; color: var(--aa-azul); padding: 4px 0; }
.wsp__comp-nuevo .form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wsp__historial { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wsp__hist { display: grid; gap: 3px; padding: 8px 0; border-bottom: 1px solid var(--borde); font-size: 12.5px; }
.wsp__hist--anterior { opacity: .65; }
.wsp__hist-fila { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wsp__hist-com { color: var(--texto); }
.wsp__hist-meta { font-size: 11.5px; }

/* Login y usuarios (autenticacion.py) */
.topbar__inner { grid-template-columns: auto auto 1fr auto; }
.topbar__usuario { display: flex; align-items: center; gap: 12px; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .28); }
.topbar__usuario-datos { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.topbar__usuario-nombre { font-weight: 600; font-size: 13.5px; color: #fff; white-space: nowrap; }
.topbar__usuario-rol { font-size: 11.5px; color: var(--aa-azul-claro); text-transform: uppercase; letter-spacing: .04em; }
.topbar__salir { color: #fff; font-size: 13px; text-decoration: none; padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; }
.topbar__salir:hover { background: rgba(255, 255, 255, .12); }
.notice--alerta { background: #fde2e1; color: #8a1c14; }
.form--solo-lider { opacity: .7; }
.acceso { min-height: 100vh; display: grid; place-items: center; background: var(--aa-azul); margin: 0; padding: 20px; }
.acceso__tarjeta { width: min(420px, 100%); background: #fff; border-radius: 14px; padding: 32px 30px; display: grid; gap: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.acceso__marca { display: grid; justify-items: center; gap: 4px; text-align: center; margin-bottom: 6px; }
.acceso__marca svg, .acceso__marca img { max-height: 56px; width: auto; }
.acceso__app { font-family: var(--fuente-titulos); font-weight: 800; font-size: 22px; color: var(--aa-azul); }
.acceso__area { font-size: 13px; color: var(--texto-sec); }
.acceso__titulo { margin: 0; font-family: var(--fuente-titulos); font-size: 24px; color: var(--aa-azul); }
.acceso__texto { margin: 0; color: var(--texto-sec); }
.acceso__boton { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; border-radius: 8px;
  background: #2f2f2f; color: #fff; text-decoration: none; font-weight: 600; }
.acceso__boton:hover { background: #111; }
.acceso__nota { margin: 0; font-size: 12.5px; color: var(--texto-sec); text-align: center; }
.usuarios__roles { margin: 0; display: grid; gap: 6px; }
.usuarios__roles dd { margin: 0 0 8px; font-size: 14px; }
.usuarios__acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.usuarios__detalle { font-size: 12.5px; overflow-wrap: anywhere; }
.fila--inactiva td { color: var(--texto-sec); }
.table--compacta td { padding: 6px 10px; font-size: 13px; }
td.num, th.num { text-align: right; }

/* Plantilla con PDF: el adjunto en la vista previa y el contrato del PDF en el chat de prueba */
.wsp__previa-doc { display: block; margin: -2px 0 8px; padding: 8px 10px; border-radius: 6px; background: rgba(0, 0, 0, .06);
  font-size: .85rem; font-weight: 600; word-break: break-word; }
.wsp__previa-doc--falta { background: #fdecea; color: #9b1c1c; font-weight: 600; }
.wsp__pdf-prueba { max-width: 260px; }
.wsp__contrato-pdf { width: 150px; flex: 0 0 auto; }
