/* ============================================================
   PrintFlow — Premium Design System
   Version: 1.0.0
   Color: Deep Navy + Amber Gold + Glassmorphism
   Typography: DM Sans (UI) / Playfair Display (Documents)
   ============================================================ */

/* ============================
   CSS CUSTOM PROPERTIES
   ============================ */
:root {
  /* Primary Colors */
  --primary: #0F172A;
  --primary-light: #1E293B;
  --primary-lighter: #334155;
  --primary-50: #F8FAFC;

  /* Accent — Amber Gold */
  --accent: #F59E0B;
  --accent-hover: #D97706;
  --accent-light: rgba(245, 158, 11, 0.1);
  --accent-dark: #B45309;

  /* Slate Grays */
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Backgrounds */
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: rgba(245, 158, 11, 0.12);

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;
  --text-sidebar: rgba(255, 255, 255, 0.65);
  --text-sidebar-active: #F59E0B;

  /* Borders */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-focus: #F59E0B;

  /* Status */
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.25);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.25);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.25);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.25);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.15);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-blur: 12px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Z-index */
  --z-sidebar: 100;
  --z-header: 90;
  --z-dropdown: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-overlay: 250;
  --z-tooltip: 500;
}

/* ============================
   GLOBAL RESET & BASE
   ============================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-main);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

::selection {
  background-color: var(--accent);
  color: var(--text-white);
}

/* ============================
   SCROLLBAR STYLING
   ============================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--slate-300) transparent;
}

/* ============================
   LAYOUT SYSTEM
   ============================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-main);
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-base);
}

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

.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--transition-base);
  overflow: hidden;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

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

.sidebar-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

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

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
}

body.sidebar-collapsed .nav-section-label {
  font-size: 0;
  padding: 8px 0;
  text-align: center;
}

body.sidebar-collapsed .nav-section-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: rgba(255, 255, 255, 0.9);
}

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

.nav-item.active .nav-icon {
  color: var(--text-sidebar-active);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-label {
  opacity: 1;
  transition: opacity var(--transition-fast);
}

body.sidebar-collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

/* Nav Groups (Expandable) */
.nav-group-toggle {
  cursor: pointer;
}

.nav-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  opacity: 0.5;
}

.nav-group.open .nav-chevron {
  transform: rotate(90deg);
}

body.sidebar-collapsed .nav-chevron {
  display: none;
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.nav-group.open .nav-submenu {
  max-height: 200px;
}

body.sidebar-collapsed .nav-submenu {
  display: none;
}

.nav-subitem {
  display: block;
  padding: 7px 14px 7px 46px;
  font-size: 0.8125rem;
  color: var(--text-sidebar);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-subitem:hover {
  color: rgba(255, 255, 255, 0.9);
  background: var(--bg-sidebar-hover);
}

.nav-subitem.active {
  color: var(--accent);
}

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

.nav-logout:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #FCA5A5 !important;
}

/* ============================
   HEADER
   ============================ */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: var(--z-header);
}

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  margin-right: 12px;
}

.mobile-menu-btn:hover {
  background: var(--slate-100);
}

.header-press-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Notification Bell */
.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notification-bell:hover {
  background: var(--slate-100);
}

.notification-bell svg {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  background: var(--error);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  z-index: var(--z-dropdown);
}

.notification-bell.open .notification-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9375rem;
}

.notif-mark-read {
  font-size: 0.8125rem;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}

.notif-mark-read:hover {
  text-decoration: underline;
}

