:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e6e9ef;
  --brand: #0f4c81;
  --brand-dark: #0b2f4f;
  --brand-soft: #e9f2fb;
  --danger: #b42318;
  --success: #22c55e;
  --pending: #374151;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

/* ============================================================
   CABECERA SUPERIOR + MENÚ PRINCIPAL
   ============================================================ */

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 18px 28px;
  background: var(--brand-dark);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  width: 100%;
}

.brand > div {
  min-width: 0;
}

.brand-logo {
  height: 58px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 10px;
  padding: 6px 10px;
  flex-shrink: 0;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.1;
}

.topbar p {
  margin: 6px 0 0;
  color: #d7e5f3;
  font-size: 15px;
}

.top-main-menu {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.top-main-menu .main-menu-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  letter-spacing: 0.02em;
  min-width: auto;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.top-main-menu .main-menu-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.top-main-menu .main-menu-btn.active {
  background: #ffffff;
  color: var(--brand-dark);
  border-color: #ffffff;
}

.status {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* ============================================================
   LAYOUT GENERAL
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  align-items: start;
}

.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  height: calc(100vh - 118px);
  min-height: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.content {
  min-width: 0;
  width: 100%;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(22px, 2vw, 32px);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.searchbox input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  background: #ffffff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.filters button {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 500;
}

.filters button.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.controls {
  overflow: auto;
  padding-right: 4px;
}

.control-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  margin: 8px 0;
  padding: 12px;
  cursor: pointer;
}

.control-item:hover,
.control-item.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.control-code {
  font-weight: 800;
  color: var(--brand);
  font-size: 13px;
}

.control-title {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.35;
}

.control-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.control-status-line {
  margin-top: 8px;
}

.estado-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  border: 1px solid transparent;
  max-width: 100%;
  white-space: normal;
}

.estado-pendiente {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.estado-en_elaboracion {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.estado-pendiente_evidencias {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.estado-en_revision {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.estado-listo {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

/* ============================================================
   FICHA DEL CONTROL
   ============================================================ */

#detail {
  width: 100%;
}

.detail-header {
  max-width: 1080px;
  margin: 0 auto 22px auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.detail-title-block {
  min-width: 0;
}

.pill {
  display: inline-flex;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 14px;
}

.detail-header h2 {
  margin: 12px 0 0;
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.18;
  max-width: 900px;
}

/* Panel de gestión del control: estado + responsable */

.control-management-panel {
  max-width: 1080px;
  margin: 0 auto 28px auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcff;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, 180px);
  gap: 14px;
  align-items: start;
}

.control-ready-box,
.responsable-box,
.responsable-actions {
  min-width: 0;
}

.control-ready-box label,
.responsable-box label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #344054;
}

.control-ready-box select,
.responsable-box input,
.responsable-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

.responsable-box textarea {
  resize: vertical;
}

#control-ready-date,
#resp-status {
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.responsable-observaciones {
  grid-column: 1 / 4;
}

.responsable-actions {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 7px;
}

#save-responsable-btn {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--brand);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

#save-responsable-btn:hover {
  background: #0b3f6d;
}

/* ============================================================
   PESTAÑAS DE CONTROL
   ============================================================ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 auto 28px;
  max-width: 1180px;
  align-items: center;
}

.tab,
.tab-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: #1f2937;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.tab.active,
.tab-btn.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.tab-panel {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.tab-panel h3,
#panel-versiones h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

/* ============================================================
   REQUISITO ENS / CCN-STIC 808
   ============================================================ */

.richtext,
pre {
  white-space: pre-wrap;
  line-height: 1.6;
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

#tab-ens .richtext {
  margin-bottom: 26px;
}

#requirements {
  max-width: 1080px;
  margin: 0 auto;
}

.requirement {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 14px;
  background: #ffffff;
}

.requirement .req-id {
  font-weight: 800;
  color: var(--brand);
}

.requirement .category {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

/* ============================================================
   REFUERZOS
   ============================================================ */

.refuerzos-wrap {
  max-width: 1080px;
  margin: 22px auto 26px;
}

.refuerzos {
  display: grid;
  gap: 12px;
}

.refuerzo,
.refuerzo-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
}

.refuerzo summary,
.refuerzo-title {
  font-weight: 800;
  color: var(--brand);
  cursor: pointer;
}

.refuerzo pre,
.refuerzo-text {
  background: #fbfcff;
  margin-top: 10px;
}

/* ============================================================
   DOCUMENTOS
   ============================================================ */

#tab-docs {
  max-width: 1180px;
}

.doc-toolbar {
  max-width: 1080px;
  margin: 6px auto 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.section-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-btn,
#refresh-documents-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #ffffff;
  color: #1f2937;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 700;
}

