/* ═══════════════════════════════════════════════════════════════════════════
   عقودي - منصة إدارة العقود الذكية
   Modern Legal Contracts Management Platform
   ═══════════════════════════════════════════════════════════════════════════ */

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 🎨 Color Palette - Modern & Professional */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  
  --accent-gold: #d4af37;
  --accent-gold-light: #f5d87a;
  --accent-gold-dark: #b8962e;
  
  /* Status Colors */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-400: #34d399;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;
  
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-400: #f87171;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  
  --info-50: #f0f9ff;
  --info-100: #e0f2fe;
  --info-500: #0ea5e9;
  --info-600: #0284c7;
  
  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;
  
  /* Light Theme */
  --bg-app: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f8fafc;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: var(--primary-500);
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Layout */
  --sidebar-width: 280px;
  --header-height: 70px;
}

/* ===== Dark Mode ===== */
body.dark-mode {
  --bg-app: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --bg-hover: #334155;
  
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --border-light: #334155;
  --border-medium: #475569;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* ===== Base Styles ===== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Utilities ===== */
.is-hidden {
  display: none !important;
}

.ms-auto {
  margin-inline-start: auto !important;
}

.fade-in {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== App Shell Layout ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-inline-end: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  margin-bottom: 32px;
}

.sidebar-logo {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md), 0 0 20px rgba(37, 99, 235, 0.3);
}

.sidebar-brand-text {
  flex: 1;
}

.sidebar-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: right;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-link.is-active {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

body.dark-mode .sidebar-link.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.15) 100%);
  color: var(--primary-400);
}

.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-link.is-active svg {
  opacity: 1;
}

/* Sidebar Panel (Account) */
.sidebar-panel {
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
  margin-top: 24px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.account-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
}

body.dark-mode .account-avatar {
  background: linear-gradient(135deg, var(--gray-700) 0%, var(--gray-600) 100%);
  color: var(--gray-400);
}

.account-meta {
  flex: 1;
  min-width: 0;
}

.account-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--gray-400);
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success-500);
  animation: pulse 2s infinite;
}

/* Theme Toggle */
.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-icon .icon-moon {
  display: none;
}

body.dark-mode .btn-icon .icon-sun {
  display: none;
}

body.dark-mode .btn-icon .icon-moon {
  display: block;
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.sidebar-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 0 0 rgba(37, 99, 235, 0);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--border-medium);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn-google {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.btn-google:hover:not(:disabled) {
  background: var(--gray-50);
  box-shadow: var(--shadow-md);
}

body.dark-mode .btn-google {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-logout {
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid var(--danger-100);
}

.btn-logout:hover:not(:disabled) {
  background: var(--danger-500);
  color: white;
  border-color: var(--danger-500);
}

body.dark-mode .btn-logout {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-add {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  padding: 10px 18px;
  font-size: 14px;
}

.btn-add:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.add-icon {
  transition: transform var(--transition-fast);
}

.btn-add:hover .add-icon {
  transform: rotate(90deg);
}

/* ===== Main Content ===== */
.app-main {
  flex: 1;
  margin-right: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

/* ===== Main Content Grid ===== */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.main-content.single-column {
  grid-template-columns: 1fr !important;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-sm);
}

.card-icon.icon-add {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
}

.card-icon.icon-edit {
  background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== List Toolbar ===== */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  align-items: flex-end;
}

.list-toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.toolbar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toolbar-input,
.toolbar-select {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.toolbar-input:focus,
.toolbar-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.list-toolbar-meta {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* ===== Contracts List ===== */
.contracts-list {
  max-height: 650px;
  overflow-y: auto;
  padding-inline-end: 8px;
}

.contracts-list::-webkit-scrollbar {
  width: 6px;
}

.contracts-list::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--radius-full);
}

.contracts-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}

.contracts-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

body.dark-mode .contracts-list::-webkit-scrollbar-track {
  background: var(--gray-800);
}

body.dark-mode .contracts-list::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}

.contracts-list.no-scroll {
  max-height: none;
  overflow: visible;
}

/* ===== Loading State ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
}

body.dark-mode .empty-state-icon {
  background: var(--gray-800);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== Enhanced Empty State ===== */
.empty-state-enhanced {
  text-align: center;
  padding: 60px 32px;
  max-width: 400px;
  margin: 0 auto;
}

.empty-icon-animated {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-500);
  animation: iconFloat 3s ease-in-out infinite;
}

