/* ==========================================================================
   BillPulse Enterprise Billing & Invoicing Suite - Main Stylesheet
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --secondary: #64748b;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #06b6d4;
  --info-light: #ecfeff;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f1f5f9;
  --text-sidebar: #475569;
  --text-sidebar-active: #2563eb;
  --sidebar-border: #e2e8f0;

  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

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

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Tokens */
body.dark-mode {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;
  --sidebar-border: #1e293b;
  --border-color: #1e293b;
  --text-heading: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --primary-light: rgba(37, 99, 235, 0.15);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.25;
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

/* Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

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

.sidebar-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, filter 0.2s ease;
  user-select: none;
  padding: 4px 8px;
}

.sidebar-logo-link img {
  max-height: 44px;
  max-width: 180px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
  transition: transform 0.2s ease;
  display: block;
}

body.dark-mode .sidebar-logo-link img {
  filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.2)) brightness(1.08);
}

.sidebar-logo-link:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

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

.brand-icon-box {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-info h1 {
  color: var(--text-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-info span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
}

.nav-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--primary);
}

body.dark-mode .nav-item:hover {
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  background-color: var(--primary-light);
  padding: 2px 7px;
  border-radius: 20px;
  color: var(--primary);
  font-weight: 600;
}

body.dark-mode .nav-badge {
  background-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
  background-color: var(--bg-sidebar);
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-main);
  border: 1px solid var(--sidebar-border);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.user-meta .user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-heading);
}

.user-meta .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.app-topbar {
  height: 70px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
}

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

.page-heading-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
}

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

/* Global Currency Selector Widget */
.currency-selector-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
}

.currency-select-input {
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--primary);
  outline: none;
  cursor: pointer;
  font-size: 13px;
}

/* Buttons */
/* ==========================================
   ULTRA-MODERN BUTTONS & ACTION STYLES
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
  line-height: 1.3;
}

.btn:active {
  transform: translateY(0px) scale(0.97) !important;
}

.btn i,
.btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn:hover i,
.btn:hover svg {
  transform: scale(1.12);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: #1d4ed8;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1.5px);
}

.btn-secondary {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-body);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background-color: var(--bg-main);
  border-color: #cbd5e1;
  color: var(--text-heading);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.07);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: #059669;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1.5px);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: #e11d48;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1.5px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   ULTRA-MODERN ACTIONS DROPDOWN COMPONENT
   ========================================== */
.actions-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.actions-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  min-width: 32px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

