/**
 * components.css - UI Component Styles
 */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  gap: var(--sp-2);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}
.btn-primary:hover { background-color: var(--color-primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-soft);
}
.btn-ghost:hover { background-color: var(--color-primary-light); color: var(--color-primary); }

.btn-danger { background-color: var(--color-danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-block { width: 100%; }
.btn-sm { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); }

/* Cards */
.card {
  background-color: var(--color-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.kpi-card {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
}
.kpi-value { font-size: var(--fs-xl); font-weight: 700; color: var(--color-text); }
.kpi-label { color: var(--color-muted); font-size: var(--fs-sm); }

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: var(--color-bg);
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
  border-bottom: 2px solid var(--color-border);
}

.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--fs-sm);
}

.table tr:hover td {
  background-color: var(--color-primary-light);
  cursor: pointer;
}

/* Form Controls */
.form-group {
  margin-bottom: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text-soft);
}

.label-xs {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Empty State */
.empty-state {
  padding: var(--sp-12);
  text-align: center;
  color: var(--color-muted);
}
.empty-state i { font-size: var(--fs-3xl); display: block; margin-bottom: var(--sp-4); }

/* Badges */
.badge {
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef9c3; color: #854d0e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-outline { background-color: transparent; border: 1px solid var(--color-border); color: var(--color-text-muted); }

/* Status Toggle Switch */
.status-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    transition: all 0.2s;
    background-color: var(--color-bg-dark);
}

.status-toggle .toggle-track {
    width: 32px;
    height: 18px;
    background-color: #cbd5e1;
    border-radius: 10px;
    position: relative;
    transition: background-color 0.2s;
}

.status-toggle .toggle-handle {
    width: 14px;
    height: 14px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.status-toggle.active .toggle-track { background-color: #22c55e; }
.status-toggle.active .toggle-handle { transform: translateX(14px); }
.status-toggle.active span { color: #16a34a; }

.status-toggle.inactive .toggle-track { background-color: #94a3b8; }
.status-toggle.inactive span { color: #64748b; }

.status-toggle:hover { background-color: var(--color-border); }

/* Dashboard Alert Items */
.alert-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-md);
    background-color: var(--color-bg-dark);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.alert-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: var(--fs-sm);
    font-weight: 700;
}

.alert-msg {
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
}

.severity-warning { border-left: 4px solid var(--color-warning); }
.severity-warning .alert-icon { background-color: #fef3c7; color: #d97706; }

.severity-danger { border-left: 4px solid var(--color-danger); }
.severity-danger .alert-icon { background-color: #fee2e2; color: #dc2626; }

.severity-success { border-left: 4px solid var(--color-success); }
.severity-success .alert-icon { background-color: #dcfce7; color: #16a34a; }

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
  border-radius: var(--r-xl);
  transform: scale(0.98) translateY(10px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}
.modal-dialog.modal-dialog-wide {
  max-width: min(980px, calc(100vw - 48px));
}
.modal-overlay.open .modal-dialog { transform: scale(1) translateY(0); }

.modal-header {
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: var(--sp-6); }
.modal-actions {
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  border-top: 1px solid var(--glass-border);
}

.btn-close {
  background: none;
  border: none;
  font-size: var(--fs-2xl);
  color: var(--color-muted);
  cursor: pointer;
}

/* Toast Styles */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 2000;
}

.toast-item {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 280px;
  transform: translateX(120%);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast-item.visible { transform: translateX(0); }
.toast-item.removing { transform: translateX(120%); opacity: 0; }

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}
.toast-success .toast-icon { background: var(--color-success); color: white; }
.toast-error .toast-icon { background: var(--color-danger); color: white; }
.toast-warn .toast-icon { background: var(--color-warning); color: white; }
.toast-info .toast-icon { background: var(--color-info); color: white; }

.toast-content { flex: 1; font-size: var(--fs-sm); font-weight: 500; white-space: pre-line; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--color-muted); font-size: var(--fs-lg); }

/* Skeleton Loading (Shimmer) */
.skeleton {
  background: var(--color-bg);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.5) 60%,
    rgba(255, 255, 255, 0)
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  to { background-position-x: -200%; }
}

.skeleton-text { height: 1em; width: 100%; margin-bottom: 0.5em; }
.skeleton-title { height: 1.5em; width: 60%; margin-bottom: 1em; }
.skeleton-circle { height: 48px; width: 48px; border-radius: var(--r-full); }

/* Page-level components */
.page-audit, .page-customers, .page-products, .page-vehicles, .page-regions, .page-users,
.page-orders, .page-dispatches, .page-finance, .page-dashboard {
  width: 100%; padding: var(--sp-6);
}

/* Sidebar components */
.sidebar {
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  color: var(--color-text);
  border-right: 1px solid var(--color-border);
  width: var(--sidebar-w, 280px); /* Increased slightly for more air */
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02); /* Very soft shadow */
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 10px; }

.sidebar-nav { 
  flex: 1;
  display: flex; 
  flex-direction: column; 
  gap: var(--sp-2); /* Increased gap between items */
  padding: 0 var(--sp-5) var(--sp-12);
  overflow-y: auto;
}

.sidebar-header { 
  padding: var(--sp-12) var(--sp-8) var(--sp-8); /* Much taller logo area */
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-4); /* More space between icon and text */
  padding: var(--sp-4) var(--sp-5);
  color: var(--color-text-soft);
  font-weight: 500;
  font-size: 0.938rem; /* Slightly larger for readability */
  transition: all 0.2s ease;
  text-decoration: none;
  border-radius: 14px; /* More rounded corners */
  line-height: 1.3;
}

.nav-link span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.nav-link i {
  width: 24px;
  flex-shrink: 0;
  text-align: center;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  transform: translateX(4px); /* Subtle slide effect */
}

.nav-link:hover i {
  opacity: 1;
  color: var(--color-primary);
}

.nav-link.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.nav-link.active i {
  color: var(--color-primary);
  opacity: 1;
}

.sidebar-label {
  padding: var(--sp-10) var(--sp-5) var(--sp-3); /* More space above categories */
  font-size: 0.688rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.user-profile { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); }
.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-info .name { font-weight: var(--fw-bold); font-size: var(--fs-sm); color: var(--color-text); }
.user-info .role { font-size: var(--fs-xs); color: var(--color-muted); }
.logo { 
  display: flex; 
  align-items: center; 
  gap: var(--sp-2); 
  font-weight: var(--fw-extrabold); 
  font-size: var(--fs-xl); 
  color: var(--color-text); 
}
.logo strong {
  color: var(--color-text);
}
.logout-btn { width: 100%; border-color: var(--color-border); color: var(--color-text-soft); }
.logout-btn:hover { background: rgba(239, 68, 68, 0.05); color: var(--color-danger); border-color: var(--color-danger); }
.finance-section { padding: var(--sp-2) 0; border-top: 1px solid var(--color-border); margin-top: var(--sp-4); }

/* Alias Classes (to be removed after Stage 5 migration) */
.primary-btn { @apply btn btn-primary; } /* Fallback handled below */
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md);
  font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
  background-color: var(--color-primary); color: white;
  border: 1px solid transparent; transition: all var(--transition-fast); gap: var(--sp-2);
}
.primary-btn:hover { background-color: var(--color-primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Page Header */
.page-header { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-8); }
.page-header h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); margin: 0; }

