/* ==========================================================
   Meesho Order Management System - Premium Dark Theme
   ========================================================== */

:root {
  --bg-0: #0b0f1a;
  --bg-1: #121826;
  --bg-2: #1a2236;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text-1: #eef1f8;
  --text-2: #9aa4bd;
  --text-3: #6b7590;
  --blue-1: #4f7dff;
  --blue-2: #2f5bd6;
  --blue-grad: linear-gradient(135deg, #4f7dff 0%, #7c5cff 100%);
  --green: #09f899;
  --yellow: #f5b93f;
  --red: #e70329;
  --purple: #9b6bff;
  --cyan: #35c6d8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at 10% 0%, #17203a 0%, var(--bg-0) 45%), var(--bg-0);
  color: var(--text-1);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
  background: #2c3752;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a4770;
}

/* ---------------- Sticky Header ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(14px);
  background: rgba(11, 15, 26, 0.75);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}

.topbar .brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.topbar .brand span {
  background: var(--blue-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn-gradient {
  background: var(--blue-grad);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 6px 18px rgba(79, 125, 255, 0.35);
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(79, 125, 255, 0.45);
  color: #fff;
}

.container-xl {
  max-width: 1500px;
}

/* ---------------- Glass Cards ---------------- */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.glass-card:hover {
  transform: translateY(-3px);
  background: var(--surface-hover);
}

.stat-card {
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card .icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  color: var(--text-2);
  font-size: 0.8rem;
  margin-top: 2px;
}

.icon-blue {
  background: rgba(79, 125, 255, 0.15);
  color: #7fa0ff;
}

.icon-green {
  background: rgba(46, 207, 142, 0.15);
  color: #4fe0ac;
}

.icon-yellow {
  background: rgba(245, 185, 63, 0.15);
  color: #ffce6b;
}

.icon-red {
  background: rgba(255, 92, 120, 0.15);
  color: #ff8fa3;
}

.icon-purple {
  background: rgba(155, 107, 255, 0.15);
  color: #b491ff;
}

.icon-cyan {
  background: rgba(53, 198, 216, 0.15);
  color: #6fe1ef;
}

.icon-gold {
  background: rgba(218, 165, 32, 0.15);
  color: #daa520;
}

/* ---------------- Upload Zone ---------------- */
.upload-zone {
  border: 2px dashed rgba(124, 92, 255, 0.4);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(79, 125, 255, 0.06), rgba(124, 92, 255, 0.03));
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
}

.upload-zone.dragover {
  border-color: #7c5cff;
  background: linear-gradient(180deg, rgba(79, 125, 255, 0.14), rgba(124, 92, 255, 0.08));
  transform: scale(1.01);
}

.upload-zone i {
  font-size: 2.4rem;
  color: #7c9bff;
}

.upload-progress-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
}

