/* ===================================================
   Singh Auto & Tyres – Workshop Management System
   Global Design System & CSS
   =================================================== */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Primary Colors - Deep Blue Workshop Theme */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Accent / Orange (Workshop vibe) */
  --accent-50: #fff7ed;
  --accent-100: #ffedd5;
  --accent-200: #fed7aa;
  --accent-300: #fdba74;
  --accent-400: #fb923c;
  --accent-500: #f97316;
  --accent-600: #ea580c;
  --accent-700: #c2410c;

  /* Success / Green */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;

  /* Warning / Yellow */
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  /* Danger / Red */
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  /* Neutral / Gray */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Font */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ========================
     SEMANTIC THEME VARIABLES
     Dark theme (default)
     ======================== */

  /* Page background */
  --bg-body: linear-gradient(135deg, #0f1729 0%, #121e33 50%, #0d1423 100%);
  --bg-body-flat: #0f1729;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-tertiary: rgba(255, 255, 255, 0.45);
  --text-placeholder: rgba(255, 255, 255, 0.25);

  /* Cards & Surfaces */
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-bg-hover: rgba(255, 255, 255, 0.07);
  --card-backdrop: blur(12px);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-hover: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Sidebar */
  --sidebar-bg: linear-gradient(180deg, rgba(15, 23, 42, 0.97) 0%, rgba(10, 14, 26, 0.98) 100%);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Header */
  --header-bg: rgba(15, 23, 42, 0.75);
  --header-border: rgba(255, 255, 255, 0.06);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.07);
  --border-color-strong: rgba(255, 255, 255, 0.12);

  /* Inputs */
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-bg-focus: rgba(255, 255, 255, 0.09);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-border-focus: rgba(59, 130, 246, 0.5);

  /* Interactive elements */
  --hover-bg: rgba(255, 255, 255, 0.06);
  --hover-bg-strong: rgba(255, 255, 255, 0.1);
  --active-bg: rgba(255, 255, 255, 0.08);

  /* Table */
  --table-header-bg: rgba(255, 255, 255, 0.03);
  --table-row-hover: rgba(255, 255, 255, 0.04);
  --table-row-divider: rgba(255, 255, 255, 0.04);

  /* Modal (dark default) */
  --modal-bg: #1e293b;
  --modal-overlay: rgba(0, 0, 0, 0.75);

  /* Dropdown */
  --dropdown-bg: #1e293b;
  --dropdown-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Badges (dark) */
  --badge-created-bg: rgba(255, 255, 255, 0.08);
  --badge-created-text: rgba(255, 255, 255, 0.6);

  /* Focus glow */
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.12),
    0 0 16px rgba(59, 130, 246, 0.06);

  /* Select dropdown */
  --select-option-bg: #1e293b;
}

/* ========================
   LIGHT THEME OVERRIDE
   ======================== */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-body-flat: #f8fafc;

  --text-primary: #0f1729;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-placeholder: #cbd5e1;

  --card-bg: #ffffff;
  --card-bg-hover: #f1f5f9;
  --card-border: #e2e8f0;
  --card-border-hover: #cbd5e1;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;

  --header-bg: #ffffff;
  --header-border: #e2e8f0;

  --border-color: #e2e8f0;
  --border-color-strong: #cbd5e1;

  --input-bg: #ffffff;
  --input-bg-focus: #f8fafc;
  --input-border: #cbd5e1;
  --input-border-focus: #3b82f6;

  --hover-bg: #f1f5f9;
  --hover-bg-strong: #e2e8f0;
  --active-bg: #cbd5e1;

  --table-header-bg: #f8fafc;
  --table-row-hover: #f8fafc;
  --table-row-divider: #e2e8f0;

  --modal-bg: #ffffff;
  --modal-overlay: rgba(0, 0, 0, 0.5);

  --dropdown-bg: #ffffff;
  --dropdown-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --badge-created-bg: #f1f5f9;
  --badge-created-text: #64748b;

  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.3);

  --select-option-bg: #ffffff;
}


/* Light-theme header text overrides (header content is on light bg) */
[data-theme="light"] .header-btn .badge {
  border-color: var(--bg-body-flat);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.4s ease, color 0.3s ease;
}

/* ========================
   THEME TOGGLE BUTTON
   ======================== */
.theme-toggle-btn {
  position: relative;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.theme-toggle-btn:hover {
  background: var(--hover-bg-strong);
  border-color: var(--border-color-strong);
  transform: scale(1.08);
}

.theme-toggle-track {
  position: relative;
  width: 20px;
  height: 20px;
}

.theme-icon {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark mode: show moon, hide sun */
.theme-toggle-btn.is-dark .theme-icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.theme-toggle-btn.is-dark .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #fbbf24;
}

/* Light mode: show sun, hide moon */
.theme-toggle-btn.is-light .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #f59e0b;
}

.theme-toggle-btn.is-light .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}


a {
  text-decoration: none;
  color: inherit;
}

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

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

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

/* --- Loading Screen --- */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1rem;
  color: var(--text-tertiary);
  background: var(--bg-body);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

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

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }

  50% {
    opacity: 0.8;
    transform: translateY(-50%) scale(1.15);
  }
}

/* --- App Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-base);
}

.app-main.collapsed {
  margin-left: var(--sidebar-collapsed-width);
}

.app-content {
  flex: 1;
  padding: 24px;
  margin-top: var(--header-height);
  width: 100%;
}

/* --- Sidebar --- */
/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

/* Brand */
.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
  position: relative;
}

.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
}

.brand-logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-brand {
  padding: 12px 8px;
  justify-content: center;
}

.sidebar.collapsed .brand-logo {
  height: 32px;
  width: 48px;
}

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

.sidebar-section-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray-500);
  padding: 18px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* ---- Nav Links (Premium) ---- */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gray-400);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  margin-bottom: 3px;
  position: relative;
  overflow: hidden;
}

/* Subtle hover glow background */
.sidebar-link::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.06));
  transition: opacity 0.25s ease;
}

.sidebar-link:hover::before {
  opacity: 1;
}

.sidebar-link:hover {
  color: #fff;
  transform: translateX(3px);
}

.sidebar-link:hover .sidebar-link-icon {
  color: var(--primary-400);
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
}

/* Active link — glowing pill (green matching logo) */
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.35), rgba(16, 185, 129, 0.25)) !important;
  color: #fff !important;
  border: 1px solid rgba(34, 197, 94, 0.5) !important;
  box-shadow:
    0 0 18px rgba(34, 197, 94, 0.4),
    0 0 40px rgba(34, 197, 94, 0.15),
    inset 0 0 0 1px rgba(74, 222, 128, 0.15) !important;
  animation: sidebarGlow 2s ease-in-out infinite alternate !important;
  transform: none !important;
}

.sidebar-link.active::before {
  display: none !important;
}

@keyframes sidebarGlow {
  from {
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.3), 0 0 28px rgba(34, 197, 94, 0.12), inset 0 0 0 1px rgba(74, 222, 128, 0.1);
  }

  to {
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.5), 0 0 50px rgba(34, 197, 94, 0.2), inset 0 0 0 1px rgba(74, 222, 128, 0.2);
  }
}

.sidebar-link.active .sidebar-link-icon {
  color: #4ade80 !important;
  filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.7)) !important;
}

.sidebar-link.active .sidebar-link-text {
  color: #fff !important;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

/* Active link left accent bar */
.sidebar-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #22c55e, #10b981);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

/* Icon */
.sidebar-link-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  transition: all 0.25s ease;
}