.section-btn.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.upload-form {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-form input {
  max-width: 280px;
}

.upload-form button {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.hint {
  max-width: 1080px;
  margin: 0 auto 20px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.documents,
.doc-list {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto 28px;
}

.doc-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.doc-name {
  font-size: 16px;
  font-weight: 850;
  color: #1f2937;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.doc-meta {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.doc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-actions button,
.doc-actions a {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: var(--brand);
  border-radius: 12px;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.doc-actions .delete,
button.delete {
  color: var(--danger);
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

/* ============================================================
   VISOR PDF MODAL
   ============================================================ */

.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.viewer-modal.hidden {
  display: none !important;
}

.viewer-modal-card {
  width: min(1500px, 96vw);
  height: min(920px, 94vh);
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  display: flex;
  flex-direction: column;
}

.viewer-header {
  min-height: 62px;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.viewer-header strong {
  font-size: 16px;
  color: #1f2937;
  overflow-wrap: anywhere;
}

.viewer-header button {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  flex-shrink: 0;
}

#viewer {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

/* ============================================================
   CONTROL DE VERSIONES
   ============================================================ */

#panel-versiones .muted {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
}

#panel-versiones .doc-toolbar {
  max-width: 1080px;
  margin: 0 auto 22px;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

.versiones-viewer,
#versiones-viewer {
  width: 100%;
  max-width: 1080px;
  height: 78vh;
  min-height: 650px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.10);
}

/* ============================================================
   ESTADO / GRÁFICO CIRCULAR
   ============================================================ */

.estado-dashboard {
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

.pie-wrap,
.estado-pie {
  width: 220px;
  height: 220px;
}

.estado-pie {
  --percent: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #111827 0 58%, transparent 59%),
    conic-gradient(var(--success) calc(var(--percent) * 1%), var(--pending) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.estado-pie span {
  font-size: 34px;
  font-weight: 850;
  color: #ffffff;
}

.estado-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 14px;
  flex: 1;
}

.estado-stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.estado-stat strong {
  display: block;
  font-size: 32px;
}

.estado-stat span {
  opacity: 0.85;
}

.estado-legend {
  display: flex;
  gap: 24px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.legend-ok {
  background: var(--success);
}

.legend-pending {
  background: var(--pending);
}

/* ============================================================
   MATRIZ DE COBERTURA
   ============================================================ */

.matriz-cobertura {
  margin-top: 34px;
}

.matriz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.matriz-header h3 {
  margin: 0 0 6px;
}

.matriz-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#refresh-matriz-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: var(--brand);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--brand);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.export-btn:hover {
  background: #0b3f6d;
}

.matriz-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.matriz-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1250px;
}

.matriz-table th,
.matriz-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.matriz-table th {
  background: #f8fafc;
  font-weight: 800;
  color: #344054;
}

.matriz-table tbody tr:hover {
  background: #fbfcff;
}

.matriz-control-title {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.35;
}

.matriz-table td:nth-child(n+6),
.matriz-table th:nth-child(n+6) {
  text-align: center;
}

.matriz-table td:nth-child(3),
.matriz-table td:nth-child(4),
.matriz-table td:nth-child(5) {
  white-space: nowrap;
}

.matriz-table td:nth-child(3),
.matriz-table td:nth-child(4) {
  max-width: 180px;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* ============================================================
   AUDITORÍA DOCUMENTAL
   ============================================================ */

.auditoria-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.auditoria-header h2 {
  margin-top: 0;
}

.auditoria-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#refresh-auditoria-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--brand);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

#refresh-auditoria-btn:hover {
  background: #0b3f6d;
}

.auditoria-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.auditoria-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 950px;
}

.auditoria-table th,
.auditoria-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.auditoria-table th {
  background: #f8fafc;
  font-weight: 800;
  color: #344054;
}

.auditoria-table tbody tr:hover {
  background: #fbfcff;
}

.audit-path {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
}

.audit-up {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.audit-delete {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1400px) {
  .layout {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .doc-toolbar {
    grid-template-columns: 1fr;
  }

  .upload-form {
    justify-content: flex-start;
  }

  .control-management-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .responsable-observaciones {
    grid-column: 1 / 3;
  }
}

@media (max-width: 1200px) {
  .status {
    white-space: normal;
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    max-height: 50vh;
  }

  .doc-row {
    grid-template-columns: 1fr;
  }

  .doc-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 16px;
    gap: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    height: 52px;
    max-width: 170px;
  }

  .top-main-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .top-main-menu .main-menu-btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .status {
    width: 100%;
  }

  .layout {
    padding: 14px;
    gap: 14px;
  }

  .card {
    padding: 18px;
  }

  .detail-header h2 {
    font-size: 24px;
  }

  .control-management-panel {
    grid-template-columns: 1fr;
  }

  .responsable-observaciones {
    grid-column: auto;
  }

  .tab,
  .tab-btn,
  .section-btn,
  #refresh-documents-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .upload-form,
  .upload-form input,
  .upload-form button {
    width: 100%;
    max-width: none;
  }

  .doc-actions button,
  .doc-actions a {
    flex: 1;
    text-align: center;
  }

  .viewer-modal {
    padding: 12px;
  }

  .viewer-modal-card {
    width: 98vw;
    height: 94vh;
    border-radius: 14px;
  }

  .estado-stats {
    grid-template-columns: 1fr;
  }

  .pie-wrap,
  .estado-pie {
    width: 190px;
    height: 190px;
  }

  .matriz-header,
  .auditoria-header {
    flex-direction: column;
  }

  .matriz-actions,
  .auditoria-actions {
    width: 100%;
  }

  .matriz-actions button,
  .matriz-actions .export-btn,
  .auditoria-actions button,
  .auditoria-actions .export-btn {
    width: 100%;
  }
} 
/* ============================================================
   Layout sin barra lateral para ESTADO y AUDITORÍA
   ============================================================ */

.layout.full-width {
  grid-template-columns: 1fr;
}

.layout.full-width .content {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.relaciones-sgsi-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.35);
}

.sgsi-relations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.sgsi-relation-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.45);
}

.sgsi-relation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sgsi-marco {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
}

.sgsi-confidence {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  white-space: nowrap;
}

.sgsi-confidence-alto {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.sgsi-confidence-medio {
  background: rgba(234, 179, 8, 0.18);
  color: #fde68a;
}

.sgsi-confidence-bajo {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.sgsi-relation-link {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: rgba(59, 130, 246, 0.14);
  color: inherit;
}

.sgsi-relation-link strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.sgsi-relation-link span {
  display: block;
  font-size: 0.86rem;
  color: #dbeafe;
}

.sgsi-relation-link:hover {
  background: rgba(59, 130, 246, 0.24);
}

.sgsi-relation-type {
  margin-top: 10px;
  font-size: 0.76rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sgsi-relation-desc {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #cbd5e1;
}
.sgsi-item-detail {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.96);
  color: #0f172a;
}

.sgsi-item-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.sgsi-item-detail h3,
.sgsi-item-detail h4,
.sgsi-item-detail strong {
  color: #0f172a;
}

.sgsi-item-detail .muted,
.sgsi-item-detail .detail-label {
  color: #475569;
}

.sgsi-item-content {
  display: grid;
  gap: 14px;
  color: #0f172a;
}

.sgsi-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.sgsi-detail-grid > div,
.sgsi-folder-list > div {
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.95);
  color: #0f172a;
}

.detail-label {
  display: block;
  font-size: 0.75rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.sgsi-folder-list {
  display: grid;
  gap: 10px;
}

.sgsi-folder-list code,
.sgsi-detail-grid code {
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
  white-space: normal;
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 8px;
}
.estado-marco-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.estado-marco-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 10px 16px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

.estado-marco-btn.active {
  background: #0f4c81;
  border-color: #0f4c81;
  color: #ffffff;
}

/* ============================================================
   ESTADO GENERAL SGSI - RESPONSIVE
   ============================================================ */

#estado-global-panel {
  width: 100%;
}

.estado-global-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.estado-global-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.estado-global-intro {
  flex: 1 1 500px;
  min-width: 280px;
}

.estado-global-intro h2 {
  margin: 0 0 12px 0;
}

.estado-global-intro h3 {
  margin: 28px 0 12px 0;
}

.estado-global-intro .muted {
  margin: 0;
  color: #5f6b7a;
  line-height: 1.5;
}

.estado-global-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  min-width: 220px;
}

.estado-global-actions button,
.estado-global-actions .export-btn {
  min-width: 200px;
  text-align: center;
}

.estado-global-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  background: #fff;
}

.estado-global-table-wrap .status-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.estado-global-table-wrap .status-table th,
.estado-global-table-wrap .status-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #e8edf3;
  vertical-align: middle;
}

.estado-global-table-wrap .status-table th {
  background: #f7f9fc;
  font-weight: 700;
  color: #24324a;
  position: sticky;
  top: 0;
  z-index: 1;
}

.estado-global-table-wrap .status-table tr:last-child td {
  border-bottom: none;
}

/* Tablet */
@media (max-width: 1100px) {
  .estado-global-top {
    flex-direction: column;
    align-items: stretch;
  }

  .estado-global-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    min-width: auto;
  }

  .estado-global-actions button,
  .estado-global-actions .export-btn {
    min-width: 190px;
  }
}

/* Móvil */
@media (max-width: 768px) {
  .estado-global-layout {
    gap: 18px;
  }

  .estado-global-intro h2 {
    font-size: 1.8rem;
  }

  .estado-global-intro h3 {
    font-size: 1.25rem;
  }

  .estado-global-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .estado-global-actions button,
  .estado-global-actions .export-btn {
    width: 100%;
    min-width: 100%;
  }

  .estado-global-table-wrap .status-table th,
  .estado-global-table-wrap .status-table td {
    padding: 12px 14px;
    font-size: 0.95rem;
  }
}
/* ============================================================
   ESTADO POR MARCO - RESPONSIVE
   ============================================================ */

#estado-panel {
  width: 100%;
}

.estado-marco-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.estado-marco-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.estado-marco-intro {
  flex: 1 1 500px;
  min-width: 280px;
}

.estado-marco-intro h2 {
  margin: 0 0 12px 0;
}

.estado-marco-intro .muted {
  margin: 0;
  color: #5f6b7a;
  line-height: 1.5;
}