/* Icon Button */
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--color-border);
  color: var(--color-text-soft); cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.icon-btn.sm { width: 32px; height: 32px; }

/* Chip / Tag */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  background: var(--color-primary-light); color: var(--color-primary);
  border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.chip .chip-close {
  background: transparent; border: none; cursor: pointer;
  color: inherit; padding: 0; line-height: 1;
}

/* Search Input */
.search-input { position: relative; }
.search-input > i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--color-muted); pointer-events: none;
}
.search-input > input { padding-left: 36px; }

/* Dropdown / Select List */
.select-list {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown, 500);
}
.select-list-item {
  padding: var(--sp-2) var(--sp-4); cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.select-list-item:last-child { border-bottom: none; }
.select-list-item:hover { background: var(--color-primary-light); }
.select-list-item .title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.select-list-item .subtitle { color: var(--color-muted); font-size: var(--fs-xs); }

/* Product Card */
.product-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--color-border); border-radius: var(--r-lg);
  background: var(--color-surface); padding: 0; gap: 0;
  cursor: pointer; transition: all var(--transition-fast); position: relative;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.product-card.active { box-shadow: 0 0 0 2px var(--color-primary); background: var(--color-primary-light); }
.product-card.disabled { opacity: 0.55; cursor: not-allowed; }

.product-card-compact {
  border-radius: var(--r-md);
}
.product-card-compact .p-3 {
  padding: var(--sp-2) !important;
}
.product-card-compact .text-sm {
  font-size: 0.813rem !important;
}