body.dark-mode .actions-dropdown-trigger {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.actions-dropdown-trigger:hover,
.actions-dropdown.active .actions-dropdown-trigger {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

body.dark-mode .actions-dropdown-trigger:hover,
body.dark-mode .actions-dropdown.active .actions-dropdown-trigger {
  background: #334155;
  border-color: #475569;
  color: #f8fafc;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.actions-dropdown-trigger i,
.actions-dropdown-trigger svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
  display: block;
  margin: auto;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.actions-dropdown-trigger:hover i,
.actions-dropdown-trigger:hover svg {
  transform: scale(1.15);
}

.actions-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

body.dark-mode .actions-dropdown-menu {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(51, 65, 85, 0.9);
  box-shadow: 0 14px 40px -6px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.actions-dropdown.active .actions-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.actions-dropdown-menu.drop-up {
  top: auto;
  bottom: calc(100% + 6px);
  transform-origin: bottom right;
  transform: translateY(6px) scale(0.96);
}

.actions-dropdown.active .actions-dropdown-menu.drop-up {
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  width: 100%;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.dropdown-item i,
.dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.1;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(241, 245, 249, 0.9);
  color: var(--text-heading);
  transform: translateX(2px);
}

body.dark-mode .dropdown-item:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
}

.dropdown-item:hover i,
.dropdown-item:hover svg {
  transform: scale(1.14);
}

.dropdown-item-primary {
  color: #2563eb;
}

.dropdown-item-primary:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #1d4ed8 !important;
}

body.dark-mode .dropdown-item-primary {
  color: #60a5fa;
}

.dropdown-item-success {
  color: #059669;
}

.dropdown-item-success:hover {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #047857 !important;
}

body.dark-mode .dropdown-item-success {
  color: #34d399;
}

.dropdown-item-warning {
  color: #d97706;
}

.dropdown-item-warning:hover {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #b45309 !important;
}

body.dark-mode .dropdown-item-warning {
  color: #fbbf24;
}

.dropdown-item-purple {
  color: #9333ea;
}

.dropdown-item-purple:hover {
  background: rgba(168, 85, 247, 0.1) !important;
  color: #7e22ce !important;
}

body.dark-mode .dropdown-item-purple {
  color: #c084fc;
}

.dropdown-item-danger {
  color: #e11d48;
}

.dropdown-item-danger:hover {
  background: rgba(244, 63, 94, 0.12) !important;
  color: #be123c !important;
}

body.dark-mode .dropdown-item-danger {
  color: #fb7185;
}

body.dark-mode .dropdown-item-danger:hover {
  background: rgba(244, 63, 94, 0.2) !important;
  color: #fda4af !important;
}

.dropdown-divider {
  height: 1px;
  background: rgba(226, 232, 240, 0.8);
  margin: 4px 0;
}

body.dark-mode .dropdown-divider {
  background: rgba(51, 65, 85, 0.8);
}

/* ==========================================
   ENHANCED MODERN TABLE ACTION BUTTONS
   ========================================== */
.table-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  background: rgba(243, 244, 246, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(229, 231, 235, 0.95);
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

body.dark-mode .table-actions-group {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(51, 65, 85, 0.75);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.table-actions-group:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.dark-mode .table-actions-group:hover {
  border-color: rgba(71, 85, 105, 0.9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.btn-action {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.25px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  line-height: 1.2;
  user-select: none;
  text-decoration: none;
}

.btn-action::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-20deg);
  transition: none;
  pointer-events: none;
}

.btn-action:hover::after {
  left: 150%;
  transition: all 0.5s ease;
}

.btn-action i,
.btn-action svg {
  width: 13.5px;
  height: 13.5px;
  stroke-width: 2.3;
  flex-shrink: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-action:hover i,
.btn-action:hover svg {
  transform: scale(1.18);
}

.btn-action:active {
  transform: translateY(0px) scale(0.94) !important;
  transition-duration: 0.08s;
}

/* 1. View / Preview Action Button */
.btn-action-view {
  background-color: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark-mode .btn-action-view {
  background-color: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-action-view:hover {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: #4f46e5;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* 2. Edit Action Button */
.btn-action-edit {
  background-color: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.25);
  color: #0284c7;
}

body.dark-mode .btn-action-edit {
  background-color: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.35);
  color: #38bdf8;
}

.btn-action-edit:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-color: #0284c7;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.42);
}

/* 3. Pay Action Button */
.btn-action-pay {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  color: #059669;
  font-weight: 700;
}

body.dark-mode .btn-action-pay {
  background-color: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.38);
  color: #34d399;
}

.btn-action-pay:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

/* 4. Convert / Workflow Action Button */
.btn-action-convert {
  background-color: rgba(168, 85, 247, 0.09);
  border-color: rgba(168, 85, 247, 0.25);
  color: #9333ea;
  font-weight: 700;
}

body.dark-mode .btn-action-convert {
  background-color: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.btn-action-convert:hover {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  border-color: #7e22ce;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.42);
}

/* 5. Duplicate / Clone Action Button */
.btn-action-copy {
  background-color: rgba(245, 158, 11, 0.09);
  border-color: rgba(245, 158, 11, 0.25);
  color: #d97706;
}

body.dark-mode .btn-action-copy {
  background-color: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.btn-action-copy:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #d97706;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.42);
}

/* 6. Delete Action Button */
.btn-action-delete {
  background-color: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.22);
  color: #e11d48;
}

body.dark-mode .btn-action-delete {
  background-color: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.btn-action-delete:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  border-color: #be123c;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.42);
}

/* Page Views Body - Full Width Fluid Layout */
.page-view {
  display: none;
  padding: 24px 32px;
  max-width: 100%;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.page-view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

/* ==========================================================================
   FULL HEIGHT & FLUID CRM & DOCUMENT VIEWS (NO PAGE SCROLLBAR, BOTTOM PINNED PAGINATION)
   ========================================================================== */
#view-invoices.active,
#view-quotations.active,
#view-pre_invoices.active,
#view-clients.active,
#view-payments.active,
#view-items.active,
.page-view.full-height-view.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  padding: 20px 32px;
  overflow: hidden;
  box-sizing: border-box;
}

#view-invoices .action-toolbar,
#view-quotations .action-toolbar,
#view-pre_invoices .action-toolbar,
#view-clients .action-toolbar,
#view-payments .action-toolbar,
#view-items .action-toolbar,
.page-view.full-height-view .action-toolbar {
  flex-shrink: 0;
  margin-bottom: 14px;
}

#view-invoices .card,
#view-quotations .card,
#view-pre_invoices .card,
#view-clients .card,
#view-payments .card,
#view-items .card,
.page-view.full-height-view .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
}

#view-invoices .table-responsive,
#view-quotations .table-responsive,
#view-pre_invoices .table-responsive,
#view-clients .table-responsive,
#view-payments .table-responsive,
#view-items .table-responsive,
.page-view.full-height-view .table-responsive {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#view-invoices .table-responsive::-webkit-scrollbar,
#view-quotations .table-responsive::-webkit-scrollbar,
#view-pre_invoices .table-responsive::-webkit-scrollbar,
#view-clients .table-responsive::-webkit-scrollbar,
#view-payments .table-responsive::-webkit-scrollbar,
#view-items .table-responsive::-webkit-scrollbar,
.page-view.full-height-view .table-responsive::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#view-invoices .table-responsive::-webkit-scrollbar-track,
#view-quotations .table-responsive::-webkit-scrollbar-track,
#view-pre_invoices .table-responsive::-webkit-scrollbar-track,
#view-clients .table-responsive::-webkit-scrollbar-track,
#view-payments .table-responsive::-webkit-scrollbar-track,
#view-items .table-responsive::-webkit-scrollbar-track,
.page-view.full-height-view .table-responsive::-webkit-scrollbar-track {
  background: transparent;
}

#view-invoices .table-responsive::-webkit-scrollbar-thumb,
#view-quotations .table-responsive::-webkit-scrollbar-thumb,
#view-pre_invoices .table-responsive::-webkit-scrollbar-thumb,
#view-clients .table-responsive::-webkit-scrollbar-thumb,
#view-payments .table-responsive::-webkit-scrollbar-thumb,
#view-items .table-responsive::-webkit-scrollbar-thumb,
.page-view.full-height-view .table-responsive::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 10px;
}

#view-invoices .table-responsive::-webkit-scrollbar-thumb:hover,
#view-quotations .table-responsive::-webkit-scrollbar-thumb:hover,
#view-pre_invoices .table-responsive::-webkit-scrollbar-thumb:hover,
#view-clients .table-responsive::-webkit-scrollbar-thumb:hover,
#view-payments .table-responsive::-webkit-scrollbar-thumb:hover,
#view-items .table-responsive::-webkit-scrollbar-thumb:hover,
.page-view.full-height-view .table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

#view-invoices .data-table thead th,
#view-quotations .data-table thead th,
#view-pre_invoices .data-table thead th,
#view-clients .data-table thead th,
#view-payments .data-table thead th,
#view-items .data-table thead th,
.page-view.full-height-view .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f1f5f9;
  box-shadow: 0 1px 0 var(--border-color);
}

body.dark-mode #view-invoices .data-table thead th,
body.dark-mode #view-quotations .data-table thead th,
body.dark-mode #view-pre_invoices .data-table thead th,
body.dark-mode #view-clients .data-table thead th,
body.dark-mode #view-payments .data-table thead th,
body.dark-mode #view-items .data-table thead th,
body.dark-mode .page-view.full-height-view .data-table thead th {
  background-color: #1e293b;
}

#view-invoices .table-pagination-footer,
#view-quotations .table-pagination-footer,
#view-pre_invoices .table-pagination-footer,
#view-clients .table-pagination-footer,
#view-payments .table-pagination-footer,
#view-items .table-pagination-footer,
.page-view.full-height-view .table-pagination-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  z-index: 5;
}

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

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

/* Quick KPI Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.metric-content .metric-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-content .metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

.metric-content .metric-subtext {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.metric-icon-box.blue {
  background: var(--primary-light);
  color: var(--primary);
}

.metric-icon-box.green {
  background: var(--success-light);
  color: var(--success);
}

.metric-icon-box.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.metric-icon-box.red {
  background: var(--danger-light);
  color: var(--danger);
}

.metric-icon-box.cyan {
  background: var(--info-light);
  color: var(--info);
}

/* Dashboard Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

.chart-container-lg {
  height: 320px;
  position: relative;
}

.chart-container-sm {
  height: 280px;
  position: relative;
}

/* Action Toolbar */
.action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  gap: 10px;
  width: 320px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13.5px;
  color: var(--text-heading);
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-filter {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-body);
  outline: none;
  cursor: pointer;
}

