/* WMS Dropanas · estilos base compartidos */
:root {
  --azul: #1f2b44;          /* azul Dropanas */
  --azul-2: #2d3d5e;
  --rojo: #c8322f;          /* rojo Dropanas */
  --rojo-suave: #fbeceb;
  --fondo: #f3f4f6;
  --superficie: #ffffff;
  --borde: #dfe2e8;
  --texto: #1a2133;
  --texto-2: #5b6478;
  --ok: #1e7a4c;
  --ok-suave: #e5f4ec;
  --alerta: #a35d00;
  --alerta-suave: #fdf2e0;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --fuente: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.45;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
code, .mono { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
i[data-lucide], svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 60px;
  background: var(--azul); color: #fff;
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; text-decoration: none; }
.marca-logo {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--rojo); font-family: var(--mono); font-size: 13px; letter-spacing: -.5px;
}
.marca small { font-weight: 400; opacity: .7; font-size: 13px; }
.barra-der { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.barra-usuario { text-align: right; line-height: 1.2; }
.barra-usuario small { display: block; opacity: .7; font-size: 12px; }
.barra .btn-icono { color: #fff; }
.barra .btn-icono:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radio);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-pri { background: var(--rojo); color: #fff; }
.btn-pri:hover { background: #ad2926; }
.btn-sec { background: var(--superficie); color: var(--texto); border-color: var(--borde); }
.btn-sec:hover { border-color: #b9bfcb; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-icono {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 8px; background: transparent; color: var(--texto-2); cursor: pointer;
}
.btn-icono:hover { background: var(--fondo); color: var(--texto); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo > span { font-weight: 600; font-size: 14px; }
.campo small { color: var(--texto-2); font-size: 13px; }
.campo input, .campo select, .campo textarea {
  min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--borde); border-radius: 8px;
  font: inherit; color: var(--texto); background: #fff;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--azul-2); outline-offset: 0; border-color: transparent; }
.campo-check { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.campo-check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--rojo); }
.req { color: var(--rojo); }

/* ---------- Tablas ---------- */
.tabla-envoltura { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); background: #f8f9fb; font-weight: 600; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--borde); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.acciones { text-align: right; width: 1%; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ancho { white-space: normal; min-width: 220px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.chip-ok { background: var(--ok-suave); color: var(--ok); }
.chip-off { background: #eceef2; color: var(--texto-2); }
.chip-rojo { background: var(--rojo-suave); color: var(--rojo); }
.chip-alerta { background: var(--alerta-suave); color: var(--alerta); }
.chip-azul { background: #e8edf7; color: var(--azul-2); }

/* ---------- Vacío ---------- */
.vacio { display: grid; place-items: center; gap: 8px; padding: 48px 16px; color: var(--texto-2); background: var(--superficie); border: 1px dashed var(--borde); border-radius: var(--radio); text-align: center; }
.vacio i[data-lucide], .vacio svg.lucide { width: 28px; height: 28px; }
.vacio p { margin: 0; }

/* ---------- Modal ---------- */
.modal-fondo { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(15, 22, 38, .45); }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--superficie); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.modal-cab h2 { font-size: 18px; }
.modal-cuerpo { padding: 8px 20px; overflow-y: auto; }
.modal-error { margin: 0 20px; padding: 10px 12px; border-radius: 8px; background: var(--rojo-suave); color: var(--rojo); font-weight: 600; font-size: 14px; }
.modal-pie { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px 20px; }

/* ---------- Avisos ---------- */
#avisos { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.aviso { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radio); background: var(--azul); color: #fff; box-shadow: var(--sombra); font-weight: 500; transition: opacity .4s, transform .4s; }
.aviso-error { background: var(--rojo); }
.aviso.saliendo { opacity: 0; transform: translateY(8px); }

/* ---------- Nota informativa ---------- */
.nota { display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radio); background: #e8edf7; color: var(--azul-2); font-size: 14px; }
.nota svg.lucide { margin-top: 2px; }

/* ---------- Contenedor ---------- */
.contenedor { max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px; }
.cargando { display: grid; place-items: center; min-height: 60vh; color: var(--texto-2); }

@media (max-width: 640px) {
  .barra { padding: 0 12px; }
  .marca small, .barra-usuario { display: none; }
  .contenedor { padding: 16px 16px 48px; }
}