/* Text */
.sidebar-link-text {
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed .sidebar-link-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Booking Badge */
.booking-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6), 0 0 16px rgba(34, 197, 94, 0.3);
  animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6), 0 0 16px rgba(34, 197, 94, 0.3);
  }

  50% {
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.8), 0 0 28px rgba(34, 197, 94, 0.5);
  }
}

.sidebar.collapsed .booking-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  font-size: 0.6rem;
  padding: 0 3px;
}

/* Collapsed: center icons */
.sidebar.collapsed .sidebar-link {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 12px 6px;
}

/* Toggle button */
.sidebar-toggle {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  justify-content: center;
  position: relative;
}

.sidebar-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2), transparent);
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--gray-400);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px;
  border-radius: 10px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.sidebar-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* Light theme sidebar adjustments */
[data-theme="light"] .sidebar-link:hover {
  color: var(--primary-700);
}

[data-theme="light"] .sidebar-link:hover .sidebar-link-icon {
  color: var(--primary-600);
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.2));
}

[data-theme="light"] .sidebar-link.active {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  border-color: #15803d !important;
  box-shadow:
    0 0 12px rgba(22, 163, 74, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
}

[data-theme="light"] .sidebar-link.active .sidebar-link-icon {
  color: #fff !important;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4)) !important;
}

[data-theme="light"] .sidebar-link.active .sidebar-link-text {
  color: #fff !important;
  text-shadow: none;
}

[data-theme="light"] .sidebar-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-600);
  border-color: rgba(59, 130, 246, 0.15);
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  transition: left var(--transition-base);
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-title p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

.header-btn {
  position: relative;
  background: none;
  color: var(--text-tertiary);
  padding: 8px;
  border-radius: var(--border-radius);
  font-size: 1.2rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}

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

.header-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger-500);
  border-radius: 100px;
  border: 2px solid var(--bg-body-flat);
  font-size: 0.6rem;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.header-user:hover {
  background: var(--hover-bg);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
  overflow: hidden;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-avatar.has-photo {
  background: none;
  box-shadow: 0 0 0 2px var(--border-color);
}

.header-user-info {
  text-align: left;
}

.header-user-info .name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-user-info .role {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

.mobile-menu-btn {
  display: none;
  background: none;
  color: var(--gray-700);
  font-size: 1.5rem;
  padding: 4px;
}

/* --- Page Headers --- */

/* ========================
   PRINT STYLES
   ======================== */
@media print {
  :root {
    --bg-body: #ffffff !important;
    --bg-body-flat: #ffffff !important;
    --text-primary: #000000 !important;
    --text-secondary: #333333 !important;
    --text-tertiary: #666666 !important;
    --card-bg: #ffffff !important;
    --card-border: #dddddd !important;
    --table-header-bg: #f8f9fa !important;
    --border-color: #dddddd !important;
  }

  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .no-print,
  .sidebar,
  .header,
  .theme-toggle-btn {
    display: none !important;
  }

  .app-main {
    margin: 0 !important;
  }

  .app-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice-paper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
}

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

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

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

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

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

/* Two-column card grid (Dashboard, Reports) */
.dashboard-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Four-column stats grid (Reports) */
.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.blue::before {
  background: linear-gradient(180deg, var(--primary-400), var(--primary-600));
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.stat-card.green::before {
  background: linear-gradient(180deg, var(--success-500), #059669);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.stat-card.orange::before {
  background: linear-gradient(180deg, var(--accent-400), var(--accent-600));
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

.stat-card.red::before {
  background: linear-gradient(180deg, var(--danger-500), #b91c1c);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.stat-card.purple::before {
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

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

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

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-400);
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success-500);
}

.stat-icon.orange {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-400);
}

.stat-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-500);
}

.stat-icon.purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.stat-info h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.45);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--success-600), var(--success-700));
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--danger-600), var(--danger-700));
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
  color: #fff;
}

.btn-outline {
  background: var(--card-bg);
  border: 1px solid var(--border-color-strong);
  color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--hover-bg-strong);
  border-color: var(--border-color-strong);
}

.btn-ghost {
  background: none;
  color: var(--text-tertiary);
  padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--active-bg);
  color: var(--text-secondary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--border-radius);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--input-bg);
  transition: all 0.25s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--focus-ring);
  background: var(--input-bg-focus);
}

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

/* Password eye toggle */
.pw-wrap {
  position: relative;
}

.pw-wrap .form-input {
  padding-right: 42px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

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

.form-select {
  color: var(--text-secondary);
}

.form-select option {
  background: var(--select-option-bg);
  color: var(--text-primary);
}

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

.form-error {
  font-size: 0.75rem;
  color: var(--danger-500);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* --- Service Type Pills --- */
.service-type-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  user-select: none;
}

.service-type-option:hover {
  background-color: var(--hover-bg);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}

.service-type-option input:checked+span {
  color: #fff;
  font-weight: 500;
}

.service-type-option.selected {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

/* --- Tables --- */
.table-container {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--card-border);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.table-search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.table-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  background: var(--input-bg);
  color: var(--text-primary);
}

.table-search input::placeholder {
  color: var(--text-placeholder);
}

.table-search input:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--focus-ring);
}

.table-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.table-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-filters select {
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--input-bg);
}

.table-filters select option {
  background: var(--select-option-bg);
  color: var(--text-primary);
}

/* --- Table Inputs (Invoice Editor) --- */
.table-input {
  width: 100%;
  padding: 8px 12px;
  min-height: 48px;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.table-input:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: var(--focus-ring);
  background: var(--input-bg-focus);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 16px 24px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--table-row-divider);
  transition: background 0.2s;
}

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

.data-table tr:hover td {
  background: var(--table-row-hover);
}

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

