/* ECS · Sistema de diseño (base descarga-cpe, acento rojo ECS) */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f5;
  --border: #e1e6eb;
  --border-strong: #cdd5dd;
  --text: #17212b;
  --muted: #5e6b78;
  --accent: #b91c1c;
  --accent-hover: #991b1b;
  --accent-soft: #fdecec;
  --accent-solid: #b91c1c;
  --accent-solid-hover: #991b1b;
  --danger: #c2410c;
  --danger-soft: #fdeee6;
  --danger-solid: #c2410c;
  --warning: #a16207;
  --warning-soft: #fdf5dc;
  --warning-solid: #b45309;
  --success: #15803d;
  --success-soft: #e5f5ea;
  --success-solid: #15803d;
  --info: #1d4ed8;
  --info-soft: #e6edfd;
  --info-solid: #1d4ed8;
  --neutral-soft: #eef1f4;
  --neutral-solid: #5e6b78;
  --row-hover: #f1f4f7;
  --sidebar: #a40000;
  --sidebar-bg: linear-gradient(180deg, #d20000 0%, #a40000 48%, #6b2c2c 100%);
  --sidebar-text: rgb(255 255 255 / 88%);
  --sidebar-muted: rgb(255 255 255 / 62%);
  --sidebar-hover: rgb(255 255 255 / 12%);
  --sidebar-active: rgb(255 255 255 / 20%);
  --accent-gradient: linear-gradient(180deg, #d20000 0%, #a40000 100%);
  --accent-gradient-hover: linear-gradient(180deg, #b80000 0%, #860000 100%);
  --brand-line: linear-gradient(90deg, #d20000 0%, #a40000 55%, #6b2c2c 100%);
  --tooltip-bg: #111a22;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 16%);
  --backdrop: rgb(10 16 22 / 55%);
  --topbar-h: 56px;
  --sidebar-w: 240px;
  --sidebar-w-mini: 68px;
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

:root[data-theme="dark"] {
  --bg: #0f161d;
  --surface: #16212b;
  --surface-2: #1b2833;
  --surface-3: #22313d;
  --border: #2a3a47;
  --border-strong: #3a4d5e;
  --text: #e4ebf0;
  --muted: #93a3b1;
  --accent: #f87171;
  --accent-hover: #fca5a5;
  --accent-soft: #3b1a1a;
  --accent-solid: #dc2626;
  --accent-solid-hover: #b91c1c;
  --danger: #f48b5b;
  --danger-soft: #3d2219;
  --danger-solid: #c2410c;
  --warning: #e8c15a;
  --warning-soft: #3a3118;
  --warning-solid: #b45309;
  --success: #5ad08a;
  --success-soft: #173826;
  --success-solid: #15803d;
  --info: #86a8ff;
  --info-soft: #1c2a4b;
  --info-solid: #2563eb;
  --neutral-soft: #22313d;
  --neutral-solid: #4b5b69;
  --row-hover: #1f2e3a;
  --sidebar: #5e0b0b;
  --sidebar-bg: linear-gradient(180deg, #9b1111 0%, #5e0b0b 50%, #2a1214 100%);
  --accent-gradient: linear-gradient(180deg, #e02424 0%, #b91c1c 100%);
  --accent-gradient-hover: linear-gradient(180deg, #c81e1e 0%, #991b1b 100%);
  --brand-line: linear-gradient(90deg, #dc2626 0%, #9b1111 55%, #4a1515 100%);
  --tooltip-bg: #000000;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 1px 3px rgb(0 0 0 / 35%);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 45%);
  --backdrop: rgb(0 0 0 / 65%);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f161d;
    --surface: #16212b;
    --surface-2: #1b2833;
    --surface-3: #22313d;
    --border: #2a3a47;
    --border-strong: #3a4d5e;
    --text: #e4ebf0;
    --muted: #93a3b1;
    --accent: #f87171;
    --accent-hover: #fca5a5;
    --accent-soft: #3b1a1a;
    --accent-solid: #dc2626;
    --accent-solid-hover: #b91c1c;
    --danger: #f48b5b;
    --danger-soft: #3d2219;
    --danger-solid: #c2410c;
    --warning: #e8c15a;
    --warning-soft: #3a3118;
    --warning-solid: #b45309;
    --success: #5ad08a;
    --success-soft: #173826;
    --success-solid: #15803d;
    --info: #86a8ff;
    --info-soft: #1c2a4b;
    --info-solid: #2563eb;
    --neutral-soft: #22313d;
    --neutral-solid: #4b5b69;
    --row-hover: #1f2e3a;
    --sidebar: #5e0b0b;
    --sidebar-bg: linear-gradient(180deg, #9b1111 0%, #5e0b0b 50%, #2a1214 100%);
    --accent-gradient: linear-gradient(180deg, #e02424 0%, #b91c1c 100%);
    --accent-gradient-hover: linear-gradient(180deg, #c81e1e 0%, #991b1b 100%);
    --brand-line: linear-gradient(90deg, #dc2626 0%, #9b1111 55%, #4a1515 100%);
    --tooltip-bg: #000000;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 1px 3px rgb(0 0 0 / 35%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 45%);
    --backdrop: rgb(0 0 0 / 65%);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  margin: 0 0 0.5rem;
  font-weight: 620;
  line-height: 1.25;
  color: var(--text);
}
h1, .h1 { font-size: 1.6rem; font-weight: 650; }
h2, .h2 { font-size: 1.3rem; }
h3, .h3 { font-size: 1.15rem; }
h4, .h4 { font-size: 1.05rem; }
h5, .h5 { font-size: 0.98rem; }
h6, .h6 { font-size: 0.9rem; }
p {
  margin: 0 0 0.75rem;
}
ul, ol, dl {
  margin: 0 0 0.75rem;
}
b, strong {
  font-weight: 650;
}
small, .small {
  font-size: 0.85em;
}
.lead {
  font-size: 1.1rem;
}
hr {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}
img, svg {
  vertical-align: middle;
}
label {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text);
}
button {
  font: inherit;
  color: inherit;
  border-radius: 0;
}
button:not(:disabled) {
  cursor: pointer;
}
code, kbd, pre, samp, .mono {
  font-family: "Cascadia Mono", Consolas, ui-monospace, monospace;
  font-size: 0.92em;
}
pre {
  overflow: auto;
}
::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Estructura de la aplicación ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  background-image: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1035;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 15%) transparent;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 2px 8px;
  color: #fff;
}
.brand:hover {
  color: #fff;
  text-decoration: none;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-solid);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
}
.brand-text {
  min-width: 0;
  line-height: 1.2;
}
.brand-text strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.brand small,
.brand-text small {
  display: block;
  color: var(--sidebar-text);
  font-size: 0.78rem;
  white-space: nowrap;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-section {
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 10px 4px;
}
.side-link {
  color: var(--sidebar-text);
  padding: 8px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  line-height: 1.35;
  white-space: nowrap;
}
.side-link span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.side-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #fff;
}
.side-group-toggle.active {
  box-shadow: none;
}
.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  flex-shrink: 0;
}
.side-caret {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.side-group.open > .side-group-toggle .side-caret {
  transform: rotate(180deg);
}
.side-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px 14px;
}
.side-group.open > .side-sub {
  display: flex;
}
.side-sub .side-link {
  font-size: 0.93em;
  padding: 7px 10px;
}
.side-sub .nav-icon {
  font-size: 0.75rem;
}
.nav-count {
  margin-left: auto;
  background: #fff;
  color: #a40000;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
}
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sim-flag {
  background: var(--warning-solid);
  color: #fff;
  padding: 8px 10px;
  border-radius: 7px;
  text-align: center;
  font-weight: 600;
}
.sim-flag:hover {
  color: #fff;
}
.theme-switch {
  display: flex;
  gap: 2px;
  background: rgb(0 0 0 / 18%);
  border-radius: 8px;
  padding: 3px;
}
.theme-switch button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 0.8rem;
  padding: 5px 4px;
  border-radius: 6px;
}
.theme-switch button.on {
  background: rgb(255 255 255 / 22%);
  color: #fff;
  font-weight: 600;
}
.sidebar-overlay {
  display: none;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand-line);
}
.topbar-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}
.topbar-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
/* Ubicación actual: "SUNAT › Comprobantes" */
.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px;
}
.topbar-section {
  color: var(--muted);
  white-space: nowrap;
}
.topbar-sep {
  font-size: 0.6rem;
  color: var(--muted);
  opacity: 0.7;
}
.topbar-title strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buscador global de empresas */
.topbar-search {
  position: relative;
  flex: 0 1 380px;
  margin-left: auto;
  display: flex;
  align-items: center;
}
.topbar-search > i {
  position: absolute;
  left: 11px;
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}
/* Con id: la regla general de inputs tiene más especificidad que una clase */
#busquedaGlobalInput {
  width: 100%;
  height: 36px;
  padding: 0 64px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
#busquedaGlobalInput:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar-search kbd {
  position: absolute;
  right: 8px;
  font: 600 0.7rem/1 inherit;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
  pointer-events: none;
}
.topbar-search input:focus ~ kbd,
.topbar-search input:not(:placeholder-shown) ~ kbd {
  display: none;
}
.topbar-search + .topbar-nav {
  margin-left: 12px;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 70vh;
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1070;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  padding: 2px 4px 2px 2px;
}
.search-item.active,
.search-item:hover {
  background: var(--surface-2);
}
.search-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  color: var(--text);
}
.search-main:hover {
  color: var(--text);
  text-decoration: none;
}
.search-main b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-main small {
  color: var(--muted);
}
.search-actions {
  display: flex;
  gap: 2px;
}
.search-actions a {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}
.search-actions a:hover {
  background: var(--surface);
  color: var(--accent);
}
.search-empty {
  padding: 10px;
  color: var(--muted);
}
@media (max-width: 767.98px) {
  .topbar-title {
    display: none;
  }
  .topbar-search {
    flex: 1 1 auto;
    margin-left: 2px;
  }
  /* Al escribir, el buscador ocupa todo el ancho de la barra (tapa los íconos) */
  .topbar-search:focus-within {
    position: absolute;
    left: 54px;
    right: 10px;
    z-index: 5;
  }
  .topbar-search kbd {
    display: none;
  }
  #busquedaGlobalInput {
    padding-right: 10px;
  }
  .search-results {
    position: fixed;
    top: calc(var(--topbar-h) + 4px);
    left: 8px;
    right: 8px;
    min-width: 0;
  }
}
.topbar-nav {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.topbar-nav > .nav-item {
  position: relative;
}
.topbar-nav .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--muted);
}
.topbar-nav .nav-link:hover,
.topbar-nav .show > .nav-link {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.topbar-nav .nav-link > i {
  font-size: 1.02rem;
}
.topbar-nav .nav-link > .badge {
  top: 3px !important;
  right: 2px !important;
  min-width: 18px;
  padding: 1px 5px;
  border: 2px solid var(--surface);
  background: var(--accent-solid);
  color: #fff;
  font-size: 0.66rem;
  line-height: 1.25;
  text-align: center;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border);
}
.app-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1500px;
  padding: 22px 28px 40px;
}
.app-content > section.content > .container-fluid,
.app-content > .content > .container-fluid,
.app-content > .container-fluid {
  padding-left: 0;
  padding-right: 0;
}
section.content,
.content-wrapper {
  display: block;
}
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 12px 28px;
}
.app-footer::after {
  content: "";
  display: table;
  clear: both;
}

