:root{
  --magenta:#e6007e;
  --morado:#5a2ca0;
  --cian:#00b3e6;
  --verde:#00b050;

  --ink:#0f172a;
  --paper:#ffffff;
  --muted:#64748b;

  --bg:#f8fafc;
  --line:#e5e7eb;

  --radius:16px;
  --radius-sm:12px;

  --shadow:0 16px 40px rgba(0,0,0,.12);
  --shadow-sm:0 10px 24px rgba(0,0,0,.08);

  --grad: linear-gradient(90deg,var(--magenta),var(--cian),var(--verde));
  --focus: 0 0 0 4px rgba(0,179,230,.18);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial;
  background: var(--bg);
  color: var(--ink);
}

/* ===================== LINKS ===================== */
a{color:inherit}
a:hover{opacity:.92}

/* ===================== HEADER ===================== */
header{
  position:sticky; top:0; z-index:20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
  padding: .85rem 5vw;
  display:flex; align-items:center; justify-content:space-between;
  gap: 14px;
}

.brand{display:flex; align-items:center; gap:.8rem; min-width:0}
.brand img{width:46px;height:46px;object-fit:contain}
.brand h1{
  font-size:1.05rem;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.brand b{
  background:var(--grad);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent
}

.head-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.logout{
  text-decoration:none;
  color:#fff;
  font-weight:900;
  padding:.65rem 1.05rem;
  border-radius:999px;
  background:var(--grad);
  box-shadow:var(--shadow-sm);
  display:inline-flex;
  align-items:center;
  gap:8px;
}

/* ===================== LAYOUT ===================== */
.wrap{
  max-width:1150px;
  margin: 24px auto;
  padding: 0 5vw 36px;
  display:grid;
  gap:24px;
  grid-template-columns: 1.1fr .9fr;
}

@media (max-width: 980px){
  .wrap{grid-template-columns: 1fr}
  header{padding: .8rem 4vw}
}

/* ===================== CARD ===================== */
.card{
  background: var(--paper);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

@media (max-width: 520px){
  .card{padding:18px}
}

h2{
  font-size:1.35rem;
  letter-spacing:-.02em;
  margin-bottom:.35rem;
}
p.helper{
  color: var(--muted);
  margin-bottom: 1rem;
  line-height:1.4;
}

/* ===================== BADGES / ALERTS ===================== */
.notice, .success, .errorbox{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid;
  line-height:1.35;
}

.notice{
  background:#fff7ed;
  border-color:#ffedd5;
  color:#9a3412;
}

.success{
  background:#ecfdf5;
  border-color:#bbf7d0;
  color:#065f46;
}

.errorbox{
  background:#fee2e2;
  border-color:#fecaca;
  color:#991b1b;
}

/* ===================== DATA LIST ===================== */
ul.data{
  list-style:none;
  display:grid;
  gap:10px;
  margin-top:10px;
}

ul.data li{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:10px 12px;
  border-radius:12px;
  background:#f8fafc;
  border:1px solid #eef2f7;
}

.k{
  width: 185px;
  color: var(--muted);
  font-weight:800;
  flex: 0 0 auto;
}

.v{
  flex:1 1 auto;
  min-width:0;
  font-weight:700;
  overflow:hidden;
  text-overflow:ellipsis;
}

@media (max-width: 560px){
  ul.data li{flex-direction:column}
  .k{width:auto}
}

/* ===================== BUTTONS ===================== */
.btn{
  border:none;
  border-radius:999px;
  padding:.65rem 1.05rem;
  font-weight:900;
  cursor:pointer;
  box-shadow:var(--shadow-sm);
  transition: transform .08s ease, opacity .15s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.btn:active{transform:scale(.98)}
.btn.pri{background:var(--grad); color:#fff}
.btn.out{background:#fff; border:1px solid var(--line); color:#111827; box-shadow:none}

.btn:focus,
input:focus,
textarea:focus,
select:focus{
  outline:none;
  box-shadow: var(--focus);
  border-color:#7dd3fc;
}

/* ===================== UPDATE PHONE FORM ===================== */
form.actualizar{
  display:grid;
  gap:10px;
  margin-top:12px;
  grid-template-columns: 1fr auto;
  align-items:end;
}

form.actualizar label{
  font-weight:900;
  margin-bottom:6px;
  display:block;
}

form.actualizar input{
  width:100%;
  min-height:44px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid #d1d5db;
  font-size:16px;
}

form.actualizar button{
  min-height:44px;
  padding:12px 18px;
}

@media (max-width: 720px){
  form.actualizar{grid-template-columns: 1fr}
}

/* ===================== WIFI (QR PANEL) ===================== */
.wifi{
  display:grid;
  gap:18px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 760px){
  .wifi{grid-template-columns: 1fr}
}

.wifi .qr{
  display:flex;
  gap:16px;
  align-items:center;
  padding:12px;
  border-radius:14px;
  border:1px solid #eef2f7;
  background:#fbfdff;
}

.wifi img{
  width:128px;
  height:128px;
  border-radius:14px;
  border:1px solid var(--line);
  box-shadow:var(--shadow-sm);
  flex: 0 0 auto;
}

.wifi .ssid{
  font-weight:1000;
  margin-bottom:6px;
  line-height:1.2;
}

.mono{
  font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  background:#f1f5f9;
  padding:.25rem .45rem;
  border-radius:10px;
  display:inline-block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  vertical-align:bottom;
}

/* ===================== SUBCARD (WIFI ACS) ===================== */
.subcard{
  margin-top:18px;
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  box-shadow:none;
  background: linear-gradient(180deg, rgba(0,179,230,.06), rgba(255,255,255,0));
}

.subhead h3{
  margin:0 0 6px 0;
  font-size:1.15rem;
  letter-spacing:-.01em;
}

/* ===================== INPUTS GENERALES ===================== */
.input{
  width:100%;
  min-height:44px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid #d1d5db;
  font-size:16px;
  line-height:1.2;
}

.mini{
  margin-top:6px;
  color:var(--muted);
  font-size:.88rem;
}

/* ===================== WIFI FORMS (ANTI-APLASTADO) ===================== */
.wifi-forms{
  display:grid;
  gap:12px;
  margin-top:12px;
}

/* evita overflow y colapso */
.wifi-form,
.wifi-form .row,
.wifi-form .col{min-width:0}

.wifi-form{
  padding:12px;
  border-radius:14px;
  border:1px solid #eef2f7;
  background:#ffffff;
}

.wifi-form .row{
  display:grid;
  gap:14px;
  align-items:end;

  /* 2 inputs + botón, con mínimos reales */
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) auto;
}

.wifi-form .col label{
  display:block;
  font-weight:1000;
  margin:0 0 8px 0;
}

/* botón siempre legible */
.btncol{
  display:flex;
  justify-content:flex-end;
  align-items:end;
}
.btncol .btn{
  min-height:44px;
  padding:12px 18px;
  white-space:nowrap;
}

/* Apila en pantallas donde ya no cabe */
@media (max-width: 980px){
  .wifi-form .row{
    grid-template-columns: 1fr;
    gap:10px;
  }
  .btncol{justify-content:stretch}
  .btncol .btn{width:100%}
}

/* ===================== ACTIONS GRID ===================== */
.grid-actions{
  display:grid;
  gap:16px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
@media (max-width: 760px){
  .grid-actions{grid-template-columns: 1fr}
}

.action{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:0 6px 16px rgba(0,0,0,.06);
  min-width:0;
}

.action svg{width:28px;height:28px;flex:0 0 auto}
.action h3{margin:0;font-size:1.05rem;font-weight:1000}
.action p{margin:0;color:var(--muted);font-size:.92rem;line-height:1.25}
.action .go{margin-left:auto; flex:0 0 auto}

.action button{
  border:none;
  border-radius:999px;
  padding:.65rem .95rem;
  background:var(--grad);
  color:#fff;
  font-weight:1000;
  cursor:pointer;
  box-shadow:var(--shadow-sm);
  white-space:nowrap;
}

/* ===================== LOGIN VIEW (si la usas) ===================== */
.loginbg{
  background:
    radial-gradient(60% 60% at 20% -10%, rgba(0,176,80,.18) 0%, transparent 60%),
    radial-gradient(60% 60% at 90% 0%, rgba(90,44,160,.18) 0%, transparent 60%),
    #0b0f1a;
  display:grid;
  place-items:center;
  padding: 5vw;
  color: var(--ink);
}

.logincard{
  width:min(480px, 92vw);
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:28px;
  box-shadow:var(--shadow);
}

.logincard .subtitle{color:#94a3b8;margin-bottom:18px}
.logincard label{display:block;font-weight:900;margin:.65rem 0 .3rem}
.logincard input{
  width:100%;
  min-height:44px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid #d1d5db;
  font-size:16px;
}
.logincard .helper{margin-top:10px;color:#9ca3af;font-size:.92rem;text-align:center}

/* ===================== SMALL TOUCHES ===================== */
@media (max-width: 420px){
  .brand h1{font-size:1rem}
  .wifi img{width:112px;height:112px}
}
/* ===================== WIFI: RESUMEN "RED GUARDADA / PASS / ÚLTIMO CAMBIO" EN 3 LÍNEAS ===================== */
/* Funciona aunque esté todo en el mismo <div> */

.subcard .notice{
  display:flex;
  flex-direction:column;
  gap:8px;
  line-height:1.25;
}

/* Si tienes spans/strong/mono dentro, que ocupen línea completa */
.subcard .notice strong,
.subcard .notice b,
.subcard .notice .mono,
.subcard .notice span{
  display:inline-block;
}

/* Fuerza saltos visuales por patrones comunes (sin cambiar HTML) */
.subcard .notice{
  white-space:normal;
  overflow-wrap:anywhere;
}

/* Si tu texto usa "·" como separador, lo mandamos a salto */
.subcard .notice{
  position:relative;
}
.subcard .notice::before{ content:""; }

/* ===================== WIFI FORM: SIEMPRE 2 CAMPOS EN FILA + BOTÓN ABAJO ===================== */

.wifi-forms{display:grid; gap:14px; margin-top:12px}

.wifi-form .row{
  display:grid;
  gap:14px;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  align-items:end;
}

.wifi-form .col{min-width:0}
.wifi-form .input{width:100%; min-width:0}

.wifi-form .btncol{
  grid-column: 1 / -1;
  display:flex;
  justify-content:center;
}

.wifi-form .btncol .btn{
  width:min(520px, 100%);
  min-height:56px;
  border-radius:999px;
  font-size:1.05rem;
}

/* En móvil: todo apilado */
@media (max-width: 720px){
  .wifi-form .row{grid-template-columns:1fr}
  .wifi-form .btncol{justify-content:stretch}
  .wifi-form .btncol .btn{width:100%}
}

/* ===================== WIFI FORM: SIEMPRE APILADO (DESKTOP + MÓVIL) ===================== */

.wifi-forms{
  display:grid;
  gap:14px;
  margin-top:12px;
}

/* Fuerza 1 sola columna SIEMPRE */
.wifi-form .row{
  display:grid !important;
  grid-template-columns: 1fr !important;
  gap:14px !important;
  align-items:stretch !important;
}

/* Evita que inputs se “encimen” o se corten */
.wifi-form .col{min-width:0}
.wifi-form .input{
  width:100% !important;
  min-width:0 !important;
  padding:1.05rem 1.15rem !important;
  font-size:1.15rem !important;
  border-radius:16px !important;
}

/* Labels más legibles */
.wifi-form .col label{
  display:block;
  font-weight:900;
  font-size:1.15rem;
  margin:0 0 10px 0;
}

/* Botón SIEMPRE ABAJO, grande, centrado */
.wifi-form .btncol{
  grid-column: 1 / -1 !important;
  display:flex !important;
  justify-content:center !important;
}

.wifi-form .btncol .btn{
  width:min(520px, 100%) !important;
  min-height:64px !important;
  border-radius:999px !important;
  font-size:1.25rem !important;
  padding:1rem 1.4rem !important;
}

/* Extra: que el contenedor no se deforme */
.subcard{overflow:hidden}
