/* ============================================================
   DigiTS WMS — Light Mode Design System
   ============================================================ */
:root {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;

  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --primary-l: #eff6ff;
  --primary-t: rgba(37,99,235,0.1);

  --green:     #16a34a;
  --green-l:   #f0fdf4;
  --yellow:    #d97706;
  --yellow-l:  #fffbeb;
  --red:       #dc2626;
  --red-l:     #fef2f2;
  --cyan:      #0891b2;
  --cyan-l:    #ecfeff;
  --purple:    #7c3aed;
  --orange:    #ea580c;

  --text:      #0f172a;
  --text-2:    #334155;
  --muted:     #64748b;
  --muted-l:   #94a3b8;

  --sidebar-w: 240px;
  --header-h:  56px;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200; overflow: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; height: var(--header-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; color: var(--text); }
.sidebar-logo .logo-sub  { font-size: 10px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }

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

.nav-section {
  padding: 12px 20px 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted-l);
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px; color: var(--text-2); text-decoration: none;
  font-size: 13px; border-left: 3px solid transparent;
  transition: all 0.15s; white-space: nowrap;
}
.nav-link:hover { background: var(--surface2); color: var(--primary); }
.nav-link.active { background: var(--primary-l); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.nav-link .nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── TOP HEADER ──────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-w);
  right: 0; height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px; z-index: 100;
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-t); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
}
.page-content { padding: 28px 32px; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.page-header-row {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-card .stat-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.green   { border-left: 4px solid var(--green); }
.stat-card.yellow  { border-left: 4px solid var(--yellow); }
.stat-card.red     { border-left: 4px solid var(--red); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 6px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: 1px solid transparent;
  text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-h); border-color: var(--primary-h); }
.btn-outline  { background: transparent; color: var(--text-2); border-color: var(--border2); }
.btn-outline:hover  { background: var(--surface2); border-color: var(--primary); color: var(--primary); }
.btn-danger   { background: var(--red); color: #fff; border-color: var(--red); }
.btn-success  { background: var(--green); color: #fff; border-color: var(--green); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 15px; }
.btn-icon { padding: 6px 8px; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border2); border-radius: 6px;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus  { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-t); }
.form-control::placeholder { color: var(--muted-l); }
.form-control.error  { border-color: var(--red); }
.form-text   { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.table th {
  background: var(--surface2); color: var(--text-2);
  padding: 10px 14px; text-align: left; font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.table tbody tr:hover td { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── BADGES / TAGS ───────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-blue   { background: var(--primary-l); color: var(--primary); }
.badge-green  { background: var(--green-l);   color: var(--green); }
.badge-yellow { background: var(--yellow-l);  color: var(--yellow); }
.badge-red    { background: var(--red-l);     color: var(--red); }
.badge-gray   { background: var(--surface2);  color: var(--muted); border: 1px solid var(--border); }
.badge-cyan   { background: var(--cyan-l);    color: var(--cyan); }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: var(--red-l);    color: var(--red);    border: 1px solid #fecaca; }
.alert-success { background: var(--green-l);  color: var(--green);  border: 1px solid #bbf7d0; }
.alert-info    { background: var(--primary-l);color: var(--primary);border: 1px solid #bfdbfe; }
.alert-warning { background: var(--yellow-l); color: var(--yellow); border: 1px solid #fde68a; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--text); color: #fff; padding: 12px 18px;
  border-radius: 8px; font-size: 13px; min-width: 240px;
  box-shadow: var(--shadow-lg); opacity: 0;
  transform: translateY(10px); transition: all 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error   { background: var(--red); }
.toast.toast-success { background: var(--green); }
.toast.toast-info    { background: var(--primary); }
.toast.toast-warning { background: var(--yellow); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: 10px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 540px;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── MISC UTILITIES ──────────────────────────────────────── */
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 12px; }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.w-full { width: 100%; }

/* ── DEVEXTREME FORM COMPACT SPACING ─────────────────────── */
/* Fluent theme default for non-first-row items is padding-top:16px (set by a
   4-:not() selector). Halving it tightens form rows while still leaving
   enough clearance for the floating label (which floats 7.5px above the
   editor border). */
.dx-field-item:not(.dx-field-item-has-group):not(.dx-field-item-has-tabs):not(.dx-first-row):not(.dx-label-v-align) {
  padding-top: 8px !important;
}
/* Also tighten bottom padding so the gap is symmetric. */
.dx-layout-manager .dx-field-item {
  padding-bottom: 4px !important;
}

/* ── DEVEXTREME GRID OVERRIDES ───────────────────────────── */
/* Header text: clip at the cell boundary so it never overlaps filter icons */
.dx-datagrid .dx-header-row .dx-datagrid-text-content {
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  line-height: 1.3;
  word-break: normal;
  overflow-wrap: normal;
}
.dx-datagrid-headers .dx-header-row > td {
  vertical-align: middle;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* Column indicators (sort + filter): always visible, pinned to the right */
.dx-datagrid-headers .dx-column-indicators {
  float: right !important;
  display: flex !important;
  align-items: center !important;
  gap: 2px;
  flex-shrink: 0;
}

/* ── LOADING SPINNER ─────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ── DATAGRID COMPACT ROWS ───────────────────────────────── */
.dx-datagrid { font-size: 13px !important; }
.dx-datagrid .dx-data-row > td { padding-top: 3px !important; padding-bottom: 3px !important; line-height: 1.4; }
.dx-datagrid-headers .dx-header-row > td { padding-top: 5px !important; padding-bottom: 5px !important; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── CUSTOM CONFIRM MODAL ────────────────────────────────── */
.wms-confirm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s ease;
}
.wms-confirm-overlay.show { opacity: 1; }
.wms-confirm-modal {
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 100%; max-width: 420px; margin: 16px;
  transform: translateY(8px); transition: transform 0.18s ease;
  overflow: hidden;
}
.wms-confirm-overlay.show .wms-confirm-modal { transform: translateY(0); }
.wms-confirm-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border);
}
.wms-confirm-header--danger  { background: var(--red-l); }
.wms-confirm-header--warning { background: var(--yellow-l); }
.wms-confirm-header--info    { background: var(--primary-l); }
.wms-confirm-header--success { background: #dcfce7; }
.wms-confirm-icon  { font-size: 20px; line-height: 1; }
.wms-confirm-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
.wms-confirm-close {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted); padding: 0 2px;
  line-height: 1; border-radius: 4px; transition: color .15s;
}
.wms-confirm-close:hover { color: var(--text); }
.wms-confirm-body  { padding: 16px 20px; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.wms-confirm-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 16px; border-top: 1px solid var(--border);
}
.btn-danger   { background: var(--red);    color: #fff; border: none; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: var(--yellow); color: #fff; border: none; }
.btn-warning:hover  { background: #b45309; }
.btn-success  { background: #16a34a;       color: #fff; border: none; }
.btn-success:hover  { background: #15803d; }

