@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

/* ===================================================================
   DESIGN TOKENS
   =================================================================== */
:root {
  /* Backgrounds */
  --app-bg: #f0eef8;
  --app-bg-soft: #f7f6fb;
  --app-card: #ffffff;
  --app-stroke: #e6e5ef;

  /* Brand */
  --app-primary: #6d7cff;
  --app-primary-2: #8a98ff;
  --app-primary-soft: rgba(109, 124, 255, 0.10);

  /* Text */
  --app-ink: #1f2433;
  --app-muted: #7d8397;

  /* Semantic */
  --app-success: #22c55e;
  --app-success-soft: rgba(34, 197, 94, 0.10);
  --app-warning: #f59e0b;
  --app-warning-soft: rgba(245, 158, 11, 0.10);
  --app-danger: #ef4444;
  --app-danger-soft: rgba(239, 68, 68, 0.10);
  --app-info: #3b82f6;
  --app-info-soft: rgba(59, 130, 246, 0.10);

  /* Misc */
  --app-radius: 16px;
  --app-radius-sm: 10px;
  --app-radius-lg: 22px;
  --app-shadow: 0 8px 26px rgba(39, 49, 86, 0.08);
  --app-shadow-lg: 0 16px 40px rgba(39, 49, 86, 0.12);
  --app-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================================
   BASE
   =================================================================== */
body {
  font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--app-ink);
  background: var(--app-bg);
  overflow-x: hidden;
}

