/* ============================================================
   UI KIT TUTRONIC — Hoja de estilos de componentes
   ------------------------------------------------------------
   Complementa Tailwind CDN. Se importa con:
     <link rel="stylesheet" href="css/ui.css" />
   Cualquier módulo nuevo la reutiliza para mantener el mismo
   look en toda la suite.
   ============================================================ */

/* ---- Escala de visualización ----
   En pantallas de escritorio la interfaz se muestra al 90%
   (equivalente al zoom del navegador al 90%) para un uso más
   compacto y equilibrado. En móvil se mantiene al 100%. */
@media (min-width: 1024px) {
  html { zoom: 0.9; }
}

/* ---- Reserva de layout del shell ----
   El sidebar es fijo y el contenido lleva margen/padding. Estas reglas
   reservan el espacio desde el PRIMER FRAME (ui.css va en <head>), de modo
   que al navegar entre páginas el contenido NO se desplaza ni el sidebar
   "aparece" deformando la página mientras se carga shell.js. */
main.suite-main {
  padding: 6rem 0.75rem 2.5rem; /* pt-24 px-3 pb-10 */
}
@media (min-width: 768px) {
  /* El margen izquierdo lo controla shell.js: si la página tiene sidebar
     (#suiteSidebar), agrega la clase md:ml-64; si no (launcher de la suite),
     el contenido queda a ancho completo. */
  main.suite-main.md\:ml-64 {
    margin-left: 16rem;
  }
  main.suite-main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  body.suite-collapsed main.suite-main { margin-left: 4rem; }
  /* Columna del sidebar oscura desde el primer frame (evita destello claro) */
  #suiteSidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 16rem;
    background: #0f172a;
    z-index: 40;
  }
  body.suite-collapsed #suiteSidebar { width: 4rem; }
}
/* Durante la carga inicial ("boot") el shell se monta SIN animar:
   el acordeón no se expande ni el contenido se desliza. shell.js añade la
   clase body.suite-boot y la quita tras el primer paint. */
body.suite-boot .suite-group-body,
body.suite-boot main.suite-main,
body.suite-boot #suiteHeader header {
  transition: none !important;
}

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 500;
  border-radius: .75rem;
  line-height: 1.25rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all .18s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.35); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: .4rem .8rem; font-size: .75rem; border-radius: .625rem; gap: .375rem; min-height: 2rem; }
.btn-md { padding: .5rem 1rem;  font-size: .875rem; min-height: 2.5rem; }
.btn-lg { padding: .65rem 1.3rem; font-size: .9375rem; min-height: 3rem; }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; }
.btn-icon-sm { width: 2.25rem; height: 2.25rem; padding: 0; }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.45), 0 4px 12px -4px rgba(79,70,229,.35);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 2px 4px rgba(79,70,229,.45), 0 10px 24px -8px rgba(79,70,229,.5); }

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  box-shadow: 0 1px 2px rgba(225,29,72,.4);
}
.btn-danger:hover { filter: brightness(1.06); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 1px 2px rgba(5,150,105,.4);
}
.btn-success:hover { filter: brightness(1.06); }