.table-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.table-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.table-pagination {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-created {
  background: var(--badge-created-bg);
  color: var(--badge-created-text);
}

.badge-pending {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
}

.badge-confirmed {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-in-progress {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-waiting {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.badge-completed {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.badge-invoiced {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.badge-paid {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-unpaid {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.badge-low-stock {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.badge-in-stock {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.badge-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.badge-inactive {
  background: var(--badge-created-bg);
  color: var(--badge-created-text);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Invoice Editor Layout --- */
.editor-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.panel {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: all 0.3s ease;
}

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

.panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--table-header-bg);
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.panel-body {
  padding: 32px;
}

.panel-footer {
  padding: 16px 32px;
  background: var(--card-bg);
  /* Match body or slightly different */
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.invoice-totals-wrapper {
  width: 100%;
  max-width: 300px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.totals-row .label {
  font-weight: 500;
}

.totals-row .value {
  font-weight: 600;
  color: var(--text-primary);
}

.totals-row.grand {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  font-size: 1.1rem;
  color: var(--primary-600);
}

.totals-row.grand .value {
  color: var(--primary-600);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.notes-editor {
  width: 100%;
  height: 120px;
  padding: 16px;
  background: transparent;
  border: none;
  resize: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.notes-editor:focus {
  outline: none;
  background: var(--input-bg-focus);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn var(--transition-fast);
  padding: 20px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--modal-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--border-radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--transition-base);
  box-shadow: var(--dropdown-shadow);
}

.modal-lg {
  max-width: 720px;
}

.modal-xl {
  max-width: 900px;
}

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

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

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

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  color: var(--text-tertiary);
  font-size: 1.25rem;
  padding: 4px;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  display: flex;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-secondary);
}

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

/* Force label visibility in modals */
/* We use !important to override any specific component styles that might be interfering */
.modal .form-label {
  color: var(--text-primary) !important;
}

/* Explicit fallback for dark mode */
[data-theme="dark"] .modal .form-label,
:root:not([data-theme="light"]) .modal .form-label {
  color: #ffffff !important;
}

/* ==================================================
   AUTH PAGES – Split-Screen Premium
   ================================================== */

.ap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #060a14;
  overflow: hidden;
}

.ap-left,
.ap-right {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* ═══ DECORATIVE PANEL ═══ */
.ap-deco {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ap-deco-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(124, 58, 237, 0.3), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(59, 130, 246, 0.25), transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(236, 72, 153, 0.1), transparent 40%),
    radial-gradient(ellipse at 70% 30%, rgba(34, 197, 94, 0.06), transparent 30%),
    linear-gradient(160deg, #080d1e 0%, #0e1530 40%, #0a0f20 100%);
}

/* Animated grid overlay */
.ap-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  animation: apGridPulse 5s ease-in-out infinite;
}

@keyframes apGridPulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

/* Glowing orbs — bigger and brighter */
.ap-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.ap-glow-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.4), transparent 65%);
  filter: blur(70px);
  top: 0%;
  left: 5%;
  animation: apGlow 7s ease-in-out infinite;
}

.ap-glow-2 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 65%);
  filter: blur(60px);
  bottom: 5%;
  right: 0%;
  animation: apGlow 9s ease-in-out infinite 2s;
}

.ap-glow-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.25), transparent 65%);
  filter: blur(50px);
  top: 40%;
  left: 40%;
  animation: apGlow 11s ease-in-out infinite 4s;
}

.ap-glow-4 {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.18), transparent 65%);
  filter: blur(45px);
  top: 20%;
  right: 20%;
  animation: apGlow 13s ease-in-out infinite 6s;
}

@keyframes apGlow {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1) translate(0, 0);
  }

  33% {
    opacity: 1;
    transform: scale(1.2) translate(15px, -20px);
  }

  66% {
    opacity: 0.7;
    transform: scale(1.1) translate(-12px, 12px);
  }
}

/* Floating SVG icons — bigger, more visible */
.ap-icon {
  position: absolute;
  pointer-events: none;
}

.ap-icon-1 {
  width: 80px;
  top: 6%;
  left: 8%;
  color: rgba(167, 139, 250, 0.3);
  filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.25));
  animation: apFloat 14s ease-in-out infinite;
}

.ap-icon-2 {
  width: 100px;
  bottom: 18%;
  right: 5%;
  color: rgba(96, 165, 250, 0.25);
  filter: drop-shadow(0 0 18px rgba(59, 130, 246, 0.2));
  animation: apFloat 16s ease-in-out infinite 1.5s;
}

.ap-icon-3 {
  width: 70px;
  top: 50%;
  left: 3%;
  color: rgba(251, 191, 36, 0.2);
  filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.15));
  animation: apSpin 25s linear infinite, apFloat 12s ease-in-out infinite 1s;
}

.ap-icon-4 {
  width: 65px;
  top: 10%;
  right: 12%;
  color: rgba(34, 197, 94, 0.22);
  filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.15));
  animation: apSpin 30s linear infinite reverse, apFloat 18s ease-in-out infinite 3s;
}

.ap-icon-5 {
  width: 60px;
  bottom: 45%;
  right: 3%;
  color: rgba(251, 146, 60, 0.2);
  filter: drop-shadow(0 0 14px rgba(251, 146, 60, 0.15));
  animation: apFloat 15s ease-in-out infinite 4s;
}

.ap-icon-6 {
  width: 55px;
  bottom: 8%;
  left: 25%;
  color: rgba(96, 165, 250, 0.18);
  filter: drop-shadow(0 0 12px rgba(96, 165, 250, 0.12));
  animation: apFloat 13s ease-in-out infinite 2s;
}

.ap-icon-7 {
  width: 50px;
  top: 30%;
  left: 20%;
  color: rgba(236, 72, 153, 0.16);
  filter: drop-shadow(0 0 12px rgba(236, 72, 153, 0.1));
  animation: apFloat 17s ease-in-out infinite 5s;
}

.ap-icon-8 {
  width: 45px;
  bottom: 30%;
  right: 20%;
  color: rgba(167, 139, 250, 0.16);
  filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.1));
  animation: apFloat 11s ease-in-out infinite 3.5s;
}

@keyframes apFloat {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  25% {
    transform: translate(15px, -22px) rotate(6deg);
  }

  50% {
    transform: translate(-10px, 14px) rotate(-4deg);
  }

  75% {
    transform: translate(8px, -8px) rotate(3deg);
  }
}

@keyframes apSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Deco content */
.ap-deco-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px;
  max-width: 380px;
}

.ap-deco-logo {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  color: #a78bfa;
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.2), 0 0 80px rgba(124, 58, 237, 0.08);
  animation: apLogoPulse 3s ease-in-out infinite;
}

.ap-logo-outer {
  animation: apSpin 15s linear infinite;
  transform-origin: center;
}

.ap-logo-mid {
  animation: apSpin 10s linear infinite reverse;
  transform-origin: center;
}

@keyframes apLogoPulse {

  0%,
  100% {
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.2), 0 0 80px rgba(124, 58, 237, 0.08);
  }

  50% {
    box-shadow: 0 0 60px rgba(124, 58, 237, 0.35), 0 0 100px rgba(124, 58, 237, 0.15);
  }
}

.ap-deco-content h2 {
  font-size: 2.4rem;
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ap-deco-content p {
  font-size: 0.95rem;
  color: rgba(203, 213, 225, 0.6);
  line-height: 1.7;
  margin: 0 0 36px;
}

/* Feature list with icons */
.ap-deco-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
}

.ap-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: rgba(203, 213, 225, 0.7);
  font-weight: 500;
  width: 200px;
}

.ap-feat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ap-feat-icon svg {
  width: 16px;
  height: 16px;
  color: #a78bfa;
}

/* ═══ ANIMATED BADGE ═══ */
.ap-badge-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
}

.ap-badge-svg {
  width: 56px;
  height: 56px;
}

.ap-badge-ring {
  animation: apBadgeSpinOuter 8s linear infinite;
  transform-origin: center;
}

.ap-badge-ring-inner {
  animation: apBadgeSpinOuter 6s linear infinite reverse;
  transform-origin: center;
}

.ap-badge-center {
  animation: apBadgePulse 2.5s ease-in-out infinite;
  transform-origin: center;
}

.ap-badge-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
  filter: blur(12px);
  animation: apBadgeGlow 3s ease-in-out infinite;
}

@keyframes apBadgeSpinOuter {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes apBadgePulse {

  0%,
  100% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }
}

@keyframes apBadgeGlow {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.15);
  }
}

/* ═══ FORM PANEL ═══ */
.ap-form-panel {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(124, 58, 237, 0.05), transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(59, 130, 246, 0.03), transparent 50%),
    rgba(8, 12, 24, 0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.ap-form-inner {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
}

.ap-form-inner h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.ap-subtitle {
  font-size: 0.88rem;
  color: rgba(148, 163, 184, 0.6);
  margin: 0 0 32px;
}

/* Error */
.ap-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 20px;
  animation: apShake 0.4s ease;
}