/* Page fade-in animation */
body:not(.login-page) .content-wrapper,
body.login-page .login-box {
  animation: pageEnter 0.4s ease-out both;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================================
   LAYOUT WRAPPER
   =================================================================== */
.wrapper {
  background: linear-gradient(180deg, #f0eef9 0%, #eceaf6 100%);
  overflow-x: hidden;
}

.content-wrapper {
  background:
    radial-gradient(circle at 14% 6%, rgba(126, 133, 255, 0.10), transparent 27%),
    radial-gradient(circle at 88% 95%, rgba(154, 161, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #efedf8 0%, #eceaf6 100%);
  padding-top: .35rem;
}

/* ===================================================================
   HEADER / NAVBAR
   =================================================================== */
.main-header.navbar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(176, 178, 199, 0.30);
  transition: background var(--app-transition), border-color var(--app-transition);
}

.main-header .btn.btn-sm {
  border-radius: 999px;
  transition: all var(--app-transition);
}

.main-header .btn.btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 124, 255, 0.18);
}

/* ===================================================================
   SIDEBAR
   =================================================================== */
.main-sidebar {
  background: linear-gradient(180deg, #f2f0fa 0%, #eceaf7 100%) !important;
  border-right: 1px solid #e1dfec;
  overflow-x: hidden;
  transition: background var(--app-transition);
}

.main-sidebar .sidebar {
  overflow-x: hidden !important;
}

.sidebar .nav-sidebar {
  overflow-x: hidden;
  padding-top: 0.25rem;
}

.brand-link {
  background: transparent;
  border-bottom: 1px solid #e1dfec;
  transition: border-color var(--app-transition);
}

.brand-link .brand-text {
  font-weight: 800;
  color: #3e455a !important;
  letter-spacing: .01em;
}

.sidebar .user-panel .info #sessionMeta,
.sidebar .user-panel .info .text-white-50 {
  color: #5f6781 !important;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link {
  color: #535a71;
  border-radius: 12px;
  margin: 2px 8px;
  font-weight: 600;
  transition: all var(--app-transition);
  position: relative;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
  background: rgba(109, 124, 255, 0.08);
  color: #4a52a8;
  transform: translateX(2px);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link .nav-icon {
  color: #68708a;
  transition: color var(--app-transition);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover .nav-icon {
  color: #6d7cff;
}

.sidebar-dark-primary .nav-sidebar .nav-link.active {
  background: linear-gradient(135deg, #7b87ff, #9aa6ff) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(109, 124, 255, 0.34);
  transform: translateX(0);
}

.sidebar-dark-primary .nav-sidebar .nav-link.active:hover {
  transform: translateX(0);
  box-shadow: 0 10px 22px rgba(109, 124, 255, 0.40);
}

.sidebar-dark-primary .nav-sidebar .nav-link.active .nav-icon {
  color: #fff !important;
}

/* ===================================================================
   CARDS
   =================================================================== */
.card {
  border: 1px solid var(--app-stroke);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  background: var(--app-card);
  transition: box-shadow var(--app-transition), transform var(--app-transition);
}

.card:hover {
  box-shadow: 0 10px 30px rgba(39, 49, 86, 0.11);
}

.card .card-header {
  border-bottom: 1px solid #efedf7;
  background: transparent;
  border-top-left-radius: var(--app-radius);
  border-top-right-radius: var(--app-radius);
  font-weight: 700;
}

.card .card-header .card-title {
  font-weight: 700;
  font-size: 1rem;
}

/* Card entrance animation */
.card.animate-in {
  animation: cardSlideUp 0.45s ease-out both;
}

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================================
   SMALL BOXES (KPI)
   =================================================================== */
.small-box {
  border-radius: var(--app-radius);
  box-shadow: 0 10px 26px rgba(39, 49, 86, 0.11);
  transition: transform var(--app-transition), box-shadow var(--app-transition);
}

.small-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(39, 49, 86, 0.16);
}

.small-box .inner h3,
.small-box .inner p {
  color: #fff;
}

/* ===================================================================
   TABLES
   =================================================================== */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  border-top: 0;
  border-bottom: 2px solid #efedf7;
  color: #707897;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  padding: .65rem .75rem;
  white-space: nowrap;
}

.table td,
.table th {
  border-color: #f0eef8;
  padding: .6rem .75rem;
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--app-transition), transform var(--app-transition);
}

.table tbody tr:hover {
  background-color: rgba(109, 124, 255, 0.05) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(118, 132, 255, 0.03);
}

.table-striped tbody tr:nth-of-type(odd):hover {
  background-color: rgba(109, 124, 255, 0.07) !important;
}

/* Rounded table container */
.card .table {
  margin-bottom: 0;
}

.card .card-body > .table:first-child thead tr:first-child th:first-child,
.card > .table thead tr:first-child th:first-child {
  border-top-left-radius: var(--app-radius);
}

.card .card-body > .table:first-child thead tr:first-child th:last-child,
.card > .table thead tr:first-child th:last-child {
  border-top-right-radius: var(--app-radius);
}

/* Responsive table on mobile */
@media (max-width: 768px) {
  .table-responsive-custom {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive-custom .table {
    min-width: 600px;
  }
}

/* ===================================================================
   FORMS
   =================================================================== */
.form-control,
.custom-select,
.select2-selection,
.input-group-text {
  border-radius: var(--app-radius-sm);
  border: 1px solid #dfe2ee;
  min-height: 38px;
  box-shadow: none;
  transition: border-color var(--app-transition), box-shadow var(--app-transition), background var(--app-transition);
}

.form-control:focus,
.custom-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-primary-soft);
  outline: none;
}

.form-control::placeholder {
  color: #b0b5c9;
}

.input-group .input-group-text {
  border-color: #dfe2ee;
  background: #f8f9fd;
  color: var(--app-muted);
}

/* ===================================================================
   BUTTONS
   =================================================================== */
.btn {
  border-radius: var(--app-radius-sm);
  font-weight: 600;
  transition: all var(--app-transition);
  letter-spacing: .01em;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #6d7cff, #8a98ff);
  border: 0;
  box-shadow: 0 6px 14px rgba(109, 124, 255, 0.26);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #606ff0, #7f8eff);
  box-shadow: 0 8px 18px rgba(109, 124, 255, 0.32);
}

.btn-success {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.20);
}

.btn-success:hover {
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.28);
}

.btn-danger {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.18);
}

.btn-danger:hover {
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.26);
}

.btn-outline-secondary {
  border-color: #d7daea;
  color: #5f6781;
}

.btn-outline-secondary:hover {
  background: rgba(109, 124, 255, 0.06);
  border-color: #c0c5e0;
  color: #4a52a8;
}

/* ===================================================================
   BADGES
   =================================================================== */
.badge {
  font-weight: 600;
  letter-spacing: .02em;
  padding: .35em .65em;
  border-radius: 8px;
}