.empty-state-error .empty-icon-animated {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #ef4444;
}

.empty-state-success .empty-icon-animated {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #22c55e;
}

.empty-state-auth .empty-icon-animated {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0ea5e9;
}

body.dark-mode .empty-icon-animated {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.25) 100%);
}

body.dark-mode .empty-state-error .empty-icon-animated {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.25) 100%);
}

body.dark-mode .empty-state-success .empty-icon-animated {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.25) 100%);
}

body.dark-mode .empty-state-auth .empty-icon-animated {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.25) 100%);
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.empty-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  text-align: right;
}

.empty-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.empty-feature-item:hover {
  background: var(--gray-100);
  transform: translateX(-4px);
}

body.dark-mode .empty-feature-item {
  background: var(--gray-800);
}

body.dark-mode .empty-feature-item:hover {
  background: var(--gray-700);
}

.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--success-100);
  color: var(--success-600);
  border-radius: 50%;
  flex-shrink: 0;
}

body.dark-mode .feature-icon {
  background: rgba(34, 197, 94, 0.2);
}

.feature-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.empty-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.empty-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.empty-action-btn:active {
  transform: translateY(0);
}

.empty-state-error .empty-action-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.empty-state-error .empty-action-btn:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.empty-state-auth .empty-action-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.empty-state-auth .empty-action-btn:hover {
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

/* ===== Contract Card ===== */
.contract-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.contract-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
  transform: translateX(-4px);
}

.contract-card:last-child {
  margin-bottom: 0;
}

.contract-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.contract-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.contract-card-ref {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.contract-status {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.status-active {
  background: var(--success-100);
  color: var(--success-700);
}

.status-review {
  background: var(--info-100);
  color: var(--info-600);
}

.status-expired {
  background: var(--danger-100);
  color: var(--danger-600);
}

.status-suspended {
  background: var(--warning-100);
  color: var(--warning-600);
}

.status-cancelled {
  background: var(--gray-100);
  color: var(--gray-600);
}

.status-closing,
.status-closed {
  background: var(--gray-200);
  color: var(--gray-700);
}

body.dark-mode .status-active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-400);
}

body.dark-mode .status-review {
  background: rgba(14, 165, 233, 0.2);
  color: var(--info-500);
}

body.dark-mode .status-expired {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger-400);
}

body.dark-mode .status-suspended {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-400);
}

body.dark-mode .status-cancelled,
body.dark-mode .status-closing,
body.dark-mode .status-closed {
  background: var(--gray-700);
  color: var(--gray-300);
}

.contract-card-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  font-size: 13px;
}

.contract-card-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contract-card-item-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.contract-card-item-value {
  color: var(--text-primary);
  font-weight: 600;
}

.contract-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-md);
}

.btn-edit {
  background: var(--primary-50);
  color: var(--primary-600);
  border: 1px solid var(--primary-100);
}

.btn-edit:hover {
  background: var(--primary-100);
}

.btn-delete {
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid var(--danger-100);
}

.btn-delete:hover {
  background: var(--danger-100);
}

body.dark-mode .btn-edit {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ===== Form Styles ===== */
.form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 24px;
  padding-bottom: 0;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-500);
}

.form-section-header svg {
  color: var(--primary-500);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-input-wrapper {
  margin-bottom: 20px;
}

.form-row .form-input-wrapper {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-label svg {
  color: var(--primary-500);
  flex-shrink: 0;
}

.form-label.required::after {
  content: '*';
  color: var(--danger-500);
  margin-inline-start: 4px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--border-medium);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.contract-preview {
  min-height: 320px;
  font-size: 13px;
  line-height: 1.8;
  background: var(--bg-hover);
  border: 2px dashed var(--border-medium);
}

.form-helper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.form-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.form-actions .btn {
  flex: 1;
}

/* Edit Mode Banner */
.edit-mode-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--warning-50) 0%, var(--warning-100) 100%);
  border: 1px solid var(--warning-200);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

body.dark-mode .edit-mode-banner {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.edit-mode-banner svg {
  color: var(--warning-600);
  flex-shrink: 0;
}

.edit-mode-text {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--warning-700);
}

body.dark-mode .edit-mode-text {
  color: var(--warning-500);
}

.edit-mode-cancel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--warning-200);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--warning-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.edit-mode-cancel:hover {
  background: var(--warning-100);
}

body.dark-mode .edit-mode-cancel {
  background: var(--bg-input);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning-500);
}