.estado-marco-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.estado-marco-actions button,
.estado-marco-actions .export-btn {
  min-width: 170px;
  text-align: center;
}

.estado-marco-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.estado-marco-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 10px 16px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

.estado-marco-btn.active {
  background: #0f4c81;
  border-color: #0f4c81;
  color: #ffffff;
}

.estado-dashboard-responsive {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 28px;
  align-items: center;
}

.estado-dashboard-responsive .pie-wrap {
  display: flex;
  justify-content: center;
}

.estado-dashboard-responsive .estado-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
}

.estado-marco-matriz {
  margin-top: 0;
}

.estado-marco-matriz .matriz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.estado-marco-matriz .matriz-table-wrap {
  width: 100%;
  overflow-x: auto;
}

/* Tablet */
@media (max-width: 1100px) {
  .estado-marco-top {
    flex-direction: column;
    align-items: stretch;
  }

  .estado-marco-actions {
    justify-content: flex-start;
  }

  .estado-dashboard-responsive {
    grid-template-columns: 1fr;
  }

  .estado-dashboard-responsive .estado-stats {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

/* Móvil */
@media (max-width: 768px) {
  .estado-marco-layout {
    gap: 18px;
  }

  .estado-marco-intro h2 {
    font-size: 1.8rem;
  }

  .estado-marco-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .estado-marco-actions button,
  .estado-marco-actions .export-btn {
    width: 100%;
    min-width: 100%;
  }

  .estado-marco-selector {
    display: grid;
    grid-template-columns: 1fr;
  }

  .estado-marco-btn {
    width: 100%;
  }

  .estado-dashboard-responsive .estado-stats {
    grid-template-columns: 1fr;
  }

  .estado-dashboard-responsive .pie-wrap {
    justify-content: center;
  }
}

   /* ============================================================
   PORTADA MARCOS SGSI
   ============================================================ */

.marcos-home {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.marcos-home-header h2 {
  margin: 0 0 10px;
}

.marcos-home-header .muted {
  margin: 0;
  color: #64748b;
  line-height: 1.5;
}

.marcos-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.marco-home-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.marco-home-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 76, 129, 0.55);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
}

.marco-home-code {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.12);
  color: #0f4c81;
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.marco-home-card strong {
  font-size: 1.05rem;
}

.marco-home-card small {
  color: #64748b;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .marcos-home-grid {
    grid-template-columns: 1fr;
  }

  .marco-home-card {
    min-height: auto;
  }
}

/* ============================================================
   NAVEGACIÓN CENTRAL POR MARCOS - SIN BARRA LATERAL
   ============================================================ */

.layout.full-width {
  display: block;
}

.framework-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.framework-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.framework-page-header h2 {
  margin: 12px 0 8px;
}

.ghost-btn {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #ffffff;
  color: #0f172a;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
}

.ghost-btn:hover {
  background: #f1f5f9;
}

.framework-tools {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 16px;
  align-items: start;
}

.framework-searchbox input {
  width: 100%;
}

.framework-controls-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.framework-controls-list .control-item {
  min-height: 140px;
  margin: 0;
}

@media (max-width: 900px) {
  .framework-tools {
    grid-template-columns: 1fr;
  }

  .framework-controls-list {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   FICHA ENRIQUECIDA DE MARCOS SGSI
   ============================================================ */

.sgsi-detail-rich {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sgsi-detail-section {
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
}

.sgsi-detail-section h4 {
  margin: 0 0 10px;
  color: #0f4c81;
}

.sgsi-detail-section p {
  margin: 0;
  line-height: 1.55;
}

.sgsi-detail-section ul {
  margin: 0;
  padding-left: 20px;
}

.sgsi-detail-section li {
  margin-bottom: 7px;
  line-height: 1.45;
}

.sgsi-detail-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .sgsi-detail-grid-3 {
    grid-template-columns: 1fr;
  }
}
.detail-back-btn {
  margin-bottom: 18px;
}

.detail-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* ============================================================
   DOCUMENTACIÓN RECOMENDADA EN FICHA SGSI
   ============================================================ */

.sgsi-doc-recommended {
  background: #f8fafc;
  border-color: rgba(15, 76, 129, 0.2);
}

.sgsi-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sgsi-doc-grid > div {
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
}

.sgsi-doc-grid strong {
  display: block;
  margin-bottom: 8px;
  color: #0f4c81;
}

.sgsi-doc-grid p {
  margin: 0;
  color: #334155;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .sgsi-doc-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   ADMINISTRACIÓN DE MARCOS
   ============================================================ */

.admin-panel {
  display: grid;
  gap: 22px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-help-box {
  border: 1px solid rgba(15, 76, 129, 0.14);
  background: #f8fafc;
  border-radius: 18px;
  padding: 16px 18px;
}

.admin-help-box p {
  margin: 8px 0 0;
  color: #475569;
  line-height: 1.5;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: #ffffff;
}

.admin-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f8fafc;
  color: #1e293b;
  font-weight: 800;
  font-size: 13px;
}

.admin-table input[type="text"],
.admin-table input[type="number"] {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: #0f172a;
}

.admin-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.admin-order-input {
  max-width: 82px;
}

.admin-familias-cell {
  max-width: 260px;
  color: #475569;
  font-size: 13px;
}

.admin-add-card {
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: #ffffff;
  padding: 18px;
}

.admin-add-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.admin-add-grid label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
}

.admin-add-grid input {
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  color: #0f172a;
}

@media (max-width: 1000px) {
  .admin-header {
    flex-direction: column;
  }

  .admin-actions {
    justify-content: flex-start;
  }

  .admin-add-grid {
    grid-template-columns: 1fr;
  }
}



/* ============================================================
   ADMIN - ZONA DE PELIGRO / RESET SGSI
   ============================================================ */

.admin-danger-card {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 18px;
  background: #fff1f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-danger-card h3 {
  margin: 0 0 6px;
  color: #991b1b;
}

.admin-danger-card p {
  margin: 0;
  color: #7f1d1d;
}

.danger-btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  background: #dc2626;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.danger-btn:hover {
  background: #b91c1c;
}

.danger-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .admin-danger-card {
    flex-direction: column;
    align-items: stretch;
  }

  .danger-btn {
    width: 100%;
  }
}


/* ============================================================
   ADMIN - CONFIGURACIÓN DOCUMENTAL
   ============================================================ */

.admin-doc-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 18px;
  background: #f8fafc;
}

.admin-doc-header h3 {
  margin: 0 0 6px;
}

.admin-doc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.admin-doc-grid label,
.admin-doc-options label {
  font-size: 0.88rem;
  color: #334155;
}

.admin-doc-grid input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 12px;
  background: #ffffff;
}

.admin-doc-grid input[readonly] {
  background: #eef2f7;
  color: #64748b;
}

.admin-doc-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.30);
}

.admin-doc-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.admin-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-script-box {
  width: 100%;
  min-height: 280px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
}

.admin-validation-result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.validation-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-bottom: 12px;
}

.validation-summary span {
  color: #475569;
}

.admin-table-wrap.compact {
  margin-top: 8px;
}

.admin-validation-result details {
  margin-top: 12px;
}

.admin-validation-result pre {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.82rem;
}

.ok-text {
  color: #047857;
  font-weight: 700;
}

@media (max-width: 900px) {
  .admin-doc-grid {
    grid-template-columns: 1fr;
  }

  .admin-doc-actions button {
    width: 100%;
  }
}


/* ============================================================
   ISO 27001 - VISTA JERÁRQUICA
   ============================================================ */

