/* Consola del técnico — estilo "Material Able" sobre Bootstrap 5 (tema claro NodosOnline) */
.hidden { display: none !important; }
body { min-height: 100vh; background: var(--ma-bg); }

/* Fondo suave para las vistas de autenticación/conexión */
#view-login, #view-totp, #view-enroll, #view-chpw, #view-security {
  background:
    linear-gradient(180deg, rgba(var(--ma-primary-rgb), .14), rgba(var(--ma-primary-rgb), .04) 46%, transparent 60%),
    var(--ma-bg);
}

/* Tarjetas con franja de acento superior */
.card { border-radius: 6px; position: relative; overflow: hidden; }
.card.accent::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--ma-primary), var(--ma-info));
}

/* Navbar superior (azul Material) */
.topbar { background: var(--ma-primary); box-shadow: 0 1px 6px rgba(47, 107, 237, .35); min-height: 58px; }
.topbar .brand-logo-img { height: 32px; width: auto; display: block; }


/* Mi perfil */
.profile-wrap { width: min(880px, calc(100% - 28px)); margin: 28px auto; display: grid; gap: 18px; }
.profile-hero { overflow: hidden; }
.hero-band {
  height: 92px; background: var(--ma-primary);
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 14px, rgba(255,255,255,0) 14px 42px);
}
.hero-body { display: flex; align-items: flex-end; gap: 18px; padding: 0 24px 16px; margin-top: -52px; flex-wrap: wrap; }
.hero-text { flex: 1; min-width: 180px; padding: 60px 0 4px; } /* empieza debajo de la banda azul */
.hero-text h1 { color: var(--ma-heading); font-weight: 700; }
.hero-actions { display: flex; gap: 8px; padding-bottom: 6px; }
.hero-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.avatar-edit { position: relative; }
.avatar-cam {
  position: absolute; right: 2px; bottom: 4px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ma-primary); color: #fff; cursor: pointer;
  border: 3px solid #fff; transition: transform .15s;
}
.avatar-cam:hover { transform: scale(1.08); }
#prof-file:focus-visible + * , .avatar-edit:focus-within .avatar-cam { outline: 3px solid rgba(68,138,255,.45); }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; }
.info-list dt { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ma-muted); align-self: center; }
.info-list dd { margin: 0; color: var(--ma-heading); }
.sec-list { display: grid; gap: 4px; }
.sec-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ma-border); }
.sec-row:last-child { border-bottom: 0; }
.sec-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(68,138,255,.1); color: var(--ma-primary); font-size: 18px; }
.sec-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }


/* Contenedores centrados */
.auth-center { width: min(430px, calc(100% - 28px)); margin: 9vh auto 0; }
.connect-wrap { width: min(880px, calc(100% - 28px)); margin: 28px auto; display: grid; gap: 18px; }

/* Login-box */
.auth-center .card { box-shadow: 0 18px 50px rgba(47, 107, 237, .18); }
.login-logo-img { display: block; width: min(250px, 76%); height: auto; margin: 8px auto 12px; }
.tagline { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--ma-muted); }

/* Inputs con ícono */
.field { position: relative; }
.field > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ma-muted); font-size: 16px; pointer-events: none; z-index: 2; }
.field > .form-control { padding-left: 42px; }