@keyframes apShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

/* ═══ FIELDS — fully visible labels ═══ */
.ap-field {
  margin-bottom: 18px;
}

.ap-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(203, 213, 225, 0.85);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ap-input {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0 16px;
  transition: all 0.3s ease;
}

.ap-input:focus-within {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow:
    0 0 0 3px rgba(124, 58, 237, 0.1),
    0 0 28px rgba(124, 58, 237, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.ap-input svg {
  color: rgba(148, 163, 184, 0.45);
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: color 0.3s;
}

.ap-input:focus-within svg {
  color: #a78bfa;
}

.ap-input input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 14px 0;
  color: #f1f5f9;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
}

.ap-input input::placeholder {
  color: rgba(148, 163, 184, 0.35);
}

/* ═══ BUTTONS ═══ */
.ap-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ap-btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1, #818cf8);
  background-size: 200% 200%;
  animation: apGrad 4s ease infinite;
  color: #fff;
  box-shadow: 0 4px 22px rgba(124, 58, 237, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  margin-top: 8px;
}

@keyframes apGrad {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.ap-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px rgba(124, 58, 237, 0.55), 0 0 60px rgba(124, 58, 237, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ap-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.ap-btn-google {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ap-btn-google:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ap-btn-google svg {
  font-size: 1.2rem;
}

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

.ap-btn-spin {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══ DIVIDER — more visible ═══ */
.ap-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
}

.ap-divider::before,
.ap-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.ap-divider span {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(203, 213, 225, 0.55);
  letter-spacing: 0.1em;
}

/* ═══ TOGGLE ═══ */
.ap-toggle {
  text-align: center;
  font-size: 0.84rem;
  color: rgba(148, 163, 184, 0.5);
  margin-top: 28px;
}

.ap-toggle button {
  background: none;
  border: none;
  color: #818cf8;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.84rem;
  font-family: inherit;
  transition: all 0.2s;
  padding: 0;
}

.ap-toggle button:hover {
  color: #a5b4fc;
  text-decoration: underline;
  text-shadow: 0 0 14px rgba(129, 140, 248, 0.4);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .ap {
    grid-template-columns: 1fr;
  }

  .ap-login .ap-left,
  .ap-signup .ap-right {
    display: none;
  }

  .ap-form-inner {
    padding: 36px 28px;
  }
}

@media (max-width: 480px) {
  .ap-form-inner {
    padding: 28px 20px;
  }

  .ap-form-inner h1 {
    font-size: 1.5rem;
  }
}

/* ═══ LIGHT THEME ═══ */
[data-theme="light"] .ap {
  background: #f0f2f8;
}

[data-theme="light"] .ap-deco-bg {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(124, 58, 237, 0.12), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(59, 130, 246, 0.1), transparent 45%),
    linear-gradient(160deg, #e8ecf4 0%, #dde3ef 40%, #e2e7f0 100%);
}

[data-theme="light"] .ap-grid-lines {
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.04) 1px, transparent 1px);
}

[data-theme="light"] .ap-glow-1 {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.14), transparent 65%);
}

[data-theme="light"] .ap-glow-2 {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1), transparent 65%);
}

[data-theme="light"] .ap-glow-3 {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.07), transparent 65%);
}

[data-theme="light"] .ap-glow-4 {
  background: radial-gradient(circle, rgba(34, 197, 94, 0.06), transparent 65%);
}

[data-theme="light"] .ap-icon-1 {
  color: rgba(124, 58, 237, 0.18);
}

[data-theme="light"] .ap-icon-2 {
  color: rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .ap-icon-3 {
  color: rgba(217, 119, 6, 0.12);
}

[data-theme="light"] .ap-icon-4 {
  color: rgba(34, 197, 94, 0.12);
}

[data-theme="light"] .ap-icon-5 {
  color: rgba(251, 146, 60, 0.12);
}

[data-theme="light"] .ap-icon-6 {
  color: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .ap-icon-7 {
  color: rgba(236, 72, 153, 0.1);
}

[data-theme="light"] .ap-icon-8 {
  color: rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .ap-deco-content h2 {
  background: linear-gradient(135deg, #1e293b 0%, #6366f1 60%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="light"] .ap-deco-content p {
  color: rgba(71, 85, 105, 0.65);
}

[data-theme="light"] .ap-feat {
  color: rgba(51, 65, 85, 0.7);
}

[data-theme="light"] .ap-deco-logo {
  background: rgba(124, 58, 237, 0.06);
  border-color: rgba(124, 58, 237, 0.12);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .ap-form-panel {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
}

[data-theme="light"] .ap-form-inner h1 {
  color: #1e293b;
}

[data-theme="light"] .ap-subtitle {
  color: rgba(71, 85, 105, 0.6);
}

[data-theme="light"] .ap-field label {
  color: rgba(30, 41, 59, 0.75);
}

[data-theme="light"] .ap-input {
  background: rgba(0, 0, 0, 0.025);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .ap-input:focus-within {
  background: #fff;
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.06), 0 0 20px rgba(124, 58, 237, 0.05);
}

[data-theme="light"] .ap-input input {
  color: #1e293b;
}

[data-theme="light"] .ap-input input::placeholder {
  color: rgba(71, 85, 105, 0.4);
}

[data-theme="light"] .ap-input svg {
  color: rgba(100, 116, 139, 0.5);
}

[data-theme="light"] .ap-divider::before,
[data-theme="light"] .ap-divider::after {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

[data-theme="light"] .ap-divider span {
  color: rgba(71, 85, 105, 0.5);
}

[data-theme="light"] .ap-btn-google {
  background: rgba(0, 0, 0, 0.03);
  color: #334155;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ap-btn-google:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .ap-error {
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
}

[data-theme="light"] .ap-toggle {
  color: rgba(71, 85, 105, 0.5);
}

[data-theme="light"] .ap-toggle button {
  color: #6366f1;
}

[data-theme="light"] .ap-badge-glow {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1), transparent 70%);
}


/* --- Dropdown Menu --- */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--dropdown-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--border-radius);
  box-shadow: var(--dropdown-shadow);
  min-width: 180px;
  padding: 4px;
  z-index: 150;
  animation: fadeIn var(--transition-fast);
}

.invoice-terms {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

/* ========================
   PRINT STYLES
   ======================== */
@media print {

  /* Hide UI elements */
  .sidebar,
  .header,
  .print-actions,
  .theme-toggle-btn,
  .table-toolbar,
  .page-header button {
    display: none !important;
  }

  /* Reset layout constraints */
  .app-main {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .app-content {
    margin-top: 0 !important;
    padding: 0 !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Invoice Paper Styling */
  .invoice-paper {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    background: #fff !important;
  }

  /* Ensure text is dark */
  .text-secondary,
  .text-tertiary {
    color: #333 !important;
  }

  /* Tables */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th,
  td {
    color: #000 !important;
    border-bottom: 1px solid #ddd !important;
  }

  /* Cards */
  .card,
  .invoice-print-container {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 100%;
  background: none;
  transition: background var(--transition-fast);
}

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

.dropdown-item.danger {
  color: var(--danger-500);
}

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

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  transition: all var(--transition-fast);
}

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

.tab.active {
  color: var(--primary-400);
  border-bottom-color: var(--primary-500);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-placeholder);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

/* --- Notification Dropdown --- */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  background: var(--dropdown-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--dropdown-shadow);
  z-index: 200;
}

.notification-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

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

.notification-item:hover {
  background: var(--hover-bg);
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.08);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.notification-content h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notification-content p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.notification-time {
  font-size: 0.7rem;
  color: var(--text-placeholder);
}

/* --- Job Detail Layout --- */
.job-detail {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.job-detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.job-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.job-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--card-border);
  overflow-x: auto;
}

.job-status-step {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.job-status-step .step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.job-status-step .step-dot.done {
  background: var(--success-500);
  color: #fff;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.job-status-step .step-dot.current {
  background: var(--primary-500);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 0 12px rgba(59, 130, 246, 0.3);
  animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {

  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 0 12px rgba(59, 130, 246, 0.3);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.1), 0 0 20px rgba(59, 130, 246, 0.4);
  }
}

.job-status-step .step-dot.pending {
  background: var(--hover-bg-strong);
  color: var(--text-tertiary);
}

.job-status-step .step-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.job-status-step .step-line {
  width: 32px;
  height: 2px;
  background: var(--border-color);
  flex-shrink: 0;
}

.job-status-step .step-line.done {
  background: var(--success-500);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

/* --- Items List (Labour / Parts) --- */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 100px 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.item-row:last-child {
  border-bottom: none;
}

.item-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 2px solid var(--border-color-strong);
  margin-top: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .job-detail {
    grid-template-columns: 1fr;
  }
}

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

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

  .app-main {
    margin-left: 0;
  }

  .header {
    left: 0;
  }

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

  .app-content {
    padding: 16px;
  }

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

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

  .dashboard-cards-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-search {
    max-width: 100%;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .header-user-info {
    display: none;
  }

  .modal {
    margin: 10px;
  }

  .item-row {
    grid-template-columns: 1fr 60px 80px 80px 32px;
    font-size: 0.8rem;
  }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* Sidebar close button — hidden on desktop */
.sidebar-close-btn {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-overlay.active {
    display: block;
  }

  /* Close button visible on mobile */
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--hover-bg, rgba(255, 255, 255, 0.06));
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 110;
    transition: all 0.2s;
  }

  .sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
  }
}

/* Extra-small screens */
@media (max-width: 480px) {
  .app-content {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stats-grid-4 {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 1.2rem;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-info h3 {
    font-size: 1.3rem;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .header-title p {
    display: none;
  }

  .auth-row {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   SETTINGS PAGE — Premium Redesign
   ======================================== */

/* Page wrapper */
.sp {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ═══ HERO BANNER ═══ */
.sp-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 140px;
}

.sp-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.15), transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(236, 72, 153, 0.08), transparent 50%),
    var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sp-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
}

/* Avatar — clean, no gradient ring */
.sp-avatar {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sp-avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.sp-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  letter-spacing: -0.02em;
}

.sp-avatar-hover {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}

.sp-avatar:hover .sp-avatar-hover {
  opacity: 1;
}

.sp-avatar-spin {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Hero info */
.sp-hero-info {
  flex: 1;
  min-width: 0;
}

.sp-hero-info h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.sp-hero-info p {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin: 3px 0 8px;
}

.sp-hero-badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 20px;
}

/* Hero action buttons */
.sp-hero-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ═══ SETTINGS GRID ═══ */
.sp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

/* ═══ CARDS ═══ */
.sp-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.sp-card:hover {
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
}

.sp-card-wide {
  grid-column: 1 / -1;
}

/* Card header */
.sp-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sp-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sp-card-icon.purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(168, 85, 247, 0.08));
  color: #a78bfa;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.12);
}

.sp-card-icon.blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(96, 165, 250, 0.08));
  color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.12);
}

