/* ============================================================
   Protech Solutions CRM — Enterprise Design System
   v2 — SaaS-grade visual language
   ============================================================ */

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

/* ────────────────────────────────────────────────────────────
   DESIGN TOKENS
   ──────────────────────────────────────────────────────────── */
:root {
  /* Brand colors (From Logo) */
  --brand-50: #f0f7ff;
  --brand-100: #e0efff;
  --brand-200: #b9daff;
  --brand-400: #5b9bd5;
  --brand-500: #3474B4;
  /* Main Blue */
  --brand-600: #2a5d91;
  --brand-700: #1f466d;
  --brand-800: #152e49;

  /* Neutral scale */
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-150: #ebedf0;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #0a0f1a;

  /* Semantic */
  --success-50: #f7fdf0;
  --success-100: #edfce0;
  --success-500: #8DB942;
  /* Main Green */
  --success-600: #719435;
  --success-700: #556f28;

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

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

  --info-50: #ecfeff;
  --info-100: #cffafe;
  --info-500: #06b6d4;
  --info-600: #0891b2;
  --info-700: #0e7490;

  --purple-50: #f5f3ff;
  --purple-100: #ede9fe;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;

  /* Aliases used widely */
  --primary: var(--brand-600);
  --primary-dark: var(--brand-700);
  --accent: var(--brand-500);
  --success: var(--success-600);
  --warning: var(--warning-600);
  --danger: var(--danger-600);
  --info: var(--info-600);

  /* Surface */
  --bg-app: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-muted: #f3f4f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --border-subtle: #f1f5f9;

  /* Sidebar (dark) */
  --sidebar-bg: #0b1220;
  --sidebar-bg-2: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-soft: #64748b;
  --sidebar-text-strong: #f1f5f9;
  --sidebar-hover: rgba(148, 163, 184, 0.08);
  --sidebar-active: rgba(59, 130, 246, 0.14);
  --sidebar-active-text: #ffffff;
  --sidebar-section: #475569;
  --sidebar-accent: var(--brand-500);

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 12px 20px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 25px 50px -12px rgba(15, 23, 42, 0.18);
  --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.18);
  --shadow-focus-danger: 0 0 0 3px rgba(239, 68, 68, 0.18);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --navbar-h: 64px;
  --content-max-w: 1440px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-slow: 280ms;
  --transition: all var(--duration) var(--ease-in-out);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-xs: 0.75rem;
  /* 12 */
  --fs-sm: 0.8125rem;
  /* 13 */
  --fs-base: 0.875rem;
  /* 14 */
  --fs-md: 0.9375rem;
  /* 15 */
  --fs-lg: 1rem;
  /* 16 */
  --fs-xl: 1.125rem;
  /* 18 */
  --fs-2xl: 1.25rem;
  /* 20 */
  --fs-3xl: 1.5rem;
  /* 24 */
  --fs-4xl: 1.875rem;
  /* 30 */

  --lh-tight: 1.25;
  --lh-snug: 1.375;
  --lh-normal: 1.55;
  --lh-relaxed: 1.65;

  /* z-index */
  --z-sidebar: 60;
  --z-backdrop: 50;
  --z-navbar: 40;
  --z-dropdown: 1000;
  --z-modal: 1050;
  --z-toast: 1100;
}

/* ────────────────────────────────────────────────────────────
   RESET & BASE
   ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

a:hover {
  color: var(--primary-dark);
}

/* Selection */
::selection {
  background: var(--brand-100);
  color: var(--brand-800);
}

/* Focus ring */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* Scrollbars */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

*::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 999px;
  border: 2px solid var(--bg-app);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--gray-300);
}

/* ────────────────────────────────────────────────────────────
   APP LAYOUT
   ──────────────────────────────────────────────────────────── */
#wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

#page-content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: var(--space-7) var(--space-8);
  width: 100%;
  max-width: var(--content-max-w);
  margin: 0 auto;
}

