/**
 * SNM ERP — Unified Design System
 * Single source of truth for all styles.
 * Replaces: style.css (template), modern-theme.css, custom.css
 *
 * Structure:
 *  1. Google Fonts
 *  2. Design Tokens (CSS Variables)
 *  3. Base & Typography
 *  4. Layout (Sidebar, Header, Content Area)
 *  5. KPI Stat Cards
 *  6. Tables
 *  7. Forms & Inputs
 *  8. Buttons
 *  9. Badges & Status Chips
 * 10. Cards & Panels
 * 11. Modals
 * 12. Alerts & Toast
 * 13. Charts & Data Viz
 * 14. Empty States
 * 15. Dark Mode
 * 16. Print Styles
 * 17. Utilities
 * 18. Responsive / Mobile
 */

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

/* ─── 2. Design Tokens ────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50:   #eef2ff;
  --brand-100:  #e0e7ff;
  --brand-200:  #c7d2fe;
  --brand-400:  #818cf8;
  --brand-500:  #6366f1;
  --brand-600:  #4f46e5;
  --brand-700:  #4338ca;
  --brand-800:  #3730a3;
  --brand-900:  #312e81;

  /* Semantic colors */
  --color-primary:    var(--brand-600);
  --color-primary-hover: var(--brand-700);
  --color-success:    #10b981;
  --color-warning:    #f59e0b;
  --color-danger:     #ef4444;
  --color-info:       #06b6d4;

  /* Surface */
  --bg-body:    #f1f5f9;
  --bg-card:    #ffffff;
  --bg-sidebar: #1e1e2d;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  /* Border */
  --border-color:  #e2e8f0;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  --border-radius-pill: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Layout */
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.25rem;
  --font-size-2xl:  1.5rem;
  --font-size-3xl:  1.875rem;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background-color: var(--bg-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── 4. Layout ─────────────────────────────────────────────────────────── */

/* Sidebar */
.side-bar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: width var(--transition-base), transform var(--transition-base);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.04);
}

.side-bar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.side-bar-logo img {
  max-width: 140px;
  max-height: 40px;
  object-fit: contain;
  transition: max-width var(--transition-base);
}

.side-bar-manu { padding: 12px 0; flex: 1; }

.side-bar-manu ul { list-style: none; padding: 0; margin: 0; }

/* Nav group label */
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 16px 20px 6px;
  display: block;
}

.side-bar-manu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.55) !important;
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: 10px 16px;
  margin: 2px 10px;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
}

.side-bar-manu li a:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.side-bar-manu li.active > a,
.side-bar-manu li a.active {
  color: #fff !important;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-icon img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(0.55);
  transition: filter var(--transition-fast);
}

.side-bar-manu li.active > a .sidebar-icon img,
.side-bar-manu li a:hover .sidebar-icon img,
.side-bar-manu li a.active .sidebar-icon img {
  filter: brightness(0) invert(1);
}

/* Sub-menu */
.side-bar-manu li.dropdown > ul {
  padding: 4px 0;
  margin: 0 10px 4px 32px;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.side-bar-manu li.dropdown > ul li a {
  font-size: 0.8rem;
  padding: 8px 12px;
  margin: 1px 0;
  color: rgba(255,255,255,0.4) !important;
}

.side-bar-manu li.dropdown > ul li a:hover,
.side-bar-manu li.dropdown > ul li a.active {
  color: rgba(255,255,255,0.9) !important;
  background: rgba(255,255,255,0.06);
}

/* Section Container */
.section-container {
  padding-left: var(--sidebar-width) !important;
  min-height: 100vh;
  transition: padding-left var(--transition-base);
}

.section-container.active {
  padding-left: 80px !important;
}

/* Header */
.main-header-section {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: rgba(241,245,249,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.header-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.header-left { display: flex; align-items: center; }
.header-middle { flex: 1; }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* Sidebar toggle button */
.sidebar-opner {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-size: 18px;
}

.sidebar-opner:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Page content area */
.erp-state-overview-section,
.erp-table-section,
.page-content {
  padding: 24px;
}

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

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--kpi-accent, var(--color-primary));
}

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

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--kpi-bg, var(--brand-50));
  color: var(--kpi-accent, var(--color-primary));
}

.kpi-body { flex: 1; min-width: 0; }

.kpi-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

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

.kpi-trend {
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-top: 4px;
}

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

/* Legacy erp-overview-item compatibility */
.erp-overview-item {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.erp-overview-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.erp-overview-item .overview-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--brand-50);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.erp-overview-item .overview-icon img {
  width: 24px;
  height: 24px;
}

.erp-overview-item h6 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text-primary);
}

