/* ==========================================================================
   PLANTA CEAI · PANTALLA DE ACCESO
   Autocontenida (no depende del CSS de la aplicación: se sirve sin sesión).
   ========================================================================== */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --brand: #2c8a00; --brand-hi: #37a100; --brand-soft: rgba(44, 138, 0, .10);
  --panel: #ffffff; --panel-2: #f5f7fa; --ink: #0c1626; --ink-2: #384559; --muted: #667488; --faint: #97a2b3;
  --line: rgba(15, 27, 45, .14); --line-2: rgba(15, 27, 45, .08);
  --danger: #c93a30; --danger-soft: rgba(201, 58, 48, .09); --ok: #17935b; --warn: #b87a10;
  --focus: 0 0 0 3px rgba(44, 138, 0, .22);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --brand: #53c812; --brand-hi: #6fdc2b; --brand-soft: rgba(83, 200, 18, .13);
    --panel: #10161d; --panel-2: #151c25; --ink: #f3f6fa; --ink-2: #b6c1d0; --muted: #8392a5; --faint: #5a687a;
    --line: rgba(166, 186, 210, .18); --line-2: rgba(166, 186, 210, .09);
    --danger: #ff6b5e; --danger-soft: rgba(255, 107, 94, .12); --ok: #3ccf8f; --warn: #f0b232;
    --focus: 0 0 0 3px rgba(83, 200, 18, .28);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 400 14.5px/1.55 var(--font); color: var(--ink); background: var(--panel); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr); min-height: 100vh; }

