/* Sistema de diseño de Venair, el mismo que customer-area.
   La marca es NEGRO corporativo (#0a0a0a), no azul, y la tipografía es Roobert. */
@import url("https://fonts.cdnfonts.com/css/roobert");

:root {
  --ink: #0a0a0a;
  --muted: #6c757d;
  --surface: #ffffff;
  --border: #e4e4e7;
  --subtle: #f8f9fa;

  --brand-100: #e4e4e7;
  --brand-300: #a1a1aa;
  --brand-400: #52525b;
  --brand-500: #0a0a0a;
  --brand-600: #050505;

  /* Estados — paleta sobria, ninguna estridente, como en customer-area. */
  --est-gris-fg: #52525b;  --est-gris-bg: #f4f4f5;  --est-gris-ring: #d4d4d8;
  --est-ambar-fg: #b45309; --est-ambar-bg: #fef3c7; --est-ambar-ring: #fcd34d;
  --est-azul-fg: #1e3a8a;  --est-azul-bg: #eff6ff;  --est-azul-ring: #bfdbfe;
  --est-verde-fg: #15803d; --est-verde-bg: #f0fdf4; --est-verde-ring: #bbf7d0;
  --est-rojo-fg: #b91c1c;  --est-rojo-bg: #fef2f2;  --est-rojo-ring: #fecaca;

  --radio: 0.25rem;
  --sombra: 0 1px 2px 0 rgb(0 0 0 / .04), 0 1px 3px 0 rgb(0 0 0 / .06);
  --fuente: "Roobert", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-weight: 500; line-height: 1.2; margin: 0; }
*:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* ── Cabecera negra ─────────────────────────────────────────────── */
.barra {
  position: sticky; top: 0; z-index: 40;
  background: #0a0a0a; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 16px 24px;
}
.marca { display: flex; align-items: center; gap: 12px; }
.marca .logo { display: block; height: 26px; width: auto; color: #fff; }
.marca .app {
  border-left: 1px solid rgb(255 255 255 / .25);
  padding-left: 12px; font-size: 14px; color: rgb(255 255 255 / .75);
  text-decoration: none; transition: color .15s;
}
.marca .app:hover { color: #fff; }

.barra nav { display: flex; gap: 8px; margin-left: auto; }
.barra nav a {
  display: inline-flex; align-items: center;
  border: 1px solid rgb(255 255 255 / .3); border-radius: var(--radio);
  padding: 8px 16px; font-size: 14px; font-weight: 500;
  color: #fff; text-decoration: none; transition: all .15s;
}
.barra nav a:hover { border-color: #fff; background: rgb(255 255 255 / .1); }
.barra nav a.activo { background: #fff; color: #0a0a0a; border-color: #fff; }

.usuario { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.usuario span { color: #fff; }
.usuario em {
  font-style: normal; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: rgb(255 255 255 / .6);
}
.usuario .salir {
  border: 1px solid rgb(255 255 255 / .3); border-radius: var(--radio);
  padding: 8px 14px; color: #fff; text-decoration: none; font-size: 14px;
  transition: all .15s;
}
.usuario .salir:hover { border-color: #fff; background: rgb(255 255 255 / .1); }

main { padding: 28px 24px; max-width: 1500px; margin: 0 auto; }

/* ── Login ──────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--subtle); }
.login .tarjeta {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 48px 40px; max-width: 400px; width: 100%; text-align: center;
}
.login .logo-grande { color: var(--ink); height: 30px; margin-bottom: 28px; }
.login h1 { font-size: 20px; margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 28px; font-size: 14px; }

/* ── Botones ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radio);
  background: var(--surface); color: var(--ink);
  padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn:hover:not(:disabled) { border-color: var(--brand-300); background: var(--subtle); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--brand-400); border-color: var(--brand-400); }
.btn-ms { width: 100%; padding: 11px; }
.btn-peligro { color: var(--est-rojo-fg); }
.btn-peligro:hover:not(:disabled) { background: var(--est-rojo-bg); border-color: var(--est-rojo-ring); }

/* ── Cabeceras y filtros ───────────────────────────────────────── */
.cabecera { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px;
  flex-wrap: wrap; }
.cabecera h1 { font-size: 22px; }
.cabecera .cuenta { color: var(--muted); font-size: 14px; }
.cabecera .acciones { margin-left: auto; display: flex; gap: 8px; }

.filtros { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
  align-items: center; }
.filtros input[type=search] {
  border: 1px solid var(--border); border-radius: var(--radio);
  background: var(--surface); padding: 9px 13px; font: inherit; font-size: 14px;
  min-width: 300px; transition: border-color .15s;
}
.filtros input[type=search]:focus { border-color: var(--brand-500); outline: none; }

.pestanas { display: flex; gap: 2px; border: 1px solid var(--border);
  border-radius: var(--radio); padding: 3px; background: var(--surface); }
.pestanas button {
  border: 0; background: none; border-radius: 2px; padding: 7px 14px;
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer;
  transition: all .15s;
}
.pestanas button:hover { background: var(--subtle); color: var(--ink); }
.pestanas button[aria-selected=true] { background: var(--brand-500); color: #fff; }

/* ── Tabla ──────────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden;
}
.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 11px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--subtle); }
td.lote { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 500; }
td.compacta { white-space: nowrap; }
td.acciones { text-align: right; white-space: nowrap; }
td.acciones .btn { padding: 6px 12px; font-size: 13px; }
.producto-nombre { color: var(--muted); font-size: 13px; margin-top: 2px; }

.vacio {
  padding: 64px 24px; text-align: center; color: var(--muted); font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radio); margin: 16px;
}
.vacio strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 6px; }

/* ── Etiquetas de estado ────────────────────────────────────────── */
.etiqueta {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 9999px;
  font-size: 12px; line-height: 1rem; font-weight: 600; white-space: nowrap;
  background: var(--est-gris-bg); color: var(--est-gris-fg);
  box-shadow: inset 0 0 0 1px var(--est-gris-ring);
}
.e-PENDIENTE_FIRMA { background: var(--est-ambar-bg); color: var(--est-ambar-fg);
  box-shadow: inset 0 0 0 1px var(--est-ambar-ring); }
.e-FIRMADO { background: var(--est-azul-bg); color: var(--est-azul-fg);
  box-shadow: inset 0 0 0 1px var(--est-azul-ring); }
.e-PUBLICADO, .e-YA_EN_SAP { background: var(--est-verde-bg); color: var(--est-verde-fg);
  box-shadow: inset 0 0 0 1px var(--est-verde-ring); }
.e-REVISION_MANUAL, .e-ERROR_PUBLICACION { background: var(--est-rojo-bg);
  color: var(--est-rojo-fg); box-shadow: inset 0 0 0 1px var(--est-rojo-ring); }
.r-admin { background: var(--est-rojo-bg); color: var(--est-rojo-fg);
  box-shadow: inset 0 0 0 1px var(--est-rojo-ring); }
.r-calidad { background: var(--est-azul-bg); color: var(--est-azul-fg);
  box-shadow: inset 0 0 0 1px var(--est-azul-ring); }

.aviso-descuadre { display: block; margin-top: 4px; font-size: 12px;
  color: var(--muted); line-height: 1.4; }

/* ── Modal de firma ─────────────────────────────────────────────── */
dialog.firma {
  border: 0; border-radius: var(--radio); padding: 0;
  width: min(1120px, 96vw); max-height: 94vh;
  box-shadow: 0 10px 40px rgb(0 0 0 / .25);
}
dialog.firma::backdrop { background: rgb(10 10 10 / .6); }
.firma-cabecera {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.firma-cabecera h2 { font-size: 17px; font-family: ui-monospace, Menlo, monospace; }
.firma-cabecera .meta { color: var(--muted); font-size: 14px; }
.firma-cabecera .cerrar { margin-left: auto; border: 0; background: none;
  font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.firma-cabecera .cerrar:hover { color: var(--ink); }
.firma-cuerpo { display: grid; grid-template-columns: 1fr 340px;
  height: min(72vh, 640px); }
.firma-cuerpo iframe { width: 100%; height: 100%; border: 0; background: var(--subtle); }
.firma-panel { padding: 22px; border-left: 1px solid var(--border);
  overflow-y: auto; display: flex; flex-direction: column; }
.firma-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.datos { list-style: none; margin: 0 0 24px; padding: 0; font-size: 14px; }
.datos li { display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border); }
.datos span { color: var(--muted); }
.datos b { font-weight: 500; text-align: right; }

.lienzo-caja { border: 1px dashed var(--brand-300); border-radius: var(--radio);
  background: var(--surface); position: relative; }
.lienzo-caja.dibujado { border-style: solid; border-color: var(--brand-500); }
canvas#lienzo { display: block; width: 100%; height: 150px; cursor: crosshair;
  touch-action: none; }
.lienzo-pista { position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; pointer-events: none; }
.lienzo-caja.dibujado .lienzo-pista { display: none; }
.firma-pie { margin-top: auto; padding-top: 20px; display: flex; gap: 8px; }
.firma-pie .btn { flex: 1; }

/* ── Avisos ─────────────────────────────────────────────────────── */
.avisos { position: fixed; bottom: 20px; right: 20px; display: flex;
  flex-direction: column; gap: 8px; z-index: 100; max-width: 440px; }
.avisos .aviso {
  padding: 13px 17px; border-radius: var(--radio);
  background: var(--ink); color: #fff; font-size: 14px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); animation: entra .18s ease-out;
}
.avisos .aviso.ok { background: var(--est-verde-fg); }
.avisos .aviso.mal { background: var(--est-rojo-fg); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important;
    transition-duration: .01ms !important; }
}

@media (max-width: 900px) {
  .firma-cuerpo { grid-template-columns: 1fr; height: auto; }
  .firma-cuerpo iframe { height: 46vh; }
  .firma-panel { border-left: 0; border-top: 1px solid var(--border); }
  .barra { padding: 12px 16px; gap: 12px; }
  .marca .app { display: none; }
  .usuario em { display: none; }
}