.btn-outline { border: 1px solid #e2e8f0; background: #fff; color: #475569; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }

.btn-ghost { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #1e293b; }

.btn-soft { background: #eef2ff; color: #4f46e5; }
.btn-soft:hover { background: #e0e7ff; }

.btn-block { width: 100%; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .6875rem;
  font-weight: 600;
  padding: .25rem .625rem;
  border-radius: 9999px;
}
.badge-indigo   { background: #eef2ff; color: #4f46e5; }
.badge-emerald  { background: #ecfdf5; color: #059669; }
.badge-amber    { background: #fffbeb; color: #d97706; }
.badge-rose     { background: #fff1f2; color: #e11d48; }
.badge-slate    { background: #f1f5f9; color: #64748b; }
.badge-sky      { background: #f0f9ff; color: #0284c7; }

/* ---- Alertas ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border-radius: .875rem;
  padding: .75rem 1rem;
  border: 1px solid transparent;
}
.alert .a-ico { flex-shrink: 0; margin-top: .1rem; }
.alert .a-close { margin-left: auto; opacity: .55; transition: opacity .15s, transform .15s; flex-shrink: 0; }
.alert .a-close:hover { opacity: 1; transform: scale(1.1); }
.alert-info    { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-danger  { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }

/* ---- Tarjetas ---- */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.card-pad { padding: 1.25rem; }

/* ---- Tablas ---- */
.ui-table { width: 100%; font-size: .875rem; }
.ui-table thead th {
  background: linear-gradient(180deg, #f1f5f9, #e9eef4);
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #334155;
  font-weight: 700;
  padding: .8rem 1rem;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}
.ui-table thead th:last-child { text-align: right; }
.ui-table tbody td { padding: .75rem 1rem; }
.ui-table tbody tr { transition: background .15s; }
.ui-table tbody tr:hover { background: #f8fafc; }

/* ---- Modales (<dialog>) ---- */
dialog { border: none; padding: 0; background: transparent; margin: auto; }
dialog::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(3px); }
dialog[open] { animation: uiPop .22s cubic-bezier(.16,1,.3,1); }
@keyframes uiPop {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 24px 60px -12px rgba(15,23,42,.35);
  width: calc(100vw - 2rem);
  max-height: 90dvh;
  overflow: auto;
}
.modal-sm { max-width: 24rem; }
.modal-md { max-width: 28rem; }
.modal-lg { max-width: 42rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .75rem; padding: 1rem 1.25rem; border-top: 1px solid #f1f5f9; }

/* ---- Toasts ---- */
#toastCont {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: 22rem;
  max-width: calc(100vw - 2rem);
}
.ui-toast {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: #fff;
  border-radius: .875rem;
  padding: .75rem 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 30px -6px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.06);
  animation: toastIn .28s cubic-bezier(.16,1,.3,1);
}
.ui-toast .t-ico { flex-shrink: 0; margin-top: .1rem; }
.ui-toast .t-text { flex: 1; font-size: .8125rem; color: #334155; line-height: 1.45; }
.ui-toast .t-close { color: #94a3b8; transition: color .15s; }
.ui-toast .t-close:hover { color: #475569; }
.ui-toast-info    { border-color: #bae6fd; } .ui-toast-info    .t-ico { color: #0284c7; }
.ui-toast-success { border-color: #a7f3d0; } .ui-toast-success .t-ico { color: #059669; }
.ui-toast-warning { border-color: #fde68a; } .ui-toast-warning .t-ico { color: #d97706; }
.ui-toast-danger  { border-color: #fecdd3; } .ui-toast-danger  .t-ico { color: #e11d48; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Entradas / formularios ---- */
.input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: .625rem;
  padding: .5rem .75rem;
  font-size: .875rem;
  background: #fff;
  color: #1e293b;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #94a3b8; }
.input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .prefix,
.input-group .suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  font-weight: 600;
  color: #64748b;
  pointer-events: none;
}
.input-group .prefix { left: .75rem; }
.input-group .suffix { right: .75rem; }
.input-group .prefix ~ .input { padding-left: 2.9rem; }
.input-group:has(.suffix) .input { padding-right: 2.9rem; }

/* ---- Select nativo moderno ---- */
.select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #cbd5e1;
  border-radius: .625rem;
  padding: .5rem 2.4rem .5rem .75rem;
  font-size: .875rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .75rem center / 1rem;
  color: #1e293b;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* ---- Combobox / Multiselect (dropdowns modernos) ---- */
.combobox, .multiselect { position: relative; }
.combobox-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  cursor: pointer;
  text-align: left;
}
.combobox-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobox-chevron, .multiselect-chevron { color: #94a3b8; transition: transform .18s ease; flex-shrink: 0; }
.combobox.open .combobox-chevron, .multiselect.open .multiselect-chevron { transform: rotate(180deg); }

.combobox-menu, .multiselect-menu {
  display: none;
  position: absolute;
  top: calc(100% + .375rem);
  left: 0; right: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,.18);
  overflow: hidden;
  animation: uiPop .18s cubic-bezier(.16,1,.3,1);
}
.combobox.open .combobox-menu, .multiselect.open .multiselect-menu { display: block; }
.combobox-search {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #94a3b8;
}
.combobox-search input { flex: 1; border: none; outline: none; font-size: .875rem; background: transparent; }
.combobox-opts { max-height: 14rem; overflow-y: auto; padding: .25rem; }
.combobox-opt, .multiselect-opt {
  display: flex; align-items: center; gap: .5rem;
  width: 100%;
  padding: .5rem .75rem;
  border-radius: .5rem;
  font-size: .875rem;
  color: #334155;
  cursor: pointer;
  text-align: left;
}
.combobox-opt > span:first-child, .multiselect-opt > span:first-child { flex: 1; }
.combobox-opt:hover, .combobox-opt.hover, .multiselect-opt:hover, .multiselect-opt.hover { background: #f1f5f9; }
.combobox-opt.selected, .multiselect-opt.selected { color: #4f46e5; font-weight: 500; }
.combobox-opt .material-symbols-outlined, .multiselect-opt .material-symbols-outlined { opacity: 0; font-size: 18px; }
.combobox-opt.selected .material-symbols-outlined, .multiselect-opt.selected .material-symbols-outlined { opacity: 1; }
.combobox-empty { padding: .625rem .75rem; font-size: .8125rem; color: #94a3b8; }

/* Multiselect con chips */
.multiselect-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.5rem;
  cursor: pointer;
  flex-wrap: wrap;
}
.multiselect-chips { display: flex; flex-wrap: wrap; gap: .375rem; flex: 1; }
.multiselect-search { flex: 1; min-width: 5rem; border: none; outline: none; font-size: .875rem; background: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #eef2ff; color: #4f46e5;
  font-size: .75rem; font-weight: 500;
  padding: .25rem .375rem .25rem .625rem;
  border-radius: 9999px;
}
.chip .material-symbols-outlined { font-size: 14px; cursor: pointer; }
.chip .material-symbols-outlined:hover { color: #e11d48; }

/* ---- Tablas: ordenar y columnas ---- */
.ui-table th.sortable { cursor: pointer; user-select: none; }
.ui-table th .sort-ico { opacity: .35; font-size: 15px; vertical-align: -3px; margin-left: 2px; transition: opacity .15s; }
.ui-table th.sortable:hover .sort-ico { opacity: .8; }
.ui-table th.sorted .sort-ico { opacity: 1; color: #4f46e5; }
.ui-table th .sort-ico.desc { display: inline-block; transform: rotate(180deg); }

.tabla-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  position: relative;
}
.tabla-toolbar .cols-menu {
  display: none;
  position: absolute;
  right: .5rem;
  top: calc(100% - .25rem);
  z-index: 45;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,.18);
  min-width: 13rem;
  padding: .4rem;
}
.tabla-toolbar .cols-menu.open { display: block; }
.cols-opt {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .45rem .6rem;
  border-radius: .5rem;
  font-size: .8125rem;
  color: #334155;
  cursor: pointer;
}
.cols-opt:hover { background: #f1f5f9; }
.cols-opt input { accent-color: #6366f1; width: .95rem; height: .95rem; }

/* ---- Tarjetas ---- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.card-body { padding: 1.25rem; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; padding: 1rem 1.25rem; border-top: 1px solid #f1f5f9; }

/* KPI / tarjeta de indicador */
.kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
  display: block;
  transition: box-shadow .18s ease;
}
.kpi-card:hover { box-shadow: 0 6px 18px -6px rgba(15,23,42,.12); }
.kpi-card .kpi-icon { width: 2.5rem; height: 2.5rem; border-radius: .75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-card .kpi-icon .material-symbols-outlined { font-size: 20px; }
.kpi-label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: #64748b; }
.kpi-value { font-size: 1.375rem; font-weight: 700; color: #1e293b; margin-top: .15rem; line-height: 1.2; }
.kpi-foot { font-size: .75rem; color: #94a3b8; margin-top: .15rem; }
.kpi-delta { display: inline-flex; align-items: center; gap: .25rem; font-size: .6875rem; font-weight: 700; }
.kpi-delta .material-symbols-outlined { font-size: 14px; }
.kpi-delta.up { color: #059669; }
.kpi-delta.down { color: #e11d48; }
.kpi-blue    { border-top: 3px solid #3b82f6; } .kpi-blue    .kpi-icon { background: #eff6ff; color: #2563eb; }
.kpi-indigo  { border-top: 3px solid #6366f1; } .kpi-indigo  .kpi-icon { background: #eef2ff; color: #4f46e5; }
.kpi-orange  { border-top: 3px solid #f97316; } .kpi-orange  .kpi-icon { background: #fff7ed; color: #ea580c; }
.kpi-emerald { border-top: 3px solid #10b981; } .kpi-emerald .kpi-icon { background: #ecfdf5; color: #059669; }
.kpi-amber   { border-top: 3px solid #f59e0b; } .kpi-amber   .kpi-icon { background: #fffbeb; color: #d97706; }
.kpi-rose    { border-top: 3px solid #f43f5e; } .kpi-rose    .kpi-icon { background: #fff1f2; color: #e11d48; }
.kpi-violet  { border-top: 3px solid #8b5cf6; } .kpi-violet  .kpi-icon { background: #f5f3ff; color: #7c3aed; }
.kpi-sky     { border-top: 3px solid #0ea5e9; } .kpi-sky     .kpi-icon { background: #f0f9ff; color: #0284c7; }
.kpi-slate   { border-top: 3px solid #64748b; } .kpi-slate   .kpi-icon { background: #f1f5f9; color: #475569; }

/* Tarjeta de acceso / acción */
.link-card {
  display: block;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
  padding: 1.1rem 1.25rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.link-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -10px rgba(15,23,42,.16); border-color: #cbd5e1; }
.link-card .link-icon { width: 2.75rem; height: 2.75rem; border-radius: .75rem; display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.link-card .link-icon .material-symbols-outlined { font-size: 24px; }
.link-title { font-weight: 600; color: #1e293b; font-size: .9375rem; line-height: 1.25; }
.link-desc { font-size: .75rem; color: #64748b; margin-top: .15rem; }
.link-open { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 600; margin-top: .75rem; }
.link-open .material-symbols-outlined { font-size: 14px; }
.link-blue    .link-icon { background: #eff6ff; color: #2563eb; } .link-blue    .link-open { color: #2563eb; }
.link-indigo  .link-icon { background: #eef2ff; color: #4f46e5; } .link-indigo  .link-open { color: #4f46e5; }
.link-emerald .link-icon { background: #ecfdf5; color: #059669; } .link-emerald .link-open { color: #059669; }
.link-amber   .link-icon { background: #fffbeb; color: #d97706; } .link-amber   .link-open { color: #d97706; }
.link-rose    .link-icon { background: #fff1f2; color: #e11d48; } .link-rose    .link-open { color: #e11d48; }
.link-sky     .link-icon { background: #f0f9ff; color: #0284c7; } .link-sky     .link-open { color: #0284c7; }
.link-violet  .link-icon { background: #f5f3ff; color: #7c3aed; } .link-violet  .link-open { color: #7c3aed; }
.link-teal    .link-icon { background: #f0fdfa; color: #0d9488; } .link-teal    .link-open { color: #0d9488; }
.link-slate   .link-icon { background: #f1f5f9; color: #475569; } .link-slate   .link-open { color: #475569; }

/* Estado vacío */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 1.5rem; }
.empty-state .e-ico { width: 3.5rem; height: 3.5rem; border-radius: 1rem; background: #f1f5f9; color: #94a3b8; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.empty-state .e-ico .material-symbols-outlined { font-size: 28px; }
.empty-title { font-weight: 600; color: #334155; font-size: .9375rem; }
.empty-desc { font-size: .8125rem; color: #94a3b8; margin-top: .25rem; max-width: 20rem; }
.empty-action { margin-top: 1rem; }

/* ---- Móvil: adaptación a teléfonos ---- */
@media (max-width: 640px) {
  .btn { min-height: 2.75rem; }          /* área táctil cómoda */
  .input { min-height: 2.75rem; }
  dialog { margin: auto 0 0 0; width: 100%; max-width: 100vw; }
  .modal {
    width: 100%;
    max-width: 100vw;
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 88dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #toastCont { top: auto; bottom: .75rem; left: .75rem; right: .75rem; width: auto; }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .ui-table thead { display: none; }
  .ui-table tbody { display: block; }
  .ui-table tbody tr {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    padding: .6rem .75rem;
    margin-bottom: .625rem;
  }
  .ui-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .45rem 0 !important;
    text-align: right !important;
    border-bottom: 1px dashed #eef2f7;
  }
  .ui-table tbody td:last-child { border-bottom: none; }
  .ui-table tbody td::before {
    content: attr(data-label);
    order: -1;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    flex-shrink: 0;
  }
}

/* ============================================================
   MODO OSCURO — capa global
   Se activa añadiendo la clase .dark a <html> (lo hace shell.js
   o el script del login). Oscurece superficies, textos, iconos y
   componentes del UI kit sin tener que editar cada página.
   ============================================================ */
.dark body,
body.dark { background-color: #0f172a; }

/* Superficies */
.dark .bg-white { background-color: #1e293b; }
.dark .bg-slate-50 { background-color: #0f172a; }
.dark .bg-slate-100 { background-color: #1e293b; }
.dark .bg-slate-50\/60, .dark .bg-slate-50\/40, .dark .bg-slate-50\/30 { background-color: rgba(30,41,59,.6); }

/* Header translúcido del shell */
.dark .bg-white\/90 { background-color: rgba(15,23,42,.9); }
.dark .backdrop-blur { background-color: rgba(15,23,42,.85); }

/* Bordes */
.dark .border-slate-200 { border-color: #334155; }
.dark .border-slate-300 { border-color: #475569; }
.dark .border-slate-100 { border-color: #1e293b; }

/* Textos */
.dark .text-slate-800, .dark .text-slate-900 { color: #e2e8f0; }
.dark .text-slate-700 { color: #cbd5e1; }
.dark .text-slate-600 { color: #94a3b8; }
.dark .text-slate-500, .dark .text-slate-400 { color: #64748b; }
.dark .text-slate-300 { color: #94a3b8; }

/* Inputs y selects */
.dark input, .dark select, .dark textarea {
  background-color: #0f172a !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}
.dark input::placeholder, .dark textarea::placeholder { color: #64748b; }

/* Tablas */
.dark table thead th { color: #94a3b8; border-color: #334155; }
.dark table tbody tr { border-color: #334155; }
.dark table tbody tr:hover, .dark tbody tr:hover { background-color: #1e293b; }
.dark .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }

/* Fondos suaves de color (iconos y badges) -> tintes oscuros */
.dark .bg-indigo-50   { background-color: rgba(99,102,241,.14); }
.dark .bg-rose-50     { background-color: rgba(244,63,94,.14); }
.dark .bg-amber-50    { background-color: rgba(245,158,11,.14); }
.dark .bg-emerald-50  { background-color: rgba(16,185,129,.14); }
.dark .bg-sky-50      { background-color: rgba(14,165,233,.14); }
.dark .bg-violet-50   { background-color: rgba(139,92,246,.14); }
.dark .bg-teal-50     { background-color: rgba(20,184,166,.14); }

/* Iconos y acentos: versiones claras para contraste */
.dark .text-indigo-600, .dark .kpi-indigo .kpi-icon, .dark .link-indigo .link-icon, .dark .link-indigo .link-open { color: #a5b4fc; }
.dark .text-rose-600,   .dark .kpi-rose .kpi-icon,   .dark .link-rose .link-icon,   .dark .link-rose .link-open   { color: #fda4af; }
.dark .text-amber-600,  .dark .kpi-amber .kpi-icon,  .dark .link-amber .link-icon,  .dark .link-amber .link-open  { color: #fcd34d; }
.dark .text-emerald-600,.dark .kpi-emerald .kpi-icon,.dark .link-emerald .link-icon,.dark .link-emerald .link-open { color: #6ee7b7; }
.dark .text-sky-600,    .dark .kpi-sky .kpi-icon,    .dark .link-sky .link-icon,    .dark .link-sky .link-open    { color: #7dd3fc; }
.dark .text-violet-600, .dark .kpi-violet .kpi-icon, .dark .link-violet .link-icon, .dark .link-violet .link-open { color: #c4b5fd; }
.dark .text-teal-600,   .dark .kpi-teal .kpi-icon,   .dark .link-teal .link-icon,   .dark .link-teal .link-open   { color: #5eead4; }

/* Texto de badges sobre fondo oscuro */
.dark .text-emerald-700, .dark .text-amber-700, .dark .text-sky-700,
.dark .text-rose-700, .dark .text-indigo-700, .dark .text-violet-700,
.dark .text-teal-700 {
  color: #cbd5e1;
}

/* Componentes del UI kit */
.dark .kpi-card { background-color: #1e293b; border-color: #334155; }
.dark .kpi-card .kpi-label { color: #94a3b8; }
.dark .kpi-card .kpi-value { color: #f1f5f9; }
.dark .kpi-card .kpi-foot { color: #64748b; }
.dark .link-card { background-color: #1e293b; border-color: #334155; }
.dark .link-card:hover { border-color: #475569; }
.dark .link-title { color: #e2e8f0; }
.dark .link-desc { color: #64748b; }
.dark .ui-table { background-color: #1e293b; border-color: #334155; }
.dark .ui-table th { color: #94a3b8; }
.dark .ui-table td { color: #cbd5e1; }
.dark .btn { border-color: #475569; }
.dark .empty-state .e-ico { background: #1e293b; color: #64748b; }
.dark .empty-title { color: #e2e8f0; }
.dark .empty-desc { color: #94a3b8; }

/* Shell: sidebar y header ya oscuros por diseño, ajustes finos */
.dark #suiteSidebar aside { background-color: #0f172a; }
.dark #suiteHeader header { background-color: rgba(15,23,42,.9); border-color: #1e293b; }
.dark #suiteHeader .bg-white\/90 { background-color: rgba(15,23,42,.9); }

/* Transición suave al cambiar de tema */
html.theme-anim, html.theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease !important; }

/* ===== Tema SweetAlert2 → estilo Suite =====
   Se aplica globalmente: todas las confirmaciones y diálogos "Cargando…" del
   ERP heredan el look de la suite sin tocar cada página. No cambia el
   comportamiento (una confirmación sigue pidiendo Sí/No). El color del botón
   de confirmar se respeta (rojo = destructivo, verde = guardar). */
.swal2-popup {
  font-family: 'Inter', sans-serif !important;
  border-radius: 1.25rem !important;
  padding: 1.5rem 1.6rem 1.4rem !important;
  box-shadow: 0 20px 55px -15px rgba(15,23,42,.35) !important;
  width: 25rem !important;
  max-width: calc(100vw - 2rem) !important;
}
.swal2-title {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  padding: 0 !important;
  margin: .15rem 0 .4rem !important;
}
.swal2-html-container {
  font-size: .875rem !important;
  color: #64748b !important;
  margin: 0 !important;
  line-height: 1.5 !important;
}
/* Ícono más discreto (sin distorsionar su geometría interna) */
.swal2-icon {
  transform: scale(.8);
  margin: .35rem auto .35rem !important;
}
/* Botonera: acción primaria a la derecha, Cancelar a la izquierda */
.swal2-actions {
  gap: .5rem !important;
  margin-top: 1.25rem !important;
  flex-direction: row-reverse !important;
}
.swal2-styled {
  border-radius: .75rem !important;
  font-weight: 600 !important;
  font-size: .875rem !important;
  padding: .55rem 1.15rem !important;
  margin: 0 !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.12) !important;
  transition: filter .18s ease !important;
}
.swal2-styled:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.35) !important; }
.swal2-styled.swal2-confirm:hover { filter: brightness(1.07); }
/* Cancelar como botón secundario, sin importar el color inline de la página */
.swal2-styled.swal2-cancel {
  background: #f1f5f9 !important;
  color: #475569 !important;
  box-shadow: none !important;
}
.swal2-styled.swal2-cancel:hover { background: #e2e8f0 !important; }
.swal2-timer-progress-bar { background: #4f46e5 !important; }

/* Dark mode */
.dark .swal2-popup { background: #1e293b !important; }
.dark .swal2-title { color: #f1f5f9 !important; }
.dark .swal2-html-container { color: #94a3b8 !important; }
.dark .swal2-styled.swal2-cancel { background: #334155 !important; color: #cbd5e1 !important; }
.dark .swal2-styled.swal2-cancel:hover { background: #3f4c5f !important; }

