:root {
  --bg-base:       #070b14;
  --bg-surface:    #0d1424;
  --bg-card:       #111b2e;
  --bg-row-hover:  #14213d;
  --bg-selected:   #0f2145;
  --border:        #1c2d4a;
  --border-light:  #243552;
  --text-primary:  #e8edf5;
  --text-secondary:#8a9dc0;
  --text-muted:    #4a5f80;
  --accent:        #3d7eff;
  --accent-dim:    rgba(61,126,255,0.12);
  --critico-color: #f87171;
  --critico-bg:    rgba(248,113,113,0.1);
  --critico-border:rgba(248,113,113,0.3);
  --alto-color:    #fbbf24;
  --alto-bg:       rgba(251,191,36,0.1);
  --alto-border:   rgba(251,191,36,0.3);
  --verde-color:   #34d399;
  --medio-color:   #a78bfa;
  --medio-bg:      rgba(167,139,250,0.1);
  --medio-border:  rgba(167,139,250,0.3);
  --font-display:  'Syne', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px;
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-base); color: var(--text-primary); font-family: var(--font-mono); font-size: 13px; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: linear-gradient(180deg,#0a1020 0%,var(--bg-surface) 100%); border-bottom: 1px solid var(--border); padding: 28px 32px 24px; position: relative; overflow: hidden; }
.topbar::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:linear-gradient(90deg,transparent,var(--accent),transparent); }
.topbar::after { content:'AUDIT · RISK · COMPLIANCE · GOVERNANCE'; position:absolute; right:32px; bottom:16px; font-size:10px; letter-spacing:0.2em; color:var(--text-muted); opacity:0.5; }
.topbar-inner { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; max-width:1400px; margin:0 auto; }
.brand-tag { font-size:10px; letter-spacing:0.15em; color:var(--accent); background:var(--accent-dim); border:1px solid rgba(61,126,255,0.25); padding:3px 10px; border-radius:var(--radius-sm); display:inline-block; margin-bottom:10px; }
.brand h1 { font-family:var(--font-display); font-size:36px; font-weight:800; line-height:1.05; color:var(--text-primary); letter-spacing:-0.5px; }
.brand h1 em { font-style:normal; color:var(--accent); }
.brand-desc { margin-top:8px; font-size:11px; color:var(--text-muted); letter-spacing:0.04em; }
.header-meta { display:flex; gap:24px; align-items:flex-end; padding-bottom:4px; }
.meta-item { display:flex; flex-direction:column; align-items:flex-end; gap:2px; }
.meta-label { font-size:9px; letter-spacing:0.15em; color:var(--text-muted); text-transform:uppercase; }
.meta-value { font-size:12px; color:var(--text-secondary); font-weight:600; }
.status-dot::before { content:'●'; color:var(--verde-color); margin-right:5px; font-size:8px; animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.container { max-width:1400px; margin:0 auto; padding:28px 32px; flex:1; }
.ecosystem-strip {
  display:grid;
  grid-template-columns:minmax(0,1.3fr) minmax(320px,0.9fr);
  gap:16px;
  margin-bottom:20px;
  padding:18px 20px;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:linear-gradient(180deg,rgba(17,27,46,0.94),rgba(13,20,36,0.94));
}
.ecosystem-kicker {
  display:inline-block;
  margin-bottom:8px;
  font-size:10px;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--accent);
}
.ecosystem-copy h2 {
  font-family:var(--font-display);
  font-size:22px;
  line-height:1.15;
  margin-bottom:8px;
  color:var(--text-primary);
}
.ecosystem-copy p {
  font-size:12px;
  color:var(--text-secondary);
  max-width:72ch;
}
.ecosystem-grid { display:grid; grid-template-columns:1fr; gap:10px; }
.ecosystem-card {
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  background:rgba(7,11,20,0.42);
  padding:12px 14px;
}
.ecosystem-card.active {
  border-color:rgba(61,126,255,0.35);
  background:rgba(61,126,255,0.1);
}
.ecosystem-label {
  display:block;
  margin-bottom:4px;
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:0.12em;
  color:var(--text-muted);
}
.ecosystem-card p { font-size:11px; color:var(--text-secondary); }
.summary { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin-bottom:24px; }
.stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px 18px; }
.stat-card.card-alert { border-color:var(--critico-border); background:linear-gradient(135deg,var(--bg-card),rgba(248,113,113,0.04)); }
.stat-card.card-warn { border-color:var(--alto-border); background:linear-gradient(135deg,var(--bg-card),rgba(251,191,36,0.04)); }
.stat-card.card-danger { border-color:rgba(248,113,113,0.5); background:linear-gradient(135deg,var(--bg-card),rgba(248,113,113,0.06)); }
.stat-card.card-danger .stat-value { color:#f87171; }
.stat-label { font-size:10px; letter-spacing:0.1em; color:var(--text-muted); text-transform:uppercase; margin-bottom:8px; display:block; }
.stat-value { font-family:var(--font-display); font-size:32px; font-weight:800; line-height:1; color:var(--text-primary); }
.stat-card.card-alert .stat-value { color:var(--critico-color); }
.stat-card.card-warn .stat-value { color:var(--alto-color); }
.stat-sub { font-size:10px; color:var(--text-muted); margin-top:4px; }
.madurez-bar { height:3px; background:var(--border); border-radius:2px; overflow:hidden; margin-top:6px; }
.madurez-fill { height:100%; background:var(--accent); border-radius:2px; }

/* ── Filtros ── */
.filters-bar { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.filters-label { font-size:10px; letter-spacing:0.12em; color:var(--text-muted); text-transform:uppercase; white-space:nowrap; }
.filters-group { display:flex; gap:8px; flex-wrap:wrap; flex:1; }
.filter-select { background:var(--bg-card); color:var(--text-secondary); border:1px solid var(--border); padding:8px 28px 8px 12px; border-radius:var(--radius-sm); font-family:var(--font-mono); font-size:11px; cursor:pointer; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a5f80'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; }
.filter-select:focus { border-color:var(--accent); color:var(--text-primary); outline:none; }
.btn-reset { background:transparent; color:var(--text-muted); border:1px solid var(--border); padding:8px 14px; border-radius:var(--radius-sm); font-family:var(--font-mono); font-size:11px; cursor:pointer; }
.btn-reset:hover { border-color:var(--critico-border); color:var(--critico-color); }
.filter-count { font-size:11px; color:var(--text-muted); margin-left:auto; }
.demo-note {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(61,126,255,0.06);
}
.demo-note p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.demo-note strong { color: var(--text-primary); }

/* ── Tabla ── */
.table-wrapper { background:var(--bg-surface); border:1px solid var(--border); border-radius:var(--radius-lg); overflow-x:auto; margin-bottom:20px; -webkit-overflow-scrolling:touch; }
.audit-table { width:100%; border-collapse:collapse; min-width:780px; }
.audit-table thead tr { background:var(--bg-card); border-bottom:1px solid var(--border); }
.audit-table th { padding:12px 14px; font-size:9px; letter-spacing:0.12em; text-transform:uppercase; color:var(--text-muted); text-align:left; font-weight:600; white-space:nowrap; }
.audit-table th.sortable { cursor:pointer; user-select:none; }
.audit-table th.sortable:hover { color:var(--text-secondary); }
.audit-table th.sort-desc::after { content:' ↓'; color:var(--accent); }
.audit-table th.sort-asc::after { content:' ↑'; color:var(--accent); }
.audit-table td { padding:13px 14px; border-bottom:1px solid var(--border); vertical-align:middle; color:var(--text-secondary); font-size:12px; }
.audit-table tbody tr { cursor:pointer; transition:background 0.15s; }
.audit-table tbody tr:hover { background:var(--bg-row-hover); }
.audit-table tbody tr.selected { background:var(--bg-selected); border-left:2px solid var(--accent); }
.audit-table tbody tr:last-child td { border-bottom:none; }
.td-id { color:var(--text-muted); font-size:11px; }
.td-riesgo { max-width:280px; color:var(--text-primary); font-size:12px; line-height:1.4; }

/* ── Badges: impacto ── */
.badge { display:inline-block; padding:3px 9px; border-radius:4px; font-size:10px; font-weight:600; letter-spacing:0.05em; border:1px solid transparent; white-space:nowrap; }
.badge-critico { background:var(--critico-bg); color:var(--critico-color); border-color:var(--critico-border); }
.badge-alto { background:var(--alto-bg); color:var(--alto-color); border-color:var(--alto-border); }
.badge-medio { background:var(--medio-bg); color:var(--medio-color); border-color:var(--medio-border); }
.badge-bajo { background:rgba(52,211,153,0.08); color:#34d399; border-color:rgba(52,211,153,0.25); }
.badge-prioridad-critica { background:rgba(239,68,68,0.12); color:#ef4444; border-color:rgba(239,68,68,0.35); }
.badge-prioridad-alta { background:rgba(234,179,8,0.1); color:#eab308; border-color:rgba(234,179,8,0.3); }

/* ── Badges: dominio ── */
.badge-dominio { font-size:10px; font-weight:600; padding:3px 9px; border-radius:4px; border:1px solid; white-space:nowrap; }
.badge-dominio-identificar { background:rgba(99,102,241,0.1); color:#818cf8; border-color:rgba(99,102,241,0.3); }
.badge-dominio-proteger { background:rgba(6,182,212,0.1); color:#67e8f9; border-color:rgba(6,182,212,0.25); }
.badge-dominio-recuperar { background:rgba(16,185,129,0.1); color:#6ee7b7; border-color:rgba(16,185,129,0.25); }
.badge-dominio-detectar  { background:rgba(245,158,11,0.1); color:#fcd34d; border-color:rgba(245,158,11,0.25); }
.badge-dominio-responder { background:rgba(251,113,133,0.1); color:#fb7185; border-color:rgba(251,113,133,0.25); }

/* ── Badges: estado del control ── */
.badge-estado { display:inline-block; padding:3px 9px; border-radius:4px; font-size:10px; font-weight:600; border:1px solid; white-space:nowrap; }
.badge-estado-noimpl  { background:rgba(248,113,113,0.12); color:#f87171; border-color:rgba(248,113,113,0.35); }
.badge-estado-parcial { background:rgba(251,191,36,0.1);   color:#fbbf24; border-color:rgba(251,191,36,0.3); }
.badge-estado-impl    { background:rgba(52,211,153,0.1);   color:#34d399; border-color:rgba(52,211,153,0.3); }
.badge-estado-validado{ background:rgba(61,126,255,0.1);   color:#3d7eff; border-color:rgba(61,126,255,0.3); }

/* ── Badges: estado del hallazgo ── */
.badge-hallazgo { display:inline-block; padding:3px 9px; border-radius:4px; font-size:10px; font-weight:600; border:1px solid; white-space:nowrap; }
.badge-hallazgo-abierto  { background:rgba(239,68,68,0.1);    color:#ef4444; border-color:rgba(239,68,68,0.35); }
.badge-hallazgo-encurso  { background:rgba(251,146,60,0.1);   color:#fb923c; border-color:rgba(251,146,60,0.35); }
.badge-hallazgo-mitigado { background:rgba(20,184,166,0.1);   color:#2dd4bf; border-color:rgba(20,184,166,0.3); }
.badge-hallazgo-aceptado { background:rgba(167,139,250,0.1);  color:#a78bfa; border-color:rgba(167,139,250,0.3); }
.badge-hallazgo-cerrado  { background:rgba(52,211,153,0.1);   color:#34d399; border-color:rgba(52,211,153,0.3); }

/* ── Badges: tipo de control ── */
.badge-tipo { display:inline-block; padding:2px 8px; border-radius:4px; font-size:9px; font-weight:600; border:1px solid; white-space:nowrap; letter-spacing:0.05em; }
.badge-tipo-preventivo { background:rgba(61,126,255,0.08); color:#60a5fa; border-color:rgba(61,126,255,0.25); }
.badge-tipo-detectivo  { background:rgba(245,158,11,0.08); color:#fbbf24; border-color:rgba(245,158,11,0.25); }
.badge-tipo-correctivo { background:rgba(251,113,133,0.08); color:#fb7185; border-color:rgba(251,113,133,0.25); }

/* ── Badges: resultado de prueba ── */
.badge-resultado { display:inline-block; padding:2px 8px; border-radius:4px; font-size:9px; font-weight:600; border:1px solid; white-space:nowrap; }
.badge-resultado-ok        { background:rgba(52,211,153,0.1);  color:#34d399; border-color:rgba(52,211,153,0.3); }
.badge-resultado-parcial   { background:rgba(251,191,36,0.1);  color:#fbbf24; border-color:rgba(251,191,36,0.3); }
.badge-resultado-fail      { background:rgba(248,113,113,0.1); color:#f87171; border-color:rgba(248,113,113,0.3); }
.badge-resultado-noprobado { background:rgba(74,95,128,0.15);  color:#8a9dc0; border-color:rgba(74,95,128,0.3); }

/* ── Badges: nivel de confianza ── */
.badge-confianza { display:inline-block; padding:2px 8px; border-radius:4px; font-size:9px; font-weight:600; border:1px solid; white-space:nowrap; }
.badge-confianza-alto  { background:rgba(52,211,153,0.1);  color:#34d399; border-color:rgba(52,211,153,0.3); }
.badge-confianza-medio { background:rgba(251,191,36,0.1);  color:#fbbf24; border-color:rgba(251,191,36,0.3); }
.badge-confianza-bajo  { background:rgba(248,113,113,0.1); color:#f87171; border-color:rgba(248,113,113,0.3); }

/* ── Badge: naturaleza ── */
.badge-naturaleza { display:inline-block; padding:2px 8px; border-radius:4px; font-size:9px; font-weight:600; border:1px solid; white-space:nowrap; background:rgba(99,102,241,0.07); color:#a5b4fc; border-color:rgba(99,102,241,0.2); }

/* ── Badge: compliance ── */
.badge-compliance { font-size:10px; color:var(--text-muted); background:var(--bg-base); border:1px solid var(--border); padding:2px 8px; border-radius:4px; white-space:nowrap; }

/* ── Scoring de riesgo ── */
.td-riesgo-num { white-space:nowrap; }
.riesgo-num { font-weight:700; font-size:12px; padding:2px 6px; border-radius:3px; }
.riesgo-critico { color:#f87171; background:rgba(248,113,113,0.1); }
.riesgo-alto    { color:#fbbf24; background:rgba(251,191,36,0.08); }
.riesgo-medio   { color:#a78bfa; background:rgba(167,139,250,0.1); }
.riesgo-bajo    { color:#34d399; background:rgba(52,211,153,0.08); }
.riesgo-arrow   { color:var(--text-muted); font-size:10px; margin:0 3px; }

/* ── Efectividad D·O ── */
.efect-bars { display:flex; flex-direction:column; gap:3px; }
.efect-row { display:flex; align-items:center; gap:5px; }
.efect-label { font-size:9px; color:var(--text-muted); font-weight:600; width:10px; text-align:center; }
.madurez-dots { display:flex; gap:3px; align-items:center; }
.dot { width:7px; height:7px; border-radius:50%; background:var(--border); }
.dot.active { background:var(--accent); }

/* ── Cards mobile ── */
.audit-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px; margin-bottom:10px; cursor:pointer; transition:border-color 0.15s; }
.audit-card:hover { border-color:var(--border-light); }
.audit-card.selected { border-color:var(--accent); background:var(--bg-selected); }
.audit-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.audit-card-riesgo { font-size:13px; color:var(--text-primary); line-height:1.4; margin-bottom:6px; }
.audit-card-brecha { font-size:11px; color:var(--critico-color); line-height:1.4; margin-bottom:10px; opacity:0.85; font-style:italic; }
.audit-card-badges { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.audit-card-footer { display:flex; justify-content:space-between; align-items:center; }
.card-riesgo-label { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }
.btn-ver-detalle { background:var(--accent-dim); color:var(--accent); border:1px solid rgba(61,126,255,0.3); padding:6px 14px; border-radius:var(--radius-sm); font-family:var(--font-mono); font-size:11px; cursor:pointer; font-weight:600; }
.btn-ver-detalle:hover { background:rgba(61,126,255,0.2); }
.empty-state { padding:40px; text-align:center; color:var(--text-muted); font-size:12px; }

/* ── Panel de detalle ── */
.detail-panel { background:var(--bg-surface); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; }
.detail-panel.has-content { border-color:var(--border-light); }
.detail-header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; background:var(--bg-card); border-bottom:1px solid var(--border); }
.detail-tag { font-size:9px; letter-spacing:0.15em; color:var(--accent); font-weight:600; }
.detail-hint { font-size:11px; color:var(--text-muted); }
.detail-empty { padding:48px 20px; }
.detail-placeholder { display:flex; flex-direction:column; align-items:center; gap:8px; color:var(--text-muted); }
.detail-placeholder span { font-size:20px; opacity:0.4; animation:bounce 1.5s ease-in-out infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
.detail-placeholder p { font-size:12px; letter-spacing:0.08em; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:1px; background:var(--border); }
.detail-cell { background:var(--bg-surface); padding:18px 20px; }
.detail-cell:hover { background:var(--bg-card); }
.detail-cell.span-full { grid-column:1/-1; }
.detail-cell h4 { font-size:9px; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-muted); margin-bottom:8px; font-weight:600; }
.detail-cell p { font-size:12px; color:var(--text-secondary); line-height:1.55; }
.detail-cell p strong { color:var(--text-primary); font-weight:600; }

/* ── Encabezado de detalle ── */
.detail-riesgo-header { grid-column:1/-1; padding:20px; background:var(--bg-card); border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:12px; }
.detail-riesgo-title { font-family:var(--font-display); font-size:15px; font-weight:700; color:var(--text-primary); line-height:1.3; }
.detail-scoring-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px; color:var(--text-muted); }
.detail-badges { display:flex; gap:8px; flex-wrap:wrap; }

/* ── Bloque de brecha ── */
.detail-brecha-block { background:linear-gradient(135deg,rgba(248,113,113,0.07),rgba(248,113,113,0.02)); border-left:2px solid var(--critico-color) !important; }
.detail-brecha-block h4 { color:var(--critico-color) !important; }
.brecha-texto { font-size:13px !important; color:var(--text-primary) !important; font-weight:600; line-height:1.45; margin-bottom:10px; }
.brecha-meta { display:flex; gap:16px; flex-wrap:wrap; align-items:center; font-size:11px; color:var(--text-muted); }

/* ── Bloque legal ── */
.detail-legal-block { background:linear-gradient(135deg,rgba(61,126,255,0.06),rgba(61,126,255,0.02)); border-left:2px solid var(--accent) !important; }
.detail-legal-block h4 { color:var(--accent) !important; }

/* ── Evidencia requerida vs observada ── */
.evidencia-split { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.evidencia-block { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }
.ev-label { font-size:9px; letter-spacing:0.1em; color:var(--accent); text-transform:uppercase; margin-bottom:4px; display:block; }
.ev-observada { color:var(--alto-color) !important; }
.evidencia-block p { font-size:11px; color:var(--text-secondary); margin:0; }
.evidencia-observada-block { background:rgba(251,191,36,0.04); border:1px solid rgba(251,191,36,0.2); border-radius:var(--radius-sm); padding:10px 12px; }
.evidencia-observada-block p { font-size:11px; color:var(--text-secondary); }

/* ── Impacto triple ── */
.impacto-triple { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }
.impacto-block { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }
.impacto-block p { font-size:11px; color:var(--text-secondary); margin:0; }

/* ── Footer ── */
.footer { border-top:1px solid var(--border); padding:14px 32px; display:flex; justify-content:space-between; font-size:10px; color:var(--text-muted); letter-spacing:0.06em; }
.footer a { color:var(--accent); text-decoration:none; }

/* ── Responsive: 1100px ── */
@media(max-width:1100px){
  .ecosystem-strip { grid-template-columns:1fr; }
  .summary { grid-template-columns:repeat(3,1fr); }
  .detail-grid { grid-template-columns:1fr; }
  .evidencia-split { grid-template-columns:1fr; }
  .impacto-triple { grid-template-columns:1fr; }
}

/* ── Responsive: 768px (mobile) ── */
@media(max-width:768px){
  .topbar { padding:20px 16px 18px; }
  .topbar::after { display:none; }
  .topbar-inner { flex-direction:column; gap:16px; }
  .brand h1 { font-size:26px; }
  .header-meta { flex-direction:row; flex-wrap:wrap; gap:12px; align-items:flex-start; justify-content:flex-start; width:100%; }
  .meta-item { align-items:flex-start; }
  .summary { grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:16px; }
  .ecosystem-strip { padding:14px 14px; margin-bottom:16px; }
  .ecosystem-copy h2 { font-size:18px; }
  .stat-value { font-size:24px; }
  .stat-card { padding:12px 14px; min-width:0; overflow:hidden; }
  .stat-label { font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .container { padding:12px 12px; }
  .filters-bar { flex-direction:column; align-items:stretch; gap:6px; margin-bottom:12px; }
  .filters-label { margin-bottom:0; }
  .filters-group { display:flex; flex-direction:column; gap:6px; }
  .filters-actions { display:grid; grid-template-columns:1fr; gap:6px; }
  .btn-export, .btn-trail { width:100%; justify-content:center; text-align:center; }
  .filter-select { width:100%; box-sizing:border-box; }
  .btn-reset { width:100%; }
  .filter-count { text-align:right; font-size:10px; }
  .detail-grid { grid-template-columns:1fr; }
  .detail-riesgo-header { flex-direction:column; gap:12px; }
  .detail-badges { justify-content:flex-start; }
  .evidencia-split { grid-template-columns:1fr; }
  .impacto-triple { grid-template-columns:1fr; }
  .brecha-meta { flex-direction:column; align-items:flex-start; gap:8px; }
  .footer { flex-direction:column; gap:4px; padding:12px 16px; text-align:center; }
}

/* ── Responsive: 480px ── */
@media(max-width:480px){
  .brand h1 { font-size:20px; }
  .brand-desc { font-size:10px; }
  .summary { grid-template-columns:1fr 1fr; gap:6px; }
  .summary .stat-card:first-child { grid-column: 1 / -1; }
  .stat-value { font-size:28px; }
  .stat-card { padding:10px 12px; }
  .topbar { padding:14px 12px 12px; }
  .container { padding:8px 10px; }
  .detail-cell { padding:12px 12px; }
  .detail-cell h4 { font-size:8px; }
  .detail-cell p { font-size:11px; }
}

/* ═══════════════════════════════════════════════════════════
   v1.3 — Gestión de hallazgos: aging, ownership, decisión
   ═══════════════════════════════════════════════════════════ */

/* ── Badges de aging ── */
.badge-aging {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; border: 1px solid; white-space: nowrap;
  letter-spacing: 0.04em;
}
.badge-aging-vencido {
  background: rgba(239,68,68,0.15); color: #ef4444;
  border-color: rgba(239,68,68,0.45);
  animation: pulse-red 1.8s ease-in-out infinite;
}
@keyframes pulse-red {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%      { box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }
}
.badge-aging-proximo {
  background: rgba(251,146,60,0.12); color: #fb923c;
  border-color: rgba(251,146,60,0.4);
}
.badge-aging-termino {
  background: rgba(74,95,128,0.12); color: #8a9dc0;
  border-color: rgba(74,95,128,0.3);
}
.badge-aging-sinfecha {
  background: transparent; color: var(--text-muted);
  border-color: var(--border); font-size: 9px;
}

/* ── Tabla: fila vencida ── */
.audit-table tbody tr.row-vencido td { background: rgba(239,68,68,0.035); }
.audit-table tbody tr.row-vencido:hover td { background: rgba(239,68,68,0.06); }

/* ── Cards: vencido ── */
.audit-card.vencido {
  border-color: rgba(239,68,68,0.55) !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.15);
}

/* ── Stat card: vencido (variante roja pulsante) ── */
.stat-card.card-vencido {
  border-color: rgba(239,68,68,0.55);
  background: linear-gradient(135deg, var(--bg-card), rgba(239,68,68,0.06));
}
.stat-card.card-vencido .stat-value { color: #ef4444; }

/* ── Columnas de tabla v1.3 ── */
.td-estado-hallazgo { white-space: nowrap; display: flex; flex-direction: column; gap: 4px; }
.td-riesgo-r  { text-align: center; }
.td-owner     { font-size: 11px; color: var(--text-secondary); max-width: 140px; }
.td-deadline  { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.td-aging     { white-space: nowrap; }

/* ── Owner sin asignar ── */
.badge-owner-unset {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600; border: 1px solid;
  background: rgba(251,146,60,0.1); color: #fb923c;
  border-color: rgba(251,146,60,0.4); white-space: nowrap;
}
.owner-text { font-size: 11px; color: var(--text-secondary); }

/* ── Badges: decisión de riesgo ── */
.badge-decision {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 10px; font-weight: 700; border: 1px solid; white-space: nowrap;
  letter-spacing: 0.05em;
}
.badge-decision-remediar  {
  background: rgba(61,126,255,0.1); color: #60a5fa;
  border-color: rgba(61,126,255,0.3);
}
.badge-decision-aceptado  {
  background: rgba(167,139,250,0.12); color: #c084fc;
  border-color: rgba(167,139,250,0.4);
}
.badge-decision-transferir {
  background: rgba(20,184,166,0.1); color: #2dd4bf;
  border-color: rgba(20,184,166,0.3);
}

/* ── Justificación de aceptación ── */
.justificacion-aceptacion {
  margin-top: 10px;
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.25);
  border-left: 3px solid #a78bfa;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.justificacion-aceptacion p {
  font-size: 11px !important;
  color: var(--text-secondary) !important;
  margin: 0;
  line-height: 1.55;
}
.ev-alerta { color: #fb923c !important; }

/* ── Bloque de gestión del hallazgo (sección 9 del detalle) ── */
.detail-gestion-block {
  background: linear-gradient(135deg, rgba(61,126,255,0.05), rgba(61,126,255,0.01));
  border-left: 2px solid rgba(61,126,255,0.5) !important;
}
.detail-gestion-block h4 { color: #60a5fa !important; }
.gestion-row {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 8px; font-size: 12px;
}
.gestion-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted); white-space: nowrap; min-width: 110px;
  padding-top: 1px;
}

/* ── Label de pesos de scoring ── */
.pesos-label {
  font-size: 10px; color: var(--text-muted);
  background: var(--bg-base); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}

/* ── Cards mobile: info gestión ── */
.card-meta {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; color: var(--text-muted);
}
.card-owner-label   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.card-deadline-label { white-space: nowrap; }

/* ── Criterio de evaluación ── */
.criterio-evaluacion-block {
  margin-top: 10px;
  background: rgba(61,126,255,0.04);
  border: 1px solid rgba(61,126,255,0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.criterio-evaluacion-block p { font-size: 11px; color: var(--text-secondary); margin: 0; }
.ev-criterio { color: var(--accent) !important; }

/* ── Observación del auditor ── */
.detail-observacion-block {
  background: linear-gradient(135deg, rgba(167,139,250,0.06), rgba(167,139,250,0.02));
  border-left: 2px solid rgba(167,139,250,0.6) !important;
}
.detail-observacion-block h4 { color: #a78bfa !important; }
.observacion-texto {
  font-size: 12px !important;
  color: var(--text-primary) !important;
  line-height: 1.55;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   v1.4 — Triage Bar · Delta Residual · Lifecycle Timeline
   ═══════════════════════════════════════════════════════════ */

/* ── Triage bar: situación hoy ── */
.triage-bar {
  display: none; /* visible via JS cuando hay flags */
  align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(239,68,68,0.06), rgba(251,146,60,0.04));
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 11px;
}
.triage-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.15em;
  color: #f87171; text-transform: uppercase;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
}
.triage-item {
  background: transparent; border: 1px solid; padding: 3px 10px;
  border-radius: 4px; font-family: var(--font-mono); font-size: 10px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.triage-critico-vencido {
  color: #ef4444; border-color: rgba(239,68,68,0.45);
  animation: pulse-red 1.8s ease-in-out infinite;
}
.triage-critico-vencido:hover { background: rgba(239,68,68,0.12); }
.triage-sin-owner {
  color: #fb923c; border-color: rgba(251,146,60,0.45);
}
.triage-sin-owner:hover { background: rgba(251,146,60,0.1); }
.triage-hallazgo-critico {
  color: #f87171; border-color: rgba(248,113,113,0.4);
}
.triage-hallazgo-critico:hover { background: rgba(248,113,113,0.08); }
.triage-aceptado-sin-aprobador {
  color: #c084fc; border-color: rgba(167,139,250,0.45);
}
.triage-aceptado-sin-aprobador:hover { background: rgba(167,139,250,0.08); }
.triage-hint {
  margin-left: auto; font-size: 10px; color: var(--text-muted); font-style: italic;
}
@media(max-width:768px){
  .triage-bar { padding: 10px 12px; gap: 6px; }
  .triage-hint { display: none; }
}

/* ── Riesgo residual: delta base → ajustado ── */
.riesgo-delta-cell {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.riesgo-base-val {
  font-size: 11px; color: var(--text-muted);
  text-decoration: line-through; opacity: 0.7;
}
.riesgo-delta-arrow {
  font-size: 10px; color: var(--text-muted);
}

/* ── Penalización: variante compacta en tabla ── */
.td-riesgo-r .badge-penalizacion {
  display: block; font-size: 8px; margin-top: 2px;
  padding: 1px 5px; text-align: center;
}

/* ── Penalización: variante detalle ── */
.penal-delta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ── Explicación residual inline (en el header del detalle) ── */
.explicacion-residual-inline {
  margin-top: 8px;
  background: rgba(52,211,153,0.04);
  border: 1px solid rgba(52,211,153,0.15);
  border-left: 2px solid rgba(52,211,153,0.4);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

/* ── Lifecycle timeline ── */
.lifecycle-timeline {
  display: flex; align-items: flex-start; gap: 0;
  margin-bottom: 10px;
}
.lt-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 90px;
}
.lt-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid;
  flex-shrink: 0;
}
.lt-dot-done    { background: var(--accent); border-color: var(--accent); }
.lt-dot-pending { background: transparent; border-color: var(--border-light); }
.lt-info {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center;
}
.lt-label {
  font-size: 8px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-muted); text-transform: uppercase;
}
.lt-date {
  font-size: 10px; color: var(--text-secondary);
}
.lt-motivo {
  font-size: 9px; color: var(--text-muted); font-style: italic;
  max-width: 90px; text-align: center;
}
.lt-connector {
  flex: 1; height: 2px; margin-top: 4px; /* center with dot */
  min-width: 20px;
}
.lt-connector-done   { background: var(--accent); opacity: 0.6; }
.lt-connector-active { background: linear-gradient(90deg, var(--accent), var(--border-light)); }
.lt-connector-pending{ background: var(--border); }

.lt-step-done    .lt-label { color: var(--accent); }
.lt-step-pending .lt-label { color: var(--text-muted); }
.lt-step-pending .lt-date  { color: var(--text-muted); font-style: italic; }

/* ── Antigüedad del hallazgo ── */
.lifecycle-antiguedad {
  font-size: 11px; color: var(--text-muted);
  padding: 4px 0 0 0;
}
.ant-normal strong { color: var(--text-secondary); }
.ant-medio  strong { color: var(--alto-color); }
.ant-alto   strong { color: var(--critico-color); }
.ant-alto   { color: var(--critico-color); }

@media(max-width:768px){
  .lifecycle-timeline { flex-direction: column; gap: 8px; }
  .lt-connector { width: 2px; height: 16px; margin: 0; min-width: 0; }
  .lt-step { flex-direction: row; min-width: 0; }
  .lt-info { align-items: flex-start; text-align: left; }
}

/* ── Risk flags: señales de alerta compuestas ── */
.td-flags {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px;
}
.risk-flag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 9px; font-weight: 700; border: 1px solid; white-space: nowrap;
  letter-spacing: 0.04em;
}
.risk-flag-critico-vencido {
  background: rgba(239,68,68,0.15); color: #ef4444;
  border-color: rgba(239,68,68,0.5);
  animation: pulse-red 1.8s ease-in-out infinite;
}
.risk-flag-sin-owner {
  background: rgba(251,146,60,0.12); color: #fb923c;
  border-color: rgba(251,146,60,0.45);
}
.risk-flag-hallazgo-critico {
  background: rgba(248,113,113,0.1); color: #f87171;
  border-color: rgba(248,113,113,0.4);
}
.risk-flag-aceptado-sin-aprobador {
  background: rgba(167,139,250,0.12); color: #c084fc;
  border-color: rgba(167,139,250,0.45);
}

/* ── Cards mobile: flags ── */
.audit-card-flags {
  display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px;
}
.audit-card.critico-vencido {
  border-color: rgba(239,68,68,0.7) !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.2), 0 0 8px rgba(239,68,68,0.08);
}

/* ── Fila tabla: crítico + vencido ── */
.audit-table tbody tr.row-critico-vencido td {
  background: rgba(239,68,68,0.06);
}
.audit-table tbody tr.row-critico-vencido:hover td {
  background: rgba(239,68,68,0.1);
}

/* ── Penalización de gestión ── */
.badge-penalizacion {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 9px; font-weight: 700; white-space: nowrap;
  background: rgba(251,146,60,0.1); color: #fb923c;
  border: 1px solid rgba(251,146,60,0.35);
  margin-top: 3px;
}
.penalizacion-explicacion {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 6px;
}
.penalizacion-motivos {
  font-size: 10px; color: var(--text-muted); font-style: italic;
}

/* ── Detail flags row (encabezado del detalle) ── */
.detail-flags-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px;
}
.detail-flags-row .risk-flag { font-size: 10px; padding: 2px 8px; }

/* ── Bloque de seguimiento del hallazgo (nueva sección 3) ── */
.detail-seguimiento-block {
  background: linear-gradient(135deg, rgba(61,126,255,0.05), rgba(61,126,255,0.01));
  border-left: 2px solid rgba(61,126,255,0.5) !important;
}
.detail-seguimiento-block h4 { color: #60a5fa !important; }
.seguimiento-grid {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}

/* ── Aging notes inline ── */
.aging-note {
  display: inline-block; font-size: 11px; margin-left: 6px;
}
.aging-note-vencido { color: #f87171; }
.aging-note-proximo { color: #fb923c; }

/* ── Lifecycle del hallazgo ── */
.lifecycle-row {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px;
  color: var(--text-secondary);
}
.lifecycle-item { display: flex; gap: 4px; align-items: center; }
.lifecycle-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
}

/* ── Aprobador de riesgo ── */
.aprobador-tag {
  display: inline-block; margin-left: 8px;
  font-size: 10px; color: var(--text-muted);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 3px;
}

/* ── Explicación del riesgo residual ── */
.explicacion-residual-block {
  margin-top: 12px;
  background: rgba(52,211,153,0.04);
  border: 1px solid rgba(52,211,153,0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.explicacion-residual-block p {
  font-size: 11px; color: var(--text-secondary); margin: 0; line-height: 1.55;
}

/* ── Responsive v1.3/1.4 ── */
@media(max-width:768px){
  .td-estado-hallazgo { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .gestion-label { min-width: 90px; }
  .justificacion-aceptacion p { font-size: 10px !important; }
  .lifecycle-row { flex-direction: column; gap: 6px; }
  .penalizacion-explicacion { flex-direction: column; gap: 4px; }
  .detail-flags-row .risk-flag { font-size: 9px; }
}

/* ══════════════════════════════════════════════════════════════════
   v1.5: EDICIÓN INLINE · TRAIL · EXPORT · TOAST
   ══════════════════════════════════════════════════════════════════ */

/* ── Columna edit en tabla ── */
.th-edit { width: 34px; padding: 0 !important; }
.td-edit { padding: 0 6px !important; text-align: center; }
.btn-edit-row {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  transition: all 0.15s;
}
.btn-edit-row:hover { color: var(--accent); border-color: var(--accent); }

/* Fila modificada — highlight sutil */
.row-editado { border-left: 2px solid var(--accent) !important; }

/* ── Panel de edición inline ── */
.edit-inline-row td {
  background: rgba(61,126,255,0.05);
  border-top: 1px solid rgba(61,126,255,0.25);
  border-bottom: 1px solid rgba(61,126,255,0.25);
}
.edit-inline-cell { padding: 12px 16px !important; }
.edit-inline-form { display: flex; flex-direction: column; gap: 10px; }
.edit-inline-fields { display: flex; flex-wrap: wrap; gap: 14px; }
.edit-field-group { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.edit-field-group > span {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.edit-select, .edit-input {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 8px;
}
.edit-select:focus, .edit-input:focus {
  border-color: var(--accent);
  outline: none;
}
.edit-inline-actions { align-items: center; display: flex; gap: 8px; }
.btn-edit-save {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  transition: opacity 0.15s;
}
.btn-edit-save:hover { opacity: 0.85; }
.btn-edit-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
}
.btn-edit-cancel:hover { color: var(--text-primary); }
.edit-modified-note { color: var(--verde-color); font-size: 10px; margin-left: 4px; }

/* ── Botones Export / Trail ── */
.filters-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.btn-export, .btn-trail {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-export:hover { border-color: var(--verde-color); color: var(--verde-color); }
.btn-trail:hover  { border-color: var(--accent);      color: var(--accent); }
.trail-badge {
  align-items: center;
  background: var(--accent);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
  justify-content: center;
  margin-left: 4px;
  min-width: 16px;
  padding: 1px 5px;
}

/* ── Trail panel ── */
#trailPanel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
}
.trail-header {
  align-items: center;
  background: rgba(61,126,255,0.07);
  border-bottom: 1px solid var(--border);
  display: flex;
  font-size: 11px;
  font-weight: 600;
  justify-content: space-between;
  padding: 8px 14px;
}
.btn-reset-changes {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  transition: all 0.15s;
}
.btn-reset-changes:hover { border-color: var(--critico-color); color: var(--critico-color); }
.trail-list { max-height: 220px; overflow-y: auto; }
.trail-entry {
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 8px;
  padding: 6px 14px;
}
.trail-ts     { color: var(--text-muted); min-width: 100px; }
.trail-ctrl   { color: var(--accent); font-weight: 700; min-width: 32px; }
.trail-field  { color: var(--text-secondary); min-width: 120px; }
.trail-before { color: var(--critico-color); }
.trail-arrow  { color: var(--text-muted); }
.trail-after  { color: var(--verde-color); }
.trail-empty  { color: var(--text-muted); font-size: 12px; padding: 16px; text-align: center; }

/* ── Toast ── */
.toast {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 6px;
  bottom: 24px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0;
  padding: 10px 18px;
  pointer-events: none;
  position: fixed;
  right: 24px;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }

/* ── filters-bar: asegurar que actions no rompa el layout ── */
.filters-bar { flex-wrap: wrap; }
@media(max-width:768px){
  .filters-actions { margin-left: 0; margin-top: 8px; width: 100%; }
  .th-edit, .td-edit { display: none; }
}