/* ---------------- Table ---------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

table.dataTable {
  color: var(--text-1) !important;
}

table.dataTable thead th {
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

table.dataTable tbody td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  vertical-align: middle;
  font-size: 0.87rem;
}

table.dataTable tbody tr {
  transition: background .12s ease;
}

table.dataTable tbody tr:hover {
  background: var(--surface-hover) !important;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input,
.form-select,
.form-control {
  background: var(--bg-2) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}

.form-select:focus,
.form-control:focus {
  border-color: var(--blue-1) !important;
  box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.2) !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-2);
}

.dataTables_wrapper .dataTables_paginate .page-link {
  background: var(--bg-2);
  color: var(--text-1);
  border-color: var(--border);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background: var(--blue-grad);
  border: none;
}

/* ---------------- Badges ---------------- */
.badge-status {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.st-Pending {
  background: rgba(245, 185, 63, 0.15);
  color: #ffce6b;
}

.st-Packed {
  background: rgba(53, 198, 216, 0.15);
  color: #6fe1ef;
}

.st-Shipped {
  background: rgba(79, 125, 255, 0.15);
  color: #7fa0ff;
}

.st-Out-For-Delivery {
  background: rgba(155, 107, 255, 0.15);
  color: #b491ff;
}

.st-Delivered {
  background: rgba(46, 207, 142, 0.15);
  color: #4fe0ac;
}

.st-RTO {
  background: rgba(255, 92, 120, 0.15);
  color: #ff8fa3;
}

.st-Customer-Return {
  background: rgba(255, 140, 66, 0.15);
  color: #ffb27a;
}

.st-Cancelled {
  background: rgba(120, 120, 130, 0.2);
  color: #b7bdcc;
}

.badge-pay-COD {
  background: rgba(255, 92, 120, 0.15);
  color: #ff8fa3;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-pay-Prepaid {
  background: rgba(46, 207, 142, 0.15);
  color: #4fe0ac;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-select {
  min-width: 150px;
  font-size: 0.78rem;
  padding: 4px 8px;
}

/* ---------------- Modal ---------------- */
.modal-content {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
}

.detail-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.detail-section h6 {
  color: var(--blue-1);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.detail-row span:first-child {
  color: var(--text-2);
}

.timeline {
  position: relative;
  padding-left: 20px;
}

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

.timeline-item {
  position: relative;
  padding-bottom: 14px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue-grad);
}

/* ---------------- Filters ---------------- */
.filter-bar {
  gap: 10px;
}

.filter-bar .form-select,
.filter-bar .form-control {
  min-width: 150px;
}

/* ---------------- Chart Cards ---------------- */
.chart-card {
  padding: 20px;
}

.chart-card h6 {
  color: var(--text-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* ---------------- Loading Overlay ---------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 26, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner-ring {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(79, 125, 255, 0.2);
  border-top-color: #7c5cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */
@media (max-width: 768px) {
  .container-xl {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar .brand {
    font-size: 1rem;
  }

  .btn-gradient {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .glass-card {
    border-radius: 12px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .filter-bar {
    flex-direction: column;
    gap: 8px !important;
  }

  .filter-bar>* {
    width: 100%;
  }

  .chart-card h6 {
    font-size: 0.9rem;
  }

  table.dataTable {
    font-size: 0.75rem;
  }

  table.dataTable tbody td {
    padding: 8px 4px;
  }
}

.fade-in {
  animation: fadeIn .35s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
  .stat-card .stat-value {
    font-size: 1.3rem;
  }

  .filter-bar .form-select,
  .filter-bar .form-control {
    min-width: 120px;
  }
}

.text-muted-2 {
  color: var(--text-2);
}

.section-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 14px;
}

/* ============================================================
   EXCEL-LIKE SPREADSHEET VIEW STYLING
   ============================================================ */
.table-responsive-excel {
  overflow: auto;
  max-height: calc(100vh - 250px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  margin-top: 10px;
}

/* Excel grid look */
.excel-table {
  border-collapse: separate !important;
  border-spacing: 0;
  font-size: 0.85rem;
}

.excel-table th,
.excel-table td {
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  padding: 6px 10px !important;
  vertical-align: middle;
  white-space: nowrap;
}

/* Column headers styling */
.excel-table thead th {
  position: sticky;
  top: 0;
  background: #151e30 !important;
  color: var(--text-2);
  z-index: 10;
  border-bottom: 2px solid var(--blue-1) !important;
  text-align: center;
  font-weight: 600;
  font-size: 0.78rem;
  box-shadow: inset 0 -1px 0 var(--border);
}

.excel-col-letter {
  font-size: 0.65rem;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 1.5px;
  display: block;
  margin-bottom: 1px;
  text-transform: uppercase;
}

/* Sticky Index/Row Number column */
.excel-table td.excel-row-num {
  position: sticky;
  left: 0;
  background: #131b2b !important;
  font-weight: 600;
  text-align: center;
  color: var(--text-3) !important;
  z-index: 5;
  border-right: 2px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

.excel-table thead th:first-child {
  position: sticky;
  top: 0;
  left: 0;
  background: #192338 !important;
  z-index: 15;
  border-right: 2px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

/* Column width limits for grid look */
.excel-cell-check {
  min-width: 40px;
}

.excel-cell-order-no {
  min-width: 140px;
}

.excel-cell-tracking {
  min-width: 155px;
}

.excel-cell-status {
  min-width: 160px;
}

.excel-cell-amount {
  min-width: 110px;
}

.excel-cell-payment {
  min-width: 90px;
}

.excel-cell-customer {
  min-width: 160px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-cell-mobile {
  min-width: 120px;
}

.excel-cell-product {
  min-width: 280px;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-cell-sku {
  min-width: 160px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-cell-qty {
  min-width: 60px;
}

.excel-cell-courier {
  min-width: 130px;
}

.excel-cell-date {
  min-width: 110px;
}

.excel-cell-code {
  min-width: 125px;
}

.excel-cell-actions {
  min-width: 60px;
}

/* In-cell dropdown styling */
.excel-table td .status-select {
  background-color: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: var(--text-1) !important;
  padding: 4px 8px !important;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.excel-table td .status-select:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Custom scrollbars for spreadsheet container */
.table-responsive-excel::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.table-responsive-excel::-webkit-scrollbar-track {
  background: #0d121f;
}

.table-responsive-excel::-webkit-scrollbar-thumb {
  background: #25314d;
  border-radius: 6px;
  border: 3px solid #0d121f;
}

.table-responsive-excel::-webkit-scrollbar-thumb:hover {
  background: #384870;
}

/* Sidebar Drawer */
.sidebar-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 2100;
  transition: left 0.3s ease;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.sidebar-drawer.show {
  left: 0;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 2090;
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-item:hover,
.sidebar-item.active {
  background: var(--surface-hover);
  color: var(--text-1);
}

.sidebar-item.active {
  background: var(--blue-1);
  color: #fff;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-1);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Amount highlighting in Spreadsheet */
.excel-cell-final-amount {
  color: #00ff87 !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(0, 255, 135, 0.15);
}

.excel-cell-refund-amount {
  color: #ff3860 !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(255, 56, 96, 0.15);
}

/* Custom search highlight style */
.search-highlight,
mark {
  background: #ffff00 !important;
  color: #000 !important;
  font-weight: bold !important;
  border-radius: 3px !important;
  padding: 1px 2px !important;
  border: none !important;
  text-shadow: none !important;
}

/* Pulsing glow animation for matching first row */
@keyframes pulseGlow {
  0% {
    background-color: rgba(255, 255, 0, 0.35);
  }

  50% {
    background-color: rgba(255, 255, 0, 0.1);
  }

  100% {
    background-color: transparent;
  }
}

.search-result-pulse {
  animation: pulseGlow 1.8s ease-in-out;
}

/* Selected row keyboard navigation style */
.selected-search-row {
  outline: 2px solid #ffff00 !important;
  outline-offset: -2px;
  background-color: rgba(255, 255, 0, 0.08) !important;
}

/* Extra small button for inline tracking */
.btn-xs {
  padding: 1px 4px !important;
  font-size: 0.7rem !important;
  border-radius: 3px !important;
  line-height: 1.2 !important;
}

/* Explicit Status Loss Modal styling for theme readability */
#statusLossModal .modal-content {
  background-color: var(--bg-1) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}
#statusLossModal .modal-header,
#statusLossModal .modal-footer {
  border-color: var(--border) !important;
}
#statusLossModal .form-label {
  color: var(--text-2) !important;
  font-weight: 500 !important;
}
#statusLossModal .form-control {
  background-color: var(--bg-0) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
}
#statusLossModal .form-control:focus {
  border-color: var(--blue-1) !important;
  box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.25) !important;
}

/* ============================================================
   LIGHT THEME SUPPORT & THEME SWITCHER
   ============================================================ */

/* Light mode theme definitions */
html[data-theme="light"] {
  --bg-0: #f4f6fa;
  --bg-1: #ffffff;
  --bg-2: #e9ecf3;
  --surface: rgba(0, 0, 0, 0.02);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --text-1: #1a202c;
  --text-2: #4a5568;
  --text-3: #718096;
  --blue-1: #3182ce;
  --blue-2: #2b6cb0;
  --blue-grad: linear-gradient(135deg, #3182ce 0%, #5a67d8 100%);
  --green: #2e7d32;
  --yellow: #dd6b20;
  --red: #c53030;
  --purple: #6b46c1;
  --cyan: #00a3c4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] body {
  background: radial-gradient(circle at 10% 0%, #ebf4ff 0%, var(--bg-0) 50%), var(--bg-0);
  color: var(--text-1);
}

html[data-theme="light"] .topbar {
  background: rgba(244, 246, 250, 0.75);
}

html[data-theme="light"] .topbar .btn-outline-light {
  color: var(--text-1);
  border-color: var(--border);
}
html[data-theme="light"] .topbar .btn-outline-light:hover {
  background-color: var(--surface-hover);
  color: var(--text-1);
}

html[data-theme="light"] .btn-close {
  filter: none !important;
}

html[data-theme="light"] .text-muted-2 {
  color: var(--text-2) !important;
}

html[data-theme="light"] .order-item.card {
  background-color: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
}

html[data-theme="light"] .excel-cell-final-amount {
  color: #2e7d32 !important;
  text-shadow: none !important;
}

html[data-theme="light"] .excel-cell-refund-amount {
  color: #c53030 !important;
  text-shadow: none !important;
}

html[data-theme="light"] .modal-content {
  background-color: var(--bg-1) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
}

html[data-theme="light"] .modal-header,
html[data-theme="light"] .modal-footer {
  border-color: var(--border) !important;
}

html[data-theme="light"] .modal-header .btn-close {
  filter: none !important;
}

/* Sidebar Theme Switcher */
.theme-switch-container {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.theme-switch-btn {
  background: var(--bg-0) !important;
  border: 1px solid var(--border);
  width: 80px;
  height: 36px;
  cursor: pointer;
  position: relative;
  border-radius: 50px;
  display: flex;
  align-items: center;
  padding: 4px;
}

.theme-slider {
  position: absolute;
  width: 32px;
  height: 28px;
  background: var(--blue-grad);
  border-radius: 50px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  left: 3px;
  /* Default: Dark mode (Moon) */
  transform: translateX(42px);
}

/* Light mode position (Sun) */
html[data-theme="light"] .theme-slider {
  transform: translateX(0);
}

.theme-switch-icon {
  width: 36px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.theme-switch-icon.sun-btn {
  color: var(--text-3);
}

html[data-theme="light"] .theme-switch-icon.sun-btn {
  color: #ff9f00 !important;
}

.theme-switch-icon.moon-btn {
  color: var(--text-3);
  margin-left: auto;
}

/* Default / Dark mode Moon active color */
html:not([data-theme="light"]) .theme-switch-icon.moon-btn,
html[data-theme="dark"] .theme-switch-icon.moon-btn {
  color: #ffce6b !important;
}

/* Light theme overrides for excel spreadsheet grid */
html[data-theme="light"] .table-responsive-excel {
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] .excel-table th,
html[data-theme="light"] .excel-table td {
  border: 1px solid var(--border) !important;
}

html[data-theme="light"] .excel-table thead th {
  background: var(--bg-2) !important;
  color: var(--text-2) !important;
  box-shadow: inset 0 -1px 0 var(--border) !important;
}

html[data-theme="light"] .excel-table td.excel-row-num {
  background: var(--bg-2) !important;
  color: var(--text-2) !important;
  border-right: 2px solid var(--border) !important;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.02) !important;
}

html[data-theme="light"] .excel-table thead th:first-child {
  background: var(--bg-2) !important;
  border-right: 2px solid var(--border) !important;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.02) !important;
}

html[data-theme="light"] table.dataTable tbody td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] .table-wrap {
  background: var(--bg-1) !important;
}

/* Custom status select dropdown styling in spreadsheet grid */
.status-select {
  border: 1px solid var(--border) !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  padding: 4px 24px 4px 10px !important;
  border-radius: 20px !important;
  width: auto !important;
  min-width: 140px;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* Style select dropdown based on status class */
.status-select.st-Pending {
  background-color: rgba(245, 185, 63, 0.15) !important;
  color: #ffbe4b !important;
}
.status-select.st-Packed {
  background-color: rgba(53, 198, 216, 0.15) !important;
  color: #4fd1e0 !important;
}
.status-select.st-Shipped {
  background-color: rgba(79, 125, 255, 0.15) !important;
  color: #7fa0ff !important;
}
.status-select.st-Out-For-Delivery {
  background-color: rgba(155, 107, 255, 0.15) !important;
  color: #a783ff !important;
}
.status-select.st-Delivered {
  background-color: rgba(46, 207, 142, 0.15) !important;
  color: #2ecf8e !important;
}
.status-select.st-RTO {
  background-color: rgba(255, 92, 120, 0.12) !important;
  color: #ff6b84 !important;
}
.status-select.st-Customer-Return {
  background-color: rgba(255, 92, 120, 0.15) !important;
  color: #ff6b84 !important;
}
.status-select.st-Cancelled {
  background-color: rgba(255, 92, 120, 0.2) !important;
  color: #ff4f6a !important;
}

/* Dropdown option tags style - ensures high contrast in both themes */
.status-select option {
  background-color: var(--bg-1) !important;
  color: var(--text-1) !important;
}

/* High contrast status text colors for light mode */
html[data-theme="light"] .status-select.st-Pending {
  color: #b7791f !important;
}
html[data-theme="light"] .status-select.st-Packed {
  color: #0c8599 !important;
}
html[data-theme="light"] .status-select.st-Shipped {
  color: #2b6cb0 !important;
}
html[data-theme="light"] .status-select.st-Out-For-Delivery {
  color: #553c9a !important;
}
html[data-theme="light"] .status-select.st-Delivered {
  color: #276749 !important;
}
html[data-theme="light"] .status-select.st-RTO,
html[data-theme="light"] .status-select.st-Customer-Return,
html[data-theme="light"] .status-select.st-Cancelled {
  color: #9b2c2c !important;
}

/* Light theme overrides for drag-and-drop upload zone */
html[data-theme="light"] .upload-zone {
  border: 2px dashed rgba(0, 0, 0, 0.12) !important;
  background: rgba(0, 0, 0, 0.015) !important;
}
html[data-theme="light"] .upload-zone:hover,
html[data-theme="light"] .upload-zone.dragover {
  border-color: var(--blue-1) !important;
  background: rgba(79, 125, 255, 0.04) !important;
}

/* ============================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ============================================================ */

@media (max-width: 576px) {
  /* Prevent topbar elements overflow on narrow screens */
  .topbar {
    padding: 10px 14px !important;
  }
  #brandLogoText {
    font-size: 1rem !important;
  }
  #brandLogoText span {
    display: none !important; /* Hide "Management" text on mobile */
  }
  .topbar .dropdown button {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
  }

  /* Compact Dashboard Stat Cards for mobile */
  .stat-card {
    padding: 10px 12px !important;
    border-radius: var(--radius-sm) !important;
  }
  .stat-card .icon-wrap {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
    margin-bottom: 6px !important;
  }
  .stat-card .stat-value {
    font-size: 1.15rem !important;
    word-break: break-all;
  }
  .stat-card .stat-label {
    font-size: 0.7rem !important;
  }

  /* Responsive Filter Bar inputs layout */
  .filter-bar {
    gap: 8px !important;
  }
  .filter-bar > * {
    flex: 1 1 calc(50% - 8px) !important;
    font-size: 0.8rem !important;
    height: 34px !important;
    padding: 4px 8px !important;
  }
  .filter-bar #searchBox {
    flex: 1 1 100% !important; /* Search takes full row width */
    height: 36px !important;
  }
  .filter-bar #btnBulkDelete,
  .filter-bar #resetFilters {
    flex: 1 1 auto !important;
    width: auto !important;
    height: 34px !important;
    padding: 4px 10px !important;
  }

  /* Compact modal dialog margins for mobile */
  .modal-dialog {
    margin: 12px !important;
  }
}

@media (max-width: 480px) {
  /* Optimize form wrapper spacing on login/register pages */
  .glass-login-card {
    padding: 25px 15px !important;
  }
  .login-logo {
    font-size: 1.5rem !important;
    margin-bottom: 15px !important;
  }
}

/* Align DataTables length/filter layout on mobile */
@media (max-width: 576px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left !important;
    float: none !important;
    margin-bottom: 12px;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
  }
  .dataTables_wrapper .dataTables_paginate {
    text-align: center !important;
    float: none !important;
    margin-top: 12px;
  }
}