/* ============================================================
   Gas Erp GAS ERP — THEME
   Professional enterprise SaaS design system
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────── */
:root {
  /* Brand Colors */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Semantic Colors */
  --color-success-50: #f0fdf4;
  --color-success-100: #dcfce7;
  --color-success-500: #22c55e;
  --color-success-600: #16a34a;
  --color-success-700: #15803d;

  --color-warning-50: #fffbeb;
  --color-warning-100: #fef3c7;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  --color-warning-700: #b45309;

  --color-danger-50: #fef2f2;
  --color-danger-100: #fee2e2;
  --color-danger-500: #ef4444;
  --color-danger-600: #dc2626;
  --color-danger-700: #b91c1c;

  --color-info-50: #eff6ff;
  --color-info-100: #dbeafe;
  --color-info-500: #3b82f6;
  --color-info-600: #2563eb;

  /* Neutral Grays */
  --color-gray-0: #ffffff;
  --color-gray-25: #fafafa;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  --color-gray-950: #030712;

  /* Cylinder Status Colors */
  --color-status-full: #16a34a;
  --color-status-empty: #d97706;
  --color-status-transit: #2563eb;
  --color-status-delivered: #0891b2;
  --color-status-scrapped: #dc2626;
  --color-status-lost: #9333ea;

  /* UI tokens (light mode) */
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-sidebar-item: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: rgba(59, 130, 246, 0.2);
  --bg-header: #ffffff;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;
  --text-sidebar-header: #64748b;

  /* Spacing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;

  /* Typography */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Dark Mode ─────────────────────────────────────────── */
html.dark {
  --bg-app: #0c1222;
  --bg-surface: #141e30;
  --bg-elevated: #1a2744;
  --bg-muted: #111827;
  --bg-sidebar: #080e1c;
  --bg-sidebar-item: rgba(255, 255, 255, 0.04);
  --bg-sidebar-active: rgba(59, 130, 246, 0.25);
  --bg-header: #141e30;

  --border-color: #1e2d45;
  --border-strong: #2d3f5f;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-sidebar: #64748b;
  --text-sidebar-active: #e2e8f0;
  --text-sidebar-header: #334155;
}

/* ─── Base Reset & Typography ───────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Shell ─────────────────────────────────────────── */
.erp-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* ─── Topbar ─────────────────────────────────────────────── */
.erp-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: left var(--transition-normal);
  box-shadow: var(--shadow-xs);
}

.erp-topbar.sidebar-collapsed {
  left: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
  .erp-topbar {
    left: 0;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 24px;
}

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

/* Global Search */
.global-search {
  position: relative;
  width: 100%;
}

.global-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  cursor: pointer;
  font-family: var(--font-sans);
}

.global-search-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.global-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-muted);
  font-family: var(--font-sans);
}

/* Icon Buttons in Topbar */
.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

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

.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--color-danger-600);
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-header);
}

/* User Avatar Button */
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-avatar-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.user-info {
  display: none;
  flex-direction: column;
  text-align: left;
}

@media (min-width: 1024px) {
  .user-info {
    display: flex;
  }
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  white-space: nowrap;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
}

/* Breadcrumbs */
.erp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}

.erp-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.erp-breadcrumb a:hover {
  color: var(--color-primary-600);
}

.erp-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.breadcrumb-sep {
  color: var(--border-strong);
  flex-shrink: 0;
}

/* Topbar Collapse Toggle */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.erp-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.erp-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

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

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

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  overflow: hidden;
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity var(--transition-normal), width var(--transition-normal);
  white-space: nowrap;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-sidebar-header);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

.erp-sidebar.collapsed .sidebar-brand-text {
  opacity: 0;
  width: 0;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-section-label {
  padding: 12px 10px 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-sidebar-header);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-normal);
  user-select: none;
}

.erp-sidebar.collapsed .sidebar-section-label {
  opacity: 0;
}