:root[data-sidebar="collapsed"] .shell {
  grid-template-columns: var(--sidebar-w-mini) minmax(0, 1fr);
}
:root[data-sidebar="collapsed"] .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}
:root[data-sidebar="collapsed"] .brand-text,
:root[data-sidebar="collapsed"] .side-link span,
:root[data-sidebar="collapsed"] .side-caret,
:root[data-sidebar="collapsed"] .side-section,
:root[data-sidebar="collapsed"] .sidebar-footer,
:root[data-sidebar="collapsed"] .nav-count {
  display: none;
}
:root[data-sidebar="collapsed"] .brand {
  justify-content: center;
  padding: 2px 0;
}
:root[data-sidebar="collapsed"] .side-link {
  justify-content: center;
  padding: 10px 0;
}
:root[data-sidebar="collapsed"] .side-sub {
  padding-left: 0;
}
:root[data-sidebar="collapsed"] .nav-icon {
  font-size: 1.05rem;
  width: auto;
}

@media (max-width: 991.98px) {
  .shell,
  :root[data-sidebar="collapsed"] .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    height: 100%;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    z-index: 1045;
  }
  :root[data-sidebar="collapsed"] .sidebar {
    padding: 16px 12px;
  }
  :root[data-sidebar="collapsed"] .brand-text,
  :root[data-sidebar="collapsed"] .side-link span,
  :root[data-sidebar="collapsed"] .side-caret,
  :root[data-sidebar="collapsed"] .side-section,
  :root[data-sidebar="collapsed"] .nav-count {
    display: revert;
  }
  :root[data-sidebar="collapsed"] .sidebar-footer {
    display: flex;
  }
  :root[data-sidebar="collapsed"] .brand,
  :root[data-sidebar="collapsed"] .side-link {
    justify-content: flex-start;
    padding: 8px 10px;
  }
  .shell.sidebar-open .sidebar {
    transform: none;
  }
  .shell.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    z-index: 1040;
  }
  .app-content {
    padding: 16px 14px 32px;
  }
  .app-footer {
    padding: 12px 14px;
  }
}

