/* Temas: día (por defecto), noche y automático (sigue al sistema). El usuario puede forzar uno con data-theme. */
:root {
  --bg: #EEF3FC;
  --bg-glow: radial-gradient(90% 46% at 88% 0%, rgba(40, 110, 255, .16), transparent 62%);
  --card: #FFFFFF;
  --card-line: rgba(20, 60, 140, .09);
  --shadow: 0 1px 2px rgba(16, 42, 100, .05), 0 10px 26px rgba(16, 42, 100, .07);
  --text: #0A1530;
  --text-2: #2C3A58;
  --muted: #5A6A88;
  --line: #E3E9F5;
  --accent: #1766F0;
  --accent-ink: #0A4FB8;
  --accent-soft: #E1ECFF;
  --grad: linear-gradient(180deg, #3584FF 0%, #0B5CE8 100%);
  --grad-text: linear-gradient(135deg, #10B6FF 0%, #1F74F7 55%, #1259E0 100%);
  --grad-btn: linear-gradient(100deg, #46AEFF 0%, #2478FF 52%, #1B62F0 100%);
  --btn-edge: rgba(255, 255, 255, .55);
  --title-glow: none;
  --wave-op: .45;
  --ring-1: rgba(23, 102, 240, .14);
  --ring-2: rgba(23, 102, 240, .07);
  --btn-shadow: 0 8px 20px rgba(23, 102, 240, .28);
  --seg-bg: #E4ECFA;
  --seg-on-bg: linear-gradient(180deg, #3584FF 0%, #1766F0 100%);
  --seg-on-fg: #FFFFFF;
  --switch-off: #A5B1C8;
  --warn: #E8590C;
  --warn-soft: #FFF1E6;
  --warn-ink: #7A2A03;
  --danger: #C4160A;
  --danger-soft: #FDECEA;
  --gray: #6B7894;
  --purple: #8944C7;
  --overlay: rgba(8, 20, 50, .38);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050B18;
    --bg-glow: radial-gradient(100% 52% at 85% -4%, rgba(30, 100, 255, .24), transparent 62%);
    --card: #0D172C;
    --card-line: rgba(90, 140, 255, .15);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px rgba(0, 0, 0, .35);
    --text: #F2F6FF;
    --text-2: #D3DDF2;
    --muted: #9BA9C4;
    --line: rgba(120, 150, 210, .16);
    --accent: #4F94FF;
    --accent-ink: #6AA8FF;
    --accent-soft: rgba(40, 110, 255, .2);
    --grad: linear-gradient(180deg, #2F7CFF 0%, #0A55E0 100%);
    --grad-text: linear-gradient(135deg, #8EE6FF 0%, #4DAEFF 50%, #2A7BFF 100%);
    --title-glow: drop-shadow(0 0 16px rgba(70, 160, 255, .35));
    --wave-op: .95;
    --btn-edge: rgba(255, 255, 255, .35);
    --ring-1: rgba(80, 160, 255, .22);
    --ring-2: rgba(80, 160, 255, .1);
    --btn-shadow: 0 10px 26px rgba(30, 100, 255, .4);
    --seg-bg: #08101F;
    --seg-on-bg: #2B3F66;
    --seg-on-fg: #FFFFFF;
    --switch-off: #3A4A68;
    --warn-soft: rgba(232, 89, 12, .16);
    --warn-ink: #FFB88A;
    --danger-soft: rgba(196, 22, 10, .2);
    --gray: #5A6A8A;
    --overlay: rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg: #050B18;
  --bg-glow: radial-gradient(100% 52% at 85% -4%, rgba(30, 100, 255, .24), transparent 62%);
  --card: #0D172C;
  --card-line: rgba(90, 140, 255, .15);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px rgba(0, 0, 0, .35);
  --text: #F2F6FF;
  --text-2: #D3DDF2;
  --muted: #9BA9C4;
  --line: rgba(120, 150, 210, .16);
  --accent: #4F94FF;
  --accent-ink: #6AA8FF;
  --accent-soft: rgba(40, 110, 255, .2);
  --grad: linear-gradient(180deg, #2F7CFF 0%, #0A55E0 100%);
  --grad-text: linear-gradient(135deg, #8EE6FF 0%, #4DAEFF 50%, #2A7BFF 100%);
    --title-glow: drop-shadow(0 0 16px rgba(70, 160, 255, .35));
    --wave-op: .95;
    --btn-edge: rgba(255, 255, 255, .35);
    --ring-1: rgba(80, 160, 255, .22);
    --ring-2: rgba(80, 160, 255, .1);
  --btn-shadow: 0 10px 26px rgba(30, 100, 255, .4);
  --seg-bg: #08101F;
  --seg-on-bg: #2B3F66;
  --seg-on-fg: #FFFFFF;
  --switch-off: #3A4A68;
  --warn-soft: rgba(232, 89, 12, .16);
  --warn-ink: #FFB88A;
  --danger-soft: rgba(196, 22, 10, .2);
  --gray: #5A6A8A;
  --overlay: rgba(0, 0, 0, .6);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); overscroll-behavior-y: none; }
body {
  min-height: 100dvh;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, -apple-system, 'SF Pro Display', Roboto, system-ui, sans-serif;
  letter-spacing: -0.15px;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, p { margin: 0; }

.page {
  position: relative;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 40px);
}
.page.center { display: flex; flex-direction: column; gap: 20px; padding-top: calc(env(safe-area-inset-top) + 20px); }

.ic { display: inline-flex; flex-shrink: 0; }
.ic svg { display: block; }
.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin svg { animation-duration: 3s; } }

/* --- cabecera --- */
.appbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.brand-logo { width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0; box-shadow: 0 6px 18px rgba(23, 102, 240, .28); }
h1.title { flex: 1; min-width: 0; font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -0.5px; }
p.sub { margin: 0 4px 18px; font-size: 15px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; flex-shrink: 0;
  border: 1px solid var(--card-line); background: var(--card); color: var(--text);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.round.plain { border-color: transparent; background: transparent; box-shadow: none; color: var(--accent); }
.topbar { display: flex; justify-content: flex-end; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.label { padding: 6px 6px 0; font-size: 12px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); }

/* --- tarjetas --- */
.card { background: var(--card); border: 1px solid var(--card-line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.sep { height: 1px; background: var(--line); margin: 0 16px; }
.tile {
  width: 38px; height: 38px; border-radius: 11px; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.tile.blue { background: var(--grad); }
.tile.orange { background: var(--warn); }
.tile.gray { background: var(--gray); }
.tile.purple { background: var(--purple); }
.tile.red { background: var(--danger); }
.tile.soft { background: var(--accent-soft); color: var(--accent); }
.col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.strong { font-size: 16px; font-weight: 700; line-height: 1.25; }
.small { font-size: 14px; line-height: 1.3; color: var(--muted); }
.caption { font-size: 14px; line-height: 1.45; color: var(--muted); }
.linkbtn { border: 0; background: transparent; color: var(--accent-ink); font-size: 15px; font-weight: 700; min-height: 44px; min-width: 44px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; }

/* --- selector de modo --- */
.linkbtn.reload { color: var(--text); } /* blanco en modo noche; oscuro en modo día para que se vea sobre la tarjeta blanca */
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--seg-bg); border-radius: 14px; }
.segmented button {
  flex: 1; min-width: 0; height: 44px; border: 0; border-radius: 11px; background: transparent;
  color: var(--text-2); font-size: 15px; font-weight: 600;
}
.segmented button[aria-pressed="true"] { background: var(--seg-on-bg); color: var(--seg-on-fg); font-weight: 700; box-shadow: 0 2px 8px rgba(10, 60, 180, .3); }
.segmented button:disabled { cursor: default; opacity: .7; }

/* --- dominio --- */
.domain-head { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.domain-name { font-size: 19px; line-height: 1.15; font-weight: 700; letter-spacing: -0.3px; overflow-wrap: anywhere; }
.status { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; margin-top: 5px; }
.status.on { color: #1F9D55; }
.status.off { color: var(--warn); }
.status.wait { color: var(--muted); }
:root[data-theme="dark"] .status.on { color: #3DD68C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.on { color: #3DD68C; } }
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--warn-soft); }
.notice .strong { color: var(--warn-ink); }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; font-size: 15px; }
.meta span:first-child { color: var(--muted); }
.meta span:last-child { font-weight: 600; text-align: right; }
.hold { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 16px; font-size: 14px; color: var(--muted); }

.switch {
  position: relative; flex-shrink: 0; width: 64px; height: 44px; padding: 4px; border: 0; border-radius: 22px;
  display: flex; align-items: center; justify-content: flex-start; background: var(--switch-off);
  transition: background .18s ease;
}
.switch.on { background: var(--grad); justify-content: flex-end; box-shadow: 0 4px 14px rgba(23, 102, 240, .3); }
.switch.busy { background: var(--switch-off); justify-content: center; }
.switch .tag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } /* solo para lector de pantalla */
.switch .knob {
  position: relative; width: 36px; height: 36px; border-radius: 18px; background: #fff; color: #1766F0;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
}
.switch:disabled { cursor: default; }
@media (prefers-reduced-motion: reduce) { .switch { transition: none; } }

.block-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.block-row + .block-row { border-top: 1px solid var(--line); }
.block-row .ip { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.block-row .since { margin-left: auto; text-align: right; font-size: 13px; line-height: 1.25; color: var(--muted); flex-shrink: 0; }
.block-row .since b { display: block; font-size: 16px; color: var(--text); }

.skeleton { background: var(--line); border-radius: 11px; }
.big-error { padding: 28px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; border-radius: 26px; }
.big-error h2 { font-size: 23px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; }
.big-error p { font-size: 16px; line-height: 1.45; color: var(--muted); }
.big-tile { width: 72px; height: 72px; border-radius: 22px; color: #fff; display: flex; align-items: center; justify-content: center; background: var(--warn); }

.btn {
  position: relative; height: 56px; border: 1px solid var(--btn-edge); border-radius: 999px; padding: 0 24px; width: 100%;
  background: var(--grad-btn); color: #fff; font-size: 18px; font-weight: 700;
  /* brillo arriba, sombra interior abajo y halo exterior: da el volumen del botón de la referencia */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -10px 18px rgba(0, 40, 140, .28), var(--btn-shadow);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.btn-ring {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .12); display: flex; align-items: center; justify-content: center;
}
.btn.soft, .btn.ghost, .btn.danger { border-color: transparent; }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--accent-ink); box-shadow: none; font-size: 16px; height: 48px; }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; font-size: 17px; }
:root[data-theme="dark"] .btn.danger { color: #FF8A80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #FF8A80; } }
.btn:disabled { opacity: .6; cursor: default; }

/* --- pantalla de bloqueo --- */
/* curva luminosa de fondo (esquina superior derecha) */
.page.center { isolation: isolate; }
.page.center::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 230px; z-index: -1; pointer-events: none; opacity: var(--wave-op);
  /* se desvanece antes de llegar al título para no cruzar el texto */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 32%, transparent 54%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 32%, transparent 54%);
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 240' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='1' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%231E6BFF' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%231E6BFF' stop-opacity='.38'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 240C120 232 200 165 262 92 312 36 358 10 400 0V240Z' fill='url(%23g)'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 30px 2px 6px; }
.hero-logo { width: 88px; height: 88px; flex-shrink: 0; border-radius: 23px; margin-bottom: 6px; box-shadow: 0 12px 32px rgba(23, 102, 240, .4), 0 0 0 1px rgba(255, 255, 255, .06); }
.hero h1 { font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -1px; white-space: nowrap; }
.hero h1 .grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; filter: var(--title-glow); }
.hero p { font-size: 17px; line-height: 1.4; color: var(--muted); }
.lock-card { padding: 26px 18px 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; border-radius: 26px; }
.fp {
  width: 60px; height: 60px; border-radius: 50%; color: var(--accent);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent) 8%, transparent) 70%);
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
  display: flex; align-items: center; justify-content: center;
  /* aros de luz concéntricos, como el círculo de la referencia */
  box-shadow: 0 0 0 7px var(--ring-1), 0 0 0 14px var(--ring-2), 0 0 26px color-mix(in srgb, var(--accent) 35%, transparent);
  margin: 8px 0 6px;
}
.fp .ic { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent)); }
.lock-card h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; }
.lock-card p { font-size: 16px; line-height: 1.4; color: var(--muted); }
.alert-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--danger); border-radius: 22px; background: var(--card); }
.foot { margin-top: auto; text-align: center; font-size: 14px; line-height: 1.4; color: var(--muted); padding-top: 12px; }

