/* =====================================================
   BCTM · TARJETA PÚBLICA
===================================================== */

:root{
  --primary:#29265B;
  --primary-light:#3B377A;
  --primary-dark:#1C193F;

  --white:#fff;
  --ink:#17152e;

  --soft:rgba(255,255,255,.72);
  --muted:rgba(255,255,255,.60);
  --line:rgba(255,255,255,.20);
  --glass:rgba(255,255,255,.09);
  --glass-hover:rgba(255,255,255,.15);

  --radius-sm:14px;
  --radius-md:18px;
  --radius-lg:20px;

  --shadow:0 25px 70px rgba(10,8,40,.35);
}

*{
  box-sizing:border-box;
}

html{
  width:100%;
  height:100%;
  min-height:100%;
  margin:0;

  background:#29265B;
}

body{
  width:100%;
  height:100%;
  min-height:100%;
  margin:0;

  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:#29265B;

  overflow:hidden;
}

/* En escritorio permitir scroll vertical */
@media (min-width: 769px){
  html,
  body{
    height:auto;
    min-height:100%;
  }

  body{
    overflow-x:hidden;
    overflow-y:auto;
  }
}

/* =====================================================
   CONTENEDOR GENERAL
===================================================== */

.app-shell{
  position:relative;
  width:100%;
  min-height:100svh;
  overflow:hidden;

  color:var(--white);

  background:
    radial-gradient(
      circle at 84% 14%,
      rgba(255,255,255,.12),
      transparent 27%
    ),
    radial-gradient(
      circle at 12% 90%,
      rgba(0,0,0,.18),
      transparent 32%
    ),
    linear-gradient(
      145deg,
      var(--primary-light) 0%,
      var(--primary) 48%,
      var(--primary-dark) 100%
    );
}

.app-shell::before,
.app-shell::after{
  content:"";
  position:absolute;

  border:1px solid rgba(255,255,255,.12);
  border-radius:50%;

  pointer-events:none;
}

.app-shell::before{
  width:340px;
  height:340px;
  top:-170px;
  right:-120px;
}

.app-shell::after{
  width:260px;
  height:260px;
  bottom:-140px;
  left:-100px;
}

/* =====================================================
   PANTALLAS
===================================================== */

.screen{
  position:absolute;
  inset:0;

  display:flex;
  flex-direction:column;

  padding:
    calc(24px + env(safe-area-inset-top))
    22px
    calc(24px + env(safe-area-inset-bottom));

  opacity:0;
  visibility:hidden;
  transform:translateY(18px);

  transition:
    opacity .35s ease,
    visibility .35s ease,
    transform .35s ease;

  overflow-y:auto;
}

.screen.active{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
}

/* =====================================================
   LOGO
===================================================== */

.brand-logo{
    position:relative;
    z-index:2;

    display:flex;
    align-items:center;
    justify-content:flex-start;

    margin-bottom:18px;
}

.brand-logo img{
    display:block;

    width:auto;
    height:72px;          /* Cambia este valor para hacerlo más grande o pequeño */
    max-width:260px;

    object-fit:contain;
    object-position:left center;

    filter:brightness(0) invert(1);
}

/* =====================================================
   CONTENIDO
===================================================== */

.content{
  position:relative;
  z-index:2;

  width:min(100%,540px);
  margin:auto;
  padding:44px 0;
}

/* Acercar el contenido al logo solamente en la pantalla inicial */
#screenWelcome .content{
  margin:24px auto 0;
  padding:20px 0 32px;
}

/* Mantener el nombre de la tarjeta en la parte inferior */
#screenWelcome .footer-note{
  margin-top:auto;
}

.eyebrow,
.admin-eyebrow{
  display:block;

  margin-bottom:14px;

  color:rgba(255,255,255,.62);

  font-size:.7rem;
  line-height:1.2;
  font-weight:800;
  letter-spacing:.18em;
  text-transform:uppercase;
}

h1,
h2{
  max-width:13ch;
  margin:0;

  color:var(--white);

  font-size:clamp(2.3rem,10vw,4.6rem);
  line-height:.98;
  letter-spacing:-.055em;
  font-weight:700;
}

h2{
  max-width:14ch;
  font-size:clamp(2.1rem,9vw,4rem);
}

.content > p{
    max-width:34ch;
    margin:20px 0 34px;

    color:var(--soft);

    font-size:1.06rem;
    font-weight:500;
    line-height:1.6;
}

/* =====================================================
   FORMULARIOS
===================================================== */

.form-stack{
  display:grid;
  gap:13px;
}