/* Form Errors */
.form-errors {
  background: var(--danger-50);
  border: 1px solid var(--danger-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
}

body.dark-mode .form-errors {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.form-errors-title {
  font-weight: 700;
  color: var(--danger-700);
  margin-bottom: 8px;
}

body.dark-mode .form-errors-title {
  color: var(--danger-500);
}

.form-errors ul {
  margin: 0;
  padding-inline-start: 20px;
}

.form-errors li {
  font-size: 13px;
  color: var(--danger-600);
  margin: 4px 0;
}

body.dark-mode .form-errors li {
  color: var(--danger-400);
}

.is-invalid {
  border-color: var(--danger-500) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.inline-input.is-invalid,
.inline-textarea.is-invalid {
  border-color: var(--danger-500) !important;
  border-style: solid !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  padding: 40px 32px;
  margin-right: var(--sidebar-width);
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.footer-brand-text h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.footer-brand-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

.footer-link:hover {
  background: var(--bg-card);
  color: var(--primary-600);
  border-color: var(--primary-200);
}

.footer-bottom {
  width: 100%;
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
}

.footer-bottom p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.footer-bottom strong {
  color: var(--text-primary);
}

.footer-copyright {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Load More ===== */
.load-more-container {
  text-align: center;
  padding: 20px;
  margin-top: 16px;
}

.btn-load-more {
  padding: 12px 28px;
  font-size: 14px;
  min-width: 180px;
}

/* ===== Toast / Notifications ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  padding: 16px 24px;
  background: var(--gray-800);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

.toast.toast-success {
  background: var(--success-600);
}

.toast.toast-error {
  background: var(--danger-600);
}

/* Toast Message - الإشعارات */
.toast-message {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--gray-800);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  animation: slideUp 0.3s ease;
}

.toast-message.toast--success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
}

.toast-message.toast--error {
  background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
}

.toast-message.toast--info {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
}

.toast-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.toast-text {
  flex: 1;
}

.toast-message.toast-out {
  animation: slideDown 0.3s ease forwards;
}

/* Undo Toast - تراجع الحذف */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--gray-900);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 14px;
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

body.dark-mode .undo-toast {
  background: var(--gray-700);
  border: 1px solid var(--gray-600);
}

.undo-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.undo-icon {
  color: var(--warning-400);
  font-size: 16px;
}

.undo-text {
  font-weight: 500;
}

.undo-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.undo-btn:hover {
  background: var(--primary-400);
  transform: scale(1.02);
}

.undo-toast-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--gray-400);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.undo-toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.undo-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary-500);
  animation: progressShrink 5s linear forwards;
}

@keyframes progressShrink {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.undo-toast.slide-out {
  animation: slideOutRight 0.3s ease forwards;
}

/* ===== Confirm Dialog - حوار التأكيد ===== */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.confirm-overlay.show {
  opacity: 1;
}

.confirm-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
}

.confirm-dialog.show {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  background: var(--gray-100);
  border-radius: 50%;
  font-size: 28px;
  color: var(--text-secondary);
}

.confirm-danger .confirm-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-500);
}

.confirm-warning .confirm-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-500);
}

.confirm-success .confirm-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-500);
}

body.dark-mode .confirm-icon {
  background: var(--gray-700);
}

.confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.confirm-message {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.confirm-details {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.confirm-cancel {
  background: var(--gray-100);
  color: var(--text-secondary);
}

.confirm-cancel:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

body.dark-mode .confirm-cancel {
  background: var(--gray-700);
  color: var(--gray-300);
}

body.dark-mode .confirm-cancel:hover {
  background: var(--gray-600);
  color: white;
}

.confirm-ok {
  color: white;
}

.confirm-ok.confirm-danger {
  background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
}

.confirm-ok.confirm-danger:hover {
  background: linear-gradient(135deg, var(--danger-600) 0%, var(--danger-700) 100%);
  transform: translateY(-1px);
}

.confirm-ok.confirm-warning {
  background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
}

.confirm-ok.confirm-warning:hover {
  background: linear-gradient(135deg, var(--warning-600) 0%, var(--warning-700) 100%);
  transform: translateY(-1px);
}

.confirm-ok.confirm-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
}

.confirm-ok.confirm-success:hover {
  background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
  transform: translateY(-1px);
}

.confirm-ok.confirm-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
}

.confirm-ok.confirm-primary:hover {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  transform: translateY(-1px);
}

.confirm-ok.confirm-secondary {
  background: var(--gray-600);
}

