:root {
  /* Marca LinkNet: violeta oscuro + cian */
  --bg: #0a0726;
  --bg-2: #2a1696;
  --surface: rgba(255, 255, 255, .07);
  --surface-solid: #1a1150;
  --text: #ffffff;
  --muted: #c3bdf0;
  --border: rgba(255, 255, 255, .16);
  --primary: #19e3ec;
  --primary-ink: #0a0726;
  --primary-soft: rgba(25, 227, 236, .14);
  --field: rgba(10, 7, 38, .55);
  --ok: #34e08e;
  --ok-soft: rgba(52, 224, 142, .16);
  --warn: #ffd166;
  --warn-soft: rgba(255, 209, 102, .14);
  --err: #ff8fa3;
  --wa: #25d366;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(5, 3, 25, .35);
  color-scheme: dark;
  font-family: "Quicksand", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 80% at 80% 100%, #5b2ee0 0%, rgba(91, 46, 224, 0) 60%),
    linear-gradient(170deg, var(--bg) 0%, #160d4a 45%, var(--bg-2) 100%);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

.topbar { background: rgba(10, 7, 38, .6); border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); backdrop-filter: blur(8px); }
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: .14em; }
.brand .wifi-i { color: var(--primary); }
.top-actions { display: flex; gap: 6px; }

.main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 16px 32px; outline: none; }
.footer { text-align: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }

h1 { color: var(--primary); font-size: 1.6rem; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.page-title { font-size: 1.9rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.card h1 { color: var(--primary); }
.narrow { max-width: 440px; margin: 4vh auto 0; }

label { display: block; font-weight: 600; margin: 16px 0 6px; }
label.check { font-weight: 500; display: flex; gap: 10px; align-items: center; margin-top: 12px; }
label.check input { width: 20px; height: 20px; accent-color: var(--primary); }
input:not([type=checkbox]) {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-height: 48px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 1.5rem !important; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.error { color: var(--err); min-height: 1.2em; margin: 10px 0 0; font-weight: 500; }
.error:empty { min-height: 0; margin: 0; }

button { font: inherit; cursor: pointer; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-top: 18px; min-height: 48px; padding: 12px 18px; border: 0; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 1rem;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .55; cursor: progress; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 8px 0; min-height: 44px; font-weight: 600; }
.btn-link:disabled { color: var(--muted); cursor: default; }
.row-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.back { margin-bottom: 4px; }
a { color: var(--primary); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 10px; }

.service-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.service-list button {
  width: 100%; text-align: left; background: var(--surface); backdrop-filter: blur(6px); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-height: 88px;
}
.service-list button:hover { border-color: var(--primary); }
.service-list .unit { font-weight: 700; font-size: 1.05rem; display: block; }
.service-list .meta { color: var(--muted); font-size: .9rem; }

.wifi-grid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) { .wifi-grid { grid-template-columns: 1fr 1.15fr; gap: 24px; } }

.network-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.network-list li { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; }
.network-list .band { grid-row: span 2; background: var(--primary-soft); color: var(--primary); font-weight: 700; border-radius: 10px; padding: 8px 10px; font-size: .85rem; white-space: nowrap; }
.network-list .ssid { font-weight: 700; word-break: break-all; }
.network-list .meta { color: var(--muted); font-size: .88rem; }

.notice { border-radius: 12px; padding: 14px; background: var(--warn-soft); color: var(--text); margin-top: 12px; }
.notice a { font-weight: 600; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 8px 0; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.big-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; font-size: 2rem; background: var(--ok-soft); color: var(--ok); }
.big-icon.wait { background: var(--warn-soft); color: var(--warn); }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-solid); color: var(--text); padding: 22px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(2, 6, 23, .55); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dialog-actions .btn-primary { width: auto; margin: 0; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}

/* Botón de ayuda por WhatsApp (Link) */
.wa-help { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px; background: rgba(255, 255, 255, .06); }
.wa-help:hover { border-color: var(--wa); }
.wa-help svg { width: 22px; height: 22px; flex: none; }
.wa-help span b { color: var(--primary); }
