/* Portal Cryotainer LNG · operación — estilos comunes
   Temas: normal (navy #1B3A6B, Arial) y cyber (mismos colores que la HMI). */

:root, [data-tema="normal"] {
  --fondo:   #eeeae3;
  --placa:   #fbfaf7;
  --placa2:  #f3f0ea;
  --linea:   #d6d0c4;
  --texto:   #1d2a3d;
  --tenue:   #6b7383;
  --acento:  #1b3a6b;
  --acento2: #2f6db3;
  --ok:      #2e8b57;
  --aviso:   #c97a10;
  --falla:   #c0392b;
  --boton-txt: #ffffff;
  --fuente:  Arial, "Helvetica Neue", Helvetica, sans-serif;
  --radio:   6px;
  --sombra:  0 1px 2px rgba(20, 30, 50, .06), 0 8px 24px rgba(20, 30, 50, .06);
}
[data-tema="cyber"] {
  --fondo:   #05070e;
  --placa:   #0b1020;
  --placa2:  #101830;
  --linea:   #1a2848;
  --texto:   #cfe4f5;
  --tenue:   #62809e;
  --acento:  #22e8ff;
  --acento2: #ff2d95;
  --ok:      #6bff9e;
  --aviso:   #ffb238;
  --falla:   #ff4d5e;
  --boton-txt: #05070e;
  --fuente:  ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --radio:   3px;
  --sombra:  0 0 0 1px var(--linea);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo); color: var(--texto);
  font-family: var(--fuente); font-size: 15px; line-height: 1.45;
  transition: background .3s ease, color .3s ease;
}
[data-tema="cyber"] body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--linea) 1px, transparent 1px),
    linear-gradient(90deg, var(--linea) 1px, transparent 1px);
  background-size: 44px 44px; opacity: .22;
}

/* ---------- logo: en cyber se vuelve blanco ---------- */
.logo { display: block; height: auto; }
[data-tema="cyber"] .logo { filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(34, 232, 255, .45)); }

/* ---------- selector de tema ---------- */
.temas { display: inline-flex; border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.temas button {
  background: transparent; color: var(--tenue); border: 0; cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  padding: 7px 12px; min-height: 34px;
}
.temas button[aria-pressed="true"] { background: var(--acento); color: var(--boton-txt); }

/* ---------- reloj ---------- */
.reloj { text-align: right; line-height: 1.2; }
.reloj .hora { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--acento); letter-spacing: .04em; }
[data-tema="cyber"] .reloj .hora { text-shadow: 0 0 12px rgba(34, 232, 255, .5); }
.reloj .fecha { font-size: 12px; color: var(--tenue); }
.reloj .fecha::first-letter { text-transform: uppercase; }

/* =====================================================================
   PANTALLA DE ENTRADA
   ===================================================================== */
.entrada { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(380px, 460px) 1fr; min-height: 100vh; }

.lado-form {
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 40px; background: var(--placa); border-right: 1px solid var(--linea);
}
.lado-form .arriba { display: flex; align-items: flex-start; }
.selectores { display: flex; gap: 10px; flex-wrap: wrap; }
.lado-form .logo { width: 230px; margin-top: 6px; }

.form-centro { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 360px; width: 100%; }
.form-centro h1 { margin: 0 0 6px; font-size: 26px; color: var(--acento); letter-spacing: .01em; }
[data-tema="cyber"] .form-centro h1 { text-transform: uppercase; letter-spacing: .12em; font-size: 21px; text-shadow: 0 0 14px rgba(34, 232, 255, .4); }
.form-centro .sub { margin: 0 0 26px; color: var(--tenue); }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tenue); }
.campo input {
  font: inherit; font-size: 16px; color: var(--texto); background: var(--placa2);
  border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px 14px; min-height: 48px; width: 100%;
}
.campo input:focus { outline: 2px solid var(--acento); outline-offset: 1px; border-color: var(--acento); }
.campo input.codigo { font-size: 26px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding-left: 26px; }