.iso27001-tree-group {
  margin-bottom: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: #f8fafc;
  overflow: hidden;
}

.iso27001-parent-clause {
  width: 100%;
  border-radius: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28) !important;
  background: #e2e8f0 !important;
  font-weight: 800;
}

.iso27001-parent-clause .control-code {
  background: #0f172a;
  color: #ffffff;
}

.iso27001-subclauses {
  padding: 8px 8px 10px;
}

.iso27001-subclause {
  width: calc(100% - 10px);
  margin: 5px 0 5px 10px;
  border-left: 4px solid rgba(37, 99, 235, 0.35) !important;
  background: #ffffff !important;
}

.iso27001-subclause.depth-2 {
  width: calc(100% - 26px);
  margin-left: 26px;
  border-left-color: rgba(14, 165, 233, 0.45) !important;
}

.iso27001-subclause.depth-3 {
  width: calc(100% - 42px);
  margin-left: 42px;
  border-left-color: rgba(16, 185, 129, 0.45) !important;
}

.iso27001-tree-count,
.iso27001-subtype {
  margin-left: auto;
  font-size: 0.74rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 4px 8px;
}

.iso27001-subtype {
  background: #f1f5f9;
}

@media (max-width: 760px) {
  .iso27001-subclause,
  .iso27001-subclause.depth-2,
  .iso27001-subclause.depth-3 {
    width: 100%;
    margin-left: 0;
  }

  .iso27001-tree-count,
  .iso27001-subtype {
    display: none;
  }
}


/* ============================================================
   ENS - FICHA HOMOGÉNEA
   ============================================================ */

.ens-homogeneous-detail .ens-source-note,
.ens-requirements-detail .ens-source-note {
  background: #f8fafc;
  border-left: 4px solid rgba(15, 23, 42, 0.18);
}

.ens-requirements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.ens-requirement-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.ens-requirement-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ens-requirement-card .req-id {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 800;
}

.ens-requirement-card .category {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 700;
}

.ens-requirement-card p {
  margin: 0;
  line-height: 1.55;
}

.ens-requirement-card p + p {
  margin-top: 10px;
}


/* ============================================================
   EVIDENCIAS CONCRETAS SUGERIDAS
   ============================================================ */

.concrete-evidence-section {
  border-left: 4px solid rgba(37, 99, 235, 0.45);
  background: #f8fafc;
}

.concrete-evidence-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.concrete-evidence-section h4::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 900;
}

.concrete-evidence-section ul {
  margin-top: 10px;
}

.concrete-evidence-section li {
  margin-bottom: 7px;
}


/* ============================================================
   RESUMEN + IDENTIFICACIÓN UNIFICADOS
   ============================================================ */

.sgsi-summary-section {
  border-left: 4px solid rgba(15, 23, 42, 0.18);
}

.summary-identification {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.summary-identification span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.2;
}

.summary-identification strong {
  margin-right: 4px;
  color: #0f172a;
}


/* ============================================================
   DOCUMENTACIÓN RECOMENDADA - 2 CAMPOS
   ============================================================ */

.sgsi-doc-grid.sgsi-doc-grid-compact {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

@media (max-width: 760px) {
  .sgsi-doc-grid.sgsi-doc-grid-compact {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   PALETAS CLARAS LOCALES - SOLO FONDO
   ============================================================ */

body.sgsi-theme-original {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e6e9ef;
  background: var(--bg);
}

body.sgsi-theme-azul-bruma {
  --bg: #edf5fb;
  --card: #fbfdff;
  --line: #dceaf5;
  background: var(--bg);
}

body.sgsi-theme-verde-menta {
  --bg: #eff8f3;
  --card: #fcfffd;
  --line: #dceddf;
  background: var(--bg);
}

body.sgsi-theme-arena {
  --bg: #f7f2ea;
  --card: #fffdf8;
  --line: #eadfce;
  background: var(--bg);
}

body.sgsi-theme-lavanda {
  --bg: #f4f1fb;
  --card: #fffaff;
  --line: #e4ddf2;
  background: var(--bg);
}

body.sgsi-theme-gris {
  --bg: #f2f3f1;
  --card: #ffffff;
  --line: #e1e3df;
  background: var(--bg);
}

/*
  Importante:
  No tocamos --text, --muted, --brand ni --brand-dark.
  Así no se pierden subtítulos ni contraste de controles.
*/

body[class*="sgsi-theme-"] .card,
body[class*="sgsi-theme-"] .framework-home-card,
body[class*="sgsi-theme-"] .admin-doc-card,
body[class*="sgsi-theme-"] .admin-appearance-card,
body[class*="sgsi-theme-"] .admin-help-box,
body[class*="sgsi-theme-"] .admin-add-card,
body[class*="sgsi-theme-"] .sgsi-detail-section,
body[class*="sgsi-theme-"] .sgsi-doc-recommended {
  background: var(--card);
  border-color: var(--line);
}

body[class*="sgsi-theme-"] .control-item,
body[class*="sgsi-theme-"] .relation-card,
body[class*="sgsi-theme-"] .doc-card,
body[class*="sgsi-theme-"] .status-card {
  border-color: var(--line);
}

.admin-appearance-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 18px;
  background: #f8fafc;
}

.admin-appearance-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  gap: 16px;
  align-items: end;
  margin-top: 14px;
}

.admin-appearance-grid label {
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-appearance-grid select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 12px;
  background: #ffffff;
}

.theme-preview {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.theme-preview-topbar {
  height: 38px;
  background: var(--brand-dark);
}

.theme-preview-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--bg);
}

.theme-preview-body span {
  display: block;
  height: 28px;
  flex: 1;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
}

.theme-preview-body button {
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

@media (max-width: 900px) {
  .admin-appearance-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIX14.6 - PALETAS CON VISTA PREVIA ROBUSTA
   ============================================================ */

html[class*="sgsi-theme-"],
body[class*="sgsi-theme-"] {
  background: var(--bg) !important;
}

body[class*="sgsi-theme-"] main,
body[class*="sgsi-theme-"] .main-layout,
body[class*="sgsi-theme-"] .page,
body[class*="sgsi-theme-"] .content {
  background: var(--bg);
}

body[class*="sgsi-theme-"] .card,
body[class*="sgsi-theme-"] .framework-home-card,
body[class*="sgsi-theme-"] .admin-doc-card,
body[class*="sgsi-theme-"] .admin-appearance-card,
body[class*="sgsi-theme-"] .admin-help-box,
body[class*="sgsi-theme-"] .admin-add-card,
body[class*="sgsi-theme-"] .sgsi-detail-section,
body[class*="sgsi-theme-"] .sgsi-doc-recommended {
  background: var(--card) !important;
  border-color: var(--line) !important;
}

body[class*="sgsi-theme-"] .control-item,
body[class*="sgsi-theme-"] .relation-card,
body[class*="sgsi-theme-"] .doc-card,
body[class*="sgsi-theme-"] .status-card {
  border-color: var(--line) !important;
}

#admin-theme-preview.theme-preview {
  border-color: var(--line) !important;
}

#admin-theme-preview .theme-preview-body {
  background: var(--bg) !important;
}

#admin-theme-preview .theme-preview-body span {
  background: var(--card) !important;
  border-color: var(--line) !important;
}


/* ============================================================
   FIX15 - ESTADO DE IMPLANTACIÓN
   ============================================================ */

.implantacion-dashboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.implantacion-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.implantacion-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 7px;
}