/* ---------- Pestañas de sección (varias páginas bajo una opción del menú) ---------- */
.page-tabs {
  display: flex;
  gap: 4px;
  margin: -4px 0 18px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.page-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  color: var(--muted);
  font-weight: 560;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.page-tabs a:hover {
  color: var(--text);
  text-decoration: none;
}
.page-tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Encabezado de página ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-header h1 {
  margin: 0 0 4px;
}
.page-header p {
  margin: 0;
}
.page-actions,
.card-actions,
.row-actions,
.toolbar-actions,
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.back {
  display: inline-block;
  margin-bottom: 6px;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.muted,
.text-muted {
  color: var(--muted) !important;
}
.pad {
  padding: 16px;
}
.mt {
  margin-top: 12px;
}
.mb {
  margin-bottom: 10px;
}
.truncate {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spacer {
  flex: 1;
}
.section-title {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.section-title p {
  margin: 2px 0 0;
}

/* ---------- Tarjetas ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  color: var(--text);
}
.card-pad {
  padding: 16px 18px;
}
.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-pad > .card-header {
  margin: -16px -18px 12px;
}
.card-header > .card-title {
  flex: 1 1 auto;
}
.card-title,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 620;
  color: var(--text);
}
.card-title i,
.card-header h3 i {
  color: var(--muted);
  margin-right: 4px;
}
.card-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.card-header[class*="bg-"] {
  background: transparent !important;
  color: var(--text) !important;
}
.card-header.bg-primary,
.card-header.bg-danger { box-shadow: inset 0 3px 0 var(--accent); }
.card-header.bg-success { box-shadow: inset 0 3px 0 var(--success); }
.card-header.bg-warning { box-shadow: inset 0 3px 0 var(--warning); }
.card-header.bg-info { box-shadow: inset 0 3px 0 var(--info); }
.card-header.bg-secondary,
.card-header.bg-dark { box-shadow: inset 0 3px 0 var(--muted); }
.card-header.bg-light,
.card-header.bg-white { box-shadow: none; }
.card-header.text-white,
.card-header .text-white,
.card-header[class*="bg-"] .card-title,
.card-header[class*="bg-"] h3,
.card-header[class*="bg-"] h4,
.card-header[class*="bg-"] h5 {
  color: var(--text) !important;
}
.card-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px 18px;
}
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.card-footer::after {
  content: "";
  display: table;
  clear: both;
}
.card-text:last-child {
  margin-bottom: 0;
}
.card-outline {
  border-top: 3px solid var(--accent);
}
.card-outline.card-primary { border-top-color: var(--accent); }
.card-outline.card-success { border-top-color: var(--success); }
.card-outline.card-info { border-top-color: var(--info); }
.card-outline.card-warning { border-top-color: var(--warning); }
.card-outline.card-danger { border-top-color: var(--danger); }
.collapsed-card > .card-body,
.collapsed-card > .card-footer {
  display: none;
}
.collapsed-card > .card-header {
  border-bottom: 0;
}
.card.help ol {
  margin: 0 0 8px;
  padding-left: 20px;
  line-height: 1.7;
}
.card-header-actions,
.card-header .btn-group {
  flex-wrap: wrap;
}

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-border: var(--border);
  --btn-color: var(--text);
  --btn-hover-bg: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  padding: 7px 13px;
  border-radius: 7px;
  font: inherit;
  font-weight: 560;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  user-select: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.btn:hover:not(:disabled):not(.disabled) {
  background: var(--btn-hover-bg);
  color: var(--btn-color);
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn > i + span,
.btn > span + i {
  margin-left: 0;
}
.btn-primary {
  --btn-bg: var(--accent-gradient);
  --btn-border: var(--accent-solid);
  --btn-color: #fff;
  --btn-hover-bg: var(--accent-gradient-hover);
  box-shadow: 0 2px 6px rgb(164 0 0 / 22%);
}
.btn-secondary,
.btn-default {
  --btn-bg: var(--surface);
  --btn-border: var(--border-strong);
  --btn-color: var(--text);
  --btn-hover-bg: var(--surface-3);
}
.btn-success {
  --btn-bg: var(--success-solid);
  --btn-border: var(--success-solid);
  --btn-color: #fff;
  --btn-hover-bg: var(--success-solid);
}
.btn-danger {
  --btn-bg: var(--danger-solid);
  --btn-border: var(--danger-solid);
  --btn-color: #fff;
  --btn-hover-bg: var(--danger-solid);
}
.btn-warning {
  --btn-bg: var(--warning-solid);
  --btn-border: var(--warning-solid);
  --btn-color: #fff;
  --btn-hover-bg: var(--warning-solid);
}
.btn-info {
  --btn-bg: var(--info-solid);
  --btn-border: var(--info-solid);
  --btn-color: #fff;
  --btn-hover-bg: var(--info-solid);
}
.btn-dark {
  --btn-bg: var(--text);
  --btn-border: var(--text);
  --btn-color: var(--surface);
  --btn-hover-bg: var(--text);
}
.btn-light {
  --btn-bg: var(--surface-2);
  --btn-border: var(--border);
  --btn-color: var(--text);
  --btn-hover-bg: var(--surface-3);
}
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.btn-warning:hover:not(:disabled),
.btn-info:hover:not(:disabled),
.btn-dark:hover:not(:disabled) {
  filter: brightness(0.92);
}
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-dark,
.btn-outline-light {
  --btn-bg: transparent;
}
.btn-outline-primary { --btn-border: var(--accent); --btn-color: var(--accent); --btn-hover-bg: var(--accent-soft); }
.btn-outline-secondary { --btn-border: var(--border-strong); --btn-color: var(--muted); --btn-hover-bg: var(--surface-2); }
.btn-outline-success { --btn-border: var(--success); --btn-color: var(--success); --btn-hover-bg: var(--success-soft); }
.btn-outline-danger { --btn-border: var(--danger); --btn-color: var(--danger); --btn-hover-bg: var(--danger-soft); }
.btn-outline-warning { --btn-border: var(--warning); --btn-color: var(--warning); --btn-hover-bg: var(--warning-soft); }
.btn-outline-info { --btn-border: var(--info); --btn-color: var(--info); --btn-hover-bg: var(--info-soft); }
.btn-outline-dark { --btn-border: var(--text); --btn-color: var(--text); --btn-hover-bg: var(--surface-2); }
.btn-outline-light { --btn-border: rgb(255 255 255 / 60%); --btn-color: #fff; --btn-hover-bg: rgb(255 255 255 / 12%); }
.btn-outline-primary.active,
.btn-outline-secondary.active,
.btn-outline-success.active,
.btn-outline-danger.active,
.btn-outline-warning.active,
.btn-outline-info.active,
.btn-outline-dark.active {
  --btn-bg: var(--btn-color);
  background: var(--btn-color);
  color: var(--surface);
  border-color: var(--btn-color);
}
.btn-primary.active,
.btn-secondary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 18%);
}
.btn-secondary.active {
  background: var(--surface-3);
}
.btn-link {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-color: var(--accent);
  --btn-hover-bg: transparent;
  font-weight: 560;
}
.btn-link:hover:not(:disabled) {
  text-decoration: underline;
  color: var(--accent-hover);
}
.btn-ghost,
.btn-ghost-danger,
.btn-tool {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-hover-bg: var(--surface-2);
}
.btn-ghost-danger {
  --btn-color: var(--danger);
}
.btn-tool {
  --btn-color: var(--muted);
  padding: 4px 8px;
  font-size: 0.9rem;
}
.btn-tool:hover:not(:disabled) {
  --btn-color: var(--text);
}
.btn-sm,
.btn-group-sm > .btn {
  padding: 4px 9px;
  font-size: 0.86em;
  border-radius: 6px;
}
.btn-xs {
  padding: 2px 7px;
  font-size: 0.78em;
  border-radius: 5px;
}
.btn-lg,
.btn-group-lg > .btn {
  padding: 10px 18px;
  font-size: 1.05em;
  border-radius: 8px;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-block + .btn-block {
  margin-top: 0.5rem;
}
.btn-group,
.btn-group-vertical {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}
.btn-group > .btn {
  position: relative;
  flex: 0 1 auto;
}
.btn-group > .btn:hover,
.btn-group > .btn:focus,
.btn-group > .btn.active {
  z-index: 1;
}
.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) {
  margin-left: -1px;
}
.btn-group > .btn:not(:last-child):not(.dropdown-toggle),
.btn-group > .btn-group:not(:last-child) > .btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) > .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.btn-group > .dropdown {
  display: inline-flex;
}
.btn-group-vertical {
  flex-direction: column;
}
.btn-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.icon-btn {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: ecs-spin 0.8s linear infinite;
  vertical-align: -2px;
}
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: -0.125em;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ecs-spin 0.75s linear infinite;
}
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.2em;
}
.spinner-grow {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  background-color: currentColor;
  border-radius: 50%;
  opacity: 0;
  animation: ecs-grow 0.75s linear infinite;
}
.spinner-grow-sm {
  width: 1rem;
  height: 1rem;
}
@keyframes ecs-spin {
  to { transform: rotate(360deg); }
}
@keyframes ecs-grow {
  0% { transform: scale(0); }
  50% { opacity: 1; transform: none; }
}
.close {
  float: right;
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
  opacity: 0.85;
  text-shadow: none;
}
.close:hover {
  color: var(--text);
  opacity: 1;
  text-decoration: none;
}

/* ---------- Formularios ---------- */
input,
select,
textarea {
  font: inherit;
  color: var(--text);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([class*="swal2"]),
select:not([class*="swal2"]),
textarea:not([class*="swal2"]) {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 10px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.4;
}
.form-control,
.custom-select,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.form-grid input:not([type="checkbox"]):not([type="radio"]),
.form-grid select,
.form-grid textarea {
  display: block;
  width: 100%;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
input:disabled,
select:disabled,
textarea:disabled,
input[readonly].form-control,
textarea[readonly].form-control {
  background-color: var(--surface-2);
  color: var(--muted);
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  accent-color: var(--accent-solid);
}
input[type="file"] {
  padding: 6px;
  max-width: 100%;
}
input[type="color"] {
  min-height: 36px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
}
textarea {
  resize: vertical;
}
select {
  cursor: pointer;
}
.form-control-sm,
.input-group-sm > .form-control {
  padding: 4px 8px !important;
  font-size: 0.88em;
  border-radius: 6px;
}
.form-control-lg {
  padding: 10px 14px !important;
  font-size: 1.08em;
}
.form-control-plaintext {
  display: block;
  width: 100%;
  padding: 6px 0;
  margin-bottom: 0;
  color: var(--text);
  background: transparent;
  border: solid transparent;
  border-width: 1px 0;
}
.form-control-file {
  display: block;
  width: 100%;
}
.form-control-color {
  width: 64px;
  height: 38px;
}
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: 0.86rem;
}
.col-form-label {
  padding-top: 8px;
  padding-bottom: 8px;
  margin-bottom: 0;
}
.form-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -6px;
  margin-left: -6px;
}
.form-row > .col,
.form-row > [class*="col-"] {
  padding-right: 6px;
  padding-left: 6px;
}
.form-inline {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 8px;
}
.form-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 1.5rem;
  margin-bottom: 4px;
}
.form-check-inline {
  display: inline-flex;
  margin-right: 12px;
}
.form-check-input {
  margin: 0;
  flex-shrink: 0;
}
.form-check-label {
  margin-bottom: 0;
  font-weight: 500;
}
.custom-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 1.5rem;
}
.custom-control-inline {
  display: inline-flex;
  margin-right: 14px;
}
.custom-control-input {
  margin: 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-solid);
}
.custom-control-label {
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
}
.custom-switch .custom-control-input {
  width: 30px;
  height: 16px;
}
.custom-select {
  appearance: auto;
}
.custom-file-input {
  max-width: 100%;
}
.input-group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
}
.input-group > .form-control,
.input-group > .custom-select,
.input-group > input,
.input-group > select {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  margin-bottom: 0;
}
.input-group > .form-control:focus,
.input-group > input:focus {
  z-index: 3;
}
.input-group-prepend,
.input-group-append {
  display: flex;
}
.input-group-prepend .btn,
.input-group-append .btn {
  position: relative;
  z-index: 2;
}
.input-group-text {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  margin-bottom: 0;
  font-size: 0.92em;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
}
.input-group > .form-control:not(:last-child),
.input-group > input:not(:last-child),
.input-group > .custom-select:not(:last-child),
.input-group > .input-group-prepend > .btn,
.input-group > .input-group-prepend > .input-group-text {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group > .form-control:not(:first-child),
.input-group > input:not(:first-child),
.input-group > .custom-select:not(:first-child),
.input-group > .input-group-append > .btn,
.input-group > .input-group-append > .input-group-text,
.input-group > .btn:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group > .input-group-append > .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group > .input-group-append,
.input-group > .btn:not(:first-child) {
  margin-left: -1px;
}
.input-group > .input-group-prepend {
  margin-right: -1px;
}
.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--danger);
}
.is-invalid ~ .invalid-feedback,
.was-validated :invalid ~ .invalid-feedback {
  display: block;
}
.form-control.is-invalid,
.was-validated .form-control:invalid {
  border-color: var(--danger);
}
.form-control.is-valid {
  border-color: var(--success);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin: 0;
}
.field-wide {
  grid-column: 1 / -1;
}
.field-label {
  font-weight: 600;
  font-size: 0.86rem;
}
.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}
.field-error,
.error-text {
  color: var(--danger);
  font-size: 0.86rem;
}
.warning-text {
  color: var(--warning);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 10px 0;
}
.form-grid .form-group {
  margin-bottom: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: 500;
}
.note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--muted);
  margin: 10px 0 0;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  overflow: hidden;
  width: fit-content;
}
.segmented button {
  border: 0;
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
  border-right: 1px solid var(--border-strong);
}
.segmented button:last-child {
  border-right: 0;
}
.segmented button.on {
  background: var(--accent-solid);
  color: #fff;
  font-weight: 600;
}
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.chip-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.inline-inputs {
  display: flex;
  gap: 6px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.toolbar > .field {
  min-width: 200px;
}
.toolbar > .field:first-child {
  min-width: 280px;
  flex: 1;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}
.filters input[type="search"] {
  max-width: 320px;
}
.filters select {
  width: auto;
}

/* ---------- Tablas ---------- */
.table-wrap,
.table-responsive,
.table-scroll-x {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-x {
  overflow-y: visible;
  position: relative;
}
/* El scroll horizontal recorta el menú "Acciones": con pocas filas se deja espacio para que se vea entero. */
.tabla-con-acciones {
  min-height: 320px;
}
/* Empresas y Cobranzas: las casillas para eliminar solo se ven después de pulsar "Eliminar". */
.tabla-empresas:not(.modo-seleccion) .col-seleccion,
.tabla-seleccionable:not(.modo-seleccion) .col-seleccion {
  display: none;
}
table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}
.table {
  margin-bottom: 1rem;
  background: transparent;
}
th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 650;
  background: var(--surface-2);
  white-space: nowrap;
}
.table th,
.table td {
  vertical-align: middle;
}
.table thead th {
  border-bottom: 1px solid var(--border-strong);
}
/* Encabezados ordenables (ordenar-tablas.js): parecen texto del encabezado, con la flecha del orden. */
.orden-col {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.orden-col:hover { color: var(--accent); }
.orden-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.orden-col i { font-size: .75em; opacity: .35; }
.orden-col.activo { color: var(--accent); }
.orden-col.activo i { opacity: 1; }
table.dense td,
.table-sm td,
.table-sm th {
  padding: 6px 8px;
}
.table-striped tbody tr:nth-of-type(odd) > td {
  background-color: var(--surface-2);
}
.table-hover tbody tr:hover > td,
tr.clickable:hover > td {
  background-color: var(--row-hover);
}
.table-bordered th,
.table-bordered td {
  border: 1px solid var(--border);
}
.table-borderless th,
.table-borderless td {
  border: 0;
}
.table-borderless th {
  background: transparent;
}
.thead-light th {
  background: var(--surface-2);
  color: var(--muted);
}
.thead-dark th {
  background: var(--text);
  color: var(--surface);
}
.table-active > td,
.table-active > th { background-color: var(--surface-3); }
.table-primary > td { background-color: var(--accent-soft); }
.table-success > td { background-color: var(--success-soft); }
.table-danger > td { background-color: var(--danger-soft); }
.table-warning > td { background-color: var(--warning-soft); }
.table-info > td { background-color: var(--info-soft); }
td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}
tr.row-muted td {
  color: var(--muted);
}
tr.clickable {
  cursor: pointer;
}
.cell-error {
  color: var(--danger);
  font-size: 0.85em;
  max-width: 520px;
}
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}
.card > .table-responsive:last-child > .table,
.card-body.p-0 > .table,
.card-body.p-0 > .table-responsive > .table,
.card-body.p-0 > .table-scroll-x > .table {
  margin-bottom: 0;
}
.card-body.p-0 > .table th:first-child,
.card-body.p-0 > .table td:first-child,
.card-body.p-0 .table-responsive > .table th:first-child,
.card-body.p-0 .table-responsive > .table td:first-child,
.card-body.p-0 .table-scroll-x > .table th:first-child,
.card-body.p-0 .table-scroll-x > .table td:first-child {
  padding-left: 18px;
}

