  :root {
    --azul: #2B3D80;
    --azul-oscuro: #202F64;
    --verde: #80BA42;
    --verde-oscuro: #659434;
    --bg: #f4f5f8;
    --texto: #212121;
    --borde: #dcdfe6;
    /* Paleta de estado (fija, reservada solo para severidad -- ver skill de dataviz) */
    --status-good: #0ca30c;
    --status-good-text: #006300;
    --status-warning: #fab219;
    --status-warning-text: #8a5a00;
    --status-critical: #d03b3b;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: 'Encode Sans Semi Expanded', -apple-system, Roboto, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.25;
    background: var(--bg);
    color: var(--texto);
  }
  h1, h2 {
    font-family: 'Encode Sans Semi Condensed', sans-serif;
    font-weight: 700;
  }
  h1 { line-height: 1.15; }
  h2 { line-height: 1.25; }
  h3 {
    font-family: 'Encode Sans Semi Condensed', sans-serif;
    font-weight: 600;
    line-height: 1.25;
  }
  small {
    font-family: 'Encode Sans Semi Expanded', sans-serif;
    font-weight: 400;
    line-height: 1.25;
  }
  .topbar {
    background: linear-gradient(120deg, var(--azul) 0%, var(--azul-oscuro) 100%);
    color: #fff;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  .topbar-marca { display: flex; align-items: center; gap: 18px; }
  .topbar-logo { height: 42px; width: auto; display: block; }
  .topbar-divisor { width: 1px; height: 30px; background: rgba(255,255,255,0.25); }
  .topbar h1 { font-size: 18px; margin: 0; font-weight: 500; opacity: 0.95; letter-spacing: 0.2px; }
  .footer-marca {
    text-align: center; font-size: 12px; color: #9aa0b0;
    padding: 24px 20px 30px; letter-spacing: 0.2px;
  }
  .tabs {
    display: flex;
    gap: 4px;
    background: #fff;
    border-bottom: 1px solid var(--borde);
    padding: 0 20px;
  }
  .tabs button {
    border: none;
    background: none;
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
  }
  .tabs button.activo {
    color: var(--azul);
    border-bottom-color: var(--verde);
    font-weight: 600;
  }
  .container { padding: 20px; max-width: 1400px; margin: 0 auto; }
  .filtros {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
  }
  .filtros input, .filtros select {
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: 6px;
    font-size: 13px;
  }
  .filtros input[type="text"] { flex: 1; min-width: 180px; }
  .btn {
    background: var(--azul);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
  }
  .btn:hover { background: var(--azul-oscuro); }
  .btn.verde { background: var(--verde); }
  .btn.verde:hover { background: var(--verde-oscuro); }
  .btn.secundario { background: #fff; color: var(--azul); border: 1px solid var(--azul); }
  .tabla-wrap {
    background: #fff;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  th { background: #f8f9fb; color: var(--azul); font-weight: 600; position: sticky; top: 0; }
  tr:hover td { background: #f5f7fb; }
  .clicable { cursor: pointer; }
  .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #e8eaf6;
    color: var(--azul);
  }
  .badge.critico { background: rgba(208,59,59,0.12); color: var(--status-critical); }
  .badge.advertencia { background: rgba(250,178,25,0.22); color: var(--status-warning-text); }
  .badge.bueno { background: rgba(12,163,12,0.12); color: var(--status-good-text); }
  .badge.neutro { background: #eceff1; color: #555; }
  .cargando, .vacio { padding: 40px; text-align: center; color: #888; }

  /* --- KPIs / Resumen --- */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
  }
  .stat-tile {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .stat-label { font-size: 12px; color: #666; margin-bottom: 6px; }
  .stat-valor { font-size: 28px; font-weight: 600; color: var(--azul); }
  .stat-tile.clicable { transition: box-shadow 0.15s ease, transform 0.15s ease; }
  .stat-tile.clicable:hover { box-shadow: 0 4px 12px rgba(43,61,128,0.18); transform: translateY(-2px); }
  .desglose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  @media (max-width: 700px) { .desglose-grid { grid-template-columns: 1fr; } }
  .desglose-card { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
  .desglose-card h3 { margin-top: 0; font-size: 14px; color: var(--azul); }
  .barra-desglose { margin-bottom: 12px; }
  .barra-desglose-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: #555; }
  .barra-desglose-track { background: #eee; border-radius: 4px; height: 10px; overflow: hidden; }
  .barra-desglose-fill { height: 100%; border-radius: 4px; }
  .barra-desglose-fill.critico { background: var(--status-critical); }
  .barra-desglose-fill.advertencia { background: var(--status-warning); }
  .barra-desglose-fill.bueno { background: var(--status-good); }
  .barra-desglose-fill.neutro { background: #9e9e9e; }
  .barra-desglose.clicable { padding: 4px; margin: -4px -4px 8px; border-radius: 6px; transition: background 0.15s ease; }
  .barra-desglose.clicable:hover { background: #f3f4f8; }

  /* --- Meter (avance %) --- */
  .meter-wrap { display: flex; align-items: center; gap: 8px; }
  .meter-track { background: rgba(43,61,128,0.12); border-radius: 6px; height: 8px; overflow: hidden; width: 60px; flex-shrink: 0; }
  .meter-fill { height: 100%; background: var(--azul); border-radius: 6px; }
  .meter-valor { font-size: 11px; color: #666; white-space: nowrap; }

  .overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 30px 16px; overflow-y: auto; z-index: 100;
  }
  .modal {
    background: #fff; border-radius: 10px; padding: 24px;
    width: 100%; max-width: 640px;
  }
  .modal h2 { margin-top: 0; color: var(--azul); font-size: 17px; }
  .modal-visor { max-width: 1600px; width: 96vw; height: 94vh; display: flex; flex-direction: column; }
  .overlay-grande { padding: 12px; }
  .visor-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-bottom: 14px; flex-shrink: 0;
  }
  .visor-header h2 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .visor-body { flex: 1; overflow-y: auto; border: 1px solid var(--borde); border-radius: 8px; }
  .archivos-lista { list-style: none; margin: 0; padding: 0; }
  .migas-pan { font-size: 13px; color: #888; margin-bottom: 10px; }

  /* 04-ago-2026 (pedido explícito): campanita de notificaciones, solo admins */
  .boton-campana {
    position: relative; background: rgba(255,255,255,0.15); border: none; color: #fff;
    font-size: 18px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.15s;
  }
  .boton-campana:hover { background: rgba(255,255,255,0.28); }
  .badge-campana {
    position: absolute; top: -4px; right: -4px; background: #dc3545; color: #fff;
    border-radius: 50%; min-width: 18px; height: 18px; padding: 0 3px; font-size: 10px;
    font-weight: 800; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--azul-oscuro);
  }
  .panel-notificaciones {
    position: absolute; top: 44px; right: 0; width: 360px; max-height: 70vh; overflow-y: auto;
    background: #fff; color: var(--texto); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.28);
    z-index: 500;
  }
  .panel-notificaciones-header {
    display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid #eee; font-size: 13px; position: sticky; top: 0; background: #fff;
  }
  .panel-notificaciones-header a { color: var(--azul); font-size: 12px; text-decoration: none; }
  .notificacion-item { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; font-size: 13px; }
  .notificacion-item:hover { background: #f5f7fb; }
  .notificacion-item.noleida { font-weight: 700; border-left: 3px solid var(--verde); }
  .notificacion-fecha { font-size: 11px; color: #888; margin-top: 3px; font-weight: 400; }
  .migas-pan a { color: var(--azul); text-decoration: none; }
  .migas-pan a:hover { text-decoration: underline; }
  .archivos-lista li { border-bottom: 1px solid #eee; }
  .archivos-lista li:last-child { border-bottom: none; }
  .archivo-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    text-decoration: none; color: var(--texto); font-size: 13px;
  }
  .archivo-item:hover { background: #f5f7fb; }
  .archivo-icono { width: 20px; height: 20px; flex-shrink: 0; }
  .archivo-nombre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .archivo-fecha { font-size: 11px; color: #888; flex-shrink: 0; }

  /* 04-ago-2026 (pedido explícito): "ISO 9001 general" tiene pocos elementos
     (2-3 tarjetas + una lista de archivos) y se veía perdido en todo el
     ancho disponible -- se escala solo ACÁ, sin tocar la grilla densa de
     "Procesos ISO 9001" (14 tarjetas) que usa las mismas clases base. */
  .iso-general-body .procesos-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
  .iso-general-body .proceso-card { padding: 20px 22px; border-radius: 12px; }
  .iso-general-body .proceso-icono { font-size: 32px; }
  .iso-general-body .proceso-nombre { font-size: 16px; -webkit-line-clamp: 2; line-clamp: 2; }
  .iso-general-body select { font-size: 15px; padding: 9px 14px; }
  .iso-general-body label { font-size: 15px; }
  .iso-general-body .btn.secundario, .iso-general-body .btn.verde { font-size: 14px; padding: 9px 16px; }
  .iso-general-body .archivos-lista { border: 1px solid #eee; border-radius: 10px; overflow: hidden; }
  .iso-general-body .archivo-item { padding: 16px 20px; font-size: 16px; gap: 16px; }
  .iso-general-body .archivo-icono { width: 26px; height: 26px; }
  .iso-general-body .archivo-fecha { font-size: 13px; }

  /* 04-ago-2026 (pedido explícito): mismo criterio que iso-general-body,
     acá para el detalle de un proceso (lista de archivos de su carpeta). */
  .proceso-detalle-body .filtros h2 { font-size: 22px; }
  .proceso-detalle-body .btn.secundario { font-size: 14px; padding: 9px 16px; }
  .proceso-detalle-body .archivos-lista { border: 1px solid #eee; border-radius: 10px; overflow: hidden; }
  .proceso-detalle-body .archivo-item { padding: 16px 20px; font-size: 16px; gap: 16px; }
  .proceso-detalle-body .archivo-icono { width: 26px; height: 26px; }
  .proceso-detalle-body .archivo-fecha { font-size: 13px; }
  .modal-tabs { display: flex; gap: 4px; border-bottom: 1px solid #eee; margin-bottom: 16px; }
  .modal-tabs button {
    border: none; background: none; padding: 8px 14px; font-size: 13px;
    cursor: pointer; color: #666; border-bottom: 2px solid transparent;
  }
  .modal-tabs button.activo { color: var(--azul); border-bottom-color: var(--verde); font-weight: 600; }
  .campo { margin-bottom: 12px; position: relative; }
  .campo label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 600; }
  .campo input, .campo select, .campo textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--borde);
    border-radius: 6px; font-size: 13px; font-family: inherit;
  }
  .campo textarea { min-height: 60px; resize: vertical; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .modal-acciones {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px;
    border-top: 1px solid #eee; padding-top: 14px;
  }
  .error-msg { color: var(--status-critical); font-size: 13px; margin-top: 8px; }
  .sub-tabla { margin-top: 18px; }

  /* --- Historial de versiones (12-ago-2026, pedido explícito) --- */
  .boton-versiones {
    background: none; border: 1px solid var(--borde); border-radius: 6px;
    padding: 4px 10px; font-size: 12px; color: var(--azul); cursor: pointer;
    margin-left: 10px; vertical-align: middle;
  }
  .fecha-en-titulo { margin-left: 10px; font-size: 12px; font-weight: normal; color: var(--azul); vertical-align: middle; }
  .boton-versiones:hover { border-color: var(--azul); background: #f4f5f8; }
  /* 13-ago-2026 (pedido explícito): "carpetas por año" -- <details> nativo hace de carpeta. */
  .version-anio { margin-bottom: 10px; }
  .version-anio-titulo {
    cursor: pointer; font-size: 13px; font-weight: 700; color: var(--azul);
    padding: 6px 4px; list-style: none; user-select: none;
  }
  .version-anio-titulo::-webkit-details-marker { display: none; }
  .version-anio-titulo::before { content: '📁 '; }
  .version-anio-cuenta { color: #999; font-weight: 400; }
  .version-item { border: 1px solid var(--borde); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
  .version-item-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 14px; font-size: 12.5px; cursor: pointer; background: #fafafa;
  }
  .version-comentario { display: block; font-weight: 700; margin: 2px 0; }
  .version-meta { color: #888; font-size: 11.5px; }
  .version-item-body { padding: 12px 14px; border-top: 1px solid #eee; }
  .version-nota { font-size: 12px; color: #666; margin: 0 0 10px; }
  .version-seccion { margin-bottom: 16px; }
  .version-seccion:last-child { margin-bottom: 0; }
  .version-seccion-titulo {
    font-size: 12px; font-weight: 700; color: var(--azul); text-transform: uppercase;
    letter-spacing: 0.3px; margin: 0 0 4px; padding-bottom: 4px; border-bottom: 1px solid #eee;
  }
  .tabla-version { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
  .tabla-version th { text-align: left; color: #888; font-weight: 600; padding: 4px 8px; border-bottom: 1px solid #eee; }
  .tabla-version th:first-child, .tabla-version td:first-child { width: 180px; }
  .tabla-version td {
    padding: 6px 8px; border-bottom: 1px solid #f4f5f8; vertical-align: top;
    white-space: normal; max-width: none; overflow: visible; text-overflow: unset;
    word-break: break-word;
  }
  .tabla-version tr.fila-cambiada { background: rgba(240,180,41,0.12); }
  .version-antes-inline {
    color: var(--status-critical); font-size: 11px; margin-top: 2px;
    text-decoration: line-through; opacity: 0.8;
  }
  .sub-tabla h3 { font-size: 13px; color: var(--azul); margin-bottom: 6px; }

  /* --- Inicio (cuadrados grandes) --- */
  .inicio-fondo-wrap {
    position: relative; overflow: hidden;
    height: calc(100vh - 82px);
    display: flex;
    background: #f4f5f8;
  }
  .inicio-wrap {
    position: relative; z-index: 1; max-width: 1700px; margin: 0 auto;
    padding: 16px 28px; width: 100%; height: 100%; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 10px;
  }
  .inicio-saludo { display: flex; align-items: baseline; gap: 10px; flex: 0 0 auto; }
  .inicio-saludo h2 { font-size: 17px; color: var(--azul); margin: 0; font-weight: 700; }
  .inicio-saludo p { color: #888; font-size: 12px; margin: 0; }
  .inicio-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    flex: 0 0 auto;
  }
  .inicio-card {
    flex: 1; min-width: 0;
    background: #fff; border-radius: 14px; padding: 14px 12px;
    box-shadow: 0 4px 20px rgba(43,61,128,0.09);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; text-align: center; border: 1px solid #eceef3;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  }
  .inicio-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(43,61,128,0.2);
    border-color: var(--verde);
  }
  .inicio-icono-wrap {
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 19px;
    flex-shrink: 0;
  }
  .inicio-icono-wrap.azul { background: rgba(43,61,128,0.10); }
  .inicio-icono-wrap.verde { background: rgba(128,186,66,0.16); }
  .inicio-card .titulo { font-size: 12.5px; font-weight: 700; color: var(--azul); }
  .inicio-card .descripcion { font-size: 10.5px; color: #888; line-height: 1.3; max-width: none; }

  /* --- Mapa de Procesos (Inicio) --- 🆕 11-ago-2026 (pedido explícito, "algo que
     pueda clickear en un futuro y me lleve al proceso"): NO es una imagen -- cada
     caja es un elemento real de la interfaz, con el mismo Código que ya usa
     /procesos-iso9001 (A1..C6), así que ya hoy hace clic y abre el detalle real
     de ese proceso (ver irAProcesoDesdeMapa). */
  .mapa-card {
    background: #fff; border-radius: 14px; padding: 14px 22px 16px;
    box-shadow: 0 4px 20px rgba(43,61,128,0.09); border: 1px solid #eceef3;
    flex: 1; min-height: 0; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .mapa-card h3 { font-size: 13.5px; font-weight: 700; color: var(--azul); margin: 0 0 2px; }
  .mapa-card > p { font-size: 11px; color: #888; margin: 0 0 10px; }
  .mapa-procesos {
    display: grid;
    grid-template-columns: clamp(64px, 6.5vw, 100px) clamp(52px, 5.2vw, 80px) minmax(0, 1fr) clamp(52px, 5.2vw, 80px) clamp(64px, 6.5vw, 100px);
    gap: clamp(4px, 0.6vw, 8px);
    align-items: stretch;
    flex: 1; min-height: 0;
  }
  .mapa-lateral {
    background: #fafaf6; border: 1.5px solid #c9a227; border-radius: 8px;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: clamp(6px, 1vw, 12px) clamp(4px, 0.7vw, 8px); text-align: center;
  }
  .mapa-lateral span { font-size: clamp(9px, 0.85vw, 11px); font-weight: 700; color: #444; line-height: 1.25; }
  .mapa-flechas {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 4px 0;
  }
  .mapa-flechas .grupo { display: flex; flex-direction: column; align-items: center; gap: 14px; }
  .mapa-lateral-doble { display: flex; flex-direction: column; gap: 14px; align-items: center; }
  .mapa-flechas .grupo span {
    font-size: clamp(9px, 0.9vw, 12px); font-weight: 700; color: #7a5e14; line-height: 1.2; text-align: center;
    background: #fdf3d8; border: 1px solid #c9a227; border-radius: 10px; padding: 3px 8px;
    display: inline-block;
  }
  .mapa-centro { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
  .mapa-banda {
    border: 1.5px solid #c9a227; border-radius: 8px; padding: 15px 12px 8px; position: relative;
    flex: 1; min-height: 0; display: flex; flex-direction: column;
  }
  .mapa-banda-titulo {
    position: absolute; top: -9px; left: 14px; background: #fff; padding: 0 8px;
    font-size: 11px; font-weight: 700; color: #444; letter-spacing: 0.4px;
  }
  .mapa-fila { display: flex; gap: clamp(4px, 0.6vw, 8px); align-items: stretch; flex: 1; min-height: 0; }
  .mapa-caja {
    flex: 1; min-width: 0; background: #F0B429; border: 1.5px solid #9c7a1f; border-radius: 8px;
    padding: clamp(4px, 0.8vw, 10px) clamp(4px, 0.6vw, 8px); font-size: clamp(8.5px, 0.85vw, 12px); font-weight: 700; color: #3a2f06;
    text-align: center; line-height: 1.2; cursor: pointer; overflow-wrap: break-word;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .mapa-caja.blanca { background: #fff; color: #333; }
  .mapa-caja .mapa-sub { display: block; font-size: clamp(7px, 0.65vw, 10px); font-weight: 400; color: #666; margin-top: 3px; }
  .mapa-caja:hover {
    transform: translateY(-3px); border-color: var(--verde);
    box-shadow: 0 8px 18px rgba(43,61,128,0.16);
  }
  .mapa-flecha-h {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: #C99A1E; color: #fff; font-size: 17px; font-weight: 900;
  }
  .mapa-conector { display: flex; justify-content: center; align-items: center; gap: 26px; margin: -3px 0; }
  .mapa-conector span {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: #fdf3d8; border: 1.5px solid #c9a227; color: #C99A1E;
    font-size: 17px; font-weight: 900;
  }
  .mapa-lado {
    display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
    color: #444; white-space: nowrap;
  }
  .mapa-lado .mapa-flecha-h { font-size: 20px; }
  .mapa-lado-izq { justify-content: flex-start; padding-left: 4px; }
  .mapa-lado-der { justify-content: flex-end; padding-right: 4px; text-align: right; }
  .btn-volver {
    background: #fff; border: 1px solid #e0e3ec; color: var(--azul); cursor: pointer;
    font-size: 13px; font-weight: 600; padding: 8px 16px; margin: 16px 0 0 20px;
    border-radius: 20px; display: inline-flex; align-items: center; gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
  }
  .btn-volver:hover {
    background: rgba(128,186,66,0.12); border-color: var(--verde);
    transform: translateX(-2px);
  }

  /* 17-ago-2026 (pedido explícito): barra "← Volver a..." al otro extremo de la fila
     del título, junto a Versiones/Guardar versión (mismo renglón, ver el flex que la
     envuelve) -- dentro del modal de Riesgo/Tratamiento cuando se llegó ahí cruzando
     desde el otro (ver volverA en la app). */
  .barra-volver {
    background: #f4f5f8; border: 1px solid #e0e3ec; color: var(--azul); cursor: pointer;
    font-size: 13px; font-weight: 600; padding: 6px 14px; flex-shrink: 0;
    border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s, border-color 0.15s;
  }
  .barra-volver:hover { background: rgba(128,186,66,0.12); border-color: var(--verde); }

  /* --- Autocompletar --- */
  .autocomplete-lista {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff;
    border: 1px solid var(--borde); border-radius: 6px; max-height: 180px; overflow-y: auto;
    z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,0.12); margin-top: 2px;
  }
  .autocomplete-item { padding: 8px 10px; font-size: 12px; cursor: pointer; }
  .autocomplete-item:hover { background: #f0f2f8; }
  .autocomplete-seleccionado { font-size: 11px; color: var(--verde); margin-top: 4px; font-weight: 600; }

  /* --- Procesos ISO (tarjetas tipo carpeta) --- */
  .procesos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .proceso-card {
    background: #fff; border-radius: 8px; padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .proceso-link {
    display: flex; align-items: center; gap: 10px; text-decoration: none;
    color: var(--texto); flex: 1; min-width: 0;
  }
  .proceso-link:hover .proceso-nombre { color: var(--azul); text-decoration: underline; }
  .proceso-icono { font-size: 22px; flex-shrink: 0; }
  .proceso-nombre {
    font-size: 12px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
  }

  /* --- Buscador (burbuja flotante) --- */
  .chat-burbuja {
    position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
    border-radius: 50%; background: var(--azul); color: #fff; border: none;
    font-size: 24px; cursor: pointer; box-shadow: 0 4px 14px rgba(43,61,128,0.4);
    z-index: 250; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.15s;
  }
  .chat-burbuja:hover { background: var(--azul-oscuro); transform: scale(1.06); }

  .boton-bitacora {
    position: fixed; bottom: 24px; left: 24px; width: 40px; height: 40px;
    border-radius: 50%; background: rgba(0,0,0,0.06); color: #777; border: none;
    font-size: 17px; cursor: pointer; z-index: 240; display: flex;
    align-items: center; justify-content: center; transition: background 0.15s;
  }
  .boton-bitacora:hover { background: rgba(0,0,0,0.12); color: #444; }
  .chat-panel {
    position: fixed; bottom: 92px; right: 24px; width: 380px; max-width: calc(100vw - 40px);
    max-height: 70vh; background: #fff; border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.22); z-index: 250;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .chat-panel-header { background: var(--azul); color: #fff; padding: 14px 18px; font-size: 14px; flex-shrink: 0; }
  .chat-panel-body { flex: 1; overflow-y: auto; padding: 14px; }
  .chat-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
  .chat-input-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 6px; font-size: 13px; }
  .chat-grupo { margin-bottom: 14px; }
  .chat-grupo h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin: 0 0 6px; }
  .chat-resultado-item {
    display: block; padding: 8px 10px; border-radius: 8px; cursor: pointer;
    font-size: 13px; color: var(--texto); text-decoration: none;
  }
  .chat-resultado-item:hover { background: #f0f2f8; }
  .chat-resultado-sub { font-size: 11px; color: #888; margin-top: 2px; }
  .chat-respuesta-directa {
    background: #eef1fb; border-left: 3px solid var(--azul); border-radius: 6px;
    padding: 10px 12px; margin-bottom: 14px; font-size: 13px; color: var(--texto);
  }

  /* --- Toast --- */
  .toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    color: #fff; padding: 10px 22px; border-radius: 6px; font-size: 13px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25); z-index: 300; font-weight: 600;
  }
  .toast.exito { background: var(--status-good); }
  .toast.error { background: var(--status-critical); }

  /* Selección múltiple (clasificación ISO 27001 del riesgo) */
  .selector-multiple { position: relative; }
  .selector-multiple-valor {
    min-height: 34px; padding: 4px 6px; border: 1px solid var(--borde); border-radius: 6px;
    background: #fff; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; cursor: pointer;
  }
  .selector-multiple-chip {
    background: #e6e9f4; color: var(--azul); border-radius: 12px; padding: 2px 8px; font-size: 12px;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .selector-multiple-chip button { border: 0; background: transparent; color: var(--azul); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; }
  .selector-multiple-vacio { color: #888; font-size: 12px; }
  .selector-multiple-panel {
    position: absolute; z-index: 20; left: 0; right: 0; margin-top: 2px; max-height: 260px; overflow-y: auto;
    background: #fff; border: 1px solid var(--borde); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.12); padding: 6px;
  }
  .selector-multiple-buscar { width: 100%; margin-bottom: 6px; }
  .selector-multiple-opcion { display: flex !important; align-items: flex-start; gap: 6px; padding: 3px 4px; font-weight: 400 !important; font-size: 13px !important; color: var(--texto) !important; cursor: pointer; }
  .selector-multiple-opcion:hover { background: #f0f3e8; }
  .selector-multiple-opcion input { width: auto !important; margin-top: 2px; accent-color: var(--verde-oscuro); }

  /* ==============================================================
     DASHBOARD SGI ADE — SISTEMA DE DISEÑO DE PORTADA Y VISTAS
     ============================================================== */
  :root {
    --navy: #2B3D80;
    --navy-2: #3B4EA0;
    --green: #80BA42;
    --green-d: #5f9230;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --border: #d7deea;
    --fg: #1c2230;
    --muted: #5d667a;
    --faint: #8a94a8;
    --bajo: #2E9E5B;
    --bajo-bg: #e3f4ea;
    --medio: #E0A200;
    --medio-bg: #fdf3d6;
    --alto: #C0392B;
    --alto-bg: #fbe3e0;
    --note: #0F766E;
    --note-bg: #e6f4f2;
    --shadow: 0 1px 3px rgba(20,30,60,.06), 0 3px 12px rgba(20,30,60,.06);
    --r: 12px;
  }

  .tnum { font-variant-numeric: tabular-nums; }

  /* Barra de pestañas dividida */
  .tabs-con-subsecciones {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .tabs-grupo {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }
  .tabs-separador {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 10px;
    flex-shrink: 0;
  }

  /* Toolbar de filtros del dashboard */
  .dashboard-toolbar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  }
  .dashboard-filtros-grupo {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .dashboard-filtros-grupo select, .dashboard-filtros-grupo input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--surface);
    color: var(--fg);
  }
  .dashboard-vistas-switch {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
  }
  .dashboard-vistas-switch button {
    border: none;
    background: transparent;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .dashboard-vistas-switch button.activo {
    background: #fff;
    color: var(--navy);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* Encabezado de vista */
  .view-hd {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--surface-2);
    border-top-left-radius: var(--r);
    border-top-right-radius: var(--r);
  }
  .view-hd .num {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--navy);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    flex: none;
  }
  .view-hd h2 { font-size: 18px; margin: 0; color: var(--fg); }
  .view-hd p { margin: 2px 0 0; font-size: 13px; color: var(--muted); flex-basis: 100%; }
  .chip {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
  }
  .chip.g { background: var(--green-d); }
  .tag-ejemplo {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--medio);
    background: var(--medio-bg);
    padding: 1px 7px;
    border-radius: 5px;
  }

  /* Grid y cards */
  .grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(12, 1fr);
  }
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
  }
  .card.span3 { grid-column: span 3; }
  .card.span4 { grid-column: span 4; }
  .card.span6 { grid-column: span 6; }
  .card.span8 { grid-column: span 8; }
  .card.span12 { grid-column: span 12; }
  .card h3 {
    font-size: 13px;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
    font-weight: 600;
  }
  @media (max-width: 900px) {
    .card.span3, .card.span4 { grid-column: span 6; }
    .card.span6, .card.span8 { grid-column: span 12; }
  }
  @media (max-width: 600px) {
    .card.span3, .card.span4 { grid-column: span 12; }
  }

  /* KPI tiles */
  .kpi { gap: 4px; }
  .kpi .kpi-num {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--fg);
  }
  .kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
  .kpi .sub { font-size: 12px; font-weight: 600; }
  .up { color: var(--bajo); }
  .down { color: var(--alto); }
  .warn { color: var(--medio); }
  .kpi.alertborder { border-left: 4px solid var(--alto); }
  .kpi.goodborder { border-left: 4px solid var(--bajo); }

  /* Mapa de calor 3x3 */
  .heatwrap {
    display: flex;
    gap: 14px;
    align-items: stretch;
    flex-wrap: wrap;
  }
  .heat-container { flex: 1; min-width: 220px; }
  .heat {
    display: grid;
    grid-template-columns: auto repeat(3, 1fr);
    grid-template-rows: auto repeat(3, 54px);
    gap: 5px;
  }
  .heat .ax {
    display: grid;
    place-items: center;
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
  }
  .heat .cell {
    border-radius: 8px;
    display: grid;
    place-items: center;
    position: relative;
    color: #1c2230;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
  }
  .heat .cell:hover {
    transform: scale(1.04);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  }
  .heat .cell.activa {
    outline: 3px solid var(--navy);
    box-shadow: 0 0 0 1px #fff;
  }
  .heat .heat-n {
    font-size: 20px;
    font-weight: 700;
  }
  .cell.bajo { background: var(--bajo); color: #fff; }
  .cell.medio { background: var(--medio); color: #1c2230; }
  .cell.alto { background: var(--alto); color: #fff; }
  .axtitle {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    font-weight: 600;
    letter-spacing: .3px;
  }
  .heat-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 130px;
    border-left: 1px solid var(--border);
    padding-left: 14px;
  }
  .heat-side .row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
  }
  .heat-side .row:hover { opacity: 0.85; }
  .sw {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
  }

  /* Barras pareadas (Inherente vs Residual) */
  .barpair {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .bp {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 13px;
  }
  .track {
    height: 16px;
    border-radius: 8px;
    background: var(--surface-2);
    overflow: hidden;
  }
  .fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
  }

  /* Donut de normas */
  .donut-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
  }
  .donut {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    flex: none;
    -webkit-mask: radial-gradient(circle 34px at 50% 50%, transparent 98%, #000 100%);
    mask: radial-gradient(circle 34px at 50% 50%, transparent 98%, #000 100%);
  }

  /* Segmentos y leyendas */
  .seg {
    display: flex;
    height: 22px;
    border-radius: 7px;
    overflow: hidden;
  }
  .seg i { display: block; }
  .seg-leg {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12.5px;
    margin-top: 4px;
  }
  .seg-leg span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* Sparklines */
  .spark {
    width: 100%;
    height: 60px;
  }

  /* Tablas de widgets y pills */
  .pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 999px;
    display: inline-block;
  }
  .pill.bajo { background: var(--bajo-bg); color: var(--bajo); }
  .pill.medio { background: var(--medio-bg); color: var(--medio); }
  .pill.alto { background: var(--alto-bg); color: var(--alto); }
  .pill.navy { background: var(--navy); color: #fff; }
  .pill.gray { background: var(--surface-2); color: var(--muted); }

  /* Nota de desarrollo punteada */
  .note {
    border: 1.5px dashed var(--note);
    background: var(--note-bg);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--fg);
  }
  .note b { color: var(--note); }
  .note .grid2 {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    margin-top: 4px;
  }
  .note .grid2 i { color: var(--muted); font-style: normal; }

  /* Leyenda de portada */
  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 13px;
    align-items: center;
  }
  .legend span { display: inline-flex; align-items: center; gap: 7px; }
  .dot-note { width: 20px; height: 0; border-top: 2px dashed var(--note); }