.implantacion-card strong {
  display: block;
  font-size: 1.65rem;
  color: var(--text);
}

.implantacion-card.destacado {
  background: var(--brand-soft);
  border-color: rgba(15, 76, 129, 0.18);
}

.implantacion-marcos-wrap {
  margin: 18px 0;
}

.implantacion-marcos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.implantacion-marco-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.implantacion-marco-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.implantacion-marco-head strong {
  color: var(--text);
}

.implantacion-marco-head span {
  font-weight: 900;
  color: var(--brand);
}

.implantacion-progress {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin: 12px 0;
}

.implantacion-progress div {
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.implantacion-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  font-size: 0.84rem;
  color: var(--muted);
}

.implantacion-mini-grid b {
  color: var(--text);
}

@media (max-width: 980px) {
  .implantacion-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .implantacion-card.destacado {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .implantacion-dashboard {
    grid-template-columns: 1fr;
  }

  .implantacion-card.destacado {
    grid-column: auto;
  }
}


/* ============================================================
   FIX15.1 - PANEL DE GESTIÓN MULTIMARCO
   ============================================================ */

.control-management-panel.hidden {
  display: none !important;
}

.control-management-panel {
  display: grid;
  grid-template-columns: minmax(190px, 240px) repeat(3, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.control-management-panel label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.control-management-panel input,
.control-management-panel select,
.control-management-panel textarea {
  width: 100%;
}

.responsable-observaciones {
  grid-column: span 2;
}

.responsable-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

@media (max-width: 1100px) {
  .control-management-panel {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .responsable-observaciones {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .control-management-panel {
    grid-template-columns: 1fr;
  }

  .responsable-observaciones {
    grid-column: auto;
  }
}


/* ============================================================
   FIX16/FIX17 - DASHBOARD EJECUTIVO + EXPORTACIONES
   ============================================================ */

.executive-dashboard {
  margin: 18px 0 22px;
}

.executive-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.executive-kpi {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.executive-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 7px;
}

.executive-kpi strong {
  font-size: 1.55rem;
  color: var(--text);
}

.executive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 18px;
  align-items: center;
}

.executive-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
}

.executive-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.executive-panel h3 {
  margin-top: 0;
}

.executive-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.executive-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.executive-row strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.executive-row span,
.executive-row small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.executive-row.priority {
  border-left: 4px solid rgba(180, 35, 24, 0.28);
}

.executive-row-meta {
  text-align: right;
  min-width: 120px;
}

.executive-row-meta b {
  color: var(--brand);
}

@media (max-width: 1200px) {
  .executive-kpis {
    grid-template-columns: repeat(3, 1fr);
  }

  .executive-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .executive-kpis {
    grid-template-columns: 1fr;
  }

  .executive-row {
    grid-template-columns: 1fr;
  }

  .executive-row-meta {
    text-align: left;
  }
}


/* ============================================================
   FIX17.1 - EXPORTACIONES ESTABLES
   ============================================================ */

button.export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}

button.export-btn:hover {
  filter: brightness(0.97);
}


/* ============================================================
   FIX18 - ÍNDICE DOCUMENTAL
   ============================================================ */

.admin-index-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.admin-index-summary {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.admin-index-summary > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: #f8fafc;
}

.admin-index-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.admin-index-summary strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

.admin-index-result {
  margin-top: 14px;
  overflow-x: auto;
}

.admin-index-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-index-table th,
.admin-index-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
}

.admin-index-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 800px) {
  .admin-index-summary {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIX18.1 - ÍNDICE DOCUMENTAL OPTIMIZADO
   ============================================================ */

.admin-index-summary {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.admin-index-summary strong#index-admin-placeholder {
  display: none;
}

@media (max-width: 980px) {
  .admin-index-summary {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-index-summary {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIX19 - ROLES Y PERMISOS
   ============================================================ */

.admin-role-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.admin-role-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.admin-role-grid label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-role-grid select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 12px;
  background: #ffffff;
}

.admin-roles-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.role-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: #f8fafc;
}

.role-card h4 {
  margin: 0 0 6px;
  color: var(--text);
}

.role-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.role-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.role-disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
}

body[data-sgsi-role="consulta"] .admin-danger-card,
body[data-sgsi-role="auditor"] .admin-danger-card {
  opacity: 0.75;
}

@media (max-width: 720px) {
  .admin-role-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIX20.2 - RELACIONES: TEXTOS LARGOS Y DEDUPLICACIÓN VISUAL
   ============================================================ */

.relation-card,
.relacion-card,
.sgsi-relation-card,
.rel-card,
[class*="relation"],
[class*="relacion"] {
  min-width: 0;
}

.relation-card *,
.relacion-card *,
.sgsi-relation-card *,
.rel-card *,
[class*="relation"] *,
[class*="relacion"] * {
  min-width: 0;
}

.relation-card strong,
.relacion-card strong,
.sgsi-relation-card strong,
.rel-card strong,
.relation-card .code,
.relacion-card .code,
.sgsi-relation-card .code,
.rel-card .code,
.relation-card [class*="code"],
.relacion-card [class*="code"],
.sgsi-relation-card [class*="code"],
.rel-card [class*="code"] {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.25;
}

.relation-card p,
.relacion-card p,
.sgsi-relation-card p,
.rel-card p,
.relation-card span,
.relacion-card span,
.sgsi-relation-card span,
.rel-card span {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.relation-card .badge,
.relacion-card .badge,
.sgsi-relation-card .badge,
.rel-card .badge,
.relation-card [class*="badge"],
.relacion-card [class*="badge"] {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.relaciones-grid,
.relations-grid,
#relaciones-content,
#relaciones-sgsi,
#sgsi-relaciones {
  min-width: 0;
}


/* ============================================================
   FIX22 - COMPACTAR FICHAS DE DETALLE SGSI
   Reduce espacios vacíos en Resumen, Objetivo y Evidencias
   ============================================================ */

/* Contenedores principales de las fichas de detalle */
.detail-section,
.detail-card,
.sgsi-detail-card,
.sgsi-section-card,
.ficha-card,
.ficha-section,
.control-detail-card,
.control-section,
.info-card,
.evidence-card,
.evidencias-card,
.card-detail,
.content-card {
  min-height: auto !important;
  height: auto !important;
  padding-top: 20px !important;
  padding-bottom: 20px !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
}

/* Si hay tarjetas con mucho padding heredado */
.detail-section > *,
.detail-card > *,
.sgsi-detail-card > *,
.sgsi-section-card > *,
.ficha-card > *,
.ficha-section > *,
.control-detail-card > *,
.control-section > *,
.info-card > *,
.evidence-card > *,
.evidencias-card > *,
.card-detail > *,
.content-card > * {
  margin-top: 0;
}

/* Bloques internos de la vista de control */
#control-detail section,
#control-detail article,
#detalle-control section,
#detalle-control article,
#control-content section,
#control-content article,
#detail-content section,
#detail-content article,
#main-detail section,
#main-detail article {
  min-height: auto !important;
  height: auto !important;
  padding-top: 20px !important;
  padding-bottom: 20px !important;
}

/* Títulos: menos aire arriba/abajo */
.detail-section h2,
.detail-section h3,
.detail-section h4,
.detail-card h2,
.detail-card h3,
.detail-card h4,
.sgsi-detail-card h2,
.sgsi-detail-card h3,
.sgsi-detail-card h4,
.sgsi-section-card h2,
.sgsi-section-card h3,
.sgsi-section-card h4,
.ficha-card h2,
.ficha-card h3,
.ficha-card h4,
.ficha-section h2,
.ficha-section h3,
.ficha-section h4,
.control-detail-card h2,
.control-detail-card h3,
.control-detail-card h4,
.control-section h2,
.control-section h3,
.control-section h4,
.info-card h2,
.info-card h3,
.info-card h4,
.evidence-card h2,
.evidence-card h3,
.evidence-card h4,
.evidencias-card h2,
.evidencias-card h3,
.evidencias-card h4,
.card-detail h2,
.card-detail h3,
.card-detail h4,
.content-card h2,
.content-card h3,
.content-card h4 {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  line-height: 1.25 !important;
}

/* Párrafos compactos */
.detail-section p,
.detail-card p,
.sgsi-detail-card p,
.sgsi-section-card p,
.ficha-card p,
.ficha-section p,
.control-detail-card p,
.control-section p,
.info-card p,
.evidence-card p,
.evidencias-card p,
.card-detail p,
.content-card p {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  line-height: 1.45 !important;
}

/* Listas de evidencias */
.detail-section ul,
.detail-card ul,
.sgsi-detail-card ul,
.sgsi-section-card ul,
.ficha-card ul,
.ficha-section ul,
.control-detail-card ul,
.control-section ul,
.info-card ul,
.evidence-card ul,
.evidencias-card ul,
.card-detail ul,
.content-card ul {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
  padding-left: 22px !important;
}

.detail-section li,
.detail-card li,
.sgsi-detail-card li,
.sgsi-section-card li,
.ficha-card li,
.ficha-section li,
.control-detail-card li,
.control-section li,
.info-card li,
.evidence-card li,
.evidencias-card li,
.card-detail li,
.content-card li {
  margin-bottom: 6px !important;
  line-height: 1.42 !important;
}

/* Chips de Marco/Código/Familia/Título más próximos al texto */
.detail-section .chips,
.detail-section .meta-row,
.detail-section .tags,
.detail-card .chips,
.detail-card .meta-row,
.detail-card .tags,
.sgsi-detail-card .chips,
.sgsi-detail-card .meta-row,
.sgsi-detail-card .tags,
.ficha-card .chips,
.ficha-card .meta-row,
.ficha-card .tags,
.ficha-section .chips,
.ficha-section .meta-row,
.ficha-section .tags,
.control-detail-card .chips,
.control-detail-card .meta-row,
.control-detail-card .tags {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
  gap: 8px !important;
  row-gap: 8px !important;
}

/* Anulación defensiva para tarjetas con clases semánticas por sección */
[class*="resumen"],
[class*="objetivo"],
[class*="evidencia"],
[class*="detalle"],
[class*="summary"],
[class*="objective"],
[class*="evidence"] {
  min-height: auto;
}

/* Mantener separación global entre tarjetas, pero sin grandes bloques vacíos */
.detail-grid,
.sgsi-detail-grid,
.ficha-grid,
.control-detail-grid,
.content-grid {
  gap: 16px !important;
}

/* Si alguna tarjeta usa flex centrado, forzamos contenido arriba */
.detail-section,
.detail-card,
.sgsi-detail-card,
.sgsi-section-card,
.ficha-card,
.ficha-section,
.control-detail-card,
.control-section,
.info-card,
.evidence-card,
.evidencias-card,
.card-detail,
.content-card {
  display: flex;
  flex-direction: column;
}

/* Responsive: todavía más compacto en portátil */
@media (max-width: 1400px) {
  .detail-section,
  .detail-card,
  .sgsi-detail-card,
  .sgsi-section-card,
  .ficha-card,
  .ficha-section,
  .control-detail-card,
  .control-section,
  .info-card,
  .evidence-card,
  .evidencias-card,
  .card-detail,
  .content-card,
  #control-detail section,
  #control-detail article,
  #detalle-control section,
  #detalle-control article,
  #control-content section,
  #control-content article,
  #detail-content section,
  #detail-content article,
  #main-detail section,
  #main-detail article {
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }
}


/* ============================================================
   FIX22.1 - COMPACTAR AÚN MÁS FICHAS DE DETALLE SGSI
   Versión más agresiva para reducir aire interno
   ============================================================ */

/* Compactación fuerte de tarjetas de detalle */
.detail-section,
.detail-card,
.sgsi-detail-card,
.sgsi-section-card,
.ficha-card,
.ficha-section,
.control-detail-card,
.control-section,
.info-card,
.evidence-card,
.evidencias-card,
.card-detail,
.content-card,
#control-detail section,
#control-detail article,
#detalle-control section,
#detalle-control article,
#control-content section,
#control-content article,
#detail-content section,
#detail-content article,
#main-detail section,
#main-detail article,
[class*="resumen"],
[class*="objetivo"],
[class*="evidencia"],
[class*="summary"],
[class*="objective"],
[class*="evidence"] {
  min-height: 0 !important;
  height: auto !important;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  padding-left: 18px !important;
  padding-right: 18px !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

/* Eliminar huecos internos generados por hijos */
.detail-section > *,
.detail-card > *,
.sgsi-detail-card > *,
.sgsi-section-card > *,
.ficha-card > *,
.ficha-section > *,
.control-detail-card > *,
.control-section > *,
.info-card > *,
.evidence-card > *,
.evidencias-card > *,
.card-detail > *,
.content-card > *,
#control-detail section > *,
#control-detail article > *,
#detalle-control section > *,
#detalle-control article > *,
#control-content section > *,
#control-content article > *,
#detail-content section > *,
#detail-content article > *,
#main-detail section > *,
#main-detail article > * {
  margin-top: 0 !important;
}

/* Títulos más pegados al contenido */
.detail-section h1,
.detail-section h2,
.detail-section h3,
.detail-section h4,
.detail-card h1,
.detail-card h2,
.detail-card h3,
.detail-card h4,
.sgsi-detail-card h1,
.sgsi-detail-card h2,
.sgsi-detail-card h3,
.sgsi-detail-card h4,
.sgsi-section-card h1,
.sgsi-section-card h2,
.sgsi-section-card h3,
.sgsi-section-card h4,
.ficha-card h1,
.ficha-card h2,
.ficha-card h3,
.ficha-card h4,
.ficha-section h1,
.ficha-section h2,
.ficha-section h3,
.ficha-section h4,
.control-detail-card h1,
.control-detail-card h2,
.control-detail-card h3,
.control-detail-card h4,
.control-section h1,
.control-section h2,
.control-section h3,
.control-section h4,
.info-card h1,
.info-card h2,
.info-card h3,
.info-card h4,
.evidence-card h1,
.evidence-card h2,
.evidence-card h3,
.evidence-card h4,
.evidencias-card h1,
.evidencias-card h2,
.evidencias-card h3,
.evidencias-card h4,
.card-detail h1,
.card-detail h2,
.card-detail h3,
.card-detail h4,
.content-card h1,
.content-card h2,
.content-card h3,
.content-card h4,
#control-detail h1,
#control-detail h2,
#control-detail h3,
#control-detail h4,
#detalle-control h1,
#detalle-control h2,
#detalle-control h3,
#detalle-control h4,
#control-content h1,
#control-content h2,
#control-content h3,
#control-content h4,
#detail-content h1,
#detail-content h2,
#detail-content h3,
#detail-content h4,
#main-detail h1,
#main-detail h2,
#main-detail h3,
#main-detail h4 {
  margin-top: 0 !important;
  margin-bottom: 6px !important;
  line-height: 1.18 !important;
}

/* Párrafos más densos */
.detail-section p,
.detail-card p,
.sgsi-detail-card p,
.sgsi-section-card p,
.ficha-card p,
.ficha-section p,
.control-detail-card p,
.control-section p,
.info-card p,
.evidence-card p,
.evidencias-card p,
.card-detail p,
.content-card p,
#control-detail p,
#detalle-control p,
#control-content p,
#detail-content p,
#main-detail p {
  margin-top: 0 !important;
  margin-bottom: 6px !important;
  line-height: 1.35 !important;
}