/* ---------- Insignias ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}
.badge:empty {
  display: none;
}
a.badge:hover {
  text-decoration: none;
  filter: brightness(0.96);
}
.badge-primary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-secondary { background: var(--neutral-soft); color: var(--muted); border-color: transparent; }
.badge-light { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.badge-dark { background: var(--text); color: var(--surface); border-color: transparent; }
.badge-neutral { background: var(--surface-2); color: var(--muted); }
.badge-pill { border-radius: 999px; }
.badge-lg { font-size: 0.9rem; padding: 4px 12px; }
.btn .badge {
  position: relative;
  top: -1px;
}

/* ---------- Alertas y avisos ---------- */
.alert {
  position: relative;
  padding: 11px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}
.alert-primary { background: var(--accent-soft); border-color: var(--accent-soft); border-left-color: var(--accent); }
.alert-secondary,
.alert-light { background: var(--surface-2); border-color: var(--border); border-left-color: var(--border-strong); }
.alert-success { background: var(--success-soft); border-color: var(--success-soft); border-left-color: var(--success); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-soft); border-left-color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-soft); border-left-color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: var(--info-soft); border-left-color: var(--info); }
.alert-dark { background: var(--surface-3); border-color: var(--border); border-left-color: var(--text); }
.alert-heading {
  color: inherit;
  margin-bottom: 6px;
}
.alert hr {
  border-top-color: rgb(127 127 127 / 25%);
  margin: 8px 0;
}
.alert-link {
  font-weight: 650;
  color: inherit;
  text-decoration: underline;
}
.alert-dismissible {
  padding-right: 40px;
}
.alert-dismissible .close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 9px 12px;
  color: inherit;
}
.alert > :last-child {
  margin-bottom: 0;
}

