:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent-red: #ff0000;
  --accent-green: #10b981;
  --surface: #ffffff;
  --surface-warm: #eef1f5;
  --hairline: rgba(15, 23, 42, 0.08);
  --elev-1: 0 1px 2px rgba(15, 23, 42, 0.04);
  --elev-2: 0 8px 24px rgba(15, 23, 42, 0.07);
  --radius: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Segoe UI Variable Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.04);
  --shadow-strong: 0 10px 28px rgba(15, 23, 42, 0.08);
  --overlay: rgba(15, 23, 42, 0.04);
  --grad-surface: linear-gradient(180deg, #ffffff, #f8fafc);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --speed-fast: 100ms;
  --speed-base: 160ms;
  --speed-slow: 220ms;
  --speed-page: 180ms;
  --btn-hover-lift: 0px;
  --btn-shadow-idle: 0 1px 2px rgba(15, 23, 42, 0.05);
  --btn-shadow-hover: 0 2px 8px rgba(15, 23, 42, 0.08);
  --motion-lift-sm: 0px;
  --motion-lift-md: 0px;
  --motion-scale-press: 0.98;
  --app-topbar-height: 64px;
  --app-stage-radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Altura del frame móvil; JS la ajusta a visualViewport/innerHeight */
  --app-frame-height: 100dvh;
}

html { background-color: var(--bg); }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  letter-spacing: -0.011em;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
html { scroll-behavior: auto; }

/* Selección de texto cálida (usa el acento verde de marca) */
::selection { background: rgba(16, 185, 129, 0.22); color: #0b3a2b; }

/* Scrollbars finos y coherentes en toda la app */
* { scrollbar-width: thin; scrollbar-color: rgba(15, 23, 42, 0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; transition: background-color var(--speed-base) var(--ease-smooth); }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.32); background-clip: padding-box; }
main { flex: 1 0 auto; }
.app-main-content {
  width: 100%;
  max-width: none;
  padding-left: clamp(0.875rem, 1.75vw, 1.75rem);
  padding-right: clamp(0.875rem, 1.75vw, 1.75rem);
}
main.container { max-width: 1140px; }
main .container { max-width: 1140px; }
.container { transition: transform var(--speed-base) var(--ease-soft), opacity var(--speed-base) var(--ease-soft); }

.navbar-brand { font-weight: 700; letter-spacing: 0.2px; }
.brand-lockup { gap: 4px; }
.navbar-brand .brand-text { font-size: 24px; font-weight: 700; color: #111; letter-spacing: -0.02em; transition: opacity var(--speed-base) var(--ease-out); }
.navbar-brand:hover .brand-text { opacity: 0.82; }
.navbar-brand .brand-logo { width: 40px; height: 40px; object-fit: contain; transition: opacity var(--speed-base) var(--ease-out); }
.navbar-brand:hover .brand-logo { opacity: 0.9; }
.nav-link { color: #111; padding: 0.5rem 0.75rem; border-radius: 10px; transition: background-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-out), color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth); }
.nav-link:hover { background-color: rgba(0,0,0,0.06); transform: translateY(var(--motion-lift-sm)); }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.app-body { display: flex; flex: 1 1 auto; align-items: stretch; min-height: 0; background: var(--bg); }
.app-sidebar { width: 264px; background: #fff; border: none; border-right: none; padding: 0.85rem 0.7rem; overflow-x: hidden; overflow-y: auto; box-shadow: none; transition: width var(--speed-slow) var(--ease-out), box-shadow var(--speed-base) var(--ease-soft), background-color var(--speed-base) var(--ease-soft), padding var(--speed-slow) var(--ease-out); display: flex; flex-direction: column; scrollbar-width: thin; min-width: 0; align-self: stretch; --sidebar-tab-bg: #111; --sidebar-tab-hover-bg: #f3f4f6; }
.app-sidebar .nav { gap: 4px; flex: 1 1 auto; overflow-x: hidden; overflow-y: visible; width: 100%; min-width: 0; max-width: 100%; }
.app-sidebar:not(.collapsed) .nav-link { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.app-sidebar .nav-link { color: #111; padding: 0.5rem 0.75rem; border-radius: 10px; transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth), transform var(--speed-fast) var(--ease-out); position: relative; z-index: 0; }
.app-sidebar button.nav-link { appearance: none; -webkit-appearance: none; border: none; background: transparent; font: inherit; text-align: left; }
.app-sidebar button.nav-link:focus,
.app-sidebar button.nav-link:active { outline: none; box-shadow: none; }
.app-sidebar button.nav-link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35); }
.app-sidebar .nav-link:hover:not(.active) { background-color: rgba(0,0,0,0.05); }
.app-sidebar .nav-link:active { transform: scale(var(--motion-scale-press)); }
.app-sidebar .nav-link[aria-expanded] { transition: background-color var(--speed-base) var(--ease-out), color var(--speed-base) var(--ease-out); }
.app-sidebar .nav-link[aria-expanded] .sidebar-nav-chevron,
.app-sidebar .nav-link[aria-expanded] .bi-chevron-down { transition: transform var(--speed-slow) var(--ease-out); }
.app-sidebar .nav-link[aria-expanded="true"] .sidebar-nav-chevron,
.app-sidebar .nav-link[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.sidebar-nav-group { display: flex; flex-direction: column; gap: 0; }
.app-sidebar:not(.collapsed) .sidebar-nav-toggle {
  width: 100%;
  justify-content: space-between;
}
.app-sidebar:not(.collapsed) .sidebar-nav-toggle .sidebar-nav-link-inner {
  flex: 1 1 auto;
  min-width: 0;
}
.app-sidebar #configMenu,
.app-sidebar #formulariosMenu { margin-top: 6px; padding: 6px; border-radius: 12px; background: rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.06); box-shadow: none; overflow-x: hidden; max-width: 100%; }
.app-sidebar:not(.collapsed) #configMenu,
.app-sidebar:not(.collapsed) #formulariosMenu {
  margin-top: 4px;
  padding: 2px 0 4px;
  background: transparent;
  border: none;
  box-shadow: none;
}
.app-sidebar #configMenu .nav-link,
.app-sidebar #formulariosMenu .nav-link { border-radius: 10px; padding: 0.45rem 0.75rem; transition: background-color var(--speed-base) var(--ease-out), color var(--speed-base) var(--ease-out); }
.app-sidebar:not(.collapsed) #configMenu .nav-link,
.app-sidebar:not(.collapsed) #formulariosMenu .nav-link {
  padding-left: 1.35rem;
}
.app-sidebar #configMenu .nav-link:hover,
.app-sidebar #formulariosMenu .nav-link:hover { background: rgba(0,0,0,0.06); color: #111; }
.app-sidebar #configMenu .nav-link:hover i,
.app-sidebar #configMenu .nav-link:hover .icon-modern,
.app-sidebar #formulariosMenu .nav-link:hover i,
.app-sidebar #formulariosMenu .nav-link:hover .icon-modern { color: #111; }
.app-sidebar:not(.collapsed) #configMenu .nav-link:hover:not(.active),
.app-sidebar:not(.collapsed) #formulariosMenu .nav-link:hover:not(.active) { background: rgba(0,0,0,0.05); color: #111; }
.app-sidebar:not(.collapsed) #configToggle[aria-expanded="true"],
.app-sidebar:not(.collapsed) #formulariosToggle[aria-expanded="true"] {
  background: rgba(0, 0, 0, 0.04);
  font-weight: 600;
  box-shadow: none;
}
.app-sidebar:not(.collapsed) .sidebar-nav-group { overflow-x: hidden; max-width: 100%; }

/* Ítem activo: píldora homogénea (sin puntas ni sombra) */
.app-sidebar:not(.collapsed) a.nav-link.active {
  background: var(--sidebar-tab-bg);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
  border-radius: 12px;
  margin: 0;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  padding-right: 0.75rem;
  width: 100%;
  max-width: 100%;
  z-index: 2;
}
.app-sidebar:not(.collapsed) a.nav-link.active i,
.app-sidebar:not(.collapsed) a.nav-link.active .icon-modern {
  color: #fff;
}
.app-sidebar:not(.collapsed) a.nav-link.active::before,
.app-sidebar:not(.collapsed) a.nav-link.active::after {
  content: none;
  display: none;
}
.app-sidebar:not(.collapsed) a.nav-link.active:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.app-sidebar .nav-link:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
  box-shadow: none;
}
.app-sidebar .nav-link:hover:not(.active) i,
.app-sidebar .nav-link:hover:not(.active) .icon-modern {
  color: #111;
}
.app-sidebar:not(.collapsed) a.nav-link.active:hover,
.app-sidebar:not(.collapsed) a.nav-link.active:hover i,
.app-sidebar:not(.collapsed) a.nav-link.active:hover .icon-modern {
  background: #111;
  color: #fff;
}
.app-sidebar:not(.collapsed) a.nav-link.active:hover:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}
.app-sidebar:not(.collapsed) .nav {
  gap: 8px;
}
.app-sidebar .nav-link:hover { transform: none; }
.app-sidebar .nav-link:not(:focus-visible),
.app-sidebar .sidebar-nav-toggle:not(:focus-visible),
.app-sidebar-collapse:not(:focus-visible) {
  box-shadow: none;
}
.app-sidebar #configMenu.collapse,
.app-sidebar #configMenu.collapsing,
.app-sidebar #formulariosMenu.collapse,
.app-sidebar #formulariosMenu.collapsing { transition: height var(--speed-slow) var(--ease-out); }
.app-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.app-content main { flex: 1 0 auto; }
body[data-authenticated] .app-content {
  background: var(--bg);
  border-top-left-radius: var(--app-stage-radius, 24px);
  overflow: hidden;
}
body[data-authenticated] #appMainContent {
  border-top-left-radius: var(--app-stage-radius, 24px);
}
/* Chrome blanco detrás del stage: sin esto la curva no se ve (gris sobre gris) */
body[data-authenticated] .app-topbar { border-bottom-color: transparent; }
body[data-authenticated] .app-sidebar { border: none; border-right: none; }

/* Layout tipo panel: header + menú a altura completa; sólo contenido/iframe hace scroll.
   Se excluye el modo embed para no romper el scroll interno de los iframes. */
html:has(body[data-authenticated]) {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background: var(--bg);
}
body[data-authenticated] {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}
body[data-authenticated] .app-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: 0;
  background: #fff;
  box-sizing: border-box;
}
body[data-authenticated] .app-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
  /* Blanco = chrome; la curva del stage (--bg) queda visible contra el menú */
  background: #fff;
}
body[data-authenticated] .app-sidebar {
  align-self: stretch;
  height: auto;
  min-height: 0;
  max-height: none;
  background: #fff;
}
body[data-authenticated] .app-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-top-left-radius: var(--app-stage-radius, 24px);
}
body[data-authenticated] .app-topbar {
  flex-shrink: 0;
}
body[data-authenticated] #appMainContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}
body[data-authenticated] #appTabWorkspace:not(.d-none) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
body[data-authenticated] .app-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
}
body[data-authenticated] .app-tab-frame {
  min-height: 100%;
  background: var(--bg);
}