.confirm-ok.confirm-secondary:hover {
  background: var(--gray-700);
  transform: translateY(-1px);
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
  /* Layout adjustments for tablets */
}

@media (max-width: 992px) {
  :root {
    --sidebar-width: 260px;
  }
  
  .contract-card-body {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    transition: transform var(--transition-normal);
  }
  
  .sidebar.is-open {
    transform: translateX(0);
  }
  
  .app-main {
    margin-right: 0;
    padding: 16px;
  }
  
  .footer {
    margin-right: 0;
  }
  
  .list-toolbar {
    flex-direction: column;
  }
  
  .list-toolbar-group {
    min-width: 100%;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .contract-card-body {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 20px;
  }
  
  .card-header {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .btn-add {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Print Styles ===== */
@media print {
  .sidebar,
  .btn,
  .list-toolbar,
  .footer {
    display: none !important;
  }
  
  .app-main {
    margin-right: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== Focus Visible ===== */
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
  background: var(--primary-200);
  color: var(--primary-900);
}

body.dark-mode ::selection {
  background: var(--primary-800);
  color: var(--primary-100);
}

/* ===== Scrollbar (global) ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

body.dark-mode ::-webkit-scrollbar-track {
  background: var(--gray-800);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Live Document Editor - المعاينة المباشرة للعقد
   ═══════════════════════════════════════════════════════════════════════════ */

/* Editor Header */
.live-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.live-editor-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-editor-title .card-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.live-editor-title .card-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.live-editor-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.live-editor-actions {
  display: flex;
  gap: 8px;
}

/* Live Document Container */
.live-document {
  background: var(--gray-100);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 24px;
}

body.dark-mode .live-document {
  background: var(--gray-800);
}

/* Document Paper */
.live-document-paper {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 56px;
  max-width: 900px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.9;
  color: var(--gray-800);
}

body.dark-mode .live-document-paper {
  background: var(--gray-900);
  color: var(--gray-200);
}

/* Bismillah */
.doc-bismillah {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-700);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary-100);
}

body.dark-mode .doc-bismillah {
  color: var(--primary-400);
  border-color: var(--primary-900);
}

/* Document Title */
.doc-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 24px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: var(--radius-lg);
  border: 2px solid var(--primary-200);
}

body.dark-mode .doc-title {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary-800);
  color: var(--gray-100);
}

/* Meta Row */
.doc-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

body.dark-mode .doc-meta-row {
  background: var(--gray-800);
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Document Sections */
.doc-section {
  margin-bottom: 28px;
}

.doc-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-700);
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--primary-50);
  border-radius: var(--radius-md);
  border-right: 4px solid var(--primary-500);
}

body.dark-mode .doc-section-title {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-400);
}

.doc-paragraph {
  margin-bottom: 12px;
  text-align: justify;
}

.doc-paragraph.doc-sub {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Document Lists */
.doc-list {
  margin: 12px 0;
  padding-inline-start: 24px;
}

.doc-list li {
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Party Boxes */
.doc-party {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

body.dark-mode .doc-party {
  background: rgba(255, 255, 255, 0.03);
}

.doc-party-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-medium);
}

.doc-party-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.doc-party-role {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.doc-party-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-field-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 120px;
  flex-shrink: 0;
}

/* Inline Inputs - المدخلات داخل النص */
.inline-input {
  border: none;
  border-bottom: 2px dashed var(--primary-300);
  background: transparent;
  padding: 6px 12px;
  font-family: inherit;
  font-size: inherit;
  color: var(--primary-700);
  font-weight: 600;
  transition: all var(--transition-fast);
  min-width: 120px;
}

.inline-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

.inline-input:hover {
  border-color: var(--primary-400);
  background: rgba(59, 130, 246, 0.05);
}

.inline-input:focus {
  outline: none;
  border-color: var(--primary-500);
  border-style: solid;
  background: rgba(59, 130, 246, 0.08);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

body.dark-mode .inline-input {
  color: var(--primary-400);
  border-color: var(--primary-700);
}

body.dark-mode .inline-input:hover,
body.dark-mode .inline-input:focus {
  background: rgba(59, 130, 246, 0.15);
}

/* Inline Input Sizes */
.inline-name {
  min-width: 200px;
  flex: 1;
}

.inline-id {
  min-width: 150px;
  max-width: 200px;
}

.inline-phone {
  min-width: 130px;
  max-width: 160px;
}

.inline-email {
  min-width: 200px;
  flex: 1;
}

.inline-date {
  min-width: 150px;
  max-width: 180px;
}

.inline-money {
  min-width: 100px;
  max-width: 150px;
  text-align: center;
}

.inline-law {
  min-width: 180px;
}

/* Inline Input Wrapper */
.inline-input-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-50);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-200);
}

