/* ===== Variables ===== */
:root {
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --color-primary: #1a4d7c;
  --color-primary-dark: #0f3558;
  --color-accent: #0d9488;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-success: #059669;
  --color-bg: #eef2f7;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(15, 53, 88, 0.08);
  --shadow-md: 0 4px 16px rgba(15, 53, 88, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ERP shell — mirrors ERP.WebSite wwwroot/css/sitecss/shared/_layout.css */
.Hidden {
  display: none !important;
}

.Visible {
  display: block !important;
}

/* ===== Base ===== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
}

/* ===== App Shell ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform 0.25s ease;
}

.app-sidebar .brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-sidebar .brand-logo {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.app-sidebar .brand-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.app-sidebar .brand-subtitle {
  font-size: 0.7rem;
  opacity: 0.75;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav .nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0.65;
  padding: 1rem 0.75rem 0.35rem;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-section-label:first-child {
  border-top: none;
  padding-top: 0.35rem;
}

/* ===== Sidebar tree (collapsible sections) ===== */
.sidebar-nav-tree {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav-tree .nav-tree-root {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav-tree .nav-link--root {
  font-weight: 600;
}

.nav-tree-group {
  border-radius: var(--radius-sm);
  margin-bottom: 0.1rem;
}

.nav-tree-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-tree-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-tree-group.has-active > .nav-tree-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-tree-chevron-wrap {
  width: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-tree-chevron {
  font-size: 0.72rem;
  transition: transform 0.22s ease;
  opacity: 0.85;
}

.nav-tree-group.is-open .nav-tree-chevron {
  transform: rotate(0deg);
}

.nav-tree-group:not(.is-open) .nav-tree-chevron {
  transform: rotate(90deg);
}

.nav-tree-section-icon {
  font-size: 1rem;
  width: 1.15rem;
  text-align: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-tree-title {
  flex: 1;
  text-align: right;
}

.nav-tree-section-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e55353;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.nav-tree-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.26s ease;
}

.nav-tree-group.is-open .nav-tree-panel {
  grid-template-rows: 1fr;
}

.nav-tree-children {
  overflow: hidden;
  margin: 0;
  padding: 0.1rem 0 0.35rem;
  position: relative;
}

.nav-tree-children::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  bottom: 0.5rem;
  right: 1.15rem;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.nav-tree-children .nav-item {
  position: relative;
}

.nav-tree-children .nav-link {
  position: relative;
  margin-right: 0.35rem;
  margin-left: 0.15rem;
  padding: 0.5rem 0.7rem 0.5rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.nav-tree-children .nav-link::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 1.15rem;
  width: 0.55rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%);
}

.nav-tree-item--nested .nav-link {
  padding-right: 1.35rem;
  font-size: 0.78rem;
  opacity: 0.95;
}

.nav-tree-item--nested .nav-link::before {
  width: 0.85rem;
  right: 1.35rem;
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav .nav-link i {
  font-size: 1.15rem;
  width: 1.35rem;
  text-align: center;
}

.sidebar-nav .nav-link .nav-link-text {
  flex: 1;
}

.sidebar-nav .nav-alert-badge {
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #e55353;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  line-height: 1.5;
  opacity: 0.75;
  text-align: center;
}

.app-footer {
  margin-top: auto;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.auth-footer {
  padding: 1rem 1.25rem 1.25rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.app-main {
  flex: 1;
  margin-right: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
}

.app-topbar .page-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
}

.app-topbar .search-box {
  max-width: 320px;
  flex: 1;
}

.app-topbar .search-box .form-control {
  border-radius: 999px;
  background: var(--color-bg);
  border-color: transparent;
  padding-right: 2.5rem;
}

.global-search-input {
  padding-right: 2.75rem;
}

.global-search-hit {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.global-search-hit:hover {
  background: var(--color-bg);
}

.app-content {
  padding: 1.5rem;
  flex: 1;
}

.sidebar-toggle {
  display: none;
  border: none;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(100%);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-main {
    margin-right: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

/* ===== KPI Cards ===== */
.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition: box-shadow 0.2s, transform 0.2s;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.kpi-icon.production { background: #dbeafe; color: #1d4ed8; }
.kpi-icon.loading { background: #ccfbf1; color: #0d9488; }
.kpi-icon.trucks { background: #ffedd5; color: #ea580c; }
.kpi-icon.delayed { background: #fee2e2; color: #dc2626; }

/* ===== Module Cards ===== */
.module-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  height: 100%;
  box-shadow: var(--shadow-sm);
}

.module-card-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.module-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.module-card-body {
  padding: 0;
}

.module-card .view-all {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.module-card .view-all:hover {
  text-decoration: underline;
}

/* ===== Tables ===== */
.dashboard-table {
  margin: 0;
  font-size: 0.875rem;
}

.dashboard-table thead th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 0.65rem 1rem;
  white-space: nowrap;
}

.dashboard-table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-color: var(--color-border);
}

.dashboard-table tbody tr:hover {
  background: #f8fafc;
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-on-track { background: #d1fae5; color: #047857; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-delayed { background: #fee2e2; color: #b91c1c; }
.status-on-road { background: #dbeafe; color: #1d4ed8; }
.status-loading { background: #e0e7ff; color: #4338ca; }
.status-arrived { background: #d1fae5; color: #047857; }
.status-idle { background: #f1f5f9; color: #475569; }

/* ===== Progress ===== */
.progress-thin {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-thin .progress-bar {
  border-radius: 999px;
  transition: width 0.25s ease;
}

.shipment-progress-wrap {
  margin-top: 0.35rem;
}

.shipment-progress-wrap .shipment-progress-label {
  display: block;
  margin-top: 0.2rem;
}

/* ===== Quick Actions ===== */
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s;
  height: 100%;
  position: relative;
}

.quick-action-alert-badge {
  position: absolute;
  top: 0.45rem;
  inset-inline-start: 0.45rem;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #e55353;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--color-surface);
}

.quick-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action-btn.is-primary {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb, 13, 110, 253), 0.08);
}

.role-shortcuts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.role-shortcut-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: border-color 0.15s, color 0.15s;
}

.role-shortcut-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.role-shortcut-pill.is-primary {
  border-color: var(--color-primary);
  background: rgba(13, 110, 253, 0.06);
  color: var(--color-primary);
}

.role-shortcut-badge {
  position: absolute;
  top: -6px;
  inset-inline-start: -4px;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--color-danger, #dc3545);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-action-btn i {
  font-size: 1.5rem;
  color: var(--color-primary);
}

.quick-action-btn span {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

/* ===== Activity Feed ===== */
.activity-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

.activity-content .activity-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.15rem;
}

.activity-content .activity-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.activity-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* ===== Overview Banner ===== */
.welcome-banner {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-accent) 100%);
  border-radius: var(--radius);
  color: #fff;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.welcome-banner h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.welcome-banner p {
  opacity: 0.9;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.welcome-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.welcome-stat-item {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.welcome-stat-item strong {
  display: block;
  font-size: 1.1rem;
}

/* ===== Truck mini cards ===== */
.truck-mini-card {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.truck-mini-card:last-child {
  border-bottom: none;
}

.truck-plate {
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 0.05em;
}

/* ===== Page Toolbar ===== */
.page-toolbar-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.page-toolbar-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.page-alert {
  border-radius: var(--radius-sm);
}

/* ===== Forms ===== */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
}

.form-card .form-label {
  font-weight: 600;
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.product-code {
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}

.empty-state i {
  font-size: 3rem;
  opacity: 0.35;
  display: block;
  margin-bottom: 1rem;
}

/* ===== Mini Stats ===== */
.mini-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.mini-stat-card .mini-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
}

.mini-stat-card .mini-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.mini-stat-card .mini-stat-sub {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.mini-stat-card.accent-blue .mini-stat-value { color: #1d4ed8; }
.mini-stat-card.accent-teal .mini-stat-value { color: var(--color-accent); }
.mini-stat-card.accent-green .mini-stat-value { color: var(--color-success); }
.mini-stat-card.accent-red .mini-stat-value { color: var(--color-danger); }
.mini-stat-card.accent-orange .mini-stat-value { color: #ea580c; }

.pending-operations-page .mini-stat-card.pending-stat-active {
  border-color: rgba(220, 38, 38, 0.25);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.pending-ops-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.pending-ops-hero--clear {
  border-color: #bbf7d0;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.pending-ops-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.65);
  color: #b45309;
}

.pending-ops-hero--clear .pending-ops-hero-icon {
  color: var(--color-success);
}

.pending-ops-hero-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.pending-ops-hero-text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.pending-operations-page .module-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pending-operations-page .module-card-header {
  background: #f8fafc;
  gap: 0.75rem;
}

.pending-ops-table .pending-cell-summary {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8125rem;
}

.pending-operations-page tr.pending-row-warning {
  background: #fffbeb;
}

.pending-operations-page tr.pending-row-warning:hover {
  background: #fef3c7;
}

@media (max-width: 767.98px) {
  .pending-ops-table .pending-cell-summary {
    max-width: 140px;
  }

  .pending-ops-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===== Warehouse queue — جداول متجاوبة للجوال ===== */
.warehouse-queue-page .warehouse-queue-table .whq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.warehouse-queue-page .btn-group.flex-wrap.mb-4 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.warehouse-queue-page .btn-group.flex-wrap.mb-4 > .btn {
  flex: 1 1 auto;
}

@media (max-width: 767.98px) {
  .warehouse-queue-page .warehouse-queue-table .dashboard-table thead th,
  .warehouse-queue-page .warehouse-queue-table .dashboard-table tbody td {
    padding: 0.5rem 0.4rem;
    font-size: 0.8125rem;
  }

  .warehouse-queue-page .warehouse-queue-table .status-badge {
    font-size: 0.6875rem;
    padding: 0.15rem 0.45rem;
  }

  .warehouse-queue-page .warehouse-queue-table .badge {
    font-size: 0.65rem;
  }

  .warehouse-queue-page .module-card-header h3 {
    font-size: 0.95rem;
  }
}

.operations-dashboard .mini-stat-value,
.operations-dashboard .nums-latin,
.nums-latin {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1;
  direction: ltr;
  unicode-bidi: embed;
}

.operations-dashboard .dashboard-table td.nums-latin,
.operations-dashboard .dashboard-table th.nums-latin {
  text-align: start;
}

/* ===== Truck Cards ===== */
.truck-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition: box-shadow 0.2s;
}

.truck-card:hover {
  box-shadow: var(--shadow-md);
}

/* ===== Auth / Login ===== */
.auth-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f3558 0%, #1a4d7c 40%, #0d9488 100%);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.auth-brand-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #fff;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
}

.auth-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.auth-submit {
  font-weight: 600;
}

.auth-demo-hint {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  border: 1px dashed var(--color-border);
}

.auth-demo-hint code {
  font-size: 0.8rem;
  color: var(--color-primary);
}

/* ===== Permissions ===== */
.permissions-section {
  border-top: 1px solid var(--color-border);
  padding-top: 1.25rem;
}

.permissions-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.permission-group {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--color-border);
}

.permission-group-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.permission-check .form-check-label {
  font-size: 0.85rem;
}

.role-badge {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.perm-tag {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.perm-tag-more {
  background: var(--color-primary);
  color: #fff;
}

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.info-card h5 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ===== Bulk actions ===== */
.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}

.bulk-selection-info {
  min-width: 120px;
}

/* ===== Customer product linking ===== */
.customer-product-panel {
  overflow: hidden;
}

.customer-product-panel .module-card-header {
  background: #f8fafc;
}

.customer-product-count {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
}

.customer-product-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}

.customer-product-search-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 360px;
}

.customer-product-search-wrap .bi-search {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.customer-product-search-wrap .form-control {
  padding-right: 2.25rem;
}

.customer-product-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.customer-product-filter-selected {
  padding-right: 0.5rem;
  border-right: 1px solid var(--color-border);
  margin-right: 0.25rem;
}

.customer-product-scroll {
  max-height: min(420px, 55vh);
  overflow: auto;
}

.customer-product-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--color-border);
}

.customer-product-cb-col {
  width: 44px;
  min-width: 44px;
}

.customer-product-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.customer-product-table tbody tr:hover:not(.is-selected) {
  background: #f8fafc;
}

.customer-product-table tbody tr.is-selected {
  background: #eff6ff;
}

.customer-product-table tbody tr.is-selected:hover {
  background: #dbeafe;
}

.customer-product-table .form-check-input {
  float: none;
  margin: 0;
}

.customer-product-no-results {
  padding: 1rem 1.25rem;
  margin: 0;
  text-align: center;
  border-top: 1px dashed var(--color-border);
}

@media (max-width: 767.98px) {
  .customer-product-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .customer-product-search-wrap {
    max-width: none;
  }

  .customer-product-toolbar-actions {
    justify-content: flex-start;
  }

  .customer-product-filter-selected {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
  }
}

/* ===== Shipment / Route ===== */
.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.route-type-option {
  display: block;
  cursor: pointer;
  margin: 0;
}

.route-type-option input {
  position: absolute;
  opacity: 0;
}

.route-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0.5rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
  height: 100%;
}

.route-type-card i {
  font-size: 1.5rem;
  color: var(--color-primary);
}

.route-type-option input:checked + .route-type-card {
  border-color: var(--color-primary);
  background: #eff6ff;
}

.route-type-badge {
  font-size: 0.75rem;
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.route-timeline {
  position: relative;
  padding-right: 0.5rem;
}

.route-step {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.25rem;
  position: relative;
}

.route-step:not(:last-child)::before {
  content: "";
  position: absolute;
  right: 17px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.route-step.completed:not(:last-child)::before {
  background: var(--color-success);
}

.route-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
  border: 2px solid var(--color-border);
}

.route-step.completed .route-step-icon {
  background: #d1fae5;
  border-color: var(--color-success);
  color: var(--color-success);
}

.route-step.active .route-step-icon {
  background: #ffedd5;
  border-color: #ea580c;
}

/* لا تعرض صندوق التحقق الأحمر إن لم توجد أخطاء */
.alert.alert-danger.validation-summary-valid,
.validation-summary-valid.alert-danger {
  display: none !important;
}

.wadiya-route-progress {
  margin-top: 0.35rem;
}

.wadiya-route-progress-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: flex-start;
}

.wadiya-route-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 4.5rem;
  min-width: 3.5rem;
  max-width: 6.5rem;
  text-align: center;
}

.wadiya-route-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  margin-bottom: 0.2rem;
}

.wadiya-route-step-label {
  font-size: 0.65rem;
  line-height: 1.2;
  color: #64748b;
}

.wadiya-route-step.done .wadiya-route-step-dot {
  background: #d1fae5;
  border-color: var(--color-success);
}

.wadiya-route-step.done .wadiya-route-step-label {
  color: var(--color-success);
  font-weight: 600;
}

.wadiya-route-step.active .wadiya-route-step-dot {
  background: #ffedd5;
  border-color: #ea580c;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

.wadiya-route-step.active .wadiya-route-step-label {
  color: #c2410c;
  font-weight: 700;
}

.tractor-mini {
  background: #f8fafc;
}

/* ===== Order lines grid ===== */
.order-lines-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.order-lines-table thead th {
  background: #f1f5f9;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.order-lines-table td {
  vertical-align: middle;
  padding: 0.35rem;
}

.order-lines-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

#loadingLinesSection .order-lines-table {
  min-width: 72rem;
}

#loadingLinesSection .line-product-search {
  min-width: 100%;
  font-size: 0.95rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

#loadingLinesSection .loading-product-search-cell {
  min-width: 18rem;
}

#loadingLinesSection .line-available-stock {
  min-width: 7rem;
  white-space: nowrap;
}

#loadingLinesSection .line-available-qty {
  display: inline-block;
  font-size: 0.92rem;
}

#loadingLinesSection .line-item-code.line-product-search {
  min-width: 8rem;
}

/* ===== Focus ===== */
.btn:focus,
.btn:active:focus,
.form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(26, 77, 124, 0.25);
}

/* ===== Daily production date tabs ===== */
.production-date-tabs-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem 0;
  box-shadow: var(--shadow-sm);
}

.production-date-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  border-bottom: none;
  gap: 0.25rem;
  scrollbar-width: thin;
}

.production-date-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--color-text-muted);
  padding: 0.55rem 0.85rem;
  margin-bottom: -1px;
  background: #f8fafc;
}

.production-date-tabs .nav-link:hover {
  color: var(--color-primary);
  background: #eef2f7;
}

.production-date-tabs .nav-link.active {
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-surface);
  border-bottom-color: var(--color-surface);
}

.production-date-tabs .tab-date {
  font-size: 0.85rem;
}

.production-date-tabs .badge {
  font-size: 0.65rem;
  font-weight: 600;
}

/* ===== ERP Document Bill (PartialStoreInvoice) ===== */
.app-main:has(.erp-document-page) {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.app-content:has(.erp-document-page) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.app-content:has(.erp-document-page) > :not(.erp-document-page) {
  flex-shrink: 0;
}

.erp-document-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.erp-document-page .erp-doc-toolbar-card,
.erp-document-page .erp-doc-header-card {
  flex-shrink: 0;
  height: auto;
}

.erp-document-page > .module-card {
  height: auto;
}

.erp-document-page .erp-doc-toolbar-card .module-card-body {
  padding: 0.65rem 1rem;
}

.erp-document-page .erp-doc-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.erp-document-page .erp-doc-operations .btn-group {
  flex-wrap: wrap;
  gap: 0.35rem;
}

.erp-document-page .executeBtn.btn-darkgray {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  box-shadow: none;
}

.erp-document-page .executeBtn.btn-darkgray:hover:not(:disabled) {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: var(--color-primary);
}

.erp-document-page .executeBtn.btn-darkgray:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.erp-document-page #btnSave.executeBtn.btn-darkgray:not(:disabled) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.erp-document-page #btnSave.executeBtn.btn-darkgray:hover:not(:disabled) {
  background: #163a5f;
  border-color: #163a5f;
  color: #fff;
}

.erp-document-page #btnDelete.executeBtn.btn-darkgray:not(:disabled) {
  color: var(--color-danger);
}