.badge.badge-light.border {
  border-color: #e3e6f4 !important;
  color: #5f6785;
  background: #f6f7fd !important;
}

/* Status-specific badge colors */
.badge-status-success,
.badge[data-status="delivered"],
.badge[data-status="pagado"],
.badge[data-status="entregado"] {
  background: var(--app-success-soft) !important;
  color: #15803d !important;
  border: 1px solid rgba(34, 197, 94, 0.20) !important;
}

.badge-status-warning,
.badge[data-status="preparing"],
.badge[data-status="adjusted"],
.badge[data-status="pago_parcial"],
.badge[data-status="en_preparacion"] {
  background: var(--app-warning-soft) !important;
  color: #92400e !important;
  border: 1px solid rgba(245, 158, 11, 0.20) !important;
}

.badge-status-danger,
.badge[data-status="canceled"],
.badge[data-status="cancelado"] {
  background: var(--app-danger-soft) !important;
  color: #991b1b !important;
  border: 1px solid rgba(239, 68, 68, 0.20) !important;
}

.badge-status-info,
.badge[data-status="submitted"],
.badge[data-status="dispatched"],
.badge[data-status="despachado"],
.badge[data-status="programado_para_entrega"] {
  background: var(--app-info-soft) !important;
  color: #1e40af !important;
  border: 1px solid rgba(59, 130, 246, 0.20) !important;
}

.badge-status-neutral,
.badge[data-status="draft"],
.badge[data-status="pendiente"],
.badge[data-status="pedido_recibido"] {
  background: rgba(125, 131, 151, 0.10) !important;
  color: #4b5563 !important;
  border: 1px solid rgba(125, 131, 151, 0.18) !important;
}

/* ===================================================================
   ALERTS / FLASH MESSAGES
   =================================================================== */
.alert {
  border-radius: var(--app-radius-sm);
  border: none;
  font-weight: 500;
  position: relative;
}

.alert-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-left: 4px solid var(--app-success);
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2, #fecaca);
  color: #991b1b;
  border-left: 4px solid var(--app-danger);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  border-left: 4px solid var(--app-warning);
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  border-left: 4px solid var(--app-info);
}

/* Flash animation */
.flash-enter {
  animation: flashSlideIn 0.35s ease-out both;
}

.flash-exit {
  animation: flashSlideOut 0.3s ease-in both;
}

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

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

/* Flash close button */
.flash-close {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.1rem;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: opacity var(--app-transition);
}

.flash-close:hover {
  opacity: 0.9;
}

/* ===================================================================
   DROPDOWNS
   =================================================================== */
.dropdown-menu {
  border-radius: 14px;
  border: 1px solid #e5e7f2;
  box-shadow: var(--app-shadow-lg);
  padding: .35rem;
  animation: dropdownFade 0.2s ease-out;
}

.dropdown-item {
  border-radius: 8px;
  padding: .45rem .75rem;
  font-weight: 500;
  transition: background var(--app-transition);
}

.dropdown-item:hover {
  background: var(--app-primary-soft);
  color: #4a52a8;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.navbar-badge {
  font-size: .62rem;
  padding: .25em .42em;
  border-radius: 999px;
}

/* ===================================================================
   MODALS
   =================================================================== */
.modal-content {
  border: 1px solid rgba(230, 232, 243, 0.6);
  border-radius: var(--app-radius-lg);
  box-shadow: 0 24px 56px rgba(34, 43, 77, 0.24);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid #efedf7;
  padding: 1rem 1.25rem;
}

.modal-header .modal-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-header .close {
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--app-transition);
  opacity: 0.6;
}

.modal-header .close:hover {
  background: rgba(109, 124, 255, 0.08);
  opacity: 1;
}

.modal-footer {
  border-top: 1px solid #efedf7;
  padding: .85rem 1.25rem;
}

.modal.fade .modal-dialog {
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  transform: translateY(12px) scale(0.98);
}

.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

#themeToggle {
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--app-transition);
}

#themeToggle:hover {
  background: var(--app-primary-soft);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

/* ===================================================================
   STATE INDICATORS
   =================================================================== */