body.dark-mode .inline-input-wrapper {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary-800);
}

.inline-currency {
  font-weight: 600;
  color: var(--primary-600);
  white-space: nowrap;
}

body.dark-mode .inline-currency {
  color: var(--primary-400);
}

/* Inline Textarea */
.inline-textarea {
  width: 100%;
  border: 2px dashed var(--primary-300);
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.03);
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
  transition: all var(--transition-fast);
}

.inline-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.inline-textarea:hover {
  border-color: var(--primary-400);
}

.inline-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  border-style: solid;
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

body.dark-mode .inline-textarea {
  background: rgba(59, 130, 246, 0.05);
  border-color: var(--primary-700);
}

.inline-notes {
  min-height: 60px;
  background: var(--warning-50);
  border-color: var(--warning-300);
}

body.dark-mode .inline-notes {
  background: rgba(245, 158, 11, 0.05);
  border-color: var(--warning-700);
}

.doc-textarea-wrapper {
  position: relative;
}

.doc-textarea-wrapper .textarea-counter {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Notes Section */
.doc-notes-section {
  background: var(--warning-50);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--warning-200);
}

body.dark-mode .doc-notes-section {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.2);
}

.doc-notes-section .doc-section-title {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 12px;
  color: var(--warning-700);
}

body.dark-mode .doc-notes-section .doc-section-title {
  color: var(--warning-400);
}

.doc-optional {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

/* Signatures */
.doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border-medium);
}

.doc-signature-box {
  text-align: center;
  padding: 24px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

body.dark-mode .doc-signature-box {
  background: rgba(255, 255, 255, 0.03);
}

.doc-signature-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.doc-signature-line {
  height: 1px;
  background: var(--border-medium);
  margin-bottom: 12px;
}

.doc-signature-name {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
}

/* Contract Status Bar */
.contract-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

body.dark-mode .contract-status-bar {
  background: rgba(255, 255, 255, 0.03);
}

.status-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-bar-label svg {
  color: var(--primary-500);
}

.status-select {
  flex: 1;
  max-width: 300px;
  padding: 12px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.status-select:hover {
  border-color: var(--border-medium);
}

.status-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Live Editor Footer */
.live-editor-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.live-editor-footer .btn {
  min-width: 160px;
}

/* Button Enhancements */
.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--primary-400);
  color: var(--primary-600);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

/* Responsive Live Editor */
@media (max-width: 992px) {
  .live-document-paper {
    padding: 32px 28px;
  }
  
  .doc-meta-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .doc-signatures {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .live-editor-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .live-editor-title {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .live-editor-actions {
    width: 100%;
    justify-content: center;
  }
  
  .live-document {
    padding: 16px;
  }
  
  .live-document-paper {
    padding: 24px 20px;
    font-size: 14px;
  }
  
  .doc-title {
    font-size: 18px;
    padding: 12px 16px;
  }
  
  .doc-field-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .doc-field-label {
    min-width: auto;
  }
  
  .inline-input,
  .inline-name,
  .inline-id,
  .inline-phone,
  .inline-email,
  .inline-date,
  .inline-money,
  .inline-law {
    width: 100%;
    min-width: auto;
    max-width: none;
  }
  
  .contract-status-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .status-select {
    max-width: none;
  }
  
  .live-editor-footer {
    flex-direction: column;
  }
  
  .live-editor-footer .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .doc-party-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .inline-input-wrapper {
    flex-wrap: wrap;
  }
}

/* ===== Service Type Options ===== */
.doc-service-type {
  margin-bottom: 20px;
}

.service-type-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.service-option {
  cursor: pointer;
}

.service-option input[type="radio"] {
  display: none;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-hover);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  text-align: center;
}

.option-card:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

.service-option input[type="radio"]:checked + .option-card {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

body.dark-mode .service-option input[type="radio"]:checked + .option-card {
  background: rgba(59, 130, 246, 0.15);
}

.option-icon {
  font-size: 24px;
}

.option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Conditional Section */
.doc-conditional-section {
  margin-top: 20px;
  padding: 20px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px dashed var(--primary-300);
  border-radius: var(--radius-lg);
}

body.dark-mode .doc-conditional-section {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--primary-700);
}

.doc-subsection-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-600);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .doc-subsection-title {
  color: var(--primary-400);
}

.doc-subsection-title::before {
  content: "▸";
}

/* Inline Select */
.inline-select {
  border: 2px dashed var(--primary-300);
  background: transparent;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--primary-700);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 180px;
  transition: all var(--transition-fast);
}

