/**
 * SYS-LDC DOMINICANA — CLEAN MODERN SAAS DESIGN SYSTEM
 * Rediseño visual integral basado en la imagen de referencia:
 * - Paleta Clean Modern SaaS (Primary #455FC1, Dark Blue #293E78, BG #F2F6FD)
 * - Tipografía Poppins (400, 500, 600, 700)
 * - Sidebar blanco puro (250px) con elemento activo azul #455FC1
 * - Topbar blanco discreto (70px)
 * - Tarjetas blancas con border-radius 6px y sombra ultra-suave
 * - Iconografía lineal y proporciones equilibradas
 */

:root {
  /* Paleta Principal Clean Modern SaaS */
  --primary: #455FC1;
  --primary-hover: #384FA8;
  --primary-light: #EEF2FC;
  --dark-blue: #293E78;

  /* Superficies */
  --bg-app: #F2F6FD;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-topbar: #FFFFFF;
  --bg-subtle: #F8FAFD;
  --border-color: #E5EBF5;
  --border-subtle: #EEF3FA;

  /* Tipografía */
  --text-primary: #293E78;
  --text-secondary: #8194BE;
  --text-muted: #98A9C9;
  --text-main: #293E78;
  --text-heading: #293E78;

  /* Acentos */
  --accent-cyan: #51C7EB;
  --accent-cyan-light: #EBF8FD;
  --accent-mint: #5BD4AD;
  --accent-mint-light: #EEFBF6;
  --accent-coral: #F67377;
  --accent-coral-light: #FEF1F2;
  --accent-warning: #F4BF63;
  --accent-warning-light: #FEF9EE;

  /* Compatibilidad y Tokens Semánticos */
  --twt-navy: #455FC1;
  --twt-navy-brand: #293E78;
  --twt-navy-dark: #293E78;
  --twt-navy-light: #51C7EB;
  --twt-navy-soft: #EEF2FC;
  --twt-navy-border: #D8E2F5;

  --twt-gold: #F4BF63;
  --twt-gold-dark: #b8820a;
  --twt-gold-light: #fae2a5;
  --twt-gold-soft: #FEF9EE;
  --twt-gold-border: #F3E0B5;

  --bs-primary: #455FC1;
  --bs-secondary: #8194BE;
  --bs-success: #5BD4AD;
  --bs-info: #51C7EB;
  --bs-warning: #F4BF63;
  --bs-danger: #F67377;

  --success: #209e74;
  --success-soft: #EEFBF6;
  --warning: #b8820a;
  --warning-soft: #FEF9EE;
  --danger: #e05235;
  --danger-soft: #FEF1F2;
  --info: #0284c7;
  --info-soft: #EBF8FD;

  /* Radios Geométricos del Design System */
  --radius-card: 6px;
  --radius-btn: 5px;
  --radius-input: 5px;
  --radius-dialog: 8px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 5px;

  /* Sombra del Prompt: 0 5px 24px rgba(39, 65, 123, 0.035) */
  --shadow-saas: 0 5px 24px rgba(39, 65, 123, 0.035);
  --shadow-xs: 0 1px 3px rgba(39, 65, 123, 0.02);
  --shadow-sm: 0 5px 24px rgba(39, 65, 123, 0.035);
  --shadow-md: 0 8px 26px rgba(39, 65, 123, 0.06);
  --shadow-lg: 0 16px 36px rgba(39, 65, 123, 0.09);

  /* Dimensiones del Layout */
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 70px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: 'Poppins', Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 13.5px;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Números tabulares para importes monetarios y totales */
.tabular-num,
.kpi-value,
.total-num,
table.data-table td strong {
  font-variant-numeric: tabular-nums;
}

code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  color: var(--dark-blue);
  background: var(--primary-light);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ============================================================================
   1. LOGIN SCREEN — CLEAN MODERN SAAS
   ============================================================================ */
.login-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(69, 95, 193, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(81, 199, 235, 0.08) 0%, transparent 45%),
    var(--bg-app);
  padding: 24px;
}

.login-split-wrapper {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  width: 100%;
  max-width: 920px;
  background: var(--bg-card);
  border-radius: var(--radius-dialog);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

@media (max-width: 860px) {
  .login-split-wrapper {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .login-showcase {
    display: none;
  }
}

.login-showcase {
  background: linear-gradient(155deg, #243668 0%, #293E78 50%, #1e2e5a 100%);
  color: #ffffff;
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border-color);
}

.login-showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(81, 199, 235, 0.18);
  border: 1px solid rgba(81, 199, 235, 0.45);
  color: #EBF8FD;
  padding: 5px 14px;
  border-radius: 50rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
}

.login-feature-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.login-feature-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-card);
  padding: 12px 14px;
}

