/* ============================================
   DESIGN SYSTEM - Light Minimalism
   ============================================ */

/* CSS Variables - Цветовая палитра */
:root {
  /* Primary Colors - Teal Monochrome Theme */
  --color-primary: #14B8A6;
  --color-primary-hover: #0D9488;
  --color-primary-light: #CCFBF1;

  --color-success: #10B981;
  --color-success-light: #D1FAE5;

  --color-danger: #EF4444;
  --color-danger-light: #FEE2E2;

  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;

  /* Additional Colors */
  --color-orange: #f97316;
  --color-orange-light: #fed7aa;
  --color-danger-dark: #DC2626;
  --color-danger-darker: #B91C1C;

  /* Header Theme - Deep Teal */
  --color-header-bg: #134E4A;
  --color-header-bg-hover: #0F766E;
  --color-header-text: #FFFFFF;
  --color-header-text-muted: #D1FAE5;
  
  /* Neutrals */
  --color-gray-50: #FAFAFA;
  --color-gray-100: #F5F5F5;
  --color-gray-200: #E5E5E5;
  --color-gray-300: #D4D4D4;
  --color-gray-400: #A3A3A3;
  --color-gray-500: #737373;
  --color-gray-600: #525252;
  --color-gray-700: #404040;
  --color-gray-800: #262626;
  --color-gray-900: #171717;
  
  /* Spacing - система 8px */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  
  /* Borders */
  --border-radius-sm: 6px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--color-gray-800);
  background: var(--color-gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Prevent background scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* ============================================
   HEADER - Modern Dark Teal Theme
   ============================================ */

.header {
  background: linear-gradient(135deg, var(--color-header-bg) 0%, var(--color-header-bg-hover) 100%);
  border-bottom: none;
  padding: var(--space-2) 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Brand Logo Styles */
.brand-logo {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  user-select: none;
  padding-top: 6px;
}

.brand-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15),
    0 -1px 1px rgba(0, 0, 0, 0.4);
}

.brand-corp {
  position: absolute;
  top: -2px;
  right: -4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: rgba(209, 250, 229, 0.6);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1),
    0 -1px 1px rgba(0, 0, 0, 0.3);
}

.user-info {
  color: var(--color-header-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-right: var(--space-2);
}

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

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-md);
  color: var(--color-header-text);
  cursor: pointer;
  transition: all 0.2s;
}

.user-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--text-sm);
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.user-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-header-text);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-header-text-muted);
  letter-spacing: 0.3px;
}

.dropdown-arrow {
  font-size: 12px;
  margin-left: 4px;
  transition: transform 0.2s;
}

.user-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
}

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

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 16px;
  color: var(--color-gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-menu-item:first-child {
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.dropdown-menu-item:last-child {
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.dropdown-menu-item:hover {
  background: var(--color-gray-50);
}

.dropdown-menu-item i {
  width: 16px;
  text-align: center;
  opacity: 0.7;
}

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

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

.dropdown-menu-item.logout:hover {
  background: var(--color-danger-light);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

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

/* Toggle Gradients Button */
.btn-toggle-gradients {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  height: 36px;
}

.btn-toggle-gradients:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(20, 184, 166, 0.3);
}

.btn-toggle-gradients:active {
  transform: translateY(0);
}

.btn-toggle-gradients.disabled {
  background: var(--color-gray-300);
  color: var(--color-gray-600);
}

.btn-toggle-gradients.disabled:hover {
  background: var(--color-gray-400);
}

.btn-toggle-gradients i {
  font-size: 14px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: white;
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--color-gray-100);
  border-color: var(--color-gray-400);
}

.btn-logout {
  padding: 8px 16px;
  background: var(--color-gray-100);
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--color-gray-200);
}

.btn-action {
  padding: 6px 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: var(--color-primary);
  color: white;
}

.btn-delete {
  padding: 6px 12px;
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: var(--color-danger);
  color: white;
}

/* Loading state */
.btn-primary.loading .btn-text { 
  opacity: 0; 
}

.btn-primary.loading .btn-loader { 
  opacity: 1; 
}

.btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  opacity: 0;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================
   LAYOUT
   ============================================ */

.layout {
  display: flex;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--color-gray-200);
  padding: var(--space-3) 0;
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  overflow-y: auto;
}

