/* AppSIG — Design System "Industrial Safety" */
@font-face {
  font-family: 'Saira Condensed';
  src: url('/vendor/fonts/saira-condensed-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Saira Condensed';
  src: url('/vendor/fonts/saira-condensed-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/vendor/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}

:root {
  /* Superficies (grafito/acero) */
  --bg: #121519;
  --surface: #1a1f26;
  --surface-2: #222933;
  --line: #2e3743;
  /* Texto */
  --text: #e8ecf1;
  --text-dim: #97a3b2;
  /* Acento: ámbar de señalización industrial */
  --amber: #ffb000;
  --amber-press: #e09a00;
  --amber-ink: #1a1205;       /* texto sobre ámbar */
  /* Semáforo semántico */
  --ok: #2fbf71;
  --warn: #ff9f1c;
  --danger: #e5484d;
  --info: #4f9cf9;
  /* Tipografía */
  --font-display: 'Saira Condensed', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  /* Métricas */
  --radius: 10px;
  --radius-sm: 6px;
  --pad: 16px;
  /* Franja de precaución (detalle sutil en alertas/headers) */
  --hazard: repeating-linear-gradient(-45deg, var(--amber) 0 10px, #2b2410 10px 20px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
}
h1, h2, h3, .display {
  font-family: var(--font-display); letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 700;
}
a { color: var(--amber); }

/* ── Layout ── */
.page { max-width: 1240px; margin: 0 auto; padding: 22px 18px 60px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 26px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 14px var(--font-body); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm);
  text-decoration: none; transition: filter 0.15s, border-color 0.15s;
}
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: var(--amber-press); filter: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad);
}
.card-click { cursor: pointer; transition: border-color 0.15s, transform 0.12s; }
.card-click:hover { border-color: var(--amber); transform: translateY(-1px); }
.grid-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}

/* ── Badges semáforo ── */
.badge {
  display: inline-block; font: 600 12px var(--font-body);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-ok { background: rgba(47, 191, 113, 0.16); color: var(--ok); }
.badge-warn { background: rgba(255, 159, 28, 0.16); color: var(--warn); }
.badge-danger { background: rgba(229, 72, 77, 0.16); color: var(--danger); }
.badge-info { background: rgba(79, 156, 249, 0.16); color: var(--info); }
.badge-dim { background: rgba(151, 163, 178, 0.14); color: var(--text-dim); }

/* ── Inputs ── */
.input, select.input, textarea.input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px;
  font: 400 14px var(--font-body);
}
.input:focus { outline: 2px solid var(--amber); outline-offset: -1px; }
.input::placeholder { color: var(--text-dim); opacity: 0.7; }
label.field { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }

/* ── Tabla ── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-family: var(--font-display); text-transform: uppercase; font-size: 13px;
  letter-spacing: 0.06em; color: var(--text-dim); text-align: left;
  padding: 10px 12px; border-bottom: 2px solid var(--line); font-weight: 600;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.row-click { cursor: pointer; }

/* ── Tabs (hub 360) — pills que envuelven: las 17 visibles a la vez ── */
.tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 7px 14px; color: var(--text-dim); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--font-display); font-size: 13.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.tabs a:hover { color: var(--text); border-color: var(--text-dim); }
.tabs a.active {
  background: var(--amber); border-color: var(--amber);
  color: var(--amber-ink); font-weight: 700;
}
@media (max-width: 640px) {
  .tabs { gap: 5px; }
  .tabs a { padding: 6px 12px; font-size: 12.5px; letter-spacing: 0.04em; }
}

/* ── Filtros pill ── */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button {
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font: 600 12.5px var(--font-body);
}
.pills button.active { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }

/* ── Detalles ── */
.hazard-strip { height: 6px; background: var(--hazard); border-radius: 3px; }
.empty {
  text-align: center; color: var(--text-dim); padding: 42px 16px;
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}
.muted { color: var(--text-dim); }
.mono { font-variant-numeric: tabular-nums; }