.site-footer {
  padding: var(--space-4) var(--space-7);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-align: center;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR
   ──────────────────────────────────────────────────────────── */
#sidebar-wrapper {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  background-image: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: var(--z-sidebar);
  transition: width var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  border-right: 1px solid var(--sidebar-border);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-4) var(--space-6);
  min-height: var(--navbar-h);
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-main {
  max-height: 50px;
  width: auto;
  object-fit: contain;
  transition: all var(--duration) var(--ease-out);
}

#sidebar-wrapper.collapsed .brand-logo-main {
  max-height: 32px;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 8px -2px rgba(37, 99, 235, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sidebar-brand-meta {
  min-width: 0;
  opacity: 1;
  transition: opacity var(--duration) ease;
}

.sidebar-brand-text {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sidebar-text-strong);
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-brand-sub {
  font-size: 0.6875rem;
  color: var(--sidebar-text);
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) var(--space-2) var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--gray-700) transparent;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--gray-700);
  border: none;
}

.sidebar-section {
  padding: var(--space-5) var(--space-4) var(--space-2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-section);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-4);
  margin: 1px var(--space-2);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) ease,
    color var(--duration-fast) ease,
    transform var(--duration-fast) ease;
  position: relative;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
  text-decoration: none;
}

.sidebar-link:active {
  transform: scale(0.98);
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 25%;
  bottom: 25%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-accent);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.sidebar-link .bi {
  font-size: 1.0625rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link.active .bi {
  opacity: 1;
}

.sidebar-link-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link .nav-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
  background: var(--warning-500);
  color: #1f1402;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Footer (user card) */
.sidebar-footer {
  padding: var(--space-3) var(--space-3);
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.08);
  transition: var(--transition);
}

.sidebar-user:hover {
  background: rgba(148, 163, 184, 0.08);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-user-text {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sidebar-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile backdrop */
#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration) ease, visibility var(--duration) ease;
}

#sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* ────────────────────────────────────────────────────────────
   TOP NAVBAR
   ──────────────────────────────────────────────────────────── */
.top-navbar {
  height: var(--navbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-7);
  gap: var(--space-3);
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  flex-shrink: 0;
  backdrop-filter: saturate(180%) blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.sidebar-toggle-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

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

.sidebar-toggle-btn:active {
  transform: scale(0.96);
}

.navbar-page-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.navbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  text-decoration: none;
}

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

.navbar-icon-btn .icon-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-500);
  border: 2px solid var(--bg-surface);
}

.navbar-icon-btn .badge-dot-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--danger-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  line-height: 1;
}

/* User menu */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
  font-size: var(--fs-sm);
}

.user-menu-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.user-menu-btn::after {
  display: none;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  min-width: 220px;
  font-size: var(--fs-sm);
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background var(--duration-fast) ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--bg-subtle);
}

.dropdown-item.text-danger {
  color: var(--danger) !important;
}

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

.dropdown-item .bi {
  font-size: 1rem;
  opacity: 0.8;
  width: 18px;
  text-align: center;
}

.dropdown-header {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 6px 12px 4px;
  font-weight: 700;
}

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