/* Tables - Fluid Display Fit without Scrollbars */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  table-layout: auto;
}

.data-table th {
  background-color: #f1f5f9;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

body.dark-mode .data-table th {
  background-color: #1e293b;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
  font-size: 13px;
}

.data-table th:last-child,
.data-table td:last-child {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.data-table td .status-pill {
  white-space: nowrap;
}

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

.data-table tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.6);
}

body.dark-mode .data-table tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.6);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-paid,
.status-accepted {
  background-color: #dcfce7;
  color: #15803d;
}

.status-partially-paid {
  background-color: #fef3c7;
  color: #b45309;
}

.status-overdue,
.status-rejected {
  background-color: #fee2e2;
  color: #b91c1c;
}

.status-sent {
  background-color: #e0f2fe;
  color: #0369a1;
}

.status-draft {
  background-color: #f1f5f9;
  color: #475569;
}

.status-converted {
  background-color: #f3e8ff;
  color: #7e22ce;
}

/* Document Builder / Editor Form */
.doc-editor-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
}

.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  color: var(--text-heading);
  outline: none;
  transition: var(--transition);
}

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

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

/* Line Items Table in Editor */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  margin-bottom: 16px;
}

.line-items-table th {
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

.line-items-table td {
  padding: 8px 6px;
  vertical-align: top;
}

.line-item-row input,
.line-item-row select {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 100%;
  outline: none;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}

.modal-backdrop.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

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

.modal-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 900px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.modal-container.modal-lg {
  max-width: 1100px;
}

.modal-container.modal-sm {
  max-width: 500px;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-main);
}