.sp-card-icon.amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.08));
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.12);
}

.sp-card-head h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.sp-card-head p {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin: 2px 0 0;
}

/* ═══ FORM ELEMENTS ═══ */
.sp-field {
  margin-bottom: 16px;
}

.sp-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sp-field label svg {
  font-size: 0.8rem;
  opacity: 0.7;
}

.sp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sp-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.sp-field input,
.sp-field textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.87rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.sp-field input:focus,
.sp-field textarea:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.sp-field textarea {
  resize: vertical;
  min-height: 68px;
}

.sp-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Password field */
.sp-pass-wrap {
  position: relative;
}

.sp-pass-wrap input {
  padding-right: 40px;
}

.sp-pass-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  font-size: 1rem;
  transition: color 0.2s;
}

.sp-pass-eye:hover {
  color: var(--text-primary);
}

/* ═══ BUTTONS ═══ */
.sp-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sp-btn-purple {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  box-shadow: 0 3px 14px rgba(124, 58, 237, 0.3);
}

.sp-btn-purple:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.45);
}

.sp-btn-blue {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 3px 14px rgba(37, 99, 235, 0.3);
}

.sp-btn-blue:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.45);
}

.sp-btn-amber {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
  box-shadow: 0 3px 14px rgba(217, 119, 6, 0.3);
}

.sp-btn-amber:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(217, 119, 6, 0.45);
}

.sp-btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.sp-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.sp-btn-logout {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.1);
}

.sp-btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

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

.sp-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══ SKELETON ═══ */
.sp-skeleton {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-sk {
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--hover-bg) 25%, var(--hover-bg-strong) 50%, var(--hover-bg) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.sp-sk.tall {
  height: 72px;
}

.sp-sk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

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

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .sp-grid {
    grid-template-columns: 1fr;
  }

  .sp-hero-content {
    flex-wrap: wrap;
  }

  .sp-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .sp-hero-content {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }

  .sp-hero-actions {
    justify-content: center;
  }

  .sp-row,
  .sp-row-3 {
    grid-template-columns: 1fr;
  }

  .sp-card {
    padding: 20px;
  }

  .sp-avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }
}

/* ═══ LIGHT THEME ═══ */
[data-theme="light"] .sp-hero-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.08), transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(59, 130, 246, 0.06), transparent 60%),
    var(--card-bg);
}

[data-theme="light"] .sp-avatar {
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sp-card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sp-card:hover {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sp-btn-ghost {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sp-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sp-foot {
  border-top-color: rgba(0, 0, 0, 0.04);
}

/* --- Utility Classes --- */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: 0.8rem;
}

.text-xs {
  font-size: 0.72rem;
}

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

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

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

.text-bold {
  font-weight: 600;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 16px;
}

.mt-4 {
  margin-top: 24px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 16px;
}

.mb-4 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 16px;
}

.gap-4 {
  gap: 24px;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Modal (Restored) --- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  backdrop-filter: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  backdrop-filter: none;
}

.modal {
  background: var(--modal-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  /* Limit height */
  display: flex;
  /* Enable flex layout */
  flex-direction: column;
  /* Stack header, body, footer */
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  /* Hide overflow of the modal container */
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

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

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  /* Prevent header from shrinking */
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  color: var(--text-tertiary);
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  /* Enable vertical scrolling */
  flex: 1;
  /* Allow body to take available space */
  min-height: 0;
  /* Critical for scrolling in flex containers */
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-body-flat);
  flex-shrink: 0;
  /* Prevent footer from shrinking */
}

/* Custom Scrollbar */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}


