/**
 * ============================================================================
 * FAMIORA ADMIN PORTAL - MATERIAL DESIGN 3 THEME SYSTEM
 * Color Theme: Modern Material 3 Medical (Vibrant Indigo & Crisp Medical Teal)
 * ============================================================================
 */

:root {
  /* ------------------------------------------------------------------------
   * 1. MATERIAL 3 COLOR PALETTE (HEALTH & CLINICAL)
   * ------------------------------------------------------------------------ */
  /* Primary: Vibrant Royal Indigo */
  --md-primary: #4f46e5;
  --md-primary-rgb: 79, 70, 229;
  --md-primary-dark: #4338ca;
  --md-primary-hover: #3730a3;
  --md-primary-light: #eef2ff;
  --md-on-primary: #ffffff;
  --md-primary-container: #e0e7ff;
  --md-on-primary-container: #312e81;

  /* Secondary: Crisp Medical Teal */
  --md-secondary: #0d9488;
  --md-secondary-rgb: 13, 148, 136;
  --md-secondary-dark: #0f766e;
  --md-secondary-light: #f0fdfa;
  --md-on-secondary: #ffffff;
  --md-secondary-container: #ccfbf1;
  --md-on-secondary-container: #115e59;

  /* Tertiary / Accents */
  --md-tertiary: #0284c7;
  --md-tertiary-light: #f0f9ff;
  --md-tertiary-container: #e0f2fe;
  --md-on-tertiary-container: #075985;

  /* Semantic Feedback Tokens */
  --md-success: #10b981;
  --md-success-dark: #059669;
  --md-success-light: #ecfdf5;
  --md-warning: #f59e0b;
  --md-warning-dark: #d97706;
  --md-warning-light: #fffbeb;
  --md-error: #ef4444;
  --md-error-dark: #dc2626;
  --md-error-light: #fef2f2;
  --md-purple: #8b5cf6;
  --md-purple-light: #f5f3ff;
  --md-pink: #ec4899;
  --md-pink-light: #fdf2f8;

  /* Neutral Canvas & Surfaces */
  --md-bg: #f8fafc;
  --md-surface: #ffffff;
  --md-surface-dim: #f1f5f9;
  --md-surface-container: #f8fafc;
  --md-surface-container-high: #f1f5f9;
  --md-surface-container-highest: #e2e8f0;

  /* Text & Border Tokens */
  --md-text: #0f172a;
  --md-text-muted: #64748b;
  --md-text-subtle: #94a3b8;
  --md-border: #e2e8f0;
  --md-border-strong: #cbd5e1;

  /* Material 3 Drawer (Slate Navy) */
  --sidebar-bg-start: #0b1120;
  --sidebar-bg-end: #0f172a;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --sidebar-active-text: #ffffff;
  --sidebar-active-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);

  /* ------------------------------------------------------------------------
   * 2. BACKWARD COMPATIBILITY TOKENS (For all existing views)
   * ------------------------------------------------------------------------ */
  --navy: var(--sidebar-bg-start);
  --navy-light: var(--sidebar-bg-end);
  --teal: var(--md-primary);
  --teal-dark: var(--md-primary-dark);
  --teal-light: var(--md-primary-light);
  --pink: var(--md-pink);
  --blue: var(--md-tertiary);
  --purple: var(--md-purple);
  --orange: var(--md-warning);
  --red: var(--md-error);
  --green: var(--md-success);
  --bg: var(--md-bg);
  --surface: var(--md-surface);
  --text: var(--md-text);
  --text-muted: var(--md-text-muted);
  --border: var(--md-border);

  /* ------------------------------------------------------------------------
   * 3. MATERIAL 3 SHAPE & ELEVATIONS
   * ------------------------------------------------------------------------ */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --card-radius: 18px;

  /* Material 3 Multi-Layer Shadows (Ambient + Key Light) */
  --elevation-0: none;
  --elevation-1: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --elevation-2: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.03);
  --elevation-3: 0 10px 24px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --elevation-4: 0 18px 36px rgba(15, 23, 42, 0.12), 0 6px 12px rgba(15, 23, 42, 0.05);
  --elevation-5: 0 24px 50px rgba(15, 23, 42, 0.16), 0 10px 20px rgba(15, 23, 42, 0.08);

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  min-height: 100%;
  background: var(--md-bg);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--md-text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  text-decoration: none;
  color: var(--md-primary);
  transition: var(--transition-fast);
}
a:hover {
  color: var(--md-primary-dark);
}