.form-stack label{
    color:var(--white);

    font-size:1.06rem;
    font-weight:800;
    line-height:1.6;
}

.form-stack input,
.form-stack textarea{
  width:100%;

  border:1px solid var(--line);
  border-radius:var(--radius-md);
  outline:0;

  color:var(--white);
  background:var(--glass);

  font:inherit;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10);

  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);

  transition:
    border-color .2s ease,
    background-color .2s ease,
    box-shadow .2s ease;
}

.form-stack input{
  height:60px;
  padding:0 16px;
}

.form-stack textarea{
  min-height:145px;
  padding:16px;
  resize:none;
  line-height:1.55;
}

.form-stack input::placeholder,
.form-stack textarea::placeholder{
  color:rgba(255,255,255,.44);
}

.form-stack input:focus,
.form-stack textarea:focus{
  border-color:rgba(255,255,255,.72);
  background:rgba(255,255,255,.13);

  box-shadow:
    0 0 0 4px rgba(255,255,255,.06);
}

/* =====================================================
   BOTÓN PRINCIPAL
===================================================== */

.form-stack button,
.main-button{
  width:100%;
  min-height:58px;
  padding:0 20px;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;

  border:0;
  border-radius:var(--radius-md);

  color:var(--ink);
  background:var(--white);

  font:inherit;
  font-size:.95rem;
  line-height:1.2;
  font-weight:800;

  text-decoration:none;

  box-shadow:var(--shadow);

  cursor:pointer;

  transition:
    transform .2s ease,
    box-shadow .2s ease,
    opacity .2s ease;
}

.form-stack button:hover,
.main-button:hover{
  transform:translateY(-1px);

  box-shadow:
    0 30px 80px rgba(10,8,40,.42);
}

.form-stack button:active,
.main-button:active{
  transform:scale(.985);
}

.form-stack button:disabled{
  opacity:.65;
  cursor:wait;
  transform:none;
}

/* =====================================================
   OPCIONES PRINCIPALES
===================================================== */

.options-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

/*
  Importante:
  Los <button> y los <a> reciben exactamente
  el mismo estilo para que no se vean movidos.
*/

.option-card{
  appearance:none;
  -webkit-appearance:none;

  width:100%;
  min-height:82px;
  margin:0;
  padding:14px 16px;

  display:grid;
  grid-template-columns:44px minmax(0,1fr);
  align-items:center;
  gap:13px;

  border:1px solid var(--line);
  border-radius:var(--radius-lg);

  color:var(--white);
  background:var(--glass);

  font:inherit;
  text-align:left;
  text-decoration:none;

  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);

  cursor:pointer;

  transition:
    transform .2s ease,
    background-color .2s ease,
    border-color .2s ease;
}

button.option-card{
  border:1px solid var(--line);
}

.option-card:hover{
  background:var(--glass-hover);
  border-color:rgba(255,255,255,.30);
}

.option-card:active{
  transform:scale(.985);
}

.option-icon{
  width:44px;
  height:44px;

  display:grid;
  place-items:center;

  border-radius:var(--radius-sm);

  color:var(--ink);
  background:var(--white);

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

  flex:none;
}

.option-card > span:last-child{
  min-width:0;
}

.option-card strong,
.option-card small{
  display:block;
}

.option-card strong{
  margin:0;

  color:var(--white);

  font-size:.98rem;
  line-height:1.3;
  font-weight:800;
}

.option-card small{
  margin-top:4px;

  color:var(--muted);

  font-size:.78rem;
  line-height:1.4;
  font-weight:400;
}

/* =====================================================
   BOTÓN REGRESAR
===================================================== */

.back-button{
  appearance:none;
  -webkit-appearance:none;

  position:absolute;
  z-index:5;

  top:calc(18px + env(safe-area-inset-top));
  right:18px;

  width:44px;
  height:44px;
  padding:0;

  display:grid;
  place-items:center;

  border:1px solid var(--line);
  border-radius:50%;

  color:var(--white);
  background:var(--glass);

  font:inherit;
  font-size:1.15rem;

  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);

  cursor:pointer;

  transition:
    transform .2s ease,
    background-color .2s ease;
}

.back-button:hover{
  background:var(--glass-hover);
  transform:translateY(-1px);
}

/* =====================================================
   PIE
===================================================== */

.footer-note{
  position:relative;
  z-index:2;

  margin:0;

  color:rgba(255,255,255,.5);

  text-align:center;
  font-size:.72rem;
  line-height:1.4;
}

/* =====================================================
   RESPUESTA IA
===================================================== */