.login-feature-item strong {
  display: block;
  font-size: 0.84rem;
  color: #ffffff;
  margin-bottom: 2px;
  font-weight: 600;
}

.login-feature-item span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.78);
}

.login-card {
  background: var(--bg-card);
  width: 100%;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-brand img {
  width: 180px;
  height: 98px;
  object-fit: contain;
  margin-bottom: 10px;
}

.login-brand h1 {
  font-size: 1.32rem;
  color: var(--text-primary);
  font-weight: 600;
}

.login-brand p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* ============================================================================
   2. APP SHELL (SIDEBAR 250px BLANCO + TOPBAR 70px BLANCO)
   ============================================================================ */
.app-shell {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  background-color: var(--bg-app);
  overflow-x: hidden;
}

/* Sidebar Clean Modern SaaS */
.bs-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 16px rgba(39, 65, 123, 0.02);
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s ease;
}

/* Flecha lateral en el borde derecho del sidebar */
.sidebar-edge-arrow {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  border-radius: 50rem;
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(39, 65, 123, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1040;
  transition: all 0.15s ease;
}

.sidebar-edge-arrow:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-50%) scale(1.06);
}

.bs-sidebar-brand {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.brand-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-text-wrap {
  min-width: 0;
  overflow: hidden;
}

.sidebar-collapse-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--twt-navy-border);
}

.brand-logo-wrap {
  background: #ffffff;
  border-radius: 5px;
  padding: 2px 4px;
  width: 50px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-logo-wrap img {
  width: 44px;
  height: 32px;
  object-fit: contain;
}

.brand-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Control de Auto-Contracción */
.bs-sidebar-autobar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #FAFCFE;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  gap: 6px;
}

.bs-sidebar-autobar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

/* Acciones rápidas en sidebar */
.bs-sidebar-quickbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  align-items: stretch;
  padding: 7px 10px;
  background: #FAFCFE;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.bs-sidebar-quickbtn {
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  border-radius: var(--radius-btn);
  padding: 4px 2px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
}

.bs-sidebar-quickbtn span {
  display: block;
  width: 100%;
  white-space: nowrap;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.bs-sidebar-quickbtn.icon-only {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.bs-sidebar-quickbtn svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.85px;
  color: var(--text-secondary);
  flex-shrink: 0;
  display: block;
}

.bs-sidebar-quickbtn.icon-only svg {
  width: 15px;
  height: 15px;
}

.bs-sidebar-quickbtn:hover,
.bs-sidebar-quickbtn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.bs-sidebar-quickbtn:hover svg,
.bs-sidebar-quickbtn.active svg {
  color: var(--primary);
}

/* Navegación del Menú Lateral */
.bs-sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bs-nav-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 12px 4px;
  white-space: nowrap;
}

/* Botón de Ítem de Navegación */
.nav-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.14s ease;
  text-align: left;
  min-height: 44px;
}

.nav-btn-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.14s ease;
}

.nav-btn-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8px;
}

.nav-btn-left span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.nav-btn:hover .nav-btn-icon {
  color: var(--primary);
}

/* ELEMENTO SELECCIONADO: Fondo azul #455FC1, texto blanco, icono blanco */
.nav-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
  border-color: var(--primary);
}

.nav-btn.active .nav-btn-icon {
  color: #ffffff !important;
}

.nav-btn.active .nav-btn-left span:last-child {
  color: #ffffff;
}