::selection {
  background: var(--md-primary);
  color: #ffffff;
}

/* Material 3 Keyboard Focus Indicator */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.quick-action:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

/* Material 3 Slim Themed Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ------------------------------------------------------------------------
 * 5. MATERIAL RIPPLE EFFECT
 * ------------------------------------------------------------------------ */
.md-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: mdRippleAnimation 0.6s linear;
  pointer-events: none;
}
.md-ripple-light {
  background: rgba(255, 255, 255, 0.35);
}
.md-ripple-primary {
  background: rgba(79, 70, 229, 0.2);
}
@keyframes mdRippleAnimation {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ------------------------------------------------------------------------
 * 6. APP SHELL & MATERIAL NAVIGATION DRAWER
 * ------------------------------------------------------------------------ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Mobile Scrim / Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1035;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* Sidebar Navigation Drawer */
.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1040;
  box-shadow: var(--elevation-3);
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--sidebar-border);
  gap: 12px;
}

.sidebar-logo {
  max-width: 170px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Mobile Close Button inside Drawer */
.sidebar-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 24px;
}

.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  padding: 18px 22px 8px;
  font-weight: 700;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 6px 12px;
}
.sidebar-nav li {
  margin-bottom: 3px;
}
.sidebar-nav a,
.sidebar-nav button.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  color: var(--sidebar-text);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition-normal);
  position: relative;
  text-decoration: none;
}
.sidebar-nav button.sidebar-logout-btn {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.sidebar-nav a i,
.sidebar-nav button.sidebar-logout-btn i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: #94a3b8;
  transition: var(--transition-fast);
}

.sidebar-nav a:hover,
.sidebar-nav button.sidebar-logout-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--sidebar-text-hover);
  transform: translateX(2px);
}
.sidebar-nav a:hover i,
.sidebar-nav button.sidebar-logout-btn:hover i {
  color: #ffffff;
}

/* Material 3 Active Capsule Pill */
.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: var(--sidebar-active-shadow);
  font-weight: 600;
}
.sidebar-nav a.active i {
  color: #ffffff;
}

.badge-dot-count {
  margin-left: auto;
  background: var(--md-error);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
}

/* ------------------------------------------------------------------------
 * 7. MAIN CONTENT & MATERIAL 3 TOPBAR
 * ------------------------------------------------------------------------ */
.main-content {
  margin-left: 270px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--md-border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--elevation-1);
}

/* Material 3 Pill Search Bar */
.topbar .search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
}
.topbar .search-box input {
  width: 100%;
  border: 1px solid var(--md-border);
  background: var(--md-surface-dim);
  border-radius: var(--radius-full);
  padding: 9px 16px 9px 40px;
  font-size: 0.9rem;
  color: var(--md-text);
  transition: var(--transition-fast);
}
.topbar .search-box input:focus {
  outline: none;
  border-color: var(--md-primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.topbar .search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-text-muted);
  font-size: 0.95rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Material 3 Circular Icon Button */
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--md-surface-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--md-text);
  font-size: 1.1rem;
  border: 1px solid var(--md-border);
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-btn:hover {
  background: var(--md-primary-light);
  color: var(--md-primary);
  border-color: rgba(79, 70, 229, 0.2);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn .badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--md-error);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.35);
}

/* Profile Chip */
.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--md-border);
  background: #ffffff;
  transition: var(--transition-fast);
}
.profile-chip:hover {
  background: var(--md-surface-dim);
  border-color: var(--md-border-strong);
}
.profile-chip .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--md-primary), var(--md-secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.28);
}
.profile-chip .name {
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.2;
}
.profile-chip .role {
  font-size: 0.72rem;
  color: var(--md-text-muted);
}

