/* ================================================================
   ERP — Modern Design System
   Premium enterprise UI inspired by Acumatica & Priority Software
   ================================================================ */

/* ========== Google Fonts (loaded in layout <head>) ========== */
/* @import is a fallback — primary load is via <link> in _Layout */

/* ========== Design Tokens ========== */
:root {
  /* — Brand palette — */
  --erp-primary: #3b82f6;
  --erp-primary-hover: #2563eb;
  --erp-primary-light: rgba(59, 130, 246, 0.10);
  --erp-primary-glow: rgba(59, 130, 246, 0.25);
  --erp-accent: #06b6d4;
  --erp-accent-light: rgba(6, 182, 212, 0.10);
  --erp-success: #10b981;
  --erp-success-light: rgba(16, 185, 129, 0.10);
  --erp-warning: #f59e0b;
  --erp-warning-light: rgba(245, 158, 11, 0.10);
  --erp-danger: #ef4444;
  --erp-danger-light: rgba(239, 68, 68, 0.10);
  --erp-info: #8b5cf6;
  --erp-info-light: rgba(139, 92, 246, 0.10);

  /* — Neutrals — */
  --erp-bg: #f1f5f9;
  --erp-bg-card: #ffffff;
  --erp-bg-elevated: #ffffff;
  --erp-border: #e2e8f0;
  --erp-border-light: #f1f5f9;
  --erp-text: #1e293b;
  --erp-text-secondary: #64748b;
  --erp-text-muted: #94a3b8;
  --erp-text-on-dark: #f8fafc;

  /* — Sidebar — */
  --erp-sidebar-bg: #0f172a;
  --erp-sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --erp-sidebar-bg-active: rgba(59, 130, 246, 0.15);
  --erp-sidebar-text: #94a3b8;
  --erp-sidebar-text-active: #f8fafc;
  --erp-sidebar-icon: #64748b;
  --erp-sidebar-icon-active: #3b82f6;
  --erp-sidebar-width: 260px;
  --erp-sidebar-collapsed-width: 72px;
  --erp-sidebar-border: rgba(255, 255, 255, 0.06);

  /* — Header — */
  --erp-header-bg: rgba(255, 255, 255, 0.80);
  --erp-header-blur: 12px;
  --erp-header-height: 60px;
  --erp-header-border: #e2e8f0;

  /* — Shadows — */
  --erp-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --erp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --erp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --erp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --erp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* — Layout — */
  --erp-radius: 0.5rem;
  --erp-radius-lg: 0.75rem;
  --erp-radius-xl: 1rem;
  --erp-radius-full: 9999px;
  --erp-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --erp-transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* — Skeleton — */
  --erp-skeleton-bg: #e2e8f0;
  --erp-skeleton-shimmer: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  --erp-skeleton-shimmer-dark: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);

  /* legacy compat */
  --erp-navbar-bg: var(--erp-sidebar-bg);
  --erp-navbar-hover: var(--erp-sidebar-bg-hover);
  --erp-footer-bg: var(--erp-sidebar-bg);
  --erp-card-shadow: var(--erp-shadow-sm);
  --erp-card-shadow-hover: var(--erp-shadow-lg);
}

/* ========== Dark Mode ========== */
[data-theme="dark"] {
  --erp-bg: #0f172a;
  --erp-bg-card: #1e293b;
  --erp-bg-elevated: #1e293b;
  --erp-border: #334155;
  --erp-border-light: #1e293b;
  --erp-text: #f1f5f9;
  --erp-text-secondary: #94a3b8;
  --erp-text-muted: #64748b;
  --erp-header-bg: rgba(15, 23, 42, 0.85);
  --erp-header-border: #334155;
  --erp-sidebar-bg: #020617;
  --erp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --erp-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
  --erp-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
  --erp-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .erp-table-wrapper,
[data-theme="dark"] .erp-card,
[data-theme="dark"] .erp-form-card,
[data-theme="dark"] .erp-side-nav,
[data-theme="dark"] .card {
  background: var(--erp-bg-card) !important;
  border-color: var(--erp-border) !important;
}

[data-theme="dark"] .table.erp-table thead th {
  background-color: #1e293b;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

[data-theme="dark"] .table.erp-table tbody td {
  color: #e2e8f0;
  border-color: #334155;
}

[data-theme="dark"] .table.erp-table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.06);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .form-label {
  color: #cbd5e1;
}

[data-theme="dark"] .modal-content {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dropdown-item {
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: #f1f5f9;
}

[data-theme="dark"] .badge.bg-secondary {
  background-color: #334155 !important;
}

[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

[data-theme="dark"] .text-muted {
  color: var(--erp-text-muted) !important;
}

[data-theme="dark"] .text-dark {
  color: #e2e8f0 !important;
}

/* — Dark Mode Skeleton — */
[data-theme="dark"] .erp-skeleton {
  background: #1e293b !important;
}
[data-theme="dark"] .erp-skeleton::after {
  background: var(--erp-skeleton-shimmer-dark) !important;
}

/* ========== Animations ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes erp-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== Base ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html { font-size: 14.5px; }
}

@media (min-width: 1200px) {
  html { font-size: 15px; }
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--erp-bg);
  color: var(--erp-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

body.erp-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--erp-bg);
  color: var(--erp-text);
}

::selection {
  background: var(--erp-primary-light);
  color: var(--erp-primary);
}

/* ========== App Shell ========== */
.erp-app-shell {
  display: flex;
  min-height: 100vh;
}

/* ========== Sidebar ========== */
.erp-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--erp-sidebar-width);
  background: var(--erp-sidebar-bg);
  border-right: 1px solid var(--erp-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width var(--erp-transition-slow), transform var(--erp-transition-slow);
  overflow: hidden;
}

.erp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid var(--erp-sidebar-border);
  min-height: var(--erp-header-height);
}

.erp-sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--erp-radius-lg);
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.erp-sidebar-brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--erp-text-on-dark);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--erp-transition);
}