/* ────────────────────────────────────────────────────────────
   PAGE HEADER (reusable component)
   ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-header-left {
  min-width: 0;
  flex: 1;
}

.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-header .subtitle {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.breadcrumb-nav a {
  color: var(--text-tertiary);
  font-weight: 500;
}

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

.breadcrumb-nav .sep {
  opacity: 0.5;
}

.breadcrumb-nav .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ────────────────────────────────────────────────────────────
   TYPOGRAPHY HELPERS
   ──────────────────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

h1 {
  font-size: var(--fs-4xl);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
}

h3 {
  font-size: var(--fs-2xl);
  line-height: var(--lh-snug);
}

h4 {
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
}

h5 {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}

h6 {
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-3);
}

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

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

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

.text-md {
  font-size: var(--fs-md) !important;
}

.text-lg {
  font-size: var(--fs-lg) !important;
}

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

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

.fw-bold {
  font-weight: 700 !important;
}

.fw-extrabold {
  font-weight: 800 !important;
}

.section-label,
.eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-3);
}

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

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

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

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

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

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

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

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* ────────────────────────────────────────────────────────────
   CARDS
   ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) ease, transform var(--duration) ease;
  overflow: hidden;
}

.card.is-hoverable:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  padding: var(--space-5) var(--space-6) !important;
}

.card-body {
  padding: var(--space-6);
}

.card-body.compact {
  padding: var(--space-4) var(--space-5);
}

.card-body.p-0 {
  padding: 0 !important;
}

.card-footer {
  background: var(--bg-subtle) !important;
  border-top: 1px solid var(--border) !important;
  padding: var(--space-3) var(--space-6) !important;
}

/* Card title block (icon + text) */
.card-title-block {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-title-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.bg-primary-soft {
  background: var(--brand-50) !important;
  color: var(--brand-700) !important;
}

.bg-success-soft {
  background: var(--success-50) !important;
  color: var(--success-700) !important;
}

.bg-warning-soft {
  background: var(--warning-50) !important;
  color: var(--warning-700) !important;
}

.bg-danger-soft {
  background: var(--danger-50) !important;
  color: var(--danger-700) !important;
}

.bg-info-soft {
  background: var(--info-50) !important;
  color: var(--info-700) !important;
}

.bg-purple-soft {
  background: var(--purple-50) !important;
  color: var(--purple-700) !important;
}

.bg-white-glass {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}

.card-title-text {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
}

.card-title-sub {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin: 2px 0 0;
}

/* ────────────────────────────────────────────────────────────
   KPI / STAT CARD
   ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) ease, transform var(--duration) ease;
  position: relative;
  overflow: hidden;
}

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

.stat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.stat-card-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 0;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.stat-card-value {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  font-feature-settings: 'tnum';
}

.stat-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* Gradient KPI variant */
.stat-card.is-feature {
  color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-800) 100%);
  box-shadow: 0 8px 16px -8px rgba(37, 99, 235, 0.5);
}

.stat-card.is-feature .stat-card-label {
  color: rgba(255, 255, 255, 0.85);
}

.stat-card.is-feature .stat-card-value {
  color: #fff;
}

.stat-card.is-feature .stat-card-meta {
  color: rgba(255, 255, 255, 0.85);
}

.stat-card.is-feature .stat-card-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.stat-card.is-feature .stat-card-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: var(--space-3) 0;
}

.stat-card.is-success {
  background: linear-gradient(135deg, var(--success-600), var(--success-700));
  box-shadow: 0 8px 16px -8px rgba(5, 150, 105, 0.5);
}

.stat-card.is-warning {
  background: linear-gradient(135deg, var(--warning-600), var(--warning-700));
  box-shadow: 0 8px 16px -8px rgba(217, 119, 6, 0.5);
}

.stat-card.is-danger {
  background: linear-gradient(135deg, var(--danger-600), var(--danger-700));
  box-shadow: 0 8px 16px -8px rgba(220, 38, 38, 0.5);
}

/* Trend badge */
.trend-up {
  color: var(--success-600);
  font-weight: 600;
}

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

/* ────────────────────────────────────────────────────────────
   TABLES
   ──────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table>thead>tr>th {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  padding: 11px var(--space-4);
  border-bottom: 1px solid var(--border);
  border-top: 0;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table>tbody>tr>td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  background: var(--bg-surface);
}

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

.table-hover>tbody>tr:hover>td {
  background: var(--bg-subtle);
}

.table thead th:first-child,
.table tbody td:first-child {
  padding-left: var(--space-6);
}

.table thead th:last-child,
.table tbody td:last-child {
  padding-right: var(--space-6);
}

.table-borderless td,
.table-borderless th {
  border: 0 !important;
}

.table.table-tight>tbody>tr>td {
  padding: 10px var(--space-4);
}

/* Cell helpers */
.cell-id {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.cell-strong {
  font-weight: 600;
  color: var(--text-primary);
}

.cell-sub {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* Avatar in table cells */
.cell-avatar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.8125rem;
  background: var(--brand-50);
  color: var(--brand-700);
}

.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 0.6875rem;
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.avatar.xl {
  width: 80px;
  height: 80px;
  font-size: 1.5rem;
}

.avatar.is-warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.avatar.is-success {
  background: var(--success-50);
  color: var(--success-700);
}

.avatar.is-info {
  background: var(--info-50);
  color: var(--info-700);
}

.avatar.is-purple {
  background: var(--purple-50);
  color: var(--purple-700);
}

.avatar.is-gradient {
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
}

/* Empty state inside tables */
.empty-state {
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
}

.empty-state h6 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}

