:root{
  --azul:#151f44;
  --azul-2:#223062;
  --naranja:#ff8200;
  --fondo:#f3f5f9;
  --linea:#e3e7ef;
  --texto:#18233f;
  --muted:#667085;
  --verde:#18a058;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  background:var(--fondo);
  color:var(--texto);
  font-family:Segoe UI,Arial,sans-serif;
}

button,
input{
  font:inherit;
}

button{
  border:0;
}

#portalCliente{
  max-width:1280px;
  margin:auto;
  padding:28px;
}

.portal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:18px;
  min-height:44px;
}

.portal-brand{
  display:inline-flex;
  align-items:center;
  text-decoration:none;
}

.brand-logo{
  width:min(230px,58vw);
  height:auto;
  display:block;
}

.portal-status{
  background:#fff;
  border:1px solid var(--linea);
  border-radius:999px;
  color:var(--azul);
  font-weight:700;
  padding:10px 16px;
  box-shadow:0 8px 24px rgba(21,31,68,.08);
  white-space:nowrap;
}

.portal-layout{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(300px,1fr);
  gap:22px;
  align-items:start;
}

.portal-main-card,
.portal-side-card{
  background:#fff;
  border:1px solid var(--linea);
  border-radius:8px;
  box-shadow:0 16px 40px rgba(21,31,68,.08);
}

.portal-main-card{
  padding:22px;
}

.portal-side-card{
  padding:24px;
  position:sticky;
  top:22px;
}

.hero-card{
  background:linear-gradient(135deg,var(--azul),var(--azul-2));
  border-radius:8px;
  color:#fff;
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(320px,.78fr);
  gap:26px;
  padding:26px 28px;
  margin-bottom:18px;
}

.hero-card.auto-access{
  grid-template-columns:1fr;
}

.badge{
  background:var(--naranja);
  border-radius:999px;
  display:inline-flex;
  font-size:13px;
  font-weight:800;
  letter-spacing:.02em;
  margin-bottom:14px;
  padding:8px 13px;
  text-transform:uppercase;
}

.hero-card h1{
  font-size:34px;
  line-height:1.08;
  margin-bottom:10px;
}

.hero-card p{
  color:rgba(255,255,255,.82);
  line-height:1.5;
}

.search-box{
  background:#fff;
  border-radius:8px;
  color:var(--texto);
  padding:18px;
}

.search-box.is-hidden{
  display:none;
}

.search-box label{
  color:var(--azul);
  display:block;
  font-size:14px;
  font-weight:800;
  margin-bottom:9px;
}

.search-row{
  display:flex;
  gap:10px;
}

.search-row input{
  border:1px solid var(--linea);
  border-radius:8px;
  min-width:0;
  outline:none;
  padding:13px 14px;
  width:100%;
}

.search-row input:focus{
  border-color:var(--naranja);
  box-shadow:0 0 0 3px rgba(255,130,0,.16);
}

.search-row button,
.actions-grid button,
.help-box button{
  background:var(--naranja);
  border-radius:8px;
  color:#fff;
  cursor:pointer;
  font-weight:800;
  padding:13px 18px;
  transition:transform .18s ease, box-shadow .18s ease;
  white-space:nowrap;
}

.search-row button:hover,
.actions-grid button:hover,
.help-box button:hover{
  box-shadow:0 10px 20px rgba(255,130,0,.22);
  transform:translateY(-1px);
}

.form-message{
  color:var(--muted);
  font-size:13px;
  min-height:19px;
  margin-top:10px;
}

.form-message.error{
  color:#c2410c;
}

.form-message.ok{
  color:var(--verde);
}

.info-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-bottom:18px;
}

.info-box,
.section-card{
  background:#f8fafd;
  border:1px solid var(--linea);
  border-radius:8px;
}

.info-box{
  min-height:104px;
  padding:17px;
}

.info-box span,
.ruta-box span,
.summary-grid span{
  color:var(--muted);
  display:block;
  font-size:13px;
  margin-bottom:8px;
}

.info-box strong{
  color:var(--azul);
  display:block;
  font-size:19px;
  line-height:1.2;
  overflow-wrap:anywhere;
}

.section-card{
  margin-top:18px;
  padding:22px;
}

.section-card h2,
.portal-side-card h2{
  color:var(--azul);
  font-size:21px;
  margin-bottom:17px;
}

.ruta-box{
  align-items:center;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:18px;
}

.ruta-box strong{
  color:var(--texto);
  display:block;
  font-size:22px;
  line-height:1.2;
}

.ruta-box small{
  color:var(--muted);
  display:block;
  font-size:13px;
  line-height:1.35;
  margin-top:8px;
}

.ruta-arrow{
  align-items:center;
  background:rgba(255,130,0,.12);
  border-radius:999px;
  color:var(--naranja);
  display:flex;
  font-size:26px;
  font-weight:900;
  height:44px;
  justify-content:center;
  width:44px;
}

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

.summary-grid div{
  background:#fff;
  border:1px solid var(--linea);
  border-radius:8px;
  padding:16px;
}

.summary-grid .full-row{
  grid-column:1 / -1;
}

.summary-grid strong{
  color:var(--azul);
  display:block;
  font-size:20px;
  line-height:1.2;
}

.payment-card{
  background:#fff;
}

.payment-head{
  align-items:flex-start;
  display:flex;
  gap:18px;
  justify-content:space-between;
  margin-bottom:16px;
}