.erp-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

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

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

.erp-sidebar-section {
  margin-bottom: 0.5rem;
}

.erp-sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--erp-sidebar-icon);
  padding: 0.6rem 0.75rem 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--erp-transition);
}

.erp-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--erp-radius);
  color: var(--erp-sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--erp-transition);
  position: relative;
}

.erp-sidebar-link:hover {
  background: var(--erp-sidebar-bg-hover);
  color: var(--erp-sidebar-text-active);
}

.erp-sidebar-link:hover .erp-sidebar-link-icon {
  color: var(--erp-sidebar-icon-active);
}

.erp-sidebar-link.active {
  background: var(--erp-sidebar-bg-active);
  color: var(--erp-sidebar-text-active);
}

.erp-sidebar-link.active .erp-sidebar-link-icon {
  color: var(--erp-sidebar-icon-active);
}

.erp-sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--erp-primary);
  border-radius: 0 2px 2px 0;
}

.erp-sidebar-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--erp-sidebar-icon);
  transition: color var(--erp-transition);
}

.erp-sidebar-link-text {
  overflow: hidden;
  transition: opacity var(--erp-transition);
}

.erp-sidebar-submenu {
  display: none;
  padding-left: 2.5rem;
  margin-top: 0.15rem;
}

.erp-sidebar-submenu.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

.erp-sidebar-submenu .erp-sidebar-link {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  color: var(--erp-sidebar-text);
}

.erp-sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--erp-sidebar-border);
  color: var(--erp-sidebar-icon);
  cursor: pointer;
  transition: all var(--erp-transition);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  font-size: 0.82rem;
}

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

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

.erp-sidebar.collapsed .erp-sidebar-brand-text,
.erp-sidebar.collapsed .erp-sidebar-link-text,
.erp-sidebar.collapsed .erp-sidebar-section-title,
.erp-sidebar.collapsed .erp-sidebar-toggle-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.erp-sidebar.collapsed .erp-sidebar-link {
  justify-content: center;
  padding: 0.55rem;
}

.erp-sidebar.collapsed .erp-sidebar-link.active::before {
  left: 0;
}

.erp-sidebar.collapsed .erp-sidebar-brand {
  justify-content: center;
  padding: 1.1rem 0.5rem;
}

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

.erp-sidebar.collapsed .erp-sidebar-link-icon {
  width: 22px;
  height: 22px;
}

/* ========== Header ========== */
.erp-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--erp-header-height);
  background: var(--erp-header-bg);
  backdrop-filter: blur(var(--erp-header-blur));
  -webkit-backdrop-filter: blur(var(--erp-header-blur));
  border-bottom: 1px solid var(--erp-header-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  transition: margin-left var(--erp-transition-slow);
}

.erp-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.erp-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.4rem;
  border-radius: var(--erp-radius);
  color: var(--erp-text-secondary);
  cursor: pointer;
  transition: all var(--erp-transition);
}

.erp-mobile-toggle:hover {
  background: var(--erp-primary-light);
  color: var(--erp-primary);
}

.erp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--erp-text-muted);
  min-width: 0;
}

.erp-breadcrumb a {
  color: var(--erp-text-secondary);
  text-decoration: none;
  transition: color var(--erp-transition);
}

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

.erp-breadcrumb-sep {
  color: var(--erp-text-muted);
  font-size: 0.75rem;
}

.erp-breadcrumb-current {
  color: var(--erp-text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-header-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.erp-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--erp-radius);
  border: none;
  background: transparent;
  color: var(--erp-text-secondary);
  cursor: pointer;
  transition: all var(--erp-transition);
  position: relative;
}