/* ---------- Progreso, estadísticas y KPIs ---------- */
.progress {
  display: flex;
  height: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.progress-bar {
  height: 100%;
  background: var(--accent-solid);
  transition: width 0.3s ease;
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-bar.bg-success { background: var(--success-solid) !important; }
.progress-bar.bg-warning { background: var(--warning-solid) !important; }
.progress-bar.bg-info { background: var(--info-solid) !important; }
.progress-bar.bg-danger { background: var(--danger-solid) !important; }
.progress-bar.bg-neutral { background: var(--neutral-solid) !important; }

/* Botón "?" que abre una ayuda (SUNAT) */
.btn-ayuda {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
}
.btn-ayuda:hover { color: var(--accent); border-color: var(--accent); }
.ayuda-popup .swal2-html-container { text-align: left; font-size: 0.9rem; line-height: 1.55; }
.ayuda-popup ol { padding-left: 1.2rem; margin: 0 0 0.6rem; }
.ayuda-popup li { margin-bottom: 0.35rem; }
.ayuda-popup .muted { font-size: 0.82rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0 8px;
}
.stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}
.stat strong {
  font-size: 1.4rem;
}
.stat-success strong {
  color: var(--success);
}
.stat-danger strong {
  color: var(--danger);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
  box-shadow: var(--shadow);
}
a.kpi:hover,
.kpi.clickable:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--text);
}
.kpi span {
  color: var(--muted);
}
.kpi strong {
  font-size: 1.9rem;
}
.kpi .kpi-small {
  font-size: 1.15rem;
}
.kpi small {
  color: var(--muted);
}
.info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  position: relative;
}
.info-box[onclick],
.info-box[data-filtro-rapido],
a.info-box {
  cursor: pointer;
}
.info-box[onclick]:hover,
.info-box[data-filtro-rapido]:hover,
a.info-box:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.info-box-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: var(--surface-2) !important;
  color: var(--muted) !important;
}
.info-box-icon.bg-primary,
.info-box-icon.bg-danger { background: var(--accent-soft) !important; color: var(--accent) !important; }
.info-box-icon.bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.info-box-icon.bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.info-box-icon.bg-info { background: var(--info-soft) !important; color: var(--info) !important; }
.info-box-icon.bg-secondary,
.info-box-icon.bg-light,
.info-box-icon.bg-dark { background: var(--neutral-soft) !important; color: var(--muted) !important; }
.info-box-icon i {
  color: inherit !important;
}
.info-box-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.info-box-text {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.info-box-number {
  display: block;
  font-size: 1.3rem;
  font-weight: 650;
  color: var(--text);
}
/* Celdas con dos datos: el principal arriba y el secundario debajo, más pequeño */
.celda-principal {
  display: block;
}
.celda-secundaria {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}
.celda-secundaria i {
  font-size: 0.72rem;
}
.info-box-desglose {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}
.info-box-desglose strong {
  color: var(--text);
}
.info-box-desglose i {
  font-size: 0.7rem;
}
/* Cards de Cobranzas: cada número filtra la tabla con un clic */
.card-filtro {
  cursor: pointer;
}
.info-box.card-filtro:hover {
  border-color: var(--border-strong);
}
.info-box-desglose .card-filtro {
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 -4px;
}
.info-box-desglose .card-filtro:hover {
  background: var(--row-hover);
}
.info-box.card-filtro.activo {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.info-box-desglose .card-filtro.activo {
  background: var(--accent-soft);
  color: var(--accent);
}
.card-filtro:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.info-box-desglose.desglose-grande {
  font-size: 0.92rem;
  margin-top: 4px;
}
.info-box-desglose.desglose-grande i {
  font-size: 0.85rem;
}
.info-box .progress {
  margin: 6px 0 2px;
  height: 4px;
}
.info-box.bg-primary,
.info-box.bg-danger,
.info-box.bg-success,
.info-box.bg-warning,
.info-box.bg-info {
  background: var(--surface) !important;
  color: var(--text) !important;
}
.small-box {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.record-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.total-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  font-size: 0.9rem;
}
.total-box small {
  color: var(--muted);
  font-weight: 600;
}
.file-dots {
  display: inline-flex;
  gap: 4px;
}
.file-dot {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
}
.file-dot.on {
  border: 1px solid transparent;
  background: var(--success-soft);
  color: var(--success);
}
/* SUNAT no entrega el archivo (error interno suyo): tachado, no pendiente */
.file-dot.off {
  border-style: solid;
  text-decoration: line-through;
  opacity: 0.55;
  cursor: help;
}
.company-list {
  display: flex;
  flex-direction: column;
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.company-list.short {
  max-height: 220px;
}
.company-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-weight: 400;
}
.company-option:last-child {
  border-bottom: 0;
}
.company-option span {
  flex: 1;
}
.reasons {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}
.log {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  margin: 0;
}
.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.job-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--text);
}
.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li span {
  display: block;
  color: var(--muted);
}
.schedule-list {
  display: flex;
  flex-direction: column;
}
.schedule {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}
.schedule:last-child {
  border-bottom: 0;
}
.schedule.off {
  opacity: 0.65;
}
.schedule p {
  margin: 4px 0;
}
.empty {
  text-align: center;
  padding: 36px 16px;
}
.empty-title {
  font-weight: 620;
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.alert-list {
  margin: 4px 0 0;
  padding-left: 16px;
  color: var(--danger);
  font-size: 0.82rem;
}
.panel-cell strong {
  display: block;
}
.panel-cell small {
  color: var(--muted);
}

/* Detalle de comprobante */
.detalle-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 300px;
}
.detalle-cell .truncate {
  max-width: 240px;
}