.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ensure form takes full height for scrolling */
.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/*---PrintStyles---*/
@media print {
  body {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #000 !important;
  }

  .no-print,
  .sidebar,
  .navbar,
  .btn,
  .page-header {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .invoice-print-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    position: absolute;
    top: 0;
    left: 0;
  }

  .invoice-paper {
    padding: 0 20px !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
  }

  /* Ensure text is black for printing */
  h1,
  h2,
  h3,
  h4,
  p,
  td,
  th,
  span,
  div {
    color: #000 !important;
    text-shadow: none !important;
  }

  /* Table borders */
  .invoice-table th {
    background: #eee !important;
    color: #000 !important;
    /* Force black text on gray bg */
    font-weight: bold !important;
    border-bottom: 2px solid #000 !important;
  }

  .invoice-table td {
    border-bottom: 1px solid #ccc !important;
  }

  /* Layout tweaks */
  .invoice-header,
  .invoice-info-grid,
  .invoice-table,
  .invoice-footer {
    width: 100% !important;
  }

  /* Improve page breaks */
  tr {
    page-break-inside: avoid;
  }
}

/* --- Customer Portal Mobile Layout Enhancements --- */
.portal-mobile-header {
  display: none !important;
}

@media (max-width: 768px) {
  .portal-mobile-header {
    display: flex !important;
  }

  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--card-border);
  }

  .data-table {
    min-width: 650px;
  }

  /* --- Dashboard Cards Vertical Stacking --- */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-card {
    padding: 20px !important;
  }

  /* --- Table to Card Mobile responsive view --- */
  .mobile-cards-table {
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .mobile-cards-table .data-table {
    min-width: 100% !important;
    display: block;
    background: transparent !important;
  }

  .mobile-cards-table .data-table thead {
    display: none;
  }

  .mobile-cards-table .data-table tbody {
    display: block;
    width: 100%;
  }

  .mobile-cards-table .data-table tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-lg);
    background: var(--card-bg);
    padding: 16px;
    box-shadow: var(--card-shadow);
  }

  .mobile-cards-table .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: right;
    font-size: 0.9rem !important;
  }

  .mobile-cards-table .data-table td:last-child {
    border-bottom: none !important;
  }

  .mobile-cards-table .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    padding-right: 16px;
    text-align: left;
  }
}

/* ═══ BOOKING CALENDAR ═══ */
.booking-calendar {
  width: 100%;
  overflow: hidden;
}

.booking-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.calendar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--hover-bg-strong);
  border-color: var(--primary-500);
}

.nav-arrows {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.nav-arrow:hover {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #fff;
}

.view-toggle {
  display: flex;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-btn {
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover,
.view-btn.active {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Calendar days header row */
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--hover-bg);
  border-bottom: 1px solid var(--border-color);
}

.day-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, auto);
  border-left: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.calendar-cell {
  border-right: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  padding: 6px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  transition: background 0.15s;
}

.calendar-cell:hover {
  background: var(--hover-bg);
}

.calendar-cell.other-month {
  background: var(--bg-body-flat);
  opacity: 0.55;
}

.calendar-cell.is-today {
  background: rgba(99, 102, 241, 0.04);
}

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

.day-number {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.today-number {
  background: var(--primary-500);
  color: #fff;
  font-weight: 700;
}

.booking-count {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--primary-500);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
}

.cell-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hide-scrollbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.hide-scrollbar {
  scrollbar-width: none;
}

/* Booking event pill */
.booking-item {
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 0.72rem;
  border-left: 3px solid transparent;
  transition: filter 0.15s, transform 0.15s;
  background: rgba(99, 102, 241, 0.12);
  border-left-color: var(--primary-500);
}

.booking-item:hover {
  filter: brightness(1.1);
  transform: translateX(2px);
}

.booking-item.status-confirmed {
  background: rgba(16, 185, 129, 0.12);
  border-left-color: var(--success-500);
}

.booking-item.status-pending {
  background: rgba(245, 158, 11, 0.12);
  border-left-color: #f59e0b;
}

.booking-item.status-cancelled {
  background: rgba(239, 68, 68, 0.10);
  border-left-color: var(--danger-500);
}

.booking-item.status-default {
  background: rgba(99, 102, 241, 0.10);
  border-left-color: var(--primary-500);
}

.booking-item-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.booking-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-item-details {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duration {
  margin-left: 4px;
  opacity: 0.8;
}

.add-booking-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  color: var(--text-tertiary);
  opacity: 0.4;
  cursor: pointer;
  font-size: 0.85rem;
  transition: opacity 0.2s;
}

.add-booking-placeholder:hover {
  opacity: 0.7;
}

/* ═══ VIEW TOGGLE GROUP (Bookings page list/calendar switch) ═══ */
.view-toggle-group {
  display: flex;
  align-items: center;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.15));
  color: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2), 0 1px 4px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.view-toggle-btn.active .svg-icon svg {
  stroke: #22c55e;
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.5));
}

[data-theme="light"] .view-toggle-btn.active {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 0 10px rgba(22, 163, 74, 0.25);
  border: 1px solid #15803d;
}

[data-theme="light"] .view-toggle-btn.active .svg-icon svg {
  stroke: #fff;
  filter: none;
}

/* Light theme: calendar cells darker background */
[data-theme="light"] .calendar-cell {
  background: #f3f4f6;
  border-color: #d1d5db;
}

[data-theme="light"] .calendar-cell:hover {
  background: #e5e7eb;
}

[data-theme="light"] .calendar-cell.other-month {
  background: #f9fafb;
}

[data-theme="light"] .calendar-cell.is-today {
  background: #ecfdf5;
}

[data-theme="light"] .calendar-grid {
  border-color: #d1d5db;
}

[data-theme="light"] .calendar-header-cell {
  border-color: #d1d5db;
  background: #f3f4f6;
}

/* Light theme: list table rows with visible borders */
[data-theme="light"] .data-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="light"] .data-table tbody tr:hover {
  background: #f3f4f6;
}

[data-theme="light"] .data-table thead th {
  border-bottom: 2px solid #d1d5db;
  background: #f9fafb;
}

/* ═══ NOTIFICATION BADGE ═══ */
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

/* ═══ PAGINATION ═══ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-body-flat);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  white-space: nowrap;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--hover-bg);
  border-color: var(--primary-500);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

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

.pagination-ellipsis {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  padding: 0 4px;
}

/* ═══ SVG ICON GLOW EFFECTS ═══ */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: filter 0.3s ease, transform 0.2s ease;
}

.svg-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
}

.svg-icon.icon-sm svg {
  width: 12px;
  height: 12px;
}

.svg-icon.icon-md svg {
  width: 16px;
  height: 16px;
}

.svg-icon.icon-lg svg {
  width: 20px;
  height: 20px;
}

/* Glow colors */
.svg-icon.glow-edit {
  color: #818cf8;
  filter: drop-shadow(0 0 3px rgba(129, 140, 248, 0.4));
}

