/* =============================================
   SignFlow Enterprise - Design System
   ============================================= */

:root {
  /* Primary palette */
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #818cf8;
  --primary-bg:    #eef2ff;

  /* Status colors */
  --success:       #10b981;
  --success-bg:    #d1fae5;
  --warning:       #f59e0b;
  --warning-bg:    #fef3c7;
  --danger:        #ef4444;
  --danger-bg:     #fee2e2;
  --info:          #3b82f6;
  --info-bg:       #dbeafe;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Surfaces */
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --surface-alt: #f1f5f9;
  --border:      #e2e8f0;
  --border-focus:#6366f1;

  /* Text */
  --text:         #1e293b;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --text-inverse: #ffffff;

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

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem;  --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem;  --space-8: 2rem;    --space-10: 2.5rem;
  --space-12: 3rem;   --space-16: 4rem;   --space-20: 5rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius:    0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Typography */
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', Consolas, 'Courier New', monospace;

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 200ms ease;

  /* Sidebar */
  --sidebar-w: 260px;
  --header-h:  64px;
}

/* Dark mode */
[data-theme="dark"] {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface-alt: #334155;
  --border:      #334155;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --text-light:  #64748b;
  --primary-bg:  #1e1b4b;
  --gray-50:  #1e293b;
  --gray-100: #334155;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

/* ---- Typography ---- */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }
p  { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }
small { font-size: 0.8125rem; }

/* ---- Layout ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-content {
  flex: 1;
  padding: var(--space-8);
  margin-top: var(--header-h);
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-6); }
.container-sm { max-width: 640px; margin: 0 auto; }
.container-md { max-width: 860px; margin: 0 auto; }

/* ---- Grid ---- */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

/* ---- Flex helpers ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* ---- Spacing ---- */
.mt-auto { margin-top: auto; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5625rem var(--space-4);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.5;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-sm { padding: 0.375rem var(--space-3); font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem var(--space-6); font-size: 1rem; }
.btn-icon { padding: 0.5625rem; width: 2.25rem; height: 2.25rem; justify-content: center; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--gray-100); text-decoration: none; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; text-decoration: none; }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-bg); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); text-decoration: none; }
.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-2);
}

/* ---- Forms ---- */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 0.5625rem var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control:disabled { opacity: 0.6; background: var(--surface-alt); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }
.form-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: var(--space-1); }
.form-error { font-size: 0.8125rem; color: var(--danger); margin-top: var(--space-1); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; }
.form-check { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.form-check input[type=checkbox], .form-check input[type=radio] {
  width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.1875rem var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.badge-primary   { background: var(--primary-bg);  color: var(--primary-dark); }
.badge-success   { background: var(--success-bg);  color: #065f46; }
.badge-warning   { background: var(--warning-bg);  color: #92400e; }
.badge-danger    { background: var(--danger-bg);   color: #991b1b; }
.badge-info      { background: var(--info-bg);     color: #1e40af; }
.badge-gray      { background: var(--gray-100);    color: var(--gray-700); }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Modals ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-md);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(16px);
  transition: transform var(--transition-md);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1.125rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--text); }
.modal-body { padding: var(--space-6); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--gray-900);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 1rem; padding: 0; }
.toast-close:hover { color: #fff; }

/* ---- Dropdowns ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
}
.dropdown-menu.show { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-100); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: var(--space-1) 0; }

/* ---- Avatars ---- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.5rem; }

/* ---- Progress ---- */
.progress { height: 6px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; }
.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Empty states ---- */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 4rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h3 { margin-bottom: var(--space-2); color: var(--text); }

/* ---- Alerts ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
}
.alert-info    { background: var(--info-bg);    border-color: #93c5fd; color: #1e40af; }
.alert-success { background: var(--success-bg); border-color: #6ee7b7; color: #065f46; }
.alert-warning { background: var(--warning-bg); border-color: #fcd34d; color: #92400e; }
.alert-danger  { background: var(--danger-bg);  border-color: #fca5a5; color: #991b1b; }
.alert-icon { font-size: 1.125rem; flex-shrink: 0; }

/* ---- Loading ---- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.page-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,.05);
  transition: transform var(--transition-md);
}
.sidebar-logo {
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}
.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.sidebar-logo-text { color: #fff; font-weight: 700; font-size: 1.125rem; }
.sidebar-logo-badge {
  font-size: 0.65rem;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-left: auto;
}
.sidebar-nav { flex: 1; padding: var(--space-4) var(--space-3); overflow-y: auto; }
.nav-section { margin-bottom: var(--space-6); }
.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.35);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item-icon { width: 20px; flex-shrink: 0; font-size: 1rem; }
.nav-item-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: 0.875rem; font-weight: 600; truncate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: rgba(255,255,255,.45); font-size: 0.75rem; }

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  z-index: 50;
  gap: var(--space-4);
}
.header-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }

/* ---- Stat Cards ---- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); margin-top: var(--space-1); }
.stat-trend { font-size: 0.75rem; font-weight: 600; margin-top: var(--space-1); }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---- Search ---- */
.search-input-wrapper { position: relative; }
.search-input-wrapper input { padding-left: 2.5rem; }
.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-4);
}
.page-btn {
  min-width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { background: var(--gray-100); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; pointer-events: none; }
.page-info { font-size: 0.8125rem; color: var(--text-muted); margin-left: auto; }

/* ---- Utility ---- */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-small   { font-size: 0.8125rem; }
.text-xs      { font-size: 0.75rem; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-none       { display: none; }
.d-block      { display: block; }
.w-full       { width: 100%; }
.rounded      { border-radius: var(--radius); }
.rounded-full { border-radius: var(--radius-full); }
.shadow       { box-shadow: var(--shadow); }
.border-top   { border-top: 1px solid var(--border); }
.overflow-hidden { overflow: hidden; }
.relative     { position: relative; }
.separator    { height: 1px; background: var(--border); margin: var(--space-4) 0; }

/* ---- Animations ---- */
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes toastIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes slideDown { from { opacity:0; transform:translateY(-16px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse   { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.animate-fadeIn   { animation: fadeIn 0.3s ease; }
.animate-slideDown { animation: slideDown 0.25s ease; }
.animate-pulse    { animation: pulse 2s ease-in-out infinite; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .header { left: 0; }
  .page-content { padding: var(--space-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .btn-lg { padding: 0.625rem var(--space-4); font-size: 0.9375rem; }
}
@media (max-width: 480px) {
  .modal { border-radius: var(--radius-lg); }
  .toast-container { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); }
  .toast { min-width: auto; width: 100%; }
}

/* Print styles */
@media print {
  .sidebar, .header, .header-actions, .btn, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; margin-top: 0 !important; }
}