/* Sidebar Item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-sidebar-item);
  color: #cbd5e1;
}

.sidebar-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 500;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--color-primary-400);
  border-radius: 0 2px 2px 0;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  transition: color var(--transition-fast);
}

.sidebar-item:hover .sidebar-icon {
  color: #93c5fd;
}

.sidebar-item.active .sidebar-icon {
  color: #93c5fd;
}

.sidebar-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-normal), width var(--transition-normal);
}

.erp-sidebar.collapsed .sidebar-item-text {
  opacity: 0;
  width: 0;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--color-primary-600);
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  transition: opacity var(--transition-normal);
}

.erp-sidebar.collapsed .sidebar-badge {
  opacity: 0;
}

.sidebar-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-sidebar-header);
  flex-shrink: 0;
  transition: transform var(--transition-fast), opacity var(--transition-normal);
}

.sidebar-item[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(180deg);
}

.erp-sidebar.collapsed .sidebar-chevron {
  opacity: 0;
}

/* Sidebar Sub-menu */
.sidebar-submenu {
  overflow: hidden;
  transition: max-height var(--transition-normal);
  max-height: 0;
  padding-left: 4px;
}

.sidebar-submenu.open {
  max-height: 500px;
}

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 28px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 12.5px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 1px;
  position: relative;
}

.sidebar-subitem::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-sidebar-header);
  transform: translateY(-50%);
  transition: background var(--transition-fast);
}

.sidebar-subitem:hover {
  background: var(--bg-sidebar-item);
  color: #cbd5e1;
}

.sidebar-subitem:hover::before {
  background: #60a5fa;
}

.sidebar-subitem.active {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-weight: 500;
}

.sidebar-subitem.active::before {
  background: #60a5fa;
}

.erp-sidebar.collapsed .sidebar-submenu {
  display: none;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  overflow: hidden;
  text-decoration: none;
}

.sidebar-user:hover {
  background: var(--bg-sidebar-item);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--transition-normal), width var(--transition-normal);
  min-width: 0;
}

.erp-sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  truncate;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--text-sidebar-header);
  line-height: 1.2;
  margin-top: 1px;
}

/* ─── Main Content ─────────────────────────────────────────── */
.erp-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.erp-main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
  .erp-main {
    margin-left: 0;
  }
}

.erp-content {
  padding: 24px;
  max-width: 1600px;
}

@media (max-width: 640px) {
  .erp-content {
    padding: 16px;
  }
}

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

@media (max-width: 768px) {
  .sidebar-overlay.show {
    display: block;
  }
}

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title-block {}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-primary {
  background: var(--color-primary-600);
  color: white;
  border-color: var(--color-primary-600);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-700);
  border-color: var(--color-primary-700);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-muted);
  border-color: var(--color-gray-400);
}

.btn-danger {
  background: var(--color-danger-600);
  color: white;
  border-color: var(--color-danger-600);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-700);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

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

.btn-success {
  background: var(--color-success-600);
  color: white;
  border-color: var(--color-success-600);
}

.btn-success:hover:not(:disabled) {
  background: var(--color-success-700);
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

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

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-muted);
}

