/* =========================================================
   CRM املاک — Main Stylesheet
   بدون وابستگی به CDN — کاملاً لوکال
   ========================================================= */

/* ─── Vazirmatn Font (local) ────────────────────────────── */
@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-Regular.cdc140628f11.woff2") format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-Medium.dd2193b32cbe.woff2") format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-Bold.7958481fe611.woff2") format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-ExtraBold.a0f99309cd35.woff2") format('woff2');
  font-weight: 800;
  font-display: swap;
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Arial, sans-serif; line-height: 1.6; color: #1f2937; background: #f9fafb; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }

/* ─── Layout ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.col-span-2 { grid-column: span 2; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.h-screen { height: 100vh; }
.overflow-hidden { overflow: hidden; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.p-3 { padding: 0.75rem; }
.inline { display: inline; }

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 240px; min-width: 240px;
  background: #1e293b; color: #e2e8f0;
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1rem; border-bottom: 1px solid #334155;
  font-size: 1rem; font-weight: 700; color: #fff;
}
.sidebar-nav { padding: 0.75rem 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem; color: #94a3b8;
  transition: all 0.15s; border-radius: 0;
  font-size: 0.9rem;
}
.nav-link:hover { background: #334155; color: #fff; }
.nav-link.active { background: #3b82f6; color: #fff; }
.sidebar-footer {
  padding: 1rem; border-top: 1px solid #334155;
  display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.user-avatar {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: #3b82f6; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
}
.avatar-lg {
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: #3b82f6; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.25rem;
}
.logout-btn { color: #ef4444; font-size: 1.2rem; padding: 0.25rem; transition: color 0.15s; }
.logout-btn:hover { color: #dc2626; }

/* ─── Main Content ────────────────────────────────────────── */
.main-content { flex: 1; overflow-y: auto; padding: 1.5rem; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: #111827; }
.btn-back { color: #6b7280; font-size: 0.875rem; display: flex; align-items: center; gap: 0.25rem; }
.btn-back:hover { color: #3b82f6; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500; transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-outline { border: 1px solid #d1d5db; color: #374151; background: #fff; }
.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-link { color: #3b82f6; font-size: 0.875rem; }
.btn-link:hover { color: #2563eb; text-decoration: underline; }
.icon-btn { padding: 0.25rem 0.5rem; border-radius: 0.375rem; font-size: 0.875rem; transition: background 0.15s; }
.icon-btn:hover { background: #f3f4f6; }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border: 1px solid #e5e7eb; overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid #e5e7eb;
}
.card-title { font-size: 1rem; font-weight: 600; color: #111827; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid #e5e7eb; background: #f9fafb; }

/* ─── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
/* وقتی دقیقاً ۳ کارت داریم (مثل صفحه‌ی گزارش‌ها) */
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: #fff; border-radius: 0.75rem;
  border: 1px solid #e5e7eb; padding: 1.25rem;
  display: flex; align-items: flex-start; gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-icon { width: 2.75rem; height: 2.75rem; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-label { font-size: 0.8rem; color: #6b7280; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: #111827; }
.stat-change { font-size: 0.75rem; color: #10b981; margin-top: 0.25rem; }

/* ─── Dashboard Grid ──────────────────────────────────────── */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}

/* ─── Tables ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table thead tr { background: #f8fafc; border-bottom: 2px solid #e5e7eb; }
.table th { padding: 0.75rem 1rem; text-align: right; font-size: 0.8rem; font-weight: 600; color: #6b7280; white-space: nowrap; }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; font-size: 0.875rem; vertical-align: middle; }
.table-row:hover td { background: #f9fafb; }
.table tr:last-child td { border-bottom: none; }

/* ─── Badges & Status ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

.status-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 600; cursor: pointer;
}
.status-new { background: #dbeafe; color: #1d4ed8; }
.status-contacted { background: #fef3c7; color: #92400e; }
.status-visiting { background: #e0e7ff; color: #3730a3; }
.status-negotiating { background: #fce7f3; color: #9d174d; }
.status-won { background: #d1fae5; color: #065f46; }
.status-lost { background: #fee2e2; color: #991b1b; }
.status-available { background: #d1fae5; color: #065f46; }
.status-reserved { background: #fef3c7; color: #92400e; }
.status-sold { background: #e5e7eb; color: #374151; }
.status-rented { background: #e0e7ff; color: #3730a3; }

.stage-badge {
  display: inline-flex; padding: 0.2rem 0.6rem;
  border-radius: 0.375rem; font-size: 0.7rem; font-weight: 600;
}
.stage-lead { background: #f3f4f6; color: #6b7280; }
.stage-contacted { background: #dbeafe; color: #1d4ed8; }
.stage-visiting { background: #e0e7ff; color: #3730a3; }
.stage-negotiating { background: #fef3c7; color: #92400e; }
.stage-contract { background: #fce7f3; color: #9d174d; }
.stage-won { background: #d1fae5; color: #065f46; }
.stage-lost { background: #fee2e2; color: #991b1b; }

.priority-badge { display: inline-flex; padding: 0.15rem 0.5rem; border-radius: 0.25rem; font-size: 0.7rem; font-weight: 600; }
.priority-low { background: #f0fdf4; color: #166534; }
.priority-medium { background: #fef9c3; color: #713f12; }
.priority-high { background: #fef3c7; color: #92400e; }
.priority-urgent { background: #fee2e2; color: #991b1b; }

.tag { display: inline-flex; padding: 0.1rem 0.4rem; background: #f3f4f6; color: #6b7280; border-radius: 0.25rem; font-size: 0.7rem; margin: 0.1rem; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label { font-size: 0.85rem; font-weight: 500; color: #374151; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db; border-radius: 0.5rem;
  font-size: 0.875rem; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-error { font-size: 0.78rem; color: #dc2626; }
.form-help { font-size: 0.78rem; color: #9ca3af; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid #e5e7eb; }
.form-section-title { font-size: 0.95rem; font-weight: 600; color: #374151; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #e5e7eb; }

.filter-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.filter-form .form-input, .filter-form .form-select { width: auto; flex: 1; min-width: 140px; }

/* ─── Info Grid ───────────────────────────────────────────── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.info-item { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.6rem; background: #f9fafb; border-radius: 0.5rem; }
.info-label { font-size: 0.75rem; color: #9ca3af; font-weight: 500; }

/* ─── Detail Grid ─────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ─── Notes ───────────────────────────────────────────────── */
.notes-list { display: flex; flex-direction: column; gap: 0.75rem; }
.note-item { padding: 0.75rem; background: #f9fafb; border-right: 3px solid #3b82f6; border-radius: 0.5rem; }
.note-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.note-body { font-size: 0.875rem; color: #374151; }

/* ─── Tasks ───────────────────────────────────────────────── */
.task-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid #f3f4f6; }
.task-item:last-child { border-bottom: none; }
.task-overdue { background: #fef2f2; }
.task-check { width: 1.25rem; height: 1.25rem; border: 2px solid #d1d5db; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; transition: all 0.15s; }
.task-check.checked { background: #10b981; border-color: #10b981; color: #fff; }
.task-body { flex: 1; }
.task-title { font-size: 0.875rem; font-weight: 500; }
.task-due { font-size: 0.75rem; color: #9ca3af; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid #e5e7eb; }
.tab { padding: 0.5rem 1rem; font-size: 0.875rem; color: #6b7280; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab:hover { color: #3b82f6; }
.tab.active { color: #3b82f6; border-bottom-color: #3b82f6; font-weight: 600; }

/* ─── Kanban ──────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.kanban-col { min-width: 240px; width: 240px; background: #f1f5f9; border-radius: 0.75rem; padding: 0.75rem; }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; padding: 0 0.25rem; }
.kanban-col-title { font-size: 0.875rem; font-weight: 600; color: #374151; }
.kanban-col-count { background: #e2e8f0; color: #64748b; border-radius: 9999px; padding: 0.1rem 0.5rem; font-size: 0.75rem; font-weight: 600; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.5rem; min-height: 80px; max-height: calc(100vh - 320px); overflow-y: auto; padding-right: 0.25rem; }
.kanban-card { background: #fff; border-radius: 0.5rem; padding: 0.75rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); border: 1px solid #e5e7eb; }
.kanban-card-title { font-size: 0.875rem; font-weight: 600; color: #111827; display: block; margin-bottom: 0.35rem; }
.kanban-card-title:hover { color: #3b82f6; }
.kanban-card-meta { font-size: 0.75rem; color: #6b7280; display: flex; flex-direction: column; gap: 0.15rem; }
.kanban-card-prop { font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #f3f4f6; }
.stage-move-btns { display: flex; gap: 0.25rem; }
.move-btn { padding: 0.15rem 0.4rem; border-radius: 0.25rem; font-size: 0.75rem; background: #f3f4f6; color: #6b7280; transition: all 0.15s; }
.move-btn:hover { background: #dbeafe; color: #3b82f6; }
.kanban-closed-row { display: grid; grid-template-columns: 1fr; }

/* ─── Properties ──────────────────────────────────────────── */
.property-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.property-card { background: #fff; border-radius: 0.75rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); border: 1px solid #e5e7eb; transition: transform 0.15s, box-shadow 0.15s; }
.property-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.property-img { position: relative; height: 180px; background: #f3f4f6; overflow: hidden; }
.property-img img { width: 100%; height: 100%; object-fit: cover; }
.property-no-img { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 3rem; color: #d1d5db; }
.property-status { position: absolute; top: 0.5rem; right: 0.5rem; }
.property-body { padding: 1rem; }
.property-title { font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.property-title a:hover { color: #3b82f6; }
.property-location { font-size: 0.8rem; color: #6b7280; margin-bottom: 0.5rem; }
.property-specs { display: flex; gap: 0.75rem; font-size: 0.78rem; color: #6b7280; margin-bottom: 0.5rem; }
.property-price { font-size: 0.875rem; font-weight: 600; color: #059669; margin-bottom: 0.75rem; }
.property-footer { display: flex; align-items: center; justify-content: space-between; }
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
.image-item { position: relative; border-radius: 0.5rem; overflow: hidden; }
.image-item img { width: 100%; height: 100px; object-fit: cover; }
.no-image { text-align: center; padding: 2rem; color: #d1d5db; font-size: 2rem; }

/* ─── Stage Buttons ───────────────────────────────────────── */
.stage-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stage-btn { padding: 0.4rem 0.75rem; border-radius: 0.5rem; font-size: 0.8rem; border: 1px solid #e5e7eb; background: #fff; color: #374151; transition: all 0.15s; }
.stage-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.stage-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* ─── List items ──────────────────────────────────────────── */
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.25rem; border-bottom: 1px solid #f3f4f6; font-size: 0.875rem; }
.list-item:last-child { border-bottom: none; }

/* ─── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.page-btn { padding: 0.4rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.375rem; font-size: 0.875rem; color: #374151; background: #fff; transition: all 0.15s; }
.page-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.page-info { font-size: 0.875rem; color: #6b7280; }

/* ─── Auth Pages ──────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.auth-card { background: #fff; border-radius: 1rem; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 1rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; text-align: center; color: #111827; margin-bottom: 0.35rem; }
.auth-subtitle { font-size: 0.875rem; color: #6b7280; text-align: center; margin-bottom: 1.75rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1rem; }

/* ─── Messages ────────────────────────────────────────────── */
.messages-container { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.alert { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-close { font-size: 1.25rem; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* ─── Text utilities ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.line-through { text-decoration: line-through; }
.tracking-widest { letter-spacing: 0.25em; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-blue-600 { color: #2563eb; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }

/* ─── Backgrounds ─────────────────────────────────────────── */
.bg-gray-50 { background-color: #f9fafb; }
.bg-red-50 { background-color: #fef2f2; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-green-100 { background-color: #d1fae5; }
.bg-yellow-100 { background-color: #fef9c3; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-red-100 { background-color: #fee2e2; }
.text-blue-600 { color: #2563eb; }
.text-green-600 { color: #16a34a; }
.text-yellow-600 { color: #ca8a04; }
.text-purple-600 { color: #9333ea; }
.text-red-600 { color: #dc2626; }
.border-red-300 { border-color: #fca5a5; }

/* ─── HTMX loading indicator ─────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Mobile top bar & sidebar overlay (hidden on desktop) ── */
[x-cloak] { display: none !important; }
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

/* ─── Responsive ──────────────────────────────────────────── */

/* Tablet: collapse sidebar to an icon-only rail */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar { width: 64px; min-width: 64px; }
  .sidebar-logo { justify-content: center; padding: 1.25rem 0.5rem; }
  .sidebar-logo span:last-child,
  .nav-link span:last-child,
  .user-info div { display: none; }
  .nav-link { justify-content: center; padding: 0.7rem 0; gap: 0; }
  .nav-link .badge { position: absolute; top: 0.3rem; left: 0.6rem; margin: 0 !important; }
  .nav-link { position: relative; }
  .sidebar-footer { flex-direction: column; gap: 0.5rem; padding: 0.75rem 0.4rem; }
  .user-info { justify-content: center; }
  .stats-grid, .stats-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Phone & small tablet: off-canvas slide-out sidebar */
@media (max-width: 768px) {
  /* جلوگیری از اسکرول افقی ناخواسته در کل صفحه */
  html, body { overflow-x: hidden; max-width: 100%; }
  .main-content { max-width: 100%; }

  .flex.h-screen.overflow-hidden { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }

  .mobile-topbar {
    display: flex; align-items: center; gap: 0.75rem;
    position: sticky; top: 0; z-index: 60;
    background: #1e293b; color: #fff;
    padding: 0.65rem 1rem;
  }
  .mobile-topbar .menu-btn { color: #fff; font-size: 1.5rem; line-height: 1; padding: 0.15rem 0.35rem; }
  .mobile-topbar .mt-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.05rem; }

  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 250px; min-width: 250px; height: 100vh;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 80; box-shadow: -8px 0 30px rgba(0,0,0,.3);
    display: flex; flex-direction: column;
    overflow-y: auto;
  }
  /* منوی ناوبری اسکرول‌پذیر، فوتر همیشه پایین و دیدنی */
  .sidebar-nav { flex: 1 1 auto; overflow-y: auto; }
  .sidebar-footer { flex-shrink: 0; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-logo span:last-child,
  .nav-link span:last-child,
  .user-info div { display: inline; }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); z-index: 70;
  }

  .main-content { height: auto; overflow-y: visible; padding: 1rem; }

  .page-header { flex-wrap: wrap; gap: 0.75rem; }
  .page-title { font-size: 1.25rem; }

  .detail-grid, .dashboard-grid, .form-grid, .info-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .stats-grid, .stats-grid-3 { grid-template-columns: repeat(2, 1fr); }

  .kanban-board { flex-direction: column; overflow-x: visible; }
  .kanban-col { width: 100%; min-width: 0; }
  .kanban-cards { max-height: none; }

  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-form .form-input, .filter-form .form-select { width: 100%; min-width: 0; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .property-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }

  .modal-overlay { padding: 1rem 0.5rem; align-items: flex-start; }
  .modal-box, .auth-card { max-width: 100%; }

  /* Make wide tables scroll horizontally instead of breaking layout */
  .table { min-width: 640px; }
}

/* Very small phones */
@media (max-width: 480px) {
  .stats-grid, .stats-grid-3 { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .lp-hero-text h1 { font-size: 1.7rem; }
}

/* Horizontal scroll wrapper for tables on small screens */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Nav divider */
.nav-divider {
  height: 1px;
  background: #334155;
  margin: 0.5rem 1rem;
}

/* Notifications */
.notif-unread { background: #f0f9ff; border-right: 3px solid #3b82f6; }
.notif-icon { width: 2rem; height: 2rem; border-radius: 50%; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.notif-dropdown { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 320px; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb; }
.notif-item { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; }
.notif-item:last-child { border-bottom: none; }
.notif-footer { padding: 0.5rem 1rem; text-align: center; border-top: 1px solid #e5e7eb; }

/* Badge green */
.badge-green { background: #d1fae5; color: #065f46; }

/* =========================================================
   Landing Page — صفحه فرود عمومی
   ========================================================= */
body.lp { background: #fff; color: #1f2937; }
.lp-container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }

/* Buttons */
.lp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.25rem; border-radius: 0.625rem;
  font-size: 0.95rem; font-weight: 600; transition: all .18s ease;
  white-space: nowrap;
}
.lp-btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; }
.lp-btn-primary { background: #3b82f6; color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.35); }
.lp-btn-primary:hover { background: #2563eb; transform: translateY(-1px); }
.lp-btn-outline { border: 1px solid #d1d5db; color: #374151; background: #fff; }
.lp-btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }
.lp-btn-white { background: #fff; color: #2563eb; }
.lp-btn-white:hover { background: #f0f6ff; transform: translateY(-1px); }

/* Header */
.lp-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid #eef2f7;
}
.lp-nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.lp-logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; color: #1e293b; }
.lp-logo-mark { font-size: 1.4rem; }
.lp-nav-links { display: flex; gap: 1.75rem; }
.lp-nav-links a { color: #475569; font-size: .95rem; font-weight: 500; }
.lp-nav-links a:hover { color: #3b82f6; }

/* Hero */
.lp-hero { padding: 4.5rem 0 3.5rem; background: linear-gradient(180deg, #f0f6ff 0%, #fff 100%); }
.lp-hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.lp-badge {
  display: inline-block; padding: .35rem .85rem; border-radius: 999px;
  background: #dbeafe; color: #1d4ed8; font-size: .8rem; font-weight: 600; margin-bottom: 1.1rem;
}
.lp-hero-text h1 { font-size: 2.6rem; line-height: 1.3; color: #0f172a; font-weight: 800; margin-bottom: 1.1rem; }
.lp-hero-text > p { font-size: 1.12rem; color: #475569; max-width: 34rem; margin-bottom: 1.75rem; }
.lp-hero-actions { display: flex; gap: .85rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.lp-trust { display: flex; gap: 1.25rem; flex-wrap: wrap; color: #16a34a; font-size: .9rem; font-weight: 500; }

/* Hero mock visual */
.lp-hero-visual { display: flex; justify-content: center; }
.lp-mock {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid #e8edf3;
  border-radius: 1rem; box-shadow: 0 20px 50px rgba(15,23,42,.12); overflow: hidden;
}
.lp-mock-bar { display: flex; gap: .4rem; padding: .8rem 1rem; background: #f8fafc; border-bottom: 1px solid #eef2f7; }
.lp-mock-bar span { width: 11px; height: 11px; border-radius: 50%; background: #cbd5e1; }
.lp-mock-body { padding: 1.25rem; }
.lp-mock-stats { display: flex; gap: .75rem; margin-bottom: 1.1rem; }
.lp-mock-stat { flex: 1; background: #f0f6ff; border-radius: .7rem; padding: .8rem .5rem; text-align: center; }
.lp-mock-stat b { display: block; font-size: 1.25rem; color: #1d4ed8; }
.lp-mock-stat small { color: #64748b; font-size: .78rem; }
.lp-mock-row {
  display: flex; align-items: center; gap: .6rem; padding: .7rem .25rem;
  border-bottom: 1px solid #f1f5f9; font-size: .92rem; color: #334155;
}
.lp-mock-row i { margin-right: auto; font-style: normal; font-size: .8rem; color: #94a3b8; }
.lp-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.lp-dot-blue { background: #3b82f6; }
.lp-dot-green { background: #22c55e; }
.lp-dot-amber { background: #f59e0b; }

/* Sections */
.lp-section { padding: 4rem 0; }
.lp-section-alt { background: #f8fafc; }
.lp-section-head { text-align: center; max-width: 36rem; margin: 0 auto 2.75rem; }
.lp-section-head h2 { font-size: 1.9rem; color: #0f172a; font-weight: 800; margin-bottom: .6rem; }
.lp-section-head p { color: #64748b; font-size: 1.05rem; }

/* Feature grid */
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.lp-card {
  background: #fff; border: 1px solid #eef2f7; border-radius: .9rem;
  padding: 1.6rem; transition: all .2s ease;
}
.lp-card:hover { border-color: #bfdbfe; box-shadow: 0 12px 30px rgba(15,23,42,.08); transform: translateY(-3px); }
.lp-card-icon {
  width: 48px; height: 48px; border-radius: .75rem; background: #f0f6ff;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1rem;
}
.lp-card h3 { font-size: 1.15rem; color: #0f172a; margin-bottom: .5rem; }
.lp-card p { color: #64748b; font-size: .95rem; }

/* Steps */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.lp-step { text-align: center; padding: 1rem; }
.lp-step-num {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 1rem;
  background: #3b82f6; color: #fff; font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.lp-step h3 { font-size: 1.15rem; color: #0f172a; margin-bottom: .5rem; }
.lp-step p { color: #64748b; font-size: .95rem; }

/* CTA */
.lp-cta { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%); padding: 3.5rem 0; }
.lp-cta-inner { text-align: center; }
.lp-cta-inner h2 { color: #fff; font-size: 1.9rem; font-weight: 800; margin-bottom: .6rem; }
.lp-cta-inner p { color: #dbeafe; font-size: 1.08rem; margin-bottom: 1.75rem; }

/* Footer */
.lp-footer { background: #0f172a; color: #94a3b8; padding: 2rem 0; }
.lp-footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.lp-footer .lp-logo { color: #e2e8f0; }
.lp-footer p { font-size: .9rem; }

/* Responsive */
@media (max-width: 860px) {
  .lp-hero-inner { grid-template-columns: 1fr; }
  .lp-hero-visual { order: -1; }
  .lp-hero-text h1 { font-size: 2.1rem; }
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-nav-links { display: none; }
}

/* Modal (HTMX) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3rem 1rem; overflow-y: auto;
}
.modal-box { width: 100%; max-width: 42rem; background: #fff; }