.notif-list {
  max-height: 340px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.notif-item:hover {
  background: var(--slate-50);
}

.notif-item.unread {
  background: var(--accent-light);
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-message {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.notif-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* User Menu */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-menu:hover {
  background: var(--slate-100);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-lighter));
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.user-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.user-menu.open .user-chevron {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  z-index: var(--z-dropdown);
}

.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.user-dropdown-header strong {
  font-size: 0.9375rem;
}

.user-dropdown-header small {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.user-dropdown a:hover {
  background: var(--slate-50);
  color: var(--text-primary);
}

/* ============================
   CARDS
   ============================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

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

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 22px;
}

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

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

.stat-card--accent::before { background: var(--accent); }
.stat-card--success::before { background: var(--success); }
.stat-card--info::before { background: var(--info); }
.stat-card--error::before { background: var(--error); }
.stat-card--warning::before { background: var(--warning); }

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon svg {
  width: 22px;
  height: 22px;
}

.stat-card-icon--accent { background: var(--accent-light); color: var(--accent); }
.stat-card-icon--success { background: var(--success-bg); color: var(--success); }
.stat-card-icon--info { background: var(--info-bg); color: var(--info); }
.stat-card-icon--error { background: var(--error-bg); color: var(--error); }

.stat-card-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change--up {
  color: var(--success);
  background: var(--success-bg);
}

.stat-card-change--down {
  color: var(--error);
  background: var(--error-bg);
}

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Primary (Amber Gold) */
.btn-primary {
  background: var(--accent);
  color: var(--primary);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

/* Secondary */
.btn-secondary {
  background: var(--slate-100);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--slate-200);
  border-color: var(--slate-300);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--slate-50);
  border-color: var(--slate-300);
}

/* Danger */
.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  border-color: #DC2626;
}

/* Success */
.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
}

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

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

/* Sizes */
.btn-xs {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-block {
  width: 100%;
}

/* ============================
   FORMS
   ============================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:hover {
  border-color: var(--slate-300);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-control:disabled {
  background: var(--slate-50);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-control.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

.form-control.is-success {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Textarea */
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Floating Labels */
.form-floating {
  position: relative;
}

.form-floating .form-control {
  padding: 22px 14px 8px;
}

.form-floating .form-label {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--text-muted);
  pointer-events: none;
  transition: all var(--transition-fast);
  margin-bottom: 0;
}

.form-floating .form-control:focus ~ .form-label,
.form-floating .form-control:not(:placeholder-shown) ~ .form-label {
  top: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
}

/* Input with Icon */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .form-control {
  padding-left: 42px;
}

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

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* ============================
   TABLES
   ============================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--slate-50);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--slate-50);
}

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

.table-actions {
  display: flex;
  gap: 4px;
}

/* Sortable Column */
.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--text-primary);
}

/* ============================
   STATUS BADGES
   ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-draft { background: var(--slate-100); color: var(--slate-600); }
.badge-sent, .badge-pending { background: var(--info-bg); color: var(--info); }
.badge-accepted, .badge-paid, .badge-active { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--error-bg); color: var(--error); }
.badge-converted { background: rgba(124, 58, 237, 0.1); color: #7C3AED; }
.badge-unpaid, .badge-overdue { background: var(--error-bg); color: var(--error); }
.badge-partial { background: var(--warning-bg); color: var(--accent-dark); }
.badge-locked { background: var(--slate-800); color: var(--text-white); }
.badge-cancelled { background: var(--slate-100); color: var(--slate-500); }
.badge-delivered { background: var(--success-bg); color: var(--success); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* ============================
   MODALS
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn var(--transition-base) ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Confirm Dialog */
.modal-confirm .modal-body {
  text-align: center;
  padding: 32px 24px;
}

.modal-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.5rem;
}

.modal-confirm-icon--warning { background: var(--warning-bg); }
.modal-confirm-icon--danger { background: var(--error-bg); }
.modal-confirm-icon--info { background: var(--info-bg); }

.modal-confirm h3 {
  margin-bottom: 8px;
}

.modal-confirm p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Modal Sizes */
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

/* ============================
   TOAST NOTIFICATIONS
   ============================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  min-width: 320px;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  animation: toastSlideIn var(--transition-base) ease-out;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast.toast-success::before { background: var(--success); }
.toast.toast-error::before { background: var(--error); }
.toast.toast-warning::before { background: var(--warning); }
.toast.toast-info::before { background: var(--info); }

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

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

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

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

.toast-dismiss {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.toast-dismiss:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.2;
  animation: toastProgress linear forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============================
   PAGINATION
   ============================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.pagination-btn:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--primary);
  color: var(--text-white);
}

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

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-left: 16px;
}

/* ============================
   SEARCH BAR
   ============================ */
.search-bar {
  position: relative;
  max-width: 360px;
}