/* Dropdown Menu (Material 3 Skinned) */
.dropdown-menu {
  border-radius: var(--radius-md);
  border: 1px solid var(--md-border);
  box-shadow: var(--elevation-3);
  padding: 6px;
  min-width: 180px;
  background: #ffffff;
  animation: mdDropdownPop 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes mdDropdownPop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--md-text);
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
}
.dropdown-item:hover {
  background: var(--md-primary-light);
  color: var(--md-primary);
}
.dropdown-divider {
  border-color: var(--md-border);
  margin: 4px 0;
}

/* ------------------------------------------------------------------------
 * 8. PAGE BODY & HEADERS
 * ------------------------------------------------------------------------ */
.page-body {
  padding: 24px 28px 60px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--md-text);
}
.page-header .subtitle {
  color: var(--md-text-muted);
  font-size: 0.86rem;
  margin-top: 3px;
}

/* ------------------------------------------------------------------------
 * 9. MATERIAL 3 CARDS & STAT TILES
 * ------------------------------------------------------------------------ */
.card-tile {
  background: var(--md-surface);
  border-radius: var(--card-radius);
  border: 1px solid var(--md-border);
  padding: 22px;
  box-shadow: var(--elevation-1);
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}
.card-tile:hover {
  box-shadow: var(--elevation-2);
}

.stat-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-radius: var(--card-radius);
  height: 100%;
}
.stat-card .stat-label {
  color: var(--md-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.stat-card .stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--md-text);
}
.stat-card .stat-delta {
  font-size: 0.76rem;
  margin-top: 8px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stat-card .stat-delta.up {
  color: var(--md-success-dark);
  background: var(--md-success-light);
}
.stat-card .stat-delta.down {
  color: var(--md-error-dark);
  background: var(--md-error-light);
}

/* Material Squircle Stat Icons */
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.teal, .stat-icon.indigo {
  background: var(--md-primary-light);
  color: var(--md-primary);
}
.stat-icon.blue {
  background: var(--md-tertiary-light);
  color: var(--md-tertiary);
}
.stat-icon.green {
  background: var(--md-success-light);
  color: var(--md-success);
}
.stat-icon.purple {
  background: var(--md-purple-light);
  color: var(--md-purple);
}
.stat-icon.orange {
  background: var(--md-warning-light);
  color: var(--md-warning);
}
.stat-icon.red {
  background: var(--md-error-light);
  color: var(--md-error);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title-row h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--md-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title-row a {
  font-size: 0.84rem;
  color: var(--md-primary);
  font-weight: 600;
}
.card-title-row a:hover {
  text-decoration: underline;
}

/* Section Headings */
.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--md-border);
}
.section-heading i {
  font-size: 1rem;
}

/* ------------------------------------------------------------------------
 * 10. MATERIAL 3 BUTTONS
 * ------------------------------------------------------------------------ */
.btn {
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 18px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.btn:active {
  transform: scale(0.97);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-full);
}
.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* Primary Filled Button (Indigo / Teal theme) */
.btn-teal,
.btn-primary {
  background: linear-gradient(135deg, var(--md-primary) 0%, var(--md-primary-dark) 100%);
  border-color: var(--md-primary);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.btn-teal:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, var(--md-primary-dark) 0%, var(--md-primary-hover) 100%);
  border-color: var(--md-primary-dark);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.42);
  transform: translateY(-1px);
}

/* Outlined Button */
.btn-outline-teal,
.btn-outline-primary {
  border: 1.5px solid var(--md-primary);
  color: var(--md-primary) !important;
  background: transparent;
}
.btn-outline-teal:hover,
.btn-outline-primary:hover {
  background: var(--md-primary-light);
  color: var(--md-primary-dark) !important;
  border-color: var(--md-primary);
}

/* Light / Secondary Buttons */
.btn-light {
  background: var(--md-surface-dim);
  border-color: var(--md-border);
  color: var(--md-text);
}
.btn-light:hover {
  background: var(--md-surface-container-highest);
  border-color: var(--md-border-strong);
  color: var(--md-text);
}
.btn-outline-secondary {
  border: 1.5px solid var(--md-border-strong);
  color: var(--md-text-muted);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--md-surface-dim);
  border-color: var(--md-text-muted);
  color: var(--md-text);
}

