/* =========================================================
   emx-theme.css — Aero Minimal EAM (LIMPIO / SIN DUPLICADOS)
   Ajustes:
   - Whats pill verde (texto blanco) + número navy
   - Tipografía menos pesada + título menos tosco
   - Logo SIEMPRE controlado (no gigante)
   - Botón Seleccionar archivo CHIQUITO y en la MISMA LÍNEA
   - Gradiente vertical top->bottom más notorio
   - Pills más juntas (roles y subroles)
   ========================================================= */

/* ========== 1) TOKENS ========== */
:root{
  --emx-primary: #0b1f3f;
  --emx-accent: #f2c230;
  --emx-accent-600: #d4a90f;

  --emx-border: #e5e7eb;
  --emx-border-soft: rgba(229,231,235,.75);

  --emx-text: #0f172a;
  --emx-muted: #6b7280;

  --emx-surface: #ffffff;
  --emx-surface-soft: #f7f9fc;

  --emx-success: #16a34a;
  --emx-danger: #dc2626;

  --emx-radius: 16px;
  --emx-radius-sm: 12px;

  --emx-shadow: 0 18px 45px rgba(0,0,0,.16);
  --emx-shadow-soft: 0 10px 28px rgba(0,0,0,.10);

  --emx-ring: 0 0 0 3px color-mix(in srgb, var(--emx-accent) 22%, transparent);

  --emx-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
}

/* ========== 2) FONDO (definitivo) ========== */
html{
  min-height: 100%;
  background: linear-gradient(180deg,
    #0b1f3f 0%,
    #081a33 35%,
    #07162d 100%
  );
  background-attachment: fixed;
}

body{
  min-height: 100%;
  margin: 0;
  background: transparent !important;
  color: var(--emx-text);
  font-family: var(--emx-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* glow arriba (definitivo) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 420px at 50% 0%,
      rgba(0,140,255,.28),
      transparent 62%
    );
  opacity: 1;
}

/* links */
a{ color: var(--emx-primary); }
a:hover{ color: var(--emx-primary); }

/* ========== 3) CONTENEDOR ========== */
.container{
  max-width: 740px;
  margin: 24px auto;
  background: var(--emx-surface);
  border: 1px solid var(--emx-border-soft);
  border-radius: var(--emx-radius);
  box-shadow: var(--emx-shadow);
  padding: 26px;
  position: relative;
  z-index: 1;
}

/* reset cajas internas */
.card,.panel,.box,.contenedor,.container-card{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* ========== 4) TIPOGRAFÍA / HEADERS ========== */
h1,h2,h3,h4,h5,h6{
  color: var(--emx-primary);
  margin: 0.2rem 0 0.6rem;
}

.form-header{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:.35rem;
  margin-bottom:.75rem;
}

/* FIX LOGO gigante */
.form-header img{
  width: 110px;
  max-width: 110px;
  height: auto;
  display:block;
}

.form-header h2{
  font-size: 1.22rem;
  font-weight: 650 !important;
  letter-spacing: -0.02em;
  text-align:center;
  margin:0;
}

h3{
  font-weight: 650;
  margin-top: 16px;
}

label{
  display:block;
  font-weight: 600;
  color:#0f172a;
  margin-top: 12px;
  margin-bottom: 6px;
}

/* ========== 5) INPUTS ========== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
textarea,
select,
.form-control{
  border: 1px solid var(--emx-border);
  border-radius: var(--emx-radius-sm);
  outline: none;

  width: 100% !important;
  max-width: 100% !important;
  display:block;
  box-sizing:border-box;

  padding: 12px 14px;
  min-height: 46px;
  font-size: 15px;

  background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease;
}

input:focus,
textarea:focus,
select:focus,
.form-control:focus{
  border-color: var(--emx-accent);
  box-shadow: var(--emx-ring);
}

::placeholder{
  color: color-mix(in srgb, var(--emx-muted) 80%, transparent);
}

input.readonly[readonly]{
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
}

/* ========== 6) BOTONES ========== */
button,
.btn,
.btn-primary,
.btn-seleccionar,
input[type="submit"],
input[type="button"]{
  background: var(--emx-primary) !important;
  border: 1px solid var(--emx-primary) !important;
  color: #fff !important;

  border-radius: 14px;
  padding: 12px 16px;
  min-height: 46px;

  font-weight: 650;
  letter-spacing: .12px;

  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  box-shadow: 0 8px 18px rgba(11,31,63,.18);
}