.menu-section {
  padding: 0 var(--space-2);
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--color-gray-600);
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.menu-item:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.menu-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

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

.menu-item.disabled:hover {
  background: transparent;
  color: var(--color-gray-600);
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: var(--space-4);
  width: 100%;  /* ← Добавляем это */
}

/* ============================================
   PAGE ELEMENTS
   ============================================ */

.page-header {
  margin-bottom: var(--space-4);
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #14B8A6 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-1);
}

.page-subtitle {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-gray-600);
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-gray-900);
}

/* ============================================
   SEARCH BAR
   ============================================ */

.search-bar {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  background: white;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-400);
  pointer-events: none;
  font-size: 14px;
}

.search-icon i {
  display: block;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  background: white;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.data-table thead {
  background: var(--color-gray-100);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 16px;
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  border-bottom: 1px solid var(--color-gray-200);
}

.data-table tbody tr {
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Alternating row colors (zebra stripe) */
.data-table tbody tr:nth-child(even) {
  background: #FAFAFA;
}

.data-table tbody tr:hover {
  background: linear-gradient(to right, #CCFBF1 0%, #E6F9F7 100%) !important;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.18);
  transform: translateY(-1px);
}

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

/* Calls Log - narrow Comment column */
#callsLogTableBody td:nth-child(6) {
  width: 60px;
  text-align: center;
}

#callsLogSection .data-table th:nth-child(6) {
  width: 60px;
  text-align: center;
}

/* Admin Estimates - narrow Actions column */
#estimatesTableBody td:nth-child(11) {
  width: 80px;
  text-align: center;
}

#admin-dashboard .data-table th:nth-child(11) {
  width: 80px;
  text-align: center;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-3);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
  opacity: 0.3;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: var(--space-1);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-3);
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: white;
  padding: var(--space-3);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-gray-200);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

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

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-gray-900);
}

/* ============================================
   BADGES
   ============================================ */

.status-badge,
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ============================================
   STATUS BADGES - IMPROVED COLOR SCHEME
   ============================================

   Color Psychology & Differentiation:
   - Diagnostics: Amber (⚠️ Initial assessment, needs attention)
   - Thinking: Indigo (💭 In consideration, client deciding)
   - No Answer: Orange (📞 Communication issue, follow-up needed)
   - Declined: Red (❌ Negative outcome, rejected)
   - Sold: Green (✅ Positive outcome, success)

   Each status has:
   - Distinct hue family (not just brightness)
   - 3px left border for quick scanning
   - High contrast text for readability
   ============================================ */

.status-diagnostics {
  background: #FEF3C7;
  color: #92400E;
  border-left: 3px solid #F59E0B;
}

.status-thinking {
  background: #E0E7FF;
  color: #3730A3;
  border-left: 3px solid #6366F1;
}

.status-no_answer {
  background: #FED7AA;
  color: #9A3412;
  border-left: 3px solid #EA580C;
}

.status-declined {
  background: #FECACA;
  color: #991B1B;
  border-left: 3px solid #DC2626;
}

.status-pending {
  background: #FEF3C7;
  color: #92400E;
  border-left: 3px solid #F59E0B;
}

.status-paid {
  background: #D1FAE5;
  color: #065F46;
  border-left: 3px solid #10B981;
}

.status-sold {
  background: #D1FAE5;
  color: #065F46;
  border-left: 3px solid #10B981;
}

/* Admin logistics statuses - Improved progression */
.status-in_transit {
  background: #DBEAFE;
  color: #1E3A8A;
  border-left: 3px solid #3B82F6;
  font-weight: 600;
}

.status-arrived {
  background: #D1FAE5;
  color: #065F46;
  border-left: 3px solid #10B981;
  font-weight: 600;
}

.status-on_board {
  background: #FEF3C7;
  color: #78350F;
  border-left: 3px solid #F59E0B;
  font-weight: 600;
}