.state-empty,
.state-loading,
.state-error,
.state-success,
.state-warning {
  border-radius: 14px;
  border: 1px solid #e6e8f3;
  background: #f8f9ff;
  color: #4f5877;
  padding: 1.5rem 1rem;
  font-size: .9rem;
  text-align: center;
}

.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.state-empty::before {
  content: "\f468";
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  font-size: 2rem;
  color: #b0b5c9;
  display: block;
}

.state-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.state-loading::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2.5px solid #d0d4e8;
  border-top-color: var(--app-primary);
  border-radius: 50%;
  display: inline-block;
  animation: stateSpin 0.7s linear infinite;
}

.state-success {
  border-color: #bde9d5;
  background: #f2fcf6;
  color: #1f6c4f;
}

.state-warning {
  border-color: #f3dfac;
  background: #fff9ec;
  color: #89631d;
}

.state-error {
  border-color: #efc0c8;
  background: #fff3f5;
  color: #99364c;
}

@keyframes stateSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===================================================================
   SCROLL TO TOP BUTTON
   =================================================================== */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1050;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--app-card);
  border: 1px solid var(--app-stroke);
  box-shadow: 0 6px 18px rgba(39, 49, 86, 0.14);
  color: var(--app-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-to-top:hover {
  background: var(--app-primary);
  color: #fff;
  box-shadow: 0 8px 22px rgba(109, 124, 255, 0.30);
  transform: translateY(-2px);
}

/* ===================================================================
   CONTENT HEADER
   =================================================================== */
.content-header h1 {
  font-weight: 800;
  color: var(--app-ink);
  letter-spacing: -0.01em;
}

.content-header .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
}

.content-header .breadcrumb-item a {
  color: var(--app-primary);
  font-weight: 500;
}

/* ===================================================================
   PROGRESS BARS
   =================================================================== */
.progress {
  border-radius: 999px;
  height: 8px;
  background: #efedf7;
  overflow: hidden;
}

.progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--app-primary), var(--app-primary-2));
  transition: width 0.6s ease;
}

/* ===================================================================
   TOOLTIPS
   =================================================================== */
.tooltip-inner {
  border-radius: 8px;
  padding: .35rem .65rem;
  font-size: .82rem;
  font-weight: 500;
}

/* ===================================================================
   PAGINATION
   =================================================================== */
.pagination .page-link {
  border-radius: 8px !important;
  margin: 0 2px;
  border: 1px solid #e6e8f3;
  color: var(--app-ink);
  font-weight: 600;
  transition: all var(--app-transition);
}

.pagination .page-link:hover {
  background: var(--app-primary-soft);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

.pagination .page-item.active .page-link {
  background: var(--app-primary);
  border-color: var(--app-primary);
  box-shadow: 0 4px 10px rgba(109, 124, 255, 0.25);
}

/* ===================================================================
   UTILITY CLASSES
   =================================================================== */
.text-gradient {
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.40);
  border-radius: var(--app-radius);
}

.hover-lift {
  transition: transform var(--app-transition), box-shadow var(--app-transition);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--app-shadow-lg);
}

/* Staggered animation for lists */
.stagger-in > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.18s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.21s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.24s; }

/* ===================================================================
   RESPONSIVE IMPROVEMENTS
   =================================================================== */
@media (max-width: 768px) {
  .card {
    border-radius: 14px;
  }

  .card .card-header {
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
  }

  .modal-content {
    border-radius: 16px;
    margin: 8px;
  }

  .content-header h1 {
    font-size: 1.4rem;
  }

  .btn {
    font-size: .88rem;
  }

  .scroll-to-top {
    bottom: 16px;
    left: 16px;
    width: 38px;
    height: 38px;
  }
}

/* ===================================================================
   DARK MODE
   =================================================================== */
body.dark-mode {
  --app-bg: #171b2d;
  --app-bg-soft: #20243a;
  --app-card: #242a42;
  --app-stroke: #333a5a;
  --app-ink: #e9ecff;
  --app-muted: #b4bddf;
  --app-primary-soft: rgba(109, 124, 255, 0.15);
  --app-success-soft: rgba(34, 197, 94, 0.15);
  --app-warning-soft: rgba(245, 158, 11, 0.15);
  --app-danger-soft: rgba(239, 68, 68, 0.15);
  --app-info-soft: rgba(59, 130, 246, 0.15);
  --app-shadow: 0 8px 26px rgba(8, 10, 18, 0.30);
  --app-shadow-lg: 0 16px 40px rgba(8, 10, 18, 0.40);
}