/* Pestañas de módulos (TabManager) */
.app-tab-workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.app-tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 14px 0 22px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--bg);
  scrollbar-width: thin;
}
/* Separador claro entre pestañas y contenido */
.app-tab-bar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(15, 23, 42, 0.12);
  pointer-events: none;
  z-index: 1;
}
.app-tab-close-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 4px 8px 0;
  align-self: flex-end;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.85);
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.65rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth),
    border-color var(--speed-fast) var(--ease-smooth), transform var(--speed-fast) var(--ease-smooth),
    box-shadow var(--speed-fast) var(--ease-smooth);
}
.app-tab-close-all:hover:not(:disabled) {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.22);
  color: #b91c1c;
  transform: none;
  box-shadow: none;
}
.app-tab-close-all:disabled,
.app-tab-close-all[hidden] {
  display: none;
}
.app-tab {
  display: inline-flex;
  align-items: center;
  height: 36px;
  max-width: min(200px, 38vw);
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: rgba(255, 255, 255, 0.62);
  flex-shrink: 0;
  margin-bottom: -1px;
  position: relative;
  overflow: hidden;
  transform-origin: bottom center;
  transition: background-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth),
    border-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth),
    height var(--speed-base) var(--ease-smooth);
}
.app-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  opacity: 0;
  transition: opacity var(--speed-base) var(--ease-smooth);
  pointer-events: none;
}
.app-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.14);
  transform: none;
  box-shadow: none;
}
.app-tab.active {
  height: 40px;
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.08);
  z-index: 2;
}
.app-tab.active::before {
  opacity: 1;
  background: #111;
}
.app-tab-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0 4px 0 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  min-width: 0;
  cursor: pointer;
  letter-spacing: 0.01em;
  outline: none;
  box-shadow: none;
}
.app-tab-label:focus,
.app-tab-label:active {
  outline: none;
  box-shadow: none;
}
.app-tab-label:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.app-tab.active .app-tab-label {
  color: #0f172a;
  font-weight: 600;
}
.app-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 0.72rem;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.07);
  color: #475569;
  opacity: 1;
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth),
    transform var(--speed-base) var(--ease-smooth);
}
.app-tab:hover:not(.active) .app-tab-icon {
  background: rgba(15, 23, 42, 0.1);
  color: #334155;
}
.app-tab.active .app-tab-icon {
  background: #111;
  color: #fff;
  transform: scale(1.04);
}
.app-tab-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.68rem;
  opacity: 0;
  transform: scale(0.88);
  outline: none;
  box-shadow: none;
  transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth),
    opacity var(--speed-fast) var(--ease-smooth), transform var(--speed-fast) var(--ease-smooth);
}
.app-tab-close:focus,
.app-tab-close:active {
  outline: none;
  box-shadow: none;
}
.app-tab-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.app-tab-close-all:focus,
.app-tab-close-all:active {
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.app-tab-close-all:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.app-tab:focus,
.app-tab:focus-visible {
  outline: none;
}
.app-tab:hover .app-tab-close,
.app-tab.active .app-tab-close {
  opacity: 1;
  transform: scale(1);
}
.app-tab-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
.app-tab.active .app-tab-close:hover {
  background: #fef2f2;
  color: #b91c1c;
}
.app-tab-panels {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.app-tab-panel {
  position: absolute;
  inset: 0;
}
.app-tab-panel[hidden] {
  display: none !important;
}
.app-tab-panel.active {
  display: block;
}
.app-tab-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}
.app-tab-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6b7280;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-warm) 100%);
}
.app-tab-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  font-size: 1.75rem;
  color: #111;
  margin-bottom: 1rem;
}
.app-tab-empty h2 { font-size: 1.15rem; color: #111; margin-bottom: 0.35rem; }
.app-tab-empty p { max-width: 28rem; margin-bottom: 0; }

body.app-embed {
  background: var(--bg);
  display: block;
  height: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
html:has(body.app-embed) {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
}
body.app-embed .page-loader { display: none !important; }
body.app-embed .embed-main {
  max-width: none;
  width: 100%;
  margin: 0;
  min-height: 100%;
  box-sizing: border-box;
  padding-left: clamp(0.875rem, 1.75vw, 1.75rem);
  padding-right: clamp(0.875rem, 1.75vw, 1.75rem);
  padding-bottom: max(0.75rem, var(--safe-bottom));
  background: var(--bg);
}
.app-tab-panel-cache { display: none !important; }

.app-topbar { position: relative; z-index: 1030; flex-shrink: 0; background: #fff; border: none; border-bottom: none; box-shadow: none; outline: none; padding-top: var(--safe-top); }
.app-topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--app-topbar-height); padding: 0 max(1rem, var(--safe-right)) 0 max(0.85rem, var(--safe-left)); }
.app-topbar-left { display: flex; align-items: center; gap: 0; min-width: 0; }
.app-topbar-right { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.app-topbar-toggle { display: none !important; }
@media (min-width: 769px) {
  .app-topbar-inner { padding-left: 0; }
  .app-topbar-left {
    width: 264px;
    justify-content: center;
    padding: 0 0.7rem;
  }
  body:has(.app-sidebar.collapsed) .app-topbar-left {
    width: 72px;
    padding: 0 0.35rem;
  }
  body:has(.app-sidebar.collapsed) .app-topbar-brand .brand-text {
    display: none;
  }
}
.app-topbar-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: #111;
  padding: 0.32rem 0.7rem;
  margin: 0;
  border-radius: 14px;
  border: none;
  background: transparent;
  outline: none;
  box-shadow: none;
  transform-origin: center center;
  transition:
    background-color var(--speed-base) var(--ease-out),
    transform var(--speed-slow) var(--ease-out),
    box-shadow var(--speed-base) var(--ease-out);
}
.app-topbar-brand .brand-logo {
  width: 66px;
  height: 66px;
  object-fit: contain;
  transform-origin: center;
  transition: filter var(--speed-base) var(--ease-out);
}
.app-topbar-brand .brand-text {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111;
  line-height: 1;
  transform-origin: left center;
  transition:
    color var(--speed-base) var(--ease-out),
    text-shadow var(--speed-base) var(--ease-out);
}
.app-topbar-left { transition: width var(--speed-slow) var(--ease-out); }
.app-topbar-brand:hover {
  background: rgba(15, 23, 42, 0.055);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transform: scale(1.06);
  text-decoration: none;
  color: #111;
}
.app-topbar-brand:hover .brand-logo,
.app-topbar-brand:hover .brand-text {
  opacity: 1;
}
.app-topbar-brand:hover .brand-logo {
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.16));
}
.app-topbar-brand:hover .brand-text {
  color: #111;
  text-shadow: 0 6px 12px rgba(15, 23, 42, 0.16);
}
.app-topbar-brand:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.28);
}
.app-topbar-brand:active {
  transform: scale(0.96);
  background: #111;
  box-shadow: none;
}
.app-topbar-brand:active .brand-logo {
  filter: brightness(1.15);
}
.app-topbar-brand:active .brand-text { color: #fff; text-shadow: none; }
.app-topbar-user .btn-ghost { padding: 0.3rem 0.55rem; }
.app-topbar-username { max-width: 12rem; }

.app-sidebar-collapse { width: 100%; border: none; background: transparent; color: #6b7280; margin-top: 6px; }
.app-sidebar-collapse:hover { background-color: rgba(0,0,0,0.05); color: #111; transform: none; }
.about-modal-dialog { max-width: min(26rem, calc(100vw - 2rem)); }
.about-modal-logo { width: 72px; height: 72px; object-fit: contain; }

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.user-menu-avatar-img { display: block; }

.users-table-photo-col { width: 3.5rem; }
.users-table-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.users-table-avatar-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.users-table-avatar-fallback { color: #9ca3af; font-size: 1.1rem; }

.profile-modal-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.profile-modal-avatar-img { display: block; }
.profile-photo-block { max-width: 22rem; margin-left: auto; margin-right: auto; }
.profile-modal-dialog { max-width: min(34rem, calc(100vw - 2rem)); }
.profile-info-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 0.875rem 1rem;
  background: #fff;
}
.profile-info-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.35rem;
}
.profile-info-label i { font-size: 0.875rem; opacity: 0.85; }
.profile-info-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111;
  line-height: 1.35;
  word-break: break-word;
}

.app-sidebar.collapsed {
  width: 72px;
  padding: 0.75rem 0;
  overflow-x: hidden;
}
.app-sidebar.collapsed .nav {
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  overflow-x: hidden;
}
.app-sidebar.collapsed .nav-text,
.app-sidebar.collapsed .sidebar-nav-chevron,
.app-sidebar.collapsed .bi-chevron-down {
  display: none !important;
  width: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  position: absolute !important;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  pointer-events: none;
}
.app-sidebar.collapsed .sidebar-nav-group,
.app-sidebar.collapsed .sidebar-nav-group--config,
.app-sidebar.collapsed .sidebar-nav-group--formularios {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 44px;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.app-sidebar.collapsed .nav-link,
.app-sidebar.collapsed #configMenu .nav-link,
.app-sidebar.collapsed #formulariosMenu .nav-link,
.app-sidebar.collapsed .app-sidebar-collapse {
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0 !important;
  margin: 0 auto;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
  text-indent: 0;
  font-size: 0;
  line-height: 0;
}
.app-sidebar.collapsed .nav-link i,
.app-sidebar.collapsed .nav-link .icon-modern {
  margin: 0 !important;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.app-sidebar.collapsed .nav-link .sidebar-nav-link-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  min-width: 0;
  overflow: hidden;
}
.app-sidebar.collapsed .nav-link .sidebar-nav-link-inner .nav-text {
  display: none !important;
}
.app-sidebar.collapsed #configMenu,
.app-sidebar.collapsed #formulariosMenu {
  margin-top: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.app-sidebar.collapsed #configMenu.show,
.app-sidebar.collapsed #configMenu.collapsing,
.app-sidebar.collapsed #formulariosMenu.show,
.app-sidebar.collapsed #formulariosMenu.collapsing {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 44px;
  margin: 0;
  padding: 0 !important;
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
}
.app-sidebar.collapsed #configMenu .nav-link:hover,
.app-sidebar.collapsed #formulariosMenu .nav-link:hover,
.app-sidebar.collapsed .nav-link:hover {
  transform: none;
}
.app-sidebar.collapsed .nav-link.active {
  background-color: #111;
  color: #fff;
  box-shadow: none;
}
.app-sidebar.collapsed .nav-link.active i,
.app-sidebar.collapsed .nav-link.active .icon-modern {
  color: #fff;
}
.app-sidebar.collapsed .nav-link.active:hover {
  background-color: var(--sidebar-tab-hover-bg);
  color: #111;
  box-shadow: none;
}
.app-sidebar.collapsed .nav-link.active:hover i,
.app-sidebar.collapsed .nav-link.active:hover .icon-modern {
  color: #111;
}
.app-sidebar.collapsed .nav-link.active:hover:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}
.app-sidebar.collapsed .nav-link:hover:not(.active) {
  background-color: rgba(0, 0, 0, 0.06);
}
.app-sidebar.collapsed #configToggle[aria-expanded="true"]:not(.active),
.app-sidebar.collapsed #formulariosToggle[aria-expanded="true"]:not(.active) {
  background: rgba(0, 0, 0, 0.06);
}
.app-sidebar.collapsed .nav-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}
.app-sidebar.collapsed .nav-link.active:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}
.app-sidebar:not(.collapsed) .app-sidebar-collapse {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.app-sidebar.collapsed .mt-auto {
  width: 100%;
  display: flex;
  justify-content: center;
}
.app-sidebar.collapsed .nav-link .nav-text,
.app-sidebar.collapsed .nav-link > .nav-text {
  display: none !important;
}

.btn-icon { background-color: transparent; border: none; color: #111; padding: 0.5rem; border-radius: 12px; transition: background-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth); position: relative; overflow: hidden; }
.btn-icon:hover { background-color: rgba(15, 23, 42, 0.06); color: #0f172a; transform: none; }
.btn-icon:active:not(:disabled) { transform: translateY(0) scale(0.97); transition-duration: var(--speed-fast); }
.btn-ghost { background-color: transparent; border: none; color: #111; padding: 0.5rem 0.75rem; border-radius: 12px; transition: background-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth); position: relative; overflow: hidden; }
.btn-ghost:hover { background-color: rgba(15, 23, 42, 0.06); color: #0f172a; transform: none; }
.btn-ghost:active:not(:disabled) { transform: translateY(0) scale(0.99); transition-duration: var(--speed-fast); }
.nav-link:focus-visible, .btn-icon:focus-visible, .btn-ghost:focus-visible { outline: 2px solid rgba(0,0,0,0.4); outline-offset: 2px; }

.dropdown-menu { border-radius: 14px; padding: 0.4rem; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12); border: 1px solid rgba(15, 23, 42, 0.08); overflow: hidden; transition: box-shadow var(--speed-base) var(--ease-out), opacity var(--speed-base) var(--ease-out); }
.dropdown-menu.show {
  animation: dropdownIn var(--speed-base) var(--ease-out) both;
}
@keyframes dropdownIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.actions-dropdown-menu { z-index: 1060; }
.actions-dropdown-trigger { min-width: 44px; padding: 0.4rem 0.6rem; justify-content: center; }
.module-actions { position: relative; z-index: 1060; }
.module-actions-card,
.module-page-header--actions { position: relative; z-index: 1100; }
.module-table-card {
  position: relative;
  z-index: 1;
  padding: 1.15rem 1.25rem !important;
}
.module-table-card.card-modern:hover,
.module-table-card.card:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
}
.dropdown-item { border-radius: 10px; padding: 0.5rem 0.75rem; font-weight: 550; transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth); }
.dropdown-item:hover, .dropdown-item:focus { background-color: #f1f5f9; color: #0f172a; transform: none; }
.dropdown-item:hover .bi, .dropdown-item:focus .bi { color: #0f172a; }
.dropdown-item.active, .dropdown-item:active { background-color: #000; color: #fff; transform: none; }
.dropdown-item.active:hover, .dropdown-item.active:hover .bi,
.dropdown-item:active:hover, .dropdown-item:active .bi { color: #fff; }
.dropdown-divider { border-top: 1px solid rgba(0,0,0,0.08); }

/* Botones: un solo contrato visual en toda la app
   Hover = oscurece el fondo, texto/icono NO cambian de color.
   Outline hover = se rellena con su color y texto contrastado.
   Active = scale 0.985. Sin lift ni filter. */
.btn {
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--btn-shadow-idle);
  transition:
    background-color var(--speed-base) var(--ease-smooth),
    border-color var(--speed-base) var(--ease-smooth),
    color var(--speed-base) var(--ease-smooth),
    box-shadow var(--speed-base) var(--ease-smooth),
    transform var(--speed-fast) var(--ease-smooth),
    opacity var(--speed-base) var(--ease-smooth);
}
.btn .bi,
.btn .icon-modern {
  color: inherit;
}
.btn:hover:not(:disabled):not(.disabled) {
  transform: none;
  filter: none;
  box-shadow: var(--btn-shadow-hover);
}
.btn:hover:not(:disabled):not(.disabled) .bi,
.btn:hover:not(:disabled):not(.disabled) .icon-modern {
  color: inherit;
  transform: none;
}
.btn:active:not(:disabled):not(.disabled) {
  transform: scale(var(--motion-scale-press));
  box-shadow: var(--btn-shadow-idle);
  filter: none;
  transition-duration: var(--speed-fast);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.22);
}
.btn:disabled,
.btn.disabled {
  transform: none !important;
  box-shadow: none;
  opacity: 0.65;
}

.btn-dark,
.btn-primary {
  background-color: #111;
  border-color: #111;
  color: #fff;
}
.btn-dark:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  background-color: #000;
  border-color: #000;
  color: #fff;
}
.btn-dark:active:not(:disabled),
.btn-primary:active:not(:disabled) {
  background-color: #000;
  border-color: #000;
  color: #fff;
}

.btn-outline-dark {
  color: #111;
  border-color: #111;
  background-color: transparent;
  box-shadow: none;
}
.btn-outline-dark:hover:not(:disabled) {
  color: #fff;
  background-color: #111;
  border-color: #111;
}
.btn-outline-dark:active:not(:disabled) {
  color: #fff;
  background-color: #000;
  border-color: #000;
}

.btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.btn-danger:active:not(:disabled) {
  background-color: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-outline-danger {
  color: #dc2626;
  border-color: #dc2626;
  background-color: transparent;
  box-shadow: none;
}
.btn-outline-danger:hover:not(:disabled) {
  color: #fff;
  background-color: #ef4444;
  border-color: #ef4444;
}
.btn-outline-danger:active:not(:disabled) {
  color: #fff;
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-success,
.btn-perms {
  background-color: #10b981;
  border-color: #10b981;
  color: #fff;
}
.btn-success:hover:not(:disabled),
.btn-perms:hover:not(:disabled) {
  background-color: #059669;
  border-color: #059669;
  color: #fff;
}
.btn-success:active:not(:disabled),
.btn-perms:active:not(:disabled) {
  background-color: #047857;
  border-color: #047857;
  color: #fff;
}

.btn-warning,
.btn-edit {
  background-color: #f59e0b;
  border-color: #f59e0b;
  color: #111;
}
.btn-warning:hover:not(:disabled),
.btn-edit:hover:not(:disabled) {
  background-color: #d97706;
  border-color: #d97706;
  color: #111;
}
.btn-warning:active:not(:disabled),
.btn-edit:active:not(:disabled) {
  background-color: #b45309;
  border-color: #b45309;
  color: #111;
}

.btn-info {
  background-color: #38bdf8;
  border-color: #38bdf8;
  color: #111;
}
.btn-info:hover:not(:disabled) {
  background-color: #0ea5e9;
  border-color: #0ea5e9;
  color: #111;
}
.btn-info:active:not(:disabled) {
  background-color: #0284c7;
  border-color: #0284c7;
  color: #111;
}

.btn-light,
.btn-secondary {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}
.btn-light:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-link {
  box-shadow: none;
  background: transparent;
  border-color: transparent;
  color: #334155;
}
.btn-link:hover:not(:disabled) {
  color: #0f172a;
  background: transparent;
  box-shadow: none;
}

.btn-icon,
.btn-ghost,
.btn-link,
.btn-close {
  box-shadow: none;
}
.btn-icon:hover:not(:disabled),
.btn-ghost:hover:not(:disabled),
.btn-link:hover:not(:disabled),
.btn-close:hover {
  box-shadow: none;
}
.ripple { position: absolute; border-radius: 50%; transform: scale(0); animation: ripple 600ms linear; background-color: rgba(255,255,255,0.7); pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.module-actions .btn .btn-text { display: none; }
.module-actions .btn i { margin-right: 0 !important; }
.module-actions .btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.module-actions .btn + .btn { margin-left: 8px; }

.btn-compact { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.btn-compact i { margin-right: 0 !important; }
.btn-compact .btn-text { display: none; }
.btn-compact + .btn-compact, .btn-compact + form .btn-compact { margin-left: 4px; }
/* Botones columna ACCIONES en datatables: sin borde */
.table .btn-compact {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: none;
  box-shadow: none;
}
.table .btn-compact:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  filter: none;
}
.table .btn-compact:active:not(:disabled) {
  transform: scale(var(--motion-scale-press));
  box-shadow: none;
}
.table .btn-compact:focus {
  box-shadow: none;
}
.table .btn-compact:focus-visible {
  outline: 2px solid rgba(0,0,0,0.35);
  outline-offset: 2px;
}
.table .btn-compact .icon-modern { font-size: 16px; }
.table .btn-compact.btn-edit {
  background-color: #f59e0b;
  color: #111;
}
.table .btn-compact.btn-edit:hover {
  background-color: #d97706;
  color: #111;
}
.table .btn-compact.btn-edit:active {
  background-color: #b45309;
  color: #111;
}
.table .btn-compact.btn-mail {
  background-color: #2563eb;
  color: #fff;
}
.table .btn-compact.btn-mail:hover {
  background-color: #1d4ed8;
  color: #fff;
}
.table .btn-compact.btn-mail:active {
  background-color: #1e40af;
  color: #fff;
}
.table .btn-compact.btn-danger {
  background-color: #ef4444;
  color: #fff;
}
.table .btn-compact.btn-danger:hover {
  background-color: #dc2626;
  color: #fff;
}
.table .btn-compact.btn-danger:active {
  background-color: #b91c1c;
  color: #fff;
}
.table .btn-compact.btn-success {
  background-color: #10b981;
  color: #fff;
}
.table .btn-compact.btn-success:hover {
  background-color: #059669;
  color: #fff;
}
.table .btn-compact.btn-success:active {
  background-color: #047857;
  color: #fff;
}
.table .btn-compact.btn-perms {
  background-color: #10b981;
  color: #fff;
}
.table .btn-compact.btn-perms:hover {
  background-color: #059669;
  color: #fff;
}
.table .btn-compact.btn-perms:active {
  background-color: #047857;
  color: #fff;
}
.table .btn-compact:disabled {
  opacity: 0.55;
  filter: saturate(0.65);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.table td.text-end {
  white-space: nowrap;
  width: 1%;
  vertical-align: middle;
}
.table td.text-end > form {
  display: inline-flex;
  margin: 0;
  vertical-align: middle;
}
.table td.text-end > .btn-compact + form,
.table td.text-end > form + .btn-compact,
.table td.text-end > .btn-compact + .btn-compact,
.table td.text-end > form + form {
  margin-left: 0;
}
/* Grupo compacto de acciones (una sola fila, poco espacio) */
.table-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  vertical-align: middle;
  max-width: 100%;
}
.table-actions > form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}
.table-actions .btn-compact,
.table-actions .btn-compact + .btn-compact,
.table-actions .btn-compact + form .btn-compact,
.table td.text-end .table-actions .btn-compact {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.table td.text-end > .btn-compact,
.table td.text-end > form {
  margin-left: 0;
  margin-right: 4px;
  vertical-align: middle;
}
.table td.text-end > .btn-compact:last-child,
.table td.text-end > form:last-child {
  margin-right: 0;
}
/* Si no hay wrapper, forzar fila compacta con gap vía márgenes mínimos */
.table td.text-end:not(:has(.table-actions)) {
  font-size: 0; /* evita huecos por whitespace entre botones inline */
}
.table td.text-end:not(:has(.table-actions)) > .btn-compact,
.table td.text-end:not(:has(.table-actions)) > form {
  font-size: 1rem;
  margin-right: 4px;
}
.table td.text-end:not(:has(.table-actions)) > .btn-compact:last-child,
.table td.text-end:not(:has(.table-actions)) > form:last-child {
  margin-right: 0;
}

.audit-detail-meta dt { font-weight: 600; color: #444; }
.audit-detail-meta dd { word-break: break-word; }
.audit-json-block {
  font-size: 0.8125rem;
  line-height: 1.45;
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  max-height: min(50vh, 320px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0;
}

/* Campos de formulario: estilo unificado y más moderno en toda la app */
.form-control,
.form-select,
textarea.form-control {
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 14px;
  padding: 0.65rem 0.95rem;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out), background-color var(--speed-base) var(--ease-smooth), transform var(--speed-fast) var(--ease-out);
}
.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.18);
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}
.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
  background-color: var(--surface-warm);
  cursor: not-allowed;
  box-shadow: none;
}
.form-control::placeholder { color: #94a3b8; }
.form-label {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}
.input-modern {
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 14px;
  padding: 0.65rem 0.95rem;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth);
}
.input-modern:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}

/* Flecha visible en TODOS los select (modales y formularios) */
select.form-select,
select.input-modern,
select.form-control,
.form-select,
.datatable-selector,
.datatable-dropdown select,
.datatable-top select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 5.75L8 10.25L12.5 5.75' stroke='%23111111' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.95rem 0.95rem;
  padding-right: 2.45rem;
}
select.form-select:disabled,
select.input-modern:disabled,
select.form-control:disabled,
.form-select:disabled,
.datatable-selector:disabled,
.datatable-dropdown select:disabled {
  background-color: var(--surface-warm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 5.75L8 10.25L12.5 5.75' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.95rem 0.95rem;
}

/* Select personalizado: lista desplegable redondeada (nativo no permite border-radius) */
.hero-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.hero-select.is-open { z-index: 1080; }
.hero-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.hero-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: calc(0.65rem * 2 + 1.5em + 2px);
  padding: 0.65rem 0.95rem;
  padding-right: 2.45rem;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 14px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 5.75L8 10.25L12.5 5.75' stroke='%23111111' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.95rem 0.95rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #111;
  font: inherit;
  font-size: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out), background-color var(--speed-base) var(--ease-smooth);
}
.hero-select-trigger:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.18);
}
.hero-select-trigger:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.hero-select.is-open .hero-select-trigger {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.hero-select-trigger:disabled,
.hero-select.is-disabled .hero-select-trigger {
  background-color: var(--surface-warm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 5.75L8 10.25L12.5 5.75' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}
.hero-select-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-select-label.is-placeholder {
  color: #9aa0a6;
}
.hero-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1085;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: min(280px, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity var(--speed-fast) var(--ease-out), transform var(--speed-fast) var(--ease-out), visibility var(--speed-fast);
}
.hero-select.is-open .hero-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.hero-select-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth);
}
.hero-select-option:hover,
.hero-select-option:focus {
  outline: none;
  background: rgba(15, 23, 42, 0.06);
  color: #000;
}
.hero-select-option.is-selected {
  background: #111;
  color: #fff;
}
.hero-select-option.is-selected:hover,
.hero-select-option.is-selected:focus {
  background: #111;
  color: #fff;
}
.hero-select-option:disabled,
.hero-select-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hero-select-option.is-placeholder {
  color: #94a3b8;
}
.input-group > .hero-select {
  flex: 1 1 auto;
  width: 1%;
}
.datatable-dropdown .hero-select,
.datatable-top .hero-select {
  width: auto;
  min-width: 4.5rem;
  display: inline-block;
}
@media (prefers-reduced-motion: reduce) {
  .hero-select-menu {
    transition: none;
  }
}

.input-group-text {
  border-radius: 14px;
  transition: border-color var(--speed-base) var(--ease-smooth), background-color var(--speed-base) var(--ease-smooth);
}
.input-group .input-group-text {
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.11);
  color: #111;
}
.input-group .form-control {
  border-left: 0;
}
.input-group:not(.login-input-group) .input-group-text:first-child {
  border-radius: 14px 0 0 14px;
  border-right: 0;
}
.input-group:not(.login-input-group) .form-control:last-child {
  border-radius: 0 14px 14px 0;
}
.input-group:focus-within .input-group-text {
  border-color: #111;
  background: #fff;
}
.form-check-label { color: #334155; }
.form-check-input { cursor: pointer; border-color: rgba(15, 23, 42, 0.22); }
input[type="checkbox"]:checked, .form-check-input:checked { background-color: #111; border-color: #111; }
.form-check-input:focus { border-color: #111; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12); }
.form-switch .form-check-input { width: 2.4em; height: 1.25em; border-radius: 999px; transition: background-color var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-out); }
.form-switch .form-check-input:checked { background-color: #111; border-color: #111; }

.card-modern { background: #ffffff; border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-soft); transition: box-shadow var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-smooth); }
.card-modern:hover { box-shadow: var(--shadow-soft); transform: none; }
.card { border-radius: var(--radius); border: 1px solid var(--hairline); box-shadow: var(--shadow-soft); transition: box-shadow var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-smooth); }
.card:hover { box-shadow: var(--shadow-soft); transform: none; }
.card.module-workspace:hover,
.card.card-static:hover,
.module-workspace.card-modern:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
}
.card-header, .card-footer { background: #fff; border-color: rgba(0,0,0,0.06); }
.card-title { font-weight: 700; }
.card-subtitle { color: #666; }
.reveal { opacity: 0; transform: translateY(12px); }
.reveal.is-visible { opacity: 1; transform: translateY(0); transition: opacity var(--speed-page) var(--ease-out), transform var(--speed-page) var(--ease-out); }

.btn.is-submitting,
button[data-heroone-submit-lock="1"],
[data-heroone-submit-lock="1"] {
  pointer-events: none;
  opacity: 0.88;
}
.modal.fade .modal-dialog {
  transform: translateY(6px);
  opacity: 0;
  transition:
    transform 180ms cubic-bezier(0.2, 0, 0, 1),
    opacity 160ms ease;
}
.modal.show .modal-dialog {
  transform: none;
  opacity: 1;
}
.modal.fade {
  transition: opacity 160ms ease;
}
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.modal-backdrop.fade {
  opacity: 0;
  transition: opacity 160ms ease;
}
.modal-backdrop.show {
  opacity: 1;
}

/* Modales: centrados en viewport, scroll interno en contenido largo */
.modal {
  --app-modal-viewport-gap: 1rem;
  --app-modal-radius: 20px;
  --app-modal-pad-x: 1.25rem;
  --bs-modal-transition: 160ms;
  --bs-modal-border-radius: var(--app-modal-radius);
  --bs-modal-border-color: rgba(15, 23, 42, 0.08);
  --bs-modal-box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.06);
  --bs-modal-header-padding: 1.05rem var(--app-modal-pad-x) 0.9rem;
  --bs-modal-footer-gap: 0.55rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.modal:not(.show) {
  overflow: hidden !important;
}
.modal.show {
  display: flex !important;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: var(--app-modal-viewport-gap);
  padding-bottom: var(--app-modal-viewport-gap);
}
.modal-dialog {
  max-height: calc(var(--app-frame-height, 100dvh) - (var(--app-modal-viewport-gap) * 2));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  width: 100%;
}
.modal-dialog-centered {
  min-height: 0 !important;
  align-items: stretch;
  margin-top: 0;
  margin-bottom: 0;
}
.modal-content,
.modal-content.app-modal-surface {
  border-radius: var(--app-modal-radius);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.18),
    0 2px 8px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  display: flex;
  flex-direction: column;
  max-height: calc(var(--app-frame-height, 100dvh) - (var(--app-modal-viewport-gap) * 2));
  overflow: hidden;
  width: 100%;
}
.modal-content > .modal-header,
.modal-content > .modal-footer,
.modal-content > form > .modal-footer,
.modal-content > .ticket-tabs-bar {
  flex-shrink: 0;
}
.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.modal-content > .modal-body,
.modal-content > .app-modal-scroll,
.modal-content > form > .modal-body,
.modal-content > form > .app-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-content > form > .app-modal-scroll > .modal-body {
  overflow: visible;
  flex: none;
  max-height: none;
}
.app-modal-scroll > .modal-body,
.app-modal-scroll form .modal-body {
  overflow: visible;
  flex: none;
  max-height: none;
}
@media (max-width: 575.98px) {
  .modal { --app-modal-viewport-gap: 0.75rem; --app-modal-pad-x: 1rem; }
}

/* Modales: cubren toda la pantalla de la app (viewport completo) */
body[data-authenticated] .modal.show {
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--app-frame-height, 100dvh);
  min-height: var(--app-frame-height, 100dvh);
  max-height: none;
  z-index: 1055;
}
body[data-authenticated] .modal-backdrop {
  z-index: 1050;
}

/* Desktop/tablet: aprovechar el viewport sin recortes; scroll interno en el contenido */
@media (min-width: 769px) {
  body[data-authenticated] .modal {
    --app-modal-viewport-gap: 1.25rem;
  }
  body[data-authenticated] .modal-dialog {
    width: min(100%, calc(100vw - (var(--app-modal-viewport-gap) * 2)));
    max-height: calc(var(--app-frame-height, 100dvh) - (var(--app-modal-viewport-gap) * 2));
  }
  body[data-authenticated] .modal-dialog.modal-sm {
    max-width: min(400px, calc(100vw - (var(--app-modal-viewport-gap) * 2)));
  }
  body[data-authenticated] .modal-dialog.modal-md,
  body[data-authenticated] .modal-dialog.profile-modal-dialog {
    max-width: min(560px, calc(100vw - (var(--app-modal-viewport-gap) * 2)));
  }
  body[data-authenticated] .modal-dialog.modal-lg {
    max-width: min(800px, calc(100vw - (var(--app-modal-viewport-gap) * 2)));
  }
  body[data-authenticated] .modal-dialog.modal-xl {
    max-width: min(1140px, calc(100vw - (var(--app-modal-viewport-gap) * 2)));
  }
  body[data-authenticated] .modal-content {
    max-height: calc(var(--app-frame-height, 100dvh) - (var(--app-modal-viewport-gap) * 2));
  }
}

/* Modales: patrón modular + cabecera/pie/body modernos (todos los modales) */
.modal-header,
.app-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1.05rem var(--app-modal-pad-x, 1.25rem) 0.9rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
  position: relative;
}
.modal-header::after,
.app-modal-header::after {
  content: "";
  position: absolute;
  left: var(--app-modal-pad-x, 1.25rem);
  right: var(--app-modal-pad-x, 1.25rem);
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.08), transparent);
  pointer-events: none;
  opacity: 0;
}
.modal-header .btn-close,
.app-modal-header .btn-close {
  margin: 0;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0.4rem;
  border-radius: 999px;
  opacity: 0.55;
  background-color: transparent;
  transition:
    opacity var(--speed-fast) var(--ease-out),
    background-color var(--speed-fast) var(--ease-out),
    transform var(--speed-fast) var(--ease-out);
}
.modal-header .btn-close:hover,
.app-modal-header .btn-close:hover {
  opacity: 1;
  background-color: rgba(15, 23, 42, 0.06);
  transform: scale(1.04);
}
.modal-header .btn-close:focus-visible,
.app-modal-header .btn-close:focus-visible {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.14);
}
.app-modal-header-text {
  flex: 1;
  min-width: 0;
}
.modal-title,
.app-modal-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 0.2rem;
  color: #111;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
}
.app-modal-subtitle {
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0;
  color: #6b7280;
  font-weight: 400;
}
.modal-body {
  padding: 1.15rem var(--app-modal-pad-x, 1.25rem) 1.2rem;
  background: #fff;
  color: #1f2937;
}
.modal-body .form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #111;
  margin-bottom: 0.35rem;
}
.modal-body .form-text {
  color: #6b7280;
  font-size: 0.78rem;
  line-height: 1.4;
}
.modal-body .mb-3:last-child,
.modal-body .mb-2:last-child {
  margin-bottom: 0 !important;
}
.modal-footer,
.modal-footer.app-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 0.85rem var(--app-modal-pad-x, 1.25rem) 1rem;
  gap: 0.55rem;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
  background: linear-gradient(180deg, #f8f9fb 0%, #f3f4f7 100%);
}
.modal-footer .btn,
.app-modal-footer .btn {
  min-height: 2.35rem;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-footer .btn:focus-visible,
.app-modal-footer .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}
@media (prefers-reduced-motion: reduce) {
  .modal.fade,
  .modal.fade .modal-dialog,
  .modal-backdrop.fade {
    transition: none !important;
  }
  .modal.fade .modal-dialog {
    transform: none;
    opacity: 1;
  }
}