/* Final status - Installed */
.status-installed {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  border-left: 3px solid #065F46;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* ========== GRADIENT ROW BACKGROUNDS (Variant 3) ========== */
/* Gradient backgrounds for table rows - left to right fade */
/* Only active when body has 'gradients-enabled' class */

body.gradients-enabled .data-table tbody tr[data-status="diagnostics"] {
  background: linear-gradient(to right, #FEF3C7 0%, #FFFBEB 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="thinking"] {
  background: linear-gradient(to right, #E0E7FF 0%, #F5F7FF 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="no_answer"] {
  background: linear-gradient(to right, #FED7AA 0%, #FFF4E6 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="declined"] {
  background: linear-gradient(to right, #FECACA 0%, #FEF2F2 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="pending"] {
  background: linear-gradient(to right, #FEF3C7 0%, #FFFBEB 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="paid"] {
  background: linear-gradient(to right, #D1FAE5 0%, #F0FDF4 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="sold"] {
  background: linear-gradient(to right, #D1FAE5 0%, #F0FDF4 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="in_transit"] {
  background: linear-gradient(to right, #DBEAFE 0%, #F0F9FF 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="arrived"] {
  background: linear-gradient(to right, #D1FAE5 0%, #F0FDF4 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="on_board"] {
  background: linear-gradient(to right, #FEF3C7 0%, #FFFBEB 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="installed"] {
  background: linear-gradient(to right, #D1FAE5 0%, #F0FDF4 35%, white 100%) !important;
}

/* Calls Log specific statuses */
body.gradients-enabled .data-table tbody tr[data-status="request"] {
  background: linear-gradient(to right, #D1FAE5 0%, #F0FDF4 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="missed"] {
  background: linear-gradient(to right, #FED7AA 0%, #FFF4E6 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="refund"] {
  background: linear-gradient(to right, #FECACA 0%, #FEF2F2 35%, white 100%) !important;
}

body.gradients-enabled .data-table tbody tr[data-status="spam"] {
  background: linear-gradient(to right, #F3F4F6 0%, #F9FAFB 35%, white 100%) !important;
}

/* Hover effect for gradient rows - use shadow instead of background change */
body.gradients-enabled .data-table tbody tr:hover {
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.25) !important;
  transform: translateY(-1px) !important;
  transition: all 0.2s !important;
}

/* Role badges */
.role-admin {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.role-manager {
  background: var(--color-success-light);
  color: #065F46;
}

.role-technician {
  background: var(--color-warning-light);
  color: #92400E;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
}

.modal-overlay.show {
  display: flex !important;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow: hidden; /* Убираем скролл с основного контейнера */
  display: flex;
  flex-direction: column;
}

@keyframes modalSlide {
  from { 
    opacity: 0; 
    transform: translateY(-20px) scale(0.96); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

.modal-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-gray-200);
  position: relative;
  flex-shrink: 0; /* Не сжимается */
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-gray-900);
}

.close-modal-btn {
  position: absolute;
  right: var(--space-2);
  top: var(--space-2);
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-gray-400);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-modal-btn:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

/* Close button on dark header background - Primary Data Modal, Estimate Details Modal, Unpaid Record Modal, & View Comments Modal */
#primaryDataModal .close-modal-btn,
#editEstimateModal .close-modal-btn,
#unpaidRecordModal .close-modal-btn,
#viewCommentsModal .close-modal-btn {
  color: rgba(255, 255, 255, 0.7);
}

#primaryDataModal .close-modal-btn:hover,
#editEstimateModal .close-modal-btn:hover,
#unpaidRecordModal .close-modal-btn:hover,
#viewCommentsModal .close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: rotate(90deg);
}

.modal-body {
  padding: var(--space-3);
  overflow-y: auto; /* Скролл только в body */
  flex: 1; /* Растягиваем на всю доступную высоту */
}

.modal-footer {
  padding: var(--space-3);
  background: var(--color-gray-50);
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* Wide Call Log Modal */
.call-modal-wide {
  max-width: 1000px;
  width: 95%;
}

.call-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.call-modal-left,
.call-modal-right {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Responsive: stack columns on smaller screens */
@media (max-width: 768px) {
  .call-modal-grid {
    grid-template-columns: 1fr;
  }

  .call-modal-wide {
    width: 100%;
    max-width: 600px;
  }
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 16px 0;
  border-bottom: 2px solid var(--color-gray-200);
  background: var(--color-gray-50);
  margin: 0;
  flex-shrink: 0; /* Не сжимается */
}

.modal-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  color: var(--color-gray-600);
  font-size: var(--text-sm);
  position: relative;
  bottom: -2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-tab i {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-tab.active i {
  transform: scale(1.1);
}

.modal-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: white;
  transform: translateY(-2px);
}

.modal-tab:hover:not(.active) {
  color: var(--color-gray-900);
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.tab-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.modal-tab.active .tab-badge {
  transform: scale(1.05);
}

.tab-content {
  position: relative;
  min-height: 500px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeInTab 0.5s ease-in-out;
}

@keyframes fadeInTab {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInTab {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: var(--space-3);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--border-radius-md);
  font-size: var(--text-sm);
  background: var(--color-gray-50);
  color: var(--color-gray-900);
  font-family: inherit;
  transition: all 0.2s;
}

.form-group input,
.form-group textarea {
  cursor: text;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--color-gray-50);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-group select:hover {
  border-color: var(--color-gray-400);
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group select:valid {
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Manual Override Toggle Switch */
.manual-override-container {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--color-gray-50);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-gray-200);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

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

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.form-group input:disabled,
.form-group textarea:disabled {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-group select:disabled {
  background-color: var(--color-gray-200);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: var(--color-gray-500);
  cursor: not-allowed;
  opacity: 0.6;
}

.read-only-field {
  background: var(--color-gray-100) !important;
  color: var(--color-gray-600);
  font-style: italic;
  cursor: not-allowed;
}

.error-message {
  color: var(--color-danger);
  font-size: var(--text-sm);
  padding: var(--space-2);
  background: var(--color-danger-light);
  border-radius: var(--border-radius-md);
  border-left: 3px solid var(--color-danger);
  margin-bottom: var(--space-2);
  display: none;
}

.error-message:not(:empty) {
  display: block;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 300px;
  max-width: 400px;
  border-left: 4px solid var(--color-success);
  animation: toastSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.toast.toast-success {
  border-left-color: var(--color-success);
}

.toast.toast-error {
  border-left-color: var(--color-danger);
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-gray-800);
}

.toast.fade-out {
  animation: toastFade 0.3s ease-out forwards;
}

@keyframes toastFade {
  to { 
    opacity: 0; 
    transform: translateX(100px); 
  }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

/* Tablet and small laptops (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .modal-content {
    max-width: 90%;
    max-height: 85vh;
  }

  .modal-tabs {
    gap: 6px;
    padding: 14px 14px 0;
  }

  .modal-tab {
    padding: 9px 16px;
    font-size: 13px;
  }

  .modal-tab i {
    font-size: 14px;
  }

  .tab-content {
    min-height: 250px;
  }

  /* Optimize form grid for tablets */
  #editEstimateForm > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile devices (max-width: 768px) */
@media (max-width: 768px) {
  .header-container {
    padding: 0 var(--space-2);
  }

  .brand-name {
    font-size: 22px;
    letter-spacing: 3px;
  }

  .brand-corp {
    font-size: 8px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-2);
  }

  .page-title {
    font-size: var(--text-2xl);
  }

  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

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

  /* Table cards on mobile */
  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table tr {
    margin-bottom: var(--space-2);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--border-radius-md);
    padding: var(--space-2);
    background: white;
  }

  .data-table td {
    padding: var(--space-1) 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Modal optimizations for mobile */
  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--border-radius-md);
    margin: var(--space-2);
  }

  .modal-tabs {
    padding: 12px 8px 0;
    gap: 4px;
  }

  .modal-tab {
    padding: 8px 12px;
    font-size: 12px;
  }

  .modal-tab i {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
  }

  .tab-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin: 0;
    padding: 2px 6px;
    font-size: 10px;
  }

  .modal-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
  }

  .tab-content {
    min-height: 200px;
  }

  /* Make form inputs stack on mobile */
  #editEstimateForm > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  .toast-container {
    left: var(--space-2);
    right: var(--space-2);
  }

  .toast {
    min-width: auto;
  }

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

/* Hamburger menu button */
.mobile-menu-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-md);
  font-size: 18px;
  color: var(--color-header-text);
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-muted {
  color: var(--color-gray-500);
  font-style: italic;
}

.loading-cell {
  text-align: center;
  padding: var(--space-5);
  color: var(--color-gray-500);
}

/* ============================================
   ICON SPACING
   ============================================ */

/* Icons in headers, labels, and buttons */
h1 i, h2 i, h3 i, h4 i, h5 i, h6 i,
label i,
.btn-primary i,
.btn-secondary i,
.filter-group-label i,
.page-title i,
.modal-title i {
  margin-right: 6px;
}

/* Icons in filter buttons and status badges */
.filter-btn i,
.status-badge i {
  margin-right: 4px;
  font-size: 11px;
}

/* Icon-only buttons */
.mobile-menu-btn i {
  margin: 0;
  font-size: 18px;
}

/* ============================================
   DELETE BUTTON ELEGANT HOVER EFFECTS
   ============================================ */

/* Center action buttons in table cell */
.action-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-danger {
  position: relative;
  overflow: visible;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: none;
}

.btn-danger::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-danger:hover::before {
  width: 200%;
  height: 200%;
  animation: pulse 1.5s infinite;
}

.btn-danger:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow:
    0 8px 25px rgba(220, 38, 38, 0.5),
    0 0 15px rgba(220, 38, 38, 0.3);
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #991b1b 100%);
  border-radius: 10px;
}

.btn-danger i {
  font-size: 16px;
  color: #dc2626;
}

.btn-danger:hover i {
  animation:
    trashLidOpen 0.6s ease-in-out,
    trashBounce 0.8s ease-in-out 0.6s infinite;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
  transform-origin: bottom center;
  color: #ffffff;
}

.btn-danger:active {
  transform: translateY(0) scale(0.95);
  box-shadow:
    0 4px 15px rgba(220, 38, 38, 0.4),
    inset 0 3px 10px rgba(0, 0, 0, 0.3);
}

.btn-danger:active i {
  animation: trashCrush 0.3s ease-in-out;
}

/* Пульсация фона */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* Открывающаяся крышка корзины */
@keyframes trashLidOpen {
  0% { transform: rotate(0deg) translateY(0); }
  30% { transform: rotate(-15deg) translateY(-3px); }
  50% { transform: rotate(-20deg) translateY(-5px); }
  70% { transform: rotate(-15deg) translateY(-3px); }
  100% { transform: rotate(0deg) translateY(0); }
}

/* Подпрыгивающая корзина */
@keyframes trashBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-4px) scale(1.05); }
  50% { transform: translateY(-2px) scale(1.02); }
  75% { transform: translateY(-3px) scale(1.03); }
}

/* Сжатие при клике */
@keyframes trashCrush {
  0% { transform: scale(1); }
  50% { transform: scale(0.8) rotate(-5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Full-width delete button (for estimate deletion in Info tab) */
.btn-danger-full {
  padding: 14px 24px;
  width: 100%;
  height: auto;
  font-size: var(--text-base);
  font-weight: 600;
  background: transparent;
  color: #dc2626;
  border: 2px solid transparent;
  border-radius: var(--border-radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.btn-danger-full i {
  color: #dc2626;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

/* Red background highlight that grows from center */
.btn-danger-full::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.btn-danger-full:hover::before {
  width: calc(100% - 8px);
  height: calc(100% - 8px);
}

.btn-danger-full:hover {
  color: #ffffff;
  border-color: #fecaca;
}

.btn-danger-full:hover i {
  color: #ffffff;
  animation: gentleShake 0.5s ease-in-out;
}

.btn-danger-full span {
  position: relative;
  z-index: 2;
  transition: color 0.3s ease;
}

.btn-danger-full:active {
  transform: scale(0.98);
}

.btn-danger-full:active::before {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

/* Gentle shake animation for delete icon */
@keyframes gentleShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
  75% { transform: rotate(-5deg); }
}

/* ============================================
   DELETE WARNING MODAL
   ============================================ */
#deleteWarningModal.show {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#deleteWarningModal .modal-content {
  border-radius: 12px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  border-left: 4px solid #f59e0b !important;
  overflow: hidden;
}

#deleteWarningModal.show .modal-content {
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#deleteWarningModal .modal-header {
  border-radius: 12px 12px 0 0 !important;
}

#deleteWarningModal .modal-footer {
  border-radius: 0 0 12px 12px !important;
}

/* ============================================
   ADMIN OPTIMIZATIONS - Reusable Components
   ============================================ */

/* Modal Header - Dark Gradient Style */
.modal-header-dark {
  background: linear-gradient(135deg, var(--color-header-bg) 0%, var(--color-header-bg-hover) 100%);
  color: white;
  border-bottom: 2px solid var(--color-primary);
  flex-shrink: 0; /* Не сжимается */
}

.modal-header-dark .modal-title {
  color: white;
}

/* ============================================
   CUSTOM MODAL SCROLLBAR
   ============================================ */

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
  width: 4px; /* Тонкий скролл */
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(20, 184, 166, 0.3); /* Полупрозрачный */
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 184, 166, 0.6); /* Темнеет при ховере */
}

/* Firefox scrollbar */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 184, 166, 0.3) transparent;
}

/* ============================================
   WORK BREAKDOWN STYLES
   ============================================ */

.breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-gray-100);
}

.breakdown-item:last-child {
  border-bottom: none;
  border-top: 2px solid var(--color-gray-300);
  margin-top: 12px;
  padding-top: 18px;
  font-weight: 700;
}

.breakdown-label {
  font-size: var(--text-base);
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown-label i {
  width: 28px;
  height: 28px;
  text-align: center;
  color: var(--color-gray-600);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breakdown-amount {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-gray-900);
}

.breakdown-item:last-child .breakdown-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

/* Comment badge */
.comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Comment badge with unread (new) comments */
.comment-badge.has-unread {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0);
  }
}

/* Modal Content - Flexbox Layout */
.modal-content-flex {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border-left: 4px solid var(--color-primary);
}

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

/* Form Section - Orange Border Style */
.form-section-orange {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--color-gray-50);
  border-radius: var(--border-radius-md);
  border-left: 4px solid var(--color-orange);
}

.form-section-orange h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-gray-700);
}

.form-section-orange h4 i {
  color: var(--color-orange);
}

/* Form Section - Red/Danger Border Style */
.form-section-danger {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--color-gray-50);
  border-radius: var(--border-radius-md);
  border-left: 4px solid var(--color-danger-dark);
}

.form-section-danger h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-gray-700);
}