.erp-document-page .erp-doc-navigator .btn-group {
  gap: 0.25rem;
}

.erp-document-page .erp-doc-navigator .executeBtn.btn-darkgray {
  min-width: 2.25rem;
  padding-inline: 0.5rem;
}

.erp-document-page--loading .erp-doc-header-card .module-card-body {
  padding: 0.5rem 0.85rem 0.4rem;
  background-color: #e8f4fa;
}

.erp-document-page--loading .erp-doc-header-card .form-group {
  margin-bottom: 0.35rem;
}

.erp-document-page--loading .erp-doc-header-card .form-control,
.erp-document-page--loading .erp-doc-header-card .form-select {
  min-height: 30px;
  padding: 0.25rem 0.5rem;
  font-size: 13px;
}

.erp-document-page--loading .erp-doc-header-card .control-label {
  font-size: 13px;
  padding-top: 0.35rem;
}

.erp-document-page--loading .loading-route-hint {
  font-size: 11px;
  color: #64748b;
  margin: 0.15rem 0 0;
  line-height: 1.35;
}

.erp-document-page--loading .loading-route-links {
  font-size: 11px;
  margin-top: 0.15rem;
}

.erp-document-page--loading .erp-doc-tabs {
  padding: 0.3rem 0.75rem 0;
}