/* --- aviso y hoja --- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 20px); max-width: 488px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 24px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-line); box-shadow: 0 14px 38px rgba(0, 0, 0, .25);
}
.toast .tick { width: 42px; height: 42px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast.err .tick { background: var(--warn); }

.scrim { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto; background: var(--bg); border-radius: 28px 28px 0 0;
  border: 1px solid var(--card-line); border-bottom: 0;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 14px;
}
.sheet > * { flex-shrink: 0; } /* la hoja hace scroll; los bloques no se aplastan */
.sheet h2 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; padding: 0 4px; }
.log-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.log-row + .log-row { border-top: 1px solid var(--line); }
.log-row .when { margin-left: auto; font-size: 13px; color: var(--muted); text-align: right; flex-shrink: 0; }

/* --- Tipografía ---
   Inter (variable, OFL) incluida en la app: antes se pedía pero no estaba cargada y caía en la fuente del sistema.
   Pesos variados (400 texto, 500-600 etiquetas y nombres, 700 títulos) y espaciado normal, sin apretar. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; letter-spacing: 0; -webkit-font-smoothing: antialiased; line-height: 1.4; }
h1.title { font-weight: 700; letter-spacing: -0.3px; }
.hero h1 { font-weight: 700; letter-spacing: -0.7px; }
.hero p, p.sub { font-weight: 400; }
.strong { font-weight: 600; letter-spacing: -0.1px; }
.domain-name { font-weight: 600; letter-spacing: -0.2px; }
.status { font-weight: 500; }
.small, .caption { font-weight: 400; }
.label { font-weight: 600; letter-spacing: .9px; }
.meta span:last-child { font-weight: 500; }
.segmented button { font-weight: 500; }
.segmented button[aria-pressed="true"] { font-weight: 600; }
.btn { font-weight: 600; letter-spacing: 0; }
.linkbtn { font-weight: 600; }
.lock-card h2 { font-weight: 600; letter-spacing: -0.2px; }
.lock-card p { font-weight: 400; }
.big-error h2, .sheet h2 { font-weight: 700; letter-spacing: -0.2px; }
.block-row .ip { font-weight: 600; letter-spacing: 0; }
.block-row .since b { font-weight: 600; }
.log-row .when { font-weight: 400; }

/* --- Switch sol / luna (modo día / noche) --- */
.theme-switch {
  position: relative; display: block; flex-shrink: 0; width: 76px; height: 44px; padding: 0; border-radius: 22px;
  border: 1px solid var(--card-line); background: var(--seg-bg);
}
.theme-switch .ts-icon { position: absolute; top: 0; bottom: 0; width: 36px; z-index: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.theme-switch .ts-sun { left: 3px; }
.theme-switch .ts-moon { right: 3px; }
.theme-switch .ts-knob {
  position: absolute; top: 3px; left: 3px; width: 36px; height: 36px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .28); transition: transform .18s ease;
}
.theme-switch.light .ts-sun { color: #F59E0B; }
.theme-switch.dark .ts-knob { transform: translateX(34px); background: var(--grad); }
.theme-switch.dark .ts-moon { color: #fff; }
@media (prefers-reduced-motion: reduce) { .theme-switch .ts-knob { transition: none; } }

/* --- Pantalla de inicio: botón más contenido y más aire sobre él --- */
.lock-card { gap: 16px; }
.lock-card .fp { margin: 10px 0 20px; }
.lock-card .btn { height: 48px; font-size: 16px; padding: 0 20px; gap: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -8px 14px rgba(0, 40, 140, .25), 0 6px 16px rgba(30, 100, 255, .28); }
.btn-ring { width: 28px; height: 28px; }
.lock-card .btn { width: auto; min-width: 232px; align-self: center; height: 46px; padding: 0 22px; }
.lock-card .btn.ghost { min-width: 0; height: 44px; padding: 0 12px; box-shadow: none; border-color: transparent; background: transparent; }

/* Ajustes: cabecera con la X de cerrar y botones con texto claro */
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -20px; z-index: 1; background: var(--bg); margin: -20px 0 0; padding: 20px 0 6px; }
.sheet .btn.soft, .sheet .btn.ghost { color: var(--text); }
/* Modo día: mismo azul de siempre (texto y "Ver más" incluidos); solo el fondo del botón un poco más intenso */
:root[data-theme="light"] .sheet .btn.soft { background: #C9DBFA; }
:root[data-theme="light"] .sheet .btn.soft, :root[data-theme="light"] .sheet .btn.ghost { color: var(--accent-ink); }

/* Campo del código de emparejamiento */
.field { width: 100%; box-sizing: border-box; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--card-line); background: var(--bg); color: var(--text); font: inherit; font-size: 17px; letter-spacing: 1px; text-align: center; text-transform: uppercase; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
