/* ============================================
   PURELUXE DISPATCH SYSTEM - STYLES
   ============================================ */

:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --teal: #14b8a6;
  --teal-light: #ccfbf1;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.15) 0%, transparent 70%);
  animation: pulse-bg 4s ease-in-out infinite;
}

@keyframes pulse-bg {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 26px;
  color: white;
  box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper > i:first-child {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
  color: var(--text);
}

.input-icon-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary:hover { background: #1e293b; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-accent { background: var(--accent); }
.btn-primary.btn-accent:hover { background: var(--accent-hover); }
.btn-primary.btn-success { background: var(--success); }
.btn-primary.btn-danger { background: var(--danger); }
.btn-full { width: 100%; justify-content: center; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-icon:hover { background: var(--bg); color: var(--text); }

.error-alert {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid rgba(239,68,68,0.2);
}

/* ============================================
   LAYOUT
   ============================================ */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-sm {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-info span:first-child {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  font-size: 10px;
  background: rgba(99,102,241,0.3);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  display: inline-block;
  max-width: fit-content;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 8px;
  overflow-y: auto;
}

.nav-section { margin-bottom: 8px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.35);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(99,102,241,0.25); color: white; }
.nav-item.active i { color: var(--accent); }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s;
}

.btn-logout:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.breadcrumb {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

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

.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-user span { font-size: 13px; font-weight: 500; }

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================
   CARDS & COMPONENTS
   ============================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 20px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.teal { background: var(--teal-light); color: var(--teal); }
.stat-icon.indigo { background: var(--accent-light); color: var(--accent); }

.stat-info {}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

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

tbody tr:hover { background: #f8fafc; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-packed { background: var(--info-light); color: #1e40af; }
.badge-dispatched { background: var(--purple-light); color: #5b21b6; }
.badge-in-transit, .badge-in_transit { background: var(--accent-light); color: #3730a3; }
.badge-delivered { background: var(--success-light); color: #065f46; }
.badge-picked-up, .badge-picked_up { background: var(--teal-light); color: #0f766e; }
.badge-out-for-delivery, .badge-out_for_delivery { background: #fef9c3; color: #713f12; }
.badge-cancelled { background: var(--danger-light); color: #991b1b; }
.badge-normal { background: var(--border-light); color: var(--text-muted); }
.badge-urgent { background: var(--danger-light); color: var(--danger); }
.badge-claims { background: var(--purple-light); color: #5b21b6; }
.badge-sample { background: var(--teal-light); color: #0f766e; }
.badge-technical { background: var(--info-light); color: #1e40af; }
.badge-super-admin, .badge-super_admin { background: #1e293b; color: white; }
.badge-administration { background: var(--accent-light); color: var(--accent); }
.badge-logistics { background: var(--success-light); color: var(--success); }
.badge-active { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light); color: var(--danger); }

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group label span.required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: var(--text);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.form-control:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control { cursor: pointer; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  animation: modal-in 0.2s ease;
}

.modal.modal-lg { max-width: 860px; }
.modal.modal-xl { max-width: 1100px; }
.modal.modal-sm { max-width: 440px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  animation: toast-in 0.3s ease;
  font-size: 13px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--info); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

.toast i { font-size: 15px; flex-shrink: 0; }
.toast.toast-success i { color: var(--success); }
.toast.toast-error i { color: var(--danger); }
.toast.toast-info i { color: var(--info); }
.toast.toast-warning i { color: var(--warning); }

.toast-msg { flex: 1; color: var(--text); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Misc */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  gap: 12px;
  font-size: 14px;
}

.loading-spinner i { font-size: 22px; color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 40px;
  color: var(--text-light);
  margin-bottom: 12px;
  display: block;
}

.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-input-wrapper i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.search-input-wrapper input:focus { border-color: var(--accent); }

.filter-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
  color: var(--text);
}

.filter-select:focus { border-color: var(--accent); }

/* Items Table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.items-table th {
  background: #f8fafc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.items-table input, .items-table select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: white;
}

.items-table input:focus, .items-table select:focus {
  border-color: var(--accent);
}

.totals-row {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  font-size: 13px;
}

.total-item { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.total-item .label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.total-item .value { font-size: 15px; font-weight: 700; color: var(--text); }
.total-item.net-value .value { color: var(--accent); font-size: 18px; }

/* Detail View */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item .label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .value { font-size: 14px; color: var(--text); font-weight: 500; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Timeline/Logs */
.timeline {
  position: relative;
  padding-left: 20px;
}

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

.timeline-item {
  position: relative;
  padding: 8px 0 8px 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 14px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-action { font-size: 13px; font-weight: 600; color: var(--text); }
.timeline-meta { font-size: 11px; color: var(--text-muted); }

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: inherit;
  border-radius: 6px 6px 0 0;
}

.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-light); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Chip/Tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Courier Track */
.tracking-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: white;
}

.tracking-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}

@media (max-width: 960px) {
  .dash-cols { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close { display: flex; }

  .overlay.open { display: block; }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger { display: block; }

  .page-content { padding: 16px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .detail-grid { grid-template-columns: 1fr; }

  .modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }

  .modal-overlay { align-items: flex-end; padding: 0; }

  table { font-size: 12px; }

  thead th, tbody td { padding: 10px 12px; }
}

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

/* Action buttons in table */
.action-btns { display: flex; gap: 4px; align-items: center; }

.btn-table {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-table.view { background: var(--info-light); color: var(--info); }
.btn-table.view:hover { background: var(--info); color: white; }
.btn-table.edit { background: var(--accent-light); color: var(--accent); }
.btn-table.edit:hover { background: var(--accent); color: white; }
.btn-table.delete { background: var(--danger-light); color: var(--danger); }
.btn-table.delete:hover { background: var(--danger); color: white; }
.btn-table.update { background: var(--success-light); color: var(--success); }
.btn-table.update:hover { background: var(--success); color: white; }

/* ─── Queue / Dispatch Table ─────────────────────────────── */
.queue-table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: white; box-shadow: var(--shadow-sm); }

.queue-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.queue-table thead th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.sortable-th:hover { background: #e2e8f0; color: var(--text); }

.queue-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

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

.queue-row:hover { background: #f8fafc; }

.queue-row-urgent { background: #fff5f5 !important; border-left: 3px solid var(--danger); }
.queue-row-urgent:hover { background: #fee2e2 !important; }

.queue-table-footer {
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 11px;
  border-top: 1px solid var(--border-light);
  background: #f8fafc;
  border-radius: 0 0 var(--radius) var(--radius);
}

.td-muted { color: var(--text-muted); }
.td-nowrap { white-space: nowrap; }

/* Hide action button labels on very small screens */
@media (max-width: 900px) {
  .btn-label { display: none; }
  .queue-table thead th:nth-child(5) { display: none; }
  .queue-table tbody td:nth-child(5) { display: none; }
}

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Rich text display */
.info-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.text-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Highlight */
.highlight-text { color: var(--accent); font-weight: 600; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================
   COURIER TRACKING STYLES
   ============================================ */

/* Pulse animation for live tracking indicator */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 1.6s ease-in-out infinite;
  margin-right: 5px;
  vertical-align: middle;
}

/* Tracking progress steps */
.track-steps {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.track-step {
  flex: 1;
  min-width: 90px;
  text-align: center;
  position: relative;
}

.track-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  font-size: 14px;
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
  transition: all 0.3s;
}

.track-step-icon.done    { background: var(--success);      color: white; }
.track-step-icon.active  { background: var(--accent);       color: white; box-shadow: 0 0 0 4px rgba(99,102,241,0.2); }
.track-step-icon.pending { background: var(--border-light); color: var(--text-light); border-color: var(--border); }

.track-step-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.track-step-connector {
  position: absolute;
  top: 17px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  z-index: 0;
  transition: background 0.4s;
}

/* Courier badge styles */
.courier-badge-delhivery {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.courier-badge-bluedart {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* Sync status badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}