.nav-pill-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 50rem;
  font-weight: 600;
  background: var(--border-subtle);
  color: var(--text-secondary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.nav-btn.active .nav-pill-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.nav-pill-badge.danger {
  background: var(--accent-coral-light);
  color: var(--accent-coral);
}

.nav-pill-badge.gold {
  background: var(--accent-warning-light);
  color: var(--dark-blue);
}

.bs-sidebar-footer {
  padding: 12px 14px;
  background: #FAFCFE;
  border-top: 1px solid var(--border-color);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Contenedor Principal Derecho */
.bs-content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1), width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Sidebar Contraído */
body.sidebar-collapsed .bs-sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .bs-content-wrapper {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
  max-width: calc(100% - var(--sidebar-collapsed-width));
}

body.sidebar-collapsed .bs-sidebar .brand-text-wrap,
body.sidebar-collapsed .bs-sidebar .bs-sidebar-autobar,
body.sidebar-collapsed .bs-sidebar .bs-sidebar-quickbar,
body.sidebar-collapsed .bs-sidebar .bs-nav-section-title,
body.sidebar-collapsed .bs-sidebar .nav-btn-left span:last-child,
body.sidebar-collapsed .bs-sidebar .nav-pill-badge,
body.sidebar-collapsed .bs-sidebar .bs-sidebar-footer {
  display: none;
}

body.sidebar-collapsed .bs-sidebar .sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.sidebar-collapsed .bs-sidebar .bs-sidebar-brand {
  height: auto;
  min-height: 0;
  padding: 6px 0 10px 0;
  justify-content: center;
  align-items: center;
}

body.sidebar-collapsed .bs-sidebar .brand-left-group {
  justify-content: center;
}

body.sidebar-collapsed .bs-sidebar .brand-logo-wrap {
  width: 48px;
  height: 36px;
  padding: 2px;
}

body.sidebar-collapsed .bs-sidebar .nav-btn {
  justify-content: center;
  padding: 11px 6px;
}

body.sidebar-collapsed .bs-sidebar .nav-btn-icon {
  width: 22px;
  height: 22px;
}

/* Hover expand cuando auto-collapse está activo */
@media (min-width: 993px) {
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover {
    width: var(--sidebar-width);
    box-shadow: var(--shadow-md);
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .brand-text-wrap,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-autobar,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-quickbar,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-nav-section-title,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-footer {
    display: block;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-autobar {
    display: flex;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-quickbar {
    display: grid;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .sidebar-collapse-btn,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .nav-btn-left span:last-child,
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .nav-pill-badge {
    display: inline-flex;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .bs-sidebar-brand {
    justify-content: space-between;
    padding: 0 16px;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .brand-left-group {
    justify-content: flex-start;
  }
  body.sidebar-auto-collapse.sidebar-collapsed .bs-sidebar:hover .nav-btn {
    justify-content: space-between;
    padding: 9px 12px;
  }
}

/* ============================================================================
   3. TOPBAR (70px BLANCO, DISCRETO Y ELEGANTE)
   ============================================================================ */
.topbar {
  background: var(--bg-topbar);
  color: var(--text-primary);
  padding: 0 24px;
  min-height: var(--topbar-height);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 300px;
}

.sidebar-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn svg,
.sidebar-collapse-btn svg,
.sidebar-edge-arrow svg {
  display: block;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--twt-navy-border);
}

/* Buscador Rápido Funcional del Topbar */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 360px;
}

.topbar-search input,
.topbar-search input[type="text"],
.topbar-search input[type="search"] {
  width: 100%;
  height: 38px;
  line-height: 36px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 0 36px 0 42px !important;
  font-size: 0.81rem;
  color: var(--text-primary);
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.topbar-search input:focus,
.topbar-search input[type="text"]:focus,
.topbar-search input[type="search"]:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.12);
  outline: none;
}

.topbar-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.topbar-search-icon svg {
  width: 17px;
  height: 17px;
  display: block;
  flex-shrink: 0;
}

/* Selector / Botón de Ajuste de Ventanas Responsive */
.window-layout-control {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  padding: 2px 4px;
  gap: 4px;
}

.window-layout-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.window-layout-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.window-layout-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.window-layout-select {
  width: auto !important;
  padding: 4px 6px !important;
  font-size: 0.74rem !important;
  font-weight: 600;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--dark-blue) !important;
  cursor: pointer;
}

/* Breadcrumb */
.bs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  list-style: none;
  white-space: nowrap;
}

.bs-breadcrumb .crumb-root {
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
}

.bs-breadcrumb .crumb-root:hover {
  color: var(--primary);
}

.bs-breadcrumb .crumb-active {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Sync Pill */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.sync-pill.online {
  background: var(--accent-mint-light);
  color: #17835b;
  border: 1px solid #c7f2e1;
}

.sync-pill.offline {
  background: var(--accent-warning-light);
  color: var(--warning);
  border: 1px solid #f6e1b2;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* User Profile Chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 4px 10px 4px 4px;
  border-radius: 50rem;
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--twt-navy-border);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name-bold {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.user-role-muted {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

@media (max-width: 992px) {
  .bs-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .bs-content-wrapper,
  body.sidebar-collapsed .bs-content-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
  body.sidebar-mobile-open .bs-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
}

/* ============================================================================
   4. MAIN CONTAINER & PAGE HEADERS
   ============================================================================ */
.main-container {
  flex: 1;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 24px 48px;
  overflow-x: hidden;
  container-type: inline-size;
  container-name: workspace;
}

.page-header {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-saas);
}

.page-header h1 {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ============================================================================
   5. DASHBOARD: 4 KPI CARDS SEGÚN REFERENCIA ESTÉTICA
   ============================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-saas);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  min-width: 0;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--twt-navy-border);
}

.kpi-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 1.48rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kpi-trend {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.kpi-trend.positive,
.kpi-trend.success {
  background: var(--accent-mint-light);
  color: #17835b;
}

.kpi-trend.warning {
  background: var(--accent-warning-light);
  color: #b8820a;
}

.kpi-trend.coral,
.kpi-trend.danger {
  background: var(--accent-coral-light);
  color: #e05235;
}

.kpi-trend.info {
  background: var(--accent-cyan-light);
  color: #0284c7;
}

.kpi-sub-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Ícono Cuadrado Sólido (Referencia Exacta: 44x44px con ícono blanco) */
.kpi-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

.kpi-icon-badge svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
}

.kpi-icon-badge.bg-primary { background: var(--primary); }
.kpi-icon-badge.bg-cyan    { background: var(--accent-cyan); }
.kpi-icon-badge.bg-mint    { background: var(--accent-mint); }
.kpi-icon-badge.bg-coral   { background: var(--accent-coral); }
.kpi-icon-badge.bg-warning { background: var(--accent-warning); }

/* ============================================================================
   6. DASHBOARD: MIDDLE ROW (STATISTICS 65% + RECENT ACTIVITY 35%)
   ============================================================================ */
.dashboard-mid-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 992px) {
  .dashboard-mid-row {
    grid-template-columns: 1fr;
  }
}

.clean-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  gap: 12px;
}