/* Document Paper Preview Styling */
.doc-preview-wrapper {
  background-color: #525659;
  padding: 30px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.pdf-document {
  background-color: #ffffff;
  color: #1e293b;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm 18mm;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  position: relative;
  box-sizing: border-box;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.doc-brand {
  max-width: 55%;
}

.doc-logo {
  max-height: 52px;
  max-width: 200px;
  height: auto;
  width: auto;
  object-fit: contain;
  margin-bottom: 8px;
  display: block;
}

.doc-logo-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.doc-logo-placeholder .logo-icon {
  width: 36px;
  height: 36px;
  background-color: var(--doc-accent, #3b82f6);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.doc-logo-placeholder .logo-text {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #0f172a;
}

.company-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.company-tagline {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
}

.company-address,
.company-contacts {
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
}

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

.doc-type-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--doc-accent, #3b82f6);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.doc-badge-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}

.meta-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.meta-label {
  color: #64748b;
  font-weight: 500;
}

.meta-value.strong {
  font-weight: 700;
  color: #0f172a;
}

.meta-value.highlight {
  font-weight: 700;
  color: var(--doc-accent, #3b82f6);
}

.doc-divider {
  height: 2px;
  background: linear-gradient(90deg, var(--doc-accent, #3b82f6), #e2e8f0);
  margin: 16px 0 20px;
}

.doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.party-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
}

.party-heading {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.party-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.party-address,
.party-extra {
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
}

.payment-summary-box {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.summary-highlight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
}

.large-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--doc-accent, #3b82f6);
}

/* Document Table */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.doc-table th {
  background-color: #f1f5f9;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 12px;
  border-top: 1px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
}

.doc-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #334155;
}

.col-num {
  width: 5%;
}

.col-desc {
  width: 45%;
}

.col-qty {
  width: 10%;
}

.col-price {
  width: 15%;
}

.col-tax {
  width: 10%;
}

.col-total {
  width: 15%;
}

.item-name {
  font-weight: 600;
  color: #0f172a;
}

.item-subtext {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 2px;
}

/* Totals & Notes */
.doc-footer-summary {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-bottom: 30px;
}

.doc-notes-block h5 {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.doc-notes-block p {
  font-size: 10.5px;
  color: #475569;
  line-height: 1.4;
  margin-bottom: 12px;
}

.bank-details-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 10.5px;
}

.bank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin-top: 4px;
}

.doc-totals-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 5px 0;
  color: #475569;
}

.totals-row.discount-row {
  color: #dc2626;
}

.totals-row.tax-row {
  color: #2563eb;
}

.grand-total-row {
  border-top: 2px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
  padding: 8px 0;
  margin-top: 6px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.paid-row {
  color: #16a34a;
  font-weight: 600;
}

.balance-row {
  font-weight: 700;
  font-size: 13px;
  padding: 6px 0;
}

.balance-row.unpaid {
  color: #dc2626;
}

.balance-row.cleared {
  color: #16a34a;
}

.doc-signature-box {
  margin-top: 24px;
  text-align: right;
}

.sig-line {
  width: 140px;
  height: 1px;
  background-color: #94a3b8;
  margin-left: auto;
  margin-bottom: 6px;
}

.sig-img {
  max-height: 45px;
  display: block;
  margin-left: auto;
  margin-bottom: 4px;
}

.sig-title {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.doc-stamp-sig-container {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 32px;
  margin-top: 20px;
}

.doc-stamp-box {
  text-align: center;
}

.doc-stamp-box .stamp-img {
  max-height: 65px;
  max-width: 90px;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px;
}

.doc-stamp-box .stamp-title {
  font-size: 9.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.doc-bottom-bar {
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
}

.doc-watermark {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 60px;
  font-weight: 900;
  color: rgba(226, 232, 240, 0.6);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 4px;
  z-index: 0;
}

/* ==========================================================================
   DOCUMENT TEMPLATES (Modern, Minimalist, Classic & Receipt)
   ========================================================================== */
/* Template 1: Modern Corporate */
.pdf-document.template-modern {
  border-top: 5px solid var(--doc-accent, #3b82f6);
}

.template-modern .doc-type-title {
  color: var(--doc-accent, #3b82f6);
}

/* Template 2: Minimalist Clean */
.pdf-document.template-minimalist {
  border-top: none;
  font-family: 'Inter', -apple-system, sans-serif;
}

.template-minimalist .doc-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.template-minimalist .doc-type-title {
  color: #0f172a;
  font-weight: 700;
  letter-spacing: -1px;
}

.template-minimalist .doc-table th {
  background: transparent;
  border-top: 1px solid #0f172a;
  border-bottom: 1px solid #0f172a;
  color: #0f172a;
}

.template-minimalist .party-box,
.template-minimalist .doc-totals-block,
.template-minimalist .bank-details-box {
  background: transparent;
  border: 1px solid #e2e8f0;
}

/* Template 3: Executive Classic */
.pdf-document.template-classic {
  border-top: none;
}

.template-classic .doc-header {
  background: #0f172a;
  color: #ffffff;
  margin: -20mm -18mm 24px -18mm;
  padding: 16mm 18mm;
  border-radius: 0;
}

.template-classic .company-title,
.template-classic .doc-type-title,
.template-classic .meta-value.strong,
.template-classic .doc-logo-placeholder .logo-text {
  color: #ffffff !important;
}

.template-classic .company-address,
.template-classic .company-contacts,
.template-classic .company-tagline,
.template-classic .meta-label,
.template-classic .meta-value {
  color: #cbd5e1 !important;
}

.template-classic .doc-table th {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* Receipt Specific Styling */
.receipt-hero-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.receipt-label {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  letter-spacing: 1px;
}

.receipt-amount-badge {
  font-size: 32px;
  font-weight: 900;
  color: #065f46;
  margin: 6px 0;
}

.receipt-method {
  font-size: 12px;
  color: #047857;
}

/* PDF High-Definition Export Mode (Direct 1:1 Canvas Rasterizer) */
.pdf-document.pdf-export-mode {
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  width: 210mm !important;
  min-height: 297mm !important;
  background-color: #ffffff !important;
  color: #1e293b !important;
  transform: none !important;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.3s ease-out;
}

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

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

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-danger {
  border-left: 4px solid var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--primary);
}

.toast.toast-warning {
  border-left: 4px solid var(--warning);
}

/* Responsive adjustments */
@media (max-width: 1024px) {

  .charts-grid,
  .doc-editor-grid {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    width: 72px;
  }

  .brand-info,
  .nav-item span,
  .nav-section-title,
  .nav-badge,
  .user-meta {
    display: none;
  }

  .sidebar-header {
    justify-content: center;
    padding: 18px 0;
  }

  .nav-item {
    justify-content: center;
    padding: 12px 0;
  }
}

/* ==========================================================================
   Admin Authentication & Security Styles
   ========================================================================== */

/* Zero-Flicker Layout Transition on Page Reload */
html.has-auth-token #auth-login-view {
  display: none !important;
}
html.has-auth-token #app-main-layout {
  display: flex !important;
}
html.no-auth-token #auth-login-view {
  display: flex !important;
}
html.no-auth-token #app-main-layout {
  display: none !important;
}

.auth-fullscreen-container {
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 60%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}


.auth-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0) 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(40px);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #fff;
  position: relative;
  z-index: 10;
  animation: authCardEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardEntrance {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

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

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: #94a3b8;
}

.auth-demo-badge {
  background: rgba(37, 99, 235, 0.15);
  border: 1px dashed rgba(59, 130, 246, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #93c5fd;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-demo-badge code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #fff;
}

.auth-input-group {
  position: relative;
  margin-bottom: 18px;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  width: 18px;
  height: 18px;
}

.auth-control {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.auth-control:focus {
  border-color: #3b82f6;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.auth-toggle-pwd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  cursor: pointer;
  background: none;
  border: none;
}

.auth-toggle-pwd:hover {
  color: #cbd5e1;
}

.auth-error-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 8px;
}

.pin-inputs-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}

.pin-digit-box {
  width: 48px;
  height: 54px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  outline: none;
}

.pin-digit-box:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Security Tab in Settings */
.security-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  gap: 8px;
}

.sec-tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.sec-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.password-strength-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  transition: var(--transition);
}