.loader { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #000; border-top-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader { position: fixed; inset: 0; background: rgba(255,255,255,0.78); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 1; transition: opacity var(--speed-fast) var(--ease-out); flex-direction: column; }
.page-loader.hidden { opacity: 0; pointer-events: none !important; visibility: hidden; display: none !important; }
.loader-text { margin-top: 10px; font-size: 14px; color: #000; letter-spacing: 0.2px; }

.page-enter { opacity: 0; transform: translateY(6px); }
.page-enter-active { opacity: 1; transform: translateY(0); transition: opacity var(--speed-page) var(--ease-out), transform var(--speed-page) var(--ease-out); }

/* ── Login moderno (dos paneles) ───────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding:
    max(1.5rem, var(--safe-top))
    max(1rem, var(--safe-right))
    max(2rem, var(--safe-bottom))
    max(1rem, var(--safe-left));
}
.login-card-split {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 920px;
  min-height: 540px;
  background: #fff;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: box-shadow var(--speed-base) var(--ease-smooth);
}
.login-card-split:hover { box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.04); transform: none; }

/* Panel de marca (oscuro) */
.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2.75rem 2.5rem;
  color: #fff;
  background: linear-gradient(155deg, #0a0a0a 0%, #1b1b1b 55%, #262626 100%);
  overflow: hidden;
}
.login-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(620px 320px at 82% -12%, rgba(255, 0, 0, 0.20), transparent 60%),
    radial-gradient(520px 420px at -12% 112%, rgba(255, 255, 255, 0.10), transparent 55%);
  pointer-events: none;
}
.login-hero-brand, .login-hero-center, .login-hero-foot { position: relative; z-index: 1; }
.login-hero-center { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 1.75rem 0; }
.login-hero-logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fff;
  border-radius: 14px;
  padding: 9px 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.30);
}
.login-hero-logo-chip img { height: 26px; width: auto; display: block; }
.login-hero-logo-chip span { font-size: 20px; font-weight: 700; color: #111; letter-spacing: 0.2px; }
.login-hero-title { font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1.15; margin: 0 0 0.7rem; }
.login-hero-subtitle { font-size: 1rem; color: rgba(255, 255, 255, 0.72); line-height: 1.55; margin: 0; max-width: 23rem; }
.login-hero-foot { display: flex; }
.login-hero-version {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.8rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
}
.login-hero-version i { font-size: 0.7rem; color: var(--accent-green); }

/* Panel de formulario */
.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 2.75rem 2.5rem; background: #fff; }
.login-form-inner { width: 100%; max-width: 22rem; }
.login-form-brand { display: none; align-items: center; justify-content: center; gap: 4px; margin-bottom: 1.5rem; }
.login-logo-sm { width: 40px; height: 40px; }
.login-form-brand .brand-text { font-size: 20px; font-weight: 700; color: #111; letter-spacing: 0.2px; }
.login-form-head { margin-bottom: 1.6rem; }
.login-form-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.03em; color: #0a0a0a; margin: 0 0 0.3rem; }
.login-form-sub { font-size: 0.92rem; color: #6b7280; margin: 0; }
.login-submit {
  border-radius: 12px;
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
}
.login-submit:hover:not(:disabled),
.login-submit:active:not(:disabled) {
  box-shadow: var(--btn-shadow-hover);
}
/* Grupos de input del login */
.login-input-group .input-group-text { background: #fafafa; border: 1px solid rgba(0, 0, 0, 0.11); border-right: 0; border-radius: 14px 0 0 14px; color: #111; }
.login-input-group .form-control { border-left: 0; border-radius: 0 14px 14px 0; }
.login-input-group .form-control:focus { border-left: 0; }
.login-input-group:focus-within .input-group-text { border-color: #111; }

/* Mostrar/ocultar contraseña */
.login-password-group .form-control { border-radius: 0; border-right: 0; }
.login-password-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.11); border-left: 0; border-radius: 0 14px 14px 0;
  background: #fafafa; color: #6b7280; padding: 0 0.85rem; cursor: pointer;
  transition: color var(--speed-base) var(--ease-smooth), background-color var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth);
}
.login-password-toggle:hover { color: #111; background: #fff; }
.login-password-group:focus-within .input-group-text,
.login-password-group:focus-within .login-password-toggle { border-color: #111; }
.login-password-group:focus-within .login-password-toggle { background: #fff; }

/* Captcha del login */
.login-captcha-group .form-control {
  border-radius: 0;
  border-right: 0;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.login-captcha-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  background: #fafafa;
  cursor: pointer;
  transition: background-color var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth);
}
.login-captcha-image:hover { background: #fff; }
.login-captcha-image img {
  display: block;
  width: 148px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}
.login-captcha-group:focus-within .input-group-text,
.login-captcha-group:focus-within .login-captcha-image {
  border-color: #111;
}
.login-captcha-group:focus-within .login-captcha-image { background: #fff; }

@media (max-width: 767.98px) {
  .login-hero { display: none; }
  .login-card-split {
    grid-template-columns: 1fr;
    min-height: 0;
    max-width: 26rem;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  }
  .login-form-panel { padding: 1.75rem 1.25rem 1.5rem; }
  .login-form-brand { display: flex; margin-bottom: 1.25rem; }
  .login-form-title { font-size: 1.35rem; }
  .login-form-sub { font-size: 0.88rem; }
  .login-screen {
    padding:
      max(1rem, var(--safe-top))
      max(0.75rem, var(--safe-right))
      max(1.5rem, var(--safe-bottom))
      max(0.75rem, var(--safe-left));
    align-items: flex-start;
    padding-top: max(1.5rem, calc(var(--safe-top) + 1rem));
  }
  .login-captcha-group {
    flex-wrap: wrap;
  }
  .login-captcha-group .input-group-text {
    border-radius: 14px 0 0 0;
  }
  .login-captcha-group .form-control {
    border-radius: 0 14px 0 0;
    min-width: 0;
  }
  .login-captcha-image {
    flex: 1 1 100%;
    width: 100%;
    border-left: 1px solid rgba(0, 0, 0, 0.11);
    border-top: 0;
    border-radius: 0 0 14px 14px;
    padding: 0.5rem;
    min-height: 52px;
  }
  .login-captcha-image img {
    width: min(100%, 180px);
    height: 48px;
  }
  .login-submit {
    min-height: 48px;
    font-size: 1rem;
  }
}

/* ── Tablas modernas (todas las tablas / DataTables de la app) ── */
.table {
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
  width: 100%;
}
.table > :not(caption) > * > * {
  background-color: transparent;
}
.table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6b7280;
  background: #f8f9fb;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  white-space: nowrap;
  vertical-align: middle;
}
.datatable-table > thead > tr > th:first-child,
.table thead th:first-child {
  border-top-left-radius: 10px;
}
.datatable-table > thead > tr > th:last-child,
.table thead th:last-child {
  border-top-right-radius: 10px;
}
.table tbody tr {
  background: #fff;
  transition: background-color var(--speed-base) var(--ease-smooth);
}
.table tbody tr:hover {
  background: #f7f8fa;
}
.table tbody td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  color: #1f2937;
  vertical-align: middle;
  font-size: 0.9rem;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table td,
.table th {
  padding: 0.85rem 1rem;
}
.table-responsive {
  border: none;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}
.module-table-card .datatable-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-striped > tbody > tr:nth-of-type(odd) { background-color: #fbfbfc; }
.table-hover > tbody > tr:hover { background-color: #f7f8fa; }

.datatable-wrapper {
  position: relative;
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.datatable-wrapper::after {
  content: "";
  display: table;
  clear: both;
}
.app-content .datatable-wrapper { width: 100%; overflow: visible; }
.app-content { overflow-x: hidden; }

.datatable-top,
.datatable-bottom {
  float: none !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.15rem 0 0.85rem;
  background: transparent;
  border: none;
  border-radius: 0;
  clear: both;
  width: 100%;
  box-shadow: none;
}
.datatable-top {
  margin: 0;
}
.datatable-bottom {
  margin: 0.75rem 0 0;
  padding: 0.85rem 0 0.1rem;
  justify-content: space-between;
}
.datatable-top > nav,
.datatable-top > div,
.datatable-bottom > nav,
.datatable-bottom > div {
  float: none !important;
}

.datatable-dropdown {
  order: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.datatable-perpage-label,
.datatable-dropdown label,
.datatable-top label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}
.datatable-selector,
.datatable-dropdown select,
.datatable-top select {
  width: auto;
  min-width: 4.5rem;
  height: 2.35rem;
  padding: 0.35rem 2.35rem 0.35rem 0.75rem;
  border-radius: 11px !important;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background-color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.datatable-search {
  order: 2;
  position: relative;
  margin-left: auto;
  min-width: min(280px, 100%);
  flex: 1 1 220px;
  max-width: 340px;
}
.datatable-search::before {
  content: "";
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 0.95rem;
  height: 0.95rem;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='7' cy='7' r='4.25' stroke='%236b7280' stroke-width='1.5'/%3E%3Cpath d='M10.25 10.25L13.25 13.25' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}
.datatable-input,
.datatable-search .datatable-input,
.datatable-top .datatable-input {
  width: 100%;
  min-width: 0;
  height: 2.35rem;
  padding: 0.4rem 0.95rem 0.4rem 2.35rem;
  border-radius: 11px !important;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  font-size: 0.875rem;
  color: #111;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth);
}
.datatable-input:focus,
.datatable-search .datatable-input:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.datatable-container {
  border: none;
  border-radius: 0;
  overflow-x: auto;
  overflow-y: visible;
  background: transparent;
  clear: both;
}
.datatable-container .table-responsive {
  border: none;
  border-radius: 0;
}
.datatable-table {
  margin: 0;
}
.datatable-table > thead > tr > th {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8f9fb;
  padding: 0.85rem 1rem;
}
.datatable-table > tbody > tr {
  transition: background-color var(--speed-base) var(--ease-smooth);
}
.datatable-table > tbody > tr:hover {
  transform: none;
  box-shadow: none;
  background: #f7f8fa;
}
.datatable-table > tbody > tr > td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  vertical-align: middle;
}
.datatable-table > tbody > tr:last-child > td {
  border-bottom: none;
}
.datatable-sorter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.datatable-table > thead > tr > th.has-col-filter,
.table thead th.has-col-filter {
  position: relative;
  overflow: visible;
  white-space: nowrap;
}
.datatable-table > thead > tr > th.has-col-filter .datatable-sorter,
.table thead th.has-col-filter .datatable-sorter {
  display: inline-flex;
  width: auto !important;
  max-width: calc(100% - 1.75rem);
  vertical-align: middle;
  padding-right: 0.15rem;
}
.dt-col-filter-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  margin-left: 0.1rem;
}
.dt-col-filter-btn:hover,
.dt-col-filter-btn.is-open,
.dt-col-filter-btn.is-filtered {
  background: rgba(15, 23, 42, 0.07);
  color: #111;
}
.datatable-table > thead > tr > th.is-filtered .dt-col-filter-btn,
.table thead th.is-filtered .dt-col-filter-btn {
  background: #111;
  color: #fff;
}
.dt-th-head .datatable-sorter,
.dt-th-head .datatable-filter {
  width: auto !important;
  height: auto;
  flex: 1 1 auto;
}
.dt-col-filter-pop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  min-width: 13rem;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
.dt-col-filter-pop.is-open { display: block; }
.dt-col-filter-input {
  width: 100%;
  min-width: 0;
  height: 2.15rem;
  padding: 0.35rem 0.7rem !important;
  border-radius: 10px !important;
}
.dt-col-filter-clear {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 650;
  text-align: left;
  padding: 0.15rem 0.1rem;
  cursor: pointer;
}
.dt-col-filter-clear:hover { color: #111; }

.datatable-info {
  margin: 0 !important;
  float: none !important;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.01em;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  line-height: 1.3;
  flex: 0 1 auto;
}
.datatable-pagination,
.datatable-bottom > nav {
  float: none !important;
  margin: 0 0 0 auto !important;
  margin-left: auto !important;
  flex: 0 0 auto;
}
.datatable-pagination ul,
.datatable-pagination-list {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  float: none !important;
}
.datatable-pagination li,
.datatable-pagination-list li {
  float: none !important;
  list-style: none;
  margin: 0;
}
.datatable-pagination a,
.datatable-pagination-list a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  height: 2.15rem;
  padding: 0 0.55rem;
  margin: 0 !important;
  float: none !important;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #111;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    background-color var(--speed-fast) var(--ease-out),
    border-color var(--speed-fast) var(--ease-out),
    color var(--speed-fast) var(--ease-out),
    transform var(--speed-fast) var(--ease-out);
}
.datatable-pagination a:hover,
.datatable-pagination-list a:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}
.datatable-pagination .datatable-active a,
.datatable-pagination .datatable-active a:focus,
.datatable-pagination .datatable-active a:hover,
.datatable-pagination-list li.datatable-active a {
  background: #111;
  border-color: #111;
  color: #fff;
  cursor: default;
}
.datatable-pagination a.datatable-ellipsis,
.datatable-pagination-list a.datatable-ellipsis {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
  min-width: 1.5rem;
}
.datatable-pagination a.datatable-ellipsis:hover,
.datatable-pagination-list a.datatable-ellipsis:hover {
  background: transparent;
  color: #6b7280;
}
.datatable-pagination .datatable-disabled a,
.datatable-pagination .datatable-disabled a:focus,
.datatable-pagination .datatable-disabled a:hover,
.datatable-pagination-list a.datatable-disabled,
.datatable-pagination-list a.datatable-disabled:hover {
  opacity: 0.38;
  cursor: not-allowed;
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #111;
  pointer-events: none;
}

@media (max-width: 576px) {
  .datatable-top,
  .datatable-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .datatable-search {
    margin-left: 0;
    max-width: none;
    width: 100%;
    flex: 1 1 auto;
  }
  .datatable-dropdown {
    width: 100%;
    justify-content: space-between;
  }
  .datatable-pagination ul,
  .datatable-pagination-list {
    justify-content: flex-end;
  }
  .datatable-pagination,
  .datatable-bottom > nav {
    width: 100%;
  }
  .datatable-info {
    text-align: left;
    width: auto;
    margin-inline: 0 !important;
  }
}

.dt-expand-col,
.dt-toggle,
.dt-row-details,
.dt-details-wrap,
.dt-details-item {
  display: none !important;
}

.help-highlight { background: #fff3cd; color: #000; padding: 0 2px; border-radius: 4px; }

/* Paleta de comandos (buscador global) */
.global-search { position: relative; display: flex; align-items: center; z-index: 1100; }
.app-cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 36px;
  width: auto;
  min-width: 0;
  padding: 0 0.28rem 0 0.45rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth);
}
.app-cmdk-trigger:hover,
.app-cmdk-trigger:focus-visible {
  background: rgba(15, 23, 42, 0.05);
  border: none;
  color: #0f172a;
  box-shadow: none;
  outline: none;
}
.app-cmdk-trigger > .bi-search { font-size: 1.05rem; flex-shrink: 0; }
.app-cmdk-trigger-label { display: none; }
.app-cmdk-trigger-keys { display: inline-flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }
@media (min-width: 769px) {
  .app-cmdk-trigger { width: auto; }
}
.app-cmdk-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.25rem;
  padding: 0 0.32rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: #64748b;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1;
}
.app-cmdk {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2600;
  align-items: flex-start;
  justify-content: center;
  padding: min(16vh, 7.5rem) 1rem 1.5rem;
}
.app-cmdk.is-open { display: flex !important; }
.app-cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.app-cmdk-dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.22),
    0 2px 8px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  animation: cmdkIn var(--speed-page) var(--ease-out);
}
@keyframes cmdkIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.app-cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}
.app-cmdk-input-icon { font-size: 1.15rem; color: #94a3b8; }
.app-cmdk-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 550;
  color: #0f172a;
  line-height: 1.4;
}
.app-cmdk-input::placeholder { color: #94a3b8; font-weight: 450; }
.app-cmdk-input::-webkit-search-decoration,
.app-cmdk-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.app-cmdk-esc {
  flex-shrink: 0;
  min-width: 2rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-cmdk-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.45rem 0.45rem 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.app-cmdk-group {
  padding: 0.35rem 0.35rem 0.15rem;
}
.app-cmdk-group + .app-cmdk-group { margin-top: 0.15rem; }
.app-cmdk-group-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}
.app-cmdk-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.62rem 0.7rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.app-cmdk-item:hover,
.app-cmdk-item.is-active,
.app-cmdk-item:focus {
  background: #f4f5f7;
  color: inherit;
  text-decoration: none;
}
.app-cmdk-item:focus { outline: none; }
.app-cmdk-item.is-active { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06); }
.app-cmdk-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  font-size: 1rem;
}
.app-cmdk-item[data-kind="section"] .app-cmdk-item-icon {
  background: #eef1f5;
  color: #0f172a;
}
.app-cmdk-item-body { flex: 1 1 auto; min-width: 0; }
.app-cmdk-item-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-cmdk-item-meta {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-cmdk-item-go {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  opacity: 0;
}
.app-cmdk-item.is-active .app-cmdk-item-go { opacity: 1; color: #0f172a; }
.app-cmdk-mark {
  background: rgba(16, 185, 129, 0.22);
  color: inherit;
  padding: 0 1px;
  border-radius: 3px;
  font-weight: 750;
}
.app-cmdk-empty {
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: #64748b;
}
.app-cmdk-empty i { display: block; font-size: 1.5rem; color: #cbd5e1; margin-bottom: 0.5rem; }
.app-cmdk-empty strong { display: block; color: #0f172a; font-size: 0.95rem; margin-bottom: 0.2rem; }
.app-cmdk-empty p { margin: 0; font-size: 0.8rem; max-width: 22rem; margin-left: auto; margin-right: auto; }
.app-cmdk-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #94a3b8;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.app-cmdk-footer .app-cmdk-kbd { min-width: 1.2rem; height: 1.15rem; font-size: 0.64rem; }
body.app-cmdk-open { overflow: hidden; }

.app-sidebar .dropdown-menu { position: absolute; }
@media (max-width: 768px) {
  :root { --app-topbar-height: 56px; }

  /*
    Shell móvil a pantalla completa (inset:0).
    Elimina la franja gris inferior por 100svh/safe-area incompleto.
  */
  html:has(body[data-authenticated]) {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
  }
  body[data-authenticated] {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg);
  }
  body[data-authenticated] .app-shell {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    box-sizing: border-box;
  }
  body[data-authenticated] .app-body {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
  }
  body[data-authenticated] .app-content {
    flex: 1 1 auto;
    min-height: 0;
    border-top-left-radius: 0;
    background: var(--bg);
  }
  body[data-authenticated] #appTabWorkspace:not(.d-none) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
  }
  body[data-authenticated] #appTabWorkspace,
  body[data-authenticated] .app-tab-panels,
  body[data-authenticated] .app-tab-frame {
    background: var(--bg);
  }

  .app-topbar {
    z-index: 1070;
    background: #fff;
  }

  /*
    El topbar móvil (1070) quedaba ENCIMA del modal Bootstrap (1055)
    y tapaba el header. Modal/backdrop deben ir por encima del chrome.
  */
  .modal {
    z-index: 2200 !important;
  }
  .modal-backdrop {
    z-index: 2190 !important;
  }

  /*
    Drawer móvil: anclado justo debajo del topbar para que TODOS los ítems
    (Dashboard, Visita Técnica, etc.) se vean desde arriba y el botón ☰ siga usable.
  */
  .app-sidebar {
    position: fixed;
    left: 0;
    top: calc(var(--safe-top) + var(--app-topbar-height));
    right: auto;
    bottom: 0;
    width: min(300px, 88vw);
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: none;
    transform: translateX(-105%);
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1060;
    background: #fff;
    padding: 0.75rem 0.85rem 0.85rem;
    box-shadow: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
  .app-sidebar .nav {
    flex: 0 0 auto;
    overflow: visible;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 16px 0 48px rgba(15, 23, 42, 0.22);
  }
  .app-sidebar-collapse {
    display: none !important;
  }
  .app-sidebar .mt-auto {
    display: none !important;
  }

  .sidebar-backdrop {
    position: fixed !important;
    top: calc(var(--safe-top) + var(--app-topbar-height)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: 1055;
    background: rgba(15, 23, 42, 0.22);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }
  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
  body.sidebar-mobile-open {
    overflow: hidden;
  }
  /* Solo bloquear toques mientras el drawer esté realmente abierto */
  body.sidebar-mobile-open:has(.app-sidebar.mobile-open) .app-content,
  body.sidebar-mobile-open:has(.app-sidebar.mobile-open) #appTabWorkspace {
    pointer-events: none;
  }

  .app-content { position: static; z-index: auto; border-top-left-radius: 0; }
  .app-topbar-inner {
    gap: 0.35rem;
    padding: 0 max(0.65rem, var(--safe-right)) 0 max(0.35rem, var(--safe-left));
  }
  .app-topbar-right { gap: 0.2rem; }
  .app-topbar-username { display: none; }
  .app-topbar-brand { gap: 8px; }
  .app-topbar-brand .brand-logo { width: 48px; height: 48px; }
  .app-topbar-brand .brand-text { font-size: 1.05rem; font-weight: 700; }
  .app-topbar-user .btn-ghost { padding: 0.25rem; }
  .user-menu-avatar { width: 30px; height: 30px; }
  .app-cmdk-trigger {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
    background: transparent;
    border-color: transparent;
  }
  .app-cmdk-trigger-label,
  .app-cmdk-trigger-keys { display: none; }
  .app-cmdk {
    padding: max(0.65rem, var(--safe-top)) max(0.65rem, var(--safe-right)) max(0.65rem, var(--safe-bottom)) max(0.65rem, var(--safe-left));
    align-items: flex-start;
  }
  .app-cmdk-dialog {
    width: 100%;
    max-height: calc(var(--app-frame-height, 100dvh) - 1.3rem);
    border-radius: 16px;
  }
  .app-cmdk-footer { display: none; }
}
@media (max-width: 576px) {
  .app-cmdk-input { font-size: 1rem; }
}

/* PWA standalone: stage completo a altura de pantalla */
@media (display-mode: standalone) {
  html,
  body[data-authenticated] {
    background: var(--bg);
  }
  body[data-authenticated] .app-shell,
  body[data-authenticated] .app-body {
    background: var(--bg);
  }
  body[data-authenticated] .app-topbar,
  body[data-authenticated] .app-sidebar {
    background: #fff;
  }
  body[data-authenticated] .app-content,
  body[data-authenticated] #appTabWorkspace,
  body[data-authenticated] .app-tab-panels {
    background: var(--bg);
  }
}

/* iOS: mismo anclaje a pantalla completa (sin hueco bajo el home indicator). */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    html:has(body[data-authenticated]),
    body[data-authenticated] {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      max-height: none;
      overflow: hidden;
      background: var(--bg);
    }
  }
}

.pwa-install-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
}