/* ─── KPI Cards ─────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  border-color: var(--color-primary-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-blue {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

.kpi-icon-green {
  background: var(--color-success-50);
  color: var(--color-success-600);
}

.kpi-icon-amber {
  background: var(--color-warning-50);
  color: var(--color-warning-600);
}

.kpi-icon-red {
  background: var(--color-danger-50);
  color: var(--color-danger-600);
}

.kpi-icon-purple {
  background: #f5f3ff;
  color: #7c3aed;
}

.kpi-icon-cyan {
  background: #ecfeff;
  color: #0891b2;
}

.kpi-icon-slate {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.kpi-trend.up {
  color: var(--color-success-600);
}

.kpi-trend.down {
  color: var(--color-danger-600);
}

/* ─── Status Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-blue {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  border: 1px solid var(--color-primary-200);
}

.badge-green {
  background: var(--color-success-50);
  color: var(--color-success-700);
  border: 1px solid var(--color-success-100);
}

.badge-amber {
  background: var(--color-warning-50);
  color: var(--color-warning-700);
  border: 1px solid var(--color-warning-100);
}

.badge-red {
  background: var(--color-danger-50);
  color: var(--color-danger-700);
  border: 1px solid var(--color-danger-100);
}

.badge-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.badge-cyan {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #cffafe;
}

.badge-gray {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
  border: 1px solid var(--color-gray-200);
}

.badge-slate {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Cylinder status badges */
.status-full {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-empty {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-transit {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-delivered {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #cffafe;
}

.status-scrapped {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-lost {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

/* Order status badges */
.status-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-scheduled {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.status-outfordelivery {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.status-completed {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #bbf7d0;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-assigned {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-intransit {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ─── Data Table ─────────────────────────────────────────── */
.data-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.data-table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.data-table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table-scroll {
  overflow-x: auto;
}

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

.data-table thead {
  background: var(--bg-muted);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.data-table th a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.data-table th a:hover {
  color: var(--text-primary);
}

.data-table th.sorted-asc a::after {
  content: ' ↑';
}

.data-table th.sorted-desc a::after {
  content: ' ↓';
}

.data-table td,
.data-table tbody th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  font-weight: normal;
  text-align: left;
}

.data-table tbody th a {
  color: var(--color-primary-600);
  font-weight: 600;
  text-decoration: none;
}

.data-table tbody th a:hover {
  text-decoration: underline;
}

.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-muted);
}

.data-table tbody tr.selected {
  background: var(--color-primary-50);
}

/* Checkbox column */
.col-check {
  width: 40px;
}

.col-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-primary-600);
  cursor: pointer;
}

/* Action column */
.col-actions {
  width: 100px;
  text-align: right;
}

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.row-action-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.row-action-btn.danger:hover {
  background: var(--color-danger-50);
  color: var(--color-danger-600);
}

/* Table Empty State */
.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.table-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.table-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.table-empty-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-width: 300px;
}

/* Table Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.page-btn.active {
  background: var(--color-primary-600);
  color: white;
  border-color: var(--color-primary-600);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Forms ─────────────────────────────────────────────── */
.form-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-muted);
}

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-section-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 640px) {

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

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

.form-field.span-2 {
  grid-column: span 2;
}

.form-field.span-3 {
  grid-column: span 3;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input.error {
  border-color: var(--color-danger-400);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-help {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-error {
  font-size: 11.5px;
  color: var(--color-danger-600);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Filter Panel ─────────────────────────────────────── */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ─── Bulk Actions Bar ─────────────────────────────────── */
.bulk-actions-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--color-primary-50);
  border: 1px solid var(--color-primary-200);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.bulk-actions-bar.show {
  display: flex;
}

.bulk-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary-700);
}

/* ─── Skeleton Loaders ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
      var(--color-gray-200) 25%,
      var(--color-gray-100) 50%,
      var(--color-gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ─── Toast Notifications ─────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 420px;
  pointer-events: all;
  animation: toast-slide-in 0.3s ease;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-success {
  border-left: 3px solid var(--color-success-500);
}

.toast.toast-error {
  border-left: 3px solid var(--color-danger-500);
}

.toast.toast-warning {
  border-left: 3px solid var(--color-warning-500);
}

.toast.toast-info {
  border-left: 3px solid var(--color-primary-500);
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.toast-body {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Command Palette ─────────────────────────────────── */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(4px);
}

.command-palette-overlay.show {
  display: flex;
}

.command-palette {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  animation: palette-in 0.15s ease;
}

@keyframes palette-in {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.command-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.command-palette-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  outline: none;
}

.command-palette-input::placeholder {
  color: var(--text-muted);
}

.command-palette-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
  color: var(--text-primary);
}

.command-item:hover,
.command-item.focused {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}

.command-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.command-item:hover .command-item-icon,
.command-item.focused .command-item-icon {
  background: var(--color-primary-100);
  color: var(--color-primary-600);
}

.command-item-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.command-item-description {
  font-size: 11px;
  color: var(--text-muted);
}