.erp-header-btn:hover {
  background: var(--erp-primary-light);
  color: var(--erp-primary);
}

.erp-header-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--erp-danger);
  border: 2px solid var(--erp-bg-card);
}

.erp-header-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--erp-radius-full);
  background: var(--erp-bg);
  border: 1px solid var(--erp-border);
  color: var(--erp-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--erp-transition);
  white-space: nowrap;
}

.erp-header-search:hover {
  border-color: var(--erp-primary);
  background: var(--erp-primary-light);
  color: var(--erp-primary);
}

.erp-header-search kbd {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  color: var(--erp-text-muted);
  font-family: inherit;
}

.erp-user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  border-radius: var(--erp-radius-full);
  border: 1px solid var(--erp-border);
  background: var(--erp-bg-card);
  color: var(--erp-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--erp-transition);
}

.erp-user-menu:hover {
  border-color: var(--erp-primary);
  box-shadow: var(--erp-shadow-sm);
}

.erp-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ========== Main Content ========== */
.erp-main {
  margin-left: var(--erp-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--erp-transition-slow);
}

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

.erp-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

/* Legacy wrappers compat */
.erp-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ========== Hero Header (legacy compat — now simplified) ========== */
.erp-hero-header {
  display: none; /* hidden in new layout; page titles are in breadcrumb + page header */
}

.erp-hero-title { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.01em; }
.erp-hero-subtitle { color: rgba(255,255,255,0.82); font-size: 0.92rem; max-width: 52rem; }
.erp-hero-icon { width: 3rem; height: 3rem; align-items: center; justify-content: center; border-radius: 0.75rem; background: rgba(255,255,255,0.18); font-size: 1.4rem; }

/* ========== Page Header ========== */
.erp-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--erp-border);
  animation: fadeIn 0.3s ease;
}

.erp-page-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--erp-text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.erp-page-title i,
.erp-page-title svg {
  color: var(--erp-primary);
  flex-shrink: 0;
}

/* ========== Cards ========== */
.erp-card,
.card {
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-sm);
  transition: box-shadow var(--erp-transition), transform var(--erp-transition), border-color var(--erp-transition);
}

.erp-card:hover {
  box-shadow: var(--erp-shadow-md);
  transform: translateY(-2px) scale(1.005);
}

/* ========== Skeleton Classes ========== */
.erp-skeleton {
  position: relative;
  overflow: hidden;
  background-color: var(--erp-skeleton-bg);
  border-radius: var(--erp-radius);
  min-height: 1em;
}

.erp-skeleton::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: var(--erp-skeleton-shimmer);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  content: '';
}

.erp-skeleton-text { width: 100%; height: 0.8rem; margin-bottom: 0.5rem; }
.erp-skeleton-title { width: 60%; height: 1.25rem; margin-bottom: 1rem; }
.erp-skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.erp-skeleton-button { width: 100px; height: 38px; border-radius: var(--erp-radius); }

/* ========== Loading State Classes ========== */
.erp-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.erp-btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: erp-spin 0.6s linear infinite;
}

.erp-card .card-body,
.erp-card .erp-card-body,
.erp-card-body {
  padding: 1.25rem 1.5rem;
}

.erp-card .card-header,
.erp-card .erp-card-header,
.erp-card-header {
  padding: 1rem 1.5rem;
  background: transparent;
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.erp-card .card-footer,
.erp-card .erp-card-footer,
.erp-card-footer {
  padding: 0.875rem 1.5rem;
  background: transparent;
  border-top: 1px solid var(--erp-border);
}


.erp-card .card-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--erp-text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.erp-card .card-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--erp-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* KPI card accent colors */
.erp-card.border-primary { border-left: 3px solid var(--erp-primary) !important; }
.erp-card.border-success { border-left: 3px solid var(--erp-success) !important; }
.erp-card.border-info    { border-left: 3px solid var(--erp-accent) !important; }
.erp-card.border-warning { border-left: 3px solid var(--erp-warning) !important; }
.erp-card.border-danger  { border-left: 3px solid var(--erp-danger) !important; }
.erp-card.border-secondary { border-left: 3px solid var(--erp-info) !important; }
.erp-card.border-dark    { border-left: 3px solid var(--erp-text) !important; }

.erp-card.border-primary .card-value { color: var(--erp-primary); }
.erp-card.border-success .card-value { color: var(--erp-success); }
.erp-card.border-info .card-value    { color: var(--erp-accent); }
.erp-card.border-warning .card-value { color: var(--erp-warning); }
.erp-card.border-danger .card-value  { color: var(--erp-danger); }
.erp-card.border-secondary .card-value { color: var(--erp-info); }
.erp-card.border-dark .card-value    { color: var(--erp-text); }

.erp-card.border-primary .card-title i { color: var(--erp-primary); }
.erp-card.border-success .card-title i { color: var(--erp-success); }
.erp-card.border-info .card-title i    { color: var(--erp-accent); }
.erp-card.border-warning .card-title i { color: var(--erp-warning); }
.erp-card.border-danger .card-title i  { color: var(--erp-danger); }
.erp-card.border-secondary .card-title i { color: var(--erp-info); }
.erp-card.border-dark .card-title i    { color: var(--erp-text-secondary); }

/* Document cards */
.erp-document-card {
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-sm);
  transition: transform var(--erp-transition), box-shadow var(--erp-transition);
  background: var(--erp-bg-card);
}

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

