/* v180.6.24.3 — Deep enterprise dark audit layer
   Objetivo: capa final de contraste para admin/secretaría/directivo/superadmin,
   cargada DESPUÉS de vistas legacy con estilos inline/embebidos. */
:root{
  --ed-bg:#050b16;
  --ed-surface:#0b1628;
  --ed-surface-2:#0f213a;
  --ed-surface-3:#132a49;
  --ed-border:rgba(147,197,253,.28);
  --ed-border-strong:rgba(147,197,253,.42);
  --ed-text:#f8fbff;
  --ed-muted:#c8d7ee;
  --ed-soft:#96acd1;
  --ed-blue:#3b82f6;
  --ed-blue-2:#2563eb;
  --ed-violet:#7c3aed;
  --ed-danger:#ef4444;
  --ed-ok:#22c55e;
  color-scheme:dark;
}
html,body{background:radial-gradient(circle at 20% 0%,rgba(37,99,235,.13),transparent 32%),linear-gradient(180deg,#060d1a,#050b16 50%,#020617)!important;color:var(--ed-text)!important;}
body *{scrollbar-color:rgba(148,163,184,.6) rgba(2,6,23,.75);}
body ::selection{background:rgba(59,130,246,.55)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;}

/* Contenedores: normaliza pantallas que salían a ancho completo. */
body .container,body main.container,body .page,body .admin-panel,body .admin-view,body .sec-shell,body .cur-shell,body .ae-shell,body .content,body .wrap{
  max-width:1280px!important;width:min(1280px,calc(100vw - 24px))!important;margin-left:auto!important;margin-right:auto!important;box-sizing:border-box!important;
}
body .page{padding-left:0!important;padding-right:0!important;}
body .card,body .panel-card,body .kpi-box,body .kpi,body .hero-side,body .box,body .section,body .notice,body .alert,body aside.panel-card,
body .table-wrap,body .table-responsive,body .mobile-table-scroll,body .grid > .card,body .admin-card,body .report-card{
  background:linear-gradient(180deg,rgba(15,30,52,.96),rgba(8,18,34,.98))!important;
  color:var(--ed-text)!important;-webkit-text-fill-color:initial!important;
  border-color:var(--ed-border)!important;box-shadow:0 18px 48px rgba(0,0,0,.25)!important;
}
body .hero-main,body .audit-hero,body .dh-hero,body .brand-hero{border:1px solid rgba(96,165,250,.38)!important;box-shadow:0 18px 44px rgba(37,99,235,.20)!important;}
body h1,body h2,body h3,body h4,body h5,body h6,body strong,body b,body label,body th{color:#fff!important;-webkit-text-fill-color:#fff!important;text-shadow:none!important;}
body p,body span,body div,body small,body td,body li,body .muted,body .small,body .desc,body .label{color:var(--ed-muted)!important;}
body td strong,body td b,body .value,body .kpi b,body .kpi .value{color:#fff!important;-webkit-text-fill-color:#fff!important;}
body a:not(.btn):not(.btn-secondary):not(.btn-danger):not(.mode-btn){color:#93c5fd!important;-webkit-text-fill-color:#93c5fd!important;}

/* Tablas legacy: elimina filas blancas y texto invisible. */
html body table,html body .table,html body .table.table,html body .table-responsive table,html body .mobile-table-scroll table,
html body .panel-card table,html body .card table,html body .admin-view table{
  width:100%;border-collapse:separate!important;border-spacing:0!important;background:#071225!important;color:var(--ed-text)!important;
  border:1px solid var(--ed-border)!important;border-radius:18px!important;overflow:hidden!important;
}
html body thead,html body table thead,html body .table thead{background:#071225!important;color:#fff!important;}
html body thead tr,html body .table thead tr,html body tr:first-child{background:#071225!important;}
html body th,html body table th,html body .table th{
  background:#071225!important;color:#f8fbff!important;-webkit-text-fill-color:#f8fbff!important;border-bottom:1px solid rgba(147,197,253,.34)!important;
  font-weight:950!important;text-transform:uppercase!important;letter-spacing:.035em!important;font-size:12px!important;padding:13px 14px!important;white-space:nowrap!important;
}
html body tbody,html body table tbody,html body .table tbody{background:#081426!important;}
html body tr,html body table tr,html body .table tr{background:#081426!important;color:var(--ed-text)!important;}
html body tbody tr:nth-child(odd),html body table tbody tr:nth-child(odd),html body .table tbody tr:nth-child(odd){background:#0a172a!important;}
html body tbody tr:nth-child(even),html body table tbody tr:nth-child(even),html body .table tbody tr:nth-child(even){background:#10213a!important;}
html body tbody tr:hover,html body table tbody tr:hover,html body .table tbody tr:hover{background:#17335a!important;}
html body td,html body table td,html body .table td{
  background:transparent!important;color:#eaf2ff!important;-webkit-text-fill-color:#eaf2ff!important;border-color:rgba(147,197,253,.18)!important;
  border-bottom:1px solid rgba(147,197,253,.16)!important;padding:13px 14px!important;vertical-align:middle!important;text-shadow:none!important;
}
html body td *,html body table td *,html body .table td *{color:inherit!important;-webkit-text-fill-color:inherit!important;text-shadow:none!important;}
html body td .muted,html body .table td .muted,html body td small{color:#b8c9e6!important;-webkit-text-fill-color:#b8c9e6!important;}
html body [style*="background:#fff"],html body [style*="background: #fff"],html body [style*="background:white"],html body [style*="background: white"],
html body [style*="background-color:#fff"],html body [style*="background-color: #fff"],html body [style*="background-color:white"],html body [style*="background-color: white"]{
  background:#0d1d33!important;color:#eaf2ff!important;-webkit-text-fill-color:#eaf2ff!important;
}

/* Formularios: no más campos blancos ni placeholders invisibles. */
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html body select,html body textarea,html body .input,html body .inputx,html body .selectx,html body .form-control,html body .form-select,
html body .ae-input,html body .ae-select,html body .brand-input{
  background:#0b172a!important;color:#f8fbff!important;-webkit-text-fill-color:#f8fbff!important;border:1px solid rgba(147,197,253,.52)!important;
  border-radius:12px!important;box-shadow:inset 0 0 0 1px rgba(15,23,42,.35),0 8px 20px rgba(0,0,0,.14)!important;outline:none!important;
  caret-color:#93c5fd!important;color-scheme:dark!important;
}
html body input:not([type="checkbox"]):not([type="radio"]):focus,html body select:focus,html body textarea:focus,html body .input:focus,html body .inputx:focus,html body .selectx:focus{
  border-color:#60a5fa!important;box-shadow:0 0 0 3px rgba(59,130,246,.22),0 10px 22px rgba(0,0,0,.22)!important;
}
html body input::placeholder,html body textarea::placeholder{color:#93a9ca!important;-webkit-text-fill-color:#93a9ca!important;opacity:1!important;}
html body input[disabled],html body input[readonly],html body select[disabled],html body textarea[readonly]{background:#111c30!important;color:#aebfda!important;-webkit-text-fill-color:#aebfda!important;opacity:1!important;}
html body option{background:#0b172a!important;color:#f8fbff!important;}
html body input[type="checkbox"],html body input[type="radio"]{accent-color:#3b82f6!important;background:#0b172a!important;border-color:#60a5fa!important;}

/* Botones/acciones. */
html body .btn,html body button.btn,html body a.btn,html body .btn.primary,html body button[type="submit"].btn{
  background:linear-gradient(135deg,#3b82f6,#2563eb)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border:1px solid rgba(147,197,253,.35)!important;
  border-radius:12px!important;font-weight:900!important;box-shadow:0 10px 24px rgba(37,99,235,.24)!important;text-decoration:none!important;
}
html body .btn-secondary,html body a.btn-secondary,html body button.btn-secondary{
  background:#111c30!important;color:#f8fbff!important;-webkit-text-fill-color:#f8fbff!important;border:1px solid rgba(147,197,253,.35)!important;border-radius:12px!important;font-weight:900!important;text-decoration:none!important;
}
html body .btn-danger,html body button.btn-danger{background:#7f1d1d!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border:1px solid rgba(248,113,113,.45)!important;border-radius:12px!important;font-weight:900!important;}
html body .badge,html body .pill,html body .badge-soft,html body .status,html body .chip{
  background:rgba(59,130,246,.16)!important;color:#dbeafe!important;-webkit-text-fill-color:#dbeafe!important;border:1px solid rgba(147,197,253,.35)!important;border-radius:999px!important;
}
html body .badge-ok,html body .ok{color:#bbf7d0!important;-webkit-text-fill-color:#bbf7d0!important;border-color:rgba(34,197,94,.35)!important;}
html body .badge-warn,html body .warn{color:#fde68a!important;-webkit-text-fill-color:#fde68a!important;border-color:rgba(245,158,11,.35)!important;}

/* Admin/secretaría: grids consistentes y responsive. */
body .grid.cols-2,body .grid[style*="grid-template-columns:1fr 1fr"],body .grid[style*="grid-template-columns: 1fr 1fr"]{gap:14px!important;}
body .actions-stack{gap:10px!important;}
body details{background:#0b172a!important;border:1px solid rgba(147,197,253,.25)!important;border-radius:14px!important;padding:8px!important;}
body summary{color:#fff!important;-webkit-text-fill-color:#fff!important;cursor:pointer!important;}
body .topbar,body nav,body .nav,body .mode-switch{background:rgba(10,22,40,.88)!important;border-color:rgba(147,197,253,.20)!important;}

/* Scroll horizontal explícito para tablas anchas sin romper mobile. */
body .table-responsive,body .mobile-table-scroll,body .table-wrap,body [style*="overflow:auto"]{overflow:auto!important;-webkit-overflow-scrolling:touch!important;}
body .table-responsive::after,body .mobile-table-scroll::after,body .table-wrap::after{content:"";display:block;height:0;}

@media (max-width:900px){
  body .container,body main.container,body .page,body .admin-panel,body .admin-view,body .sec-shell,body .cur-shell{width:calc(100vw - 16px)!important;max-width:calc(100vw - 16px)!important;}
  body .grid,body .grid.cols-2,body .hero,body .kpis,body .kpi-row,body .create-grid,body .rowx{grid-template-columns:1fr!important;}
  body .card,body .panel-card{padding:14px!important;border-radius:18px!important;}
  html body table,html body .table{min-width:760px!important;}
  html body th,html body td{padding:11px 12px!important;font-size:12px!important;}
  html body input:not([type="checkbox"]):not([type="radio"]),html body select,html body textarea,html body button,html body .btn,html body .btn-secondary{min-height:42px!important;}
}

@media (max-width:560px){
  body .hero-main h1,body h1{font-size:24px!important;}
  body .hero-main,body .hero-side{padding:16px!important;border-radius:18px!important;}
  body [style*="display:flex"]{max-width:100%;}
  body .btn,body .btn-secondary,body .btn-danger{white-space:normal!important;}
}