/* Listas de evidencias más compactas */
.detail-section ul,
.detail-card ul,
.sgsi-detail-card ul,
.sgsi-section-card ul,
.ficha-card ul,
.ficha-section ul,
.control-detail-card ul,
.control-section ul,
.info-card ul,
.evidence-card ul,
.evidencias-card ul,
.card-detail ul,
.content-card ul,
#control-detail ul,
#detalle-control ul,
#control-content ul,
#detail-content ul,
#main-detail ul {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
  padding-left: 18px !important;
}

.detail-section li,
.detail-card li,
.sgsi-detail-card li,
.sgsi-section-card li,
.ficha-card li,
.ficha-section li,
.control-detail-card li,
.control-section li,
.info-card li,
.evidence-card li,
.evidencias-card li,
.card-detail li,
.content-card li,
#control-detail li,
#detalle-control li,
#control-content li,
#detail-content li,
#main-detail li {
  margin-bottom: 3px !important;
  line-height: 1.32 !important;
}

/* Reducir separación de chips */
.detail-section .chips,
.detail-section .meta-row,
.detail-section .tags,
.detail-card .chips,
.detail-card .meta-row,
.detail-card .tags,
.sgsi-detail-card .chips,
.sgsi-detail-card .meta-row,
.sgsi-detail-card .tags,
.ficha-card .chips,
.ficha-card .meta-row,
.ficha-card .tags,
.ficha-section .chips,
.ficha-section .meta-row,
.ficha-section .tags,
.control-detail-card .chips,
.control-detail-card .meta-row,
.control-detail-card .tags,
#control-detail .chips,
#control-detail .meta-row,
#control-detail .tags,
#detalle-control .chips,
#detalle-control .meta-row,
#detalle-control .tags,
#detail-content .chips,
#detail-content .meta-row,
#detail-content .tags {
  margin-top: 6px !important;
  margin-bottom: 0 !important;
  gap: 6px !important;
  row-gap: 6px !important;
}