/* ========== Tables ========== */
.erp-table-wrapper {
  background: var(--erp-bg-card);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-sm);
  overflow: hidden;
  border: 1px solid var(--erp-border);
  animation: fadeIn 0.3s ease 0.1s both;
}

.table.erp-table {
  margin-bottom: 0;
  color: var(--erp-text);
}

.table.erp-table thead th {
  background-color: var(--erp-bg);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--erp-text-muted);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--erp-border);
  white-space: nowrap;
}

.table.erp-table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-color: var(--erp-border-light);
  font-size: 0.9rem;
  transition: background-color var(--erp-transition);
}

.table.erp-table tbody tr {
  transition: background-color var(--erp-transition);
}

.table.erp-table tbody tr:hover {
  background-color: var(--erp-primary-light);
}

.table.erp-table .btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.8125rem;
}

/* ========== Buttons ========== */
.btn {
  border-radius: var(--erp-radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--erp-transition);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-primary {
  background: var(--erp-primary);
  border-color: var(--erp-primary);
  box-shadow: 0 1px 3px var(--erp-primary-glow);
}

.btn-primary:hover {
  background: var(--erp-primary-hover);
  border-color: var(--erp-primary-hover);
  box-shadow: 0 4px 12px var(--erp-primary-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline-primary {
  color: var(--erp-primary);
  border-color: var(--erp-primary);
}

.btn-outline-primary:hover {
  background: var(--erp-primary);
  border-color: var(--erp-primary);
  transform: translateY(-1px);
}

.btn-outline-danger:hover {
  transform: translateY(-1px);
}

.btn-outline-light {
  border-color: var(--erp-border);
  color: var(--erp-text-secondary);
}

.btn-outline-light:hover {
  background: var(--erp-bg);
  border-color: var(--erp-primary);
  color: var(--erp-primary);
}

.btn-group-actions .btn {
  margin-right: 0.25rem;
}

.btn-group-actions .btn:last-child {
  margin-right: 0;
}

/* ========== Forms ========== */
.form-control, .form-select {
  border-radius: var(--erp-radius);
  border: 1px solid var(--erp-border);
  background: var(--erp-bg-card);
  color: var(--erp-text);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  transition: all var(--erp-transition);
}

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

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

.form-label {
  font-weight: 600;
  color: var(--erp-text);
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.erp-form-card {
  background: var(--erp-bg-card);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-md);
  padding: 2rem;
  border: 1px solid var(--erp-border);
  max-width: 42rem;
  animation: scaleIn 0.3s ease;
}

.form-check-input:checked {
  background-color: var(--erp-primary);
  border-color: var(--erp-primary);
}

/* ========== Alerts ========== */
.alert {
  border-radius: var(--erp-radius-lg);
  border: none;
  box-shadow: var(--erp-shadow-xs);
  font-size: 0.9rem;
}

.alert-warning {
  background: linear-gradient(135deg, rgba(245,158,11,0.08) 0%, rgba(245,158,11,0.04) 100%);
  color: #92400e;
  border-left: 3px solid var(--erp-warning);
}

.alert-danger {
  background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, rgba(239,68,68,0.04) 100%);
  color: #991b1b;
  border-left: 3px solid var(--erp-danger);
}

.alert-success {
  background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(16,185,129,0.04) 100%);
  color: #065f46;
  border-left: 3px solid var(--erp-success);
}

.alert-info {
  background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(59,130,246,0.04) 100%);
  color: #1e40af;
  border-left: 3px solid var(--erp-primary);
}

/* ========== Badges ========== */
.badge {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.35em 0.7em;
  border-radius: var(--erp-radius-full);
}

.badge.bg-secondary {
  background-color: var(--erp-bg) !important;
  color: var(--erp-text-secondary) !important;
  border: 1px solid var(--erp-border);
}

.badge.bg-success {
  background-color: var(--erp-success-light) !important;
  color: var(--erp-success) !important;
}