.erp-overview-item p {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── 6. Tables ─────────────────────────────────────────────────────────── */
.responsive-table {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* ─── Table Dropdown Overflow & Boundary Fix ─── */
.table-responsive {
  min-height: 320px;
}

@media (min-width: 992px) {
  .table-responsive {
    overflow: visible !important;
  }
}

.table td .dropdown {
  position: relative;
}

.table td .dropdown-menu {
  border-radius: 10px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  z-index: 1065 !important;
  animation: dropdownFadeIn 0.15s ease-out;
}

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

.table td .dropdown-menu .dropdown-item {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.table td .dropdown-menu .dropdown-item:hover {
  background-color: var(--brand-50, #eef2ff);
  color: var(--color-primary, #4f46e5);
}

.table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table tbody td {
  padding: 14px 20px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-sm);
  vertical-align: middle;
}

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

.table-hover tbody tr {
  transition: background var(--transition-fast);
  cursor: default;
}

.table-hover tbody tr:hover { background: #f8fafc; }

/* Table image avatar */
.table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

/* ─── 7. Forms & Inputs ─────────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  line-height: 1.5;
}

.form-control:focus, .form-select:focus {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
  outline: none;
}

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

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.form-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.input-group .form-control { border-radius: var(--border-radius-sm); }

/* Select2 override */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  background: #f8fafc !important;
  min-height: 42px !important;
  display: flex;
  align-items: center;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12) !important;
}

/* ─── 8. Buttons ─────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-family);
  font-weight: 500;
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius-sm);
  padding: 9px 18px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.btn-primary, .theme-btn {
  background: var(--color-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}

.btn-primary:hover, .theme-btn:hover {
  background: var(--color-primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-outline-primary {
  border: 1.5px solid var(--color-primary) !important;
  color: var(--color-primary) !important;
  background: transparent !important;
}

.btn-outline-primary:hover {
  background: var(--brand-50) !important;
}

.btn-sm { padding: 6px 12px; font-size: var(--font-size-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--font-size-base); }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

/* ─── 9. Badges & Status Chips ─────────────────────────────────────────── */
.badge {
  padding: 5px 10px;
  border-radius: var(--border-radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Status-specific badge overrides (soft/tinted) */
.badge.bg-warning, .badge-warning-soft { background: #fef3c7 !important; color: #92400e !important; }
.badge.bg-success, .badge-success-soft { background: #d1fae5 !important; color: #065f46 !important; }
.badge.bg-danger,  .badge-danger-soft  { background: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-primary, .badge-primary-soft { background: var(--brand-100) !important; color: var(--brand-800) !important; }
.badge.bg-info,    .badge-info-soft    { background: #cffafe !important; color: #164e63 !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #64748b !important; }

/* ─── 10. Cards & Panels ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  margin-bottom: 1.5rem;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Glassmorphism for KPI Cards */
.erp-state-overview .card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

[data-theme="dark"] .erp-state-overview .card {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.5rem;
}

.card-header h5, .card-header h6 {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body { padding: 20px; }

/* Section header (page-level) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header h4, .section-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* ─── 11. Modals ─────────────────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
}

.modal-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body { padding: 24px; }

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  gap: 8px;
}

/* ─── 12. Empty States ───────────────────────────────────────────────────── */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--brand-50);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.empty-state h5 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── 13. Loader / Skeleton ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

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

.kpi-loader {
  display: inline-block;
  width: 80px;
  height: 20px;
}

/* ─── 14. Charts container ───────────────────────────────────────────────── */
.chart-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ─── 15. Dark Mode ──────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-body:    #0f172a;
  --bg-card:    #1e293b;
  --bg-sidebar: #0f172a;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --border-color:  #334155;
  --brand-50:  rgba(79,70,229,0.1);
  --brand-100: rgba(79,70,229,0.15);
}

[data-theme="dark"] .table thead th      { background: #1e293b; }
[data-theme="dark"] .table-hover tbody tr:hover { background: #2d3748; }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select         { background: #1e293b; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .form-control:focus  { background: #1e293b; border-color: var(--color-primary); }
[data-theme="dark"] .card, [data-theme="dark"] .cards { background: var(--bg-card); }
[data-theme="dark"] .main-header-section { background: rgba(15,23,42,0.85); }

/* ─── 16. Print ──────────────────────────────────────────────────────────── */
@media print {
  .side-bar, .main-header-section, .no-print { display: none !important; }
  .section-container { margin-left: 0 !important; }
  body { background: white; font-size: 12px; }
  .card { border: 1px solid #ddd; box-shadow: none; }
  .table tbody tr { break-inside: avoid; }
}

/* ─── 17. Utilities ──────────────────────────────────────────────────────── */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }

.text-xs  { font-size: var(--font-size-xs) !important; }
.text-sm  { font-size: var(--font-size-sm) !important; }
.text-base{ font-size: var(--font-size-base) !important; }

.rounded-pill { border-radius: var(--border-radius-pill) !important; }
.rounded-lg   { border-radius: var(--border-radius-lg) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }

/* Divider */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* Avatar group */
.avatar-group { display: flex; }
.avatar-group .table-avatar { margin-left: -8px; border: 2px solid white; }
.avatar-group .table-avatar:first-child { margin-left: 0; }

/* Progress ring (for production %) */
.progress-ring { display: inline-flex; position: relative; }
.progress-ring canvas { transform: rotate(-90deg); }

/* Notification badge */
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--border-radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
}

/* ─── 18. Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 991px) {
  .section-container {
    padding-left: 0 !important;
  }
}

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

  .side-bar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .section-container {
    margin-left: 0 !important;
  }

  .erp-state-overview-section,
  .erp-table-section,
  .page-content {
    padding: 16px;
  }

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

  .section-header { flex-direction: column; align-items: flex-start; }

  .table thead th,
  .table tbody td {
    padding: 12px 14px;
  }

  /* Mobile overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }

  .sidebar-overlay.active { display: block; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .btn { padding: 8px 14px; }
  .modal-body { padding: 16px; }
}