.loading-card,
.answer-card,
.error-card{
  margin-top:18px;
  padding:20px;

  border:1px solid var(--line);
  border-radius:22px;

  background:rgba(255,255,255,.11);

  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

.loading-card{
  display:flex;
  align-items:center;
  gap:14px;
}

.loading-card[hidden],
.answer-card[hidden],
.error-card[hidden]{
  display:none;
}

.loading-card p{
  margin:0;

  color:var(--soft);
  line-height:1.5;
}

.answer-card p{
  margin:14px 0 18px;

  color:var(--white);
  line-height:1.6;
}

.answer-label{
  color:rgba(255,255,255,.62);

  font-size:.68rem;
  font-weight:800;
  letter-spacing:.16em;
}

.loader{
  width:24px;
  height:24px;
  flex:none;

  border:3px solid rgba(255,255,255,.25);
  border-top-color:var(--white);
  border-radius:50%;

  animation:spin .8s linear infinite;
}

.error-card{
  color:#fff;
  background:rgba(145,20,45,.28);
  line-height:1.5;
}

@keyframes spin{
  to{
    transform:rotate(360deg);
  }
}

/* =====================================================
   ADMINISTRADOR
===================================================== */

.admin-body{
  min-height:100vh;
  margin:0;

  color:#17172a;
  background:#f6f7fb;
}

.admin-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;

  padding:
    28px
    max(24px,calc((100% - 1240px)/2));

  color:var(--white);
  background:var(--primary);
}

.admin-topbar h1{
  margin:4px 0 0;

  color:var(--white);

  font-size:clamp(1.6rem,4vw,2.5rem);
  line-height:1.1;
}

.admin-topbar .admin-eyebrow{
  color:#cbc9ff;
}

.admin-logout{
  min-height:42px;
  padding:0 15px;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  border:1px solid rgba(255,255,255,.25);
  border-radius:12px;

  color:var(--white);
  background:transparent;

  font-size:.82rem;
  font-weight:700;

  text-decoration:none;
}

.admin-container{
  width:min(1240px,calc(100% - 32px));
  margin:28px auto 60px;

  display:grid;
  gap:24px;
}

.admin-panel{
  padding:24px;

  border:1px solid #e5e7ef;
  border-radius:22px;

  background:var(--white);

  box-shadow:
    0 18px 50px rgba(31,35,70,.06);
}

.admin-panel h2{
  margin:4px 0 22px;

  color:#17172a;

  font-size:1.45rem;
  line-height:1.2;
}

/* =====================================================
   FORMULARIO ADMINISTRADOR
===================================================== */

.admin-worker-form{
  display:grid;
  grid-template-columns:
    repeat(4,minmax(0,1fr))
    auto;

  gap:14px;
  align-items:end;
}

.admin-worker-form label,
.admin-form label{
  display:grid;
  gap:7px;

  color:#17172a;

  font-size:.8rem;
  line-height:1.3;
  font-weight:700;
}

.admin-worker-form input,
.admin-form input{
  width:100%;
  height:48px;
  padding:0 13px;

  border:1px solid #e5e7ef;
  border-radius:12px;
  outline:0;

  color:#17172a;
  background:var(--white);

  font:inherit;
}

.admin-worker-form input:focus,
.admin-form input:focus{
  border-color:var(--primary);

  box-shadow:
    0 0 0 3px rgba(41,38,91,.10);
}

.admin-worker-form button,
.admin-form button{
  min-height:48px;
  padding:0 18px;

  border:0;
  border-radius:12px;

  color:var(--white);
  background:var(--primary);

  font:inherit;
  font-weight:800;

  cursor:pointer;
}

/* =====================================================
   TABLA ADMINISTRADOR
===================================================== */

.admin-table-wrap{
  width:100%;
  overflow:auto;
}

.admin-table{
  width:100%;
  min-width:950px;

  border-collapse:collapse;
}

.admin-table th,
.admin-table td{
  padding:15px 13px;

  text-align:left;
  vertical-align:middle;

  border-bottom:1px solid #e5e7ef;
}

.admin-table th{
  color:#697086;

  font-size:.73rem;
  line-height:1.2;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
}

.admin-table td{
  color:#17172a;
}

.admin-table td strong,
.admin-table td small,
.admin-code{
  display:block;
}

.admin-table td small{
  margin-top:4px;

  color:#697086;
}

.admin-code{
  margin-top:7px;

  color:var(--primary);

  font-size:.7rem;
  font-weight:800;
}

/* =====================================================
   QR
===================================================== */

.admin-qr-card{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
}