.badge.bg-danger {
  background-color: var(--erp-danger-light) !important;
  color: var(--erp-danger) !important;
}

.badge.bg-warning {
  background-color: var(--erp-warning-light) !important;
  color: #92400e !important;
}

.badge.bg-info {
  background-color: var(--erp-info-light) !important;
  color: var(--erp-info) !important;
}

.badge.bg-primary {
  background-color: var(--erp-primary-light) !important;
  color: var(--erp-primary) !important;
}

/* ========== Footer ========== */
.erp-footer {
  background: var(--erp-sidebar-bg);
  border-top: 1px solid var(--erp-sidebar-border);
  margin-top: auto;
  padding: 0.75rem 1.5rem;
}

.erp-footer span {
  color: var(--erp-sidebar-text);
}

.erp-footer a {
  color: var(--erp-sidebar-text);
  text-decoration: none;
  transition: color var(--erp-transition);
}

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

/* ========== Floating Help Button & Modal ========== */
.erp-help-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1050;
  border-radius: var(--erp-radius-full);
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--erp-shadow-lg);
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-info));
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all var(--erp-transition);
}

.erp-help-fab i, .erp-help-fab svg {
  font-size: 1.3rem;
  width: 20px;
  height: 20px;
}

.erp-help-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--erp-shadow-xl);
}

.erp-help-modal {
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-xl);
  border: 1px solid var(--erp-border);
  overflow: hidden;
}

.erp-help-modal .modal-header {
  background: var(--erp-bg);
  border-bottom: 1px solid var(--erp-border) !important;
  padding: 1rem 1.25rem;
}

.erp-help-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--erp-radius-full);
  background: var(--erp-primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--erp-primary);
}

.erp-help-modal-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--erp-text-secondary);
  padding: 1.25rem;
}

/* ========== Side Nav (legacy compat for sidebar inside content) ========== */
.erp-side-nav {
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-sm);
  padding: 1rem;
  top: 1rem;
  display: none; /* hidden in new sidebar layout */
}

.erp-side-nav-title {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--erp-text-muted);
  margin-bottom: 0.65rem;
  padding: 0 0.35rem;
  font-weight: 600;
}

.erp-side-nav-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--erp-text);
  border-radius: var(--erp-radius);
  padding: 0.48rem 0.55rem;
  margin-bottom: 0.2rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--erp-transition);
}

.erp-side-nav-link:hover {
  color: var(--erp-primary);
  background: var(--erp-primary-light);
}

/* ========== Navbar (legacy compat for admin/landing layouts) ========== */
.erp-navbar {
  background: var(--erp-sidebar-bg) !important;
  padding: 0.5rem 0;
  border: none;
}

.erp-navbar .navbar-brand {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.erp-navbar .nav-link {
  border-radius: var(--erp-radius);
  padding: 0.4rem 0.65rem !important;
  transition: all var(--erp-transition);
  font-size: 0.875rem;
  font-weight: 500;
}

.erp-navbar .nav-link:hover {
  background-color: var(--erp-sidebar-bg-hover);
}

.erp-navbar .dropdown-menu {
  border: 1px solid var(--erp-border);
  box-shadow: var(--erp-shadow-lg);
  border-radius: var(--erp-radius-lg);
  padding: 0.35rem 0;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--erp-bg-card);
}

.erp-navbar .dropdown-item {
  padding: 0.5rem 1rem;
  border-radius: var(--erp-radius);
  margin: 0 0.25rem;
  font-size: 0.875rem;
  color: var(--erp-text);
  transition: all var(--erp-transition);
}

.erp-navbar .dropdown-item:hover {
  background-color: var(--erp-primary-light);
  color: var(--erp-primary);
}

.navbar.navbar-dark .nav-link,
.navbar.navbar-dark .navbar-brand {
  color: rgba(255, 255, 255, 0.95) !important;
}

.navbar.navbar-dark .nav-link:hover,
.navbar.navbar-dark .navbar-brand:hover {
  color: #fff !important;
}

.navbar.navbar-dark .dropdown-toggle::after {
  border-top-color: rgba(255, 255, 255, 0.9);
}

.admin-nav {
  background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%) !important;
}

.admin-nav .navbar-brand { font-weight: 700; }
.admin-nav .nav-link { font-weight: 500; }

@media (min-width: 992px) {
  .navbar .nav-item.dropdown:hover .dropdown-menu {
    display: block;
  }
}

@media (max-width: 991.98px) {
  .navbar .navbar-collapse {
    padding-top: 0.5rem;
    max-height: 85vh;
    overflow-y: auto;
  }
  .navbar .navbar-nav .dropdown-menu {
    position: static !important;
    float: none;
    width: 100%;
    margin: 0.25rem 0;
    box-shadow: none;
    background-color: rgba(0, 0, 0, 0.15) !important;
    border: none;
  }
  .navbar .navbar-nav .dropdown-item {
    padding-left: 1rem;
    color: rgba(255, 255, 255, 0.9);
  }
  .navbar .navbar-nav .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
}