.command-item-kbd {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── Dropdown Menus ─────────────────────────────────── */
.dropdown-wrapper {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 6px;
  display: none;
  animation: dropdown-in 0.12s ease;
}

.dropdown-menu.show {
  display: block;
}

@keyframes dropdown-in {
  from {
    transform: translateY(-4px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}

.dropdown-item:hover {
  background: var(--bg-muted);
}

.dropdown-item.danger:hover {
  background: var(--color-danger-50);
  color: var(--color-danger-600);
}

.dropdown-sep {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ─── Timeline ─────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 24px;
}

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

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

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-dot.active {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
}

.timeline-dot.success {
  background: var(--color-success-600);
  border-color: var(--color-success-600);
}

.timeline-dot.warning {
  background: var(--color-warning-600);
  border-color: var(--color-warning-600);
}

.timeline-dot.danger {
  background: var(--color-danger-600);
  border-color: var(--color-danger-600);
}

/* ─── Messages ─────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-success {
  background: var(--color-success-50);
  border: 1px solid var(--color-success-100);
  color: var(--color-success-700);
}

.alert-error {
  background: var(--color-danger-50);
  border: 1px solid var(--color-danger-100);
  color: var(--color-danger-700);
}

.alert-warning {
  background: var(--color-warning-50);
  border: 1px solid var(--color-warning-100);
  color: var(--color-warning-700);
}

.alert-info {
  background: var(--color-info-50);
  border: 1px solid var(--color-info-100);
  color: var(--color-info-600);
}

/* ─── Chart Cards ─────────────────────────────────────── */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

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

.chart-card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-card-body {
  padding: 16px 20px;
}

/* ─── Responsive Utilities ─────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  .show-mobile-only {
    display: none !important;
  }
}

/* ─── Overrides for Django Admin Internals ──────────────── */
/* These remove Django's old styling while keeping the data flowing */

.module,
#content,
#changelist {
  all: unset;
  display: block;
}

.vTextField,
.vDateField,
.vTimeField,
.vUUIDField,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--color-primary-600);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="url"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus,
.vTextField:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Object tools (top-right Add button on list pages) */
.object-tools {
  margin: 0;
  padding: 0;
  list-style: none;
}

.object-tools li {
  display: inline-flex;
}

.object-tools li a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--color-primary-600);
  color: white;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast);
  border: none;
}

.object-tools li a:hover {
  background: var(--color-primary-700);
}

/* Error list */
.errorlist {
  list-style: none;
  margin: 0 0 8px;
  padding: 10px 14px;
  background: var(--color-danger-50);
  border: 1px solid var(--color-danger-200);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--color-danger-700);
}

.errorlist li::before {
  content: '⚠ ';
}