.boton {
  font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em;
  background: var(--acento); color: var(--boton-txt); border: 0; border-radius: var(--radio);
  padding: 13px 18px; min-height: 48px; width: 100%; cursor: pointer;
}
.boton:hover { filter: brightness(1.08); }
.boton:disabled { opacity: .55; cursor: wait; }
[data-tema="cyber"] .boton { text-transform: uppercase; letter-spacing: .14em; box-shadow: 0 0 18px rgba(34, 232, 255, .35); }
.enlace { background: none; border: 0; color: var(--acento2); font: inherit; font-size: 13px; cursor: pointer; padding: 10px 0; text-decoration: underline; }

.aviso { border-radius: var(--radio); padding: 11px 13px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.aviso.info  { border-color: var(--acento2); background: color-mix(in srgb, var(--acento2) 8%, transparent); }
.aviso.error { border-color: var(--falla); color: var(--falla); background: color-mix(in srgb, var(--falla) 8%, transparent); }
.aviso.ok    { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
[hidden] { display: none !important; }

.bienvenida .rol { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--acento); color: var(--acento); border-radius: var(--radio); padding: 3px 8px; margin-bottom: 16px; }
.lista-eq { list-style: none; padding: 0; margin: 0 0 18px; border: 1px solid var(--linea); border-radius: var(--radio); }
.lista-eq li { display: flex; justify-content: space-between; gap: 10px; padding: 11px 13px; border-top: 1px solid var(--linea); }
.lista-eq li:first-child { border-top: 0; }
.lista-eq b { color: var(--acento); }
.lista-eq span { color: var(--tenue); font-size: 13px; }

.pie { font-size: 12px; color: var(--tenue); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.pie .enlaces { display: flex; gap: 16px; flex-wrap: wrap; }
.pie a { color: inherit; }

/* ---------- fotos que cambian ---------- */
.lado-fotos { position: relative; overflow: hidden; background: #0b1020; }
.lado-fotos .foto {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transform: scale(1.04); transition: opacity 1.4s ease, transform 8s linear;
}
.lado-fotos .foto.activa { opacity: 1; transform: scale(1.0); }
.lado-fotos::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(8, 18, 38, .78) 0%, rgba(8, 18, 38, 0) 42%);
}
[data-tema="cyber"] .lado-fotos::after {
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .18) 2px 3px),
    linear-gradient(to top, rgba(5, 7, 14, .9) 0%, rgba(5, 7, 14, 0) 45%),
    linear-gradient(to right, rgba(5, 7, 14, .55), rgba(5, 7, 14, 0) 30%);
}
.lema { position: absolute; left: 40px; right: 260px; bottom: 34px; z-index: 2; color: #fff; }
.reloj-foto { position: absolute; right: 40px; bottom: 34px; z-index: 2; color: #fff; }
.reloj-foto .hora, [data-tema="cyber"] .reloj-foto .hora { font-size: 34px; color: #fff; }
[data-tema="cyber"] .reloj-foto .hora { color: var(--acento); }
.reloj-foto .fecha { color: rgba(255,255,255,.85); font-size: 13px; }
.reloj-foto .hora, .reloj-foto .fecha { text-shadow: 0 1px 8px rgba(0,0,0,.55); }
.lema b { display: block; font-size: 28px; line-height: 1.15; max-width: 620px; }
.lema span { display: block; margin-top: 8px; font-size: 14px; opacity: .85; }
[data-tema="cyber"] .lema b { font-size: 22px; letter-spacing: .1em; text-transform: uppercase; color: var(--acento); text-shadow: 0 0 16px rgba(34, 232, 255, .5); }
.puntos { display: flex; gap: 8px; margin-top: 16px; }
.puntos i { width: 26px; height: 3px; background: rgba(255, 255, 255, .35); border-radius: 2px; }
.puntos i.activa { background: #fff; }
[data-tema="cyber"] .puntos i.activa { background: var(--acento); box-shadow: 0 0 8px var(--acento); }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .entrada { grid-template-columns: 1fr; grid-template-rows: 34vh auto; }
  .lado-fotos { order: -1; }
  .lado-form { border-right: 0; padding: 20px 16px 24px; gap: 22px; }
  .lado-form .logo { width: 170px; }
  .lema { left: 16px; right: 130px; bottom: 16px; }
  .reloj-foto { right: 16px; bottom: 16px; }
  .reloj-foto .hora, [data-tema="cyber"] .reloj-foto .hora { font-size: 20px; }
  .reloj-foto .fecha { font-size: 11px; max-width: 120px; }
  .lema b, [data-tema="cyber"] .lema b { font-size: 18px; }
  .lema span { display: none; }
  .form-centro { max-width: none; justify-content: flex-start; }
}

/* =====================================================================
   PÁGINAS CON SESIÓN (tablero, equipo)
   ===================================================================== */
body.app { min-height: 100vh; }
.cabecera {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--placa); border-bottom: 1px solid var(--linea);
}
[data-tema="normal"] .cabecera { background: #1b3a6b; border-bottom-color: #1b3a6b; color: #fff; }
[data-tema="normal"] .cabecera .logo { filter: brightness(0) invert(1); }
.cab-logo .logo { width: 170px; }
.cab-usuario { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 140px; }
.cab-usuario b { font-size: 14px; }
.cab-usuario span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
[data-tema="normal"] .cabecera .temas { border-color: rgba(255,255,255,.35); }
[data-tema="normal"] .cabecera .temas button { color: rgba(255,255,255,.75); }
[data-tema="normal"] .cabecera .temas button[aria-pressed="true"] { background: #fff; color: #1b3a6b; }
.boton-sec {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; min-height: 34px;
  background: transparent; color: var(--acento); border: 1px solid var(--acento); border-radius: var(--radio); padding: 7px 14px;
}
[data-tema="normal"] .cabecera .boton-sec { color: #fff; border-color: rgba(255,255,255,.6); }
.boton-sec:hover { background: color-mix(in srgb, var(--acento) 10%, transparent); }
.boton-sec.chico { font-size: 12px; padding: 4px 10px; min-height: 30px; }
.boton-sec.peligro { color: var(--falla); border-color: var(--falla); }

.contenido { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }
.titulo-pag { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.titulo-pag h1 { margin: 0; font-size: 28px; color: var(--acento); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
[data-tema="cyber"] .titulo-pag h1 { letter-spacing: .1em; text-transform: uppercase; font-size: 24px; text-shadow: 0 0 14px rgba(34,232,255,.4); }
.titulo-pag .sub { margin: 4px 0 0; color: var(--tenue); }
.titulo-pag .sub a { color: var(--acento2); }
.tenue { color: var(--tenue); }
.volver { display: inline-block; margin-bottom: 12px; color: var(--acento2); font-size: 14px; }
.volver::before { content: "← "; }
.nota { color: var(--tenue); font-size: 12px; margin-top: 14px; }

/* ---- totales ---- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--placa); border: 1px solid var(--linea); border-left: 4px solid var(--acento); border-radius: var(--radio);
       padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--sombra); }
.kpi-et { font-size: 12px; color: var(--tenue); letter-spacing: .04em; }
.kpi-v { font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--texto); }
.kpi-u { font-size: 12px; color: var(--tenue); }
.kpi-ok { border-left-color: var(--ok); }
.kpi-aviso { border-left-color: var(--aviso); }
.kpi-falla { border-left-color: var(--falla); }
.kpi-falla .kpi-v { color: var(--falla); }

/* ---- tarjetas de equipo ---- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.tarjeta {
  display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit;
  background: var(--placa); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px;
  box-shadow: var(--sombra); transition: border-color .15s ease, transform .15s ease;
}
.tarjeta:hover, .tarjeta:focus-visible { border-color: var(--acento); transform: translateY(-1px); }
[data-tema="cyber"] .tarjeta:hover { box-shadow: 0 0 22px rgba(34,232,255,.18); }
.tarjeta.apagada { opacity: .78; }
.t-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.t-codigo { font-size: 20px; color: var(--acento); letter-spacing: .04em; }
.t-ubic { font-size: 13px; }
.t-ubic a { color: var(--acento2); }
.t-alarma { align-self: flex-start; }
.t-et { display: block; font-size: 11px; color: var(--tenue); letter-spacing: .06em; text-transform: uppercase; }
.t-u { font-size: 12px; color: var(--tenue); margin-left: 4px; }
.t-flujo b { font-size: 30px; font-variant-numeric: tabular-nums; }
.t-cifras { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; border-top: 1px solid var(--linea); padding-top: 10px; }
.t-cifras b { font-size: 17px; font-variant-numeric: tabular-nums; }
.t-cifras .con-falla b { color: var(--falla); }
.barras { width: 100%; height: 56px; display: block; margin-top: 6px; }
.barras .b-dato { fill: var(--acento); }
[data-tema="normal"] .barras .b-dato { fill: #2f6db3; }
.barras .b-vacio { fill: var(--linea); }
.t-pie { display: flex; justify-content: space-between; font-size: 12px; border-top: 1px solid var(--linea); padding-top: 10px; }
.t-abrir { color: var(--acento2); font-weight: 700; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
        padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; font-family: var(--fuente); }
.pill-ok { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.pill-ok::before { content: "● "; }
.pill-off { color: var(--tenue); border-color: var(--linea); }
.pill-falla { color: var(--falla); border-color: var(--falla); background: color-mix(in srgb, var(--falla) 10%, transparent); }
.pill-info { color: var(--acento2); border-color: var(--acento2); }

/* ---- página de equipo ---- */
.opciones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.opcion {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 88px;
  background: var(--placa); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra);
}
.opcion:hover:not(:disabled) { border-color: var(--acento); }
.opcion.activa { border-color: var(--acento); box-shadow: inset 0 -3px 0 var(--acento), var(--sombra); }
.opcion:disabled { cursor: not-allowed; opacity: .55; }
.op-icono { color: var(--acento); font-size: 18px; }
.opcion b { font-size: 15px; }
.op-sub { font-size: 12px; color: var(--tenue); }

.seccion { background: var(--placa); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px 20px; box-shadow: var(--sombra); }
.seccion h2 { margin: 0 0 14px; font-size: 18px; color: var(--acento); }
.seccion h3 { margin: 20px 0 10px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--tenue); }
.tabla-cont { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--tenue);
            border-bottom: 1px solid var(--linea); padding: 8px 10px; white-space: nowrap; }
.tabla td { border-bottom: 1px solid var(--linea); padding: 9px 10px; vertical-align: middle; }
.tabla td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla td.acciones { white-space: nowrap; text-align: right; }
.tabla td.acciones .boton-sec + .boton-sec { margin-left: 6px; }
.tabla tr.fila-activa td { background: color-mix(in srgb, var(--falla) 6%, transparent); }
.nivel { font-weight: 700; color: var(--falla); }

.form-subir { margin-top: 24px; border-top: 1px solid var(--linea); padding-top: 16px; }
.form-subir h3 { margin-top: 0; }
.fila-campos { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 12px; }
.form-subir select, .form-subir input[type="text"], .form-subir input[type="file"] {
  font: inherit; font-size: 14px; color: var(--texto); background: var(--placa2);
  border: 1px solid var(--linea); border-radius: var(--radio); padding: 10px 12px; min-height: 44px; width: 100%;
}
[data-tema="cyber"] .form-subir select { color-scheme: dark; }
.form-subir .boton { width: auto; padding: 11px 28px; }

@media (max-width: 900px) {
  .cabecera { padding: 10px 16px; gap: 10px; }
  .cab-logo .logo { width: 130px; }
  .contenido { padding: 16px 16px 32px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-v { font-size: 22px; }
  .tarjetas { grid-template-columns: 1fr; }
  .opciones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fila-campos { grid-template-columns: 1fr; }
  .titulo-pag .reloj { display: none; }
}