.card-title-saas {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-subtitle-saas {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.bg-primary { background: var(--primary); }
.legend-dot.bg-cyan    { background: var(--accent-cyan); }
.legend-dot.bg-mint    { background: var(--accent-mint); }
.legend-dot.bg-coral   { background: var(--accent-coral); }

/* SVG Minimal Bar Chart */
.saas-bar-chart-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 8px 4px;
}

.saas-bar-chart-svg {
  width: 100%;
  height: auto;
  min-height: 220px;
  display: block;
}

.saas-bar-chart-svg rect.bar-rect {
  fill: var(--primary);
  transition: fill 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
}

.saas-bar-chart-svg rect.bar-rect:hover {
  fill: var(--primary-hover);
  opacity: 0.9;
}

/* Timeline Vertical Recent Activity */
.timeline-list {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 24px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-item:last-child {
  padding-bottom: 4px;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-color);
}

.timeline-dot.bg-primary { background: var(--primary); }
.timeline-dot.bg-cyan    { background: var(--accent-cyan); }
.timeline-dot.bg-mint    { background: var(--accent-mint); }
.timeline-dot.bg-coral   { background: var(--accent-coral); }

.timeline-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.timeline-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================================================
   7. TARJETAS (.card, .card-header, .card-body)
   ============================================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-saas);
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.card-header,
.card-header.navy {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  color: var(--text-primary);
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h2,
.card-header.navy h2 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   8. TABLAS REFINADAS Y LIMPIAS
   ============================================================================ */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}

table.data-table thead th {
  background: #FFFFFF;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.69rem;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
}

table.data-table tbody tr {
  transition: background-color 0.12s ease;
}

table.data-table tbody tr:hover {
  background-color: var(--bg-subtle);
}

/* ============================================================================
   9. FORMULARIOS, INPUTS Y SELECTS
   ============================================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field label {
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-primary);
}

.field label .req {
  color: var(--accent-coral);
}

.bs-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.bs-input-group-text {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-input) 0 0 var(--radius-input);
  white-space: nowrap;
}

.bs-input-group input,
.bs-input-group select {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 12px;
}

input.money-input {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.12);
}

.error-msg {
  display: none;
  color: var(--accent-coral);
  font-size: 0.74rem;
  font-weight: 500;
  margin-top: 2px;
}

input:user-invalid,
select:user-invalid,
input.user-invalid-fallback,
select.user-invalid-fallback {
  border-color: var(--accent-coral);
  background-color: var(--accent-coral-light);
}

input:user-invalid + .error-msg,
select:user-invalid + .error-msg,
input.user-invalid-fallback + .error-msg,
select.user-invalid-fallback + .error-msg {
  display: block;
}

/* ============================================================================
   10. BOTONES Y BADGES
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  font-size: 0.81rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.75rem;
}

.btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 0.88rem;
}

.btn svg,
.btn-sm svg,
.btn-lg svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-sm svg {
  width: 13px;
  height: 13px;
}

.bs-input-group-text svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  display: block;
  flex-shrink: 0;
}

h1 svg, h2 svg, h3 svg, h4 svg {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 6px;
  flex-shrink: 0;
  color: var(--primary);
}

.page-header h1 svg,
.card-header h2 svg,
.card-header h3 svg,
.modal-header h2 svg,
.modal-header h3 svg {
  margin-right: 0;
  vertical-align: middle;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-gold {
  background: var(--accent-warning);
  border-color: #e5b155;
  color: var(--dark-blue);
  font-weight: 600;
}

.btn-gold:hover {
  background: #e5b155;
  color: var(--dark-blue);
}

.btn-success {
  background: var(--accent-mint);
  border-color: #4ec29c;
  color: #ffffff;
}

.btn-success:hover {
  background: #4ec29c;
  color: #ffffff;
}

.btn-danger {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  color: #ffffff;
}

.btn-danger:hover {
  background: #e65f63;
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--twt-navy-border);
  color: var(--primary);
}

.btn-toggle-eye.active {
  background: var(--twt-navy-soft) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* Badges de Estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 50rem;
  font-size: 0.71rem;
  font-weight: 600;
}

.badge-success { background: var(--accent-mint-light); color: #17835b; border: 1px solid #c7f2e1; }
.badge-warning { background: var(--accent-warning-light); color: #b8820a; border: 1px solid #f6e1b2; }
.badge-danger  { background: var(--accent-coral-light); color: #e05235; border: 1px solid #fbd2d4; }
.badge-info    { background: var(--accent-cyan-light); color: #0284c7; border: 1px solid #bae6fd; }
.badge-navy    { background: var(--primary-light); color: var(--primary); border: 1px solid var(--twt-navy-border); }
.badge-gold    { background: var(--accent-warning-light); color: #b8820a; border: 1px solid #f6e1b2; }

/* ============================================================================
   11. POS / BILLING WORKSPACE & MODOS DE VENTANAS
   ============================================================================ */