/* Filter Button with Animated Badge */
.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.btn-filter .filter-count {
  background: linear-gradient(135deg, var(--md-primary), var(--md-purple));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  animation: mdFilterCountPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mdFilterCountPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Quick Action Tiles */
.quick-action {
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  border: 1px solid var(--md-border);
  display: block;
  background: var(--md-surface);
  transition: var(--transition-normal);
  text-decoration: none;
}
.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: var(--elevation-3);
  border-color: rgba(79, 70, 229, 0.25);
}
.quick-action i {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
  color: var(--md-primary);
}
.quick-action span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--md-text);
}

/* ------------------------------------------------------------------------
 * 11. MATERIAL 3 INPUTS & FORMS
 * ------------------------------------------------------------------------ */
.form-card {
  background: var(--md-surface);
  border-radius: var(--card-radius);
  border: 1px solid var(--md-border);
  padding: 28px;
  box-shadow: var(--elevation-1);
}
.form-label {
  font-weight: 600;
  font-size: 0.84rem;
  margin-bottom: 6px;
  color: var(--md-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--md-border-strong);
  background-color: #ffffff;
  color: var(--md-text);
  font-size: 0.9rem;
  padding: 9px 14px;
  transition: var(--transition-fast);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--md-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}
textarea.form-control {
  border-radius: var(--radius-sm);
}

/* Repeatable Cards in Forms */
.repeatable-card {
  background: var(--md-surface-dim);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
}
.repeatable-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--md-border-strong);
}
.repeatable-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--md-text);
}
.repeatable-card-title i {
  color: var(--md-primary);
  margin-right: 4px;
}

/* Sticky Live Preview Card */
.live-preview-card {
  position: sticky;
  top: 80px;
}
.live-preview-card .photo-preview {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--md-border-strong);
}
.live-preview-card .preview-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 10px;
}
.live-preview-card .preview-meta {
  color: var(--md-text-muted);
  font-size: 0.82rem;
}
.live-preview-card .preview-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--md-border);
  font-size: 0.84rem;
}

/* Live Preview Bar (Horizontal Strip) */
.live-preview-bar {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--md-surface-dim);
  border: 1px solid var(--md-border);
}

/* Form Tabs */
.form-card .nav-tabs {
  border-bottom: 2px solid var(--md-border);
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.form-card .nav-tabs .nav-link {
  color: var(--md-text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  white-space: nowrap;
  background: transparent;
  transition: var(--transition-fast);
}
.form-card .nav-tabs .nav-link.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
  background: transparent;
}
.form-card .nav-tabs .nav-link:hover:not(.active) {
  color: var(--md-text);
}

/* Nav Pills (Settings / Tabs) */
.nav-pills {
  gap: 8px;
}
.nav-pills .nav-link {
  color: var(--md-text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  transition: var(--transition-fast);
}
.nav-pills .nav-link:hover:not(.btn-teal):not(.active) {
  background: var(--md-primary-light);
  color: var(--md-primary);
  border-color: rgba(79, 70, 229, 0.2);
}
.nav-pills .nav-link.btn-teal,
.nav-pills .nav-link.active {
  background: var(--md-primary) !important;
  color: #ffffff !important;
  border-color: var(--md-primary) !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* ------------------------------------------------------------------------
 * 12. MATERIAL 3 DATA TABLES & STATUS CHIPS
 * ------------------------------------------------------------------------ */
.table-responsive {
  border-radius: var(--radius-md);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.table-clean {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}
.table-clean thead th {
  text-align: left;
  color: var(--md-text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 13px 16px;
  border-bottom: 2px solid var(--md-border);
  background: var(--md-surface-dim);
  white-space: nowrap;
}
.table-clean thead tr:first-child th:first-child {
  border-top-left-radius: var(--radius-sm);
}
.table-clean thead tr:first-child th:last-child {
  border-top-right-radius: var(--radius-sm);
}
.table-clean tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-border);
  vertical-align: middle;
  color: var(--md-text);
}
.table-clean tbody tr:last-child td {
  border-bottom: none;
}
.table-clean tbody tr {
  transition: background 0.15s ease;
}
.table-clean tbody tr:hover {
  background: rgba(79, 70, 229, 0.025);
}

/* Small Avatar in Table Rows */
.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--md-primary), var(--md-secondary));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  margin-right: 10px;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.22);
}