.pwa-install-guide-lead {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.85rem;
}
.pwa-install-steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: #374151;
}
.pwa-install-steps li {
  margin-bottom: 0.65rem;
  line-height: 1.45;
  font-size: 0.875rem;
  padding-left: 0.25rem;
}
.pwa-install-steps li:last-child {
  margin-bottom: 0;
}
.pwa-install-note {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
  padding: 0.7rem 0.85rem;
  background: #f5f6f8;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 10px;
}
#pwaInstallNativeBlock {
  padding: 0.85rem 1rem;
  background: #f8f9fb;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
}

/* Campana de notificaciones (topbar, antes de buscar) */
.app-notif { position: relative; flex-shrink: 0; }
.app-notif-toggle {
  position: relative;
  min-width: 44px;
  min-height: 44px;
}
.app-notif-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}
.app-notif-menu {
  width: min(22rem, calc(100vw - 1.25rem));
  max-width: 22rem;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.app-notif-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
}
.app-notif-mark-all {
  text-decoration: none;
  color: #334155;
  white-space: nowrap;
}
.app-notif-mark-all:hover { color: #0f172a; text-decoration: underline; }
.app-notif-list {
  max-height: min(22rem, 55vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-notif-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}
.app-notif-item:last-child { border-bottom: none; }
.app-notif-item:hover { background: rgba(15, 23, 42, 0.04); color: inherit; }
.app-notif-item.is-unread { background: rgba(37, 99, 235, 0.06); }
.app-notif-item.is-unread:hover { background: rgba(37, 99, 235, 0.1); }
.app-notif-item-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.15rem;
}
.app-notif-item-body {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}
.app-notif-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.72rem;
  color: #94a3b8;
}
.app-notif-empty { padding: 1.25rem 1rem !important; }

.btn-icon,
.app-topbar-toggle {
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}