.admin-qr-svg{
  width:220px;
  height:220px;
  padding:10px;

  border:1px solid #e5e7ef;
  border-radius:22px;

  background:var(--white);
}

.admin-qr-svg svg,
.admin-qr-svg canvas{
  display:block;

  width:100%!important;
  height:100%!important;
}

.admin-qr-actions,
.admin-url-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}

.admin-small-button,
.admin-small-link{
  min-height:34px;
  padding:0 12px;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  border:0;
  border-radius:9px;

  color:var(--primary);
  background:#ececf7;

  font:inherit;
  font-size:.72rem;
  font-weight:800;

  text-decoration:none;
  cursor:pointer;
}

.admin-url-link{
  display:block;

  max-width:330px;

  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;

  color:var(--primary);

  text-decoration:none;
}

/* =====================================================
   ESTADOS
===================================================== */

.admin-status{
  display:inline-block;

  padding:6px 9px;

  border-radius:99px;

  font-size:.72rem;
  font-weight:800;
}

.admin-status.is-active{
  color:#16865c;
  background:#e8f7f1;
}

.admin-status.is-inactive{
  color:#b4233b;
  background:#fdecef;
}

.admin-toggle-link{
  display:block;

  margin-top:8px;

  color:#697086;

  font-size:.74rem;

  text-decoration:none;
}

.admin-alert{
  padding:14px 16px;

  border-radius:13px;
}

.admin-alert-success{
  color:#16865c;
  background:#e8f7f1;
}

.admin-alert-error{
  color:#b4233b;
  background:#fdecef;
}

.admin-empty{
  color:#697086;
  text-align:center;
}

/* =====================================================
   LOGIN
===================================================== */

.login-body{
  min-height:100vh;
  margin:0;
  padding:24px;

  display:grid;
  place-items:center;

  background:
    linear-gradient(
      145deg,
      var(--primary-light),
      var(--primary) 55%,
      var(--primary-dark)
    );
}

.login-card{
  width:min(100%,430px);
  padding:32px;

  border-radius:24px;

  background:var(--white);

  box-shadow:
    0 35px 90px rgba(0,0,0,.22);
}

.login-card img{
  display:block;

  max-width:145px;
  max-height:52px;
  margin-bottom:22px;

  object-fit:contain;
}

.login-card h1{
  margin:4px 0 10px;

  color:#17172a;

  font-size:2rem;
  line-height:1.08;
  letter-spacing:-.04em;
}

.login-card p{
  color:#697086;
  line-height:1.5;
}

.login-card .admin-eyebrow{
  color:var(--primary);
}

.admin-form{
  display:grid;
  gap:15px;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media(min-width:700px){

  .screen{
    padding-right:42px;
    padding-left:42px;
  }

  .content{
    padding:60px 0;
  }

  .options-grid{
    grid-template-columns:1fr 1fr;
  }

}

@media(max-width:900px){

  .admin-worker-form{
    grid-template-columns:1fr 1fr;
  }

  .admin-worker-form button{
    grid-column:1/-1;
  }

}

@media(max-width:600px){

  .screen{
    padding:
      calc(20px + env(safe-area-inset-top))
      18px
      calc(20px + env(safe-area-inset-bottom));
  }

  .brand-logo img{
    max-width:135px;
    height:38px;
  }

  .content{
    padding:38px 0;
  }

  .option-card{
    min-height:80px;
  }

  .admin-topbar{
    padding:20px 18px;
  }

  .admin-topbar h1{
    font-size:1.5rem;
  }

  .admin-container{
    width:min(100% - 24px,1240px);
  }

  .admin-panel{
    padding:20px;
  }

  .admin-worker-form{
    grid-template-columns:1fr;
  }

  .admin-worker-form button{
    grid-column:auto;
  }

  /* =====================================================
   QR ADMINISTRADOR · TAMAÑO CORREGIDO
===================================================== */

.admin-qr-card{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
}

.admin-qr-svg{
  width:132px;
  height:132px;
  padding:6px;

  border:1px solid #e5e7ef;
  border-radius:16px;

  background:#fff;

  box-shadow:
    0 8px 22px rgba(31,35,70,.06);
}

.admin-qr-svg svg,
.admin-qr-svg canvas{
  display:block;
  width:100%!important;
  height:100%!important;
}

.admin-qr-actions{
  display:flex;
  align-items:center;
  gap:6px;
}

.admin-qr-actions .admin-small-button{
  min-width:48px;
  min-height:30px;
  padding:0 10px;

  border-radius:8px;

  font-size:.68rem;
}

}