button:hover,
.btn:hover,
.btn-primary:hover,
.btn-seleccionar:hover,
input[type="submit"]:hover,
input[type="button"]:hover{
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(11,31,63,.22);
}

button:active,
.btn:active{
  transform: translateY(0);
  box-shadow: 0 7px 16px rgba(11,31,63,.18);
}

/* Botón “Subir captura” con gradiente mínimo */
#formCaptura .btn{
  background: linear-gradient(180deg, #0b1f3f, #071a33) !important;
  border-color: rgba(255,255,255,.12) !important;
}

/* PDF */
.btn-pdf{
  background: var(--emx-primary) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 999px !important;
  padding: 10px 14px !important;
  min-height: auto !important;
  font-weight: 650 !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}

.btn-back{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;

  font-size: 2.0rem;
  line-height: 1;

  width: 52px;
  height: 52px;
  border-radius: 14px;

  color: var(--emx-primary);
  font-weight: 650;
  transition: color .2s, background .2s, transform .15s;
}

.btn-back:hover{
  color:#19375e;
  background: rgba(11,31,63,.06);
  transform: translateY(-1px);
}

/* ========== 7) ROLES (COMPACT) ========== */
.roles-container{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  text-align:center;
  margin-top: 10px;

  gap: 6px !important;
  row-gap: 6px !important;
  column-gap: 6px !important;
}

.roles-container > *{ margin:0 !important; }

.rol-btn{
  border:none;
  background:transparent;
  padding:0;
  margin:0 !important;
}

.rol-btn input[type="radio"]{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.rol-btn span{
  display:inline-block;
  margin:0 !important;

  padding: .44rem .90rem !important;
  border-radius: 999px;

  background: #eef3f9;
  color: var(--emx-primary);
  border: 1px solid var(--emx-border-soft);

  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .12px;

  transition: background .15s, color .15s, box-shadow .15s, transform .15s;
  box-shadow: 0 1px 0 rgba(255,255,255,.75) inset;
}

.rol-btn span:hover{
  background:#fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2,10,25,.10);
}

.rol-btn input[type="radio"]:checked + span{
  background: var(--emx-primary);
  color:#fff;
  border-color: var(--emx-primary);
  box-shadow: 0 12px 30px rgba(11,31,63,.18);
}

/* ========== 8) SUBROLES (COMPACT) ========== */
.subroles-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 10px;

  gap: 6px !important;
  row-gap: 6px !important;
  column-gap: 6px !important;
}

.subroles-grid > *{ margin:0 !important; }

.subrole-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  margin:0 !important;
  padding: .44rem .85rem !important;
  min-height: 44px !important;
  border-radius: 12px !important;

  background: #f1f5f9 !important;
  color: var(--emx-primary) !important;
  border: 1px solid rgba(15,23,42,.10) !important;

  font-weight: 600 !important;
  font-size: 14px;
  letter-spacing: .12px;

  cursor:pointer;
  user-select:none;
  box-shadow: none !important;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

.subrole-btn:hover{
  background: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2,10,25,.10) !important;
}

.subrole-btn.active,
.subrole-btn[aria-pressed="true"]{
  background: var(--emx-primary) !important;
  color:#fff !important;
  border-color: var(--emx-primary) !important;
  box-shadow: 0 12px 30px rgba(11,31,63,.16) !important;
}