/* ========== Focus & Utilities ========== */
.btn:focus, .btn:active:focus {
  box-shadow: 0 0 0 3px var(--erp-primary-light);
}

.form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--erp-primary-light);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--erp-text-muted);
  text-align: end;
}

.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.text-muted {
  color: var(--erp-text-muted) !important;
}

/* ========== Dropdown Menus (global) ========== */
.dropdown-menu {
  border-radius: var(--erp-radius-lg);
  box-shadow: var(--erp-shadow-lg);
  border: 1px solid var(--erp-border);
  padding: 0.35rem;
  animation: scaleIn 0.15s ease;
}

.dropdown-item {
  border-radius: var(--erp-radius);
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  transition: all var(--erp-transition);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--erp-primary-light);
  color: var(--erp-primary);
}

.dropdown-divider {
  border-color: var(--erp-border);
  margin: 0.25rem 0;
}

/* ========== Modal ========== */
.modal-content {
  border-radius: var(--erp-radius-xl);
  border: 1px solid var(--erp-border);
  box-shadow: var(--erp-shadow-xl);
  overflow: hidden;
}

.modal-header {
  border-bottom-color: var(--erp-border);
}

.modal-footer {
  border-top-color: var(--erp-border);
}

/* ========== Scrollbar Global ========== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--erp-text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--erp-text-secondary);
}

/* ========== Loading Skeleton ========== */
.skeleton {
  background: linear-gradient(90deg, var(--erp-bg) 25%, var(--erp-border) 50%, var(--erp-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--erp-radius);
}

/* ========== Status Pills ========== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--erp-radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill--active   { background: var(--erp-success-light); color: var(--erp-success); }
.status-pill--pending  { background: var(--erp-warning-light); color: #92400e; }
.status-pill--inactive { background: var(--erp-danger-light);  color: var(--erp-danger); }
.status-pill--draft    { background: var(--erp-bg);            color: var(--erp-text-muted); border: 1px solid var(--erp-border); }
.status-pill--info     { background: var(--erp-primary-light); color: var(--erp-primary); }

.status-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ========== Quick Actions Grid ========== */
.erp-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.erp-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border-radius: var(--erp-radius-lg);
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  text-decoration: none;
  color: var(--erp-text);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  transition: all var(--erp-transition);
}

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

.erp-quick-action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--erp-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ========== Premium Mesh Gradients ========== */
.bg-mesh-premium {
  background-color: var(--erp-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(147, 51, 234, 0.4) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.4) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.2) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(236, 72, 153, 0.3) 0px, transparent 50%);
  color: white !important;
  border: none !important;
  position: relative;
  overflow: hidden;
}

.bg-mesh-premium::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.bg-mesh-premium .card-title,
.bg-mesh-premium .card-value,
.bg-mesh-premium .card-title i {
  color: white !important;
  position: relative;
  z-index: 1;
}

.bg-mesh-premium .card-title {
  opacity: 0.9;
}

/* ========== Command Palette ========== */
.erp-command-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.erp-command-palette-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.erp-command-palette {
  width: 100%;
  max-width: 640px;
  background: var(--erp-bg-card);
  border-radius: var(--erp-radius-xl);
  box-shadow: var(--erp-shadow-xl), 0 0 0 1px var(--erp-border);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.erp-command-palette-overlay.show .erp-command-palette {
  transform: scale(1);
}

.erp-command-search-wrapper {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--erp-border);
  gap: 1rem;
}

.erp-command-search-icon {
  width: 22px;
  height: 22px;
  color: var(--erp-text-muted);
}

.erp-command-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--erp-text);
  font-size: 1.1rem;
  font-weight: 500;
  outline: none;
}

.erp-command-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.erp-command-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--erp-radius);
  color: var(--erp-text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.erp-command-item:hover,
.erp-command-item.active {
  background: var(--erp-primary-light);
  color: var(--erp-primary);
}

.erp-command-item-icon {
  width: 20px;
  height: 20px;
  color: var(--erp-text-muted);
}

.erp-command-item.active .erp-command-item-icon,
.erp-command-item:hover .erp-command-item-icon {
  color: var(--erp-primary);
}

.erp-command-item-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.erp-command-item-badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--erp-bg);
  color: var(--erp-text-muted);
  font-weight: 600;
}

.erp-command-footer {
  padding: 0.75rem 1.5rem;
  background: var(--erp-bg);
  border-top: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--erp-text-muted);
  font-size: 0.75rem;
}

