/* PIN · Servicios de Comunicaciones MCIT.
   Mismo concepto que el Monitor de Señal MCIT: consola de fósforo verde de un NOC sobre negro puro,
   con líneas de barrido, VT323 para cifras y títulos e IBM Plex Mono para los datos. */
:root {
    --fondo: #000000;
    --panel: #000000;
    --linea: #2A4A30;
    --fosforo: #B9E887;        /* texto: fósforo claro, derivado de verde-texto MCIT */
    --fosforo-vivo: #E8FFCC;
    --fosforo-tenue: #8DBF63;  /* etiquetas: legibles sobre negro */
    --marca: #7DAF44;          /* mcit-verde */
    --azul: #8FB0CC;           /* azul-ui (oscuro) MCIT */
    --ambar: #F0B44C;
    --rojo: #FF6B5E;
    --f-crt: "VT323", "Courier New", monospace;
    --f-datos: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    --f-marca: "Montserrat", "Century Gothic", system-ui, sans-serif;
    --r: 2px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
    background: var(--fondo);
    color: var(--fosforo);
    font: 14px/1.5 var(--f-datos);
    font-variant-numeric: tabular-nums;
    min-height: 100vh;
    padding: 24px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
body::after { /* líneas de barrido */
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
    background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 3px);
}
a { color: var(--fosforo-vivo); text-decoration-style: dashed; text-underline-offset: 3px; }
a:hover { color: #fff; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
h1 { font-family: var(--f-crt); font-size: 34px; line-height: 1; color: var(--fosforo-vivo); letter-spacing: .03em; }
h2 { font-family: var(--f-crt); font-size: 24px; line-height: 1.1; color: var(--fosforo-vivo); margin: 0 0 12px; }
p { margin: 0 0 12px; }
code, .mono, pre { font-family: var(--f-datos); font-size: 13px; }
code { color: var(--fosforo-vivo); }
strong { color: var(--fosforo-vivo); font-weight: 600; }
:focus-visible { outline: 2px dashed var(--fosforo-vivo); outline-offset: 2px; }
.muted { color: var(--fosforo-tenue); }
.small { font-size: 12px; line-height: 1.45; }
.label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fosforo-tenue); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.crt { font-family: var(--f-crt); line-height: 1; }
.cursor::after { content: "█"; margin-left: 4px; }

/* Tubo: el marco de la consola */
.tubo {
    max-width: 1280px; margin: 0 auto;
    border: 1px solid var(--linea); border-radius: 14px;
    padding: 20px clamp(14px, 2.5vw, 28px) 28px;
    text-shadow: 0 0 4px rgba(185,232,135,.28);
}
@media (prefers-reduced-motion: no-preference) {
    .tubo { animation: parpadeo 7s infinite; }
    @keyframes parpadeo { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .94; } 98% { opacity: .99; } }
    .cursor::after { animation: latido 1.1s steps(2) infinite; }
    @keyframes latido { 50% { opacity: .25; } }
}

/* Encabezado */
.cabeza { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; border-bottom: 1px dashed var(--linea); padding-bottom: 14px; margin-bottom: 14px; }
.marca { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.marca svg { width: 30px; height: auto; filter: drop-shadow(0 0 6px rgba(125,175,68,.6)); flex: none; }
.marca b { font-family: var(--f-marca); font-weight: 700; font-size: 22px; letter-spacing: .06em; color: var(--fosforo-vivo); }
.marca .sep { color: var(--fosforo-tenue); font-family: var(--f-crt); font-size: 28px; }
.marca .titulo { font-family: var(--f-crt); font-size: 28px; color: var(--fosforo); letter-spacing: .04em; text-transform: uppercase; }
.reloj { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.reloj .hora { font-size: 30px; color: var(--fosforo-vivo); }
.reloj .quien { font-size: 12px; color: var(--fosforo-tenue); text-transform: uppercase; letter-spacing: .1em; }
.reloj form { margin: 0; }

/* Navegación: pestañas de consola */
.nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.nav a {
    color: var(--fosforo-tenue); text-decoration: none; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600;
    padding: 5px 12px; border: 1px solid var(--linea); border-radius: var(--r);
}
.nav a:hover { color: var(--fosforo-vivo); border-color: var(--fosforo-tenue); }
.nav a.on { color: var(--fondo); background: var(--fosforo); border-color: var(--fosforo); text-shadow: none; }

main { display: block; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head p { margin: 6px 0 0; }

/* Avisos */
.notice { border: 1px solid currentColor; padding: 10px 14px; border-radius: var(--r); margin-bottom: 16px; text-shadow: none; overflow-wrap: anywhere; }
.notice strong { color: inherit; }
.notice a { color: inherit; }
.notice.ok { color: var(--fosforo-vivo); border-color: var(--fosforo); }
.notice.error { color: var(--rojo); }
.notice.warn { color: var(--ambar); }
.notice ul { margin: 0; padding-left: 18px; }

/* Cajas */
.card { border: 1px solid var(--linea); border-radius: var(--r); background: var(--panel); padding: 14px 16px; margin-bottom: 20px; min-width: 0; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr) !important; } .reloj { margin-left: 0; } }

/* Contadores */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 20px; }
.stat { border: 1px solid var(--linea); border-radius: var(--r); padding: 10px 14px; text-decoration: none; color: inherit; display: grid; gap: 2px; }
.stat:hover { border-color: var(--fosforo-tenue); }
.stat .n { font-family: var(--f-crt); font-size: 52px; line-height: 1; color: var(--fosforo); }
.stat.good .n { color: var(--fosforo-vivo); }
.stat.bad { border-color: var(--rojo); }
.stat.bad .n { color: var(--rojo); }
@media (prefers-reduced-motion: no-preference) {
    .stat.bad { animation: alarma 1.4s ease-in-out infinite; }
    @keyframes alarma {
        0%, 100% { background: var(--panel); box-shadow: inset 0 0 0 1px var(--rojo); }
        50% { background: rgba(255,107,94,.12); box-shadow: inset 0 0 0 1px var(--rojo), 0 0 18px 2px rgba(255,107,94,.35); }
    }
}