.empty-state p {
  font-size: var(--fs-sm);
  margin: 0 0 var(--space-4);
}

/* ────────────────────────────────────────────────────────────
   FORMS
   ──────────────────────────────────────────────────────────── */
.form-control,
.form-select,
textarea.form-control,
input.form-control {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  line-height: 1.5;
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background var(--duration-fast) ease;
  -webkit-appearance: none;
  appearance: none;
}

textarea.form-control {
  min-height: 88px;
  resize: vertical;
}

.form-control:hover,
.form-select:hover {
  border-color: var(--border-strong);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
  background: var(--bg-surface);
}

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

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger-500);
}

.form-control.is-invalid:focus {
  box-shadow: var(--shadow-focus-danger);
}

.form-control-sm,
.form-select-sm {
  padding: 6px 10px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
}

.form-label {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}

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

.form-help {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}

.invalid-feedback {
  display: block;
  font-size: var(--fs-xs);
  color: var(--danger-600);
  margin-top: 4px;
  font-weight: 500;
}

/* Custom select arrow */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23475569'%3E%3Cpath d='M3.204 5h9.592L8 10.481 3.204 5zm-.753.659l4.796 5.48a1 1 0 0 0 1.506 0l4.796-5.48c.566-.647.106-1.659-.753-1.659H3.204a1 1 0 0 0-.753 1.659z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}

/* Checkbox / radio */
.form-check {
  padding-left: 1.75em;
  min-height: 22px;
}

.form-check-input {
  width: 1.1em;
  height: 1.1em;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  margin-top: 0.2em;
  margin-left: -1.75em;
  cursor: pointer;
  transition: var(--transition);
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

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

.form-check-input:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}

.form-check-label {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  cursor: pointer;
}

/* Input group */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: var(--fs-sm);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}

.input-group .form-control:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group>.btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group>.btn:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}

/* Search box (icon prefix) */
.search-box {
  position: relative;
}

.search-box .bi-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-box .form-control {
  padding-left: 36px;
}

/* Form section (group of fields) */
.form-section {
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

/* ────────────────────────────────────────────────────────────
   BUTTONS
   ──────────────────────────────────────────────────────────── */
.btn {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--duration-fast) ease,
    color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) ease;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  line-height: 1.45;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  box-shadow: var(--shadow-focus);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  font-size: var(--fs-xs);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.btn-lg {
  font-size: var(--fs-md);
  padding: 11px 22px;
  border-radius: var(--radius-md);
}

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

/* Primary */
.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
  background: var(--brand-800);
  border-color: var(--brand-800);
  color: #fff;
}

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

.btn-success:hover {
  background: var(--success-700);
  border-color: var(--success-700);
  color: #fff;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

/* Warning */
.btn-warning {
  background: var(--warning-600);
  color: #fff;
  border-color: var(--warning-600);
}

.btn-warning:hover {
  background: var(--warning-700);
  border-color: var(--warning-700);
  color: #fff;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.25);
}

/* Danger */
.btn-danger {
  background: var(--danger-600);
  color: #fff;
  border-color: var(--danger-600);
}

.btn-danger:hover {
  background: var(--danger-700);
  border-color: var(--danger-700);
  color: #fff;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}

/* Info */
.btn-info {
  background: var(--info-600);
  color: #fff;
  border-color: var(--info-600);
}

.btn-info:hover {
  background: var(--info-700);
  border-color: var(--info-700);
  color: #fff;
}

/* Secondary (neutral) */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

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

/* Outline variants */
.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-info,
.btn-outline-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

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

.btn-outline-primary:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}

.btn-outline-success {
  color: var(--success);
}

.btn-outline-success:hover {
  background: var(--success-50);
  border-color: var(--success-100);
  color: var(--success-700);
}

.btn-outline-warning {
  color: var(--warning);
}

.btn-outline-warning:hover {
  background: var(--warning-50);
  border-color: var(--warning-100);
  color: var(--warning-700);
}

.btn-outline-danger {
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger-50);
  border-color: var(--danger-100);
  color: var(--danger-700);
}