.search-bar .form-control {
  padding-left: 42px;
  background: var(--slate-50);
  border-color: transparent;
}

.search-bar .form-control:focus {
  background: var(--bg-card);
  border-color: var(--accent);
}

.search-bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ============================
   DROPDOWNS
   ============================ */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--slate-50);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
}

.dropdown-item--danger { color: var(--error); }
.dropdown-item--danger:hover { background: var(--error-bg); }

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

/* ============================
   TABS
   ============================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  overflow-x: auto;
}

.tab-item {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-content {
  display: none;
  padding-top: 20px;
}

.tab-content.active {
  display: block;
  animation: fadeIn var(--transition-base);
}

/* ============================
   LOADING STATES
   ============================ */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-heading {
  height: 24px;
  width: 50%;
  margin-bottom: 16px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 4px; }

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* ============================
   EMPTY STATES
   ============================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-icon svg {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin-bottom: 20px;
}

/* ============================
   ALERTS
   ============================ */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid transparent;
  position: relative;
}

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: #065F46; }
.alert-error { background: var(--error-bg); border-color: var(--error-border); color: #991B1B; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: #92400E; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: #1E40AF; }

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-dismiss {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.alert-dismiss:hover {
  opacity: 1;
}

/* ============================
   AVATARS
   ============================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-lighter));
  color: var(--text-white);
}

.avatar-xs { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.5rem; }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -10px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================
   TAGS
   ============================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag-vip {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.15));
  color: var(--accent-dark);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.tag-regular {
  background: var(--slate-100);
  color: var(--slate-600);
}

.tag-blacklisted {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.tag-new {
  background: var(--info-bg);
  color: var(--info);
}

/* ============================
   TOGGLE SWITCH
   ============================ */
.toggle {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 100%;
  height: 100%;
  background: var(--slate-300);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  position: relative;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================
   PROGRESS / STEPPER
   ============================ */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 20px 0;
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  position: relative;
}

.stepper-step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.stepper-step.completed::after {
  background: var(--success);
}

.stepper-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--slate-100);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.stepper-step.active .stepper-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary);
}

.stepper-step.completed .stepper-dot {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.stepper-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stepper-step.active .stepper-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================
   BREADCRUMBS
   ============================ */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
  color: var(--text-primary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

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

/* ============================
   FILE UPLOAD
   ============================ */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-upload:hover,
.file-upload.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.file-upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-muted);
}

.file-upload-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.file-upload-text strong {
  color: var(--accent);
}

.file-upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-upload input[type="file"] {
  display: none;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.file-preview-name {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-preview-remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
}

.file-preview-remove:hover {
  color: var(--error);
  background: var(--error-bg);
}

/* ============================
   TOOLTIPS
   ============================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background: var(--slate-800);
  color: var(--text-white);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: var(--z-tooltip);
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--slate-800);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================
   SIDEBAR OVERLAY (Mobile)
   ============================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ============================
   UTILITY CLASSES
   ============================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================
   KEYFRAME ANIMATIONS
   ============================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

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

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Animation utility classes */
.animate-fade-in { animation: fadeIn var(--transition-base); }
.animate-fade-in-up { animation: fadeInUp var(--transition-base); }
.animate-slide-up { animation: slideUp var(--transition-base); }
.animate-slide-right { animation: slideInRight var(--transition-base); }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-spin { animation: spin 0.6s linear infinite; }

/* Stagger animations */
.stagger > * { animation: fadeInUp 0.4s ease-out both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ============================
   RESPONSIVE — TABLET
   ============================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .page-content {
    padding: 20px 24px;
  }

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

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

/* ============================
   RESPONSIVE — MOBILE
   ============================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

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

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

  .mobile-menu-btn {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

  .app-header {
    padding: 0 16px;
  }

  .user-name {
    display: none;
  }

  .user-chevron {
    display: none;
  }

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

  .notification-dropdown {
    width: calc(100vw - 32px);
    right: -60px;
  }

  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .modal {
    margin: 16px;
    max-height: calc(100vh - 32px);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .page-content {
    padding: 12px;
  }

  .card-body {
    padding: 16px;
  }

  .card-header {
    padding: 14px 16px;
  }

  .stat-card {
    padding: 16px;
  }

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