/* Botón de marca (degradé Material) */
.btn-brand { background: linear-gradient(90deg, var(--ma-primary), #3f7bf5); border: 0; color: #fff; font-weight: 600; box-shadow: 0 8px 18px -6px rgba(var(--ma-primary-rgb), .7); }
.btn-brand:hover { filter: brightness(1.06); color: #fff; }

/* Código 2FA */
.code { font: 700 26px/1 Consolas, monospace; letter-spacing: 8px; text-align: center; color: var(--ma-heading); }
.qr { display: block; width: 210px; height: 210px; margin: 12px auto; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--ma-border); }

/* Lista de equipos */
.device-item { display: flex; align-items: center; gap: 12px; }
.device-item .d-main { flex: 1; min-width: 0; }
.device-item .d-sub { color: var(--ma-muted); font-size: 12.5px; }
.device-item .d-metrics { font-size: 12px; color: var(--ma-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.device-item .d-metrics .m-warn { color: #c47f17; font-weight: 600; }
.device-item .d-metrics .m-crit { color: #d93636; font-weight: 600; }
/* desconectado: atenuado pero legible (antes opacity .55 dejaba el texto sin contraste) */
.device-item.offline .fw-semibold { color: var(--ma-muted); }
.device-item.offline { background: #fafbfc; }
.device-item .d-btns { display: flex; gap: 6px; flex-wrap: wrap; }
/* referencia del equipo: qué es realmente (ubicación, quién lo usa) */
.device-item .d-ref { display: flex; align-items: baseline; gap: 6px; margin: 1px 0 2px; font-size: 13px; color: var(--ma-heading); overflow-wrap: anywhere; }
.device-item .d-ref i { color: var(--ma-primary); font-size: 12px; flex: none; }
.device-item .d-edit { padding-inline: 9px; }
.dot-status { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: #b5c0cf; }
.dot-status.on { background: var(--ma-success); box-shadow: 0 0 7px rgba(17,193,91,.6); }
.dot-status.busy { background: var(--ma-warning); box-shadow: 0 0 7px rgba(255,186,87,.6); }
.empty-hint { color: var(--ma-muted); padding: 18px 2px; text-align: center; }

/* Celular: barra con solo íconos, filtros a lo ancho y botones del equipo debajo del nombre */
@media (max-width: 575.98px) {
  .topbar .tb-label, .topbar .user-text { display: none; }
  .tb-link { padding: 8px 10px; }
  .user-chip { padding-right: 8px; }
  .connect-wrap, .profile-wrap { width: calc(100% - 32px); margin: 16px auto; }
  .hero-body { flex-direction: column; align-items: center; text-align: center; }
  .hero-text { min-width: 0; padding-top: 0; }
  .dev-filters { width: 100%; margin-left: 0 !important; }
  .dev-filters > * { flex: 1 1 0; min-width: 0 !important; }
  .device-item { flex-wrap: wrap; }
  .device-item .d-main { flex-basis: 100%; }
}

/* Visor de sesión (pantalla completa, se mantiene oscuro) */
#view-session { position: fixed; inset: 0; z-index: 1040; display: flex; flex-direction: column; background: #000; }
.session-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #1b2733;
  border-bottom: 1px solid #2b3a49; flex-wrap: wrap; color: #e9eff6; }
.session-bar .fw-semibold { color: #fff; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ma-success); box-shadow: 0 0 8px rgba(17,193,91,.7); }
#perm-badge.view { background: var(--ma-warning) !important; color: #000 !important; }
#stage { position: relative; flex: 1; background: #000; overflow: hidden; outline: none; }
#stage:focus { box-shadow: inset 0 0 0 2px var(--ma-primary); }
#remote { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #8ea6c7; margin: 0; pointer-events: none; }

/* ================= Login: pantalla dividida (panel de marca + formulario) ================= */
.auth-hero { display: none; }
body.auth-mode { background: #fff; }
body.auth-mode .auth-hero {
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 56%; z-index: 1;
  padding: clamp(28px, 4.2vw, 72px) clamp(28px, 5vw, 92px) clamp(22px, 3vw, 40px);
  color: #fff; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(60% 50% at 82% 8%, rgba(36, 120, 255, .55), transparent 70%),
    radial-gradient(55% 45% at 18% 88%, rgba(22, 92, 255, .32), transparent 70%),
    linear-gradient(160deg, #030c26 0%, #051a4d 52%, #0a2c86 100%);
}
/* textura sutil de puntos */
body.auth-mode .auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: radial-gradient(rgba(140, 190, 255, .18) 1px, transparent 1.4px); background-size: 26px 26px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.ah-brand { display: flex; align-items: center; gap: 12px; font: 700 clamp(22px, 2.1vw, 34px)/1 'Montserrat', sans-serif; letter-spacing: -.6px; }
.ah-brand img { width: clamp(52px, 4.6vw, 80px); height: auto; filter: drop-shadow(0 0 14px rgba(64, 140, 255, .55)); }
.ah-brand .a { color: #fff; } .ah-brand .b { color: #4d9bff; }
.ah-copy { margin-top: clamp(28px, 7vh, 96px); }
.ah-copy h1 { font: 700 clamp(38px, 4.5vw, 78px)/1.04 'Montserrat', sans-serif; letter-spacing: -2px; margin: 0 0 18px; color: #fff; }
.ah-copy h1 span { display: block; color: #2f8bff; text-shadow: 0 0 30px rgba(47, 139, 255, .35); }
.ah-copy p { font-size: clamp(16px, 1.45vw, 24px); color: rgba(235, 243, 255, .92); margin: 0; }
.ah-art { width: 100%; max-width: 760px; flex: 1 1 auto; min-height: 0; margin: clamp(10px, 3vh, 34px) 0 8px; }
.ah-spark { stroke-dasharray: 60 900; animation: ah-flow 4.5s linear infinite; opacity: .9; }
@keyframes ah-flow { from { stroke-dashoffset: 960; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .ah-spark { animation: none; stroke-dasharray: none; opacity: .5; } }
.ah-foot { font-size: 14px; color: rgba(225, 236, 255, .8); }
.ah-foot b { color: #fff; font-weight: 600; }

/* Lado del formulario */
body.auth-mode #view-login, body.auth-mode #view-totp, body.auth-mode #view-enroll { background: #fff; }
body.auth-mode .auth-pane, body.auth-mode .auth-center {
  margin: 0 0 0 56%; width: auto; min-height: 100vh; position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 48px clamp(24px, 5vw, 80px) 72px;
}
body.auth-mode .auth-center > .card { width: min(460px, 100%); box-shadow: none; border: 1px solid var(--ma-border); }
.auth-form { width: min(460px, 100%); }
.auth-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 3.5px; text-transform: uppercase; color: #1565f5; margin-bottom: 18px; }
.auth-title { font: 700 clamp(30px, 2.6vw, 42px)/1.12 'Montserrat', sans-serif; letter-spacing: -1px; color: #0b1a3d; margin-bottom: 10px; }
.auth-sub { font-size: 17px; color: #6b7a90; margin-bottom: 30px; }
.auth-label { display: block; font-weight: 700; font-size: 15px; color: #0b1a3d; margin-bottom: 8px; }
.auth-field { margin-bottom: 22px; }
.auth-field > .form-control { height: 56px; border-radius: 9px; padding-left: 50px; font-size: 16px; background: #f6f8fc; border: 1px solid #d5dce8; color: #0b1a3d; }
.auth-field > .form-control::placeholder { color: #8f9bb0; }
.auth-field > .form-control:focus { background: #fff; border-color: #1565f5; box-shadow: 0 0 0 4px rgba(21, 101, 245, .14); }
.auth-field > i { left: 18px; font-size: 20px; color: #7d8aa0; }
.auth-btn { height: 58px; border-radius: 9px; margin-top: 8px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(90deg, #0b5cf0, #1d6dff); box-shadow: 0 12px 26px -10px rgba(21, 101, 245, .75); }
.auth-btn i { font-size: 22px; transition: transform .15s; }
.auth-btn:hover i { transform: translateX(3px); }
.auth-btn:focus-visible { outline: 3px solid rgba(21, 101, 245, .45); outline-offset: 3px; }
.auth-wm { position: absolute; right: clamp(24px, 4vw, 64px); bottom: 28px; font: 700 22px/1 'Montserrat', sans-serif; letter-spacing: -.6px; }
.auth-wm .a { color: #0b1a3d; } .auth-wm .b { color: #1565f5; }

/* Tablet: panel de marca arriba, formulario debajo */
@media (max-width: 991.98px) {
  body.auth-mode .auth-hero { position: relative; width: 100%; padding: 28px 32px 0; }
  .ah-copy { margin-top: 26px; }
  .ah-copy h1 { font-size: clamp(34px, 6vw, 50px); }
  .ah-art { max-width: 520px; max-height: 210px; align-self: center; margin: 4px 0 0; }
  .ah-foot { display: none; }
  body.auth-mode .auth-pane, body.auth-mode .auth-center { margin-left: 0; min-height: 0; padding: 36px 24px 84px; }
}
/* Celular: panel de marca compacto, sin ilustración */
@media (max-width: 575.98px) {
  body.auth-mode .auth-hero { padding: 20px 20px 24px; }
  .ah-brand { font-size: 21px; } .ah-brand img { width: 44px; }
  .ah-copy { margin-top: 20px; }
  .ah-copy h1 { font-size: 30px; letter-spacing: -1px; margin-bottom: 8px; }
  .ah-copy p { font-size: 15px; }
  .ah-art { display: none; }
  body.auth-mode .auth-pane, body.auth-mode .auth-center { padding: 26px 16px 72px; }
  .auth-eyebrow { font-size: 11.5px; letter-spacing: 2.5px; margin-bottom: 10px; }
  .auth-sub { margin-bottom: 22px; font-size: 15.5px; }
  .auth-wm { right: 16px; bottom: 22px; font-size: 18px; }
}

/* Verificación en dos pasos con el mismo estilo que el login */
body.auth-mode .auth-center > .card { border: 0; padding: 0 !important; background: transparent; overflow: visible; }
body.auth-mode .auth-center > .card::before { display: none; }
body.auth-mode .auth-center h2.h5 { font: 700 clamp(26px, 2.2vw, 34px)/1.15 'Montserrat', sans-serif; letter-spacing: -.8px; color: #0b1a3d; margin-bottom: 10px; }
body.auth-mode .auth-center .card > p.text-secondary, body.auth-mode .auth-center .card > ol { font-size: 15.5px !important; color: #6b7a90 !important; margin-bottom: 24px; }
body.auth-mode .auth-center .form-control.code { height: 66px; border-radius: 9px; background: #f6f8fc; border-color: #d5dce8; }
body.auth-mode .auth-center .form-control.code:focus { background: #fff; border-color: #1565f5; box-shadow: 0 0 0 4px rgba(21, 101, 245, .14); }
body.auth-mode .auth-center .btn-brand { height: 58px; border-radius: 9px; font-size: 18px; background: linear-gradient(90deg, #0b5cf0, #1d6dff); }