@media (prefers-reduced-motion: reduce) {
  *:not(.notyf__toast):not(.notyf__toast--disappear):not(.notyf__progress) {
    animation: none !important;
    transition: none !important;
  }
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--speed-slow) var(--ease-out), backdrop-filter var(--speed-slow) var(--ease-out);
  z-index: 1055;
}
.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Móvil: drawer debajo del topbar (ítems visibles desde arriba) */
@media (max-width: 768px) {
  .app-sidebar {
    top: calc(var(--safe-top) + var(--app-topbar-height)) !important;
    bottom: 0 !important;
    height: auto !important;
    max-height: none !important;
    z-index: 1060;
    padding-top: 0.75rem;
  }
  .sidebar-backdrop {
    top: calc(var(--safe-top) + var(--app-topbar-height)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    z-index: 1055;
  }
}

/* Notyf: siempre visible sobre chrome, modales y PWA */
.notyf {
  position: fixed !important;
  top: var(--toast-offset-top, calc(var(--app-topbar-height) + env(safe-area-inset-top, 0px) + 8px)) !important;
  right: max(1rem, env(safe-area-inset-right, 0px)) !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 3000 !important;
  max-width: min(24rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.notyf .notyf__toast {
  pointer-events: auto;
}

/* Ayuda: colores coherentes con la app */
.help-tabs .nav-link { color: #111; background: transparent; border-radius: 12px; padding: 0.5rem 0.75rem; transition: background-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth); }
.help-tabs .nav-link:hover { background: rgba(15, 23, 42, 0.06); color: #0f172a; transform: none; }
.help-tabs .nav-link.active { background: #000; color: #fff; box-shadow: var(--elev-1); }
.help-tabs .nav-link.active:hover { background: #111; color: #fff; }

/* Workspace compartido (Ayuda / Core) — rediseño hub */
.hub-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.hub-shell {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  overflow: hidden;
  min-height: 32rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.hub-shell-body,
.module-workspace-body {
  display: grid;
  grid-template-columns: minmax(200px, 232px) minmax(0, 1fr);
  gap: 0;
  min-height: 32rem;
}
.hub-rail,
.module-workspace-nav {
  padding: 1.25rem 0.85rem 1.35rem;
  background: #fafbfc;
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  align-self: stretch;
}
.hub-rail-label,
.module-workspace-nav-label {
  margin: 0 0 0.65rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.hub-rail-nav.module-side-nav,
.hub-shell .module-side-nav {
  background: transparent;
  border: none;
  padding: 0;
  gap: 2px;
}
.hub-rail-item.module-side-nav-link,
.hub-shell .module-side-nav-link {
  min-height: 42px;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  color: #475569;
  background: transparent;
}
.hub-rail-item.module-side-nav-link:hover,
.hub-shell .module-side-nav-link:hover:not(.active) {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.06);
  transform: none;
}
.hub-rail-item.module-side-nav-link.active,
.hub-shell .module-side-nav-link.active {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.hub-rail-item.module-side-nav-link.active .hub-rail-icon,
.hub-rail-item.module-side-nav-link.active .module-side-nav-icon,
.hub-shell .module-side-nav-link.active .module-side-nav-icon {
  background: #111;
  color: #fff;
  transform: none;
}
.hub-rail-item.module-side-nav-link.active::before,
.hub-shell .module-side-nav-link.active::before {
  display: none;
}
.hub-rail-icon.module-side-nav-icon,
.hub-shell .module-side-nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
}
.hub-stage,
.module-workspace-main {
  padding: 1.5rem 1.65rem 1.85rem;
  min-width: 0;
  background: #fff;
}
.hub-stage-head,
.module-pane-intro {
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.hub-stage-kicker {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.hub-stage-title,
.module-pane-title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.25;
}
.hub-stage-lead,
.module-pane-summary {
  margin: 0;
  max-width: 46rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #64748b;
}
.hub-empty-perm,
.module-workspace-empty-perm {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.9rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
}
.hub-guide-list.accordion {
  --bs-accordion-border-width: 0;
  --bs-accordion-btn-padding-x: 0;
  --bs-accordion-btn-padding-y: 0;
  --bs-accordion-body-padding-x: 0;
  --bs-accordion-body-padding-y: 0;
}
.hub-guide-item.accordion-item,
.hub-shell .help-accordion-item,
.hub-shell .hub-guide-item {
  margin-top: 0.65rem;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
  background: #fff;
  box-shadow: none !important;
  overflow: hidden;
}
.hub-guide-item.accordion-item + .hub-guide-item.accordion-item,
.hub-guide-list .accordion-item + .accordion-item {
  margin-top: 0.65rem;
}
.hub-guide-toggle.accordion-button,
.hub-shell .hub-guide-toggle {
  gap: 0.75rem;
  padding: 0.95rem 1.05rem !important;
  background: #fff !important;
  color: #0f172a !important;
  font-weight: 650;
  box-shadow: none !important;
}
.hub-guide-toggle.accordion-button:not(.collapsed),
.hub-shell .hub-guide-toggle:not(.collapsed) {
  background: #fafbfc !important;
}
.hub-guide-num,
.hub-shell .help-accordion-index {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hub-guide-toggle:not(.collapsed) .hub-guide-num,
.hub-guide-toggle:not(.collapsed) .help-accordion-index {
  background: #111;
  color: #fff;
}
.hub-guide-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  line-height: 1.3;
}
.hub-guide-body,
.hub-shell .accordion-body {
  padding: 0 1.05rem 1.15rem !important;
}
.hub-perm,
.hub-shell .help-section-perm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.78rem;
  color: #64748b;
}
.hub-steps,
.hub-shell .help-section-steps {
  list-style: none;
  counter-reset: hub-step;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.hub-step,
.hub-shell .help-section-step {
  position: relative;
  padding: 0.85rem 0.95rem 0.85rem 3rem;
  margin: 0;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.05);
  color: #334155;
  line-height: 1.55;
}
.hub-step::before,
.hub-shell .help-section-step::before {
  counter-increment: hub-step;
  content: counter(hub-step);
  position: absolute;
  left: 0.75rem;
  top: 0.9rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hub-notes,
.hub-shell .help-section-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.hub-note,
.hub-shell .help-section-note {
  position: relative;
  padding-left: 1.1rem;
  margin: 0;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
}
.hub-note::before,
.hub-shell .help-section-note::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}
.hub-prose {
  margin: 0;
  color: #475569;
  line-height: 1.55;
}
.hub-rail-item.module-side-nav-link .module-side-nav-label,
.hub-rail-item.module-side-nav-link .hub-rail-text {
  flex: 1;
  min-width: 0;
}
.help-rail-count {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hub-rail-item.module-side-nav-link.active .help-rail-count {
  background: #111;
  color: #fff;
}

/* Menú Guías (Ayuda): lista clara, ítem activo igual al resto */
#helpWorkspace .hub-shell-body {
  grid-template-columns: minmax(228px, 256px) minmax(0, 1fr);
}
.help-guides-rail {
  padding: 1.15rem 0.85rem 1.35rem;
  background: #f8fafc;
}
.help-guides-head {
  margin: 0 0.4rem 0.9rem;
}
.help-guides-head .hub-rail-label {
  margin: 0;
}
.help-guides-hint {
  margin: 0.28rem 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: #94a3b8;
  line-height: 1.35;
}
.help-guides-rail .hub-rail-nav.module-side-nav {
  gap: 4px;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link {
  min-height: 44px;
  padding: 0.4rem 0.45rem 0.4rem 0.4rem;
  gap: 0.65rem;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #0f172a;
  font-weight: 600;
  background: transparent;
  box-shadow: none;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link::before {
  display: none;
}
.help-guides-rail .hub-rail-item .hub-rail-icon,
.help-guides-rail .hub-rail-item .module-side-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.95rem;
}
.help-guides-rail .help-rail-count {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link:hover:not(.active) {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link:hover:not(.active) .hub-rail-icon,
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link:hover:not(.active) .module-side-nav-icon {
  background: #fff;
  color: #111;
  border-color: rgba(15, 23, 42, 0.12);
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link.active {
  background: #111;
  border-color: #111;
  color: #fff;
  box-shadow: none;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link.active .hub-rail-icon,
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link.active .module-side-nav-icon {
  background: rgba(255, 255, 255, 0.14);
  border-color: transparent;
  color: #fff;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link.active .help-rail-count {
  background: #fff;
  color: #111;
}
.help-guides-rail .hub-rail-item.nav-link.module-side-nav-link.active:hover {
  background: #111;
  color: #fff;
}
@media (max-width: 767.98px) {
  #helpWorkspace .hub-shell-body {
    grid-template-columns: 1fr;
  }
  .help-guides-head {
    margin: 0 0 0.75rem;
  }
  .help-guides-rail .hub-rail-item.nav-link.module-side-nav-link {
    min-height: 40px;
  }
}
.help-module-count {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.15rem;
}
.help-toc-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.4rem 0.7rem 0.4rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #334155;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
  transition: background-color var(--speed-fast) var(--ease-out), border-color var(--speed-fast) var(--ease-out), color var(--speed-fast) var(--ease-out);
}
.help-toc-item:hover {
  background: #fff;
  border-color: #111;
  color: #0f172a;
}
.help-toc-num {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-toc-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.help-card {
  scroll-margin-top: 1rem;
}
.help-card-num {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.help-block-label {
  margin: 0 0 0.55rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.help-card .hub-perm {
  display: inline-flex;
  margin: 0;
}
.help-section-step strong,
.help-section-note strong,
.help-module-summary strong {
  font-weight: 750;
  color: #0f172a;
}
.module-workspace {
  padding: 0;
  overflow: hidden;
  min-height: 28rem;
}
.module-search-group .input-group-text {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #64748b;
}
.module-search-group .form-control {
  border-color: rgba(15, 23, 42, 0.12);
}
.module-search-group .form-control:focus {
  border-color: rgba(15, 23, 42, 0.35);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.module-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 22rem;
  padding: 2.5rem 1.5rem;
}
.module-search-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}
.module-search-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.module-search-empty-hint {
  margin: 0;
  font-size: 0.875rem;
  color: #94a3b8;
}
.hub-shell.is-search-empty .hub-shell-body,
.module-workspace.is-search-empty .module-workspace-body,
.hub-shell.is-search-empty .module-workspace-body {
  display: none;
}
.hub-shell.is-search-empty .module-search-empty,
.module-workspace.is-search-empty .module-search-empty {
  display: flex;
}
.sys-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.sys-overview-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.07);
}
@media (max-width: 767.98px) {
  .hub-shell-body,
  .module-workspace-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hub-rail,
  .module-workspace-nav {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding: 1rem;
  }
  .hub-rail-nav.module-side-nav,
  .hub-shell .module-side-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hub-rail-nav.module-side-nav::-webkit-scrollbar { display: none; }
  .hub-rail-item.module-side-nav-link,
  .hub-shell .module-side-nav-link {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }
  .hub-stage,
  .module-workspace-main {
    padding: 1.15rem 1rem 1.35rem;
  }
  .sys-overview {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 575.98px) {
  .sys-overview {
    grid-template-columns: 1fr;
  }
}

/* Legacy aliases kept for JS/CSS compatibility */
.module-workspace-nav .module-side-nav {
  background: transparent;
  border: none;
  padding: 0;
}
.tab-pane.module-pane-filtered-out {
  display: none !important;
}
@media (min-width: 768px) {
  .hub-rail.module-side-nav-wrap,
  .module-workspace-nav.module-side-nav-wrap {
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - 6rem);
    overflow: auto;
  }
}

/* Navegación lateral interna (Core, Ayuda) — base */
.module-side-nav-wrap {
  align-self: flex-start;
  min-width: 0;
}
@media (min-width: 769px) {
  .module-side-nav-wrap {
    position: sticky;
    top: 0.75rem;
  }
}
.module-side-nav .nav-link.module-side-nav-link {
  color: #475569;
  background: transparent;
}
.module-side-nav .nav-link.module-side-nav-link:hover {
  color: #0f172a;
  background: #fff;
}
.module-side-nav .nav-link.module-side-nav-link.active {
  color: #0f172a;
  background: #fff;
}
.module-side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.07);
}
.module-side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth),
    border-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth);
}
.module-side-nav-link:focus,
.module-side-nav-link:active {
  outline: none;
  box-shadow: none;
}
.module-side-nav-link:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.35);
  outline-offset: 1px;
}
.module-side-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth);
}
.module-side-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.module-side-nav-link:hover {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  transform: none;
}
.module-side-nav-link:hover .module-side-nav-icon {
  background: rgba(15, 23, 42, 0.09);
  color: #111;
}
.module-side-nav-link.active {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  position: relative;
}
.module-side-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: #111;
}
.module-side-nav-link.active .module-side-nav-icon {
  background: #111;
  color: #fff;
}
@media (max-width: 768px) {
  .module-side-nav-wrap {
    position: static;
    margin-bottom: 0.65rem;
  }
  .module-side-nav {
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.4rem;
    gap: 0.35rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .module-side-nav::-webkit-scrollbar { display: none; }
  .module-side-nav-link {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    min-height: 40px;
    padding: 0.4rem 0.7rem 0.4rem 0.55rem;
    scroll-snap-align: start;
  }
  .module-side-nav-link.active::before {
    top: 6px;
    bottom: 6px;
  }
  .module-side-nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.85rem;
  }
  .module-side-nav-label {
    font-size: 0.8125rem;
  }
}
.help-accordion .accordion-button { background: #fff; color: #111; }
.help-accordion .accordion-button:not(.collapsed) { background: #fafafa; color: #111; box-shadow: none; }
.help-accordion .accordion-button:focus { box-shadow: none; border-color: #0000; }
.help-module-title { font-weight: 700; color: #0f172a; }
.help-module-summary { font-size: 0.9375rem; line-height: 1.55; }
.help-accordion-item { border-color: rgba(15, 23, 42, 0.08); overflow: hidden; }
.help-accordion .accordion-button { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.help-accordion-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.07);
  color: #111;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.help-accordion .accordion-button:not(.collapsed) .help-accordion-index {
  background: #111;
  color: #fff;
}
.help-section-steps {
  list-style: none;
  counter-reset: help-step;
  padding-left: 0;
  margin: 0;
}
.help-section-step {
  position: relative;
  padding-left: 2.35rem;
  margin-bottom: 0.85rem;
  line-height: 1.55;
  color: #334155;
}
.help-section-step:last-child { margin-bottom: 0; }
.help-section-step::before {
  counter-increment: help-step;
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-section-notes {
  list-style: none;
  padding-left: 0;
}
.help-section-note {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
}
.help-section-note:last-child { margin-bottom: 0; }
.help-section-note::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}
.help-section-perm {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.accordion-item { border-radius: 14px; border: 1px solid rgba(0,0,0,0.06); overflow: hidden; box-shadow: var(--elev-1); transition: transform var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-smooth); }
.accordion-item + .accordion-item { margin-top: 10px; }
.accordion-button { font-weight: 600; transition: background-color var(--speed-base) var(--ease-out), color var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out); }
.accordion-button:not(.collapsed) { background-color: #f7f7f8; }
.accordion-button:focus { border-color: transparent; box-shadow: 0 0 0 4px rgba(0,0,0,0.08); }
.accordion-button::after {
  transition: transform var(--speed-slow) var(--ease-out), filter var(--speed-base) var(--ease-out);
}
.accordion-collapse.collapsing {
  transition: height var(--speed-slow) var(--ease-out);
}

.core-app-accordion .accordion-button { background: #fff; color: #111; gap: 0.35rem; }
.core-app-accordion .accordion-button:not(.collapsed) { background: #fafafa; color: #111; box-shadow: none; }
.core-app-accordion .accordion-button:focus { box-shadow: none; border-color: transparent; }
.core-app-accordion .accordion-button .core-app-acc-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  font-size: 1rem;
  flex-shrink: 0;
}
.core-app-accordion .accordion-button:not(.collapsed) .core-app-acc-icon { background: #111; color: #fff; }
.core-app-accordion .accordion-body { padding: 1.25rem 1.35rem 1.35rem; }
.core-app-preview {
  background: linear-gradient(180deg, #f8f9fa 0%, #f3f4f6 100%);
  border-color: rgba(0, 0, 0, 0.08) !important;
}
.core-app-form-actions {
  margin-top: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Core: ajustes tipo panel moderno */
.core-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.core-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.core-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: #fff;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.core-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.05rem;
}
.core-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  flex-shrink: 0;
  font-size: 1.05rem;
}
.core-card-title {
  margin: 0 0 0.15rem;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.core-card-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}
.core-card-body { min-width: 0; }
.core-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem 1rem;
}
.core-field { min-width: 0; }
.core-field--wide { grid-column: 1 / -1; }
.core-field .form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}
.core-brand-hero {
  margin: -0.15rem 0 1.15rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.core-brand-hero-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.core-brand-hero-suffix {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.15;
}
.core-brand-hero-meta {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: #64748b;
}
.core-brand-hero-hint {
  margin-top: 0.7rem;
  font-size: 0.75rem;
  color: #94a3b8;
}
.core-drop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.core-drop-form { min-width: 0; }
.core-drop {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1.5px dashed rgba(15, 23, 42, 0.16);
  border-radius: 14px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color var(--speed-base) var(--ease-out), background-color var(--speed-base) var(--ease-out), transform var(--speed-fast) var(--ease-out);
}
.core-drop:hover,
.core-drop.is-over {
  border-color: #111;
  background: #fff;
}
.core-drop-preview {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.core-drop-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.core-drop-preview--favicon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
.core-drop-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.core-drop-copy strong {
  font-size: 0.88rem;
  color: #0f172a;
}
.core-drop-copy span {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.35;
}
.core-drop-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.core-drop-reset { margin: 0; }
.core-switch-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.1rem;
}
.core-switch {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  cursor: pointer;
  position: relative;
}
.core-switch--card { background: #fff; }
.core-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.core-switch-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex-shrink: 0;
  margin-top: 0.1rem;
  transition: background-color var(--speed-base) var(--ease-out);
}
.core-switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform var(--speed-base) var(--ease-out);
}
.core-switch-input:checked + .core-switch-ui { background: #111; }
.core-switch-input:checked + .core-switch-ui::after { transform: translateX(18px); }
.core-switch-input:focus-visible + .core-switch-ui {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.18);
}
.core-switch-copy { min-width: 0; }
.core-switch-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}
.core-switch-hint {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
}
.core-password {
  position: relative;
}
.core-password .form-control { padding-right: 2.75rem; }
.core-password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 10px;
}
.core-password-toggle:hover { color: #0f172a; background: rgba(15, 23, 42, 0.06); }
.core-test-bar {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}
.core-test-bar .form-control { flex: 1 1 auto; }
.core-test-bar .btn { flex-shrink: 0; white-space: nowrap; }
.core-compose {
  min-height: 9rem;
  resize: vertical;
}
.core-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.85rem;
  border-left: 2px solid rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.core-timeline-item {
  position: relative;
  padding-left: 1.15rem;
}
.core-timeline-dot {
  position: absolute;
  left: -0.95rem;
  top: 1.15rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 0 0 4px #fff;
}
.core-timeline-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  background: #fff;
}
.core-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.45rem;
}
.core-timeline-from,
.core-timeline-date {
  font-size: 0.75rem;
  color: #94a3b8;
}
.core-timeline-desc {
  margin: 0 0 0.45rem;
  white-space: pre-wrap;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.5;
}
.core-timeline-who {
  font-size: 0.78rem;
  color: #64748b;
}
.core-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #64748b;
  border: 1px dashed rgba(15, 23, 42, 0.14);
  border-radius: 16px;
}
.core-empty i {
  font-size: 1.75rem;
  display: block;
  margin-bottom: 0.65rem;
  color: #94a3b8;
}
@media (max-width: 767.98px) {
  .core-fields,
  .core-drop-grid {
    grid-template-columns: 1fr;
  }
  .core-test-bar {
    flex-direction: column;
  }
}
 