/* Tabla de comprobantes: "Detalle" absorbe el espacio libre para que el resto quepa sin scroll */
.tabla-cpe .col-contraparte {
  width: 35%;
  min-width: 150px;
  max-width: 280px;
}
.tabla-cpe .tipo-cpe {
  max-width: 130px;
}
.tabla-cpe .col-detalle {
  width: 65%;
  min-width: 130px;
  max-width: 0;
}
.tabla-cpe .col-detalle .detalle-cell {
  max-width: none;
}
.tabla-cpe .col-detalle .truncate {
  flex: 1;
  min-width: 0;
  max-width: none;
}
.tabla-cpe .badge {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.eye-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
  flex-shrink: 0;
}
.eye-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.detalle {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detalle-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.detalle-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.glosa {
  margin: 0;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 12px;
}
.detalle-foot {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.detalle-info p {
  margin: 4px 0;
}
.detalle-totales {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;
  align-content: start;
  text-align: right;
  min-width: 220px;
}
.detalle-totales .total {
  font-size: 1.15rem;
  color: var(--accent);
}

/* ---------- Listas ---------- */
.list-group {
  display: flex;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
  border-radius: 8px;
}
.list-group-item {
  position: relative;
  display: block;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}
.list-group-item + .list-group-item {
  border-top-width: 0;
}
.list-group-item:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.list-group-item:last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}
.list-group-item-action {
  width: 100%;
  text-align: inherit;
  cursor: pointer;
}
.list-group-item-action:hover,
.list-group-item-action:focus {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  z-index: 1;
}
.list-group-item.active {
  z-index: 2;
  color: #fff;
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}
.list-group-item.disabled,
.list-group-item:disabled {
  color: var(--muted);
  pointer-events: none;
}
.list-group-flush {
  border-radius: 0;
}
.list-group-flush > .list-group-item {
  border-width: 0 0 1px;
}
.list-group-flush > .list-group-item:last-child {
  border-bottom-width: 0;
}
.list-unstyled {
  padding-left: 0;
  list-style: none;
}
.list-inline {
  padding-left: 0;
  list-style: none;
}
.list-inline-item {
  display: inline-block;
}
.list-inline-item:not(:last-child) {
  margin-right: 0.5rem;
}

/* ---------- Navegación genérica ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}
.nav-link {
  display: block;
  padding: 7px 12px;
}
.nav-link:hover {
  text-decoration: none;
}
.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: 2px;
}
.nav-tabs .nav-link {
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
}
.nav-tabs .nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border) var(--border) var(--surface);
  font-weight: 600;
}
.nav-pills .nav-link {
  border-radius: 7px;
  color: var(--muted);
}
.nav-pills .nav-link.active {
  color: #fff;
  background: var(--accent-solid);
}
.tab-content > .tab-pane {
  display: none;
}
.tab-content > .active {
  display: block;
}

/* ---------- Menús desplegables ---------- */
.dropdown,
.dropup,
.dropleft,
.dropright {
  position: relative;
}
.dropdown-toggle {
  white-space: nowrap;
}
.dropdown-toggle::after {
  display: inline-block;
  margin-left: 4px;
  vertical-align: 2px;
  content: "";
  border-top: 4px solid;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}
.dropdown-toggle:empty::after {
  margin-left: 0;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  float: left;
  min-width: 11rem;
  padding: 6px;
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: var(--text);
  text-align: left;
  list-style: none;
  background: var(--surface);
  background-clip: padding-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.dropdown-menu.show {
  display: block;
}
.dropdown-menu-right {
  right: 0;
  left: auto;
}
.dropdown-menu-left {
  right: auto;
  left: 0;
}
.dropdown-menu-lg {
  min-width: 280px;
  max-width: 300px;
  padding: 0;
}
.dropdown-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  clear: both;
  font-weight: 400;
  color: var(--text);
  text-align: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
}
.dropdown-menu-lg .dropdown-item {
  border-radius: 0;
  white-space: normal;
}
.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.dropdown-item.active,
.dropdown-item:active {
  color: #fff;
  background: var(--accent-solid);
}
.dropdown-item.disabled,
.dropdown-item:disabled {
  color: var(--muted);
  pointer-events: none;
}
.dropdown-item i {
  width: 18px;
  text-align: center;
  margin-right: 4px;
  color: var(--muted);
}
.dropdown-item.text-danger i,
.dropdown-item.text-danger {
  color: var(--danger) !important;
}
.dropdown-divider {
  height: 0;
  margin: 6px 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.dropdown-menu-lg .dropdown-divider {
  margin: 0;
}
.dropdown-header {
  display: block;
  padding: 8px 12px;
  margin-bottom: 0;
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.dropdown-header.notif-danger { background: var(--danger-soft); color: var(--danger); }
.dropdown-header.notif-warning { background: var(--warning-soft); color: var(--warning); }
.dropdown-header.notif-info { background: var(--info-soft); color: var(--info); }

/* Notificaciones */
.notificacion-item {
  padding: 10px 15px;
  border-left: 3px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}
.notificacion-item:hover {
  background-color: var(--surface-2);
}
.notificacion-item.urgente {
  border-left-color: var(--danger);
}
.notificacion-item.critica {
  border-left-color: var(--warning);
}
.notificacion-item.proxima {
  border-left-color: var(--info);
}
.notificacion-titulo {
  font-weight: 650;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text);
}
.notificacion-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.notificacion-estado {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}
.notificacion-estado.urgente {
  background-color: var(--danger-soft);
  color: var(--danger);
}
.notificacion-estado.critica {
  background-color: var(--warning-soft);
  color: var(--warning);
}
.notificacion-estado.proxima {
  background-color: var(--info-soft);
  color: var(--info);
}
.notif-card {
  border-left: 3px solid transparent;
  padding: 10px 12px !important;
  cursor: pointer;
}
.notif-card.no-leida {
  border-left-color: var(--accent);
  background-color: var(--accent-soft);
}
.notif-card-title {
  display: flex;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}
.notif-card-event {
  color: var(--muted);
  margin: 0 0 2px 24px;
}
.notif-card-details {
  color: var(--muted);
  opacity: 0.85;
  margin: 0 0 4px 24px;
  font-size: 11px;
}
.notif-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 24px;
  font-size: 11px;
  color: var(--muted);
}
.notif-card-new {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Modales (estructura Bootstrap 4) ---------- */
.modal-open {
  overflow: hidden;
}
.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
}
.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}
.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
}
.modal.fade .modal-dialog {
  transition: transform 0.2s ease-out;
  transform: translate(0, -24px);
}
.modal.show .modal-dialog {
  transform: none;
}
.modal.modal-static .modal-dialog {
  transform: scale(1.02);
}
.modal-dialog-scrollable {
  display: flex;
  max-height: calc(100% - 1rem);
}
.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 1rem);
  overflow: hidden;
}
.modal-dialog-scrollable .modal-header,
.modal-dialog-scrollable .modal-footer {
  flex-shrink: 0;
}
.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}
.modal-dialog-centered::before {
  display: block;
  height: calc(100vh - 1rem);
  height: min-content;
  content: "";
}
.modal-dialog-centered.modal-dialog-scrollable {
  flex-direction: column;
  justify-content: center;
  height: 100%;
}
.modal-dialog-centered.modal-dialog-scrollable .modal-content {
  max-height: none;
}
.modal-dialog-centered.modal-dialog-scrollable::before {
  content: none;
}
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background: var(--surface);
  background-clip: padding-box;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
  outline: 0;
  color: var(--text);
}
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  width: 100vw;
  height: 100vh;
  background-color: rgb(10 16 22);
}
.modal-backdrop.fade {
  opacity: 0;
}
.modal-backdrop.show {
  opacity: 0.55;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 11px;
  border-top-right-radius: 11px;
  background: var(--surface);
  color: var(--text);
}
.modal-header .close {
  padding: 4px 6px;
  margin: -4px -6px -4px auto;
  float: none;
}
.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
  line-height: 1.35;
  color: inherit;
}
.modal-title i {
  margin-right: 4px;
}
.modal-header[class*="bg-"],
.modal-header.text-white {
  background: var(--surface) !important;
  color: var(--text) !important;
}
.modal-header.bg-primary,
.modal-header.bg-danger { box-shadow: inset 0 3px 0 var(--accent); }
.modal-header.bg-success { box-shadow: inset 0 3px 0 var(--success); }
.modal-header.bg-warning { box-shadow: inset 0 3px 0 var(--warning); }
.modal-header.bg-info { box-shadow: inset 0 3px 0 var(--info); }
.modal-header.bg-secondary,
.modal-header.bg-dark { box-shadow: inset 0 3px 0 var(--muted); }
.modal-header.bg-primary .modal-title i,
.modal-header.bg-danger .modal-title i { color: var(--accent); }
.modal-header.bg-success .modal-title i { color: var(--success); }
.modal-header.bg-warning .modal-title i { color: var(--warning); }
.modal-header.bg-info .modal-title i { color: var(--info); }
.modal-header .text-white,
.modal-header.text-white .close,
.modal-header .close.text-white {
  color: var(--text) !important;
}
.modal-header .close.text-white,
.modal-header.text-white .close {
  color: var(--muted) !important;
}
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 16px 18px;
  min-width: 0;
}
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  border-bottom-right-radius: 11px;
  border-bottom-left-radius: 11px;
}
.modal-footer > * {
  margin: 0;
}
.modal-scrollbar-measure {
  position: absolute;
  top: -9999px;
  width: 50px;
  height: 50px;
  overflow: scroll;
}
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 560px;
    margin: 1.75rem auto;
  }
  .modal-dialog-scrollable {
    max-height: calc(100% - 3.5rem);
  }
  .modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
  }
  .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
  .modal-dialog-centered::before {
    height: calc(100vh - 3.5rem);
    height: min-content;
  }
  .modal-sm {
    max-width: 320px;
  }
}
@media (min-width: 992px) {
  .modal-lg,
  .modal-xl {
    max-width: 820px;
  }
}
@media (min-width: 1200px) {
  .modal-xl {
    max-width: 1140px;
  }
}