.btn-outline-info {
  color: var(--info);
}

.btn-outline-info:hover {
  background: var(--info-50);
  border-color: var(--info-100);
  color: var(--info-700);
}

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

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

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

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

/* Action button (in tables) */
.btn-action {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-action.is-primary {
  color: var(--primary);
}

.btn-action.is-primary:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.btn-action.is-warning {
  color: var(--warning);
}

.btn-action.is-warning:hover {
  background: var(--warning-50);
  border-color: var(--warning-100);
}

.btn-action.is-danger {
  color: var(--danger);
}

.btn-action.is-danger:hover {
  background: var(--danger-50);
  border-color: var(--danger-100);
}

/* Action group (cluster of icon buttons) */
.action-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* ────────────────────────────────────────────────────────────
   BADGES (status pills)
   ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status pills */
.badge-free {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-on-work {
  background: var(--danger-50);
  color: var(--danger-700);
}

.badge-initiated {
  background: var(--info-50);
  color: var(--info-700);
}

.badge-pending {
  background: var(--warning-50);
  color: var(--warning-700);
}

.badge-in-progress {
  background: var(--purple-50);
  color: var(--purple-700);
}

.badge-in_progress {
  background: var(--purple-50);
  color: var(--purple-700);
}

.badge-completed {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-received {
  background: var(--success-50);
  color: var(--success-700);
}

/* Generic semantic */
.bg-primary {
  background: var(--primary) !important;
  color: #fff !important;
}

.bg-success {
  background: var(--success) !important;
  color: #fff !important;
}

.bg-warning {
  background: var(--warning) !important;
  color: #1f1402 !important;
}

.bg-danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.bg-info {
  background: var(--info) !important;
  color: #fff !important;
}

.bg-secondary {
  background: var(--gray-500) !important;
  color: #fff !important;
}

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

.bg-dark {
  background: var(--gray-900) !important;
  color: #fff !important;
}

.bg-primary-subtle {
  background: var(--brand-50) !important;
}

.bg-success-subtle {
  background: var(--success-50) !important;
}

.bg-warning-subtle {
  background: var(--warning-50) !important;
}

.bg-danger-subtle {
  background: var(--danger-50) !important;
}

.bg-info-subtle {
  background: var(--info-50) !important;
}

.bg-secondary-subtle {
  background: var(--bg-subtle) !important;
}

/* ────────────────────────────────────────────────────────────
   ALERTS / FLASH MESSAGES
   ──────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
  position: relative;
}

.alert .bi {
  font-size: 1.05rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.alert .btn-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1rem;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.alert .btn-close:hover {
  opacity: 1;
}

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

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

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

.alert-info {
  background: var(--info-50);
  color: var(--info-700);
  border-color: var(--info-100);
}

.alert-light {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.messages-wrapper {
  padding: var(--space-3) var(--space-7) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ────────────────────────────────────────────────────────────
   AUTH PAGES
   ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.18) 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(124, 58, 237, 0.16) 0%, transparent 35%),
    linear-gradient(135deg, #0b1220 0%, #0f172a 50%, #1e293b 100%);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-2xl);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 40px 36px;
  position: relative;
  z-index: 1;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto var(--space-5);
  box-shadow: 0 12px 24px -8px rgba(37, 99, 235, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  text-align: center;
  margin: 0 0 var(--space-7);
}

/* ────────────────────────────────────────────────────────────
   STAGE PROGRESS (Job detail stepper)
   ──────────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  flex-wrap: nowrap;
}

.stepper-item {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

.stepper-marker {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
}

.stepper-marker.is-done {
  background: var(--success-100);
  color: var(--success-700);
}

.stepper-marker.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.stepper-marker.is-idle {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.stepper-text {
  margin-left: var(--space-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.stepper-text.is-done {
  color: var(--success-700);
}

.stepper-text.is-active {
  color: var(--primary);
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 var(--space-2);
  min-width: 16px;
}

.stepper-line.is-done {
  background: var(--success-500);
}

/* ────────────────────────────────────────────────────────────
   STAR RATING
   ──────────────────────────────────────────────────────────── */
#id_customer_rating {
  display: none;
}

#star-display {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

#star-display .bi {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-300);
  transition: transform var(--duration-fast) ease, color var(--duration-fast) ease;
}

#star-display .bi.filled {
  color: var(--warning-500);
}