/* Status Pills (Material 3 Assist & Status Chips) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
}
.pill-green {
  background: var(--md-success-light);
  color: var(--md-success-dark);
}
.pill-blue {
  background: var(--md-tertiary-light);
  color: var(--md-tertiary);
}
.pill-red {
  background: var(--md-error-light);
  color: var(--md-error-dark);
}
.pill-yellow {
  background: var(--md-warning-light);
  color: var(--md-warning-dark);
}
.pill-purple {
  background: var(--md-purple-light);
  color: var(--md-purple);
}
.pill-gray {
  background: var(--md-surface-dim);
  color: var(--md-text-muted);
}

/* Sortable Headers */
.table-clean thead th a.sort-link {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.table-clean thead th a.sort-link:hover {
  color: var(--md-primary);
}
.sort-icon {
  font-size: 0.65rem;
}
.sort-icon.active {
  color: var(--md-primary);
}
.sort-icon:not(.active) {
  opacity: 0.35;
}

/* ------------------------------------------------------------------------
 * 13. MATERIAL 3 PAGINATION
 * ------------------------------------------------------------------------ */
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  margin-top: 6px;
  border-top: 1px solid var(--md-border);
}
.pager-bar .pagination .page-link {
  color: var(--md-text);
  border-color: var(--md-border);
  border-radius: var(--radius-sm);
  margin: 0 2px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}
.pager-bar .pagination .page-link:hover {
  background: var(--md-primary-light);
  color: var(--md-primary);
  border-color: rgba(79, 70, 229, 0.2);
}
.pager-bar .pagination .page-item.active .page-link {
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.32);
}
.pager-bar .pagination .page-item.disabled .page-link {
  color: var(--md-text-subtle);
  background: transparent;
  border-color: var(--md-border);
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.toolbar-row .page-size-col {
  min-width: 150px;
}

/* ------------------------------------------------------------------------
 * 14. MATERIAL 3 OFFCANVAS FILTER DRAWER
 * ------------------------------------------------------------------------ */
.offcanvas.offcanvas-end {
  width: 420px;
  max-width: 94vw;
  border: none;
  border-top-left-radius: var(--radius-xl);
  border-bottom-left-radius: var(--radius-xl);
  box-shadow: -10px 0 45px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.offcanvas-backdrop.show {
  opacity: 0.6;
  background: #0f172a;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.offcanvas-header {
  padding: 22px 26px;
  background: linear-gradient(135deg, var(--sidebar-bg-start) 0%, var(--md-primary-dark) 100%);
  position: relative;
  overflow: hidden;
}
.offcanvas-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  position: relative;
  z-index: 1;
}
.offcanvas-title i {
  color: #ffffff;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}
.offcanvas-header .btn-close {
  filter: none;
  background: rgba(255, 255, 255, 0.18) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1rem auto no-repeat;
  border-radius: 50%;
  opacity: 1;
  width: 32px;
  height: 32px;
  position: relative;
  z-index: 1;
  transition: var(--transition-fast);
}
.offcanvas-header .btn-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.offcanvas-body {
  padding: 24px 26px;
  background: var(--md-surface);
}
.drawer-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--md-border);
  display: flex;
  gap: 12px;
  background: var(--md-surface-dim);
}
.drawer-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--md-primary);
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-section-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--md-primary);
}
.drawer-section-label:first-child {
  margin-top: 0;
}

/* ------------------------------------------------------------------------
 * 15. SELECT2 & FLATPICKR MATERIAL STYLING
 * ------------------------------------------------------------------------ */
.select2-container--bootstrap-5 .select2-selection {
  border: 1.5px solid var(--md-border-strong) !important;
  min-height: 40px !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--md-primary) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14) !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
  background-color: var(--md-primary) !important;
  color: #ffffff !important;
}
.select2-container--bootstrap-5 .select2-selection__choice {
  background-color: var(--md-primary-light) !important;
  color: var(--md-primary-dark) !important;
  border-color: rgba(79, 70, 229, 0.2) !important;
  border-radius: var(--radius-full) !important;
  font-weight: 600;
}
.select2-container--bootstrap-5 .select2-dropdown {
  border: 1px solid var(--md-border) !important;
  box-shadow: var(--elevation-4) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}