.metric-card { display: flex; align-items: center; gap: 12px; }
.metric-card .metric-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; box-shadow: var(--elev-1); font-size: 1.25rem; }
.metric-card .metric-label { color: #111; font-weight: 500; }
.metric-card .metric-value { font-size: 2rem; line-height: 1; }
.metric-users .metric-icon { background: #3b82f6; }
.metric-roles .metric-icon { background: #10b981; }
.metric-permissions .metric-icon { background: #f59e0b; }
.metric-modules .metric-icon { background: #6366f1; }
.metric-audit .metric-icon { background: #ef4444; }
.metric-messages .metric-icon { background: #6b7280; }

/* ─── Encabezado de página (Dashboard y módulos) ─── */
.dash-page { display: flex; flex-direction: column; gap: 1.25rem; }
.dash-page-header,
.module-page-header {
  padding: 1.1rem 1.35rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.module-page-header--actions { position: relative; z-index: 1100; }
.module-page-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.dash-page-header-main,
.module-page-header-main { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.module-page-head-text { min-width: 0; }
.dash-page-icon,
.module-page-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: #111;
  color: #fff; font-size: 1.35rem; flex-shrink: 0;
  box-shadow: none;
}
.dash-page-title,
.module-page-title { font-size: 1.28rem; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 0.12rem; color: #0f172a; }
.dash-page-subtitle,
.module-page-subtitle { margin: 0; font-size: 0.88rem; color: #64748b; line-height: 1.45; }
.module-page-header-actions { flex-shrink: 0; }
.module-page-header-search { width: min(100%, 360px); flex-shrink: 0; }
.module-page-header-actions:has(.core-autosave-status) {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}
.core-autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #64748b;
  line-height: 1.2;
  user-select: none;
}
.core-autosave-status[data-state="idle"] {
  display: none;
}
.core-autosave-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.core-autosave-status[data-state="pending"] { color: #334155; }
.core-autosave-status[data-state="pending"] .core-autosave-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
  animation: coreAutosavePulse 1.1s var(--ease-out, ease) infinite;
}
.core-autosave-status[data-state="saved"] { color: #047857; }
.core-autosave-status[data-state="saved"] .core-autosave-dot { background: #10b981; }
.core-autosave-status[data-state="error"] { color: #b91c1c; }
.core-autosave-status[data-state="error"] .core-autosave-dot { background: #ef4444; }
.core-autosave-status[data-state="wait"] { color: #92400e; }
.core-autosave-status[data-state="wait"] .core-autosave-dot { background: #f59e0b; }
@keyframes coreAutosavePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .core-autosave-status[data-state="pending"] .core-autosave-dot { animation: none; }
}
@media (max-width: 640px) {
  .module-page-header-inner { flex-direction: column; align-items: stretch; }
  .module-page-header-actions,
  .module-page-header-search { align-self: stretch; width: 100%; max-width: none; }
}

.dash-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.75rem;
}
.dash-highlight {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth);
}
a.dash-highlight:hover {
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transform: none;
  color: inherit;
}
.dash-highlight-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #111;
  color: #fff;
  font-size: 1rem;
}
.dash-highlight--info .dash-highlight-icon { background: #2563eb; }
.dash-highlight--warn .dash-highlight-icon { background: #c2410c; }
.dash-highlight--danger .dash-highlight-icon { background: #be123c; }
.dash-highlight-body { min-width: 0; }
.dash-highlight-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.dash-highlight-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 0.15rem;
}
.dash-highlight-hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

.dash-highlight--ok .dash-highlight-icon { background: #047857; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 1.25rem;
}
.dash-grid-item {
  min-width: 0;
  container-type: inline-size;
  container-name: dashcard;
}

.dash-module-card {
  --dash-accent: #2563eb;
  --dash-accent-2: #2563eb;
  --dash-accent-soft: rgba(37, 99, 235, 0.1);
  --dash-accent-glow: rgba(37, 99, 235, 0.16);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 1.2rem 1.2rem 1.05rem;
  opacity: 0;
  transform: translateY(8px);
  transition: transform var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out),
    opacity var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-out);
}
.dash-module-card[data-dash-module="users"] {
  --dash-accent: #2563eb; --dash-accent-2: #2563eb;
  --dash-accent-soft: rgba(37, 99, 235, 0.1); --dash-accent-glow: rgba(37, 99, 235, 0.16);
}
.dash-module-card[data-dash-module="roles"] {
  --dash-accent: #059669; --dash-accent-2: #059669;
  --dash-accent-soft: rgba(5, 150, 105, 0.1); --dash-accent-glow: rgba(5, 150, 105, 0.16);
}
.dash-module-card[data-dash-module="core"] {
  --dash-accent: #334155; --dash-accent-2: #334155;
  --dash-accent-soft: rgba(51, 65, 85, 0.1); --dash-accent-glow: rgba(51, 65, 85, 0.16);
}
.dash-module-card[data-dash-module="audit"] {
  --dash-accent: #be123c; --dash-accent-2: #be123c;
  --dash-accent-soft: rgba(190, 18, 60, 0.1); --dash-accent-glow: rgba(190, 18, 60, 0.16);
}
.dash-module-card[data-dash-module="visita_tecnica"] {
  --dash-accent: #c2410c; --dash-accent-2: #c2410c;
  --dash-accent-soft: rgba(194, 65, 12, 0.1); --dash-accent-glow: rgba(194, 65, 12, 0.16);
}
.dash-module-card[data-dash-module="sucursales"] {
  --dash-accent: #0f766e; --dash-accent-2: #0f766e;
  --dash-accent-soft: rgba(15, 118, 110, 0.1); --dash-accent-glow: rgba(15, 118, 110, 0.16);
}
.dash-module-card[data-dash-module="administracion"] {
  --dash-accent: #1e3a5f; --dash-accent-2: #1e3a5f;
  --dash-accent-soft: rgba(30, 58, 95, 0.1); --dash-accent-glow: rgba(30, 58, 95, 0.16);
}
.dash-module-card[data-dash-module="terceros"],
.dash-module-card[data-dash-module="form_tec"] {
  --dash-accent: #111111; --dash-accent-2: #111111;
  --dash-accent-soft: rgba(17, 17, 17, 0.08); --dash-accent-glow: rgba(17, 17, 17, 0.14);
}
.dash-module-card[data-dash-module="pass_segura"] {
  --dash-accent: #0f766e; --dash-accent-2: #0f766e;
  --dash-accent-soft: rgba(15, 118, 110, 0.1); --dash-accent-glow: rgba(15, 118, 110, 0.16);
}
.dash-module-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--dash-accent);
  opacity: 1;
}
.dash-module-card:hover {
  transform: translateY(0);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.07);
}
.dash-module-card.is-visible { opacity: 1; transform: translateY(0); }

.dash-module-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 1rem;
}
.dash-module-title-wrap { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.dash-module-icon-wrap {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--dash-accent);
  color: #fff; box-shadow: none;
}
.dash-module-icon { font-size: 1.2rem; line-height: 1; }
.dash-module-title-block { min-width: 0; }
.dash-module-title {
  font-weight: 800; font-size: 1.08rem; letter-spacing: -0.02em;
  color: #0f172a; line-height: 1.2; margin-bottom: 0.2rem;
}
.dash-module-summary { color: #64748b; font-size: 0.84rem; line-height: 1.4; }
.dash-status {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--dash-accent-soft); color: var(--dash-accent);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.dash-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dash-accent); box-shadow: 0 0 0 3px var(--dash-accent-soft);
}

.dash-metrics { display: grid; gap: 10px; margin-bottom: 1rem; }
.dash-metrics--single { grid-template-columns: 1fr; }
.dash-metrics--multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-metrics--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.dash-stat {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  padding: 12px 14px; border-radius: 12px;
  background: #f8f9fb;
  border: 1px solid rgba(15, 23, 42, 0.07);
  transition: border-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth);
}
.dash-module-card:hover .dash-stat { border-color: rgba(15, 23, 42, 0.1); box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05); }
.dash-stat--hero { padding: 16px 18px; }
.dash-stat--hero .dash-stat-value { font-size: 2rem; }
.dash-stat-icon-wrap {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--dash-accent-soft); color: var(--dash-accent);
}
.dash-stat--hero .dash-stat-icon-wrap { width: 46px; height: 46px; border-radius: 12px; }
.dash-stat-icon { font-size: 1.1rem; line-height: 1; }
.dash-stat--hero .dash-stat-icon { font-size: 1.25rem; }
.dash-stat-body { min-width: 0; flex: 1; }
.dash-stat-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: #94a3b8; margin-bottom: 2px;
}
.dash-stat-value {
  font-size: 1.5rem; font-weight: 800; color: #0f172a;
  line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.dash-stat-hint { font-size: 0.78rem; color: #64748b; line-height: 1.3; margin-top: 4px; }

.dash-insight {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; margin-bottom: 1rem; border-radius: 12px;
  background: var(--dash-accent-soft);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dash-insight-icon { flex-shrink: 0; font-size: 1rem; color: var(--dash-accent); margin-top: 2px; }
.dash-insight-text { margin: 0; font-size: 0.84rem; line-height: 1.5; color: #475569; font-weight: 500; }

.dash-body-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1rem; align-items: stretch; margin-top: 2px;
  min-width: 0;
}
.dash-split-chart,
.dash-split-detail { min-width: 0; }

.dash-chart-wrap {
  border-radius: 14px;
  padding: 14px 14px 10px;
  background: #f8f9fb;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: none;
  min-width: 0;
}
.dash-chart-caption {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #94a3b8; margin-bottom: 10px;
}
.dash-chart {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 200px;
  min-height: 160px;
}
.dash-chart--horizontal { height: min(280px, 42vw); min-height: 200px; }
.dash-split-chart .dash-chart { height: 210px; }
.dash-split-chart .dash-chart--horizontal { height: 240px; }
/*
 * Chart.js controla el tamaño del <canvas> vía atributos width/height.
 * NO forzar width/height en CSS (!important rompe el dibujo y deja cajas vacías).
 */
.dash-chart-canvas {
  display: block;
  max-width: 100%;
}
.dash-chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}
.dash-chart-fallback--empty {
  min-height: 160px;
  padding: 1.25rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dash-detail-panel {
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  background: #fafbfc;
  padding: 1rem 1.1rem; min-height: 100px; height: 100%;
  min-width: 0;
  overflow: hidden;
}
.dash-detail-heading {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #94a3b8; margin: 0 0 12px 0;
}
.dash-detail-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-width: 0; }
.dash-detail-col { min-width: 0; }
.dash-breakdown-list { margin-bottom: 0; min-width: 0; }
.dash-minirow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, 1.2fr) max-content;
  gap: 8px; align-items: center; font-size: 0.8rem;
  margin-bottom: 11px;
  min-width: 0;
  animation: dashRowIn 0.5s var(--ease-smooth) both;
  animation-delay: var(--dash-row-delay, 0ms);
}
@keyframes dashRowIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.dash-minirow:last-child { margin-bottom: 0; }
.dash-minirow-label {
  color: #334155; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.dash-minirow-bar-wrap {
  height: 8px; background: rgba(15, 23, 42, 0.07);
  border-radius: 999px; overflow: hidden;
  min-width: 0;
}
.dash-minirow-bar {
  height: 100%; border-radius: 999px; max-width: 100%;
  background: var(--dash-accent);
  box-shadow: none;
  transition: width 1s var(--ease-emphasized);
}
.dash-minirow-val {
  font-weight: 700; font-variant-numeric: tabular-nums;
  color: #0f172a; text-align: right; font-size: 0.78rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-minirow-pct {
  display: block;
  font-size: 0.65rem;
  font-weight: 650;
  color: #94a3b8;
}
.dash-trend {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 56px;
  margin: 0 0 12px;
}
.dash-trend-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.dash-trend-bar-track {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.dash-trend-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--dash-accent);
  opacity: 0.85;
}
.dash-trend-lab {
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.dash-detail-foot { font-size: 0.82rem; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(15, 23, 42, 0.08); }
.dash-detail-facts li {
  padding: 0.45rem 0; border-bottom: 1px dashed rgba(15, 23, 42, 0.07);
  font-size: 0.86rem; color: #475569;
}
.dash-detail-facts li:last-child { border-bottom: none; }

.dash-card-footer {
  margin-top: auto; padding-top: 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
  display: flex; justify-content: flex-end;
}
.dash-card-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 0.86rem; color: #fff; text-decoration: none;
  padding: 9px 16px; border-radius: 10px;
  background: var(--dash-accent);
  box-shadow: none;
  transition: transform var(--speed-base) var(--ease-smooth), background-color var(--speed-base) var(--ease-smooth), opacity var(--speed-base) var(--ease-smooth);
}
.dash-card-link:hover {
  color: #fff;
  transform: none;
  box-shadow: none;
}
.dash-card-link:focus-visible { outline: 2px solid var(--dash-accent); outline-offset: 2px; }
.dash-card-link-ico { font-size: 1.2rem; line-height: 1; color: inherit; }
.dash-card-link:hover .dash-card-link-ico { transform: none; color: inherit; }

@container dashcard (max-width: 560px) {
  .dash-metrics--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-body-split { grid-template-columns: 1fr; }
  .dash-detail-two-col { grid-template-columns: 1fr; }
  .dash-module-head { flex-wrap: wrap; }
  .dash-status { margin-left: auto; }
  .dash-chart { height: 190px; min-height: 160px; }
  .dash-chart--horizontal { height: 210px; min-height: 180px; }
  .dash-split-chart .dash-chart,
  .dash-split-chart .dash-chart--horizontal { height: 200px; }
  .dash-stat-value { font-size: 1.28rem; }
  .dash-stat-hint { display: none; }
  .dash-insight { margin-bottom: 0.85rem; }
}
@container dashcard (max-width: 420px) {
  .dash-metrics--three,
  .dash-metrics--multi { grid-template-columns: 1fr; }
  .dash-module-head { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .dash-status { margin-left: 0; align-self: flex-start; }
  .dash-minirow {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas: "label val" "bar bar";
  }
  .dash-minirow-label { grid-area: label; }
  .dash-minirow-bar-wrap { grid-area: bar; }
  .dash-minirow-val { grid-area: val; }
  .dash-chart { height: 170px; }
  .dash-chart--horizontal { height: 190px; min-height: 160px; }
  .dash-card-footer { justify-content: stretch; }
  .dash-card-link { width: 100%; justify-content: center; }
}

.dash-empty-state {
  text-align: center; padding: 3rem 1.5rem; border-radius: 20px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--elev-1);
}
.dash-empty-state--error .dash-empty-icon { background: rgba(225, 29, 72, 0.1); color: #e11d48; }
.dash-empty-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.06); color: #64748b; font-size: 1.5rem;
}
.dash-empty-title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin-bottom: 0.35rem; }
.dash-empty-text { color: #64748b; margin: 0; font-size: 0.9rem; }

.dash-skeleton-card {
  border-radius: 20px; padding: 1.35rem; background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
}
.dash-skeleton-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 1rem 0; }
.dash-skeleton-chart { height: 140px; margin-top: 0.5rem; }
.dash-skeleton-card .skeleton-line,
.dash-skeleton .skeleton-line {
  height: 12px; border-radius: 8px;
  background: linear-gradient(90deg, rgba(15,23,42,0.05) 0%, rgba(15,23,42,0.1) 50%, rgba(15,23,42,0.05) 100%);
  background-size: 200% 100%; animation: skeleton 1.2s ease-in-out infinite; margin-bottom: 12px;
}
.dash-skeleton-card .skeleton-line:last-child { margin-bottom: 0; }
.dash-skeleton-card .w-40 { width: 40%; }
.dash-skeleton-card .w-70 { width: 70%; }
.dash-skeleton-card .w-100 { width: 100%; }
/* Core — salud de BD (vista agregada, sin listar tablas) */
.core-db-health .core-db-metric-card {
  border-radius: 14px;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(0, 0, 0, 0.07);
  background: linear-gradient(165deg, #fafafa 0%, #fff 55%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.045);
  transition: box-shadow var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth), transform var(--speed-base) var(--ease-smooth);
}
.core-db-health .core-db-metric-card:hover {
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: var(--elev-1);
  transform: none;
}
.core-db-metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}
.core-db-metric-value { color: #111; }
.core-db-metric-hint {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #6b7280;
}
.core-db-badge-soft {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
}
.core-db-progress {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.core-db-progress .progress-bar {
  transition: width 0.85s var(--ease-emphasized);
}
.core-db-stat-chip {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.core-db-log-list li { padding: 0.2rem 0; border-bottom: 1px dashed rgba(0, 0, 0, 0.06); }
.core-db-log-list li:last-child { border-bottom: none; }

@keyframes skeleton { 0% { background-position: 0% 50%; } 100% { background-position: -200% 50%; } }

.icon-modern { font-size: 1.15rem; transition: transform var(--speed-fast) var(--ease-out), color var(--speed-fast) var(--ease-smooth); }
.alert {
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--speed-base) var(--ease-out), transform var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-smooth), opacity var(--speed-base) var(--ease-out);
  animation: alertIn var(--speed-slow) var(--ease-out) both;
}
.alert:hover { box-shadow: var(--shadow-soft); transform: none; }
@keyframes alertIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notyf__toast {
  -webkit-border-radius: 16px;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  position: relative;
  background: var(--notyf-bg, #3b82f6);
}
.notyf__toast:not(.notyf__toast--disappear) {
  animation: toastIn 180ms var(--ease-out);
}
.notyf__toast.notyf__toast--disappear {
  animation: notyf-fadeoutdown 0.3s ease forwards;
  animation-delay: 0s;
}
.notyf__toast.notyf__toast--disappear .notyf__message,
.notyf__toast.notyf__toast--disappear .notyf__icon,
.notyf__toast.notyf__toast--disappear .notyf__dismiss {
  animation: none;
  opacity: 1;
  transform: none;
}
.notyf__message { font-weight: 600; color: #fff; }
.notyf__dismiss-btn { position: absolute; right: 0; top: 0; left: auto; margin: 0; padding: 0; width: 44px; height: 44px; color: rgba(255,255,255,0.85); background: transparent; border: none; opacity: 0.9; display: flex; align-items: center; justify-content: center; z-index: 2; transition: opacity var(--speed-fast) var(--ease-out), color var(--speed-fast) var(--ease-out); }
.notyf__dismiss-btn:hover { opacity: 1; color: #fff; transform: none; }
.notyf__dismiss-btn svg { width: 16px; height: 16px; }
.notyf__toast .notyf__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--notyf-bar, #ffffff);
  transform-origin: left;
  pointer-events: none;
}
.notyf__toast:not(.notyf__toast--disappear) .notyf__progress {
  animation: notyfProgress var(--notyf-duration, 5000ms) linear forwards;
}
.notyf__ripple { display: none; }
@keyframes notyfProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.badge { border-radius: 999px; padding: 0.32em 0.7em; font-weight: 650; letter-spacing: 0.01em; font-size: 0.72rem; transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth); }
.page-link { border-radius: 12px; border: 1px solid rgba(15, 23, 42, 0.1); color: #0f172a; background: #fff; transition: background-color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth); }
.page-link:hover { background-color: #111; border-color: #111; transform: none; box-shadow: var(--btn-shadow-hover); color: #fff; }
.page-item.active .page-link { background-color: #111; border-color: #111; color: #fff; }
.page-item.active .page-link:hover { background-color: #111; border-color: #111; color: #fff; }
.nav-pills .nav-link { border-radius: 12px; transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth), box-shadow var(--speed-base) var(--ease-smooth); }
.nav-pills .nav-link:hover { background-color: rgba(15, 23, 42, 0.06); color: #0f172a; transform: none; }
.nav-pills .nav-link.active { background-color: #111; color: #fff; box-shadow: none; }
.nav-pills .nav-link.active:hover { background-color: #111; color: #fff; }
.breadcrumb { background: transparent; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }
.pagination { gap: 6px; }
.list-group-item { border-radius: 12px; border: 1px solid rgba(15, 23, 42, 0.08); margin-bottom: 8px; box-shadow: none; transition: background-color var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth); }
.list-group-item:hover { transform: none; box-shadow: none; background-color: #f8fafc; }
.progress { border-radius: 999px; height: 8px; background-color: rgba(0,0,0,0.06); overflow: hidden; }
.progress-bar { background-color: #000; transition: width var(--speed-slow) var(--ease-out); }
.offcanvas { border-left: 1px solid rgba(0,0,0,0.06); box-shadow: var(--shadow-strong); transition: transform var(--speed-slow) var(--ease-out); }
.tooltip-inner { border-radius: 10px; padding: 0.4rem 0.6rem; box-shadow: var(--elev-1); }
.popover { border-radius: 14px; border: 1px solid rgba(0,0,0,0.06); box-shadow: var(--elev-2); }
.popover-header { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.06); font-weight: 600; }
.popover-body { color: #333; }

/* ── Visita técnica: previews de adjuntos ─────────────────── */
.visita-scope-hint { margin-top: -0.15rem; }
.visita-adjuntos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.visita-adjunto-thumb {
  width: 88px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-decoration: none;
  color: #475569;
}
.visita-adjunto-thumb img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  display: block;
}
.visita-adjunto-thumb--broken img {
  opacity: 0;
}
.visita-adjunto-thumb--broken {
  position: relative;
}
.visita-adjunto-thumb--broken::before {
  content: '';
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' fill='%94a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'/%3E%3Cpath d='M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z'/%3E%3C/svg%3E") center/28px no-repeat;
}
.visita-adjunto-thumb span {
  font-size: 0.68rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 88px;
}
.visita-adjunto-thumb--link:hover img {
  border-color: #111;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.visita-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.visita-detail-hero {
  padding-bottom: 0.15rem;
}
.visita-detail-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}
.visita-detail-ref {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.visita-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.visita-detail-badges .badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.4em 0.7em;
}
.visita-detail-asunto {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
  word-break: break-word;
}
.visita-detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.visita-detail-fact {
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.visita-detail-fact--wide {
  grid-column: 1 / -1;
}
.visita-detail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.28rem;
}
.visita-detail-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
  line-height: 1.35;
}
.visita-detail-section {
  margin: 0;
}
.visita-detail-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #475569;
}
.visita-detail-desc,
.visita-detail-panel {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.visita-detail-panel {
  padding: 0.35rem 0.25rem;
}
.visita-detail-panel .text-muted {
  padding: 0.55rem 0.75rem !important;
}
.visita-detail-empty {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed rgba(15, 23, 42, 0.12);
  color: #64748b;
  font-size: 0.875rem;
}
.admin-notas-historial {
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.visita-notas-thread .admin-nota-item {
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.45rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
  border-left-width: 3px;
  border-left-style: solid;
}
.visita-notas-thread .admin-nota-item:last-child {
  margin-bottom: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.admin-nota-item--solicitante { border-left-color: #0284c7; background: #f0f9ff; }
.admin-nota-item--asignado,
.admin-nota-item--gestion { border-left-color: #111827; background: #f8fafc; }
.admin-nota-item {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.admin-nota-item:last-child { border-bottom: none; }
.admin-nota-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.3rem;
}
.admin-nota-rol {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
}
.admin-nota-item--solicitante .admin-nota-rol {
  color: #0369a1;
  background: rgba(2, 132, 199, 0.12);
}
.admin-nota-who {
  font-weight: 600;
  color: #64748b;
}
.admin-nota-body {
  font-size: 0.9rem;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Modal ticket (alineado al patrón app-modal-*) ── */
.ticket-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.ticket-header-row .app-modal-title {
  margin-bottom: 0;
}
.ticket-status-badge,
.ticket-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.ticket-status--abierta,
.ticket-prio--baja { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.ticket-status--proceso { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.ticket-status--resuelto { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.ticket-status--cerrada { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.ticket-status--default { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.ticket-prio--media { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.ticket-prio--alta { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.ticket-prio--urgente { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.ticket-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ticket-tabs::-webkit-scrollbar { display: none; }
.ticket-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.7rem 0.95rem;
  background: transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.ticket-tabs .nav-link:hover {
  color: #111;
  border-color: transparent;
}
.ticket-tabs .nav-link.active {
  color: #111;
  background: transparent;
  border-bottom-color: #111;
}

/* Barra de pestañas: nunca se comprime dentro del modal flex/scrollable */
.ticket-tabs-bar {
  flex: 0 0 auto;
  flex-shrink: 0 !important;
  min-height: 2.75rem;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  overflow: visible;
}
.modal-content > .ticket-tabs-bar {
  flex-shrink: 0 !important;
}
.ticket-tabs-bar .ticket-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.25rem;
  margin: 0;
  padding: 0.35rem 0.85rem 0;
  border-bottom: none;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.ticket-tabs-bar .ticket-tabs .nav-item {
  flex: 0 0 auto;
}
.ticket-tabs-bar .ticket-tabs .nav-link {
  min-height: 2.35rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}
@media (max-width: 768px) {
  .ticket-tabs-bar {
    min-height: 3rem;
    background: #fafafa;
  }
  .ticket-tabs-bar .ticket-tabs {
    padding: 0.45rem 0.75rem 0.35rem;
    gap: 0.4rem;
  }
  .ticket-tabs-bar .ticket-tabs .nav-link {
    min-height: 2.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 650;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    background: #fff;
    color: #4b5563;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }
  .ticket-tabs-bar .ticket-tabs .nav-link:hover {
    color: #111;
    border-color: rgba(0, 0, 0, 0.14);
  }
  .ticket-tabs-bar .ticket-tabs .nav-link.active {
    color: #fff;
    background: #111;
    border-color: #111;
    border-bottom-color: #111;
    box-shadow: none;
  }
}

.ticket-modal-body {
  background: #fff;
}
.ticket-conv-thread {
  min-height: 0;
}
.ticket-conv-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0.15rem 0 0.7rem;
}
.ticket-mail-msg {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.ticket-mail-msg:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.ticket-mail-msg-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.ticket-mail-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}
.ticket-mail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.ticket-mail-autor {
  font-weight: 650;
  color: #111;
  font-size: 0.9rem;
}
.ticket-mail-fecha {
  font-size: 0.75rem;
  color: #9ca3af;
}
.ticket-mail-bubble {
  margin-left: 2.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #111;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-mail-adjuntos {
  margin: 0.55rem 0 0 2.5rem;
}
.ticket-mail-adjuntos-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.3rem;
}
.ticket-mail-adjuntos-empty {
  font-size: 0.85rem;
  color: #9ca3af;
}
.ticket-conv-empty {
  margin: 0;
  font-size: 0.875rem;
}
.ticket-reply-box {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 1rem;
  background: transparent;
}
.ticket-conv-closed-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.4;
}
.ticket-conv-closed-notice.d-none { display: none !important; }
.ticket-conv-closed-notice i { margin-top: 0.1rem; flex-shrink: 0; }
.ticket-reply-as {
  font-size: 0.875rem;
  color: #6b7280;
}
.ticket-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.ticket-detail-card {
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
}
.ticket-detail-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.3rem;
}
.ticket-detail-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: #111;
  word-break: break-word;
}
.ticket-activity-list {
  position: relative;
  padding-left: 0.15rem;
}
.ticket-activity-day {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin: 0.25rem 0 0.65rem;
}
.ticket-activity-item {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  gap: 0.65rem;
  position: relative;
  padding: 0 0 1rem 0.45rem;
  border-left: 2px solid #e5e7eb;
  margin-left: 0.3rem;
}
.ticket-activity-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0.3rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #9ca3af;
}
.ticket-activity-item--latest::before {
  border-color: #111;
  background: #111;
}
.ticket-activity-time {
  font-size: 0.75rem;
  color: #9ca3af;
  padding-top: 0.1rem;
}
.ticket-activity-who {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111;
  margin-bottom: 0.3rem;
}
.ticket-activity-msg {
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 0.875rem;
  color: #111;
  line-height: 1.45;
}
@media (max-width: 576px) {
  .ticket-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .ticket-details-grid {
    grid-template-columns: 1fr;
  }
  .ticket-mail-bubble,
  .ticket-mail-adjuntos {
    margin-left: 0;
  }
  .ticket-activity-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .ticket-reply-box .btn-dark {
    width: 100%;
  }
  #visitaNuevaNota,
  #adminVisitaNuevaNota {
    min-height: 4.5rem;
  }
}
@media (max-width: 576px) {
  .visita-detail-facts {
    grid-template-columns: 1fr;
  }
  .visita-detail-fact--wide {
    grid-column: auto;
  }
  .visita-detail-asunto {
    font-size: 1.08rem;
  }
}
@media (max-width: 768px) {
  .visita-adjunto-thumb,
  .visita-adjunto-thumb img { width: 76px; height: 76px; }
  .visita-adjunto-thumb span { max-width: 76px; }
  .visita-adjunto-thumb--broken::before { width: 76px; height: 76px; }
}

/* ── Páginas de error (coherentes con login / marca) ───────── */
.error-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 2rem);
  padding:
    max(1.25rem, var(--safe-top))
    max(0.85rem, var(--safe-right))
    max(1.5rem, var(--safe-bottom))
    max(0.85rem, var(--safe-left));
}
body[data-authenticated] .error-screen--in-app {
  min-height: min(70dvh, 560px);
  padding: 1.25rem 0.5rem;
}
.error-card {
  width: 100%;
  max-width: 26rem;
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.10), 0 2px 8px rgba(15, 23, 42, 0.04);
}
.error-card:hover { transform: none; }
.error-card-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1.35rem;
}
.error-card-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.error-card-brand .brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111;
}
.error-card-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #111 0%, #374151 100%);
  color: #fff;
  font-size: 1.65rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}
.error-card-code {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.error-card-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.25;
}
.error-card-message {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
}
.error-card-hint {
  margin: 0 0 1.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.84rem;
  line-height: 1.45;
  color: #64748b;
  text-align: left;
}
.error-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}
.error-card-actions .btn {
  min-height: 44px;
  flex: 1 1 auto;
  min-width: 8.5rem;
}

/* ═══════════════════════════════════════════════════════════
   Experiencia móvil (≤768px) — densidad, touch y legibilidad
   Alineado con el drawer JS (max-width: 768px).
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Contenido y espaciado general */
  .app-main-content,
  body.app-embed .embed-main {
    padding-left: max(0.75rem, var(--safe-left));
    padding-right: max(0.75rem, var(--safe-right));
    /* Sin franja vacía tipo footer: el safe-area lo absorbe el shell/panel */
    padding-bottom: 0.75rem;
  }

  /* Altura completa: el fondo del stage (--bg) llena el viewport; chrome (topbar/sidebar) en blanco */
  body[data-authenticated],
  body[data-authenticated] .app-shell,
  body[data-authenticated] .app-body,
  body.app-embed,
  html:has(body.app-embed),
  html:has(body[data-authenticated]) {
    background: var(--bg);
  }
  body[data-authenticated] .app-topbar,
  body[data-authenticated] .app-sidebar {
    background: #fff;
  }
  body[data-authenticated] .app-content,
  body[data-authenticated] #appTabWorkspace,
  body[data-authenticated] .app-tab-panels,
  body[data-authenticated] .app-tab-frame,
  body[data-authenticated] .app-tab-bar {
    background: var(--bg);
  }
  body[data-authenticated] .app-shell {
    padding-bottom: 0;
  }
  /* Safe-area dentro del scroll; el módulo llena el iframe */
  body.app-embed .embed-main {
    padding-bottom: max(0.75rem, var(--safe-bottom));
    min-height: 100%;
    box-sizing: border-box;
    background: var(--bg);
  }
  /* Embed móvil (legado): mismos modales centrados que el resto de la app. */
  body.app-embed .modal,
  body.app-embed .modal.show {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: var(--app-frame-height, 100dvh) !important;
    min-height: 0 !important;
    max-height: none !important;
    z-index: 2200 !important;
    padding: max(0.75rem, var(--safe-top, 0px)) max(0.75rem, var(--safe-right, 0px)) max(0.75rem, var(--safe-bottom, 0px)) max(0.75rem, var(--safe-left, 0px)) !important;
    margin: 0 !important;
    background: transparent !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    align-items: center !important;
    justify-content: center !important;
  }
  /* Modal abierto: el documento no hace scroll (evita hueco gris bajo el teclado). */
  html:has(body.app-embed.modal-open),
  body.app-embed.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
    height: 100% !important;
    max-height: 100% !important;
  }
  body.app-embed.modal-open .embed-main {
    overflow: hidden !important;
  }
  body.app-embed {
    background: var(--bg);
  }
  html:has(body.app-embed) {
    background: var(--bg);
  }
  body.app-embed .embed-main {
    background: var(--bg);
  }
  body.app-embed .modal-backdrop {
    z-index: 2190 !important;
  }
  .row.g-4 {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.85rem;
  }
  .row.g-3 {
    --bs-gutter-x: 0.7rem;
    --bs-gutter-y: 0.7rem;
  }

  /* Cards: ganar a utilidades Bootstrap p-4 / p-3 */
  .card-modern,
  .card.card-modern.p-4,
  .card.card-modern.p-3,
  .card.p-4 {
    padding: 0.9rem !important;
    border-radius: 16px;
  }
  .card-modern:hover,
  .card:hover {
    transform: none;
  }
  .module-table-card {
    padding: 0.85rem !important;
  }

  /* Encabezados de módulo / dashboard */
  .dash-page { gap: 0.9rem; }
  .dash-page-header,
  .module-page-header {
    padding: 0.9rem 1rem;
    border-radius: 16px;
  }
  .dash-page-icon,
  .module-page-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.15rem;
  }
  .dash-page-title,
  .module-page-title {
    font-size: 1.15rem;
    line-height: 1.25;
  }
  .dash-page-subtitle,
  .module-page-subtitle {
    font-size: 0.8rem;
    line-height: 1.4;
  }
  .module-page-header-main,
  .dash-page-header-main {
    gap: 0.75rem;
  }
  .module-page-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .module-page-header-actions,
  .module-page-header-search {
    align-self: stretch;
    width: 100%;
    max-width: none;
  }
  .module-page-header-actions.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }
  .module-page-header-actions .dropdown {
    width: 100%;
  }
  .module-page-header-actions .actions-dropdown-trigger,
  .module-page-header-actions.module-actions > .btn {
    width: 100%;
    height: auto;
    min-height: 44px;
    justify-content: center;
  }

  /* Pestañas */
  .app-tab-bar {
    padding: 6px 10px 0 12px;
    gap: 4px;
  }
  .app-tab {
    max-width: min(160px, 42vw);
    height: 36px;
  }
  .app-tab.active { height: 38px; }
  .app-tab-label {
    padding: 0 2px 0 8px;
    font-size: 0.75rem;
    gap: 6px;
  }
  .app-tab-icon {
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
  }
  .app-tab-close {
    opacity: 1;
    transform: scale(1);
    width: 24px;
    height: 24px;
    margin-right: 4px;
  }
  .app-tab-empty {
    padding: 2rem 1.25rem;
  }
  .app-tab-empty-icon {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
  }

  /* Sidebar nav: targets táctiles cómodos */
  .app-sidebar .nav-link {
    min-height: 48px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
  .app-sidebar-collapse {
    min-height: 44px;
  }

  /* Tablas y DataTables */
  .table {
    border-spacing: 0 4px;
    font-size: 0.875rem;
  }
  .table thead th {
    font-size: 11px;
    letter-spacing: 0.3px;
    white-space: nowrap;
  }
  .table td,
  .table th {
    padding: 0.65rem 0.7rem;
  }
  .table tbody tr:hover,
  .datatable-table > tbody > tr:hover {
    transform: none;
  }
  .datatable-top,
  .datatable-bottom {
    gap: 0.65rem;
    padding: 0.35rem 0 0.65rem;
  }
  .datatable-top .datatable-input {
    min-width: 0;
    width: 100%;
  }
  .datatable-bottom {
    flex-wrap: wrap;
    font-size: 0.8rem;
  }
  .datatable-pagination-list,
  .datatable-pagination ul {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.3rem;
  }
  .users-table-avatar-wrap {
    width: 32px;
    height: 32px;
  }
  .table td.text-end {
    white-space: nowrap;
  }
  .table td.text-end .btn-compact,
  .table-actions .btn-compact {
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
  }
  .table-actions {
    gap: 3px;
  }

  /* Dashboard */
  .dash-grid { gap: 0.9rem; }
  .dash-module-card,
  .dash-skeleton-card {
    padding: 1rem 0.95rem 0.9rem;
    border-radius: 16px;
  }
  .dash-module-card:hover {
    transform: none;
  }
  .dash-module-card.is-visible:hover {
    transform: none;
  }
  .dash-module-head { margin-bottom: 0.75rem; gap: 8px; }
  .dash-module-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
  .dash-module-icon { font-size: 1.05rem; }
  .dash-module-title { font-size: 1rem; }
  .dash-module-summary { font-size: 0.8rem; }
  .dash-metrics { gap: 8px; margin-bottom: 0.75rem; }
  .dash-stat { padding: 10px 12px; }
  .dash-stat--hero { padding: 12px 14px; }
  .dash-stat--hero .dash-stat-value { font-size: 1.65rem; }
  .dash-stat-value { font-size: 1.25rem; }
  .dash-chart { height: 160px; min-height: 150px; width: 100%; }
  .dash-chart--horizontal {
    height: 180px;
    min-height: 160px;
  }
  .dash-split-chart .dash-chart { height: 170px; min-height: 150px; }
  .dash-split-chart .dash-chart--horizontal { height: 180px; min-height: 160px; }
  .dash-insight {
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  .dash-insight-text { font-size: 0.8rem; }
  .dash-card-link {
    min-height: 44px;
    font-size: 0.875rem;
  }
  .dash-empty-state {
    padding: 2rem 1.15rem;
    border-radius: 16px;
  }
  .dash-skeleton-metrics { grid-template-columns: 1fr; }

  /* Formularios */
  .form-control,
  .form-select,
  textarea.form-control,
  .input-modern {
    font-size: 16px; /* evita zoom automático en iOS */
    padding: 0.7rem 0.9rem;
    min-height: 44px;
  }
  select.form-select,
  select.input-modern,
  select.form-control,
  .form-select {
    padding-right: 2.5rem;
  }
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
  }
  .input-group-text {
    min-height: 44px;
  }
  .btn:not(.btn-icon):not(.btn-ghost):not(.btn-compact):not(.btn-close):not(.login-password-toggle):not(.pwa-install-btn) {
    min-height: 44px;
  }
  .btn-sm:not(.btn-compact) {
    min-height: 38px;
  }
  .btn-compact {
    min-height: 40px;
    min-width: 40px;
  }
  .table td.text-end .btn-compact,
  .table-actions .btn-compact {
    min-height: 32px;
    min-width: 32px;
  }

  /*
    Modales móviles: tarjeta centrada (no pantalla completa).
    Mantiene el patrón app-modal-* del escritorio, adaptado al viewport.
  */
  .modal {
    --app-modal-viewport-gap: max(0.75rem, var(--safe-top, 0px), env(safe-area-inset-top, 0px));
    --app-modal-side-gap: max(0.75rem, var(--safe-left, 0px), env(safe-area-inset-left, 0px));
    padding-left: var(--app-modal-side-gap);
    padding-right: max(0.75rem, var(--safe-right, 0px), env(safe-area-inset-right, 0px));
  }
  .modal.show {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: var(--app-frame-height, 100dvh) !important;
    min-height: 0 !important;
    max-height: none !important;
    display: flex !important;
    align-items: center !important;
    align-items: safe center !important;
    justify-content: center !important;
    padding-top: max(0.75rem, var(--safe-top, 0px), env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(0.75rem, var(--safe-bottom, 0px), env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: transparent !important;
  }
  .modal-dialog,
  .modal-dialog-centered {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: min(88dvh, calc(var(--app-frame-height, 100dvh) - 1.5rem)) !important;
    min-height: 0 !important;
    margin: auto !important;
    transform: none !important;
  }
  .modal-dialog-scrollable {
    height: auto !important;
    max-height: min(88dvh, calc(var(--app-frame-height, 100dvh) - 1.5rem)) !important;
  }
  .modal-dialog-scrollable .modal-content {
    max-height: inherit !important;
    overflow: hidden !important;
  }
  .modal-content {
    border-radius: var(--app-modal-radius, 20px) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 22px 56px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.06) !important;
    max-height: min(88dvh, calc(var(--app-frame-height, 100dvh) - 1.5rem)) !important;
    height: auto !important;
    flex: 0 1 auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
  }
  .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .modal-content > .modal-body,
  .modal-content > form > .modal-body,
  .modal-content > .app-modal-scroll,
  .modal-content > form > .app-modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .modal-content > .modal-header,
  .modal-content > .modal-footer,
  .modal-content > form > .modal-footer,
  .modal-content > .ticket-tabs-bar {
    flex-shrink: 0;
  }
  .modal-backdrop {
    background: rgba(15, 23, 42, 0.45) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .modal-backdrop.fade {
    opacity: 0 !important;
    transition: opacity 160ms ease !important;
  }
  .modal-backdrop.show {
    opacity: 1 !important;
  }
  body.modal-open {
    overflow: hidden !important;
  }
  .app-modal-header {
    padding: 1rem var(--app-modal-pad-x, 1rem) 0.85rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    border-radius: var(--app-modal-radius, 20px) var(--app-modal-radius, 20px) 0 0;
  }
  .app-modal-title { font-size: 1.05rem; }
  .app-modal-subtitle { font-size: 0.78rem; line-height: 1.4; }
  .modal-body { padding: 1.05rem var(--app-modal-pad-x, 1rem) 1.1rem; }
  .modal-footer.app-modal-footer,
  .modal-footer {
    padding: 0.8rem var(--app-modal-pad-x, 1rem) max(0.9rem, var(--safe-bottom));
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
    background: linear-gradient(180deg, #f8f9fb 0%, #f3f4f7 100%);
    border-top: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 0 0 var(--app-modal-radius, 20px) var(--app-modal-radius, 20px);
  }
  .modal-header:not(.app-modal-header) {
    padding: 1rem var(--app-modal-pad-x, 1rem) 0.85rem;
  }
  .modal-footer:not(.app-modal-footer) {
    padding: 0.8rem var(--app-modal-pad-x, 1rem) 0.9rem;
  }
  .modal-footer.app-modal-footer .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: calc(50% - 0.25rem);
  }
  .modal-footer.app-modal-footer .btn:only-child,
  .modal-footer.app-modal-footer .btn.w-100 {
    flex: 1 1 100%;
  }
  .profile-modal-avatar {
    width: 80px;
    height: 80px;
  }
  .about-modal-logo {
    width: 56px;
    height: 56px;
  }

  /* Core / Ayuda / métricas */
  .core-app-accordion .accordion-body {
    padding: 1rem;
  }
  .core-db-health .core-db-metric-card {
    padding: 0.85rem 0.9rem;
  }
  .metric-card .metric-value {
    font-size: 1.5rem;
  }
  .help-accordion .accordion-button {
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
  }
  .nav-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-pills .nav-link {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
  }

  /* Dropdowns: área táctil */
  .dropdown-item {
    padding: 0.7rem 0.9rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .dropdown-menu {
    max-width: min(100vw - 1.5rem, 22rem);
  }

  /* Notyf en móvil: ancho completo, debajo del topbar/safe-area */
  .notyf {
    left: max(0.75rem, var(--safe-left)) !important;
    right: max(0.75rem, var(--safe-right)) !important;
    top: max(
      var(--toast-offset-top, calc(var(--app-topbar-height) + var(--safe-top) + 8px)),
      calc(var(--safe-top) + 3.75rem)
    ) !important;
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .notyf__toast {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22) !important;
  }
  .notyf__message {
    font-size: 0.9rem;
    line-height: 1.35;
    padding-right: 1.75rem;
  }

  /* Error page */
  .card-modern.text-center {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 576px) {
  .app-main-content,
  body.app-embed .embed-main {
    padding-left: max(0.65rem, var(--safe-left));
    padding-right: max(0.65rem, var(--safe-right));
  }
  .card-modern,
  .card.card-modern.p-4,
  .card.card-modern.p-3,
  .card.p-4 {
    padding: 0.75rem !important;
  }
  .module-table-card {
    padding: 0.5rem !important;
    border-radius: 14px;
  }
  .dash-page-header,
  .module-page-header {
    padding: 0.8rem 0.85rem;
  }
  .dash-metrics--multi,
  .dash-metrics--three {
    grid-template-columns: 1fr;
  }
  .modal-footer.app-modal-footer .btn {
    flex: 1 1 100%;
    min-width: 100%;
  }
  .login-form-panel {
    padding: 1.5rem 1.1rem 1.35rem;
  }
  .login-card-split {
    border-radius: 18px;
  }
  .pwa-install-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }
  .card-modern.text-center .d-flex.gap-2 {
    flex-direction: column;
    align-items: stretch;
  }
  .error-card {
    padding: 1.6rem 1.25rem 1.35rem;
    border-radius: 18px;
  }
  .error-card-actions {
    flex-direction: column;
  }
  .error-card-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Touch / sin hover fino: sin lifts que molestan al tocar */
@media (hover: none) {
  .table tbody tr:hover,
  .datatable-table > tbody > tr:hover,
  .card-modern:hover,
  .card:hover,
  .dash-module-card:hover,
  .dash-module-card.is-visible:hover,
  .list-group-item:hover,
  .page-link:hover,
  .alert:hover,
  .core-db-health .core-db-metric-card:hover,
  .core-db-metric-card:hover,
  .module-page-header:hover .module-page-icon,
  .module-side-nav-link:hover .module-side-nav-icon,
  .app-sidebar .nav-link:hover:not(.active) .bi,
  .app-sidebar .nav-link:hover:not(.active) .icon-modern,
  .btn:hover:not(:disabled) .bi,
  .btn:hover:not(:disabled) .icon-modern,
  .datatable-pagination a:hover,
  .datatable-pagination-list a:hover {
    transform: none;
  }
  .btn:hover:not(:disabled),
  .btn-icon:hover,
  .btn-ghost:hover {
    transform: none;
  }
  .module-side-nav-link:hover {
    transform: none;
  }
  .dropdown-item:hover,
  .dropdown-item:focus {
    transform: none;
  }
  .app-tab-close {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Modal detalle Tecnología / cuestionario terceros ── */
.terceros-detalle {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.terceros-detalle-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  padding: 0.95rem 1.05rem;
  background: #f8f9fb;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}
.terceros-detalle-meta-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.terceros-detalle-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6b7280;
  line-height: 1.2;
}
.terceros-detalle-meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111;
  line-height: 1.35;
}
.terceros-detalle-empty {
  text-align: center;
  color: #6b7280;
  padding: 2.5rem 1rem;
}
.terceros-detalle-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.65rem;
  opacity: 0.7;
}
.terceros-detalle-empty p {
  margin: 0;
}
.terceros-detalle-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.terceros-detalle-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.terceros-detalle-section-head h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.01em;
}
.terceros-detalle-section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}
.terceros-detalle-muted {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.45;
}
.terceros-qa-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.terceros-qa-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem 0.9rem;
  padding: 0.95rem 1rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.terceros-qa-num {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.terceros-qa-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.terceros-qa-question {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #111;
  line-height: 1.45;
}
.terceros-qa-bullets {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.45;
}
.terceros-qa-answer {
  margin: 0;
  padding: 0.7rem 0.85rem;
  background: #f4f6f8;
  border-left: 3px solid #111;
  border-radius: 0 8px 8px 0;
  font-size: 0.875rem;
  font-weight: 400;
  color: #1f2937;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.terceros-qa-empty {
  color: #9ca3af;
  font-style: italic;
}
.terceros-adjuntos-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.terceros-adjunto-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fff;
  color: #111;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.terceros-adjunto-link:hover {
  background: #f8f9fb;
  border-color: rgba(0, 0, 0, 0.16);
  color: #111;
}
.terceros-adjunto-link i {
  font-size: 1.05rem;
  flex-shrink: 0;
}
.terceros-adjunto-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.terceros-adjunto-size {
  font-size: 0.75rem;
  color: #6b7280;
  flex-shrink: 0;
}
.terceros-consent-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}
.terceros-consent-details {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  background: #fafafa;
  padding: 0.55rem 0.85rem;
}
.terceros-consent-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 600;
  list-style: none;
}
.terceros-consent-details summary::-webkit-details-marker { display: none; }
.terceros-consent-details summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 0.45rem;
  border-left: 5px solid #6b7280;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  vertical-align: 0.1em;
  transition: transform 0.15s ease;
}
.terceros-consent-details[open] summary::before {
  transform: rotate(90deg);
}
.terceros-consent-texto {
  margin-top: 0.65rem;
  padding: 0.75rem 0.85rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}
@media (max-width: 991.98px) {
  .terceros-detalle-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .terceros-detalle-meta {
    grid-template-columns: 1fr;
  }
  .terceros-qa-item {
    grid-template-columns: 1.75rem minmax(0, 1fr);
    padding: 0.8rem 0.75rem;
  }
  .terceros-qa-num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.72rem;
  }
}

.terceros-emails-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 280px;
}
.terceros-email-line {
  font-size: 0.875rem;
  line-height: 1.35;
  word-break: break-all;
}
.terceros-emails-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  margin-top: 0.15rem;
}