#star-display .bi:hover {
  transform: scale(1.18);
  color: var(--warning-500);
}

/* ────────────────────────────────────────────────────────────
   LIST GROUP
   ──────────────────────────────────────────────────────────── */
.list-group {
  display: flex;
  flex-direction: column;
}

.list-group-item {
  background: var(--bg-surface);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px var(--space-4);
  font-size: var(--fs-sm);
  transition: background var(--duration-fast) ease;
  cursor: pointer;
}

.list-group-item:last-child {
  border-bottom: 0;
}

.list-group-item:hover {
  background: var(--bg-subtle);
}

.list-group-flush>.list-group-item {
  border-radius: 0;
}

/* ────────────────────────────────────────────────────────────
   DEFINITION TABLE (label / value pairs)
   ──────────────────────────────────────────────────────────── */
.def-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.def-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.def-row:last-child {
  border-bottom: 0;
}

.def-row dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-tertiary);
  margin: 0;
}

.def-row dd {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  margin: 0;
  word-break: break-word;
}

@media (max-width: 575.98px) {
  .def-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 8px 0;
  }
}

/* ────────────────────────────────────────────────────────────
   STAGE PANEL (collapsible job stage section)
   ──────────────────────────────────────────────────────────── */
.stage-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.stage-panel-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast) ease;
}

.stage-panel-head:hover {
  background: var(--bg-subtle);
}

.stage-panel-head .bi-chevron {
  margin-left: auto;
  transition: transform var(--duration) var(--ease-in-out);
  color: var(--text-tertiary);
}

.stage-panel.is-open .stage-panel-head .bi-chevron {
  transform: rotate(180deg);
}

.stage-panel-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.stage-panel-num.is-success {
  background: var(--success-100);
  color: var(--success-700);
}

.stage-panel-num.is-primary {
  background: var(--brand-100);
  color: var(--brand-700);
}

.stage-panel-num.is-warning {
  background: var(--warning-100);
  color: var(--warning-700);
}

.stage-panel-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.stage-panel-sub {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin: 2px 0 0;
}

.stage-panel-body {
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
}

/* ────────────────────────────────────────────────────────────
   FILTER BAR
   ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: end;
  margin-top: var(--space-4);
}

.filter-bar>* {
  min-width: 0;
}

.filter-bar .filter-search {
  flex: 1 1 280px;
}

.filter-bar .filter-select {
  flex: 0 0 160px;
  min-width: 130px;
}

.filter-bar .filter-actions {
  display: flex;
  gap: var(--space-2);
}

@media (max-width: 575.98px) {
  .filter-bar>* {
    flex: 1 1 100%;
  }
}

/* ────────────────────────────────────────────────────────────
   DIVIDER LABEL
   ──────────────────────────────────────────────────────────── */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  margin: var(--space-4) 0;
  font-weight: 500;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ────────────────────────────────────────────────────────────
   TOGGLE PASSWORD VISIBILITY BUTTON
   ──────────────────────────────────────────────────────────── */
.pw-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-left: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 12px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

/* ────────────────────────────────────────────────────────────
   UTILITY
   ──────────────────────────────────────────────────────────── */
.rounded-lg {
  border-radius: var(--radius-lg) !important;
}

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

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

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

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

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

.shadow-none {
  box-shadow: none !important;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

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

/* Skeleton loading */
.skeleton {
  display: inline-block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gray-150) 25%, var(--gray-100) 50%, var(--gray-150) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

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

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

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.animate-fade-in {
  animation: fadeInUp var(--duration-slow) var(--ease-out) both;
}

/* ────────────────────────────────────────────────────────────
   MODALS
   ──────────────────────────────────────────────────────────── */
.modal-content {
  border: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-2xl);
}

