/* GestionLogic ERP — Plantilla Personalizable estilo Microsoft Dynamics NAV / Navision */
:root {
  --nav-topbar: #002050;
  --nav-primary: #0078d4;
  --nav-primary-hover: #106ebe;
  --nav-accent: #008272;
  --nav-sidebar-bg: #ffffff;
  --nav-bg: #f1f5f9;
  --nav-surface: #ffffff;
  --nav-border: #cbd5e1;
  --nav-row-pad-y: 4px;
  --nav-row-pad-x: 7px;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--nav-bg);
  color: #0f172a;
  font-size: 13px;
}

.nav-topbar {
  background: var(--nav-topbar);
  color: #fff;
  height: 44px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 2px solid var(--nav-primary);
  gap: 6px;
}

.nav-shell {
  display: flex;
  max-width: 100%;
  height: calc(100vh - 44px);
  overflow: hidden;
}

.nav-sidebar {
  width: 208px;
  background: var(--nav-sidebar-bg);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.15s ease, opacity 0.15s ease;
}

@media (min-width: 1101px) {
  .nav-shell.sidebar-collapsed .nav-sidebar {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

.nav-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.nav-ribbon {
  background: #ffffff;
  border-bottom: 1px solid var(--nav-border);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 100%;
}

.nav-content {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  max-width: 100%;
}

/* Tablas densas estilo Navision — sin desplazamiento horizontal */
.nav-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.nav-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
}

.nav-table thead th {
  position: sticky;
  top: 0;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  padding: 5px 5px;
  border-bottom: 2px solid #94a3b8;
  text-align: left;
  white-space: normal;
  z-index: 2;
}

.nav-table tbody td {
  padding: var(--nav-row-pad-y) 5px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nav-table-compact thead th { padding: 4px 4px; font-size: 9.5px; }
.nav-table-compact tbody td { padding: 3px 4px !important; font-size: 11.5px; }

.cell-sub {
  display: block;
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.25;
  margin-top: 1px;
}

.nav-table tbody tr:hover {
  background: #eff6ff;
}

.nav-table th.num, .nav-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Cue Tiles estilo Role Center Dynamics NAV */
.cue-tile {
  background: #fff;
  border: 1px solid var(--nav-border);
  border-left: 4px solid var(--nav-primary);
  padding: 9px 11px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cue-tile:hover {
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}
.cue-tile.cue-accent { border-left-color: var(--nav-accent); }
.cue-tile.cue-amber { border-left-color: #d97706; }
.cue-tile.cue-red { border-left-color: #dc2626; }
.cue-tile.cue-green { border-left-color: #16a34a; }
.cue-tile.cue-purple { border-left-color: #7c3aed; }

.nav-card {
  background: #fff;
  border: 1px solid var(--nav-border);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.nav-card-head {
  background: #f8fafc;
  border-bottom: 1px solid var(--nav-border);
  padding: 6px 10px;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-input, .nav-select, .nav-textarea {
  border: 1px solid #94a3b8;
  border-radius: 2px;
  padding: 4px 6px;
  font-size: 12.5px;
  background: #fff;
  color: #0f172a;
  width: 100%;
}

.nav-input:focus, .nav-select:focus, .nav-textarea:focus {
  outline: 2px solid var(--nav-primary);
  border-color: var(--nav-primary);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 2px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav-btn:hover { background: #e2e8f0; }

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

.nav-btn-accent {
  background: var(--nav-accent);
  border-color: var(--nav-accent);
  color: #fff;
}
.nav-btn-accent:hover { filter: brightness(0.92); }

.nav-btn-danger {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}
.nav-btn-danger:hover { background: #b91c1c; }

.ico-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}
.ico-btn:hover { background: var(--nav-primary); color: #fff; border-color: var(--nav-primary); }
.ico-btn.danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.ico-btn.success:hover { background: #059669; border-color: #059669; color: #fff; }

.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 9.5px;
  line-height: 1.3;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-slate { background: #e2e8f0; color: #334155; }

/* Evitar que elementos dentro de CSS Grid ensanchen las columnas y recorten bordes */
.grid > *, .split-grid > * { min-width: 0; }
.nav-table-fixed { table-layout: fixed; }
.nav-table td .cell-truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* FactBox lateral estilo Navision */
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
  align-items: start;
}
.split-grid > * { min-width: 0; }
.split-grid.no-factbox {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1200px) {
  .split-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1100px) {
  .nav-sidebar {
    position: fixed;
    left: 0;
    top: 44px;
    bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.15s;
  }
  .nav-sidebar.open { transform: translateX(0); }
}

.series-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 1150px) {
  .series-cards-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Secciones del menú lateral */
.nav-menu-section {
  padding-top: 7px;
  margin-top: 7px;
  border-top: 1px solid #e2e8f0;
}
.nav-menu-section:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}
.nav-menu-section-title {
  padding: 2px 8px 4px 8px;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Pestañas en fichas (Clientes, Proveedores, Empleados) */
.gl-card-tabs {
  background: #f8fafc;
  border-bottom: 1px solid var(--nav-border);
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.gl-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.gl-tab-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--nav-topbar);
}
.gl-tab-btn.active {
  background: var(--nav-topbar);
  border-color: var(--nav-topbar);
  color: #ffffff;
}
.gl-tab-btn.gl-tab-dragging { opacity: 0.45; }
.gl-tab-btn.gl-tab-drop { outline: 2px dashed #f97316; }

.gl-tab-panel { display: none; }
.gl-tab-panel.active { display: block; }

/* Personalización de columnas en tablas */
.gl-col-cfg-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.gl-col-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: #f97316;
  border: 1px solid #ea580c;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}
.gl-col-popover {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  width: 235px;
  max-height: 340px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  padding: 8px;
  z-index: 80;
}
.gl-col-popover.open { display: block; }
.gl-col-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.gl-col-item:hover { background: #fff7ed; }

/* Ordenación de columnas */
.gl-sortable-th { cursor: pointer; user-select: none; }
.gl-sortable-th:hover { background: #cbd5e1 !important; }
.gl-sort-ind { margin-left: 3px; font-size: 9px; color: #64748b; }

/* Modales */
.gl-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 70;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.gl-modal.open { display: flex; }
.gl-modal-box {
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .nav-shell { height: auto; overflow: visible; }
  .nav-workspace, .nav-content { overflow: visible; padding: 0; }
}

/* Validación en vivo y autocompletado inteligente */
.nav-input.gl-field-valid {
  border-color: #16a34a !important;
  background-color: #f0fdf4 !important;
}
.nav-input.gl-field-invalid {
  border-color: #dc2626 !important;
  background-color: #fef2f2 !important;
}
.gl-field-msg {
  font-size: 10.5px;
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.25;
}
.gl-field-msg.ok { color: #15803d; }
.gl-field-msg.err { color: #b91c1c; }
.gl-highlight-tasadora {
  border-color: #7c3aed !important;
  background-color: #f5f3ff !important;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.nav-card { max-width: 100%; min-width: 0; }
.nav-card-head { flex-wrap: wrap; }

/* Toast stack sustituyendo alert() */
.gl-toast-stack {
  position: fixed;
  top: 52px;
  right: 14px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
  pointer-events: none;
}
.gl-toast {
  pointer-events: auto;
  background: #0f172a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  border-left: 4px solid var(--nav-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gl-toast.ok { background: #14532d; border-left-color: #22c55e; }
.gl-toast.err { background: #7f1d1d; border-left-color: #f87171; }
.gl-toast.info { background: #002050; border-left-color: #38bdf8; }

/* Enlaces rápidos Email y WhatsApp Web vinculados a campos */
.gl-contact-field-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.gl-contact-field-row .nav-input { flex: 1; min-width: 0; }
.gl-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 26px;
  padding: 0 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
  transition: opacity 0.12s, filter 0.12s;
}
.gl-contact-btn.email { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.gl-contact-btn.email:hover:not(.disabled) { background: #1d4ed8; color: #fff; }
.gl-contact-btn.wa { background: #ecfdf5; color: #15803d; border-color: #bbf7d0; }
.gl-contact-btn.wa:hover:not(.disabled) { background: #16a34a; color: #fff; }
.gl-contact-btn.disabled {
  opacity: 0.42;
  pointer-events: none;
  filter: grayscale(1);
}

/* Campana de notificaciones en topbar */
.gl-notif-wrap { position: relative; display: inline-flex; align-items: center; }
.gl-notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  cursor: pointer;
}
.gl-notif-bell:hover { background: rgba(255, 255, 255, 0.25); }
.gl-notif-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 99px;
  line-height: 14px;
}
.gl-notif-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 300px;
  max-width: calc(100vw - 24px);
  background: #fff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  z-index: 90;
  overflow: hidden;
}
.gl-notif-dropdown.open { display: block; }

/* Autocomplete en campo único (Cliente, Proveedor, etc.) */
.gl-ac-wrap { position: relative; width: 100%; min-width: 0; }
.gl-ac-input { padding-right: 26px !important; }
.gl-ac-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  display: none;
}
.gl-ac-clear:hover { background: #cbd5e1; color: #0f172a; }
.gl-ac-clear.visible { display: block; }
.gl-ac-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 230px;
  overflow-y: auto;
  z-index: 75;
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}
.gl-ac-menu.open { display: block; }
.gl-ac-item {
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}
.gl-ac-item:last-child { border-bottom: none; }
.gl-ac-item:hover, .gl-ac-item.active { background: #eff6ff; color: #002050; font-weight: 600; }
.gl-ac-empty { padding: 7px 8px; font-size: 11.5px; color: #64748b; }

/* Select con buscador inline y paginación */
.gl-combo-wrap { display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0; }
.gl-combo-filter { font-size: 11px !important; padding: 2px 6px !important; background: #f8fafc !important; border-color: #cbd5e1 !important; }
.gl-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--nav-border);
  background: #f8fafc;
  font-size: 11.5px;
}
.doc-line-row.is-suplido-row { background: #f0f9ff; }
.line-suplido-readonly { background: #f1f5f9 !important; color: #64748b !important; }

/* Estado trazabilidad envíos Email / WhatsApp + cambio de color del sobre */
.doc-sent-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.doc-sent-pill.email, .doc-sent-pill.email-enviado { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.doc-sent-pill.email-recibido { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.doc-sent-pill.email-leido { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.doc-sent-pill.wa { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.doc-sent-pill.none { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.gl-mail-btn-none { color: #64748b !important; border-color: #cbd5e1 !important; background: #f8fafc !important; }
.nav-topbar select option { background-color: #ffffff !important; color: #0f172a !important; font-weight: 600; }
.gl-mail-btn-enviado { color: #1d4ed8 !important; border-color: #93c5fd !important; background: #dbeafe !important; }
.gl-mail-btn-recibido { color: #b45309 !important; border-color: #fcd34d !important; background: #fef3c7 !important; }
.gl-mail-btn-leido { color: #15803d !important; border-color: #4ade80 !important; background: #dcfce7 !important; font-weight: 700 !important; }

/* Tablero Kanban 5 columnas sin scroll horizontal y Drag & Drop */
.gl-kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
@media (max-width: 1024px) {
  .gl-kanban-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .gl-kanban-board { grid-template-columns: minmax(0, 1fr); }
}
.gl-kanban-col {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px;
  min-width: 0;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gl-kanban-col.drag-over, .cal-day-cell.drag-over {
  background: #e0f2fe !important;
  outline: 2px dashed #0284c7;
}
.gl-kanban-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #0078d4;
  border-radius: 3px;
  padding: 6px 7px;
  font-size: 11px;
  cursor: grab;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.gl-kanban-card:active { cursor: grabbing; }

/* Calendario / Agenda de Empleados */
.cal-grid-7 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--nav-border);
  border-left: 1px solid var(--nav-border);
  width: 100%;
  max-width: 100%;
}
.cal-head-cell {
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  text-align: center;
  padding: 5px 4px;
  border-right: 1px solid var(--nav-border);
  border-bottom: 2px solid #94a3b8;
  min-width: 0;
}
.cal-day-cell {
  min-height: 98px;
  padding: 4px;
  background: #fff;
  border-right: 1px solid var(--nav-border);
  border-bottom: 1px solid var(--nav-border);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-day-cell.other-month { background: #f8fafc; opacity: 0.72; }
.cal-day-cell.today { background: #eff6ff; box-shadow: inset 0 2px 0 var(--nav-primary); }
.cal-event-pill {
  display: block;
  width: 100%;
  text-align: left;
  padding: 2px 5px;
  border-radius: 3px;
  border-left: 4px solid #0078d4;
  font-size: 10.5px;
  line-height: 1.25;
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cal-event-pill:hover { filter: brightness(0.96); }
.cal-emp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.cal-emp-chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.cal-color-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
@media (max-width: 900px) {
  .cal-grid-7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================================
   MEJORAS UI: Menú Usuario, Breadcrumbs, Drawer Móvil, Estados Vacíos, Dark Mode
   ========================================================================= */

/* Menú Desplegable de Usuario en Topbar */
.gl-user-menu-wrap { position: relative; }
.gl-user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 8px 2px 3px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.gl-user-menu-btn:hover { background: rgba(0, 0, 0, 0.42); }
.gl-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--nav-primary);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.gl-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 242px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  z-index: 80;
  overflow: hidden;
}
.gl-user-dropdown.open { display: block; }
.gl-user-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  color: #1e293b;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 500;
}
.gl-user-dd-item:hover { background: #eff6ff; color: #002050; }

/* Migas de pan (Breadcrumbs) */
.gl-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.2;
  margin-bottom: 1px;
}
.gl-breadcrumbs a {
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
}
.gl-breadcrumbs a:hover { color: var(--nav-primary); text-decoration: underline; }

/* Sidebar Drawer en Tablet / Móvil (<= 1100px) */
.gl-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 44px 0 0 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 55;
  backdrop-filter: blur(1px);
}
.gl-sidebar-backdrop.open { display: block; }

@media (max-width: 1100px) {
  .nav-sidebar {
    position: fixed;
    top: 44px;
    left: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
  }
  .nav-sidebar.open {
    transform: translateX(0);
  }
}
@media (max-width: 1024px) {
  .nav-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Estados vacíos en tablas */
.gl-empty-cell {
  padding: 20px 12px !important;
  text-align: center !important;
  color: #64748b !important;
}
.gl-empty-cell-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.gl-empty-cell-ico {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Botón en proceso de envío (anti doble clic) */
.gl-btn-submitting {
  opacity: 0.72 !important;
  pointer-events: none !important;
  cursor: wait !important;
}

/* =========================================================================
   MODO OSCURO OPCIONAL POR USUARIO (html.gl-dark) — ALTO CONTRASTE AAA
   ========================================================================= */
html.gl-dark {
  --nav-bg: #0b1120;
  --nav-surface: #151e2e;
  --nav-sidebar-bg: #111827;
  --nav-border: #273449;
  color-scheme: dark;
}
html.gl-dark body {
  background: var(--nav-bg);
  color: #e2e8f0;
}
html.gl-dark .nav-sidebar,
html.gl-dark .nav-ribbon,
html.gl-dark .nav-card,
html.gl-dark .kpi-tile,
html.gl-dark .cue-tile,
html.gl-dark .gl-modal-box,
html.gl-dark .gl-notif-dropdown,
html.gl-dark .gl-user-dropdown,
html.gl-dark .gl-kanban-card,
html.gl-dark .cal-day-cell {
  background: var(--nav-surface) !important;
  border-color: var(--nav-border) !important;
  color: #e2e8f0 !important;
}
html.gl-dark .nav-sidebar > div:first-child,
html.gl-dark .nav-sidebar-head,
html.gl-dark .nav-card-head,
html.gl-dark .gl-card-tabs {
  background: #0f172a !important;
  border-color: var(--nav-border) !important;
  color: #f1f5f9 !important;
}
html.gl-dark .gl-tab-btn { color: #94a3b8; }
html.gl-dark .gl-tab-btn:hover { color: #f1f5f9; background: rgba(148, 163, 184, 0.08); }
html.gl-dark .gl-tab-btn.active {
  background: var(--nav-surface);
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}
html.gl-dark .nav-ribbon h1 { color: #f8fafc !important; }
html.gl-dark kbd {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

/* Textos de alto contraste en modo oscuro */
html.gl-dark .gl-breadcrumbs,
html.gl-dark .gl-breadcrumbs a,
html.gl-dark .cell-sub,
html.gl-dark .kpi-label,
html.gl-dark .text-slate-400,
html.gl-dark .text-slate-500,
html.gl-dark .text-slate-600 { color: #94a3b8 !important; }

html.gl-dark .text-slate-700,
html.gl-dark .text-slate-800,
html.gl-dark .text-slate-900,
html.gl-dark .text-\[\#002050\],
html.gl-dark .text-\[\#005a9e\] { color: #f1f5f9 !important; }

html.gl-dark .text-\[\#0078d4\],
html.gl-dark .text-blue-700,
html.gl-dark .text-blue-800,
html.gl-dark .text-sky-700,
html.gl-dark .text-sky-800,
html.gl-dark .text-sky-900,
html.gl-dark .text-sky-950,
html.gl-dark .text-indigo-700,
html.gl-dark .text-indigo-800 { color: #60a5fa !important; }

html.gl-dark .text-emerald-700,
html.gl-dark .text-emerald-800,
html.gl-dark .text-emerald-900,
html.gl-dark .text-emerald-950,
html.gl-dark .text-\[\#008272\] { color: #34d399 !important; }

html.gl-dark .text-amber-700,
html.gl-dark .text-amber-800,
html.gl-dark .text-amber-900,
html.gl-dark .text-amber-950 { color: #fbbf24 !important; }

html.gl-dark .text-red-600,
html.gl-dark .text-red-700,
html.gl-dark .text-red-800,
html.gl-dark .text-red-900,
html.gl-dark .text-red-950 { color: #f87171 !important; }

html.gl-dark .text-purple-700,
html.gl-dark .text-purple-800,
html.gl-dark .text-purple-900,
html.gl-dark .text-purple-950,
html.gl-dark .text-violet-700 { color: #c084fc !important; }

/* Fondos claros pastel -> translúcidos oscuros elegantes */
html.gl-dark .bg-white,
html.gl-dark .bg-slate-50,
html.gl-dark .bg-slate-50\/70,
html.gl-dark .bg-slate-100,
html.gl-dark .bg-slate-200 {
  background-color: #162032 !important;
}
html.gl-dark .bg-blue-50,
html.gl-dark .bg-sky-50,
html.gl-dark .bg-sky-50\/60,
html.gl-dark .bg-sky-50\/70,
html.gl-dark .bg-indigo-50,
html.gl-dark .bg-indigo-50\/50 {
  background-color: rgba(56, 189, 248, 0.13) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
  color: #e0f2fe !important;
}
html.gl-dark .bg-amber-50,
html.gl-dark .bg-amber-50\/70,
html.gl-dark .bg-amber-100 {
  background-color: rgba(251, 191, 36, 0.13) !important;
  border-color: rgba(251, 191, 36, 0.32) !important;
  color: #fef3c7 !important;
}
html.gl-dark .bg-emerald-50,
html.gl-dark .bg-emerald-50\/50,
html.gl-dark .bg-emerald-100 {
  background-color: rgba(52, 211, 153, 0.13) !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
  color: #d1fae5 !important;
}
html.gl-dark .bg-red-50,
html.gl-dark .bg-red-50\/60,
html.gl-dark .bg-red-50\/70,
html.gl-dark .bg-red-100 {
  background-color: rgba(248, 113, 113, 0.14) !important;
  border-color: rgba(248, 113, 113, 0.32) !important;
  color: #fee2e2 !important;
}
html.gl-dark .bg-purple-50,
html.gl-dark .bg-purple-100 {
  background-color: rgba(192, 132, 252, 0.14) !important;
  border-color: rgba(192, 132, 252, 0.32) !important;
  color: #f3e8ff !important;
}

html.gl-dark .border-slate-100,
html.gl-dark .border-slate-200,
html.gl-dark .border-slate-300 {
  border-color: var(--nav-border) !important;
}

/* Sidebar enlaces hover/activo */
html.gl-dark .nav-sidebar a:hover {
  background-color: #1e293b !important;
  color: #ffffff !important;
}
html.gl-dark .nav-menu-section-title { color: #64748b !important; }

/* Tablas, inputs, botones y badges en oscuro */
html.gl-dark .nav-table { background: var(--nav-surface); color: #e2e8f0; }
html.gl-dark .nav-table thead th,
html.gl-dark .cal-head-cell {
  background: #0f172a !important;
  color: #cbd5e1 !important;
  border-bottom-color: var(--nav-border) !important;
}
html.gl-dark .nav-table tbody td { border-bottom-color: var(--nav-border); }
html.gl-dark .nav-table tbody tr:hover { background: #1e2c44 !important; }
html.gl-dark .nav-input,
html.gl-dark .nav-select,
html.gl-dark .nav-textarea {
  background: #0b1120 !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}
html.gl-dark .nav-btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
html.gl-dark .nav-btn:hover { background: #29384e; border-color: #475569; }
html.gl-dark .nav-btn-primary { background: var(--nav-primary); color: #ffffff; border-color: var(--nav-primary); }
html.gl-dark .nav-btn-accent { background: var(--nav-accent); color: #ffffff; border-color: var(--nav-accent); }
html.gl-dark .nav-btn-danger { background: #dc2626; color: #ffffff; border-color: #b91c1c; }
html.gl-dark .ico-btn {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}
html.gl-dark .ico-btn:hover { background: #334155; color: #ffffff; }
html.gl-dark .gl-user-dd-item { color: #e2e8f0; }
html.gl-dark .gl-user-dd-item:hover { background: #26354d; color: #ffffff; }
html.gl-dark .gl-empty-cell-ico { background: #0f172a; color: #64748b; }
html.gl-dark .badge-slate { background: #334155; color: #e2e8f0; }
html.gl-dark .badge-blue { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
html.gl-dark .badge-green { background: rgba(52, 211, 153, 0.2); color: #6ee7b7; }
html.gl-dark .badge-amber { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
html.gl-dark .badge-red { background: rgba(248, 113, 113, 0.22); color: #fca5a5; }
html.gl-dark .badge-purple { background: rgba(192, 132, 252, 0.22); color: #d8b4fe; }
html.gl-dark .cal-day-cell.other-month { background: #0f172a !important; }
html.gl-dark .cal-day-cell.today { background: #172554 !important; }
html.gl-dark .cal-event-pill { background: #0f172a; color: #e2e8f0; }

/* =========================================================================
   PULIDO ESTÉTICO SAAS MODERNO (Inter, Tarjetas suaves, Cebreado y Scroll fino)
   ========================================================================= */
html, body {
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.nav-card {
  border-radius: 8px;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
}
.nav-card-head {
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
  border-bottom-color: #e2e8f0;
  padding: 7px 11px;
}
.kpi-tile, .cue-tile {
  border-radius: 8px;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.cue-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}
.gl-modal-box {
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
}

/* Botones y pestañas con acabado más limpio */
.nav-btn {
  border-radius: 6px;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.08s ease;
}
.nav-btn:active { transform: scale(0.985); }
.nav-input, .nav-select, .nav-textarea {
  border-radius: 6px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.nav-input:focus, .nav-select:focus, .nav-textarea:focus {
  border-color: var(--nav-primary);
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.16);
  outline: none;
}

/* Cebreado sutil en tablas financieras para mejor lectura horizontal */
.nav-table thead th {
  background: #f1f5f9;
  color: #334155;
  border-bottom: 1.5px solid #cbd5e1;
}
.nav-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.nav-table tbody tr:hover {
  background: #eff6ff;
}
html.gl-dark .nav-table tbody tr:nth-child(even) {
  background: #1a2639;
}

/* Barras de desplazamiento finas y discretas */
.nav-sidebar::-webkit-scrollbar,
.nav-content::-webkit-scrollbar,
.nav-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.nav-sidebar::-webkit-scrollbar-thumb,
.nav-content::-webkit-scrollbar-thumb,
.nav-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
.nav-sidebar::-webkit-scrollbar-thumb:hover,
.nav-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
html.gl-dark .nav-sidebar::-webkit-scrollbar-thumb,
html.gl-dark .nav-content::-webkit-scrollbar-thumb {
  background: #475569;
}