.pos-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
}

.pos-grid > div,
.pos-grid > section.card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.pos-grid > div > .card {
  flex: 1;
  margin-bottom: 0;
}

.pos-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.pos-quick-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.pos-quick-tile:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.pos-quick-tile.product {
  background: var(--accent-warning-light);
  border-color: var(--twt-gold-border);
}

.pos-quick-tile-title {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
}

.pos-quick-tile-price {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.pos-summary-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-card);
  padding: 16px;
  border: 1px solid var(--border-color);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.summary-row.total {
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-row.total .total-num {
  color: var(--primary);
}

/* ============================================================================
   LÍNEAS DE FACTURACIÓN POS — EDICIÓN FLUIDA Y VISIBILIDAD DE CAMPOS
   ============================================================================ */
table.data-table.pos-items-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

table.data-table.pos-items-table thead th {
  padding: 10px 8px;
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

table.data-table.pos-items-table td {
  padding: 8px 6px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
}

/* Ocultar spinners nativos en toda la tabla POS para evitar que tapen los números */
.pos-items-table input[type="number"]::-webkit-outer-spin-button,
.pos-items-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pos-items-table input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Inputs y Selects dentro de la tabla POS */
.pos-items-table input.pos-item-input,
.pos-items-table select.pos-item-select {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  font-size: 0.83rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pos-items-table input.pos-item-input:focus,
.pos-items-table select.pos-item-select:focus,
.pos-items-table textarea.pos-item-desc:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.15);
  background: #ffffff;
}

/* Cantidad: centrado, texto tabular, sin flechas */
.pos-items-table input.pos-item-qty {
  text-align: center;
  font-weight: 600;
  padding: 0 6px;
}

/* Precio: alineado a la derecha con número tabular */
.pos-items-table input.pos-item-price {
  text-align: right;
  font-weight: 500;
  padding: 0 8px;
}

/* Select de ITBIS DGII: suficiente ancho y padding sin cortar texto */
.pos-items-table select.pos-item-select {
  padding: 0 24px 0 8px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  background-position: right 6px center;
  min-width: 100px;
}

/* Descripción del servicio: autoexpandible, legible, multilínea si es largo */
.pos-items-table textarea.pos-item-desc {
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 7px 9px;
  font-size: 0.82rem;
  font-family: inherit;
  line-height: 1.35;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  resize: vertical;
  box-sizing: border-box;
  overflow-y: hidden;
  display: block;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pos-items-table .pos-item-meta {
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
  line-height: 1.2;
}

/* Columnas numéricas en POS */
.pos-items-table td.pos-num-col,
.pos-items-table th.pos-num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================================================
   ACCIONES COMPACTAS POR FACTURA & PORTAL FLOTANTE (SIN RECORTES)
   ============================================================================ */
.action-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-action-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
}

.btn-action-trigger.active {
  background: var(--bg-subtle) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(69, 95, 193, 0.18) !important;
}

/* PORTAL FLOTANTE GLOBAL (PORTAL / POPPER EN BODY) */
.floating-action-portal {
  position: fixed;
  z-index: 999999;
  background: #ffffff;
  min-width: 215px;
  max-width: 280px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(100vh - 24px);
  animation: floatingPortalFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

.floating-action-portal[data-placement="top"] {
  transform-origin: bottom right;
  animation: floatingPortalFadeInUp 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatingPortalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floatingPortalFadeInUp {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.floating-action-portal button,
.floating-action-portal a {
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  box-sizing: border-box;
  white-space: nowrap;
}

.floating-action-portal button svg,
.floating-action-portal a svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color 0.12s ease;
}

.floating-action-portal button:hover,
.floating-action-portal a:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.floating-action-portal button:hover svg,
.floating-action-portal a:hover svg {
  color: var(--primary);
}

.floating-action-portal button.text-danger {
  color: #dc2626;
}

.floating-action-portal button.text-danger svg {
  color: #dc2626;
}

.floating-action-portal button.text-danger:hover {
  background: #fff1f2;
  color: #b91c1c;
}

.floating-action-portal button.text-danger:hover svg {
  color: #b91c1c;
}

.floating-action-portal hr {
  margin: 5px 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
}

/* Compatibilidad con details nativo */
.action-dropdown {
  position: relative;
  display: inline-block;
}

.action-dropdown summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.action-dropdown summary::-webkit-details-marker {
  display: none;
}

.action-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 999;
  background: #ffffff;
  min-width: 200px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}

.action-dropdown .dropdown-menu button,
.action-dropdown .dropdown-menu a {
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 0.80rem;
  font-family: inherit;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease;
  box-sizing: border-box;
  white-space: nowrap;
}

.action-dropdown .dropdown-menu button:hover,
.action-dropdown .dropdown-menu a:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.action-dropdown .dropdown-menu button.text-danger {
  color: #dc2626;
}

.action-dropdown .dropdown-menu button.text-danger:hover {
  background: #fff1f2;
}

.action-dropdown .dropdown-menu hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
}

/* BUSCADOR DE SERVICIOS Y PRODUCTOS EN POS (DROPDOWN FLOTANTE) */
.search-box-wrap {
  position: relative;
  width: 100%;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  max-height: 320px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-subtle);
}