.modal-backdrop.show {
  opacity: 0.45;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background-color: #0f172a;
}

.modal-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.5rem 1.75rem;
}

.modal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.25rem 1.75rem;
}

.modal-body {
  padding: 1.75rem;
}

.modal .btn-close {
  background-color: var(--bg-subtle);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  opacity: 0.8;
  transition: all var(--duration-fast);
}

.modal .btn-close:hover {
  opacity: 1;
  background-color: var(--gray-200);
}

.role-select-card {
  cursor: pointer;
  border-color: var(--border) !important;
}

.form-check-input:checked + .role-select-card {
  border-color: var(--brand-500) !important;
  background-color: var(--brand-50) !important;
}

.form-check-input:checked + .role-select-card .role-check-indicator {
  background-color: var(--brand-500);
  border-color: var(--brand-500) !important;
}

.role-check-indicator {
  transition: all var(--duration-fast) ease;
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  .main-content {
    padding: var(--space-6) var(--space-6);
  }

  .top-navbar {
    padding: 0 var(--space-6);
  }

  .messages-wrapper {
    padding: var(--space-3) var(--space-6) 0;
  }
}

@media (max-width: 991.98px) {
  #sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-xl);
  }

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

  #sidebar-wrapper.collapsed {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }

  .main-content {
    padding: var(--space-5) var(--space-4);
  }

  .top-navbar {
    padding: 0 var(--space-4);
  }

  .messages-wrapper {
    padding: var(--space-3) var(--space-4) 0;
  }

  .navbar-page-title {
    font-size: var(--fs-base);
  }
}

@media (max-width: 575.98px) {
  :root {
    --navbar-h: 60px;
  }

  .auth-card {
    padding: 28px 22px;
    border-radius: var(--radius-xl);
  }

  .main-content {
    padding: var(--space-4) var(--space-3);
  }

  .top-navbar {
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }

  .messages-wrapper {
    padding: var(--space-2) var(--space-3) 0;
  }

  .page-header {
    gap: var(--space-2);
  }

  .page-header h1,
  .page-header h2,
  .page-header h3,
  .page-header h4 {
    font-size: 1.125rem;
  }

  .card-header {
    padding: var(--space-4) !important;
  }

  .card-body {
    padding: var(--space-4);
  }

  .stat-card {
    padding: var(--space-4);
  }

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

  .table thead th:first-child,
  .table tbody td:first-child {
    padding-left: var(--space-4);
  }

  .table thead th:last-child,
  .table tbody td:last-child {
    padding-right: var(--space-4);
  }

  .user-name {
    display: none;
  }
}

/* Desktop collapsed sidebar — icons only */
@media (min-width: 992px) {
  #sidebar-wrapper.collapsed {
    width: var(--sidebar-w-collapsed);
  }

  #sidebar-wrapper.collapsed .sidebar-brand {
    padding: 0;
    justify-content: center;
  }

  #sidebar-wrapper.collapsed .sidebar-brand-meta,
  #sidebar-wrapper.collapsed .sidebar-section,
  #sidebar-wrapper.collapsed .sidebar-link-text,
  #sidebar-wrapper.collapsed .nav-badge,
  #sidebar-wrapper.collapsed .sidebar-user-text {
    display: none;
  }

  #sidebar-wrapper.collapsed .sidebar-link {
    justify-content: center;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    margin-left: var(--space-2);
    margin-right: var(--space-2);
  }

  #sidebar-wrapper.collapsed .sidebar-link.active::before {
    left: -2px;
    top: 25%;
    bottom: 25%;
  }

  #sidebar-wrapper.collapsed .sidebar-user {
    justify-content: center;
    padding: var(--space-2);
  }

  #sidebar-wrapper.collapsed .sidebar-user-avatar {
    margin: 0;
  }
}

/* ────────────────────────────────────────────────────────────
   PRINT
   ──────────────────────────────────────────────────────────── */
@media print {
  body {
    background: #fff !important;
  }

  #sidebar-wrapper,
  #sidebar-backdrop,
  .top-navbar,
  .sidebar-toggle-btn,
  .no-print,
  .site-footer {
    display: none !important;
  }

  #page-content-wrapper {
    margin: 0;
  }

  .main-content {
    padding: 0;
    max-width: none;
  }

  .card,
  .stat-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ────────────────────────────────────────────────────────────
   BS5 OVERRIDES — keep markup compatible
   ──────────────────────────────────────────────────────────── */