body.dark-mode .wrapper {
  background: linear-gradient(180deg, #181c31 0%, #14192b 100%);
}

body.dark-mode .content-wrapper {
  background:
    radial-gradient(circle at 10% 5%, rgba(110, 122, 255, 0.14), transparent 29%),
    radial-gradient(circle at 85% 90%, rgba(141, 126, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #171b2d 0%, #14182a 100%);
}

body.dark-mode .main-header.navbar {
  background: rgba(30, 36, 58, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: #31395d;
}

body.dark-mode .main-sidebar {
  background: linear-gradient(180deg, #1f2440 0%, #1a2038 100%) !important;
  border-right-color: #31395d;
}

body.dark-mode .brand-link {
  border-bottom-color: #31395d;
}

body.dark-mode .brand-link .brand-text {
  color: #edf0ff !important;
}

body.dark-mode .sidebar .user-panel .info #sessionMeta,
body.dark-mode .sidebar .user-panel .info .text-white-50 {
  color: #c4cbee !important;
}

body.dark-mode .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link {
  color: #b7c1e7;
}

body.dark-mode .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
  background: rgba(109, 124, 255, 0.12);
  color: #d0d8ff;
}

body.dark-mode .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link .nav-icon {
  color: #b7c1e7;
}

body.dark-mode .card,
body.dark-mode .modal-content {
  color: var(--app-ink);
  background: var(--app-card);
  border-color: var(--app-stroke);
  box-shadow: var(--app-shadow);
}

body.dark-mode .card .card-header {
  border-bottom-color: #333a5b;
}

body.dark-mode .small-box {
  box-shadow: 0 10px 25px rgba(10, 12, 21, 0.42);
}

body.dark-mode .table,
body.dark-mode .table td,
body.dark-mode .table th {
  color: #e6ebff;
}

body.dark-mode .table thead th {
  border-bottom-color: #3a446b;
  color: #9ba4cc;
}

body.dark-mode .table td,
body.dark-mode .table th {
  border-color: #32395a;
}

body.dark-mode .table tbody tr:hover {
  background-color: rgba(109, 124, 255, 0.08) !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(145, 157, 255, 0.05);
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd):hover {
  background-color: rgba(109, 124, 255, 0.10) !important;
}

body.dark-mode .form-control,
body.dark-mode .custom-select,
body.dark-mode .input-group-text {
  background: #1f2540;
  border-color: #3a446b;
  color: #e6ebff;
}

body.dark-mode .form-control::placeholder {
  color: #6b7499;
}

body.dark-mode .form-control:focus,
body.dark-mode .custom-select:focus {
  border-color: #8f9cff;
  box-shadow: 0 0 0 3px rgba(128, 143, 255, 0.20);
}

body.dark-mode .input-group .input-group-text {
  background: #1a2038;
  border-color: #3a446b;
  color: #9ba4cc;
}

body.dark-mode .btn-outline-secondary {
  border-color: #3a446b;
  color: #b7c1e7;
}

body.dark-mode .btn-outline-secondary:hover {
  background: rgba(109, 124, 255, 0.12);
  border-color: #6d7cff;
  color: #d0d8ff;
}

body.dark-mode .dropdown-menu {
  background: #232a47;
  border-color: #374169;
}

body.dark-mode .dropdown-item {
  color: #e4e9ff;
}

body.dark-mode .dropdown-item:hover {
  background: rgba(123, 136, 255, 0.16);
}

body.dark-mode .text-muted {
  color: #b5bde0 !important;
}

body.dark-mode .modal-header {
  border-bottom-color: #333a5b;
}

body.dark-mode .modal-footer {
  border-top-color: #333a5b;
}

body.dark-mode .modal-header .close {
  color: #b7c1e7;
}

body.dark-mode .modal-header .close:hover {
  background: rgba(109, 124, 255, 0.15);
}

/* Dark mode alerts */
body.dark-mode .alert-success {
  background: linear-gradient(135deg, #1a3a2a, #1f4030);
  color: #86efac;
  border-left-color: #22c55e;
}

body.dark-mode .alert-danger {
  background: linear-gradient(135deg, #3b1a1a, #451f1f);
  color: #fca5a5;
  border-left-color: #ef4444;
}

body.dark-mode .alert-warning {
  background: linear-gradient(135deg, #3b2e14, #453618);
  color: #fcd34d;
  border-left-color: #f59e0b;
}

body.dark-mode .alert-info {
  background: linear-gradient(135deg, #1a2a4a, #1f3055);
  color: #93c5fd;
  border-left-color: #3b82f6;
}

/* Dark mode state indicators */
body.dark-mode .state-empty,
body.dark-mode .state-loading {
  background: #222944;
  border-color: #384269;
  color: #dee5ff;
}

body.dark-mode .state-empty::before {
  color: #6b7499;
}

body.dark-mode .state-loading::before {
  border-color: #384269;
  border-top-color: var(--app-primary);
}

body.dark-mode .state-success {
  border-color: #2f6e54;
  background: #1f3a30;
  color: #86efac;
}

body.dark-mode .state-warning {
  border-color: #7b6230;
  background: #3b3121;
  color: #fcd34d;
}

body.dark-mode .state-error {
  border-color: #7a3d4b;
  background: #3f2730;
  color: #fca5a5;
}

/* Dark mode badges */
body.dark-mode .badge.badge-light.border {
  background: #2a3050 !important;
  border-color: #3a446b !important;
  color: #c4cbee;
}

body.dark-mode .badge-status-success,
body.dark-mode .badge[data-status="delivered"],
body.dark-mode .badge[data-status="pagado"],
body.dark-mode .badge[data-status="entregado"] {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.25) !important;
}

body.dark-mode .badge-status-warning,
body.dark-mode .badge[data-status="preparing"],
body.dark-mode .badge[data-status="adjusted"],
body.dark-mode .badge[data-status="pago_parcial"],
body.dark-mode .badge[data-status="en_preparacion"] {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}

body.dark-mode .badge-status-danger,
body.dark-mode .badge[data-status="canceled"],
body.dark-mode .badge[data-status="cancelado"] {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
}

body.dark-mode .badge-status-info,
body.dark-mode .badge[data-status="submitted"],
body.dark-mode .badge[data-status="dispatched"],
body.dark-mode .badge[data-status="despachado"],
body.dark-mode .badge[data-status="programado_para_entrega"] {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
}

body.dark-mode .badge-status-neutral,
body.dark-mode .badge[data-status="draft"],
body.dark-mode .badge[data-status="pendiente"],
body.dark-mode .badge[data-status="pedido_recibido"] {
  background: rgba(180, 189, 223, 0.12) !important;
  color: #c4cbee !important;
  border-color: rgba(180, 189, 223, 0.20) !important;
}

/* Dark mode scroll-to-top */
body.dark-mode .scroll-to-top {
  background: var(--app-card);
  border-color: var(--app-stroke);
  color: var(--app-primary);
}

body.dark-mode .scroll-to-top:hover {
  background: var(--app-primary);
  color: #fff;
}

/* Dark mode progress */
body.dark-mode .progress {
  background: #2a3050;
}

/* Dark mode pagination */
body.dark-mode .pagination .page-link {
  background: var(--app-card);
  border-color: var(--app-stroke);
  color: var(--app-ink);
}

body.dark-mode .pagination .page-link:hover {
  background: var(--app-primary-soft);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

body.dark-mode .pagination .page-item.active .page-link {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

/* Dark mode glass card */
body.dark-mode .glass-card {
  background: rgba(36, 42, 66, 0.70);
  border-color: rgba(51, 58, 90, 0.50);
}

/* Dark mode login page */
body.dark-mode.login-page {
  background: linear-gradient(135deg, #171b2d, #1a2038) !important;
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */
@media print {
  .main-sidebar,
  .main-header,
  .scroll-to-top,
  #themeToggle,
  .floating-actions {
    display: none !important;
  }

  .content-wrapper {
    margin-left: 0 !important;
    background: #fff !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