/* Modos de Organización de Ventanas */
body[data-window-layout="justified"] .kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

body[data-window-layout="balanced"] .pos-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-window-layout="compact"] .main-container {
  padding: 12px 16px 32px;
}

body[data-window-layout="compact"] .page-header {
  padding: 10px 16px;
  margin-bottom: 12px;
}

body[data-window-layout="compact"] .kpi-grid,
body[data-window-layout="compact"] .pos-grid,
body[data-window-layout="compact"] .dashboard-mid-row {
  gap: 12px;
  margin-bottom: 12px;
}

body[data-window-layout="stacked"] .pos-grid {
  grid-template-columns: 1fr !important;
}

@media (max-width: 1100px) {
  .pos-grid,
  body[data-window-layout="balanced"] .pos-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   11B. USERS & ROLES WORKSPACE RESPONSIVE GRID
   ============================================================================ */
.users-layout-grid {
  display: grid;
  grid-template-columns: minmax(360px, 450px) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.users-layout-grid > div {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.users-layout-grid > div > .card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 0;
  box-sizing: border-box;
}

.users-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.users-table-wrap table.data-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
}

body[data-window-layout="balanced"] .users-layout-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-window-layout="compact"] .users-layout-grid {
  gap: 12px;
}

body[data-window-layout="stacked"] .users-layout-grid {
  grid-template-columns: 1fr !important;
}

@container workspace (max-width: 1160px) {
  .users-layout-grid,
  body[data-window-layout="balanced"] .users-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}

@media (max-width: 1200px) {
  .users-layout-grid,
  body[data-window-layout="balanced"] .users-layout-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ============================================================================
   12. SUBTABS & SELECTOR DE MÉTODOS DE PAGO
   ============================================================================ */
.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.pay-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.pay-method-btn {
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-btn);
  padding: 9px 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--text-primary);
  transition: all 0.14s ease;
}

.pay-method-btn:hover {
  border-color: var(--twt-navy-border);
  background: var(--bg-subtle);
}

.pay-method-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

/* ============================================================================
   13. MODALES NATIVOS <dialog>
   ============================================================================ */
dialog.twt-dialog {
  margin: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-dialog);
  padding: 0;
  max-width: 580px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  overflow: hidden;
}

dialog.twt-dialog.dialog-lg {
  max-width: 780px;
}

dialog#ri-preview-dialog {
  max-width: 880px;
  width: min(880px, calc(100vw - 28px));
}

dialog#ecf-xml-dialog {
  max-width: 820px;
  width: min(820px, calc(100vw - 28px));
}

dialog.twt-dialog::backdrop {
  background: rgba(41, 62, 120, 0.4);
  backdrop-filter: blur(2px);
}