.row {
  --bs-gutter-x: 1.25rem;
}

.g-3 {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}

.g-4 {
  --bs-gutter-x: 1.25rem;
  --bs-gutter-y: 1.25rem;
}

.fs-1 {
  font-size: 1.875rem !important;
}

.fs-2 {
  font-size: 1.5rem !important;
}

.fs-3 {
  font-size: 1.25rem !important;
}

.fs-4 {
  font-size: 1.125rem !important;
}

.fs-5 {
  font-size: 1rem !important;
}

.fs-6 {
  font-size: 0.875rem !important;
}

/* Bootstrap collapse — used on stage panels */
.collapse:not(.show) {
  display: none;
}

/* Soft border */
.border {
  border: 1px solid var(--border) !important;
}

.border-0 {
  border: 0 !important;
}

.border-bottom {
  border-bottom: 1px solid var(--border) !important;
}

.border-top {
  border-top: 1px solid var(--border) !important;
}

/* ────────────────────────────────────────────────────────────
   ANIMATIONS & PREMIUM UI
   ──────────────────────────────────────────────────────────── */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

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

@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.5;
  }

  to {
    transform: scale(4);
    opacity: 0;
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s var(--ease-out) forwards;
}

.animate-fade-out {
  animation: fadeOut 0.3s var(--ease-in-out) forwards;
}

.animate-slide-in {
  animation: slideInRight 0.4s var(--ease-out) forwards;
}

/* Button Ripple */
.btn {
  position: relative;
  overflow: hidden;
}

.btn-ripple {
  position: absolute;
  background: rgba(255, 255, 255, 0.3);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: ripple 0.6s linear forwards;
}

/* Glassmorphism */
.glass-panel {
  background: rgba(255, 255, 255, 0.7) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.glass-dark {
  background: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Hover Effects */
.hover-elevate {
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.hover-elevate:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg) !important;
}

.hover-glow:hover {
  box-shadow: 0 0 15px var(--brand-200);
}

/* Table Enhancements */
.table-hover tbody tr {
  transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
  background-color: var(--brand-50) !important;
}

/* Form Polishing */
.form-control,
.form-select {
  border: 1px solid var(--border);
  padding: 0.6rem 0.875rem;
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-100);
  outline: none;
}

.input-group-text {
  background-color: var(--gray-50);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}

/* Custom Badges */
.badge-pill {
  padding: 0.35em 0.8em;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.75rem;
}

.badge-soft-primary {
  background: var(--brand-50);
  color: var(--brand-700);
}

.badge-soft-success {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-soft-warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.badge-soft-danger {
  background: var(--danger-50);
  color: var(--danger-700);
}

.badge-soft-info {
  background: var(--info-50);
  color: var(--info-700);
}

.badge-soft-secondary {
  background: #e9ecef;
  color: #495057;
}
/* ------------------------------------------------------------
   SOFT BACKGROUND UTILITIES
   ------------------------------------------------------------ */
.bg-primary-soft { background-color: var(--brand-50) !important; color: var(--brand-700) !important; }
.bg-success-soft { background-color: var(--success-50) !important; color: var(--success-700) !important; }
.bg-warning-soft { background-color: var(--warning-50) !important; color: var(--warning-700) !important; }
.bg-danger-soft  { background-color: var(--danger-50) !important; color: var(--danger-700) !important; }
.bg-info-soft    { background-color: var(--info-50) !important; color: var(--info-700) !important; }
.bg-purple-soft  { background-color: var(--purple-50) !important; color: var(--purple-700) !important; }
.bg-white-glass  { background-color: rgba(255, 255, 255, 0.1) !important; backdrop-filter: blur(4px); }


.focus-within-ring:focus-within {
  border-color: var(--brand-400) !important;
  box-shadow: 0 0 0 3px rgba(52, 116, 180, 0.1);
  transition: all 0.2s ease;
}