.payment-head h2{
  margin-bottom:7px;
}

.payment-head p{
  color:var(--muted);
  line-height:1.45;
}

.payment-head button{
  background:var(--naranja);
  border-radius:8px;
  color:#fff;
  cursor:pointer;
  font-weight:800;
  padding:13px 18px;
  white-space:nowrap;
}

.payment-head button:disabled{
  background:#aab2c2;
  cursor:not-allowed;
}

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

.payment-grid div{
  background:#f8fafd;
  border:1px solid var(--linea);
  border-radius:8px;
  padding:16px;
}

.payment-grid span{
  color:var(--muted);
  display:block;
  font-size:13px;
  margin-bottom:8px;
}

.payment-grid strong{
  color:var(--azul);
  display:block;
  font-size:21px;
  line-height:1.2;
}

.payment-grid .saldo-box{
  border-color:rgba(255,130,0,.38);
  background:#fff8ef;
}

.payment-grid .saldo-box strong{
  color:#c55f00;
}

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

.actions-grid button.secondary{
  background:var(--azul);
}

.actions-grid button:disabled{
  background:#aab2c2;
  box-shadow:none;
  cursor:not-allowed;
  transform:none;
}

.timeline{
  display:grid;
  gap:18px;
}

.timeline-item{
  align-items:center;
  color:var(--muted);
  display:flex;
  gap:13px;
}

.timeline-item span{
  background:#d5dae5;
  border:4px solid #eef1f6;
  border-radius:50%;
  flex:0 0 auto;
  height:18px;
  width:18px;
}

.timeline-item.active{
  color:var(--texto);
  font-weight:700;
}

.timeline-item.active span{
  background:var(--verde);
  border-color:rgba(24,160,88,.16);
}

.help-box{
  background:#f8fafd;
  border:1px solid var(--linea);
  border-radius:8px;
  margin-top:26px;
  padding:20px;
}

.detail-box{
  background:#f8fafd;
  border:1px solid var(--linea);
  border-radius:8px;
  margin-top:26px;
  padding:20px;
}

.detail-box h3,
.help-box h3{
  color:var(--azul);
  font-size:18px;
  margin-bottom:8px;
}

.detail-box p{
  color:var(--texto);
  font-size:14px;
  line-height:1.55;
  max-height:220px;
  overflow:auto;
  white-space:pre-line;
}

.help-box p{
  color:var(--muted);
  line-height:1.45;
  margin-bottom:16px;
}

.help-box button{
  width:100%;
}

.detalle-carga-texto{
  color:var(--texto);
  font-size:14px;
  line-height:1.5;
}

.detalle-carga-acordeon{
  display:grid;
  gap:8px;
  max-height:330px;
  overflow:auto;
  padding-right:4px;
}

.detalle-carga-grupo{
  background:#f8fafd;
  border:1px solid var(--linea);
  border-radius:8px;
  overflow:hidden;
}

.detalle-carga-grupo summary{
  align-items:center;
  cursor:pointer;
  display:grid;
  gap:10px;
  grid-template-columns:minmax(0,1fr) auto;
  list-style:none;
  padding:11px 12px;
}

.detalle-carga-grupo summary::-webkit-details-marker{
  display:none;
}

.detalle-carga-grupo summary span{
  color:var(--azul);
  font-weight:800;
  min-width:0;
}

.detalle-carga-grupo summary strong{
  color:var(--texto);
  font-size:13px;
  white-space:nowrap;
}

.detalle-carga-grupo summary::before{
  color:var(--azul);
  content:"›";
  font-size:18px;
  font-weight:900;
  line-height:1;
}

.detalle-carga-grupo[open] summary::before{
  content:"⌄";
}

.detalle-carga-grupo summary{
  grid-template-columns:auto minmax(0,1fr) auto;
}

.detalle-carga-grupo ul{
  border-top:1px solid var(--linea);
  display:grid;
  gap:0;
  list-style:none;
  margin:0;
  padding:6px 12px 10px;
}

.detalle-carga-grupo li{
  align-items:start;
  color:var(--texto);
  display:grid;
  gap:10px;
  grid-template-columns:minmax(0,1fr) auto;
  padding:7px 0;
}

.detalle-carga-grupo li + li{
  border-top:1px solid #e9edf4;
}

.detalle-carga-grupo li span{
  font-size:13px;
  line-height:1.35;
}

.detalle-carga-grupo li strong{
  color:var(--azul);
  font-size:13px;
  min-width:20px;
  text-align:right;
}

@media(max-width:1020px){
  .portal-layout,
  .hero-card{
    grid-template-columns:1fr;
  }

  .portal-side-card{
    position:static;
  }

  .info-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:680px){
  #portalCliente{
    padding:16px;
  }

  .portal-header{
    align-items:center;
    flex-direction:row;
  }

  .portal-status{
    width:auto;
    text-align:center;
  }

  .portal-brand{
    display:none;
  }

  .portal-main-card,
  .portal-side-card,
  .hero-card{
    padding:18px;
  }

  .hero-card h1{
    font-size:27px;
  }

  .search-row,
  .actions-grid,
  .ruta-box,
  .summary-grid,
  .payment-grid,
  .info-grid{
    grid-template-columns:1fr;
  }

  .payment-head{
    display:grid;
  }

  .payment-head button{
    width:100%;
  }

  .search-row{
    display:grid;
  }

  .ruta-arrow{
    justify-self:center;
    transform:rotate(90deg);
  }
}