.dialog-header {
  background: #ffffff;
  color: var(--text-primary);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.dialog-header h2 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dialog-body {
  padding: 20px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.dialog-footer {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================================
   14. TOAST NOTIFICATIONS
   ============================================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #243668;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-md);
  font-size: 0.81rem;
  font-weight: 500;
  border-left: 4px solid var(--accent-mint);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================================
   15. SPINNER DE CARGA Y BANNER DE ESTADO DE OPERACIÓN (ABONOS / PAGOS)
   ============================================================================ */
.twt-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: twtSpin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes twtSpin {
  to {
    transform: rotate(360deg);
  }
}

.payment-status-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 10px;
}

.payment-status-banner.processing,
.payment-status-banner.is-info {
  display: flex;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.payment-status-banner.success,
.payment-status-banner.is-success {
  display: flex;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.payment-status-banner.error,
.payment-status-banner.is-error {
  display: flex;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

button:disabled,
.btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================================
   16. BUSCADOR INTELIGENTE DE FACTURAS Y SUGERENCIAS DESPLEGABLES FLOTANTES
   ============================================================================ */
.module-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 480px;
}

.module-search-box .module-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.module-search-box .module-search-icon svg {
  width: 17px;
  height: 17px;
  display: block;
  flex-shrink: 0;
}

.module-search-box input,
.module-search-box input[type="text"],
.module-search-box input[type="search"] {
  width: 100%;
  height: 38px;
  line-height: 36px;
  padding: 0 36px 0 44px !important;
  padding-left: 44px !important;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-family: var(--font-sans, 'Poppins', sans-serif);
  font-size: 0.82rem;
  color: var(--twt-navy-dark, #0f172a);
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.module-search-box input:focus,
.module-search-box input[type="text"]:focus,
.module-search-box input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.12);
  outline: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  z-index: 2;
}

.search-clear-btn:hover {
  background: var(--bg-subtle);
  color: var(--twt-navy-dark);
}

.floating-search-portal {
  position: fixed;
  z-index: 99999;
  background: #ffffff;
  font-family: var(--font-sans, 'Poppins', sans-serif);
  color: var(--twt-navy-dark, #0f172a);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.14), 0 4px 10px -3px rgba(15, 23, 42, 0.07);
  max-height: min(380px, calc(100vh - 96px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
}

.search-portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.search-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: var(--font-sans, 'Poppins', sans-serif);
  color: var(--twt-navy-dark, #0f172a);
  transition: background-color 0.12s ease;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.is-active {
  background: #f1f5f9;
}

.search-suggestion-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--primary, #2952cc);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.search-suggestion-main {
  flex: 1;
  min-width: 0;
}

.search-suggestion-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.search-suggestion-code {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--twt-navy-dark, #0f172a);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-suggestion-client {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.search-suggestion-meta {
  font-size: 0.73rem;
  color: var(--text-secondary, #475569);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  line-height: 1.35;
}

.twt-search-highlight {
  background: #fef08a;
  color: #0f172a;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}

.search-empty-state {
  padding: 16px 12px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

@keyframes rowLocateHighlight {
  0% { background-color: #fef9c3; }
  70% { background-color: #fef9c3; }
  100% { background-color: transparent; }
}

tr.located-sale-row {
  animation: rowLocateHighlight 2.6s ease-out;
}

/* ============================================================================
   18. CATÁLOGO SAAS UX/UI (SERVICIOS, PRODUCTOS Y ADMINISTRACIÓN DE CATEGORÍAS)
   ============================================================================ */

.catalog-toolbar-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.catalog-filters-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 380px;
  flex-wrap: wrap;
}

.catalog-search-wrapper {
  position: relative;
  flex: 1 1 240px;
  max-width: 380px;
  min-width: 200px;
}

.catalog-search-input {
  width: 100%;
  height: 38px;
  padding-left: 38px !important;
  padding-right: 12px !important;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.82rem;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.catalog-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.12);
  outline: none;
}

.catalog-filter-select {
  width: auto !important;
  height: 38px;
  padding: 0 30px 0 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 165px;
  max-width: 240px;
  cursor: pointer;
  box-sizing: border-box;
}

.catalog-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.catalog-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.catalog-primary-btn {
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 600;
}

.catalog-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.catalog-table thead th {
  background: #F8FAFC;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  vertical-align: middle;
}

.catalog-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  font-size: 0.83rem;
  color: var(--text-primary);
  box-sizing: border-box;
}

.catalog-table tbody tr:last-child td {
  border-bottom: none;
}

.catalog-table tbody tr:hover {
  background-color: #F8FAFC;
}

/* Distribución equilibrada de columnas del Catálogo */
.catalog-table .col-id {
  width: 72px;
  min-width: 68px;
  white-space: nowrap;
  color: #64748B;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.catalog-table .col-desc {
  min-width: 240px;
  max-width: 440px;
}

.catalog-item-title {
  font-weight: 600;
  color: #0F172A;
  line-height: 1.35;
}

.catalog-item-subdesc {
  font-size: 0.74rem;
  color: #64748B;
  margin-top: 2px;
  line-height: 1.3;
}

.catalog-table .col-cat {
  width: 195px;
  min-width: 160px;
  max-width: 240px;
  white-space: nowrap;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 215px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.cat-tag-parent-prefix {
  color: #64748B;
  font-weight: 500;
}

.cat-tag-sep {
  color: #94A3B8;
  margin: 0 2px;
}

.catalog-table .col-stock {
  width: 115px;
  min-width: 105px;
  text-align: center;
  white-space: nowrap;
}

.catalog-table th.col-money,
.catalog-table td.col-money {
  width: 145px;
  min-width: 135px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-left: 16px;
  padding-right: 16px;
}

.catalog-table td.col-money-total {
  font-weight: 700;
  color: var(--primary, #2952CC);
}

.catalog-table th.col-actions,
.catalog-table td.col-actions {
  width: 185px;
  min-width: 175px;
  text-align: right;
  white-space: nowrap;
}

.catalog-categories-table th.col-actions,
.catalog-categories-table td.col-actions,
.categories-table th.col-actions,
.categories-table td.col-actions {
  width: 220px;
  min-width: 210px;
  text-align: right;
  white-space: nowrap;
}

/* Contenedor de botones de acción en una sola línea */
.table-actions-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  box-sizing: border-box;
  vertical-align: middle;
}

.btn-action-primary {
  height: 34px;
  padding: 0 12px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  border-radius: 7px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-action-primary svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.btn-Action-subcat,
.btn-action-subcat {
  height: 34px;
  padding: 0 11px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 7px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--primary, #2952CC);
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-action-subcat svg {
  width: 14px;
  height: 14px;
  stroke-width: 2px;
  flex-shrink: 0;
  display: block;
}

.btn-action-subcat:hover {
  background: var(--primary-light, #EEF2FF);
  border-color: var(--primary, #2952CC);
  color: var(--primary, #2952CC);
}

.btn-action-subcat:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.18);
}

.btn-icon-action {
  width: 34px;
  height: 34px;
  min-width: 34px;
  max-width: 34px;
  padding: 0 !important;
  border-radius: 7px;
  border: 1px solid var(--border-color, #E2E8F0);
  background: #ffffff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
  line-height: 1;
}

.btn-icon-action svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.85px;
  flex-shrink: 0;
  display: block;
}

.btn-icon-action:hover {
  background: #F1F5F9;
  color: var(--primary, #2952CC);
  border-color: #CBD5E1;
}

.btn-icon-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(69, 95, 193, 0.18);
}

.btn-icon-action.btn-icon-danger,
.btn-icon-action.danger {
  color: #DC2626;
  border-color: #FECACA;
  background: #FFF5F5;
}

.btn-icon-action.btn-icon-danger:hover,
.btn-icon-action.danger:hover {
  background: #FEE2E2;
  color: #B91C1C;
  border-color: #FCA5A5;
}

/* Jerarquía visual de Categorías y Subcategorías */
.cat-parent-row,
.cat-row-principal {
  background: #FFFFFF;
}

.cat-sub-row,
.cat-row-sub {
  background: #FCFDFE;
}

.cat-inactive-row,
.cat-row-inactive {
  opacity: 0.65;
  background: #F8FAFC;
}

.cat-hierarchy-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cat-hierarchy-cell.is-subcategory,
.cat-hierarchy-cell.is-sub {
  padding-left: 24px;
}

.subcat-tree-branch {
  color: #94A3B8;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.cat-folder-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cat-folder-icon.parent {
  background: #EEF2FF;
  color: #455FC1;
  border: 1px solid #E0E7FF;
}

.cat-folder-icon.sub {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.cat-folder-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.cat-name-block {
  min-width: 0;
  flex: 1;
}

.cat-name-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-name-text {
  font-weight: 600;
  color: #0F172A;
  line-height: 1.35;
}

.cat-row-sub .cat-name-text {
  font-weight: 500;
  color: #1E293B;
}

.cat-desc-sub {
  font-size: 0.74rem;
  color: #64748B;
  margin-top: 2px;
  line-height: 1.3;
}

.cat-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #64748B;
  font-size: 0.69rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.cat-parent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.cat-parent-badge svg {
  width: 13px;
  height: 13px;
  color: #64748B;
  flex-shrink: 0;
}

.cat-parent-dash,
.cat-root-dash {
  color: #94A3B8;
  font-weight: 500;
  font-size: 0.78rem;
}

.col-cat-parent {
  width: 195px;
  min-width: 165px;
  white-space: nowrap;
}

.col-cat-type {
  width: 165px;
  min-width: 150px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .catalog-toolbar-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .catalog-filters-group {
    justify-content: flex-start;
  }
  .catalog-actions-group {
    justify-content: space-between;
  }
}