/* Quantity Stepper (Legacy - for compatibility) */
.qty-stepper { display: inline-flex; align-items: center; gap: var(--sp-2); }
.qty-stepper button {
  width: 24px; height: 24px; border-radius: var(--r-sm);
  border: 1px solid var(--color-border); background: var(--color-surface);
  cursor: pointer; font-weight: bold; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.qty-stepper button:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.qty-stepper .qty-value {
  font-size: var(--fs-sm); font-weight: 700; min-width: 20px; text-align: center;
}

/* Premium Stepper UI */
.qty-stepper-premium {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg-dark);
  border-radius: 1rem;
  padding: 4px;
  width: 100%;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 0.75rem;
  border: none;
  background: white;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stepper-btn:hover {
  background: var(--color-primary);
  color: white;
  transform: scale(1.1);
}

.stepper-btn:active {
  transform: scale(0.95);
}

.qty-value-premium {
  font-weight: 800;
  font-size: 1rem;
  color: var(--color-primary);
  min-width: 30px;
  text-align: center;
}

.qty-input-premium {
  width: 3.75rem;
  border: 0;
  background: transparent;
  outline: none;
  appearance: textfield;
}

.qty-input-premium::-webkit-inner-spin-button,
.qty-input-premium::-webkit-outer-spin-button,
.mw-step-input::-webkit-inner-spin-button,
.mw-step-input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.btn-add-cart {
  width: 100%;
  padding: 10px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 1rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-add-cart:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
  background: var(--color-primary-dark);
}

.btn-add-cart.btn-compact {
  padding: 6px 10px;
  font-size: 0.75rem;
}

/* Loader */
.loader-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-12); }
.loader {
  width: 32px; height: 32px;
  border: 3px solid var(--color-border); border-top-color: var(--color-primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Premium & Modern UI additions */
.card-premium {
  background: white;
  border-radius: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-premium:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.btn-primary-premium {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: white;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(var(--color-primary-rgb), 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 1rem;
  color: var(--color-muted);
  font-weight: 600;
}

/* Sidebar Primary Actions */
.nav-primary-action {
  margin: var(--sp-2) 0 !important;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
  border: none !important;
}

.nav-primary-action:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4) !important;
}

.nav-primary-action.active {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, #3730a3 100%) !important;
}

.nav-primary-action i, .nav-primary-action span {
  color: white !important;
  opacity: 1 !important;
}


/* Language Switcher Dropdown (Premium) */
.lang-dropdown {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.lang-trigger:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.lang-trigger i.fa-globe {
  font-size: 0.9rem;
  color: var(--color-primary);
}

.lang-trigger i.fa-chevron-down {
  font-size: 0.7rem;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.lang-dropdown.open .lang-trigger {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.lang-dropdown.open .lang-trigger i.fa-chevron-down {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--color-surface);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.lang-dropdown.open .lang-menu {
  display: flex;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-option:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.lang-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.lang-option .check-icon {
  font-size: 0.8rem;
  display: none;
}

.lang-option.active .check-icon {
  display: block;
}

/* Map Marker */
.custom-map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: var(--color-primary);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -15px 0 0 -15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  border: 2px solid white;
}

.marker-pin i {
  transform: rotate(45deg);
  color: white;
  font-size: 14px;
}

.marker-pin::after {
  content: '';
  width: 10px;
  height: 10px;
  margin: 8px 0 0 8px;
  background: white;
  position: absolute;
  border-radius: 50%;
}

/* ============================================================
   MOBILE RESPONSIVE — Mobil Uyumluluk Planı (Faz 1 + Faz 2)
   ============================================================ */

/* --- 1.3 Sidebar drawer (mobile + tablet) --- */
@media (max-width: 1023px) {
  .nav-mail-desktop-only { display: none !important; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(86vw, 320px);
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,.12);
  }
  body[data-sidebar-open="true"] .sidebar { transform: translateX(0); }
  body[data-sidebar-open="true"] { overflow: hidden; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body[data-sidebar-open="true"] .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* --- 1.7 Page padding override --- */
@media (max-width: 1023px) {
  .page-audit, .page-customers, .page-products, .page-vehicles, .page-regions,
  .page-users, .page-orders, .page-dispatches, .page-finance, .page-dashboard {
    padding: var(--sp-4);
  }
}
@media (max-width: 767px) {
  .page-audit, .page-customers, .page-products, .page-vehicles, .page-regions,
  .page-users, .page-orders, .page-dispatches, .page-finance, .page-dashboard {
    padding: var(--sp-3);
  }
}

/* --- 1.8 Toast container mobile --- */
@media (max-width: 767px) {
  .toast-container {
    top: calc(var(--header-height) + .5rem);
    right: .5rem;
    left: .5rem;
  }
  .toast-item { min-width: 0; width: 100%; }
}

/* --- 2.1 Modal bottom-sheet (components.css .modal-dialog için) --- */
@media (max-width: 767px) {
  .modal-overlay { align-items: flex-end; }
  .modal-dialog,
  .modal-dialog.modal-dialog-wide {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .modal-overlay.open .modal-dialog { transform: translateY(0); }
  .modal-body {
    padding: var(--sp-4);
    max-height: calc(92dvh - 180px); /* adjusted to prevent stacked buttons cutoff */
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
  }
  .modal-header, .modal-actions { padding: var(--sp-3) var(--sp-4); }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* --- 2.2 Tablolar mobilde yatay scroll + kart fallback --- */
@media (max-width: 1023px) {
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; padding: var(--sp-2) var(--sp-3); font-size: 0.82rem; }
}
@media (max-width: 767px) {
  .table-as-cards { border: 0; }
  .table-as-cards thead { display: none; }
  .table-as-cards tbody, .table-as-cards tr { display: block; width: 100%; }
  .table-as-cards tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    margin-bottom: .75rem;
    padding: .85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
  }
  /* Standart hücre: label sol, value sağ, tek satır */
  .table-as-cards td {
    border: 0;
    padding: 0;
    white-space: normal;
    font-size: .85rem;
    min-width: 0;
    overflow-wrap: anywhere;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .65rem;
    text-align: right !important;
  }
  .table-as-cards td::before {
    content: attr(data-label);
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-muted);
    text-align: left;
    flex-shrink: 0;
    align-self: center;
  }
  /* Başlık hücresi: data-mw-title attribute ile işaretlenir → tam genişlik, sola yaslı */
  .table-as-cards td[data-mw-title] {
    display: block;
    text-align: left !important;
    font-weight: 800;
    font-size: 1rem;
    color: var(--color-text);
    padding-bottom: .55rem;
    margin-bottom: .35rem;
    border-bottom: 1px dashed var(--color-border);
  }
  .table-as-cards td[data-mw-title]::before { display: none; }

  /* Aksiyon hücresi: data-label="" → tam genişlik, ortalanmış */
  .table-as-cards td[data-label=""] {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: .55rem;
    margin-top: .25rem;
    border-top: 1px dashed var(--color-border);
  }
  .table-as-cards td[data-label=""]::before { display: none; }

  /* Geri uyumluluk: data-mw-title olmayan ilk td hâlâ başlık gibi davransın */
  .table-as-cards td:first-child:not([data-mw-title]):not([data-label]) {
    display: block;
    text-align: left !important;
    font-weight: 800;
  }
  .table-as-cards td:first-child:not([data-mw-title]):not([data-label])::before {
    display: none;
  }
}

/* --- 2.4 Form input font-size (iOS zoom önleme) --- */
@media (max-width: 1023px) {
  .form-control, select.form-control, textarea.form-control,
  input[type="text"], input[type="number"], input[type="email"],
  input[type="password"], input[type="search"], input[type="date"],
  input[type="tel"], select, textarea {
    font-size: 16px;
  }
}

/* --- 2.5 Touch hedef minimum boyutu --- */
@media (max-width: 1023px) {
  .btn, .icon-btn, .nav-link, .tab-btn, .btn-close { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .table-as-cards tr { min-height: 56px; }
}

/* --- 2.8 Sticky tab bar / chip row scroll --- */
.tab-bar, .chip-row {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }
.tab-bar .tab-btn, .chip-row > * { flex-shrink: 0; }
@media (max-width: 767px) {
  .tab-bar .tab-btn { padding: .55rem .75rem !important; font-size: .8rem !important; }
}

/* --- 3.7 Chart host mobile yükseklik --- */
@media (max-width: 767px) {
  .chart-host { height: 240px !important; }
  .chart-host[data-chart="cashflow"],
  .chart-host[data-chart="salesTrend"] { height: 260px !important; }
}

/* --- 3.8 Map host mobile yükseklik --- */
.map-host { height: 480px; }
@media (max-width: 1023px) { .map-host { height: 360px; } }
@media (max-width: 767px) { .map-host { height: 280px; } }

/* --- Mobile yatay scroll guard --- */
@media (max-width: 1023px) {
  .main-content, .view-container { overflow-x: hidden; max-width: 100vw; }
  .view-container > * { max-width: 100%; }
}

/* --- Planner / loading fixed bottom bar mobile --- */
@media (max-width: 1023px) {
  .planner-bottom-bar {
    margin-left: 0 !important;
    padding: .65rem .75rem !important;
  }
  .planner-bottom-inner {
    max-width: 100% !important;
    flex-wrap: wrap;
    gap: .5rem !important;
    justify-content: center !important;
  }
  .planner-bottom-inner > div { min-width: 0; }
  .planner-bottom-inner .flex.gap-16 { gap: 1rem !important; }
}
@media (max-width: 767px) {
  .planner-bottom-bar { padding-bottom: calc(.65rem + env(safe-area-inset-bottom)) !important; }
  .planner-bottom-inner { flex-direction: column; align-items: stretch !important; }
  .planner-bottom-inner > div { width: 100%; }
  .planner-bottom-inner button { width: 100%; padding: .85rem 1rem !important; font-size: .9rem !important; }
}

/* --- dispatches-detail action buttons mobile --- */
@media (max-width: 767px) {
  .dispatch-actions { gap: .4rem !important; }
  .dispatch-actions button {
    flex: 1 1 calc(50% - .25rem);
    min-width: 0;
    padding: .65rem .5rem !important;
    font-size: .75rem !important;
    white-space: nowrap;
  }
}

/* --- Sevkiyat dışı sipariş (delivery-adhoc) layout --- */
.adhoc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .adhoc-layout { grid-template-columns: minmax(0,1fr) 320px; }
}
.adhoc-layout > * { min-width: 0; }

/* --- dispatch-delivery-flow: FAB ile çakışan save butonunun altında boşluk --- */
@media (max-width: 767px) {
  .delivery-flow-page .fab-container,
  .delivery-record-page .fab-container { display: none; }
}

/* --- Notifications sayfası 2 kolon layout --- */
.notifications-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .notifications-layout { grid-template-columns: 1fr 340px; gap: 2rem; }
}
.notifications-layout > * { min-width: 0; }

/* --- Frekans tablosunun min-w-[1200px] mobilde kapansın --- */
@media (max-width: 1023px) {
  .table-as-cards { min-width: 0 !important; }
}

/* --- Page header buton grupları mobile'da yayılsın --- */
@media (max-width: 767px) {
  /* "Excel Export / Yazdır / Yeni X" gibi sağ-üst aksiyon grupları */
  .anim-fade-in > header .btn,
  .anim-fade-in > div > header .btn,
  .page-header .btn {
    flex: 1 1 calc(50% - .25rem);
    min-width: 0;
    padding: .55rem .75rem !important;
    font-size: .78rem !important;
    white-space: nowrap;
  }
  .anim-fade-in > header,
  .anim-fade-in > div > header { gap: .4rem !important; }
}

/* --- Card içi flex/grid taşma guard --- */
.card > div, .card > section { min-width: 0; }

/* --- Liste sayfası header'ı mobile'da dikey --- */
@media (max-width: 767px) {
  .anim-fade-in > header.flex,
  .anim-fade-in > div > header.flex {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .anim-fade-in > header.flex > *,
  .anim-fade-in > div > header.flex > * { width: 100%; }
}

/* ============================================================
   MOBILE WIZARD — sipariş giriş / sevkiyat oluşturma / teslim
   ============================================================ */
.mobile-wizard {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-height, 56px));
  background: var(--color-bg);
  margin: -.75rem;
}
.mw-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.mw-back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 12px; cursor: pointer; color: var(--color-text);
}
.mw-title { flex: 1; min-width: 0; }
.mw-step-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--color-muted);
}
.mw-step-name { font-size: 1.05rem; font-weight: 800; color: var(--color-text); }
.mw-step-dots { display: flex; gap: 4px; }
.mw-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--color-border);
  transition: all .2s;
}
.mw-dot.is-active { background: var(--color-primary); width: 22px; }
.mw-dot.is-done { background: var(--color-success); }