/* ---------- Tooltips ---------- */
.tooltip {
  position: absolute;
  z-index: 1070;
  display: block;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  word-wrap: break-word;
  opacity: 0;
  pointer-events: none;
}
.tooltip.show {
  opacity: 0.96;
}
.tooltip .arrow {
  position: absolute;
  display: block;
  width: 0.8rem;
  height: 0.4rem;
}
.tooltip .arrow::before {
  position: absolute;
  content: "";
  border-color: transparent;
  border-style: solid;
}
.bs-tooltip-top,
.bs-tooltip-auto[x-placement^="top"] {
  padding: 0.4rem 0;
}
.bs-tooltip-top .arrow,
.bs-tooltip-auto[x-placement^="top"] .arrow {
  bottom: 0;
}
.bs-tooltip-top .arrow::before,
.bs-tooltip-auto[x-placement^="top"] .arrow::before {
  top: 0;
  border-width: 0.4rem 0.4rem 0;
  border-top-color: var(--tooltip-bg);
}
.bs-tooltip-right,
.bs-tooltip-auto[x-placement^="right"] {
  padding: 0 0.4rem;
}
.bs-tooltip-right .arrow,
.bs-tooltip-auto[x-placement^="right"] .arrow {
  left: 0;
  width: 0.4rem;
  height: 0.8rem;
}
.bs-tooltip-right .arrow::before,
.bs-tooltip-auto[x-placement^="right"] .arrow::before {
  right: 0;
  border-width: 0.4rem 0.4rem 0.4rem 0;
  border-right-color: var(--tooltip-bg);
}
.bs-tooltip-bottom,
.bs-tooltip-auto[x-placement^="bottom"] {
  padding: 0.4rem 0;
}
.bs-tooltip-bottom .arrow,
.bs-tooltip-auto[x-placement^="bottom"] .arrow {
  top: 0;
}
.bs-tooltip-bottom .arrow::before,
.bs-tooltip-auto[x-placement^="bottom"] .arrow::before {
  bottom: 0;
  border-width: 0 0.4rem 0.4rem;
  border-bottom-color: var(--tooltip-bg);
}
.bs-tooltip-left,
.bs-tooltip-auto[x-placement^="left"] {
  padding: 0 0.4rem;
}
.bs-tooltip-left .arrow,
.bs-tooltip-auto[x-placement^="left"] .arrow {
  right: 0;
  width: 0.4rem;
  height: 0.8rem;
}
.bs-tooltip-left .arrow::before,
.bs-tooltip-auto[x-placement^="left"] .arrow::before {
  left: 0;
  border-width: 0.4rem 0 0.4rem 0.4rem;
  border-left-color: var(--tooltip-bg);
}
.tooltip-inner {
  max-width: 260px;
  padding: 5px 9px;
  color: #fff;
  text-align: center;
  background-color: var(--tooltip-bg);
  border-radius: 6px;
}
.popover {
  position: absolute;
  z-index: 1060;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
}
.popover-header {
  padding: 8px 12px;
  margin: 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.popover-body {
  padding: 8px 12px;
}

/* ---------- Transiciones Bootstrap ---------- */
.fade {
  transition: opacity 0.15s linear;
}
.fade:not(.show) {
  opacity: 0;
}
.collapse:not(.show) {
  display: none;
}
.collapsing {
  position: relative;
  height: 0;
  overflow: hidden;
  transition: height 0.3s ease;
}

/* ---------- Avisos flotantes ---------- */
.ecs-toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1080;
  max-width: min(420px, calc(100vw - 36px));
}
.ecs-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  padding: 10px 10px 10px 14px;
  box-shadow: var(--shadow-lg);
  animation: ecs-toast-in 0.2s ease;
}
@keyframes ecs-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.ecs-toast > i {
  margin-top: 3px;
  color: var(--info);
}
.ecs-toast > span {
  flex: 1;
  white-space: pre-line;
}
.ecs-toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.ecs-toast-success {
  border-left-color: var(--success);
}
.ecs-toast-success > i {
  color: var(--success);
}
.ecs-toast-error {
  border-left-color: var(--danger);
}
.ecs-toast-error > i {
  color: var(--danger);
}
.ecs-toast-warning {
  border-left-color: var(--warning);
}
.ecs-toast-warning > i {
  color: var(--warning);
}