.inline-select:hover {
  border-color: var(--primary-400);
  background: rgba(59, 130, 246, 0.05);
}

.inline-select:focus {
  outline: none;
  border-color: var(--primary-500);
  border-style: solid;
}

body.dark-mode .inline-select {
  color: var(--primary-400);
  border-color: var(--primary-700);
  background: rgba(59, 130, 246, 0.1);
}

/* Inline Radio Group */
.inline-radio-group {
  display: flex;
  gap: 20px;
}

.inline-radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.inline-radio-group label:hover {
  color: var(--primary-600);
}

.inline-radio-group input[type="radio"] {
  accent-color: var(--primary-500);
  width: 16px;
  height: 16px;
}

/* ===== Payment Type Options ===== */
.doc-payment-type {
  margin: 20px 0;
}

.payment-type-options {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.payment-option {
  cursor: pointer;
  flex: 1;
}

.payment-option input[type="radio"] {
  display: none;
}

.payment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  background: var(--bg-hover);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.payment-card:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

.payment-option input[type="radio"]:checked + .payment-card {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

body.dark-mode .payment-option input[type="radio"]:checked + .payment-card {
  background: rgba(59, 130, 246, 0.15);
}

.payment-icon {
  font-size: 20px;
}

.payment-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Payment Schedule */
.payment-schedule {
  margin: 16px 0;
}

.payment-row {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 120px 40px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.payment-row.payment-header {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-medium);
}

.payment-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-100);
  color: var(--primary-700);
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
}

.inline-small {
  padding: 8px 10px;
  font-size: 13px;
  min-width: auto !important;
}

.inline-tiny {
  width: 60px !important;
  min-width: auto !important;
  text-align: center;
  padding: 4px 8px;
}

.inline-suffix {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-icon-small {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--error-100);
  color: var(--error-600);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.btn-icon-small:hover {
  background: var(--error-200);
  transform: scale(1.1);
}

.payment-total {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--primary-50);
  border-radius: var(--radius-md);
  font-weight: 700;
  color: var(--primary-700);
  text-align: center;
}

body.dark-mode .payment-total {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-400);
}

/* ===== Obligations Checkboxes ===== */
.doc-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.obligations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.obligation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.obligation-item:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.obligation-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--success-500);
  margin-top: 2px;
  flex-shrink: 0;
}

.obligation-item input[type="checkbox"]:checked + .obligation-text {
  color: var(--text-primary);
}

.obligation-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  transition: color var(--transition-fast);
}