/* Estado del Sistema (Core) */
.sys-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.sys-overview-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.sys-overview-item i {
  font-size: 1.15rem;
  margin-top: 0.1rem;
  color: #64748b;
}
.sys-overview-item.is-ok {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.22);
}
.sys-overview-item.is-ok i { color: #059669; }
.sys-overview-item.is-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
}
.sys-overview-item.is-warn i { color: #d97706; }
.sys-overview-item.is-bad {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.22);
}
.sys-overview-item.is-bad i { color: #dc2626; }
.sys-overview-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}
.sys-overview-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.sys-log-viewer {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(15, 23, 42, 0.35);
}
.sys-log-tabs .nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
}
.sys-status-accordion .help-accordion-index {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.85rem;
}
@media (max-width: 991.98px) {
  .sys-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .sys-overview {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Motion system global — suaviza toda la UI sin cambiar lógica
   ═══════════════════════════════════════════════════════════════ */
.collapsing {
  transition: height var(--speed-slow) var(--ease-out) !important;
}

.fade:not(.show):not(.modal):not(.modal-backdrop) {
  transition: opacity var(--speed-base) var(--ease-out);
}
.tab-pane.fade {
  transition: opacity var(--speed-base) var(--ease-out), transform var(--speed-base) var(--ease-out);
}
.tab-pane.fade:not(.show) {
  opacity: 0;
  transform: translateY(4px);
}
.tab-pane.fade.show {
  opacity: 1;
  transform: translateY(0);
}

.module-side-nav-link {
  transition:
    background-color var(--speed-base) var(--ease-smooth),
    color var(--speed-base) var(--ease-smooth),
    border-color var(--speed-base) var(--ease-smooth),
    box-shadow var(--speed-base) var(--ease-out),
    transform var(--speed-fast) var(--ease-out) !important;
}
.module-side-nav-link:active:not(.active) {
  transform: scale(var(--motion-scale-press));
}
.module-side-nav-icon {
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth), transform var(--speed-fast) var(--ease-out);
}
.module-side-nav-link:hover .module-side-nav-icon {
  transform: none;
}
.module-side-nav-link.active .module-side-nav-icon {
  transform: none;
}

.module-page-icon {
  transition: transform var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out), background-color var(--speed-base) var(--ease-smooth);
}
.module-page-header:hover .module-page-icon {
  transform: translateY(var(--motion-lift-sm)) scale(1.03);
}