/* Message list */
.messagelist {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messagelist li {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
}

.messagelist li.success {
  background: var(--color-success-50);
  border-color: var(--color-success-100);
  color: var(--color-success-700);
}

.messagelist li.error {
  background: var(--color-danger-50);
  border-color: var(--color-danger-100);
  color: var(--color-danger-700);
}

.messagelist li.warning {
  background: var(--color-warning-50);
  border-color: var(--color-warning-100);
  color: var(--color-warning-700);
}

.messagelist li.info {
  background: var(--color-info-50);
  border-color: var(--color-info-100);
  color: var(--color-info-600);
}

/* Action select */
select[name="action"] {
  height: 34px;
  padding: 0 8px;
  font-size: 12.5px;
  width: auto;
}

/* Inline forms */
.tabular.inline-group {
  margin: 0;
}

/* Add row link */
.add-row td a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px dashed var(--color-primary-400);
  color: var(--color-primary-600);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.add-row td a:hover {
  background: var(--color-primary-50);
  border-style: solid;
}

/* Calendar widget */
.calendarbox,
.clockbox {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  font-size: 13px !important;
  color: var(--text-primary) !important;
}

.calendarbox h2,
.clockbox h2 {
  background: var(--color-primary-600) !important;
  color: white !important;
  padding: 10px !important;
  font-size: 13px !important;
}

/* tom-select overrides */
.ts-control {
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  background: var(--bg-surface) !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

.ts-control:focus-within {
  border-color: var(--color-primary-400) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.ts-dropdown {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  font-size: 13px !important;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: var(--color-primary-50) !important;
  color: var(--color-primary-700) !important;
}

/* DRP (Date Range Picker) */
.drp-tag.active {
  background: var(--color-primary-600) !important;
  border-color: var(--color-primary-600) !important;
  color: white !important;
}

.drp-btn.primary {
  background: var(--color-primary-600) !important;
  border-color: var(--color-primary-600) !important;
  color: white !important;
}

/* Print QR page */
@media print {

  .erp-sidebar,
  .erp-topbar {
    display: none !important;
  }

  .erp-main {
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ================================================================
   COMPREHENSIVE DARK MODE OVERRIDES
   Fixes all hardcoded white/light elements that don't respond to
   the html.dark CSS variable tokens defined above.
   ================================================================ */

/* ── Form inputs & selects ─────────────────────────────────── */
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="date"],
html.dark input[type="datetime-local"],
html.dark input[type="time"],
html.dark input[type="url"],
html.dark input[type="search"],
html.dark input[type="tel"],
html.dark input[type="file"],
html.dark textarea,
html.dark select,
html.dark .vTextField,
html.dark .vDateField,
html.dark .vTimeField,
html.dark .vUUIDField,
html.dark .vLargeTextField {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: var(--text-muted) !important;
}

/* ── Tom Select widget ─────────────────────────────────────── */
html.dark .ts-control {
  background: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

html.dark .ts-dropdown {
  background: var(--bg-elevated) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.dark .ts-dropdown .option:hover,
html.dark .ts-dropdown .option.active {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--color-primary-300) !important;
}

html.dark .ts-wrapper.multi .ts-control > div {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: var(--color-primary-300) !important;
}

/* ── Calendar & Clock picker ───────────────────────────────── */
html.dark .calendarbox,
html.dark .clockbox {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.dark .calendar table,
html.dark .calendar {
  background-color: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
}

html.dark .calendar caption,
html.dark .calendarbox h2,
html.dark .clockbox h2 {
  background-color: var(--bg-muted) !important;
  color: var(--text-primary) !important;
}

html.dark .calendar th {
  background-color: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

html.dark .calendar td {
  border-color: var(--border-color) !important;
}

html.dark .calendar td a,
html.dark .timelist a {
  color: var(--text-secondary) !important;
}

html.dark .calendar td a:hover,
html.dark .timelist a:hover {
  background-color: rgba(59, 130, 246, 0.2) !important;
  color: var(--color-primary-300) !important;
}

html.dark .calendar td.selected a {
  background-color: var(--color-primary-600) !important;
  color: white !important;
}

html.dark .calendar td.today a {
  color: var(--color-primary-400) !important;
}

html.dark .calendar-shortcuts {
  background-color: var(--bg-muted) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
}

html.dark .calendar-cancel {
  background-color: var(--bg-muted) !important;
  border-color: var(--border-color) !important;
}

html.dark .calendar-cancel a {
  color: var(--color-danger-400) !important;
}

/* ── Status Badges dark mode ───────────────────────────────── */
html.dark .status-full {
  background: rgba(22, 163, 74, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(22, 163, 74, 0.3) !important;
}

html.dark .status-empty {
  background: rgba(180, 83, 9, 0.15) !important;
  color: #fcd34d !important;
  border-color: rgba(180, 83, 9, 0.3) !important;
}

html.dark .status-transit,
html.dark .status-intransit {
  background: rgba(29, 78, 216, 0.15) !important;
  color: #93c5fd !important;
  border-color: rgba(29, 78, 216, 0.3) !important;
}

html.dark .status-delivered {
  background: rgba(8, 145, 178, 0.15) !important;
  color: #67e8f9 !important;
  border-color: rgba(8, 145, 178, 0.3) !important;
}

html.dark .status-scrapped,
html.dark .status-cancelled {
  background: rgba(185, 28, 28, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(185, 28, 28, 0.3) !important;
}

html.dark .status-lost {
  background: rgba(109, 40, 217, 0.15) !important;
  color: #c4b5fd !important;
  border-color: rgba(109, 40, 217, 0.3) !important;
}

html.dark .status-pending {
  background: rgba(146, 64, 14, 0.15) !important;
  color: #fde68a !important;
  border-color: rgba(146, 64, 14, 0.3) !important;
}

html.dark .status-scheduled {
  background: rgba(30, 64, 175, 0.15) !important;
  color: #93c5fd !important;
  border-color: rgba(30, 64, 175, 0.3) !important;
}

html.dark .status-outfordelivery {
  background: rgba(3, 105, 161, 0.15) !important;
  color: #7dd3fc !important;
  border-color: rgba(3, 105, 161, 0.3) !important;
}

html.dark .status-completed,
html.dark .status-assigned {
  background: rgba(20, 83, 45, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(20, 83, 45, 0.3) !important;
}

/* ── Badge colors dark mode ────────────────────────────────── */
html.dark .badge-blue {
  background: rgba(37, 99, 235, 0.15) !important;
  color: #93c5fd !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}

html.dark .badge-green {
  background: rgba(22, 163, 74, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(22, 163, 74, 0.25) !important;
}

html.dark .badge-amber {
  background: rgba(217, 119, 6, 0.15) !important;
  color: #fcd34d !important;
  border-color: rgba(217, 119, 6, 0.25) !important;
}

html.dark .badge-red {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
}

html.dark .badge-purple {
  background: rgba(109, 40, 217, 0.15) !important;
  color: #c4b5fd !important;
  border-color: rgba(109, 40, 217, 0.25) !important;
}

html.dark .badge-cyan {
  background: rgba(14, 116, 144, 0.15) !important;
  color: #67e8f9 !important;
  border-color: rgba(14, 116, 144, 0.25) !important;
}

html.dark .badge-gray,
html.dark .badge-slate {
  background: rgba(71, 85, 105, 0.2) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── KPI Icon backgrounds dark mode ────────────────────────── */
html.dark .kpi-icon-blue {
  background: rgba(37, 99, 235, 0.15) !important;
  color: #93c5fd !important;
}

html.dark .kpi-icon-green {
  background: rgba(22, 163, 74, 0.15) !important;
  color: #86efac !important;
}

html.dark .kpi-icon-amber {
  background: rgba(217, 119, 6, 0.15) !important;
  color: #fcd34d !important;
}

html.dark .kpi-icon-red {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #fca5a5 !important;
}

html.dark .kpi-icon-purple {
  background: rgba(124, 58, 237, 0.15) !important;
  color: #c4b5fd !important;
}

html.dark .kpi-icon-cyan {
  background: rgba(8, 145, 178, 0.15) !important;
  color: #67e8f9 !important;
}

/* ── Inline admin table dark mode ──────────────────────────── */
html.dark .inline-group table,
html.dark .inline-group thead,
html.dark .inline-group tbody,
html.dark .tabular.inline-related {
  background-color: var(--bg-surface) !important;
}

html.dark .inline-group thead tr,
html.dark .inline-group .bg-gray-50,
html.dark thead.bg-gray-50 {
  background-color: var(--bg-muted) !important;
}

html.dark .inline-group tbody tr,
html.dark .bg-white {
  background-color: var(--bg-surface) !important;
}

html.dark .inline-group tbody tr:hover {
  background-color: var(--bg-elevated) !important;
}

html.dark .inline-group .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .inline-group .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--border-color) !important;
}

html.dark .inline-group th,
html.dark .text-gray-600 {
  color: var(--text-secondary) !important;
}

html.dark .inline-group td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Tailwind bg utility override in dark mode ─────────────── */
html.dark .bg-white {
  background-color: var(--bg-surface) !important;
}

html.dark .bg-gray-50 {
  background-color: var(--bg-muted) !important;
}

html.dark .bg-gray-100 {
  background-color: var(--bg-elevated) !important;
}

html.dark .bg-slate-50 {
  background-color: var(--bg-muted) !important;
}

html.dark .text-gray-700,
html.dark .text-gray-800,
html.dark .text-gray-900 {
  color: var(--text-primary) !important;
}

html.dark .text-gray-500,
html.dark .text-gray-600 {
  color: var(--text-secondary) !important;
}

html.dark .text-gray-400 {
  color: var(--text-muted) !important;
}

html.dark .border-gray-200,
html.dark .border-gray-100 {
  border-color: var(--border-color) !important;
}

html.dark .border-gray-300 {
  border-color: var(--border-strong) !important;
}

html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--border-color) !important;
}

/* ── DRP (Date Range Picker) dark mode ─────────────────────── */
html.dark .drp-panel {
  background: var(--bg-elevated) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.dark .drp-input {
  background: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

html.dark .drp-tag {
  background: transparent !important;
  border-color: var(--border-strong) !important;
  color: var(--text-secondary) !important;
}

html.dark .drp-tag:hover {
  background: var(--bg-muted) !important;
}

html.dark .drp-btn {
  background: transparent !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

html.dark .drp-btn:hover {
  background: var(--bg-muted) !important;
}

html.dark .drp-row input[type="date"] {
  background: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

/* ── Alert overrides dark mode ─────────────────────────────── */
html.dark .alert-success {
  background: rgba(22, 163, 74, 0.12) !important;
  border-color: rgba(22, 163, 74, 0.25) !important;
  color: #86efac !important;
}

html.dark .alert-error {
  background: rgba(220, 38, 38, 0.12) !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
  color: #fca5a5 !important;
}

html.dark .alert-warning {
  background: rgba(217, 119, 6, 0.12) !important;
  border-color: rgba(217, 119, 6, 0.25) !important;
  color: #fde68a !important;
}

html.dark .alert-info {
  background: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  color: #93c5fd !important;
}

/* ── Messagelist dark mode ─────────────────────────────────── */
html.dark .messagelist li.success {
  background-color: rgba(22, 163, 74, 0.12) !important;
  border-color: rgba(22, 163, 74, 0.25) !important;
  color: #86efac !important;
}

html.dark .messagelist li.error {
  background-color: rgba(220, 38, 38, 0.12) !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
  color: #fca5a5 !important;
}

html.dark .messagelist li.warning {
  background-color: rgba(217, 119, 6, 0.12) !important;
  border-color: rgba(217, 119, 6, 0.25) !important;
  color: #fde68a !important;
}

html.dark .messagelist li.info {
  background-color: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  color: #93c5fd !important;
}

/* ── Errorlist dark mode ───────────────────────────────────── */
html.dark .errorlist {
  background-color: rgba(220, 38, 38, 0.12) !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
  color: #fca5a5 !important;
}

/* ── Dropdown item danger hover dark mode ──────────────────── */
html.dark .dropdown-item.danger:hover {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #fca5a5 !important;
}

/* ── Command palette dark mode ─────────────────────────────── */
html.dark .command-item:hover,
html.dark .command-item.focused {
  background: var(--bg-elevated) !important;
}

html.dark .command-item:hover .command-item-icon,
html.dark .command-item.focused .command-item-icon {
  background: rgba(37, 99, 235, 0.2) !important;
  color: var(--color-primary-400) !important;
}

/* ── Datetimeshortcuts dark mode ───────────────────────────── */
html.dark .datetimeshortcuts a {
  background: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  color: var(--color-primary-400) !important;
}

html.dark .datetimeshortcuts a:hover {
  background: rgba(37, 99, 235, 0.2) !important;
  border-color: var(--color-primary-400) !important;
}

/* ── Table row selected dark mode ──────────────────────────── */
html.dark .data-table tbody tr.selected {
  background: rgba(37, 99, 235, 0.12) !important;
}

html.dark .data-table tbody tr:hover {
  background: var(--bg-elevated) !important;
}

/* ── Changelist result table dark mode override ────────────── */
html.dark #result_list,
html.dark #result_list thead,
html.dark #result_list tbody,
html.dark #result_list tfoot {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
}

html.dark #result_list thead th,
html.dark #result_list thead td {
  background-color: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

html.dark #result_list tbody tr:hover {
  background-color: var(--bg-elevated) !important;
}

html.dark #result_list td,
html.dark #result_list th {
  border-color: var(--border-color) !important;
}

/* ── Module/fieldset dark mode ─────────────────────────────── */
html.dark .module,
html.dark fieldset.module {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

html.dark fieldset.module h2,
html.dark .module h2 {
  background-color: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── Inline table rows dark mode ───────────────────────────── */
html.dark .inline-group table tbody tr {
  background-color: var(--bg-surface) !important;
}

html.dark .inline-group table thead tr {
  background-color: var(--bg-muted) !important;
}

html.dark .inline-group .add-row td {
  background-color: var(--bg-muted) !important;
}

/* ── Submit row / action bar dark mode ─────────────────────── */
html.dark .submit-row,
html.dark .submit-row p {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

/* ── Selector widget dark mode ─────────────────────────────── */
html.dark .selector-available h2,
html.dark .selector-chosen h2 {
  background-color: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

html.dark .selector select {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-primary) !important;
}

/* ── Filter sidebar dark mode ──────────────────────────────── */
html.dark #changelist-filter {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

html.dark #changelist-filter h2,
html.dark #changelist-filter h3 {
  background-color: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

html.dark #changelist-filter ul li a {
  color: var(--text-secondary) !important;
}

html.dark #changelist-filter ul li a:hover,
html.dark #changelist-filter ul li.selected a {
  color: var(--color-primary-400) !important;
}