/* Flatpickr Calendar Material 3 Override */
.flatpickr-calendar {
  box-shadow: var(--elevation-4) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--md-border) !important;
  overflow: hidden;
  font-family: inherit !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--md-primary) !important;
  border-color: var(--md-primary) !important;
  color: #fff !important;
}
.flatpickr-day.today {
  border-color: var(--md-primary) !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-weekdays {
  background: var(--sidebar-bg-start) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year,
span.flatpickr-weekday {
  color: #fff !important;
  background: transparent !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  fill: #fff !important;
  color: #fff !important;
}

/* Custom Checkboxes */
.form-check-input {
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.18em;
  cursor: pointer;
  border: 1.5px solid var(--md-border-strong);
}
.form-check-input:checked {
  background-color: var(--md-primary);
  border-color: var(--md-primary);
}
.form-check-input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.form-check-label {
  cursor: pointer;
  font-size: 0.88rem;
}

/* Modals */
.modal-content {
  border-radius: var(--radius-xl);
  border: 1px solid var(--md-border);
  box-shadow: var(--elevation-5);
}
.modal-header {
  border-bottom: 1px solid var(--md-border);
  padding: 20px 24px;
}
.modal-title {
  font-weight: 700;
  font-size: 1.1rem;
}
.modal-body {
  padding: 22px 24px;
}
.modal-footer {
  border-top: 1px solid var(--md-border);
  padding: 16px 24px;
  background: var(--md-surface-dim);
}

/* Alerts */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  box-shadow: var(--elevation-1);
}
.alert-success {
  background: var(--md-success-light);
  color: var(--md-success-dark);
  border-color: rgba(16, 185, 129, 0.25);
}
.alert-danger {
  background: var(--md-error-light);
  color: var(--md-error-dark);
  border-color: rgba(239, 68, 68, 0.25);
}

/* ------------------------------------------------------------------------
 * 16. AUTH / LOGIN PAGE
 * ------------------------------------------------------------------------ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #0b1120 70%, #020617 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.22), transparent 70%);
  pointer-events: none;
}
.auth-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  padding: 42px 36px;
  box-shadow: var(--elevation-5);
  position: relative;
  z-index: 1;
}
.auth-logo {
  max-width: 200px;
  height: auto;
  margin: 0 auto;
}

/* ------------------------------------------------------------------------
 * 17. CHAT & SUPPORT THREAD
 * ------------------------------------------------------------------------ */
.chat-thread {
  height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 4px;
}
.chat-bubble-row {
  display: flex;
  justify-content: flex-start;
}
.chat-bubble-row.mine {
  justify-content: flex-end;
}
.chat-bubble {
  max-width: 75%;
  padding: 10px 15px;
  border-radius: 18px;
  background: var(--md-surface-dim);
  border: 1px solid var(--md-border);
  font-size: 0.9rem;
  box-shadow: var(--elevation-1);
}
.chat-bubble-row.mine .chat-bubble {
  background: var(--md-primary);
  color: #ffffff;
  border-color: var(--md-primary);
  border-bottom-right-radius: 4px;
}
.chat-bubble-row:not(.mine) .chat-bubble {
  border-bottom-left-radius: 4px;
}
.chat-bubble.bot {
  background: var(--md-primary-light);
  border-color: rgba(79, 70, 229, 0.2);
  color: var(--md-primary-dark);
}

/* ------------------------------------------------------------------------
 * 18. COMPREHENSIVE RESPONSIVE BREAKPOINTS (MOBILE & TABLET EXCELLENCE)
 * ------------------------------------------------------------------------ */

/* Tablets & Down (< 992px) */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .topbar .search-box {
    display: none;
  }
  .live-preview-card {
    position: static;
  }
}