.svg-icon.glow-edit:hover {
  filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-delete {
  color: #f87171;
  filter: drop-shadow(0 0 3px rgba(248, 113, 113, 0.4));
}

.svg-icon.glow-delete:hover {
  filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-view {
  color: #22d3ee;
  filter: drop-shadow(0 0 3px rgba(34, 211, 238, 0.4));
}

.svg-icon.glow-view:hover {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-success {
  color: #34d399;
  filter: drop-shadow(0 0 3px rgba(52, 211, 153, 0.4));
}

.svg-icon.glow-success:hover {
  filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-pay {
  color: #4ade80;
  filter: drop-shadow(0 0 3px rgba(74, 222, 128, 0.4));
}

.svg-icon.glow-pay:hover {
  filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-print {
  color: #60a5fa;
  filter: drop-shadow(0 0 3px rgba(96, 165, 250, 0.4));
}

.svg-icon.glow-print:hover {
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-invoice {
  color: #a78bfa;
  filter: drop-shadow(0 0 3px rgba(167, 139, 250, 0.4));
}

.svg-icon.glow-invoice:hover {
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-add {
  color: #34d399;
  filter: drop-shadow(0 0 3px rgba(52, 211, 153, 0.4));
}

.svg-icon.glow-add:hover {
  filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-bell {
  color: #fbbf24;
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.4));
}

.svg-icon.glow-bell:hover {
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8));
  transform: scale(1.15);
}

.svg-icon.glow-warn {
  color: #f97316;
  filter: drop-shadow(0 0 3px rgba(249, 115, 22, 0.4));
}

.svg-icon.glow-tool {
  color: #94a3b8;
  filter: drop-shadow(0 0 2px rgba(148, 163, 184, 0.3));
}

.svg-icon.glow-user {
  color: #94a3b8;
  filter: drop-shadow(0 0 2px rgba(148, 163, 184, 0.3));
}

.svg-icon.glow-clock {
  color: #94a3b8;
  filter: drop-shadow(0 0 2px rgba(148, 163, 184, 0.3));
}

/* Pulse animation for action buttons */
@keyframes iconPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 3px currentColor);
  }

  50% {
    filter: drop-shadow(0 0 10px currentColor);
  }
}

.svg-icon.pulse {
  animation: iconPulse 2s ease-in-out infinite;
}

/* Button SVG icon alignment */
.btn .svg-icon {
  margin-right: 4px;
}

.btn .svg-icon svg {
  width: 14px;
  height: 14px;
}

.btn-icon .svg-icon {
  margin-right: 0;
}

.btn-icon .svg-icon svg {
  width: 16px;
  height: 16px;
}

/* Service badge icon */
.service-badge-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.service-badge-icon .svg-icon svg {
  width: 11px;
  height: 11px;
}

/* ============================================================
   COMPREHENSIVE MOBILE RESPONSIVE FIXES
   Targets: Dashboard, Jobs, Bookings, Invoices, all tables/forms
   ============================================================ */

@media (max-width: 768px) {

  /* ── GLOBAL: Prevent ALL horizontal overflow ── */
  html,
  body {
    overflow-x: hidden !important;
  }

  .app-content {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  /* ── DASHBOARD: Stack Recent Jobs & Low Stock vertically ── */
  #dashContent,
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* ── TABLE CONTAINER: Remove horizontal scroll ── */
  .table-container {
    overflow: visible !important;
    border-radius: var(--border-radius-lg);
  }

  /* ── ALL DATA TABLES: Convert to stacked card layout ── */
  .data-table {
    min-width: 100% !important;
    display: block !important;
    width: 100% !important;
  }

  .data-table thead {
    display: none !important;
  }

  .data-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .data-table tr {
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-lg) !important;
    background: var(--card-bg) !important;
    padding: 14px 16px !important;
    box-shadow: var(--card-shadow) !important;
  }

  .data-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: right !important;
    font-size: 0.88rem !important;
    word-break: break-word;
  }

  .data-table td:last-child {
    border-bottom: none !important;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    padding-right: 12px;
    text-align: left;
    flex-shrink: 0;
    min-width: 90px;
  }

  /* ── ACTIONS COLUMN: Wrap buttons nicely ── */
  .data-table td:last-child {
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    padding-top: 10px !important;
  }

  .data-table td .flex,
  .data-table td .inv-actions,
  .data-table td .actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }

  .data-table td .btn-sm {
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
  }

  .data-table td .btn-icon {
    width: 34px !important;
    height: 34px !important;
    padding: 6px !important;
  }

  /* ── DROPDOWN / SELECT: GLOBAL FIX for ALL selects site-wide ── */
  /* 16px minimum font prevents iOS auto-zoom on focus */
  select,
  .form-select,
  .table-filters select,
  .table-toolbar select,
  #statusFilter,
  #fCustomer,
  #fVehicle,
  #fCust,
  #fVeh,
  #fAssign,
  #fStatus,
  #payMethod,
  .modal select,
  .modal .form-select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 14px 40px 14px 16px !important;
    font-size: 16px !important;
    /* prevents iOS zoom */
    line-height: 1.4 !important;
    border: 1px solid var(--input-border) !important;
    border-radius: var(--border-radius) !important;
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 14px !important;
    box-sizing: border-box !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
  }

  select:focus,
  .form-select:focus,
  .modal select:focus,
  .modal .form-select:focus {
    outline: none !important;
    border-color: var(--input-border-focus) !important;
    box-shadow: var(--focus-ring) !important;
  }

  select option,
  .form-select option,
  .modal select option {
    padding: 14px 16px !important;
    font-size: 16px !important;
    background: var(--select-option-bg) !important;
    color: var(--text-primary) !important;
    min-height: 44px !important;
  }

  .table-filters {
    width: 100%;
  }

  /* ── TABLE TOOLBAR: Stack search + filters vertically ── */
  .table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 16px !important;
  }

  .table-search {
    max-width: 100% !important;
    width: 100% !important;
  }

  .table-search input {
    padding: 14px 12px 14px 40px !important;
    font-size: 16px !important;
    /* prevents iOS zoom */
  }

  /* ── iOS zoom prevention: ALL inputs must be >= 16px ── */
  input,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="search"],
  textarea,
  .form-input,
  .form-textarea,
  .ss-display,
  .ss-search {
    font-size: 16px !important;
  }

  /* ── PAGINATION: Stack on mobile ── */
  .pagination-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    font-size: 0.82rem !important;
  }

  .pagination-controls,
  .pagination-size {
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  /* ── MODALS: Centered, compact on mobile ── */
  .modal-overlay {
    padding: 16px !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
  }

  .modal {
    max-width: 100% !important;
    max-height: 88vh !important;
    margin: auto !important;
    border-radius: 16px !important;
    overflow: visible !important;
    width: 100% !important;
  }

  .modal-body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: 65vh !important;
    padding: 12px 14px !important;
  }

  .modal-header {
    padding: 12px 14px !important;
  }

  .modal-header h2 {
    font-size: 1.05rem !important;
  }

  .modal-footer {
    padding: 10px 14px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .modal-footer .btn {
    flex: 1 !important;
    min-width: 100px !important;
    justify-content: center !important;
    padding: 11px !important;
    font-size: 0.9rem !important;
  }

  /* ── ALL FORM INPUTS inside modals: compact, proper size ── */
  .modal .form-input,
  .modal .form-textarea,
  .modal input[type="date"],
  .modal input[type="time"],
  .modal input[type="text"],
  .modal input[type="number"],
  .modal input[type="email"],
  .modal textarea {
    width: 100% !important;
    padding: 11px 12px !important;
    font-size: 16px !important;
    /* prevents iOS zoom */
    box-sizing: border-box !important;
  }

  /* ── Form groups inside modals: stack vertically, compact ── */
  .modal .form-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .modal .form-group {
    margin-bottom: 10px !important;
  }

  .modal .form-label {
    font-size: 0.82rem !important;
    margin-bottom: 4px !important;
  }

  /* ── Customer/Vehicle select + button row: proper layout ── */
  .modal [style*="display:flex"][style*="gap:8px"] {
    flex-wrap: nowrap !important;
  }

  .modal [style*="display:flex"][style*="gap:8px"]>select,
  .modal [style*="display:flex"][style*="gap:8px"]>.form-select {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .modal [style*="display:flex"][style*="gap:8px"]>.btn-icon {
    flex-shrink: 0 !important;
    width: 48px !important;
    height: 48px !important;
  }

  /* ── PAGE HEADER: Stack title + button ── */
  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .page-header>div {
    width: 100% !important;
  }

  /* Stack multiple buttons in header */
  .page-header [style*="display:flex"][style*="gap:8px"],
  .page-header [style*="display:flex"][style*="gap: 8px"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .page-header .btn {
    flex: 1 !important;
    min-width: 0 !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    padding: 10px 12px !important;
  }

  /* View toggles (List / Calendar) */
  .view-toggle-group {
    width: 100% !important;
  }

  .view-toggle-group .view-toggle-btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 10px !important;
    font-size: 0.85rem !important;
  }

  /* Service type labels in booking form */
  .service-type-option {
    padding: 10px 16px !important;
    font-size: 0.88rem !important;
  }

  /* ── BADGES: Proper sizing ── */
  .badge {
    font-size: 0.72rem !important;
    padding: 4px 10px !important;
    white-space: nowrap !important;
  }

  /* ── JOBS: Action buttons overflow fix ── */
  .flex.gap-1 {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* ── INVOICE ACTIONS ROW ── */
  .inv-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-end !important;
  }

  /* ── BOOKING CALENDAR: Fit on screen ── */
  .booking-calendar {
    overflow: hidden !important;
  }

  .booking-calendar-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 12px !important;
  }

  .calendar-controls {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  .calendar-grid {
    font-size: 0.75rem !important;
  }

  .calendar-grid td,
  .calendar-grid th {
    padding: 6px 2px !important;
    font-size: 0.72rem !important;
  }

  /* ── SHARE CARD: Fit mobile screen ── */
  .share-card-overlay {
    padding: 16px 10px !important;
  }

  .share-card {
    max-width: 100% !important;
  }

  /* ── STATS GRID override for inline styles ── */
  #statsGrid,
  [style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Force all inline 2-column grids to stack on mobile ── */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Editor panels: no horizontal scroll ── */
  .editor-panel {
    overflow-x: hidden !important;
  }

  .editor-panel [style*="overflow-x:auto"],
  .editor-panel [style*="overflow-x: auto"] {
    overflow-x: hidden !important;
  }
}

/* ── Extra-small screens (< 480px) ── */
@media (max-width: 480px) {

  .app-content {
    padding: 10px !important;
  }

  .header {
    padding: 0 12px !important;
  }

  .header-title h1 {
    font-size: 0.95rem !important;
  }

  /* Even smaller table cards */
  .data-table td {
    font-size: 0.82rem !important;
    padding: 6px 0 !important;
  }

  .data-table td::before {
    font-size: 0.68rem !important;
    min-width: 75px !important;
  }

  .data-table tr {
    padding: 12px !important;
  }

  /* Buttons stack full width */
  .data-table td .flex,
  .data-table td .inv-actions {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }

  .data-table td .btn-sm {
    font-size: 0.72rem !important;
    padding: 5px 8px !important;
  }

  /* Modal even tighter */
  .modal-body {
    padding: 12px !important;
  }

  .modal .form-group {
    margin-bottom: 12px !important;
  }

  /* Page header */
  .page-header h1 {
    font-size: 1.15rem !important;
  }

  /* Pagination compact */
  .pagination-bar {
    font-size: 0.75rem !important;
    padding: 10px !important;
  }

  .pagination-btn {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
  }
}

/* ── Dashboard Stats Accordion Animation ── */
@keyframes statDropIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

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

/* On desktop, hide the chevron indicator */
.dash-stat-chevron {
  display: none;
}

@media (max-width: 768px) {

  /* Show chevron on mobile */
  .dash-stat-chevron {
    display: block !important;
  }

  /* Stats grid as column on mobile for accordion */
  #statsGrid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* Hover effect on dropdown items */
  .dash-stat-item:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* ── JOB DETAIL CARD (share modal): Solid bg, centered, compact ── */
  .job-detail-overlay,
  [id*="jobDetail"],
  [id*="shareOverlay"],
  .modal-overlay[style*="display: flex"],
  .modal-overlay[style*="display:flex"] {
    align-items: center !important;
    justify-content: center !important;
  }

  .job-detail-card,
  .job-detail-overlay .modal,
  [class*="job-detail"] {
    max-width: 95% !important;
    max-height: 85vh !important;
    margin: auto !important;
    border-radius: 16px !important;
    background: #151a27 !important;
    overflow: hidden !important;
  }

  .job-detail-card .modal-body,
  .job-detail-overlay .modal-body {
    max-height: 70vh !important;
    overflow-y: auto !important;
    padding: 12px !important;
    background: #151a27 !important;
  }

  /* ── PROFILE CARD (vehicles): compact on mobile ── */
  .profile-card-overlay {
    padding: 16px !important;
  }

  .profile-card {
    max-width: 100% !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  .profile-card-header {
    padding: 16px 18px !important;
  }

  .profile-body {
    padding: 14px 18px !important;
  }

  .profile-info-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .profile-info-box {
    padding: 10px 12px !important;
  }

  .profile-detail-grid {
    gap: 6px 12px !important;
    font-size: 0.85rem !important;
  }

  .profile-footer {
    padding: 10px 18px !important;
  }

  /* ── DATA TABLE CARDS: centered label+value layout ── */
  .data-table tbody tr td[data-label] {
    text-align: left !important;
  }

  .data-table tbody tr td[data-label]::before {
    text-align: left !important;
    font-weight: 600 !important;
    color: var(--text-tertiary) !important;
    text-transform: uppercase !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.5px !important;
  }

  /* Center the actions buttons in mobile card */
  .data-table tbody tr td.actions {
    justify-content: center !important;
  }

  .data-table tbody tr td.actions .flex {
    justify-content: center !important;
  }
}

/* ========================
   APP-SPECIFIC MOBILE FIXES
   ======================== */

/* Fix 1: Date input fields cut off on mobile */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  line-height: 1.4;
  overflow: visible;
}

@media (max-width: 768px) {
  input[type="date"],
  input[type="time"] {
    font-size: 16px !important;
    padding: 12px 10px !important;
    min-height: 48px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    overflow: visible !important;
    text-overflow: ellipsis !important;
  }

  .form-group input[type="date"],
  .form-group input[type="time"] {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Ensure date picker text doesn't overflow */
  input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    padding: 0;
  }

  input[type="date"]::-webkit-datetime-edit {
    padding: 0;
    overflow: visible;
  }

  input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
    overflow: visible;
  }
}

/* Fix 2: Sidebar bottom buttons (theme toggle + signout) visible on mobile */
.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.sidebar-toggle {
  flex-shrink: 0;
  min-height: 52px;
}

@media (max-width: 768px) {
  .sidebar {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  .sidebar-nav {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    padding-bottom: 12px !important;
  }

  .sidebar .sidebar-toggle {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    padding: 12px 16px !important;
    border-top: 1px solid var(--sidebar-border) !important;
    min-height: 56px !important;
    background: var(--bg-body-flat, #0f1729) !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 5 !important;
  }

  .sidebar .sidebar-toggle button {
    min-height: 40px !important;
    padding: 8px 12px !important;
  }
}