/* Steer Vault — hoja de estilos propia, sin CDN ni build: la UI tiene que cargar
   con el servidor aislado de internet (es una herramienta de recuperación).

   Los tokens son los MISMOS de steer.run (src/styles/global.css) y del panel
   (steer_ui): fondo "ink" neutro sin glows, azul de marca anclado al del logo
   (#0E6FB6), teal SOLO para estados sanos y ámbar SOLO para la acción principal.
   Si cambian allá, cambian acá. */

/* Tipografías de marca, servidas por el propio nodo (nunca desde Google Fonts:
   esto tiene que abrir sin internet). Inter es la de texto del sitio; Geist Mono
   la de datos. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/inter-latin-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/geist-mono-var.woff2') format('woff2');
}

:root {
  --bg0: #07090C;
  --bg1: #0B0E11;
  --bg2: #131922;
  --surface: #11151C;
  --surface2: #151B23;
  --surface3: #1B222C;
  --line: rgba(120, 150, 205, .12);
  --line2: rgba(255, 255, 255, .06);
  --text: #B4BEC6;
  --strong: #EEF2F4;
  --muted: #78838C;
  --accent: #2A8BE0;
  --accent2: #0E6FB6;
  --link: #66AEFF;
  --teal: #4FD6C8;                 /* estados sanos: verificado, en línea */
  --amber: #F2A65A;
  --amber-deep: #E2812E;           /* acento cálido: SOLO la acción principal */
  --green: #3FCF6B;
  --warn: #F2C14E;
  --danger: #F2574C;
  --purple: #a78bfa;               /* marca distintiva, no es un estado de salud */
  --radius: 16px;
  --radius-btn: 11px;
  --grad-blue: linear-gradient(135deg, #0E6FB6 0%, #4A9BF2 100%);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .7);
  --shadow-sm: 0 10px 26px -16px rgba(0, 0, 0, .6);
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg1);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 440;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.oculto { display: none !important; }
code, pre, .mono { font-family: var(--mono); }

/* ---------- Marca ---------- */
.marca {
  display: flex; align-items: center; gap: 9px;
  font-size: 17px; letter-spacing: -.01em; color: var(--strong); font-weight: 400;
}
.marca b { font-weight: 800; }
.marca .timon { width: 26px; height: 26px; flex: 0 0 auto; }