/* Compactar badges/chips */
.detail-section .chip,
.detail-section .tag,
.detail-section .badge,
.detail-card .chip,
.detail-card .tag,
.detail-card .badge,
.sgsi-detail-card .chip,
.sgsi-detail-card .tag,
.sgsi-detail-card .badge,
.ficha-card .chip,
.ficha-card .tag,
.ficha-card .badge,
.ficha-section .chip,
.ficha-section .tag,
.ficha-section .badge,
.control-detail-card .chip,
.control-detail-card .tag,
.control-detail-card .badge,
#control-detail .chip,
#control-detail .tag,
#control-detail .badge,
#detalle-control .chip,
#detalle-control .tag,
#detalle-control .badge,
#detail-content .chip,
#detail-content .tag,
#detail-content .badge {
  padding-top: 5px !important;
  padding-bottom: 5px !important;
  line-height: 1.15 !important;
}

/* Reducir separación entre tarjetas dentro del detalle */
.detail-grid,
.sgsi-detail-grid,
.ficha-grid,
.control-detail-grid,
.content-grid,
#control-detail,
#detalle-control,
#control-content,
#detail-content,
#main-detail {
  gap: 10px !important;
}

/* Compactación específica para bloques con mucho blanco */
#control-detail .panel,
#control-detail .card,
#detalle-control .panel,
#detalle-control .card,
#control-content .panel,
#control-content .card,
#detail-content .panel,
#detail-content .card,
#main-detail .panel,
#main-detail .card {
  min-height: 0 !important;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

/* Reducir aire si hay grid de dos/tres columnas debajo del objetivo */
#control-detail .grid,
#detalle-control .grid,
#control-content .grid,
#detail-content .grid,
#main-detail .grid {
  gap: 10px !important;
}

/* Evitar compactar demasiado los botones o formularios de administración */
.admin-panel,
.admin-card,
.admin-quality-card,
.admin-index-card,
.modal,
.dialog,
button,
input,
select,
textarea {
  min-height: initial;
}


/* ============================================================
   FIX23 - MÓDULO SIMPLE DE ANÁLISIS DE RIESGOS
   ============================================================ */

.riesgos-layout {
  display: grid;
  gap: 16px;
}

.riesgos-header,
.riesgos-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.riesgos-header h2,
.riesgos-card h3 {
  margin-top: 0;
}

.riesgos-actions,
.riesgos-actions-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.riesgos-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.riesgos-stepper span {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .84rem;
}

.riesgos-grid,
.riesgos-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 16px;
}

.riesgos-card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.riesgos-card-primary {
  border-left: 5px solid var(--brand);
}

.riesgos-upload-form {
  display: grid;
  gap: 10px;
}

.riesgos-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.riesgos-config-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .86rem;
}

.riesgos-config-grid input,
.riesgos-config-grid select,
.riesgos-upload-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

.riesgos-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.riesgos-kpis > div {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
}

.riesgos-kpis span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-bottom: 6px;
}

.riesgos-kpis strong {
  font-size: 1.35rem;
  color: var(--text);
}

.riesgos-kpi-destacado {
  background: #eef6ff !important;
  border-color: #c7ddff !important;
}

.riesgos-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.riesgos-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: .88rem;
}