.password-strength-fill.weak {
  width: 33%;
  background: #ef4444;
}

.password-strength-fill.medium {
  width: 66%;
  background: #f59e0b;
}

.password-strength-fill.strong {
  width: 100%;
  background: #10b981;
}

.audit-log-badge {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.audit-log-badge.login_success {
  background: #dcfce7;
  color: #15803d;
}

.audit-log-badge.login_failed,
.audit-log-badge.lockout_triggered {
  background: #fee2e2;
  color: #b91c1c;
}

.audit-log-badge.logout {
  background: #f1f5f9;
  color: #475569;
}

.audit-log-badge.security_config_updated {
  background: #e0f2fe;
  color: #0369a1;
}

/* ==========================================================================
   PAGINATION CONTROLS COMPONENT (20 / 50 / 100 / All Entries)
   ========================================================================== */
.table-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-entries-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-entries-select {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  color: var(--text-heading);
  font-weight: 600;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.pagination-entries-select:focus {
  border-color: var(--primary);
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-info strong {
  color: var(--text-heading);
  font-weight: 600;
}

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

.pagination-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
  background-color: var(--bg-main);
  border-color: #cbd5e1;
  color: var(--text-heading);
}

.page-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border-color);
  background-color: transparent;
}

.page-btn-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 32px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   SUPPORTIVE DOCUMENTS & ATTACHMENTS GALLERY
   ========================================================================== */