/* ── Avatar / logo placeholder ── */
.logo-chip {
  width: 44px; height: 44px; border-radius: 9px; flex: none;
  background: var(--amber); color: var(--amber-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  overflow: hidden;
}
.logo-chip img { width: 100%; height: 100%; object-fit: cover; }

/* ── Definición (ficha) ── */
.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.def-grid .def { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.def-grid .def b { display: block; font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; font-weight: 600; }

@media (max-width: 760px) {
  .page { padding: 16px 12px 80px; }
  .page-head h1 { font-size: 22px; }
  .btn { padding: 10px 16px; } /* dedos en obra */
}
/* ── SigModal: formularios modales propios ─────────────────────── */
.om-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 8, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.18s;
}
.om-overlay.om-open { opacity: 1; }
.om-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,176,0,0.04);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative; overflow: hidden;
}
.om-modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--amber), transparent 65%);
  opacity: 0.7;
}
.om-open .om-modal { transform: translateY(0) scale(1); }
.om-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px 12px;
}
.om-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: 0.02em; }
.om-subtitle { font-size: 11.5px; color: var(--text-dim); font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 3px; }
.om-x {
  background: none; border: none; color: var(--text-dim); font-size: 15px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.om-x:hover { color: var(--danger); background: var(--surface-2); }
.om-body { padding: 6px 22px 14px; overflow-y: auto; }
.om-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.om-field { grid-column: 1 / -1; display: flex; flex-direction: column; }
.om-field.om-half { grid-column: span 1; }
.om-section {
  grid-column: 1 / -1;
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--amber);
  border-bottom: 1px solid var(--line); padding: 14px 0 5px; margin-bottom: 4px;
}
.om-label {
  font-family: var(--font-display); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim);
  margin: 10px 0 5px;
}
.om-input {
  background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-family: var(--font-body); width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.om-input:focus { outline: none; border-color: var(--amber-press); box-shadow: 0 0 0 3px rgba(255,176,0,0.12); }
.om-input:disabled { opacity: 0.5; }
.om-input::placeholder { color: var(--text-dim); }
select.om-input option { background: var(--surface); }
.om-textarea { resize: vertical; min-height: 84px; }
.om-file { padding: 8px; }
.om-file::file-selector-button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; margin-right: 10px; cursor: pointer;
  font-family: var(--font-display); font-size: 12px;
}
.om-error { color: var(--danger); font-size: 12px; min-height: 14px; margin-top: 3px; }
.om-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 22px 18px; border-top: 1px solid var(--line);
}
.om-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 4px; }
.om-toggle input { display: none; }
.om-toggle-slider {
  width: 38px; height: 21px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); position: relative; flex: none;
  transition: background 0.18s, border-color 0.18s;
}
.om-toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--text-dim); transition: transform 0.18s, background 0.18s;
}
.om-toggle input:checked + .om-toggle-slider { background: var(--amber-press); border-color: var(--amber); }
.om-toggle input:checked + .om-toggle-slider::after { transform: translateX(17px); background: #fff; }
.om-toggle-text { font-size: 13.5px; }
.om-custom { margin-top: 2px; }

/* Móvil: sheet de pantalla completa desde abajo */
@media (max-width: 640px) {
  .om-overlay { padding: 0; align-items: flex-end; }
  .om-modal {
    max-width: none !important; border-radius: 16px 16px 0 0;
    max-height: 94vh; border-left: none; border-right: none; border-bottom: none;
    transform: translateY(40px);
  }
  .om-grid { grid-template-columns: 1fr; }
  .om-field.om-half { grid-column: 1 / -1; }
  .om-foot { position: sticky; bottom: 0; background: var(--surface); }
  .om-foot .btn { flex: 1; justify-content: center; }
}


/* Accesibilidad: foco visible por teclado (no en click de ratón) en controles. */
a:focus-visible, button:focus-visible, select:focus-visible,
[tabindex]:focus-visible, .card-click:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Banner de estado de prueba Free (trial-banner.js): flujo normal arriba del topnav
   (NO sticky: .snav ya es sticky top:0 z-index:50; dos sticky en top:0 se pisan y
   el banner tapaba el topnav al hacer scroll). */
.trial-bar {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; text-align: center;
  background: var(--warn); color: var(--amber-ink);
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em;
}
.trial-bar a { color: var(--amber-ink); text-decoration: underline; font-weight: 700; white-space: nowrap; }
.trial-bar-expired { background: var(--danger); color: #fff; }
.trial-bar-expired a { color: #fff; }

/* Skeletons: placeholder de carga reutilizable (.skeleton / .skeleton-row). */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2, #1a1f26); border-radius: 6px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: skl 1.2s infinite; }
.skeleton-row { height: 14px; margin: 8px 0; }
@keyframes skl { 100% { transform: translateX(100%); } }

/* ── SweetAlert2 — tema oscuro global ("Industrial Safety") ──
   Antes: la mayoría de modales salían en el tema claro por defecto y unos pocos
   en oscuro → inconsistencia. Esto unifica TODOS los modales en oscuro. */
.swal2-popup {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.swal2-title { color: var(--text) !important; }
.swal2-html-container, .swal2-content { color: var(--text-dim) !important; }
.swal2-input, .swal2-textarea, .swal2-select, .swal2-file {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}
.swal2-input::placeholder, .swal2-textarea::placeholder { color: var(--text-dim); }
.swal2-validation-message { background: var(--surface-2) !important; color: var(--danger) !important; }
.swal2-styled.swal2-confirm { background: var(--amber); color: var(--amber-ink); font-weight: 700; }
.swal2-styled.swal2-confirm:focus { box-shadow: 0 0 0 3px rgba(255,176,0,.35); }
.swal2-styled.swal2-cancel { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line); }
.swal2-styled:focus { outline: none; }
.swal2-close { color: var(--text-dim); }
.swal2-close:hover { color: var(--amber); }
.swal2-loader { border-color: var(--amber) transparent var(--amber) transparent; }
.swal2-timer-progress-bar { background: rgba(255, 176, 0, 0.5); }
.swal2-toast { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--line); }