.erp-command-kbd {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.erp-command-kbd kbd {
  padding: 0.1rem 0.35rem;
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--erp-text-secondary);
}

/* ========== Responsive ========== */
@media (max-width: 991.98px) {
  .erp-sidebar {
    transform: translateX(-100%);
    z-index: 1060;
  }

  .erp-sidebar.mobile-open {
    transform: translateX(0);
    width: var(--erp-sidebar-width) !important;
  }

  .erp-sidebar.mobile-open .erp-sidebar-brand-text,
  .erp-sidebar.mobile-open .erp-sidebar-link-text,
  .erp-sidebar.mobile-open .erp-sidebar-section-title,
  .erp-sidebar.mobile-open .erp-sidebar-toggle-label {
    opacity: 1 !important;
    width: auto !important;
  }

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

  .erp-sidebar-overlay.show {
    display: block;
    animation: fadeIn 0.2s ease;
  }

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

  .erp-mobile-toggle {
    display: flex;
  }

  .erp-content {
    padding: 1rem;
  }

  .erp-header {
    padding: 0 1rem;
  }

  .erp-header-search {
    display: none;
  }

  .erp-page-title {
    font-size: 1.15rem;
  }

  .erp-side-nav {
    display: none !important;
  }
}

@media (max-width: 575.98px) {
  .erp-content {
    padding: 0.75rem;
  }

  .erp-page-header {
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .erp-card .card-body {
    padding: 1rem;
  }

  .erp-card .card-value {
    font-size: 1.5rem;
  }

  .erp-form-card {
    padding: 1.25rem;
  }

  .table.erp-table thead th {
    padding: 0.65rem 0.6rem;
    font-size: 0.7rem;
  }

  .table.erp-table tbody td {
    padding: 0.6rem;
    font-size: 0.82rem;
  }
}

/* Tablet landscape */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .erp-sidebar:not(.collapsed) {
    width: 220px;
  }
  .erp-sidebar:not(.collapsed) ~ .erp-main {
    margin-left: 220px;
  }
}

/* ========== Print ========== */
@media print {
  .erp-sidebar,
  .erp-header,
  .erp-help-fab,
  .erp-sidebar-overlay,
  .erp-footer,
  .btn-group-actions,
  .erp-quick-actions {
    display: none !important;
  }

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

  .erp-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* ========== Lucide Icon Sizing (inline SVG) ========== */
.lucide {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  stroke-width: 2;
}

/* ========== Collapsible Sidebar Groups ========== */
.erp-group-section { padding: 0; }

.erp-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.45rem 1.1rem 0.45rem 1.1rem;
  color: var(--erp-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
/* ========== Toast Notifications ========== */
.erp-toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.erp-toast {
  width: 320px;
  background: var(--erp-bg-card);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-lg);
  box-shadow: var(--erp-shadow-xl);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.erp-toast.show {
  transform: translateX(0);
}

.erp-toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.erp-toast-success .erp-toast-icon { color: var(--erp-success); }
.erp-toast-error .erp-toast-icon { color: var(--erp-danger); }
.erp-toast-warning .erp-toast-icon { color: var(--erp-warning); }
.erp-toast-info .erp-toast-icon { color: var(--erp-info); }

.erp-toast-content {
  flex: 1;
}

.erp-toast-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--erp-text);
  margin-bottom: 0.2rem;
}

.erp-toast-message {
  font-size: 0.85rem;
  color: var(--erp-text-secondary);
  line-height: 1.4;
}

.erp-toast-close {
  background: none;
  border: none;
  color: var(--erp-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.erp-toast-close:hover {
  color: var(--erp-text);
}

/* ========== Tabbed Form Layouts ========== */
.erp-nav-tabs {
  border-bottom: 2px solid var(--erp-border);
  margin-bottom: 0;
}
.erp-nav-tabs .nav-link {
  color: var(--erp-text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  transition: all var(--erp-transition);
}
.erp-nav-tabs .nav-link:hover {
  color: var(--erp-primary);
  border-color: transparent;
}
.erp-nav-tabs .nav-link.active {
  color: var(--erp-primary);
  background-color: transparent;
  border-color: transparent;
  border-bottom: 2px solid var(--erp-primary);
}

/* ========== Contextual Help Tooltips ========== */

.erp-help-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--erp-border);
  color: var(--erp-text-secondary);
  font-size: 0.7rem;
  margin-left: 0.4rem;
  cursor: help;
  transition: all var(--erp-transition);
}

.erp-help-tooltip:hover {
  background: var(--erp-primary);
  color: #fff;
}

/* ========== Relationship Maps (Flow View) ========== */
.erp-flow-map {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0;
  position: relative;
}
.erp-flow-map::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 2px;
  background: var(--erp-border);
  z-index: 0;
  transform: translateY(-50%);
}
.erp-flow-node {
  position: relative;
  z-index: 1;
  background: var(--erp-surface);
  border: 2px solid var(--erp-border);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--erp-text-secondary);
  transition: all var(--erp-transition);
}
.erp-flow-node.active {
  border-color: var(--erp-primary);
  color: var(--erp-primary);
  box-shadow: 0 0 0 4px var(--erp-primary-light);
}
.erp-flow-node.completed {
  border-color: var(--erp-success);
  background: var(--erp-success);
  color: #fff;
}
.erp-flow-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--erp-text);
  white-space: nowrap;
}
.erp-flow-meta {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--erp-text-secondary);
  white-space: nowrap;
}