/* ---------- Login ---------- */
.pantalla-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 640px at 50% -12%, var(--bg2) 0%, var(--bg1) 54%, var(--bg0) 100%);
  position: relative; overflow: hidden;
}
/* Retícula del hero de steer.run, tenue y enmascarada */
.pantalla-login::before {
  content: ""; position: absolute; inset: -2px; pointer-events: none;
  background-image: linear-gradient(rgba(120, 150, 205, .05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(120, 150, 205, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 68%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 68%);
}
.tarjeta-login {
  position: relative; z-index: 1;
  width: 100%; max-width: 372px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 30px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.tarjeta-login .marca { font-size: 19px; }
.tarjeta-login .sub { color: var(--muted); margin: 8px 0 20px; font-size: 13px; }
.tarjeta-login label { font-size: 12px; color: var(--muted); margin-top: 12px; }
.tarjeta-login .btn { margin-top: 22px; }

input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg0); color: var(--strong);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus {
  border-color: rgba(42, 139, 224, .55);
  box-shadow: 0 0 0 3px rgba(42, 139, 224, .13);
}

/* ---------- Botones ---------- */
.btn {
  padding: 9px 15px; border-radius: var(--radius-btn); border: 1px solid var(--line);
  background: var(--surface2); color: var(--text); cursor: pointer; font: inherit;
  font-weight: 500; transition: .15s;
}
.btn:hover { background: var(--surface3); color: var(--strong); border-color: rgba(120, 150, 205, .24); }
/* Azul de marca: la acción principal de cada bloque */
.btn.primario {
  background: var(--grad-blue); border: none; color: #fff; font-weight: 600;
  box-shadow: 0 12px 28px -14px rgba(42, 139, 224, .7);
}
.btn.primario:hover { filter: brightness(1.08); transform: translateY(-1px); }
/* Ámbar: reservado para UNA sola acción destacada por pantalla (igual que el CTA
   del sitio). Acá es el sobre de recuperación, que es lo que salva el día. */
.btn.cta {
  background: linear-gradient(135deg, var(--amber-deep) 0%, var(--amber) 100%);
  border: none; color: #2A1608; font-weight: 650;
  box-shadow: 0 12px 28px -14px rgba(226, 129, 46, .6);
}
.btn.cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.chico { padding: 6px 11px; font-size: 12.5px; }
.btn.fantasma { background: transparent; }
.btn.datos { color: var(--link); border-color: rgba(42, 139, 224, .3); }
.btn.datos:hover { background: rgba(42, 139, 224, .1); }
.btn.peligro { color: var(--danger); border-color: rgba(242, 87, 76, .28); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Cabecera ---------- */
.cabecera {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 17, .86); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.cabecera-der { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usuario { color: var(--muted); font-size: 13px; }
.pastilla {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px; background: rgba(42, 139, 224, .08);
  border: 1px solid rgba(42, 139, 224, .2); font-size: 12px; color: var(--link);
  font-family: var(--mono); font-weight: 500;
}
.pastilla::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  flex: 0 0 auto;
}
.pastilla.ok { color: var(--teal); border-color: rgba(79, 214, 200, .22); background: rgba(79, 214, 200, .08); }
.pastilla.ok::before { background: var(--teal); box-shadow: 0 0 0 3px rgba(79, 214, 200, .16); }
.pastilla.mal { color: var(--danger); border-color: rgba(242, 87, 76, .26); background: rgba(242, 87, 76, .08); }
.pastilla.mal::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(242, 87, 76, .16); }

.banda {
  padding: 11px 24px; background: rgba(242, 193, 78, .08);
  border-bottom: 1px solid rgba(242, 193, 78, .2); color: #F0D9A0; font-size: 13px;
}
.banda b { color: var(--warn); }

main { padding: 26px 24px; max-width: 1440px; margin: 0 auto; }

/* ---------- Métricas ---------- */
/* Una sola fila en pantalla ancha: son seis indicadores que se leen de un vistazo,
   no una grilla que crece. Debajo de 1180px se repliega en dos filas. */
.metricas {
  display: grid; gap: 12px; margin-bottom: 24px;
  grid-template-columns: repeat(5, minmax(0, 1fr)) 1.35fr;
}
@media (max-width: 1180px) { .metricas { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metrica {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px; min-width: 0;
}
.metrica .valor, .metrica .etiqueta { overflow-wrap: anywhere; }

/* Tarjeta de disco con anillo: el espejo se muere sin espacio, así que el estado
   se ve como gráfico y no como un número más. */
.metrica.disco { display: flex; align-items: center; gap: 14px; }
.metrica.disco .anillo { width: 64px; height: 64px; flex: 0 0 auto; }
.metrica.disco .disco-txt { min-width: 0; }
.anillo .pista {
  fill: none; stroke: var(--surface3); stroke-width: 7;
}
.anillo .avance {
  fill: none; stroke-width: 7; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 32px 32px;
  transition: stroke-dashoffset .6s ease, stroke .3s;
}
.anillo .cifra {
  font-size: 15px; font-weight: 700; text-anchor: middle;
  font-family: var(--sans); letter-spacing: -.03em;
}
.anillo .pie {
  font-size: 7.5px; text-anchor: middle; fill: var(--muted);
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .12em;
}
.metrica .valor {
  font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: var(--strong);
  line-height: 1.15;
}
.metrica .etiqueta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.metrica.destaca { border-color: rgba(79, 214, 200, .22); }
.metrica.destaca .valor { color: var(--teal); }
.metrica.avisa { border-color: rgba(242, 193, 78, .22); }
.metrica.avisa .valor { color: var(--warn); }
.metrica.clicable { cursor: pointer; transition: border-color .15s, background .15s; }
.metrica.clicable:hover { border-color: rgba(120, 150, 205, .32); background: var(--surface2); }

/* ---------- Pestañas ---------- */
.pestanas {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 20px; flex-wrap: wrap;
}
.pestana {
  padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); cursor: pointer; font: inherit; font-weight: 500;
  border-radius: 8px 8px 0 0; transition: .15s;
}
.pestana:hover { color: var(--text); background: var(--surface); }
.pestana.activa { color: var(--strong); border-bottom-color: var(--accent); }

/* ---------- Filtros ---------- */
.filtros, .fila-controles {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
}
.filtros input[type=search] { flex: 1; min-width: 220px; }
.filtros select, .fila-controles select { width: auto; min-width: 170px; }
.fila-controles input { width: auto; min-width: 180px; }
.fila-controles label { color: var(--muted); font-size: 13px; }
.ayuda { color: var(--muted); font-size: 12px; }

/* ---------- Tablas ---------- */
.tabla-scroll {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px 15px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11px;
  text-transform: uppercase; letter-spacing: .09em;
}
td { padding: 11px 15px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface2); }
th.num, td.num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
th.acciones, td.acciones { text-align: right; white-space: nowrap; }
td.acciones .btn { margin-left: 5px; }
.nombre-backup { font-weight: 550; color: var(--strong); }
.sub-linea { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }

/* ---------- Etiquetas de estado ---------- */
.et {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--line); background: var(--surface2); color: var(--muted);
  white-space: nowrap; font-weight: 500;
}
/* Teal = sano, igual que en el sitio */
.et.verified { color: var(--teal); border-color: rgba(79, 214, 200, .26); background: rgba(79, 214, 200, .08); }
.et.stored { color: var(--link); border-color: rgba(42, 139, 224, .26); background: rgba(42, 139, 224, .08); }
.et.error { color: var(--danger); border-color: rgba(242, 87, 76, .28); background: rgba(242, 87, 76, .08); }
.et.pending, .et.downloading { color: var(--warn); border-color: rgba(242, 193, 78, .26); background: rgba(242, 193, 78, .08); }
.et.purged { color: var(--muted); }
.et.capped { color: var(--muted); border-style: dashed; }
.et.missing { color: var(--muted); border-style: dotted; }
.et.conservado { color: var(--purple); border-color: rgba(167, 139, 250, .3); background: rgba(167, 139, 250, .09); }
.et.prod { color: #FF9C93; border-color: rgba(242, 87, 76, .26); }
.et-error-clic, .error-preview { cursor: pointer; }
.et-error-clic:hover { border-color: rgba(242, 87, 76, .5); background: rgba(242, 87, 76, .16); }
.error-preview:hover { color: var(--danger); text-decoration: underline; }
.error-detalle {
  background: var(--bg0); border: 1px solid rgba(242, 87, 76, .28); border-radius: 10px;
  padding: 12px; margin: 12px 0 0; font-size: 12.5px; color: #FF9C93;
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto;
}

/* ---------- Notas ---------- */
.nota {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 18px;
  color: var(--text); font-size: 13px;
}
.nota b { color: var(--strong); }
.nota.critica { border-left-color: var(--amber); }
.nota-sub { color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.vacio { color: var(--muted); text-align: center; padding: 34px; }

/* ---------- Bloques plegables (ayuda) ---------- */
/* La explicación larga no puede ocupar la pantalla todos los días: se lee una vez
   y después estorba. Va plegada, y quien la necesita la abre. */
.plegable {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 12px;
}
.plegable > summary {
  cursor: pointer; padding: 12px 16px; color: var(--text); font-weight: 550;
  list-style: none; display: flex; align-items: center; gap: 9px; user-select: none;
  border-radius: 12px;
}
.plegable > summary::-webkit-details-marker { display: none; }
.plegable > summary::before {
  content: ""; width: 0; height: 0; flex: 0 0 auto;
  border-left: 5px solid var(--accent); border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; transition: transform .15s;
}
.plegable[open] > summary::before { transform: rotate(90deg); }
.plegable > summary:hover { color: var(--strong); background: var(--surface2); }
.plegable[open] > summary { border-bottom: 1px solid var(--line2); border-radius: 12px 12px 0 0; }
.plegable-cuerpo { padding: 4px 18px 14px; font-size: 13px; }
.plegable-cuerpo p { margin: 10px 0; }
.plegable-cuerpo b { color: var(--strong); }
.plegable-cuerpo code {
  background: var(--bg0); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 5px; font-size: 12px; color: var(--teal);
}

/* ---------- Pestaña de ayuda ---------- */
.ayuda-doc { max-width: 900px; }
.tabla-simple { width: 100%; border-collapse: collapse; margin: 6px 0 2px; }
.tabla-simple td { padding: 8px 10px 8px 0; vertical-align: top; border-bottom: 1px solid var(--line2); }
.tabla-simple td:first-child { width: 132px; white-space: nowrap; color: var(--text); }
.tabla-simple tr:last-child td { border-bottom: none; }

/* ---------- Formulario en grilla ---------- */
/* Dos columnas: un formulario de diez campos apilados se lee como un trámite. */
.grilla-form {
  display: grid; gap: 12px 16px; margin-bottom: 16px; max-width: 1080px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.grilla-form .campo.ancho { grid-column: 1 / -1; }
.grupo-titulo { color: var(--text); font-weight: 600; font-size: 13px; margin: 4px 0 10px; }
.grilla-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.grilla-form label.check {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text);
  margin: 0; cursor: pointer;
}
.grilla-form label.check input {
  width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer;
}
.grilla-form input, .grilla-form select { width: 100%; }

/* Estado del diagnóstico que se informa por correo */
.diagnostico { margin-bottom: 16px; }
.diagnostico ul { margin: 8px 0 0; padding-left: 20px; }
.diagnostico li { margin-bottom: 5px; }
.diagnostico li.grave { color: #FF9C93; }

/* ---------- Tarjetas de recuperación ---------- */
.tarjetas-recuperacion {
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.tarjeta {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 11px;
}
.tarjeta h3 { margin: 0; font-size: 15px; color: var(--strong); font-weight: 650; letter-spacing: -.01em; }
.tarjeta p { margin: 0; color: var(--muted); font-size: 13px; }
.tarjeta pre {
  background: var(--bg0); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; overflow-x: auto; font-size: 11.5px; color: var(--teal); margin: 0;
  line-height: 1.55;
}
.tarjeta .btn { align-self: flex-start; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(5, 7, 10, .74); display: grid;
  place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(3px);
}
.modal-caja {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 860px; max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-cabecera {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 19px; border-bottom: 1px solid var(--line);
}
.modal-cabecera h3 { margin: 0; font-size: 15px; color: var(--strong); font-weight: 650; }
.modal-cuerpo { padding: 17px 19px; overflow: auto; }
.modal-cuerpo table { font-size: 12.5px; }

/* ---------- Tostadas ---------- */
.tostadas {
  position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column;
  gap: 9px; z-index: 60;
}
.tostada {
  background: var(--surface2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-sm);
  max-width: 390px; font-size: 13px; color: var(--text);
  animation: entrar .18s ease-out;
}
.tostada.ok { border-left-color: var(--teal); }
.tostada.mal { border-left-color: var(--danger); }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

.sub-titulo { font-size: 13px; color: var(--muted); font-weight: 600; margin: 20px 0 10px;
  text-transform: uppercase; letter-spacing: .09em; }

/* ---------- Selección múltiple ---------- */
.barra-lote {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 12px; padding: 11px 16px;
  background: rgba(42, 139, 224, .08); border: 1px solid rgba(42, 139, 224, .24);
  border-radius: 12px; color: var(--text); font-size: 13px;
}
.barra-lote b { color: var(--strong); }
.barra-lote-btns { display: flex; gap: 8px; flex-wrap: wrap; }

th.sel, td.sel { width: 34px; padding-right: 0; }
td.sel input, th.sel input {
  width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer;
}
tbody tr.marcada td { background: rgba(42, 139, 224, .07); }

/* ---------- Menú de acciones ---------- */
/* Posición fija y colgado del body: la tabla scrollea en horizontal, así que un menú
   absoluto dentro de ella quedaría recortado. */
.menu-flotante {
  position: fixed; z-index: 70; min-width: 232px; padding: 6px;
  background: var(--surface2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1px;
}
.menu-flotante button {
  display: block; width: 100%; text-align: left; padding: 8px 11px;
  background: none; border: none; color: var(--text); font: inherit; font-size: 13px;
  border-radius: 8px; cursor: pointer; transition: background .12s;
}
.menu-flotante button:hover { background: var(--surface3); color: var(--strong); }
.menu-flotante button.peligro { color: var(--danger); }
.menu-flotante button.peligro:hover { background: rgba(242, 87, 76, .1); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 8px; }

.modal-caja.angosta { max-width: 520px; }
.modal-cuerpo label { display: block; font-size: 12px; color: var(--muted); margin: 16px 0 6px; }
#borrar-lista { margin-bottom: 4px; line-height: 1.7; }

@media (max-width: 640px) {
  main { padding: 16px 14px; }
  .cabecera { padding: 12px 14px; }
  th, td { padding: 9px 11px; }
}