/* ---------- Utilidades (vocabulario Bootstrap) ---------- */
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-justify { text-align: justify !important; }
.text-nowrap { white-space: nowrap !important; }
.text-wrap { white-space: normal !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-break { word-break: break-word !important; overflow-wrap: break-word !important; }
.text-prewrap { white-space: pre-wrap !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.text-decoration-none { text-decoration: none !important; }
.text-reset { color: inherit !important; }
.font-weight-light { font-weight: 300 !important; }
.font-weight-normal { font-weight: 400 !important; }
.font-weight-bold,
.fw-bold { font-weight: 650 !important; }
.fw-semibold { font-weight: 600 !important; }
.font-weight-bolder { font-weight: 750 !important; }
.font-italic { font-style: italic !important; }
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }
.text-lg { font-size: 1.15rem !important; }
.text-primary { color: var(--accent) !important; }
.text-secondary { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-dark,
.text-body { color: var(--text) !important; }
.text-light { color: var(--surface-2) !important; }
.text-white { color: #fff !important; }
.text-white-50 { color: rgb(255 255 255 / 60%) !important; }
.text-black-50 { color: var(--muted) !important; }
a.text-primary:hover { color: var(--accent-hover) !important; }
.bg-primary { background-color: var(--accent-solid) !important; }
.bg-secondary { background-color: var(--neutral-solid) !important; }
.bg-success { background-color: var(--success-solid) !important; }
.bg-danger { background-color: var(--danger-solid) !important; }
.bg-warning { background-color: var(--warning-solid) !important; }
.bg-info { background-color: var(--info-solid) !important; }
.bg-dark { background-color: var(--text) !important; color: var(--surface); }
.bg-light { background-color: var(--surface-2) !important; }
.bg-white { background-color: var(--surface) !important; }
.bg-transparent { background-color: transparent !important; }
.bg-info-light { background-color: var(--info-soft) !important; }
.bg-light.text-dark,
.bg-white.text-dark { color: var(--text) !important; }
.border { border: 1px solid var(--border) !important; }
.border-top { border-top: 1px solid var(--border) !important; }
.border-right { border-right: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.border-left { border-left: 1px solid var(--border) !important; }
.border-0 { border: 0 !important; }
.border-top-0 { border-top: 0 !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.border-2 { border-width: 2px !important; }
.border-4 { border-width: 4px !important; }
.border-dashed { border-style: dashed !important; }
.border-primary { border-color: var(--accent) !important; }
.border-secondary { border-color: var(--border-strong) !important; }
.border-success { border-color: var(--success) !important; }
.border-danger { border-color: var(--danger) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-info { border-color: var(--info) !important; }
.border-light { border-color: var(--border) !important; }
.border-dark { border-color: var(--text) !important; }
.rounded { border-radius: 8px !important; }
.rounded-sm { border-radius: 5px !important; }
.rounded-lg { border-radius: 12px !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 999px !important; }
.rounded-0 { border-radius: 0 !important; }
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow) !important; }
.shadow,
.elevation-1,
.elevation-2 { box-shadow: var(--shadow) !important; }
.shadow-lg,
.elevation-3,
.elevation-4 { box-shadow: var(--shadow-lg) !important; }
.float-left { float: left !important; }
.float-right { float: right !important; }
.float-none { float: none !important; }
.clearfix::after {
  display: block;
  clear: both;
  content: "";
}
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }
.mw-100 { max-width: 100% !important; }
.mh-100 { max-height: 100% !important; }
.min-w-0 { min-width: 0 !important; }
.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }
.sticky-top { position: sticky; top: 0; z-index: 1020; }
.fixed-top { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; }
.fixed-bottom { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1030; }
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.align-baseline { vertical-align: baseline !important; }
.align-top { vertical-align: top !important; }
.align-middle { vertical-align: middle !important; }
.align-bottom { vertical-align: bottom !important; }
.align-text-top { vertical-align: text-top !important; }
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }
.img-fluid { max-width: 100%; height: auto; }
.img-thumbnail {
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}
.img-circle { border-radius: 50%; }
.user-select-none { user-select: none !important; }
.cursor-pointer { cursor: pointer !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.row.g-3,
.row.gx-4.gy-3 {
  margin: -0.5rem -0.5rem 0.5rem;
}
.row.g-3 > *,
.row.gx-4.gy-3 > * {
  padding: 0.5rem;
}
.row.gx-4.gy-3 > * {
  padding: 0.5rem 0.75rem;
}
.divider {
  border: 0;
  border-top: 1px solid var(--border);
}
.embed-responsive {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
}
blockquote,
.blockquote {
  margin: 0 0 1rem;
  padding-left: 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
mark,
.mark {
  padding: 0 0.2em;
  background: var(--warning-soft);
  color: inherit;
}
details > summary {
  cursor: pointer;
}

/* ---------- SweetAlert2 ---------- */
.swal2-popup {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  font-family: inherit !important;
}
.swal2-title {
  color: var(--text) !important;
  font-size: 1.3rem !important;
  font-weight: 650 !important;
}
.swal2-html-container,
.swal2-content {
  color: var(--muted) !important;
  font-size: 0.98rem !important;
}
.swal2-styled.swal2-confirm {
  background-color: var(--accent-solid);
  border-radius: 7px !important;
  font-weight: 600;
}
.swal2-styled.swal2-cancel {
  background-color: var(--neutral-solid);
  border-radius: 7px !important;
  font-weight: 600;
}
.swal2-styled.swal2-deny {
  border-radius: 7px !important;
}
.swal2-styled:focus {
  box-shadow: 0 0 0 3px rgb(185 28 28 / 30%) !important;
}
.swal2-input,
.swal2-textarea,
.swal2-select,
.swal2-file {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
  border-radius: 7px !important;
}
.swal2-validation-message {
  background: var(--surface-2) !important;
  color: var(--danger) !important;
}
.swal2-timer-progress-bar {
  background: var(--accent) !important;
}
.swal2-container.swal2-backdrop-show {
  background: var(--backdrop) !important;
}

/* ---------- Ajustes móviles ---------- */
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .schedule {
    flex-direction: column;
  }
}
@media (max-width: 767.98px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }
  .topbar {
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
  }
  .topbar-nav .nav-link {
    min-height: 44px;
    min-width: 40px;
  }
  .page-header {
    gap: 10px;
  }
  .page-actions {
    width: 100%;
  }
  .card-header,
  .card-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .kpis {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .info-box {
    min-height: 70px;
  }
  #notificacionesDropdown .kanban-notification-menu,
  #notificacionesAdminWebDropdown .kanban-notification-menu,
  #notificacionesTarjetasDropdown .kanban-notification-menu {
    position: fixed !important;
    top: calc(var(--topbar-h) + env(safe-area-inset-top)) !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(100vh - 4.25rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 4.25rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    transform: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-notification-menu .notificacion-item {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .kanban-notification-menu .dropdown-header {
    white-space: normal;
  }
}
@media (max-width: 374.98px) {
  .topbar-nav .nav-link {
    padding-right: 4px;
    padding-left: 4px;
    min-width: 34px;
  }
}

@media print {
  .sidebar,
  .topbar,
  .app-footer,
  .sidebar-overlay {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .app-content {
    padding: 0;
    max-width: none;
  }
  .card {
    box-shadow: none;
  }
}

/* ===== Centro de notificaciones (una sola campana) ===== */
.ecs-notif { position: relative; }
.ecs-notif-boton { background: none; border: 0; cursor: pointer; }
.ecs-notif-boton[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.ecs-notif-boton.con-avisos > i { animation: ecs-notif-vaiven 2.4s ease-in-out 1; transform-origin: 50% 0; }
@keyframes ecs-notif-vaiven { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-12deg); } 50% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .ecs-notif-boton.con-avisos > i { animation: none; } }
.ecs-notif-badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-solid); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.ecs-notif-badge[hidden] { display: none; }
.ecs-notif-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1060; width: 420px; max-width: calc(100vw - 24px); max-height: min(620px, calc(100vh - 90px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: ecs-notif-entrada .16s ease; }
.ecs-notif-panel[hidden] { display: none; }
@keyframes ecs-notif-entrada { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ecs-notif-cabecera { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; }
.ecs-notif-cabecera strong { font-size: 1rem; }
.ecs-notif-herramientas { display: flex; gap: 2px; }
.ecs-notif-icono { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ecs-notif-icono:hover { background: var(--surface-2); color: var(--text); }
.ecs-notif-icono[hidden] { display: none; }
.ecs-notif-pestanas { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.ecs-notif-pestanas button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: .84rem; font-weight: 600; cursor: pointer; }
.ecs-notif-pestanas button:hover { background: var(--surface-2); color: var(--text); }
.ecs-notif-pestanas button.activa { background: var(--accent-soft); color: var(--accent); }
.ecs-notif-pestanas b { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-solid); color: #fff; font-size: .68rem; line-height: 18px; }
.ecs-notif-pestanas b:empty { display: none; }
.ecs-notif-permiso { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 8px 10px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: .8rem; }
.ecs-notif-permiso[hidden] { display: none; }
.ecs-notif-permiso span { flex: 1; }
.ecs-notif-cuerpo { flex: 1; overflow-y: auto; padding: 6px 6px 8px; overscroll-behavior: contain; }
.ecs-notif-cuerpo [hidden] { display: none; }
.notif-item { position: relative; display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; }
.notif-item:hover, .notif-item:focus-visible { background: var(--row-hover); color: var(--text); text-decoration: none; outline: none; }
.notif-item.no-leida { background: var(--accent-soft); }
.notif-item.no-leida:hover { filter: brightness(.98); }
.notif-icono { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .85rem; background: var(--info-soft); color: var(--info); }
.notif-icono.notif-primary, .notif-icono.notif-danger { background: var(--accent-soft); color: var(--accent); }
.notif-icono.notif-success { background: var(--success-soft); color: var(--success); }
.notif-icono.notif-warning { background: var(--warning-soft); color: var(--warning); }
.notif-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: .84rem; }
.notif-texto strong { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-texto span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-texto small { color: var(--muted); font-size: .76rem; }
.notif-hora { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.notif-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); }
.notif-chip { padding: 1px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.notif-chip.notif-danger { background: var(--danger-soft); color: var(--danger); }
.notif-chip.notif-warning { background: var(--warning-soft); color: var(--warning); }
.notif-chip.notif-info { background: var(--info-soft); color: var(--info); }
.notif-grupo { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.notif-grupo span { padding: 0 7px; border-radius: 999px; background: var(--neutral-soft); }
.notif-grupo-danger { color: var(--danger); }
.notif-grupo-warning { color: var(--warning); }
.notif-vacio { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 20px; text-align: center; color: var(--muted); font-size: .84rem; }
.notif-vacio i { font-size: 1.8rem; color: var(--success); margin-bottom: 6px; }
.notif-vacio strong { color: var(--text); }
.notif-cargando { padding: 30px; text-align: center; color: var(--muted); }
.notif-mas { display: block; width: calc(100% - 12px); margin: 6px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: none; color: var(--muted); font-size: .82rem; cursor: pointer; }
.notif-mas:hover { color: var(--accent); border-color: var(--accent); }
.ecs-notif-pie { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: .82rem; }
.ecs-notif-pie a { color: var(--muted); }
.ecs-notif-pie a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 767.98px) {
  .ecs-notif-panel { position: fixed; top: calc(var(--topbar-h) + 6px); left: 8px; right: 8px; width: auto; max-width: none; max-height: calc(100vh - var(--topbar-h) - 16px); }
  .notif-item { padding: 12px 10px; }
}

/* ---------- Pantallas por pasos con resumen fijo (Cobranzas masivas, Nueva descarga SUNAT) ---------- */
.nc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.nc-principal { display: grid; gap: 16px; min-width: 0; }
.nc-paso { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.nc-paso-cab { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.nc-paso-cab h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.nc-paso-cab p { font-size: .82rem; color: var(--muted); margin: 2px 0 0; }
.nc-paso-cab .ml-auto { margin-left: auto; }
.nc-num { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-solid); color: #fff; font-weight: 700; font-size: .85rem; }
.nc-paso label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.nc-opciones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.nc-opciones button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.nc-opciones button i { font-size: 1.05rem; }
.nc-opciones button:hover { border-color: var(--accent); color: var(--text); }
.nc-opciones button.activo { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.nc-aviso { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--warning-soft); color: var(--warning); font-size: .82rem; }
.nc-aviso[hidden] { display: none; }
.nc-resumen { position: sticky; top: calc(var(--topbar-h) + 16px); }
.nc-resumen-caja { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 18px; box-shadow: var(--shadow); }
.nc-resumen-caja h3 { font-size: .95rem; font-weight: 700; margin: 0 0 12px; }
.nc-resumen-caja h3 i { color: var(--accent); }
.nc-resumen-fila { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .84rem; }
.nc-resumen-fila span { color: var(--muted); }
.nc-resumen-fila strong { text-align: right; overflow-wrap: anywhere; }
.nc-totales { display: grid; gap: 8px; margin: 14px 0; }
.nc-total { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.nc-total > span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nc-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.nc-total small { display: block; color: var(--muted); font-size: .74rem; }
.nc-nota { font-size: .75rem; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 1199.98px) { .nc-layout { grid-template-columns: 1fr; } .nc-resumen { position: static; } }
@media (max-width: 767.98px) { .nc-opciones { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nc-paso { padding: 14px; } }

/* Empresa (nombre / RUC) que abre su detalle */
a.link-empresa,
a.link-empresa:hover {
  color: inherit;
  text-decoration: none;
}
a.link-empresa:hover .celda-principal {
  color: var(--accent);
  text-decoration: underline;
}

/* Selector con búsqueda (SUNAT.buscador): se escribe para filtrar y se elige de la lista. */
.buscador {
  position: relative;
  min-width: 280px;
}
.buscador > input { width: 100%; }
.buscador-lista {
  position: absolute;
  z-index: 1060;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.buscador-lista li {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}
.buscador-lista li.activo { background: var(--accent-soft); }
.buscador-lista li.elegida { font-weight: 600; }
.buscador-lista li.buscador-vacio { color: var(--muted); cursor: default; }