/* ========== 9) MODAL ========== */
.emx-modal{ position: fixed; inset: 0; display: none; z-index: 9999; }
.emx-modal.is-open{ display: block; }

/* Modal scrolleable en pantallas chicas */
.emx-modal{
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.emx-modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(11,31,63,.62);
  backdrop-filter: blur(6px);
}

.emx-modal__card{
  position:relative;
  width: min(660px, calc(100% - 32px));
  margin: 6vh auto 0 auto;
  background:#fff;
  border-radius: 18px;
  box-shadow: 0 26px 70px rgba(0,0,0,.24);
  overflow:hidden;
  border: 1px solid rgba(229,231,235,.80);
}

@media (max-width: 420px){
  .emx-modal__card{ margin-top: 4vh; border-radius: 16px; }
}

.emx-modal__header{
  padding: 18px 18px 12px 18px;
  background: linear-gradient(180deg, rgba(11,31,63,.06), rgba(11,31,63,0));
}

.emx-modal__title{
  margin: 0;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--emx-primary);
}

.emx-modal__body{ padding: 14px 18px 16px; }

.emx-modal__alert{
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .04);
  border: 1px solid rgba(15, 23, 42, .10);
  color: #0f172a;
  font-size: .95rem;
  margin-bottom: 12px;
}
.emx-modal__alert b{ color: var(--emx-primary); }

.emx-modal__list{ margin:0; padding-left: 18px; color:#1f2937; }
.emx-modal__list li{ margin:10px 0; line-height:1.35; }
.emx-modal__list b{ color: var(--emx-primary); }

.emx-modal__contact{
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: var(--emx-surface-soft);
  border: 1px solid var(--emx-border);
}

.emx-modal__contactTitle{
  font-weight: 650;
  color: var(--emx-primary);
  margin-bottom: 8px;
}

.emx-modal__contactRow{
  display:flex;
  gap:10px;
  align-items:center;
  margin: 8px 0;
  flex-wrap: wrap;
}

.emx-modal__pill{
  display:inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(11,31,63,.08);
  color: var(--emx-primary);
  font-weight: 600;
  font-size: .85rem;
  border: 1px solid rgba(15,23,42,.10);
}

/* Whats pill verde */
.emx-modal__contactRow:has(.emx-modal__link[href*="wa.me"]) .emx-modal__pill{
  background: #25D366 !important;
  color: #fff !important;
  border: 1px solid rgba(0,0,0,.10) !important;
  box-shadow: 0 10px 20px rgba(37,211,102,.22) !important;
}

/* fallback por si :has no está soportado */
@supports not(selector(:has(*))){
  .emx-modal__contactRow:first-child .emx-modal__pill{
    background: #25D366 !important;
    color: #fff !important;
    border: 1px solid rgba(0,0,0,.10) !important;
  }
}

/* link navy */
.emx-modal__link{
  color: var(--emx-primary) !important;
  text-decoration: underline;
  font-weight: 600;
}

.emx-modal__footer{
  padding: 14px 18px 18px;
  display:flex;
  justify-content:flex-end;
}

.emx-modal__btn{
  border:0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--emx-primary);
  color:#fff;
  font-weight: 650;
  cursor:pointer;
  min-height: 46px;
}

/* ========== 10) FORM CAPTURA (label + botón en la MISMA LÍNEA) ========== */
#formCaptura > label:first-of-type{
  display: inline;
  margin: 0;
  font-weight: 600;
}

/* Botón mini definitivo */
#formCaptura .btn-file{
  display: inline-flex !important;
  vertical-align: middle;
  margin-left: 10px;
  margin-top: 0 !important;

  min-height: 32px !important;
  padding: 6px 10px !important;
  font-size: 12.5px !important;
  border-radius: 10px !important;

  box-shadow: 0 8px 18px rgba(11,31,63,.12) !important;
}

#nombreArchivo{
  margin-top: 8px !important;
  color: #475569 !important;
  font-size: 13px !important;
}