.mw-body {
  flex: 1;
  padding: 1rem;
  display: flex; flex-direction: column; gap: 1rem;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.mw-search-wrap { position: relative; }
.mw-search-icon {
  position: absolute; left: .9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
}
.mw-search-input {
  width: 100%;
  padding: .85rem 1rem .85rem 2.5rem;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  outline: none;
}
.mw-search-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }

.mw-selected-strip {
  padding: .75rem; background: var(--color-primary-light);
  border-radius: 14px;
}
.mw-selected-strip-label {
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-primary); margin-bottom: .5rem;
}
.mw-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.mw-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem;
  background: var(--color-primary); color: white;
  border-radius: 999px;
  font-size: .8rem; font-weight: 600;
}
.mw-chip-readonly { padding: .35rem .85rem; }
.mw-chip-x {
  background: rgba(255,255,255,.25); color: white;
  border: 0; width: 18px; height: 18px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .65rem;
}

.mw-list { display: flex; flex-direction: column; gap: .5rem; }
.mw-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  text-align: left; cursor: pointer;
  transition: all .15s;
}
.mw-row:active { transform: scale(.99); }
.mw-row.is-selected { border-color: var(--color-primary); background: var(--color-primary-light); }
.mw-row-check {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: white; font-size: .75rem;
}
.mw-row.is-selected .mw-row-check {
  background: var(--color-primary); border-color: var(--color-primary);
}
.mw-row-body { flex: 1; min-width: 0; }
.mw-row-title {
  font-weight: 700; font-size: .9rem; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mw-row-sub {
  font-size: .75rem; color: var(--color-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mw-empty {
  padding: 2rem 1rem; text-align: center;
  color: var(--color-muted); font-size: .85rem;
}

/* Ürün kartları */
.mw-product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
}
.mw-prod-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: .85rem .8rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  min-height: 110px;
}
.mw-prod-card.is-in-cart { border-color: var(--color-primary); background: var(--color-primary-light); }
.mw-prod-title {
  font-weight: 700; font-size: .82rem; color: var(--color-text);
  line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mw-prod-price {
  font-size: .9rem; font-weight: 800; color: var(--color-primary);
  margin-top: auto;
}
.mw-prod-add {
  background: var(--color-primary); color: white;
  border: 0; padding: .55rem; border-radius: 10px;
  font-weight: 700; font-size: .8rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mw-stepper {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: .25rem;
  background: var(--color-surface); border-radius: 10px;
  border: 1px solid var(--color-primary);
}
.mw-step-btn {
  background: transparent; border: 0;
  color: var(--color-primary); font-weight: 800; font-size: 1.1rem;
  padding: .5rem; cursor: pointer; min-height: 40px;
}
.mw-step-val { font-weight: 800; font-size: .95rem; text-align: center; color: var(--color-text); }
.mw-step-input { width: 3.5rem; min-width: 0; border: 0; outline: none; background: transparent; appearance: textfield; }

/* Özet bölümleri */
.mw-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: .9rem 1rem;
}
.mw-section-label {
  font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-muted);
  display: block; margin-bottom: .5rem;
}
.mw-section-label-row { display: flex; justify-content: space-between; align-items: center; }
.mw-section-edit {
  background: transparent; border: 0; color: var(--color-primary);
  font-weight: 700; font-size: .75rem; cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.mw-section-body { display: flex; flex-direction: column; gap: .35rem; }

.mw-summary-item {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .55rem 0;
  border-top: 1px dashed var(--color-border);
}
.mw-summary-item:first-child { border-top: 0; padding-top: 0; }
.mw-summary-item-name {
  font-size: .82rem; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mw-summary-item-meta {
  display: flex; align-items: center; gap: .55rem;
  font-size: .78rem; color: var(--color-muted);
  flex-shrink: 0;
}
.mw-summary-item-meta strong { color: var(--color-primary); font-weight: 800; }

.mw-date-input, .mw-textarea {
  width: 100%;
  font-size: 16px;
  padding: .65rem .85rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  font-family: inherit;
  outline: none;
}
.mw-textarea { resize: vertical; min-height: 80px; }

.mw-totals {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.mw-total-row { display: flex; justify-content: space-between; font-size: .85rem; }
.mw-total-row strong { font-weight: 700; }
.mw-total-grand {
  margin-top: .35rem; padding-top: .65rem;
  border-top: 1px solid var(--color-border);
  font-size: 1rem;
}
.mw-total-grand strong { font-size: 1.15rem; color: var(--color-primary); }
.mw-bulk-warning {
  margin-top: .5rem; padding: .55rem .75rem;
  background: rgba(245, 158, 11, .1);
  color: var(--color-warning);
  border-radius: 10px; font-size: .75rem; font-weight: 600;
}

/* Alt bar */
.mw-bottom {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 10;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .75rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.mw-bottom-info {
  flex: 1; min-width: 0;
  font-size: .8rem; font-weight: 600; color: var(--color-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mw-next-btn {
  flex-shrink: 0;
  min-width: 120px;
  padding: .75rem 1rem;
  font-weight: 700; font-size: .85rem;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 360px) {
  .mw-next-btn { min-width: 100px; padding: .7rem .8rem; font-size: .8rem; }
  .mw-bottom-info { font-size: .72rem; }
}

/* Wizard aktifken FAB gizle (body.wizard-active JS tarafında set ediliyor) */
body.wizard-active #fab-root { display: none !important; }
/* :has() destekleyen tarayıcılar için ekstra güvence */
body:has(.mobile-wizard) #fab-root,
body:has(.driver-mobile) #fab-root,
body:has(.driver-mobile-customer) #fab-root { display: none !important; }
.mw-bottom { z-index: 12 !important; }

/* Sevkiyat planner — bölge grup başlığı */
.mw-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: .65rem .85rem .85rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.mw-group-head {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
.mw-group-title { font-weight: 700; font-size: .85rem; color: var(--color-text); }
.mw-group-count { color: var(--color-muted); font-weight: 600; font-size: .75rem; }
.mw-group-toggle {
  background: transparent; border: 1px solid var(--color-primary);
  color: var(--color-primary); border-radius: 999px;
  padding: .25rem .7rem; font-size: .7rem; font-weight: 700;
  cursor: pointer;
}
.mw-pallet-badge {
  display: inline-block; margin-left: .5rem;
  padding: 1px 7px; font-size: .65rem; font-weight: 800;
  background: var(--color-primary-light); color: var(--color-primary);
  border-radius: 999px;
}

/* Hint çubuğu */
.mw-hint {
  background: var(--color-info, #0ea5e9); color: white;
  padding: .55rem .85rem; border-radius: 10px;
  font-size: .75rem; font-weight: 600;
  background: rgba(14,165,233,.1); color: var(--color-info);
}

/* Error banner */
.mw-error {
  position: relative;
  margin: 0 1rem; padding: .75rem 2.5rem .75rem 1rem;
  background: rgba(239,68,68,.1); color: var(--color-danger);
  border-radius: 12px; font-size: .85rem; font-weight: 600;
}
.mw-error-close {
  position: absolute; top: .5rem; right: .5rem;
  background: transparent; border: 0; color: var(--color-danger);
  cursor: pointer; padding: .25rem;
}

/* Kapasite bar */
.mw-capacity-track {
  width: 100%; height: 10px; border-radius: 999px;
  background: var(--color-border); overflow: hidden;
  margin-top: .35rem;
}
.mw-capacity-fill {
  height: 100%; background: var(--color-primary);
  border-radius: 999px; transition: width .25s;
}
.mw-capacity-fill.is-over { background: var(--color-danger); }
.mw-warning {
  margin-top: .5rem; padding: .5rem .75rem;
  background: rgba(239,68,68,.1); color: var(--color-danger);
  border-radius: 10px; font-size: .75rem; font-weight: 700;
}
.mw-next-btn.is-warning {
  background: var(--color-danger); border-color: var(--color-danger);
}

/* ============================================================
   DRIVER MOBILE — sürücü teslim ekranı
   ============================================================ */
.driver-mobile, .driver-mobile-customer {
  margin: -.75rem;
  background: var(--color-bg);
  min-height: calc(100dvh - var(--header-height, 56px));
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.dm-top {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem .6rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 5;
}
.dm-top-body { flex: 1; min-width: 0; }
.dm-top-title { font-weight: 800; font-size: 1.05rem; color: var(--color-text); }
.dm-top-sub {
  font-size: .7rem; color: var(--color-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-progress-num {
  font-weight: 800; color: var(--color-primary);
  background: var(--color-primary-light);
  padding: .3rem .65rem; border-radius: 999px; font-size: .8rem;
}
.dm-progress-track {
  background: var(--color-surface);
  padding: .25rem 1rem .8rem;
  border-bottom: 1px solid var(--color-border);
}
.dm-progress-track::before {
  content: ''; display: block; height: 8px;
  background: var(--color-border); border-radius: 999px;
  position: relative;
}
.dm-progress-fill {
  height: 8px; background: var(--color-primary); border-radius: 999px;
  margin-top: -8px; transition: width .35s;
}

.dm-adhoc-btn {
  margin: .85rem 1rem 0;
  width: calc(100% - 2rem);
  background: var(--color-success); color: white;
  border: 0; padding: .85rem 1rem;
  border-radius: 14px; font-weight: 800; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.dm-adhoc-btn.is-disabled { background: var(--color-border); color: var(--color-muted); box-shadow: none; }

.dm-section { padding: .85rem 1rem 0; }
.dm-section-title {
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-muted); margin-bottom: .5rem;
}
.dm-done { opacity: 1; }
.dm-list { display: flex; flex-direction: column; gap: .55rem; }

.dm-cust-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.dm-cust-row:active { transform: scale(.99); }
.dm-cust-row.is-done { border-color: var(--color-success); background: rgba(16,185,129,.06); }
.dm-cust-row.is-payment-full { border-color: var(--color-success); background: rgba(16,185,129,.08); }
.dm-cust-row.is-payment-partial { border-color: #facc15; background: rgba(250,204,21,.13); }
.dm-cust-row.is-payment-none { border-color: var(--color-danger); background: rgba(220,38,38,.09); }
.dm-cust-row.is-payment-failed { border-color: #64748b; background: rgba(100,116,139,.16); }
.dm-cust-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.dm-cust-row.is-done .dm-cust-icon { background: var(--color-success); color: white; }
.dm-cust-row.is-payment-partial .dm-cust-icon { background: #eab308; color: white; }
.dm-cust-row.is-payment-none .dm-cust-icon { background: var(--color-danger); color: white; }
.dm-cust-row.is-payment-failed .dm-cust-icon { background: #64748b; color: white; }
.dm-cust-body { flex: 1; min-width: 0; }
.dm-cust-name {
  font-weight: 700; font-size: .92rem; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-cust-sub {
  font-size: .72rem; color: var(--color-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-cust-chev { color: var(--color-muted); font-size: .9rem; }

.dm-done-badge {
  display: inline-flex; align-items: center;
  background: var(--color-success); color: white;
  padding: .25rem .6rem; border-radius: 999px;
  font-size: .7rem; font-weight: 800;
}

.dm-customer-body { padding: .85rem; }
/* Mevcut orderCard içeriği wrapper içinde sığması için */
.dm-customer-body > * { max-width: 100% !important; }

/* === Alacak yönetimi (finance-receivables) mobil ince ayar === */
.finance-rec-detail-label { display: none; }
@media (max-width: 767px) {
  .finance-rec-checkbox-cell { display: none !important; }
  .finance-rec-detail-label { display: inline; margin-right: .35rem; }
  .finance-rec-detail-btn {
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    padding: .65rem 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .35rem !important;
    background: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
    border: 0 !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: .85rem !important;
    white-space: nowrap !important;
  }
}

/* === Dispatch close — aksiyon butonları mobilde dikey === */
.dispatch-close-actions .btn { min-height: 44px; }
@media (max-width: 1023px) {
  .dispatch-close-actions { gap: .5rem !important; }
  .dispatch-close-actions .btn { padding: .75rem 1rem !important; font-size: .85rem !important; }
}

/* Sevkiyat bitir CTA (tüm teslimatlar tamamlandığında) */
.dm-finish-cta {
  margin: 1rem;
  padding: 1.5rem 1.25rem;
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.25);
  border-radius: 18px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
}
.dm-finish-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.dm-finish-title { font-weight: 800; font-size: 1.05rem; color: var(--color-text); }
.dm-finish-sub { font-size: .8rem; color: var(--color-muted); margin-bottom: .85rem; }
.dm-finish-btn {
  width: 100%;
  background: var(--color-success); color: white;
  border: 0; padding: 1rem 1.5rem;
  border-radius: 14px;
  font-weight: 800; font-size: .95rem;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(16,185,129,.35);
  transition: transform .1s;
}
.dm-finish-btn:active { transform: scale(.98); }

/* ============================================================
   LOADING MOBILE — depocu yükleme akışı
   ============================================================ */
.loading-mobile {
  margin: -.75rem;
  background: var(--color-bg);
  min-height: calc(100dvh - var(--header-height, 56px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
.lm-top {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem .55rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 5;
}
.lm-top-body { flex: 1; min-width: 0; }
.lm-top-title { font-weight: 800; font-size: 1.05rem; color: var(--color-text); }
.lm-top-sub {
  font-size: .72rem; color: var(--color-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lm-progress-num {
  font-weight: 800; color: var(--color-primary);
  background: var(--color-primary-light);
  padding: .3rem .65rem; border-radius: 999px; font-size: .8rem;
}
.lm-progress-row {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: .25rem 1rem .9rem;
}
.lm-progress-track {
  height: 10px; background: var(--color-border);
  border-radius: 999px; overflow: hidden;
}
.lm-progress-fill {
  height: 100%; background: var(--color-primary);
  border-radius: 999px; transition: width .3s;
}
.lm-progress-label {
  font-size: .72rem; font-weight: 700; color: var(--color-muted);
  margin-top: .35rem;
}

.lm-items {
  display: flex; flex-direction: column;
  gap: .85rem; padding: .85rem 1rem;
}
.lm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1rem;
  display: flex; flex-direction: column; gap: .85rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color .2s, background .2s;
}
.lm-card.is-exact   { border-color: var(--color-success); background: rgba(16,185,129,.04); }
.lm-card.is-partial { border-color: var(--color-warning); }
.lm-card.is-over    { border-color: var(--color-danger);  background: rgba(239,68,68,.04); }
.lm-card.has-missing-note { box-shadow: 0 0 0 2px rgba(239,68,68,.15); }

.lm-card-head { display: flex; justify-content: space-between; align-items: start; gap: .65rem; }
.lm-card-info { flex: 1; min-width: 0; }
.lm-card-name {
  font-weight: 800; font-size: .95rem; color: var(--color-text);
  line-height: 1.25;
}
.lm-card-plan {
  display: flex; align-items: center; gap: .4rem;
  margin-top: .35rem; font-size: .75rem; color: var(--color-muted);
}
.lm-plan-label {
  font-size: .65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em;
}
.lm-card-plan strong { color: var(--color-text); font-weight: 800; font-size: .85rem; }

.lm-state-badge {
  padding: .25rem .6rem; border-radius: 999px;
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  flex-shrink: 0;
}
.lm-state-badge.is-zero    { background: var(--color-bg); color: var(--color-muted); }
.lm-state-badge.is-exact   { background: var(--color-success); color: white; }
.lm-state-badge.is-partial { background: var(--color-warning); color: white; }
.lm-state-badge.is-over    { background: var(--color-danger);  color: white; }

.lm-stepper-row {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr;
  gap: .5rem; align-items: stretch;
}
.lm-step-btn {
  min-height: 60px;
  background: var(--color-primary);
  color: white; border: 0; border-radius: 14px;
  font-size: 1.5rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 12px rgba(99,102,241,.25);
  transition: transform .1s, opacity .2s;
}
.lm-step-btn:active { transform: scale(.96); }
.lm-step-btn:disabled { opacity: .35; box-shadow: none; cursor: not-allowed; }
.lm-step-val {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.65rem; font-weight: 800; color: var(--color-text);
  background: var(--color-bg); border-radius: 14px;
  min-height: 60px;
}

.lm-quick-fill {
  width: 100%;
  background: var(--color-success); color: white;
  border: 0; padding: .7rem 1rem; border-radius: 12px;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(16,185,129,.25);
}
.lm-quick-fill:active { transform: scale(.99); }

.lm-note-wrap { display: flex; flex-direction: column; gap: .35rem; }
.lm-note-label {
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-muted);
}
.lm-note-label.is-missing { color: var(--color-danger); }
.lm-note-input {
  width: 100%; padding: .75rem 1rem;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  outline: none;
}
.lm-card.has-missing-note .lm-note-input {
  border-color: var(--color-danger);
}
.lm-note-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ============================================================
   DMC — Driver mobile customer (tek müşteri teslim ekranı)
   ============================================================ */
.dmc-body {
  padding: .85rem 1rem;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .85rem;
}
.dmc-section-title {
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-muted);
}
.dmc-items { display: flex; flex-direction: column; gap: .75rem; }
.dmc-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: .85rem;
  display: flex; flex-direction: column; gap: .7rem;
  transition: border-color .2s, background .2s;
}
.dmc-item.is-full {
  border-color: var(--color-success);
  background: rgba(16,185,129,.05);
}
.dmc-item-head { display: flex; gap: .5rem; }
.dmc-item-info { flex: 1; min-width: 0; }
.dmc-item-name {
  font-weight: 800; font-size: .92rem; color: var(--color-text);
  line-height: 1.25;
}
.dmc-item-meta {
  display: flex; align-items: center; gap: .4rem;
  flex-wrap: wrap;
  margin-top: .35rem;
  font-size: .7rem;
}
.dmc-tag {
  padding: .15rem .55rem; border-radius: 999px;
  font-weight: 800; letter-spacing: .03em;
  font-size: .65rem;
}
.dmc-tag-plan { background: var(--color-primary-light); color: var(--color-primary); }
.dmc-tag-extra { background: var(--color-warning); color: white; }
.dmc-price-tag { color: var(--color-muted); font-weight: 600; }

.dmc-delivered-qty {
  background: var(--color-bg);
  padding: .85rem;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--color-success);
}

/* Farklı ürün ekle */
.dmc-add-extra {
  width: 100%;
  background: transparent;
  border: 2px dashed var(--color-border);
  color: var(--color-text);
  padding: .9rem;
  border-radius: 14px;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.dmc-add-extra:hover { border-color: var(--color-primary); color: var(--color-primary); }

.dmc-extra-picker {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .5rem;
  background: var(--color-bg);
  padding: .65rem;
  border-radius: 12px;
}
.dmc-extra-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: .65rem .5rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s;
}
.dmc-extra-btn:hover { border-color: var(--color-primary); }
.dmc-extra-name { font-size: .75rem; font-weight: 700; color: var(--color-text); }
.dmc-extra-stock { font-size: .65rem; color: var(--color-primary); font-weight: 800; margin-top: 2px; }

/* Tahsilat */
.dmc-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.dmc-pay-field { display: flex; flex-direction: column; gap: .35rem; }
.dmc-pay-label {
  font-size: .65rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-muted);
}
.dmc-pay-input {
  font-size: 1.25rem; font-weight: 800;
  padding: .85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  text-align: center;
  outline: none;
  width: 100%;
}
.dmc-pay-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.dmc-match-btn {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 0;
  padding: .55rem; border-radius: 10px;
  font-weight: 700; font-size: .75rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Toplam tutar kutusu */
.dmc-total-box {
  background: linear-gradient(135deg, var(--color-primary), #4f46e5);
  color: white;
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 8px 20px rgba(99,102,241,.25);
}
.dmc-total-label {
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  opacity: .85;
}
.dmc-total-val {
  font-size: 1.85rem; font-weight: 900;
  margin-top: .25rem;
}

.dmc-done-info {
  background: rgba(16,185,129,.08);
  color: var(--color-success);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(16,185,129,.25);
}
.dmc-done-info .dmc-total-val { color: var(--color-success); }
.dmc-done-info.is-paid-partial {
  background: rgba(250,204,21,.13);
  color: #a16207;
  border-color: rgba(250,204,21,.38);
}
.dmc-done-info.is-paid-partial .dmc-total-val { color: #a16207; }
.dmc-done-info.is-paid-none {
  background: rgba(220,38,38,.09);
  color: var(--color-danger);
  border-color: rgba(220,38,38,.28);
}
.dmc-done-info.is-paid-none .dmc-total-val { color: var(--color-danger); }
.dmc-done-info.is-cancelled {
  background: rgba(100,116,139,.16);
  color: #475569;
  border-color: rgba(100,116,139,.35);
}
.dmc-done-info.is-cancelled .dmc-total-val { color: #475569; }
.dmc-done-detail { margin-top: .35rem; font-size: .8rem; color: var(--color-text); }

/* Alt bar */
.dmc-bottom { padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); gap: .65rem; }
.dmc-failed-btn {
  flex: 1;
  background: var(--color-surface);
  color: var(--color-danger);
  border: 2px solid var(--color-danger);
  font-weight: 800;
  padding: .85rem 1rem;
  border-radius: 14px;
  font-size: .85rem;
}
.dmc-failed-btn:active { background: rgba(239,68,68,.05); }
.dmc-deliver-btn {
  flex: 1.5;
  font-weight: 800;
  padding: .85rem 1rem;
  border-radius: 14px;
  font-size: .9rem;
  box-shadow: 0 4px 14px rgba(99,102,241,.3);
}

/* ============================================================
   DISPATCHES TABS — sevkiyatlar üst sekme barı
   ============================================================ */
.dispatches-tabs {
  scroll-behavior: smooth;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
  -webkit-overflow-scrolling: touch;
  position: relative;
  /* Sağda fade-out gradient ile scroll edilebileceğini ima et */
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
}
.dispatches-tabs::-webkit-scrollbar { display: none; }

.dispatches-tab-btn {
  padding: 1rem 1.25rem;
  font-size: .9rem;
  flex-shrink: 0;
  min-height: 48px;
}
.dispatches-tab-btn.is-active { font-weight: 800; }
.dispatches-tab-count {
  font-weight: 800;
  min-width: 22px;
  text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Tablet — biraz daraltılır */
@media (max-width: 1023px) {
  .dispatches-tab-btn { padding: .8rem 1rem; font-size: .85rem; }
}

/* Mobile — kompakt, scrollable */
@media (max-width: 767px) {
  .dispatches-tab-btn { padding: .65rem .85rem !important; font-size: .8rem !important; min-height: 44px; }
  .dispatches-tab-count { font-size: .65rem; padding: 1px 6px !important; }
}

/* --- SearchSelect chip'leri mobile'da tam genişlik --- */
@media (max-width: 767px) {
  .search-select-chips { flex-direction: column; gap: .5rem !important; }
  .search-select-chips > .chip {
    width: 100%;
    justify-content: space-between !important;
    margin: 0 !important;
    padding: .7rem 1rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.18) !important;
  }
  .search-select-chips > .chip > span:not(.chip-close) {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* --- Satıcı Modülü: responsive customer list and detail --- */
.sales-mobile-only { display: none; }
.sales-order-btn { gap: .5rem; white-space: nowrap; }
.sales-order-btn-sm { padding: .55rem .85rem !important; font-size: .78rem !important; }
.sales-customer-cards { padding: .75rem; background: #f8fafc; }
.sales-customer-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: .75rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
  cursor: pointer;
}
.sales-customer-card:last-child { margin-bottom: 0; }
.sales-customer-card-head { display: flex; align-items: center; gap: .75rem; }
.sales-customer-index {
  width: 2rem; height: 2rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2ff; color: var(--color-primary); font-size: .75rem; font-weight: 900;
  flex: 0 0 auto;
}
.sales-customer-name { margin: 0; color: #1e293b; font-size: .98rem; font-weight: 900; line-height: 1.25; }
.sales-customer-location { margin: .2rem 0 0; color: #64748b; font-size: .75rem; font-weight: 700; }
.sales-customer-address,
.sales-customer-contact {
  display: flex; align-items: flex-start; gap: .55rem;
  margin-top: .85rem; color: #64748b; font-size: .78rem; line-height: 1.45;
}
.sales-customer-address i,
.sales-customer-contact i { color: var(--color-primary); margin-top: .15rem; width: 1rem; text-align: center; }
.sales-customer-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .85rem; }
.sales-mobile-stat { min-width: 0; background: #f8fafc; border-radius: 12px; padding: .65rem .75rem; }
.sales-mobile-stat-label { display: block; color: #94a3b8; font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.sales-mobile-stat strong { display: block; color: #334155; font-size: .78rem; margin-top: .2rem; overflow-wrap: anywhere; }
.sales-mobile-stat.is-danger strong { color: #e11d48; }
.sales-order-btn-mobile {
  width: 100%; min-height: 46px; margin-top: .85rem; border: 0; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), #4f46e5);
  color: white; font-size: .85rem; font-weight: 900;
  box-shadow: 0 7px 16px rgba(79, 70, 229, .22);
}
.sales-order-history-card {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .8rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc;
}
.sales-order-history-card > div { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.sales-order-history-card > div:last-child { text-align: right; align-items: flex-end; }
.sales-order-history-card strong { color: #334155; font-size: .78rem; overflow-wrap: anywhere; }
.sales-order-history-card span { color: #64748b; font-size: .7rem; }
.sales-contact-status {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .38rem .6rem; border-radius: 999px; font-size: .68rem; font-weight: 900;
  white-space: nowrap; border: 1px solid transparent;
}
.sales-contact-status.is-pending { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.sales-contact-status.is-contacted { color: #0369a1; background: #f0f9ff; border-color: #bae6fd; }
.sales-contact-status.is-order { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.sales-contact-summary { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.sales-contact-summary-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .5rem;
  border-radius: 999px; font-size: .65rem; font-weight: 800; background: #f8fafc; color: #64748b;
}
.sales-contact-summary-chip strong { font-size: .72rem; }
.sales-contact-summary-chip.is-pending strong { color: #b45309; }
.sales-contact-summary-chip.is-contacted strong { color: #0369a1; }
.sales-contact-summary-chip.is-order strong { color: #047857; }
.sales-contact-progress { border-left: 5px solid #f59e0b; }
.sales-contact-progress.status-2 { border-left-color: #0ea5e9; }
.sales-contact-progress.status-3 { border-left-color: #10b981; background: linear-gradient(135deg, #fff, #ecfdf5); }
.sales-contact-progress.is-empty { border-left-color: #cbd5e1; }
.sales-contact-progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.sales-contact-progress-head h2 { margin-bottom: .2rem !important; }
.sales-contact-progress-note { margin: .8rem 0 0; color: #475569; font-size: .85rem; line-height: 1.5; }
.sales-contact-action { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; margin-top: 1rem; }

/* Customer detail special price dialog */
body.customer-price-modal-open { overflow: hidden; }
.customer-price-modal {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center;
  padding: 1.25rem; background: rgba(15, 23, 42, .68); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .18s ease;
}
.customer-price-modal.is-open { opacity: 1; }
.customer-price-dialog {
  width: min(620px, 100%); max-height: min(88vh, 760px); overflow: hidden;
  display: flex; flex-direction: column; background: #fff; border: 1px solid rgba(255,255,255,.7);
  border-radius: 26px; box-shadow: 0 32px 90px rgba(15,23,42,.34);
  transform: translateY(14px) scale(.985); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.customer-price-modal.is-open .customer-price-dialog { transform: translateY(0) scale(1); }
.customer-price-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.35rem 1.5rem; color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 56%, #7c3aed 100%);
}
.customer-price-heading { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.customer-price-heading-icon {
  width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 15px; background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.customer-price-heading h3 { margin: 0; font-size: 1.18rem; font-weight: 900; letter-spacing: -.02em; }
.customer-price-heading p { margin: .2rem 0 0; opacity: .82; font-size: .78rem; font-weight: 700; overflow-wrap: anywhere; }
.customer-price-close {
  width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center;
  border: 0; border-radius: 12px; color: #fff; background: rgba(255,255,255,.14); cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.customer-price-close:hover { background: rgba(255,255,255,.24); transform: rotate(4deg); }
.customer-price-body { overflow-y: auto; padding: 1.4rem 1.5rem .4rem; background: linear-gradient(180deg, #fff, #fbfcff); }
.customer-price-section { position: relative; margin-bottom: 1.25rem; }
.customer-price-label-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .55rem; }
.customer-price-label {
  display: flex; align-items: center; gap: .5rem; margin: 0 0 .55rem;
  color: #334155; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .035em;
}
.customer-price-label-row .customer-price-label { margin: 0; }
.customer-price-label > span {
  width: 22px; height: 22px; display: inline-grid; place-items: center;
  border-radius: 7px; color: #4f46e5; background: #eef2ff; font-size: .68rem;
}
.customer-price-search,
.customer-price-input {
  width: 100%; box-sizing: border-box; border: 1px solid #dbe3ef; border-radius: 14px;
  background: #fff; color: #0f172a; font: inherit; font-size: .92rem; font-weight: 650;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.customer-price-search { min-height: 48px; padding: .75rem 1rem .75rem 2.75rem; background-image: none; }
.customer-price-section:has(.customer-price-search)::after {
  content: '\f002'; position: absolute; left: 1rem; top: 2.8rem; color: #94a3b8;
  font-family: 'Font Awesome 5 Free'; font-weight: 900; pointer-events: none;
}
.customer-price-search:focus,
.customer-price-input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(99,102,241,.12); background: #fff; }
.customer-price-selected { margin-top: .65rem; }
.customer-price-selected-empty {
  min-height: 68px; display: flex; align-items: center; justify-content: center; gap: .6rem;
  border: 1px dashed #cbd5e1; border-radius: 15px; color: #94a3b8; background: #f8fafc; font-size: .82rem; font-weight: 700;
}
.customer-price-selected-card {
  display: flex; align-items: center; gap: .8rem; padding: .8rem;
  border: 1px solid #c7d2fe; border-radius: 16px; background: linear-gradient(135deg, #eef2ff, #faf5ff);
}
.customer-price-product-icon {
  width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 13px; color: #4f46e5; background: #fff; box-shadow: 0 5px 14px rgba(79,70,229,.12);
}
.customer-price-product-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.customer-price-product-copy strong { color: #1e293b; font-size: .84rem; line-height: 1.3; overflow-wrap: anywhere; }
.customer-price-product-copy span { color: #64748b; font-size: .7rem; font-weight: 700; }
.customer-price-change,
.customer-price-default-action { border: 0; background: transparent; color: #4f46e5; font-size: .72rem; font-weight: 900; cursor: pointer; }
.customer-price-change { padding: .45rem .55rem; }
.customer-price-default-action { text-align: right; }
.customer-price-results {
  margin-top: .55rem; max-height: 230px; overflow-y: auto;
  border: 1px solid #e2e8f0; border-radius: 15px; background: #fff; box-shadow: 0 12px 30px rgba(15,23,42,.1);
}
.customer-price-result {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .72rem .85rem; border: 0; border-bottom: 1px solid #f1f5f9;
  background: #fff; text-align: left; cursor: pointer; transition: background .12s ease;
}
.customer-price-result:last-child { border-bottom: 0; }
.customer-price-result:hover { background: #f5f7ff; }
.customer-price-result-name { min-width: 0; color: #334155; font-size: .78rem; font-weight: 800; overflow-wrap: anywhere; }
.customer-price-result-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .12rem; }
.customer-price-result-meta small { color: #94a3b8; font-size: .62rem; }
.customer-price-result-meta strong { color: #16a34a; font-size: .75rem; }
.customer-price-no-results { padding: 1.2rem; color: #94a3b8; text-align: center; font-size: .8rem; font-weight: 700; }
.customer-price-money-field { position: relative; }
.customer-price-money-field > span {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: #4f46e5; font-size: 1.1rem; font-weight: 900;
}
.customer-price-money-field .customer-price-input { min-height: 54px; padding: .8rem 1rem .8rem 2.4rem; font-size: 1.1rem; font-weight: 900; }
.customer-price-note { min-height: 82px; padding: .8rem 1rem; resize: vertical; line-height: 1.45; }
.customer-price-actions {
  display: flex; gap: .75rem; padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid #eef2f7; background: #fff;
}
.customer-price-cancel,
.customer-price-save {
  min-height: 48px; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  border-radius: 14px; font-size: .85rem; font-weight: 900; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.customer-price-cancel { border: 1px solid #dbe3ef; color: #475569; background: #fff; }
.customer-price-save { border: 0; color: #fff; background: linear-gradient(135deg, #4f46e5, #6366f1); box-shadow: 0 10px 22px rgba(79,70,229,.24); }
.customer-price-cancel:hover,
.customer-price-save:hover { transform: translateY(-1px); }
.customer-price-save:disabled { opacity: .65; cursor: wait; transform: none; }

@media (max-width: 1023px) {
  .sales-desktop-only { display: none !important; }
  .sales-mobile-only { display: block; }
  .sales-module-page .page-header { margin-bottom: 1.1rem !important; }
  .sales-module-page .page-header h1 { font-size: 1.75rem !important; line-height: 1.15; }
  .sales-module-page .page-header p { font-size: .9rem !important; line-height: 1.4; }
  .sales-module-page > .card { padding: 1rem !important; border-radius: 20px !important; }
  .sales-tab-btn { min-width: 0; padding: .75rem .55rem !important; font-size: .78rem !important; }
  .sales-tab-btn i { margin-right: .35rem !important; }
  .sales-detail-page { padding-bottom: 2rem !important; }
  .sales-detail-header { align-items: stretch !important; }
  .sales-detail-actions { width: 100%; }
  .sales-detail-actions > button { min-height: 48px; flex: 1; justify-content: center; }
  .sales-detail-page .card { border-radius: 18px !important; }
  .sales-detail-page .grid { min-width: 0; }
  .sales-contact-progress-head { align-items: center; }
  .sales-contact-action { width: 100%; min-height: 48px; }
}

@media (max-width: 639px) {
  .customer-price-modal { align-items: end; padding: 0; }
  .customer-price-dialog { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; }
  .customer-price-header { padding: 1.1rem; }
  .customer-price-body { padding: 1.15rem 1rem .25rem; }
  .customer-price-actions { padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .customer-price-cancel,
  .customer-price-save { width: 100%; flex: 0 0 auto; }
  .sales-customer-cards { padding: .6rem; }
  .sales-customer-card { padding: .9rem; border-radius: 16px; }
  .sales-detail-page h1 { font-size: 1.35rem !important; overflow-wrap: anywhere; }
  .sales-detail-actions { flex-direction: column !important; }
  .sales-order-btn-detail { width: 100%; }
  .sales-contact-progress-head { flex-direction: column; align-items: flex-start; }
}