.erp-document-page--loading .erp-doc-tabs .nav-link {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.erp-document-page .erp-doc-header-card .module-card-header {
  padding: 0;
  border-bottom: none;
}

.erp-document-page .erp-doc-tabs {
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1rem 0;
  gap: 0.25rem;
}

.erp-document-page .erp-doc-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.erp-document-page .erp-doc-tabs .nav-link:hover {
  border-color: var(--color-border);
  color: var(--color-primary);
}

.erp-document-page .erp-doc-tabs .nav-link.active {
  background: var(--color-surface);
  border-color: var(--color-border);
  border-bottom-color: var(--color-surface);
  color: var(--color-primary);
  margin-bottom: -1px;
}

.erp-document-page .erp-doc-header-card .module-card-body {
  padding: 1rem 1.25rem 0.5rem;
}

.erp-document-page .erp-doc-header-card .form-group {
  margin-bottom: 0.85rem;
}

.erp-document-page .erp-doc-header-card .control-label {
  font-weight: 600;
  color: var(--color-text-muted);
}

.erp-document-page .erp-doc-grid-card .module-card-header {
  flex-shrink: 0;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

.erp-document-page .erp-doc-grid-card .module-card-header h3 {
  font-size: 0.95rem;
}

.erp-document-page .erp-doc-grid-card .module-card-body {
  padding: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.erp-document-page .erp-doc-grid-card.module-card {
  flex: 1 1 auto;
  min-height: 12rem;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.erp-document-page .erp-doc-grid-card .erp-doc-grid-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.erp-document-page .DataGridParent.dxDataGrid {
  min-height: 0;
}

.erp-document-page td[role=columnheader] {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e293b;
}
