/* ============================================================
   LEER SIEMPRE IA / CONTROL DEL CAMBIO - V0237

   OBJETIVO:
   - Login responsive y visible en Chrome, Edge, Firefox, Opera y Safari.
   - Evitar que la altura disponible del navegador o iPad oculte elementos.
   - Retirar visualmente el carrito y ordenar Buscar / Usuario.

   REGLA:
   - No alterar backend, campos, permisos ni validación del login.
   - Mantener los IDs usados por login_cmp.js.
============================================================ */
:root{
    --navy:#031f4c;
    --navy-2:#052a66;
    --blue:#074cb8;
    --green:#49a82e;
    --green-2:#63bf36;
    --text:#102449;
    --muted:#6b7791;
    --line:#d9e3f0;
    --soft:#f6f9fd;
    --white:#fff;
    --shadow:0 24px 70px rgba(7,28,69,.15);
    --shadow-soft:0 12px 30px rgba(7,28,69,.08);
    --radius:26px;
    --font:'Inter','Plus Jakarta Sans',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

*,*::before,*::after{box-sizing:border-box}
html{
    margin:0;
    min-height:100%;
    background:#f7fafc;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
}
body{
    margin:0;
    min-height:100vh;
    min-height:100svh;
    min-height:100dvh;
    font-family:var(--font);
    color:var(--text);
    background:#f7fafc;
    overflow-x:hidden;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    -webkit-font-smoothing:antialiased;
}
button,input{font-family:var(--font)}
button{-webkit-tap-highlight-color:transparent}
img{max-width:100%}

.ag-wrap{
    width:calc(100% - 32px);
    max-width:1280px;
    margin-right:auto;
    margin-left:auto;
}
.ag-page{
    position:relative;
    display:flex;
    flex-direction:column;
    min-height:100vh;
    min-height:100svh;
    min-height:100dvh;
    overflow-x:hidden;
    overflow-y:visible;
    background:linear-gradient(180deg,#fff 0%,#f4f8fb 88%);
}

.ag-topbar{
    height:31px;
    flex:0 0 31px;
    background:#06214b;
    color:#fff;
    font-size:12px;
    font-weight:700;
}
.ag-topbar-inner{
    height:31px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}
.ag-contact{display:flex;align-items:center;gap:12px;min-width:0}
.ag-contact i{color:#45c838;margin-right:6px}
.ag-sep{width:1px;height:14px;background:rgba(255,255,255,.35)}
.ag-social{
    width:24px;
    height:24px;
    flex:0 0 24px;
    border-radius:999px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    color:#45c838;
    text-decoration:none;
    border:1px solid rgba(255,255,255,.18);
}
.ag-topbar,.ag-topbar a,.ag-topbar span,.ag-topbar a[href],.ag-topbar a[href^="tel"],.ag-topbar a[href^="mailto"]{
    color:#fff!important;
    text-decoration:none;
}
.ag-topbar [x-apple-data-detectors],
.ag-topbar [x-apple-data-detectors-type="telephone"],
.ag-topbar [x-apple-data-detectors-type="email"]{
    color:#fff!important;
    text-decoration:none!important;
}
.ag-contact span{white-space:nowrap}

.ag-navbar{
    height:58px;
    flex:0 0 58px;
    background:#fff;
    border-bottom:1px solid #e8edf4;
    position:relative;
    z-index:5;
}
.ag-navbar-inner{
    height:58px;
    display:grid;
    grid-template-columns:minmax(190px,1fr) auto minmax(190px,1fr);
    align-items:center;
    column-gap:24px;
}
.ag-logo{
    display:flex;
    align-items:center;
    justify-self:start;
    min-width:0;
    text-decoration:none;
}
.ag-logo img{height:39px;max-width:220px;object-fit:contain}
.ag-logo-text{align-items:center;gap:8px;font-size:25px;color:#52565a}
.ag-logo-text b{color:#2c8b22}
.ag-mark{width:30px;height:30px;border-radius:50%;background:repeating-conic-gradient(var(--green) 0 12deg,transparent 12deg 24deg)}

.ag-menu{
    justify-self:center;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:28px;
    min-width:0;
    font-size:13px;
    font-weight:800;
    white-space:nowrap;
}
.ag-menu a{color:#06163a;text-decoration:none}
.ag-menu .active{color:#06163a;position:relative}
.ag-menu .active::after{content:"";position:absolute;left:0;right:0;bottom:-20px;height:2px;background:var(--green)}
.ag-menu i{font-size:10px;margin-left:3px}

.ag-icons{
    justify-self:end;
    min-width:190px;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:20px;
}
.ag-icons button{
    width:28px;
    height:34px;
    padding:0;
    border:0;
    background:transparent;
    color:#06163a;
    font-size:20px;
    position:relative;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}
/* Seguridad adicional: aunque un navegador conserve HTML antiguo, el carrito no se muestra. */
.ag-icons .cart{display:none!important}

.ag-main{
    position:relative;
    z-index:2;
    flex:1 0 auto;
    width:calc(100% - 32px);
    padding-top:16px;
    padding-bottom:24px;
}
.ag-desktop-shell{filter:drop-shadow(0 16px 28px rgba(7,28,69,.09))}
.ag-hero-card{
    width:100%;
    min-height:650px;
    border-radius:20px;
    background:#fff;
    display:grid;
    grid-template-columns:minmax(0,1fr) 330px;
    overflow:hidden;
    border:1px solid #e2e9f2;
}
.ag-hero-photo{
    min-width:0;
    min-height:650px;
    background-image:linear-gradient(90deg,rgba(3,25,65,.08),rgba(3,25,65,.18)),url('/CMP/assets/media/institucional/carlos-figueroa.webp');
    background-size:cover;
    background-position:center 38%;
    background-repeat:no-repeat;
}
.ag-login-card{
    min-width:0;
    background:#fff;
    padding:24px 28px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    box-shadow:-18px 0 55px rgba(7,28,69,.10);
    position:relative;
}
.ag-login-card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:1px;background:linear-gradient(180deg,transparent,#eef3f8,transparent)}
.ag-login-head{display:flex;align-items:center;gap:14px;margin-bottom:16px}
.ag-lock{width:54px;height:54px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#eef3fa;color:#041e4b;font-size:20px;flex:0 0 auto}
.ag-login-head h1{margin:0;font-size:25px;line-height:1;font-weight:900;color:#0b1f48;letter-spacing:-.04em}
.ag-login-head p{margin:8px 0 0;color:var(--muted);font-size:13px;font-weight:600}

.ag-respuesta{min-height:0}
.ag-saved-card{display:none;align-items:center;gap:10px;border:1px solid #bfe6b9;background:#f1faee;border-radius:14px;padding:11px 12px;margin-bottom:12px}
.ag-saved-check{width:34px;height:34px;border-radius:50%;background:#42a83a;color:#fff;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.ag-saved-text{display:flex;flex-direction:column;font-size:11px;color:#225d20;line-height:1.25;flex:1;min-width:0}
.ag-saved-text strong{font-size:12px;color:#155d19;margin-bottom:1px}
.ag-saved-text b{font-weight:900;color:#104314}
.ag-edit{width:32px;height:32px;border-radius:50%;border:0;background:#fff;color:#06429b;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 9px rgba(7,28,69,.10);cursor:pointer}

.ag-form{display:flex;flex-direction:column;gap:9px}
.ag-field{height:43px;border:1px solid var(--line);border-radius:8px;background:#fff;display:flex;align-items:center;gap:10px;padding:0 12px;box-shadow:0 1px 2px rgba(7,28,69,.03)}
.ag-field:focus-within{border-color:#7da8e7;box-shadow:0 0 0 3px rgba(7,76,184,.10)}
.ag-field i{width:16px;color:#0b2553;font-size:14px;flex:0 0 16px}
.ag-field input{min-width:0;border:0;outline:none;background:transparent;width:100%;height:100%;font-size:13px;font-weight:600;color:#102449;-webkit-appearance:none;appearance:none}
.ag-field input::placeholder{color:#6e7890}
.ag-pass button{border:0;background:transparent;color:#0b2553;cursor:pointer;font-size:15px;padding:0;flex:0 0 auto}
.ag-remember{display:flex;align-items:flex-start;gap:9px;border:1px solid #d9e3f0;background:#f7fbff;border-radius:10px;padding:9px 11px;margin:2px 0}
.ag-remember input{accent-color:#0a55cf;margin-top:2px;flex:0 0 auto}
.ag-remember span{display:flex;flex-direction:column;min-width:0}
.ag-remember strong{font-size:12px}
.ag-remember small{font-size:10px;color:#6b7791;line-height:1.25;margin-top:2px}
.ag-btn{height:42px;border-radius:9px;border:1px solid transparent;font-size:14px;font-weight:900;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;text-decoration:none}
.ag-btn-main{height:47px;background:linear-gradient(180deg,#0a57cc,#0642a3);color:#fff;box-shadow:0 12px 20px rgba(6,66,163,.22)}
.ag-btn-main:disabled{cursor:wait;opacity:.75}
.ag-btn-outline{background:#fff;color:#083a85;border-color:#aac4ea}
.ag-btn-green{background:#fff;color:#248323;border-color:#80cb6b}
.ag-secure{font-size:11px;color:#677489;line-height:1.45;margin:12px 0 0}
.ag-secure i{color:#40a935;margin-right:5px}

.ag-benefits{
    position:relative;
    z-index:2;
    margin:18px 0 0;
    background:#fff;
    border:1px solid #e2e9f2;
    border-radius:16px;
    box-shadow:var(--shadow-soft);
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    overflow:hidden;
}
.ag-benefits article{min-width:0;display:flex;align-items:center;gap:14px;padding:18px 20px;border-right:1px solid #e6edf5}
.ag-benefits article:last-child{border-right:0}
.ag-benefits span{width:50px;height:50px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:22px;flex:0 0 auto}
.ag-benefits .blue{background:#eef4fe;color:#0a3f96}
.ag-benefits .green{background:#eef9e9;color:#42a235}
.ag-benefits h3{margin:0 0 6px;text-transform:none;font-size:15px;color:#06307a;font-weight:900}
.ag-benefits p{margin:0;color:#62708a;font-size:12px;line-height:1.4;font-weight:600}
.ag-footer-note{position:relative;z-index:2;flex:0 0 auto;font-size:14px;color:#66758f;margin-top:0;margin-bottom:22px;font-weight:600}
.ag-footer-note i{color:#40a935;margin-right:8px}
.ag-wave{position:fixed;pointer-events:none;right:-120px;bottom:-145px;width:750px;height:250px;background:linear-gradient(180deg,#58ad2a 0 20%,#06214b 21% 100%);border-radius:50% 0 0 0;transform:rotate(-5deg);z-index:0}

.ag-mobile-only{display:none}
.ag-mobile-card{display:none}
.ag-mobile-logo{background:#fff;border:1px solid #e5edf6;border-radius:18px;box-shadow:0 14px 34px rgba(7,28,69,.08);padding:18px 16px;text-align:center}
.ag-mobile-logo img{display:block;width:100%;max-width:260px;height:auto;margin:0 auto}
.hidden-force{display:none!important}
.ag-alert{border-radius:10px;padding:10px 12px;font-size:12px;font-weight:700;margin-bottom:10px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.ag-alert-error{background:#fff1f1;color:#b42318;border:1px solid #ffc9c9}
.ag-alert-info{background:#eff6ff;color:#063b85;border:1px solid #bad6ff}

/* Escritorios con poca altura útil: conserva todo visible y compacto. */
@media (min-width:1025px) and (max-height:900px){
    .ag-main{padding-top:10px;padding-bottom:16px}
    .ag-hero-card,.ag-hero-photo{min-height:590px}
    .ag-login-card{padding-top:18px;padding-bottom:18px}
    .ag-login-head{margin-bottom:12px}
    .ag-form{gap:7px}
    .ag-benefits{margin-top:12px}
    .ag-benefits article{padding:13px 16px}
    .ag-benefits span{width:44px;height:44px;font-size:19px}
    .ag-benefits h3{font-size:14px;margin-bottom:3px}
    .ag-benefits p{font-size:11px}
    .ag-footer-note{margin-bottom:14px}
}

@media (min-width:1025px) and (max-height:760px){
    .ag-hero-card,.ag-hero-photo{min-height:540px}
    .ag-login-card{justify-content:flex-start;padding-top:16px;padding-bottom:16px}
    .ag-login-head{margin-bottom:10px}
    .ag-lock{width:46px;height:46px}
    .ag-login-head h1{font-size:22px}
    .ag-field{height:40px}
    .ag-btn{height:39px}
    .ag-btn-main{height:43px}
    .ag-secure{margin-top:8px}
}

@media (min-width:1025px) and (max-width:1200px){
    .ag-navbar-inner{grid-template-columns:minmax(165px,1fr) auto minmax(120px,1fr);column-gap:16px}
    .ag-menu{gap:17px;font-size:12px}
    .ag-icons{min-width:120px;gap:16px}
    .ag-logo img{max-width:185px}
    .ag-hero-card{grid-template-columns:minmax(0,1fr) 320px}
}

@media (max-width:1024px){
    .ag-navbar-inner{display:flex;align-items:center;justify-content:center}
    .ag-menu{display:none}
    .ag-icons{display:none}
    .ag-logo{justify-self:auto}
    .ag-hero-card{grid-template-columns:1fr;min-height:0;overflow:visible;border:0;background:transparent}
    .ag-hero-photo{display:none}
    .ag-login-card{box-shadow:0 18px 45px rgba(7,28,69,.10);border:1px solid #e5edf6;border-radius:22px;width:100%;max-width:420px;margin:0 auto}
    .ag-login-card::before{display:none}
    .ag-desktop-shell{filter:none;background:transparent}
    .ag-benefits{grid-template-columns:1fr 1fr}
    .ag-benefits article:nth-child(2){border-right:0}
    .ag-benefits article:nth-child(-n+2){border-bottom:1px solid #e6edf5}
}

@media (max-width:640px){
    .ag-wrap,.ag-main{width:calc(100% - 26px)}
    .ag-topbar{height:auto;flex-basis:auto;padding:8px 0;background:#06214b}
    .ag-topbar-inner{height:auto}
    .ag-contact{font-size:11px;gap:8px;flex-wrap:wrap;justify-content:flex-start}
    .ag-contact span,.ag-contact a,.ag-contact a[href],.ag-topbar [x-apple-data-detectors]{color:#7ce65f!important;font-weight:800}
    .ag-contact i{color:#7ce65f!important;margin-right:4px}
    .ag-social{display:none}
    .ag-navbar{height:62px;flex-basis:62px}
    .ag-navbar-inner{height:62px;justify-content:center}
    .ag-logo{min-width:0}
    .ag-logo img{height:46px}
    .ag-main{padding-top:12px;padding-bottom:18px}
    .ag-hero-card{display:block}
    .ag-login-card{padding:22px 18px 20px;border-radius:24px}
    .ag-login-head{justify-content:center;text-align:center;display:block;margin-bottom:16px}
    .ag-lock{margin:0 auto 10px;width:44px;height:44px}
    .ag-login-head h1{font-size:23px}
    .ag-login-head p{font-size:12px}
    .ag-saved-card{order:20;margin-top:6px}
    .ag-field{height:48px;border-radius:9px}
    .ag-field input{font-size:14px}
    .ag-remember{display:none}
    .ag-btn-main{height:50px}
    .ag-btn-outline{display:none}
    .ag-btn-green{height:46px}
    .ag-secure{display:none}
    .ag-benefits{display:none}
    .ag-mobile-card{display:block;margin:14px 0 4px}
    .ag-mobile-logo{padding:14px 12px;border-radius:16px}
    .ag-mobile-logo img{max-width:240px}
    .ag-footer-note{display:none}
    .ag-wave{width:420px;height:140px;bottom:-90px}
    .ag-desktop-shell{margin-bottom:16px}
}

/* Safari iOS/iPad: evita que la barra dinámica corte el contenido final. */
@supports (-webkit-touch-callout:none){
    body,.ag-page{
        min-height:-webkit-fill-available;
    }
    .ag-page{
        padding-bottom:env(safe-area-inset-bottom);
    }
    .ag-footer-note{
        padding-bottom:env(safe-area-inset-bottom);
    }
}