.form-section-danger h4 i {
  color: var(--color-danger-dark);
}

/* Modal Header - Orange Gradient Style (for View Comments Modal) */
.modal-header-orange {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white;
  border-bottom: none;
}

.modal-header-orange .modal-title {
  color: white;
}

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

.status-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.status-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #DC2626; /* Red when inactive */
  border-radius: 24px;
  transition: all 0.3s ease;
}

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

.status-toggle input:checked + .status-toggle-slider {
  background-color: #10B981; /* Green when active */
}

.status-toggle input:checked + .status-toggle-slider:before {
  transform: translateX(20px);
}

.status-toggle:hover .status-toggle-slider {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.status-toggle input:not(:checked):hover + .status-toggle-slider {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
/* ============================================
   PREMIUM MODAL SYSTEM
   Added: 2025-11-17
   ============================================ */

/* ===== MODAL OVERLAY ENHANCEMENTS ===== */
.modal-overlay {
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== MODAL SIZE SYSTEM ===== */
.modal-content-sm {
  max-width: 450px;
  width: 100%;
}

.modal-content-md {
  max-width: 650px;
  width: 100%;
}

.modal-content-lg {
  max-width: 850px;
  width: 100%;
}

.modal-content-xl {
  max-width: 1000px;
  width: 100%;
}

/* ===== PREMIUM MODAL ANIMATION ===== */
.modal-content {
  animation: modalSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ===== PREMIUM HEADERS ===== */
.modal-header-primary {
  background: linear-gradient(135deg, var(--color-header-bg) 0%, var(--color-primary-hover) 50%, var(--color-primary) 100%) !important;
  color: white !important;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header-primary::before {
  content: '';
  /* Shimmer animation removed for performance */
  display: none;
}

.modal-header-primary .modal-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.modal-header-primary .modal-title i {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.modal-header-primary .close-modal-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 1;
  line-height: 1;
}

.modal-header-primary .close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg) scale(1.1);
}

/* Keep existing warning/danger headers as-is */
/* Modal header success variant */
.modal-header-success {
  background: linear-gradient(135deg, #059669 0%, var(--color-success) 100%);
  color: white;
  padding: 28px 32px;
}

/* Modal header info variant (orange) */
.modal-header-info {
  background: linear-gradient(135deg, #D97706 0%, var(--color-warning) 100%);
  color: white;
  padding: 28px 32px;
}

/* ===== PREMIUM FORM SECTIONS ===== */
.form-section {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.form-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: all 0.3s;
}

.form-section:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Section color variants */
.form-section--client::before {
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.form-section--client:hover {
  border-color: var(--color-primary-light);
}

.form-section--work::before {
  background: linear-gradient(180deg, #8B5CF6 0%, #7C3AED 100%);
}

.form-section--work:hover {
  border-color: #EDE9FE;
}

.form-section--payment::before {
  background: linear-gradient(180deg, var(--color-success) 0%, #059669 100%);
}

.form-section--payment:hover {
  border-color: var(--color-success-light);
}

.form-section--financial::before {
  background: linear-gradient(180deg, var(--color-warning) 0%, #D97706 100%);
}

.form-section--financial:hover {
  border-color: var(--color-warning-light);
}

.form-section h4 {
  margin: 0 0 20px 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-gray-100);
  color: var(--color-gray-900);
}

.form-section h4 i {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.form-section--client h4 i {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  color: white;
}

.form-section--work h4 i {
  background: linear-gradient(135deg, #EDE9FE 0%, #8B5CF6 100%);
  color: white;
}

.form-section--payment h4 i {
  background: linear-gradient(135deg, var(--color-success-light) 0%, var(--color-success) 100%);
  color: white;
}

.form-section--financial h4 i {
  background: linear-gradient(135deg, var(--color-warning-light) 0%, var(--color-warning) 100%);
  color: white;
}

/* ============================================
   UNPAID ATTENTION BADGE
   ============================================ */

.unpaid-attention-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.6);
  }
}

/* ===== GRID UTILITIES ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ===== ENHANCED FORM INPUTS ===== */
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* ===== PREMIUM BUTTONS ===== */
.btn-primary {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.4);
}

.btn-primary span,
.btn-primary i {
  position: relative;
  z-index: 1;
}

.btn-secondary:hover {
  transform: translateY(-2px);
}

/* ===== MODAL BODY ENHANCEMENTS ===== */
.modal-body {
  background: linear-gradient(to bottom, var(--color-gray-50) 0%, white 100%);
}

/* ===== MODAL FOOTER ENHANCEMENTS ===== */
.modal-footer {
  background: linear-gradient(to top, var(--color-gray-50) 0%, white 100%);
  border-top: 2px solid var(--color-gray-100);
}

/* ===== BACKWARDS COMPATIBILITY ===== */
/* Keep old classes working for modals we're not updating yet */
.modal-header-dark .modal-title {
  color: white;
}

.form-section-orange {
  background: var(--color-gray-50);
  border: 2px solid var(--color-gray-200);
  border-radius: var(--border-radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.form-section-orange h4 {
  margin: 0 0 var(--space-3) 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-gray-800);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-gray-200);
}

.form-section-danger {
  background: #FEF2F2;
  border: 2px solid #FECACA;
  border-radius: var(--border-radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.form-section-danger h4 {
  margin: 0 0 var(--space-3) 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid #FECACA;
}

/* ========== MONTH PICKER (Calls Log Pagination) - Improved Design ========== */

/* Month Picker - компактный и subtle */
.month-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--border-radius-sm);
  transition: all 0.2s;
}

.month-picker:hover {
  border-color: var(--color-gray-400);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.month-picker.disabled {
  opacity: 0.6;
  pointer-events: none;
  background: var(--color-gray-50);
}

/* Кнопки стрелок - минималистичные */
.month-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: transparent;
  color: var(--color-gray-600);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.month-nav-btn:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.month-nav-btn:active {
  background: var(--color-gray-200);
  transform: scale(0.95);
}

/* Month Display - компактный */
.month-display {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-700);
  min-width: 110px;
  text-align: center;
}

.month-picker.disabled .month-display {
  color: var(--color-gray-400);
}

/* Reset Filters Button - желтый и компактный */
#resetFiltersBtn {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border: 1px solid #FDE68A !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  height: 36px !important;
  transition: all 0.2s !important;
}

#resetFiltersBtn:hover {
  background: #FDE68A !important;
  border-color: #FCD34D !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2) !important;
}

#resetFiltersBtn:active {
  transform: translateY(0) !important;
}

/* Rotate animation for Reset button icon */
#resetFiltersBtn i {
  display: inline-block;
  transition: transform 0.4s ease;
}

#resetFiltersBtn.spinning i {
  animation: spinIcon 0.5s ease-in-out;
}

@keyframes spinIcon {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(-360deg);
  }
}