/* ========== 11) TEXTO ROJO ELEGANTE ========== */
p span[style*="color:red"],
p[style*="color:#c00"],
p[style*="color:red"],
#facturaMensaje{
  color: #b91c1c !important;
  font-weight: 600 !important;
}

p b{ font-weight: 650; }
p{ line-height: 1.45; }

/* ========== 12) MOBILE: roles full-width ========== */
@media (max-width: 520px){
  .roles-container{
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px !important;
    justify-content: initial;
    align-items: stretch;
    text-align: center;
  }

  .rol-btn{ display:block; width:100%; }

  .rol-btn span{
    display:flex;
    align-items:center;
    justify-content:center;

    width: 100%;
    min-height: 44px !important;
    padding: 9px 12px !important;

    border-radius: 14px;
    font-size: 15px;
    letter-spacing: .12px;
  }

  .subroles-grid{
    gap: 6px !important;
    margin-top: 8px !important;
  }

  .subrole-btn{
    min-height: 44px !important;
    padding: 9px 12px !important;
    border-radius: 14px !important;
  }
}

/* ==========================
   UX Pills: no foco fantasma
========================== */

/* iOS/Safari highlight */
.rol-btn span,
.subrole-btn,
.emx-pill{
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Quita glow/outline raro en mobile */
.rol-btn span:focus,
.subrole-btn:focus,
.emx-pill:focus{
  outline: none !important;
  box-shadow: none !important;
}

/* Solo accesibilidad real */
.rol-btn span:focus-visible,
.subrole-btn:focus-visible,
.emx-pill:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--emx-accent) 55%, transparent);
  outline-offset: 2px;
}

/* Hover desktop: el seleccionado NO se vuelve blanco */
.rol-btn input[type="radio"]:checked + span:hover{
  background: var(--emx-primary) !important;
  color: #fff !important;
  transform: none !important;
}

.subrole-btn.active:hover,
.subrole-btn[aria-pressed="true"]:hover{
  background: var(--emx-primary) !important;
  color:#fff !important;
  transform: none !important;
}

/* Pills de cambio (Rol) */
.emx-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: .44rem .90rem !important;
  border-radius: 999px;
  background: #eef3f9;
  color: var(--emx-primary);
  border: 1px solid var(--emx-border-soft);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .12px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

.emx-pill:hover{
  background:#fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2,10,25,.10);
}

.emx-pill--change{
  background: var(--emx-accent) !important;
  color: #0b1f3f !important;
  border-color: color-mix(in srgb, var(--emx-accent) 65%, #000 0%) !important;
}

/* “Cambiar de concepto” con aire */
.emx-concept-change{
  margin-top: 10px !important;
}

/* Mobile: si no cabe, full width */
@media (max-width: 520px){
  #btnCambiarRol,
  #btnCambiarConcepto{
    width: 100%;
    justify-content:center;
  }
}

/* Cambiar de rol = MISMO estilo que subrole-btn (Cambiar de concepto) */
#btnCambiarRol.emx-pill--change{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  margin:0 !important;
  padding: .44rem .85rem !important;
  min-height: 44px !important;
  border-radius: 12px !important;

  background: #f1f5f9 !important;
  color: var(--emx-primary) !important;
  border: 1px solid rgba(15,23,42,.10) !important;

  font-weight: 600 !important;
  font-size: 14px !important;
  letter-spacing: .12px;

  cursor:pointer;
  user-select:none;
  box-shadow: none !important;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

#btnCambiarRol.emx-pill--change:hover{
  background: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2,10,25,.10) !important;
}

/* iOS: sin brillo/pressed pegado */
#btnCambiarRol.emx-pill--change:active{
  transform: none !important;
  box-shadow: none !important;
}

.roles-container,
#btnCambiarRol,
#btnCambiarConcepto,
.subroles-grid,
.emx-pill--change{
  margin-bottom: 6px !important;
}

#btnCambiarRol,
#btnCambiarConcepto{
  margin-top: 0 !important;
}