/* Lámparas de estado */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--linea); align-items: baseline; }
.checks li:last-child { border-bottom: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; transform: translateY(1px); }
.dot.ok { background: var(--fosforo-vivo); box-shadow: 0 0 8px var(--fosforo); }
.dot.warn { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.dot.bad { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
@media (prefers-reduced-motion: no-preference) { .dot.bad { animation: latido 1s steps(2) infinite; } }

/* Tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px dashed var(--linea); vertical-align: top; }
th { font-size: 11px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--fosforo-tenue); border-bottom: 1px solid var(--linea); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(156,203,102,.05); }
td.subject { max-width: 380px; }
td.subject a { color: var(--fosforo-vivo); text-decoration: none; font-weight: 500; }
td.subject a:hover { text-decoration: underline dashed; }
.trunc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err { color: var(--rojo); font-size: 12px; line-height: 1.45; }
.empty { padding: 24px 12px; color: var(--fosforo-tenue); }

/* Estados */
.pill { display: inline-block; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 7px; border: 1px solid currentColor; border-radius: var(--r); white-space: nowrap; text-shadow: none; color: var(--fosforo-tenue); }
.pill.entregado { color: var(--fosforo-vivo); }
.pill.enviado { color: var(--azul); }
.pill.pendiente, .pill.diferido { color: var(--ambar); }
.pill.rebotado, .pill.descartado, .pill.spam, .pill.fallido { color: var(--rojo); }
.pill.off { color: var(--fosforo-tenue); opacity: .8; }

/* Formularios */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fosforo-tenue); }
.field label strong { text-transform: none; letter-spacing: 0; }
.field .hint { font-size: 12px; color: var(--fosforo-tenue); line-height: 1.45; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select {
    font: inherit; font-size: 14px; color: var(--fosforo-vivo); caret-color: var(--fosforo-vivo);
    background: var(--fondo); border: 1px solid var(--linea); border-radius: var(--r);
    padding: 7px 10px; min-height: 36px; max-width: 100%;
}
input::placeholder { color: var(--fosforo-tenue); opacity: .8; }
input:focus, select:focus { border-color: var(--fosforo); outline: none; box-shadow: 0 0 0 1px var(--fosforo); }
input[type=date] { color-scheme: dark; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; text-transform: none !important; letter-spacing: 0 !important; color: var(--fosforo) !important; }
.check input { accent-color: var(--marca); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
    background: transparent; color: var(--fosforo); border: 1px solid var(--fosforo); border-radius: var(--r);
    padding: 7px 14px; min-height: 34px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--fosforo); color: var(--fondo); text-shadow: none; }
.btn.sec { border-color: var(--fosforo-tenue); color: var(--fosforo-tenue); }
.btn.sec:hover { background: var(--fosforo-tenue); color: var(--fondo); }
.btn.danger { border-color: var(--rojo); color: var(--rojo); }
.btn.danger:hover { background: var(--rojo); color: var(--fondo); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 11px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Clave recién generada */
.token { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border: 1px dashed var(--fosforo); border-radius: var(--r); padding: 10px 12px; }
.token code { font-size: 14px; overflow-wrap: anywhere; flex: 1; min-width: 200px; }

/* Detalle de correo */
dl.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 16px; margin: 0; }
dl.meta dt { color: var(--fosforo-tenue); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 1px dashed var(--linea); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--fosforo-tenue); opacity: .5; }
.timeline li.good::before { background: var(--fosforo-vivo); opacity: 1; box-shadow: 0 0 8px var(--fosforo); }
.timeline li.bad::before { background: var(--rojo); opacity: 1; box-shadow: 0 0 8px var(--rojo); }
.timeline .t { color: var(--fosforo-vivo); font-weight: 500; }
.timeline .d { font-size: 12px; line-height: 1.45; color: var(--fosforo-tenue); overflow-wrap: anywhere; }
.timeline li.bad .t { color: var(--rojo); }
/* El correo se ve como lo verá el destinatario: fondo claro dentro del monitor. */
.preview { width: 100%; height: 560px; border: 1px solid var(--linea); border-radius: var(--r); background: #fff; }
details summary { cursor: pointer; font-size: 12px; color: var(--fosforo-tenue); }
details summary:hover { color: var(--fosforo-vivo); }
pre.json { white-space: pre-wrap; font-size: 12px; border: 1px dashed var(--linea); padding: 10px; border-radius: var(--r); overflow-x: auto; color: var(--fosforo); }

/* Paginación */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 11px; border: 1px solid var(--linea); border-radius: var(--r); text-decoration: none; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.pager span.on { background: var(--fosforo); color: var(--fondo); }
.pager span.off { color: var(--fosforo-tenue); }

/* Acceso */
.acceso { max-width: 640px; margin: 12vh auto 0; }
.acceso .tubo { display: grid; gap: 18px; padding: 28px; }
.acceso .marca { flex-wrap: wrap; }
.acceso .marca .titulo { font-size: 24px; }
.acceso form { display: grid; gap: 12px; }
.acceso .field { margin: 0; }
.acceso .btn { width: 100%; }
.prompt { font-family: var(--f-crt); font-size: 24px; color: var(--fosforo-vivo); margin: 0; }

@media (max-width: 600px) {
    .hide-sm { display: none; }
    body { padding-top: 12px; }
    .marca .titulo { font-size: 22px; }
    .stat .n { font-size: 42px; }
}