/* Tablet Portrait & Large Phone (< 768px) */
@media (max-width: 767.98px) {
  .page-body {
    padding: 18px 16px 48px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .page-header {
    margin-bottom: 18px;
  }
  .page-header h1 {
    font-size: 1.25rem;
  }
  .form-card,
  .card-tile {
    padding: 18px 16px;
  }
  .stat-card .stat-value {
    font-size: 1.4rem;
  }
  .offcanvas.offcanvas-end {
    width: 100%;
    max-width: 100vw;
    border-radius: 0;
  }
  .table-clean thead th,
  .table-clean tbody td {
    padding: 10px 12px;
  }
}

/* Mobile Phones (< 576px) */
@media (max-width: 575.98px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-header > div:last-child {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .page-header .btn,
  .page-header a.btn {
    flex: 1;
  }
  .topbar-right {
    gap: 8px;
  }
  .profile-chip {
    padding: 2px;
  }
  .table-clean {
    font-size: 0.82rem;
  }
  .table-clean thead th,
  .table-clean tbody td {
    padding: 9px 8px;
  }
  .quick-action {
    padding: 14px 10px;
  }
  .quick-action i {
    font-size: 1.3rem;
  }
  .quick-action span {
    font-size: 0.76rem;
  }
  .auth-card {
    padding: 32px 22px;
  }
  .stat-card .stat-value {
    font-size: 1.25rem;
  }
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-row .page-size-col {
    min-width: 0;
    width: 100%;
  }
  .pager-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ------------------------------------------------------------------------
 * 19. MATERIAL FORM TABS (NO HORIZONTAL SCROLL) & SYMMETRIC FORM STYLING
 * ------------------------------------------------------------------------ */
.material-form-tabs.nav,
.material-form-tabs {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  border: none;
  overflow: visible !important;
}
.material-form-tabs .nav-item {
  width: 100%;
}
.material-form-tabs .nav-link {
  width: 100%;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 10px !important;
  border-radius: var(--radius-md) !important;
  background: var(--md-surface-dim);
  border: 1px solid var(--md-border) !important;
  color: var(--md-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  gap: 6px;
  transition: var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  user-select: none;
}
.material-form-tabs .nav-link i {
  font-size: 0.95rem;
  color: var(--md-text-muted);
  transition: var(--transition-fast);
  flex-shrink: 0;
  pointer-events: none;
}
.material-form-tabs .nav-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.material-form-tabs .nav-link:hover:not(.active) {
  background: var(--md-primary-light);
  color: var(--md-primary);
  border-color: rgba(79, 70, 229, 0.3) !important;
}
.material-form-tabs .nav-link:hover:not(.active) i {
  color: var(--md-primary);
}
.material-form-tabs .nav-link.active {
  background: linear-gradient(135deg, var(--md-primary) 0%, var(--md-primary-dark) 100%) !important;
  color: #ffffff !important;
  border-color: var(--md-primary) !important;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.32) !important;
}
.material-form-tabs .nav-link.active i {
  color: #ffffff !important;
}

.material-form-tabs.tabs-5 {
  grid-template-columns: repeat(5, 1fr) !important;
}

@media (max-width: 991.98px) {
  .material-form-tabs.nav,
  .material-form-tabs {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .material-form-tabs.tabs-5 {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 575.98px) {
  .material-form-tabs.nav,
  .material-form-tabs,
  .material-form-tabs.tabs-5 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Symmetric Form Sections */
.form-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--md-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--md-text);
  letter-spacing: -0.01em;
}
.form-section-header i {
  color: var(--md-primary);
  font-size: 1.15rem;
}

.photo-upload-symmetric {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 24px;
  background: var(--md-surface-dim);
  border-radius: var(--radius-md);
  border: 1px dashed var(--md-border-strong);
  margin-bottom: 24px;
}
.photo-upload-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--md-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--md-text-muted);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--elevation-1);
}
.photo-upload-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Symmetric Document Cards */
.document-card-symmetric {
  background: var(--md-surface-dim);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-fast);
}
.document-card-symmetric:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: var(--elevation-1);
}