.attachment-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  background: rgba(248, 250, 252, 0.6);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

body.dark-mode .attachment-upload-zone {
  background: rgba(15, 23, 42, 0.4);
  border-color: #334155;
}

.attachment-upload-zone:hover,
.attachment-upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.attachment-upload-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

body.dark-mode .attachment-upload-icon {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.attachment-upload-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.attachment-upload-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Attachments Grid Display */
.attachments-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.attachment-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.attachment-card-thumb {
  width: 100%;
  height: 100px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

body.dark-mode .attachment-card-thumb {
  background: #0f172a;
}

.attachment-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.attachment-card-thumb:hover img {
  transform: scale(1.05);
}

.attachment-card-doc-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.attachment-card-doc-icon i,
.attachment-card-doc-icon svg {
  width: 32px;
  height: 32px;
}

.attachment-ext-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
}

.attachment-ext-badge.pdf {
  background: #fee2e2;
  color: #dc2626;
}

.attachment-ext-badge.doc,
.attachment-ext-badge.docx {
  background: #e0f2fe;
  color: #0284c7;
}

.attachment-ext-badge.xls,
.attachment-ext-badge.xlsx {
  background: #dcfce7;
  color: #16a34a;
}

.attachment-ext-badge.img,
.attachment-ext-badge.png,
.attachment-ext-badge.jpg {
  background: #f3e8ff;
  color: #9333ea;
}

.attachment-card-meta {
  margin-top: 8px;
  flex: 1;
}

.attachment-filename {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-filesize {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.attachment-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.attachment-btn-action {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.attachment-btn-action:hover {
  background: var(--bg-main);
  color: var(--primary);
  border-color: var(--primary);
}

.attachment-btn-action.delete:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: #fef2f2;
}

/* ==========================================================================
   STAMP & SIGNATURE VISUAL RENDERING
   ========================================================================== */
.doc-stamp-sig-container {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 28px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.doc-stamp-box {
  text-align: center;
  min-width: 120px;
}

.doc-stamp-box .stamp-img {
  max-height: 80px;
  max-width: 120px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  margin: 0 auto 4px;
  display: block;
}

.doc-stamp-box .stamp-seal-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border: 2px dashed #2563eb;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.04);
  color: #2563eb;
}

.doc-stamp-box .stamp-title {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.doc-signature-box {
  text-align: right;
  min-width: 140px;
}

.doc-signature-box .sig-img {
  max-height: 52px;
  max-width: 160px;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-bottom: 4px;
}

.doc-signature-box .sig-line {
  width: 150px;
  height: 1px;
  background-color: #94a3b8;
  margin-left: auto;
  margin-bottom: 6px;
}

.doc-signature-box .sig-title {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Side-by-side signature settings upload cards */
.stamp-sig-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .stamp-sig-upload-grid {
    grid-template-columns: 1fr;
  }
}

.stamp-sig-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-main);
}

.stamp-sig-preview-frame {
  height: 100px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
}

body.dark-mode .stamp-sig-preview-frame {
  background: #1e293b;
}

.stamp-sig-preview-frame img {
  max-height: 90%;
  max-width: 90%;
  object-fit: contain;
}

/* ==========================================================================
   IMAGE & DOCUMENT LIGHTBOX VIEWER MODAL
   ========================================================================== */
#modal-lightbox .modal-container {
  max-width: 900px;
  background: #0f172a;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}

.lightbox-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  max-height: 75vh;
  overflow: auto;
  padding: 12px;
}

.lightbox-img-view {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.lightbox-iframe-view {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: 6px;
  background: #ffffff;
}

/* ==========================================================================
   CLIENT SEARCH SELECT / FILTER
   ========================================================================== */
.client-filter-select {
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  color: var(--text-heading);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.client-search-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 6px;
}

/* ==========================================================================
   SEARCHABLE CLIENT SELECTOR COMPONENT
   ========================================================================== */
.client-search-wrapper {
  position: relative;
  flex: 1;
}

.client-search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  z-index: 1050;
  padding: 4px;
}

.client-search-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.client-search-item:hover,
.client-search-item.highlighted {
  background: var(--primary-light, rgba(37, 99, 235, 0.15));
  border-color: rgba(37, 99, 235, 0.2);
}

.client-search-item-name {
  font-weight: 600;
  color: var(--text-heading, #f8fafc);
  font-size: 13px;
}

.client-search-item-details {
  font-size: 11.5px;
  color: var(--text-muted, #94a3b8);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.client-search-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

/* ==========================================================================
   SETTINGS TABS & CACHE MANAGEMENT ENGINE
   ========================================================================== */
.security-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  padding: 0 4px 8px;
  flex-wrap: wrap;
}

.sec-tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.sec-tab-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-heading);
}

body.dark-mode .sec-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sec-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Topbar Cache Status Pill */
.topbar-cache-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.topbar-cache-pill:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.topbar-cache-pill.cache-off {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.cache-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  display: inline-block;
}

.topbar-cache-pill.cache-off .cache-pill-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

/* Master Cache Hero Card */
.cache-master-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(14, 165, 233, 0.04) 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
  gap: 16px;
}