body.dark-mode .obligation-item {
  background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .obligation-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Address input */
.inline-address {
  min-width: 280px;
  flex: 1;
}

/* Responsive for new elements */
@media (max-width: 768px) {
  .service-type-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .payment-type-options {
    flex-direction: column;
  }
  
  .payment-row {
    grid-template-columns: 40px 1fr 1fr;
    gap: 8px;
  }
  
  .payment-row.payment-header span:nth-child(4),
  .payment-row.payment-header span:nth-child(5),
  .payment-row span:nth-child(5) {
    display: none;
  }
  
  .inline-radio-group {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .service-type-options {
    grid-template-columns: 1fr 1fr;
  }
  
  .option-card {
    padding: 12px 8px;
  }
  
  .option-icon {
    font-size: 20px;
  }
  
  .option-label {
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Print Styles - تنسيقات الطباعة المحسّنة (أبيض وأسود)
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  /* إعادة تعيين الصفحة */
  @page {
    size: A4;
    margin: 15mm 20mm;
  }
  
  /* تحويل كل شيء للأبيض والأسود */
  * {
    -webkit-filter: grayscale(100%) !important;
    filter: grayscale(100%) !important;
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* إخفاء كل شيء ماعدا المستند */
  .sidebar,
  .list-card,
  .live-editor-header,
  .live-editor-actions,
  .edit-mode-banner,
  .contract-status-bar,
  .live-editor-footer,
  .footer,
  .form-errors,
  #form-errors,
  .btn,
  button,
  .theme-toggle,
  .mobile-menu-btn,
  .header {
    display: none !important;
  }
  
  /* إعدادات الصفحة الأساسية */
  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    color: #000 !important;
    font-size: 12pt !important;
    line-height: 1.6 !important;
  }
  
  /* إظهار المستند فقط */
  .app-layout {
    display: block !important;
  }
  
  .app-main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  .container {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  
  /* إظهار بطاقة النموذج */
  .form-card,
  #form-card {
    display: block !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }
  
  .live-document {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }
  
  .live-document-paper {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
    background: white !important;
  }
  
  /* عنوان العقد */
  .doc-title {
    font-size: 18pt !important;
    color: #000 !important;
    text-align: center !important;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #333 !important;
  }
  
  /* بيانات العقد */
  .doc-meta-row {
    justify-content: space-between !important;
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 10px !important;
    margin-bottom: 15px !important;
  }
  
  .doc-meta-item {
    font-size: 10pt !important;
  }
  
  .doc-label {
    font-weight: bold !important;
    color: #000 !important;
  }
  
  /* أقسام المستند */
  .doc-section {
    margin-bottom: 15px !important;
    padding: 10px 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  
  .doc-section-title {
    font-size: 13pt !important;
    font-weight: bold !important;
    color: #000 !important;
    border-bottom: 1px solid #666 !important;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
  }
  
  /* بيانات الأطراف */
  .doc-party {
    margin-bottom: 12px !important;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 0 !important;
    background: #fafafa !important;
    break-inside: avoid !important;
  }
  
  .doc-party-header {
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 5px !important;
    margin-bottom: 8px !important;
  }
  
  .doc-party-number {
    background: #333 !important;
    color: white !important;
    width: 22px !important;
    height: 22px !important;
    font-size: 11pt !important;
  }
  
  .doc-party-role {
    font-size: 11pt !important;
    font-weight: bold !important;
    color: #000 !important;
  }
  
  .doc-field-row {
    padding: 3px 0 !important;
    font-size: 10pt !important;
  }
  
  .doc-field-label {
    font-weight: bold !important;
    color: #333 !important;
    min-width: 100px !important;
  }
  
  /* الحقول المدخلة */
  .inline-input,
  .inline-select,
  .inline-textarea {
    border: none !important;
    border-bottom: 1px dotted #999 !important;
    background: transparent !important;
    padding: 2px 5px !important;
    color: #000 !important;
    font-size: 10pt !important;
    min-width: 100px !important;
    font-family: inherit !important;
  }
  
  .inline-input:focus,
  .inline-textarea:focus {
    box-shadow: none !important;
  }
  
  .inline-input::placeholder,
  .inline-textarea::placeholder {
    color: transparent !important;
  }
  
  /* إخفاء العناصر الفارغة */
  .inline-input:placeholder-shown {
    border-bottom-style: solid !important;
  }
  
  /* نطاق العمل */
  .scope-phase {
    border: 1px solid #000 !important;
    background: white !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
    border-radius: 0 !important;
    break-inside: avoid !important;
  }
  
  .scope-primary {
    background: #f5f5f5 !important;
    border-color: #000 !important;
    border-width: 2px !important;
  }
  
  .scope-phase-badge {
    background: #000 !important;
    color: white !important;
    padding: 2px 8px !important;
    font-size: 9pt !important;
  }
  
  .scope-phase-title {
    font-size: 11pt !important;
    font-weight: bold !important;
    color: #000 !important;
  }
  
  .scope-list li {
    font-size: 10pt !important;
    color: #000 !important;
    padding: 3px 20px 3px 0 !important;
  }
  
  .scope-list li::before {
    color: #000 !important;
    content: "●" !important;
  }
  
  /* خيارات النطاق الإضافية */
  .scope-options-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  
  .scope-option-box {
    padding: 8px !important;
    border: 1px solid #666 !important;
    background: white !important;
    border-radius: 0 !important;
  }
  
  .scope-option-item input:checked + .scope-option-box {
    border: 2px solid #000 !important;
    background: #e0e0e0 !important;
  }
  
  .scope-option-item input:checked + .scope-option-box::before {
    content: "✓ " !important;
    font-weight: bold !important;
  }
  
  .scope-option-icon {
    display: none !important;
  }
  
  .scope-option-label {
    font-size: 9pt !important;
    color: #000 !important;
    font-weight: bold !important;
  }
  
  .scope-option-desc {
    font-size: 8pt !important;
    color: #333 !important;
  }
  
  /* إخفاء الخيارات غير المحددة بشكل أوضح */
  .scope-option-item input:not(:checked) + .scope-option-box {
    opacity: 0.4 !important;
    background: #f9f9f9 !important;
  }
  
  /* الأتعاب */
  .inline-money {
    font-weight: bold !important;
  }
  
  .inline-currency {
    font-size: 9pt !important;
  }
  
  /* جدول الدفعات */
  .payment-schedule {
    border: 1px solid #ccc !important;
  }
  
  .payment-row {
    border-bottom: 1px solid #ddd !important;
    padding: 5px !important;
  }
  
  .payment-header {
    background: #eee !important;
    font-weight: bold !important;
  }
  
  .btn-remove {
    display: none !important;
  }
  
  /* الالتزامات */
  .obligations-list {
    columns: 1 !important;
  }
  
  .obligation-item {
    font-size: 10pt !important;
    padding: 3px 0 !important;
    break-inside: avoid !important;
  }
  
  .obligation-item input[type="checkbox"] {
    width: 12px !important;
    height: 12px !important;
  }
  
  /* التوقيعات */
  .doc-signatures {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 30px !important;
    padding-top: 20px !important;
    border-top: 2px solid #333 !important;
  }
  
  .doc-signature-box {
    border: 1px solid #ccc !important;
    padding: 15px !important;
    min-height: 100px !important;
  }
  
  .doc-signature-title {
    font-size: 10pt !important;
    font-weight: bold !important;
    color: #000 !important;
  }
  
  .doc-signature-name {
    font-size: 11pt !important;
    color: #000 !important;
  }
  
  .doc-signature-line {
    border-top: 1px solid #333 !important;
    margin-top: 40px !important;
  }
  
  /* ملاحظات إضافية */
  .doc-notes-section {
    break-inside: avoid !important;
    border: 1px solid #ccc !important;
    background: #fffef0 !important;
    padding: 10px !important;
  }
  
  .doc-notes-title {
    font-size: 11pt !important;
    font-weight: bold !important;
    color: #000 !important;
  }
  
  /* Radio buttons */
  .inline-radio-group label {
    font-size: 10pt !important;
  }
  
  /* General card styles */
  .card {
    box-shadow: none !important;
    border: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   تنسيقات مراحل نطاق العمل - Scope Phases
   ═══════════════════════════════════════════════════════════════════════════ */

.scope-phase {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.scope-primary {
  border-color: var(--success-400);
  background: linear-gradient(135deg, var(--success-50) 0%, transparent 100%);
}

[data-theme="dark"] .scope-primary {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.1) 0%, transparent 100%);
  border-color: var(--success-600);
}

.scope-phase-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.scope-phase-badge {
  background: var(--success-500);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.scope-phase-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scope-phase-content {
  padding-right: 0.5rem;
}

.scope-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
}

.scope-list li {
  position: relative;
  padding: 0.5rem 1.5rem 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.6;
}

.scope-list li::before {
  content: "✓";
  position: absolute;
  right: 0;
  color: var(--success-500);
  font-weight: bold;
}

/* خيارات إضافية Grid */
.scope-options {
  background: var(--bg-hover);
}

[data-theme="dark"] .scope-options {
  background: var(--bg-card);
}

.scope-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .scope-options-grid {
    grid-template-columns: 1fr;
  }
}

.scope-option-item {
  cursor: pointer;
}

.scope-option-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scope-option-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.scope-option-item:hover .scope-option-box {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

[data-theme="dark"] .scope-option-item:hover .scope-option-box {
  background: rgba(59, 130, 246, 0.1);
}

.scope-option-item input:checked + .scope-option-box {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .scope-option-item input:checked + .scope-option-box {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary-400);
}

.scope-option-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.scope-option-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.scope-option-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.scope-option-item input:checked + .scope-option-box .scope-option-label {
  color: var(--primary-600);
}

[data-theme="dark"] .scope-option-item input:checked + .scope-option-box .scope-option-label {
  color: var(--primary-300);
}

/* تنسيق حقول بيانات العقد */
.doc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media print {
  .scope-option-box {
    border-color: #ccc !important;
    background: transparent !important;
  }
  
  .scope-option-item input:checked + .scope-option-box {
    border-color: #000 !important;
    background: #f0f0f0 !important;
  }
  
  .scope-primary {
    background: #f8f8f8 !important;
    border-color: #999 !important;
  }
}