/* ------------------------------------------------------------------------
 * 20. DASHBOARD MATERIAL REFINEMENTS
 * ------------------------------------------------------------------------ */
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--card-radius);
  box-shadow: var(--elevation-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
  border-color: rgba(79, 70, 229, 0.3);
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: var(--transition-fast);
}
.stat-card.color-blue::after, .stat-card.color-indigo::after { background: var(--md-primary); }
.stat-card.color-green::after { background: var(--md-success); }
.stat-card.color-teal::after { background: var(--md-secondary); }
.stat-card.color-purple::after { background: var(--md-purple); }
.stat-card.color-orange::after { background: var(--md-warning); }
.stat-card.color-red::after { background: var(--md-error); }

.stat-card .stat-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--md-text-muted);
}
.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--md-text);
  margin: 4px 0;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}
.stat-card .stat-delta.up {
  background: var(--md-success-light);
  color: var(--md-success-dark);
}
.stat-card .stat-delta.down {
  background: var(--md-error-light);
  color: var(--md-error-dark);
}

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

/* Material Progress Indicators */
.progress-material {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--md-surface-container-high);
  overflow: hidden;
}
.progress-material .progress-bar {
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

/* Quick Actions in Dashboard */
.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 575.98px) {
  .dashboard-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
 * 11. CATALOG PRICING & SERVICE SELECTION MATERIAL 3 STYLES
 * -------------------------------------------------------------------------- */
.catalog-pricing-card {
  background: var(--md-surface, #ffffff);
  border: 1px solid var(--md-border, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

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

.catalog-pricing-table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 13px 14px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.catalog-pricing-table tbody td {
  padding: 11px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

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

.catalog-pricing-table tbody tr:hover td {
  background-color: #fafbfd;
}

/* Material 3 Custom Select */
.catalog-select {
  display: block;
  width: 100%;
  height: 40px;
  padding: 8px 36px 8px 13px;
  font-size: 0.86rem;
  font-weight: 500;
  color: #1e293b;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  line-height: 1.4;
}

.catalog-select:hover {
  border-color: #94a3b8;
  background-color: #f8fafc;
}

.catalog-select:focus {
  border-color: var(--md-primary, #4f46e5);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
  background-color: #ffffff;
}

.catalog-select option {
  color: #0f172a;
  padding: 8px 10px;
  background: #ffffff;
}

/* Master Fixed Price Read-Only Display Badge */
.master-price-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 8px 14px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-weight: 700;
  color: #334155;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.master-price-badge .currency-sym {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Offered Price Custom Input Group */
.offered-price-group {
  display: flex;
  align-items: stretch;
  height: 40px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.offered-price-group:hover {
  border-color: #94a3b8;
}

.offered-price-group:focus-within {
  border-color: var(--md-secondary, #0d9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.offered-price-group .price-prefix {
  background: #f0fdfa;
  color: #0d9488;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border-right: 1.5px solid #ccfbf1;
  user-select: none;
}

.offered-price-group .offered-price-input {
  border: none;
  outline: none;
  padding: 6px 12px;
  width: 100%;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f766e;
  background: transparent;
}

.offered-price-group .offered-price-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Delete Row Action Button */
.btn-delete-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #fee2e2;
  background: #fff5f5;
  color: #ef4444;
  font-size: 0.95rem;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  padding: 0;
}

.btn-delete-row:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

/* Add Service Row Button */
.btn-add-service-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.86rem;
  background: #f0fdfa;
  color: #0d9488;
  border: 1.5px dashed #0d9488;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.btn-add-service-row:hover {
  background: #0d9488;
  color: #ffffff;
  border-style: solid;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
  transform: translateY(-1px);
}

/* Catalog Profile Display Styles */
.pill-teal {
  background: var(--md-secondary-light, #f0fdfa);
  color: var(--md-secondary-dark, #0f766e);
}
.pill-indigo {
  background: var(--md-primary-light, #eef2ff);
  color: var(--md-primary-dark, #4338ca);
}

.catalog-tag-service {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-xs, 6px);
  background: var(--md-primary-light, #eef2ff);
  color: var(--md-primary, #4f46e5);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.catalog-price-fixed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-weight: 600;
  color: #475569;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.catalog-price-offered {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 800;
  color: var(--md-secondary-dark, #0f766e);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.catalog-special-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