.riesgos-table th {
  background: #f1f5f9;
  color: var(--text);
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.riesgos-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.riesgos-table tr:last-child td {
  border-bottom: 0;
}

.riesgos-heatmap {
  display: grid;
  gap: 8px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 42px repeat(5, minmax(54px, 1fr));
  gap: 6px;
  align-items: stretch;
}

.heatmap-label,
.heatmap-corner {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.heatmap-cell {
  min-height: 58px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #111827;
  border: 1px solid rgba(15,23,42,.08);
}

.heatmap-cell strong {
  font-size: 1.25rem;
}

.heatmap-cell span {
  font-size: .72rem;
  opacity: .7;
}

.heatmap-bajo {
  background: #dcfce7;
}

.heatmap-medio {
  background: #fef9c3;
}

.heatmap-alto {
  background: #fed7aa;
}

.heatmap-critico {
  background: #fecaca;
}

.heatmap-axis-title,
.heatmap-x-title {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.heatmap-x-title {
  text-align: center;
}

.riesgos-top-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.riesgo-top-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 13px;
  padding: 10px;
  background: #fff;
}

.riesgo-top-item strong,
.riesgo-top-item span {
  display: block;
}

.riesgo-top-item span {
  color: var(--muted);
  font-size: .82rem;
  margin-top: 3px;
}

.riesgo-top-item.critico,
.risk-badge.critico {
  border-left-color: #dc2626;
}

.riesgo-top-item.alto,
.risk-badge.alto {
  border-left-color: #ea580c;
}

.riesgo-top-item.medio,
.risk-badge.medio {
  border-left-color: #ca8a04;
}

.riesgo-top-item.bajo,
.risk-badge.bajo {
  border-left-color: #16a34a;
}

.risk-badge {
  display: inline-block;
  border-left: 5px solid #64748b;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8fafc;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .riesgos-grid,
  .riesgos-main-grid {
    grid-template-columns: 1fr;
  }

  .riesgos-kpis {
    grid-template-columns: repeat(3, 1fr);
  }

  .riesgos-config-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .riesgos-header,
  .riesgos-section-head {
    display: block;
  }

  .riesgos-kpis,
  .riesgos-config-grid {
    grid-template-columns: 1fr;
  }
}

/* FIX23.3 - Acciones de limpieza del módulo de riesgos */
.riesgos-danger-zone {
  margin-top: 0.65rem;
}

.danger-btn {
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: #fff5f5;
  color: #991b1b;
}

.danger-btn:hover {
  background: #fee2e2;
  border-color: rgba(185, 28, 28, 0.55);
}

/* FIX23.5 - Exportacion PDF auditora por marco y activos */
.riesgos-export-card {
  margin-top: 14px;
}

.riesgos-export-config {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  align-items: end;
}

.riesgos-export-assets {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 12px;
  padding: 10px;
  background: rgba(248, 250, 252, 0.8);
}

.riesgos-export-asset {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
}

.riesgos-export-asset strong {
  display: block;
  font-size: 13px;
}

.riesgos-export-asset small {
  color: var(--muted, #64748b);
}

@media (max-width: 900px) {
  .riesgos-export-config {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIX23.6 - Identidad visual administrable en cabecera
   ============================================================ */

.admin-branding-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-branding-box h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
}

.admin-branding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
  align-items: end;
  margin-top: 14px;
}

.admin-branding-grid label {
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-branding-grid input[type="text"],
.admin-branding-grid input[type="file"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
}

.admin-brand-logo-preview {
  min-height: 86px;
  border: 1px dashed rgba(148, 163, 184, 0.80);
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.admin-brand-logo-preview span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-brand-logo-preview img {
  max-height: 52px;
  max-width: 220px;
  object-fit: contain;
}

.admin-brand-logo-preview em {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .admin-branding-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    height: 48px;
    max-width: 170px;
  }
}

@media (max-width: 520px) {
  .brand {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 13px;
  }

  .top-main-menu {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   FIX23.13 - Botones de configurar analisis de riesgos
   ============================================================ */

.riesgos-config-actions {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  justify-content: flex-start;
  align-items: center;
}

#riesgos-save-config-btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 9px;
}

#riesgos-generate-btn {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 32px;
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.16);
}

#riesgos-generate-btn:hover {
  background: #15803d;
  border-color: #166534;
}

#riesgos-generate-btn:focus {
  outline: 2px solid rgba(34, 197, 94, 0.30);
  outline-offset: 2px;
}


/* FIX23.14 - Plantillas por marco dentro del módulo de riesgos */
.riesgos-template-picker {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.78);
}

.riesgos-template-picker label {
  margin: 0;
}

#riesgos-template-download-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .riesgos-template-picker {
    grid-template-columns: 1fr;
  }

  #riesgos-template-download-btn {
    width: 100%;
  }
}


/* FIX24.0 - Licencia y módulos */
.admin-license-card{margin:18px 0;padding:16px;border:1px solid rgba(148,163,184,.35);border-radius:14px;background:rgba(248,250,252,.78)}
.admin-license-result{margin-top:10px}.license-summary{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:10px}.license-summary span{padding:4px 8px;border-radius:999px;background:rgba(226,232,240,.8);font-size:.86rem}.modules-grid{display:flex;flex-wrap:wrap;gap:8px}.module-pill{border:1px solid rgba(148,163,184,.35);border-radius:12px;padding:8px 10px;min-width:180px;background:#fff}.module-pill strong,.module-pill small{display:block}.module-pill.ok{border-color:rgba(22,163,74,.45)}.module-pill.off{opacity:.62}.error-text{color:#b91c1c}

/* FIX24.2 - Instalacion de modulos desde Admin */
.module-install-box{margin:12px 0 14px;padding:12px;border:1px dashed rgba(59,130,246,.35);border-radius:12px;background:rgba(239,246,255,.55)}
.module-install-box label{display:block;font-weight:700;margin-bottom:8px;color:#1e3a8a}
.module-install-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.module-install-row input[type="file"]{max-width:360px;background:#fff;border:1px solid rgba(148,163,184,.5);border-radius:10px;padding:7px}
.mini-danger-btn{margin-top:8px;border:1px solid rgba(185,28,28,.35);background:rgba(254,242,242,.9);color:#991b1b;border-radius:8px;padding:5px 8px;font-size:.78rem;font-weight:700;cursor:pointer}
.mini-danger-btn:hover{background:#fee2e2}

/* FIX24.9 - Menu Gestion aplicacion */
.gestion-app-menu {
  position: relative;
  margin-left: auto;
}

.gestion-app-btn {
  min-width: 170px;
}

.gestion-app-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 230px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.22);
}

.gestion-app-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: #0f172a;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.gestion-app-item:hover,
.gestion-app-item.active {
  background: rgba(15, 76, 117, 0.10);
  color: var(--brand-dark);
}

@media (max-width: 760px) {
  .gestion-app-menu {
    margin-left: 0;
    width: 100%;
  }

  .gestion-app-btn {
    width: 100%;
  }

  .gestion-app-dropdown {
    position: static;
    margin-top: 8px;
    width: 100%;
  }
}

/* FIX24.15 - Asistente Superadmin de licencias y módulos */
.license-wizard-box {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #d7e3f5;
  border-radius: 14px;
  background: #f8fbff;
}

.compact-header h4 {
  margin: 0 0 4px 0;
  font-size: 1rem;
}

.compact-header p {
  margin: 0;
}

.license-wizard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.license-wizard-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  color: #334155;
}

.license-wizard-grid input {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}

.license-wizard-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 10px 0 14px 0;
}

.license-module-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #ffffff;
}

.license-module-check input {
  margin-top: 3px;
}

.license-module-check span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.license-module-check small {
  color: #64748b;
}

@media (max-width: 760px) {
  .license-wizard-grid {
    grid-template-columns: 1fr;
  }
}


/* FIX24.15.1 - Visualización de validación de estado Superadmin */
.license-state-report {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
}

.license-state-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.license-state-head span {
  color: #64748b;
  font-size: 0.88rem;
}

.license-state-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.license-state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.license-state-table th,
.license-state-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.license-state-table th {
  color: #334155;
  background: #f8fafc;
}

.state-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
}

.state-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.state-pill.off {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================================
   FIX24.18 - Autenticación, usuarios y sesiones
   ============================================================ */
.auth-status-box {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  font-size: 0.82rem;
  color: #475569;
}

.small-btn {
  padding: 5px 10px !important;
  min-height: 28px !important;
  font-size: 0.78rem !important;
}

.admin-users-card {
  margin-top: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  padding: 16px;
  background: #ffffff;
}

.admin-users-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-users-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  color: #334155;
}

.admin-users-grid input,
.admin-users-grid select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.admin-users-result {
  margin-top: 12px;
  overflow-x: auto;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-users-table th,
.admin-users-table td {
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

.admin-users-table th {
  background: #f8fafc;
  color: #334155;
}

.admin-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-ok,
.badge-warn {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
  font-size: 0.76rem;
}

.badge-ok {
  background: #dcfce7;
  color: #166534;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.danger-btn {
  color: #b91c1c !important;
  border-color: rgba(185, 28, 28, 0.35) !important;
}

@media (max-width: 920px) {
  .admin-users-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .admin-users-grid {
    grid-template-columns: 1fr;
  }
  .auth-status-box {
    justify-content: flex-start;
  }
}