body.dark-mode .cache-master-card {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.25) 0%, rgba(15, 23, 42, 0.4) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

.cache-master-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}

.cache-master-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
  max-width: 600px;
}

.cache-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cache-status-pill.pill-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cache-status-pill.pill-disabled {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.cache-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Master Switch Toggle */
.cache-master-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cache-switch-label {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.cache-switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cache-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 28px;
}

body.dark-mode .cache-slider {
  background-color: #475569;
}

.cache-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .cache-slider {
  background-color: #10b981;
}

input:checked + .cache-slider:before {
  transform: translateX(24px);
}

/* Cache Metrics Grid */
.cache-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.cache-metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

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

.cache-metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cache-metric-icon i {
  width: 22px;
  height: 22px;
}

.cache-metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cache-metric-value {
  font-size: 16px;
  font-weight: 800;
  margin: 2px 0 1px;
  color: var(--text-heading);
}

.cache-metric-subtext {
  font-size: 11px;
  color: var(--text-muted);
}

/* Checkbox Row in Cache */
.cache-options-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cache-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.cache-checkbox-row:hover {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.02);
}

.cache-checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
}

/* Benchmark Box */
.cache-benchmark-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.cache-benchmark-box .benchmark-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: #10b981;
}

/* Inactivity Warning Countdown Modal Animations */
@keyframes warningPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 14px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

#modal-inactivity-warning .modal-container {
  animation: warningPulse 3s infinite ease-in-out;
}

/* ==========================================
   ENTERPRISE SETTINGS & CONFIGURATION SYSTEM
   ========================================== */
.settings-tabs-container {
  border-bottom: 1px solid var(--border-color);
  padding: 0 0 12px;
  margin-bottom: 24px;
}

.security-tabs-nav,
.settings-tabs-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.sec-tab-btn,
.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sec-tab-btn:hover,
.settings-tab-btn:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.sec-tab-btn.active,
.settings-tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sec-tab-btn.active i,
.settings-tab-btn.active i {
  color: #ffffff !important;
}

.settings-section-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.color-presets-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.color-swatch-btn:hover {
  transform: scale(1.15);
}

.color-swatch-btn.active {
  border-color: var(--text-heading);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
}

.tax-preset-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tax-preset-pill {
  padding: 4px 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tax-preset-pill:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}