/* ── Panel de marca ─────────────────────────────────────────────────────── */
.brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  --padx: clamp(32px, 5vw, 72px); padding: 40px var(--padx); color: #e5eaf1; background: #090d12;
  background-image:
    radial-gradient(110% 80% at 0% 0%, rgba(83, 200, 18, .12), transparent 58%),
    radial-gradient(90% 70% at 100% 100%, rgba(91, 164, 255, .12), transparent 62%);
}
.brand-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(rgba(166, 186, 210, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(166, 186, 210, .06) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(90% 90% at 30% 40%, #000, transparent 85%); mask-image: radial-gradient(90% 90% at 30% 40%, #000, transparent 85%);
}
.brand > * { position: relative; z-index: 1; }
.brand-top { display: flex; align-items: center; gap: 14px; }
.brand-top .logo { width: 38px; height: 38px; flex-shrink: 0; }
.brand-top b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: #f3f6fa; }
.brand-top span { display: block; font-size: 12.5px; color: #8392a5; margin-top: 1px; }

/* ── Diagrama de proceso (P&ID animado) ─────────────────────────────────── */
.art { position: relative; flex: 1 1 0; min-height: 250px; background: radial-gradient(58% 52% at 50% 56%, rgba(91, 164, 255, .09), transparent 72%); width: calc(100% + 2 * var(--padx)); margin: 10px calc(-1 * var(--padx)) 2px; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 4%, #000 95%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 4%, #000 95%, transparent 100%); }
/* tuberías: pared + luz interior + fluido en movimiento */
.art .wall { fill: none; stroke: #2e3d52; stroke-width: 8.5; stroke-linecap: round; stroke-linejoin: round; }
.art .bore { fill: none; stroke: #09101a; stroke-width: 5.6; stroke-linecap: round; stroke-linejoin: round; }
.art .flow { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 7 9; animation: flow 2.4s linear infinite; }
.art .flow.steam { stroke: #f4a24a; } .art .flow.proc { stroke: #a58bff; } .art .flow.vap { stroke: #d8ccff; stroke-dasharray: 3 8; }
.art .flow.cond { stroke: #3fd0b8; } .art .flow.cw { stroke: #38d0e8; }
/* equipos */
.art .vs3 { stroke: rgba(196, 211, 232, .72); stroke-width: 1.4; }
.art .tb { fill: none; stroke: rgba(196, 211, 232, .4); stroke-width: 1.1; stroke-linecap: round; }
.art .tw { fill: none; stroke: rgba(196, 211, 232, .6); stroke-width: 1.6; }
.art .tray { fill: none; stroke: rgba(196, 211, 232, .45); stroke-width: 1.3; stroke-linecap: round; }
.art .fl { fill: none; stroke: rgba(210, 222, 240, .75); stroke-width: 1.7; }
.art .leg { fill: none; stroke: rgba(196, 211, 232, .42); stroke-width: 1.4; stroke-linecap: round; }
.art .mw { fill: #0b1119; stroke: rgba(196, 211, 232, .55); stroke-width: 1.2; }
.art .furn { fill: #090e15; stroke: rgba(196, 211, 232, .45); stroke-width: 1.2; }
.art .glass { fill: rgba(120, 190, 255, .28); stroke: rgba(196, 211, 232, .4); stroke-width: .8; }
.art .lvl { animation: bob 4.5s ease-in-out infinite alternate; } .art .lvl.l2 { animation-delay: -1s; } .art .lvl.l3 { animation-delay: -2s; } .art .lvl.l4 { animation-delay: -3s; } .art .lvl.l5 { animation-delay: -1.6s; }
.art .flm { transform-box: fill-box; transform-origin: 0% 50%; animation: flick .45s ease-in-out infinite alternate; }
.art .smk { fill: rgba(196, 211, 232, .2); animation: smoke 3.4s ease-in infinite; } .art .smk.s2 { animation-delay: -1.7s; }
.art .vb { fill: #0e1520; stroke: rgba(214, 226, 244, .88); stroke-width: 1.3; stroke-linejoin: round; }
.art .vs { fill: none; stroke: rgba(214, 226, 244, .8); stroke-width: 1.3; }
.art .va { fill: #121b28; stroke: rgba(214, 226, 244, .88); stroke-width: 1.3; }
.art .pos, .art .vfd, .art .trap { fill: #0e1520; stroke: rgba(196, 211, 232, .62); stroke-width: 1.2; }
.art .pump .pc { fill: #0e1520; stroke: rgba(214, 226, 244, .88); stroke-width: 1.5; }
.art .pump .rot { fill: rgba(214, 226, 244, .85); animation: spin 1.4s linear infinite; } .art .pump .hub { fill: #0e1520; stroke: rgba(214, 226, 244, .9); stroke-width: 1; }
.art .mot rect { fill: #0e1520; stroke: rgba(196, 211, 232, .6); stroke-width: 1.2; } .art .mot path { stroke: rgba(196, 211, 232, .35); stroke-width: 1; fill: none; }
.art .mot text { font: 700 8px var(--mono); fill: #9fb0c6; text-anchor: middle; }
.art .fanb { fill: rgba(196, 211, 232, .12); stroke: rgba(196, 211, 232, .5); stroke-width: 1.2; }
.art .blades { fill: rgba(214, 226, 244, .85); animation: fanx .5s linear infinite alternate; }
.art .dcsband { stroke: rgba(150, 182, 236, .28); stroke-width: 1; }
.art .bus { fill: none; stroke: #5ba4ff; stroke-width: 1.2; stroke-dasharray: 3 3.6; opacity: .7; }
.art .jb { fill: #0b121a; stroke: #5ba4ff; stroke-width: 1.2; }
.art .arw { fill: #53c812; }
.art .tp { stroke: rgba(196, 211, 232, .5); }
/* instrumentos ISA: campo en verde, DCS en azul */
.art .bub circle { fill: #0b121a; stroke: #53c812; stroke-width: 1.5; }
.art .bub.dcs circle { stroke: #5ba4ff; } .art .bub.dcs path { stroke: #5ba4ff; stroke-width: 1.2; }
.art .bub text { font: 600 9.4px var(--mono); fill: #e3ebf6; text-anchor: middle; } .art .bub.sm text { font-size: 7.8px; }
/* señales 4–20 mA / HART con pulsos de datos */
.art .sg { fill: none; stroke: #53c812; stroke-width: 1.3; stroke-dasharray: 3 3.6; opacity: .8; stroke-linecap: round; stroke-linejoin: round; }
.art .pulse { fill: #c4ff86; filter: url(#glow); }
/* textos */
.art .tg { font: 500 10.4px var(--mono); fill: #94a5bc; letter-spacing: .03em; } .art .tg.b { fill: #e1eaf5; font-weight: 700; } .art .tg.faint { fill: #62728a; font-size: 9px; } .art .tg.c { font-size: 8px; fill: #a4b4ca; }
.art .rd { font: 700 11px var(--mono); fill: #6fdc2b; } .art .rd .u { fill: #7186a0; font-weight: 500; font-size: 9.2px; }
.art .rd.band { font-size: 10px; } .art .rd.band .u { font-size: 8px; }
.art .legend .lg { fill: none; stroke-width: 2.4; stroke-linecap: round; } .art .legend .lg.steam { stroke: #f4a24a; } .art .legend .lg.proc { stroke: #a58bff; } .art .legend .lg.cond { stroke: #3fd0b8; } .art .legend .lg.cw { stroke: #38d0e8; }
.art .legend .lgs { stroke: #53c812; stroke-width: 1.4; stroke-dasharray: 3 3; fill: none; }
.art .title rect { fill: rgba(9, 13, 18, .85); stroke: rgba(150, 182, 236, .3); stroke-width: 1; }
@keyframes flow { to { stroke-dashoffset: -32; } }
@keyframes bob { from { transform: translateY(1.5px); } to { transform: translateY(-1.5px); } }
@keyframes flick { from { transform: scale(1, .9); opacity: .85; } to { transform: scale(1.12, 1.08); opacity: 1; } }
@keyframes smoke { 0% { transform: translateY(0) scale(.7); opacity: .35; } 100% { transform: translateY(-34px) scale(1.7); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fanx { from { transform: scaleX(1); } to { transform: scaleX(.18); } }

.copy { max-width: 560px; margin-top: 22px; }
.copy h1 { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.08; letter-spacing: -.028em; font-weight: 650; color: #f6f9fc; }
.copy > p { margin-top: 12px; font-size: 14.5px; color: #a7b4c5; max-width: 50ch; }
.points { list-style: none; margin-top: 16px; display: grid; gap: 8px; }
.points li { display: flex; gap: 12px; align-items: flex-start; color: #a7b4c5; font-size: 13.5px; }
.points b { color: #e5eaf1; font-weight: 600; }
.points svg { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; stroke: #53c812; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand footer { font-size: 12px; color: #627084; }

/* ── Panel de acceso ────────────────────────────────────────────────────── */
.panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 40px 28px; background: var(--panel); }
.card { width: min(100%, 410px); }
.view > * + * { margin-top: 16px; }
.view h2 { font-size: 26px; line-height: 1.15; letter-spacing: -.022em; font-weight: 650; color: var(--ink); }
.view h2 + .muted { margin-top: 8px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 7px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  font-size: 15px; transition: border-color .15s, box-shadow .15s; outline: none;
}
.field input:hover { border-color: var(--faint); }
.field input:focus { border-color: var(--brand); box-shadow: var(--focus); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.pw { position: relative; }
.pw input { padding-right: 46px; }
.eye { position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.eye:hover { color: var(--ink); background: var(--panel-2); }
.eye svg, .back svg, .badge-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.caps { display: block; margin-top: 7px; font-size: 12.5px; color: var(--warn); font-weight: 550; }
.hint { display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.hint.bad { color: var(--danger); } .hint.good { color: var(--ok); }

.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 9px; }
.meter i { height: 4px; border-radius: 4px; background: var(--line); transition: background .2s; }
.meter[data-s="1"] i:nth-child(-n+1) { background: var(--danger); }
.meter[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-s="3"] i:nth-child(-n+3) { background: #7bbf20; }
.meter[data-s="4"] i { background: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px; padding: 0 20px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 16px rgba(44, 138, 0, .22); }
@media (prefers-color-scheme: dark) { :root:not(.light) .btn.primary { color: #06130a; box-shadow: 0 6px 18px rgba(83, 200, 18, .18); } }
.btn.primary:hover { background: var(--brand-hi); border-color: var(--brand-hi); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn .spin { display: none; }
.btn.busy span { opacity: .0; position: absolute; } .btn.busy { position: relative; } .btn.busy .spin { display: inline-block; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: rot .7s linear infinite; }
.spin.big { width: 34px; height: 34px; margin: 24px auto 4px; display: block; border-color: var(--line); border-top-color: var(--brand); }
@keyframes rot { to { transform: rotate(360deg); } }

.alt { text-align: center; font-size: 13.5px; color: var(--muted); padding-top: 4px; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--muted); font-size: 13.5px; cursor: pointer; padding: 2px 6px 2px 0; margin-bottom: 2px; }
.back:hover { color: var(--ink); }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 500; background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.info { background: var(--brand-soft); color: var(--ink-2); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.badge-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); }
.badge-ic.ok { color: var(--ok); } .badge-ic.warn { color: var(--warn); }
.steps { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.steps b { padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.legal { max-width: 410px; text-align: center; font-size: 12px; color: var(--faint); line-height: 1.5; }

@media (max-height: 820px) { .points { display: none; } .copy > p { max-width: 62ch; } }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .brand { padding: 24px; min-height: 0; }
  .art, .copy, .brand footer { display: none; }
  .panel { padding-top: 32px; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .art *, .art .flow { animation: none !important; } .spin { animation-duration: 1.6s; } }