.table tbody tr {
  transition: background-color var(--speed-fast) var(--ease-smooth), box-shadow var(--speed-fast) var(--ease-out);
}
.table-hover > tbody > tr:hover > * {
  transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth);
}

.datatable-pagination a,
.datatable-pagination-list a,
.datatable-top select,
.datatable-bottom select,
.datatable-search input {
  transition:
    background-color var(--speed-base) var(--ease-smooth),
    border-color var(--speed-base) var(--ease-smooth),
    color var(--speed-base) var(--ease-smooth),
    box-shadow var(--speed-base) var(--ease-out),
    transform var(--speed-fast) var(--ease-out);
}
.datatable-pagination a:hover,
.datatable-pagination-list a:hover {
  transform: none;
}

.btn .bi,
.btn .icon-modern,
.nav-link .bi,
.nav-link .icon-modern {
  transition: transform var(--speed-fast) var(--ease-out), opacity var(--speed-fast) var(--ease-out);
}
.btn:hover:not(:disabled) .bi,
.btn:hover:not(:disabled) .icon-modern {
  transform: none;
}
.btn:active:not(:disabled) .bi,
.btn:active:not(:disabled) .icon-modern {
  transform: none;
}

.app-sidebar .nav-link .bi,
.app-sidebar .nav-link .icon-modern {
  transition: transform var(--speed-fast) var(--ease-out), color var(--speed-base) var(--ease-smooth);
}
.app-sidebar .nav-link:hover:not(.active) .bi,
.app-sidebar .nav-link:hover:not(.active) .icon-modern {
  transform: none;
}

.input-group-text {
  transition: background-color var(--speed-base) var(--ease-smooth), border-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth);
}
.form-check-input {
  transition: background-color var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-out), box-shadow var(--speed-fast) var(--ease-out), transform var(--speed-fast) var(--ease-out);
}
.form-check-input:active {
  transform: scale(0.94);
}

.help-highlight {
  transition: background-color var(--speed-fast) var(--ease-smooth), color var(--speed-fast) var(--ease-smooth);
}

.module-search-empty {
  animation: emptyIn var(--speed-slow) var(--ease-out) both;
}
@keyframes emptyIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.core-db-metric-card {
  transition: transform var(--speed-base) var(--ease-out), box-shadow var(--speed-base) var(--ease-out), border-color var(--speed-base) var(--ease-smooth), background-color var(--speed-base) var(--ease-smooth);
}
.core-db-metric-card:hover {
  transform: none;
}

.alert-dismissible .btn-close {
  transition: opacity var(--speed-fast) var(--ease-out), transform var(--speed-fast) var(--ease-out), background-color var(--speed-fast) var(--ease-out);
}
.alert-dismissible .btn-close:hover {
  transform: none;
}

/* ═══════════════════════════════════════════════════════════════
   Pulido visual 2026 — capa global (sin cambiar funcionalidad)
   Densidad calmada, cromo quieto, color semántico, microestados.
   ═══════════════════════════════════════════════════════════════ */
.table,
.datatable-table {
  font-variant-numeric: tabular-nums;
}
.table thead th,
.datatable-table > thead > tr > th {
  background: #f8fafc;
  color: #64748b;
  letter-spacing: 0.06em;
}
.table tbody td,
.datatable-table > tbody > tr > td {
  color: #0f172a;
}
.table tbody tr:hover,
.datatable-table > tbody > tr:hover {
  background: #f8fafc;
}
.datatable-top,
.datatable-bottom {
  background: #f8fafc;
}

.badge.bg-success {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
}
.badge.bg-danger {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
}
.badge.bg-warning,
.badge.bg-warning.text-dark {
  background-color: #fffbeb !important;
  color: #b45309 !important;
}
.badge.bg-info,
.badge.bg-info.text-dark {
  background-color: #f0f9ff !important;
  color: #0369a1 !important;
}
.badge.bg-primary {
  background-color: #eff6ff !important;
  color: #1d4ed8 !important;
}
.badge.bg-secondary {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
}
.badge.bg-dark {
  background-color: #0f172a !important;
  color: #fff !important;
}

.alert {
  border-width: 1px;
  box-shadow: none;
}
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.alert-primary { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-secondary { background: #f8fafc; border-color: #e2e8f0; color: #334155; }

.form-control,
.form-select,
textarea.form-control,
.input-modern,
.hero-select-trigger {
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: none;
}
.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled),
.hero-select-trigger:hover:not(:disabled) {
  border-color: rgba(15, 23, 42, 0.22);
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus,
.input-modern:focus,
.hero-select-trigger:focus,
.hero-select.is-open .hero-select-trigger {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.form-control[type="file"] {
  padding: 0.4rem 0.7rem;
  color: #0f172a;
}
.form-control[type="file"]::file-selector-button,
.form-control[type="file"]::-webkit-file-upload-button {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background-color: #111;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  padding: 0.4rem 0.85rem;
  margin-right: 0.75rem;
  cursor: pointer;
  pointer-events: none;
  box-shadow: none;
  transition: background-color var(--speed-base) var(--ease-smooth), color var(--speed-base) var(--ease-smooth);
}
.form-control[type="file"]:hover:not(:disabled):not([readonly])::file-selector-button,
.form-control[type="file"]:hover:not(:disabled):not([readonly])::-webkit-file-upload-button,
.form-control[type="file"]:not(:disabled):not([readonly]):hover::file-selector-button {
  background-color: #000;
  color: #fff;
}
.form-control[type="file"]:disabled::file-selector-button,
.form-control[type="file"]:disabled::-webkit-file-upload-button {
  color: #fff;
  background-color: #111;
  opacity: 0.65;
}

.btn-icon:hover .bi,
.btn-ghost:hover .bi {
  color: inherit;
}

.bi { vertical-align: -0.125em; line-height: 1; }
.btn .bi,
.nav-link .bi,
.dropdown-item .bi {
  font-size: 1.05em;
}

img.brand-logo,
img.login-logo-sm,
img.error-card-logo,
.login-hero-logo-chip img,
.terceros-publico-brand img {
  object-fit: contain;
}
.user-menu-avatar,
.users-table-avatar-wrap,
.profile-modal-avatar {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.app-topbar {
  border: none;
  border-bottom: none;
  box-shadow: none;
}
.app-sidebar {
  border: none;
  border-right: none;
}
.app-sidebar .nav-link {
  font-weight: 550;
  letter-spacing: -0.01em;
}

.btn-dark,
.btn-primary {
  background-color: #111;
  border-color: #111;
  color: #fff;
}
.btn-outline-dark {
  color: #111;
  border-color: #111;
}
.btn-outline-dark:hover:not(:disabled) {
  background-color: #111;
  border-color: #111;
  color: #fff;
}

.progress {
  background-color: #eef2f6;
  height: 8px;
}
.progress-bar.bg-success { background-color: #10b981 !important; }
.progress-bar.bg-warning { background-color: #f59e0b !important; }
.progress-bar.bg-danger { background-color: #ef4444 !important; }
.progress-bar.bg-dark { background-color: #111 !important; }

.tooltip-inner {
  background: #0f172a;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 550;
  padding: 0.4rem 0.65rem;
}
.popover {
  border-radius: 14px;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

hr { border-color: rgba(15, 23, 42, 0.08); opacity: 1; }
code, kbd, samp {
  font-size: 0.86em;
  border-radius: 6px;
}
kbd {
  background: #0f172a;
  color: #fff;
  padding: 0.15em 0.45em;
}
pre {
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.accordion-item:not(.hub-guide-item):not(.help-accordion-item) {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px !important;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.accordion-item:not(.hub-guide-item) > .accordion-button {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.accordion-item:not(.hub-guide-item) > .accordion-button:not(.collapsed) {
  background: #f8fafc;
  color: #0f172a;
  box-shadow: none;
}
.accordion-button:focus {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.spinner-border { --bs-spinner-width: 1.65rem; --bs-spinner-height: 1.65rem; }
.form-text { color: #64748b; font-size: 0.8rem; }
.invalid-feedback { font-size: 0.8rem; }
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.form-control.is-valid,
.form-select.is-valid {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.app-notif-menu {
  border-radius: 16px;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}
.app-notif-menu-header {
  background: #fff;
}
.app-notif-item {
  transition: background-color var(--speed-fast) var(--ease-smooth);
}

.visita-adjunto-thumb img {
  transition: border-color var(--speed-base) var(--ease-smooth);
}
.visita-adjunto-thumb:hover img {
  border-color: rgba(15, 23, 42, 0.22);
}

.login-submit {
  box-shadow: var(--btn-shadow-idle);
}
.login-submit:hover:not(:disabled) {
  box-shadow: var(--btn-shadow-hover);
}

.terceros-publico-body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: -0.011em;
}
.terceros-publico-state-card {
  border-radius: 20px;
}
.terceros-publico-consent-box {
  border-radius: 12px;
  background: #f8fafc;
}

.module-page-title,
.dash-page-title {
  letter-spacing: -0.035em;
}
.module-page-header:hover .module-page-icon {
  transform: none;
}

.text-muted { color: #64748b !important; }

@media (prefers-reduced-motion: reduce) {
  .page-enter,
  .page-enter-active,
  .reveal,
  .reveal.is-visible,
  .alert,
  .dropdown-menu.show,
  .module-search-empty,
  .tab-pane.fade,
  .modal.fade .modal-dialog {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .notyf__toast:not(.notyf__toast--disappear) {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .notyf__toast.notyf__toast--disappear {
    animation: none !important;
    opacity: 0 !important;
  }
  .btn:hover:not(:disabled) .bi,
  .btn:hover:not(:disabled) .icon-modern,
  .app-sidebar .nav-link:hover:not(.active) .bi,
  .module-side-nav-link:hover .module-side-nav-icon,
  .module-page-header:hover .module-page-icon {
    transform: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Producción — diseño quieto, rápido y consistente
   ═══════════════════════════════════════════════════════════════ */
body[data-authenticated] .app-topbar {
  border: none;
  border-bottom: none;
  box-shadow: none;
}
body[data-authenticated] .app-sidebar {
  border: none;
  border-right: none;
}
body[data-authenticated] .app-content {
  border-top-left-radius: var(--app-stage-radius);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.actions-dropdown-trigger {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 12px;
}
.dropdown-menu {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  padding: 0.35rem;
}
.dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-weight: 500;
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: #f4f5f7;
  color: #0f172a;
}

.hub-shell {
  border-radius: 16px;
  box-shadow: none;
}
.hub-stage-title,
.module-pane-title {
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hub-stage-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.module-table-card {
  border-radius: 16px;
  box-shadow: none;
}
.module-table-card.card-modern {
  padding: 1.1rem 1.2rem !important;
}

.datatable-top,
.datatable-bottom {
  background: transparent;
  border: none;
  padding: 0.15rem 0 0.7rem;
}
.datatable-search input {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  min-height: 38px;
}
.table thead th,
.datatable-table > thead > tr > th {
  background: #f8f9fb;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.app-modal-surface {
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.14);
}
.app-modal-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-screen {
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(255, 0, 0, 0.06), transparent 55%),
    radial-gradient(700px 380px at 100% 110%, rgba(15, 23, 42, 0.05), transparent 50%),
    var(--bg);
}
.app-login-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
}
.app-login-main .login-screen {
  width: 100%;
  flex: 1 1 auto;
}
.login-card-split {
  border-radius: 22px;
}

.core-brand-hero {
  border-radius: 14px;
  background: #f8f9fb;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.core-card {
  border-radius: 14px;
  box-shadow: none;
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

@media (max-width: 767.98px) {
  .login-card-split { border-radius: 18px; }
  .module-page-header,
  .hub-shell,
  .module-table-card { border-radius: 14px; }
}

/* ── Personalización (preferencias por usuario) ── */
.profile-modal-dialog { max-width: min(36rem, calc(100vw - 2rem)); }
.profile-tabs,
.module-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.55rem 1.25rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
}
.profile-tab,
.module-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #475569;
  font-weight: 650;
  font-size: 0.875rem;
  padding: 0.55rem 0.95rem 0.65rem;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.profile-tab:hover,
.module-tab:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #111;
}
.profile-tab.is-active,
.profile-tab.active,
.module-tab.is-active,
.module-tab.active {
  background: #111;
  color: #fff;
}
.module-tab:focus,
.module-tab:focus-visible,
.profile-tab:focus,
.profile-tab:focus-visible {
  outline: none;
  box-shadow: none;
}
.module-tab:focus-visible,
.profile-tab:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.16);
}
.module-tabs .nav-link,
.module-tabs .nav-link:hover,
.module-tabs .nav-link:focus {
  border: 0;
  box-shadow: none;
  color: #475569;
  background: transparent;
}
.module-tabs .nav-link.active,
.module-tabs .nav-link.active:hover,
.module-tabs .nav-link.active:focus {
  border: 0;
  box-shadow: none;
  color: #fff;
  background: #111;
}
.module-tab i {
  font-size: 0.95rem;
  opacity: 0.88;
  line-height: 1;
}
.module-tab.active i,
.module-tab.is-active i {
  opacity: 1;
}
.module-tab-count {
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.module-tab.active .module-tab-count,
.module-tab.is-active .module-tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.module-workspace-body--tabs {
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none !important;
  min-height: 32rem;
}
.module-workspace-body--tabs .module-tabs {
  flex: 0 0 auto;
}
.module-workspace-body--tabs .hub-stage,
.module-workspace-body--tabs .module-workspace-main {
  flex: 1 1 auto;
}
@media (max-width: 767.98px) {
  .module-tabs,
  .profile-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .module-tabs::-webkit-scrollbar,
  .profile-tabs::-webkit-scrollbar { display: none; }
  .module-tab,
  .profile-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}
.profile-prefs-form .form-label {
  font-weight: 600;
  font-size: 0.8125rem;
}
.login-lang-switch {
  display: inline-flex;
  gap: 0.25rem;
  margin-top: 1rem;
}
.login-lang-switch button {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.65rem;
  cursor: pointer;
}
.login-lang-switch button.is-current,
html[lang="en"] .login-lang-switch [data-set-lang="en"],
html[lang="es"] .login-lang-switch [data-set-lang="es"] {
  background: #111;
  color: #fff;
  border-color: #111;
}

html[data-pref-font="humanist"] { --font-sans: "Segoe UI", "Trebuchet MS", "Gill Sans", Calibri, sans-serif; }
html[data-pref-font="serif"] { --font-sans: Georgia, "Times New Roman", "Palatino Linotype", serif; }
html[data-pref-font="mono"] { --font-sans: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace; }

html[data-pref-size="sm"] { font-size: 14px; }
html[data-pref-size="md"] { font-size: 16px; }
html[data-pref-size="lg"] { font-size: 17.5px; }
html[data-pref-size="xl"] { font-size: 19px; }

html[data-pref-density="compact"] .app-main-content {
  padding-left: clamp(0.65rem, 1.2vw, 1.15rem);
  padding-right: clamp(0.65rem, 1.2vw, 1.15rem);
}
html[data-pref-density="compact"] .card-modern,
html[data-pref-density="compact"] .module-page-header,
html[data-pref-density="compact"] .module-table-card.card-modern {
  padding: 0.75rem 0.9rem !important;
}
html[data-pref-density="compact"] .table > :not(caption) > * > *,
html[data-pref-density="compact"] .datatable-table > :not(caption) > * > * {
  padding: 0.4rem 0.65rem;
}
html[data-pref-density="compact"] .btn { padding-top: 0.32rem; padding-bottom: 0.32rem; }
html[data-pref-density="compact"] .form-control,
html[data-pref-density="compact"] .form-select { min-height: 2.15rem; }

html[data-pref-contrast="high"] {
  --text: #000000;
  --text-muted: #1e293b;
  --bg: #ffffff;
  --hairline: rgba(0, 0, 0, 0.38);
}
html[data-pref-contrast="high"] .card,
html[data-pref-contrast="high"] .form-control,
html[data-pref-contrast="high"] .form-select,
html[data-pref-contrast="high"] .app-modal-surface,
html[data-pref-contrast="high"] .profile-info-card {
  border-color: #111 !important;
}
html[data-pref-contrast="high"] a { text-decoration: underline; }

html[data-pref-motion="reduced"] *,
html[data-pref-motion="reduced"] *::before,
html[data-pref-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html[data-pref-motion="system"] *,
  html[data-pref-motion="system"] *::before,
  html[data-pref-motion="system"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