/* ========== Density Controls (Compact View) ========== */
body.erp-density-compact .erp-table tbody td,
body.erp-density-compact .erp-table thead th {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

body.erp-density-compact .erp-card .card-body {
  padding: 1rem;
}

body.erp-density-compact .form-control,
body.erp-density-compact .form-select {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

body.erp-density-compact .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.erp-group-toggle:hover {
  background: var(--erp-sidebar-hover);

  color: var(--erp-text);
}

.erp-group-label { flex: 1; text-align: left; }

.erp-group-icon {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  width: 18px;
  text-align: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.erp-group-toggle[aria-expanded="true"] .erp-group-icon {
  content: "-";
}

/* Group items: collapsed by default, animate open */
.erp-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.erp-group-items.open {
  max-height: 1000px;
}

/* Dark mode */
[data-theme="dark"] .erp-group-toggle { color: var(--erp-text-muted); }
[data-theme="dark"] .erp-group-toggle:hover { background: var(--erp-sidebar-hover); color: #e2e8f0; }

 @ k e y f r a m e s   s h i m m e r   { 
     0 %   {   b a c k g r o u n d - p o s i t i o n :   2 0 0 %   0 ;   } 
     1 0 0 %   {   b a c k g r o u n d - p o s i t i o n :   - 2 0 0 %   0 ;   } 
 } 
 / *   = = = = = = = = = =   P r e m i u m   M e s h   G r a d i e n t s   = = = = = = = = = =   * / 
 . b g - m e s h - p r e m i u m   { 
     b a c k g r o u n d - c o l o r :   v a r ( - - e r p - p r i m a r y ) ; 
     b a c k g r o u n d - i m a g e :   
         r a d i a l - g r a d i e n t ( a t   0 %   0 % ,   r g b a ( 1 4 7 ,   5 1 ,   2 3 4 ,   0 . 4 )   0 p x ,   t r a n s p a r e n t   5 0 % ) , 
         r a d i a l - g r a d i e n t ( a t   1 0 0 %   0 % ,   r g b a ( 5 9 ,   1 3 0 ,   2 4 6 ,   0 . 4 )   0 p x ,   t r a n s p a r e n t   5 0 % ) , 
         r a d i a l - g r a d i e n t ( a t   1 0 0 %   1 0 0 % ,   r g b a ( 1 6 ,   1 8 5 ,   1 2 9 ,   0 . 2 )   0 p x ,   t r a n s p a r e n t   5 0 % ) , 
         r a d i a l - g r a d i e n t ( a t   0 %   1 0 0 % ,   r g b a ( 2 3 6 ,   7 2 ,   1 5 3 ,   0 . 3 )   0 p x ,   t r a n s p a r e n t   5 0 % ) ; 
     c o l o r :   w h i t e   ! i m p o r t a n t ; 
     b o r d e r :   n o n e   ! i m p o r t a n t ; 
     p o s i t i o n :   r e l a t i v e ; 
     o v e r f l o w :   h i d d e n ; 
 } 
 
 . b g - m e s h - p r e m i u m : : b e f o r e   { 
     c o n t e n t :   ' ' ; 
     p o s i t i o n :   a b s o l u t e ; 
     t o p :   0 ;   l e f t :   0 ;   r i g h t :   0 ;   b o t t o m :   0 ; 
     b a c k g r o u n d :   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 0 5 ) ; 
     p o i n t e r - e v e n t s :   n o n e ; 
 } 
 
 . b g - m e s h - p r e m i u m   . c a r d - t i t l e , 
 . b g - m e s h - p r e m i u m   . c a r d - v a l u e , 
 . b g - m e s h - p r e m i u m   . c a r d - t i t l e   i   { 
     c o l o r :   w h i t e   ! i m p o r t a n t ; 
     p o s i t i o n :   r e l a t i v e ; 
     z - i n d e x :   1 ; 
 } 
 
 . b g - m e s h - p r e m i u m   . c a r d - t i t l e   { 
     o p a c i t y :   0 . 9 ; 
 } 
  
 