/* ==========================================
   TANYA — Real Estate Transaction Platform
   ========================================== */

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

:root {
  --primary: #1a56e8;
  --primary-dark: #1347c8;
  --primary-light: #e8effe;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --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;
  --white: #ffffff;
  --sidebar-width: 240px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-50); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; }
img { max-width: 100%; }

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

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: var(--gray-300);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.75rem;
}
.logo-link { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.logo-text { font-size: 1.125rem; font-weight: 700; color: var(--white); letter-spacing: -0.01em; }

.nav-links { list-style: none; padding: 0 0.75rem; flex: 1; }
.nav-links li { margin-bottom: 2px; }

.nav-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  color: var(--gray-400);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  cursor: pointer;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--white); text-decoration: none; }
.nav-link.active { background: rgba(26,86,232,0.2); color: #93b4ff; }

.sidebar-bottom {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 2px;
}
.logout-btn { background: none; border: none; font-size: 0.875rem; text-align: left; }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1200px;
}

/* ---- Page Header ---- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
}
.page-title { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; }
.page-subtitle { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.25rem; }
.back-link { font-size: 0.875rem; color: var(--gray-500); display: block; margin-bottom: 0.375rem; }
.back-link:hover { color: var(--primary); }
.header-actions { display: flex; gap: 0.75rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-full { width: 100%; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stats-row-5 {
  grid-template-columns: repeat(5, 1fr);
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--primary-200, #93c5fd);
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.stat-icon-blue { background: #eff6ff; color: #2563eb; }
.stat-icon-green { background: #f0fdf4; color: #16a34a; }
.stat-icon-emerald { background: #ecfdf5; color: #059669; }
.stat-icon-indigo { background: #eef2ff; color: #4f46e5; }
.stat-icon-amber { background: #fffbeb; color: #d97706; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.25rem; }

/* Skeleton loading animation */
.stat-skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  min-height: 2rem;
  min-width: 4rem;
  color: transparent !important;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Attention indicator for deadlines */
.stat-card-attention .stat-value.has-deadlines {
  color: #d97706;
}
.stat-card-attention .stat-value.no-deadlines {
  color: #16a34a;
}

/* ---- Dashboard Sections ---- */
.dashboard-section { margin-bottom: 2.5rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--gray-900); margin-bottom: 1rem; }
.section-header .section-title { margin-bottom: 0; }
.link-sm { font-size: 0.875rem; color: var(--primary); }

/* ---- Projects Grid ---- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.project-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  text-decoration: none;
  display: block;
  color: inherit;
  overflow: hidden;
}
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }

.project-card-cover {
  position: relative;
  height: 140px;
  background: linear-gradient(135deg, #1a56e8 0%, #0ea5e9 100%);
  overflow: hidden;
}
.project-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-cover .cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  color: rgba(255,255,255,0.4);
}

/* Deal type badge — top-left overlay */
.deal-type-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
  z-index: 2;
}
.deal-type-buyside { background: rgba(59,130,246,0.85); color: white; }
.deal-type-listside { background: rgba(16,185,129,0.85); color: white; }

/* Favorite star — top-right */
.card-fav-star {
  position: absolute; top: 8px; right: 8px;
  font-size: 1.125rem;
  color: rgba(255,255,255,0.6);
  z-index: 2;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  line-height: 1;
}
.card-fav-star:hover { color: var(--warning); transform: scale(1.15); }
.card-fav-star.active { color: var(--warning); }

/* Card body */
.project-card-body { padding: 0.875rem 1rem 1rem; }

/* Address row with stage dot */
.project-card-address-row {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.project-card-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.stage-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.8);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

/* MLS badge */
.project-card-mls { margin-bottom: 0.375rem; }
.mls-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.6875rem; font-weight: 500;
  color: var(--success);
  background: #d1fae5;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.mls-badge svg { stroke: var(--success); }

/* Price */
.card-price-primary {
  font-size: 1.125rem; font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.125rem;
}
.price-line {
  font-size: 0.75rem; color: var(--gray-500);
  margin-bottom: 0.625rem;
}

/* Agent row */
.project-card-agent-row {
  display: flex; align-items: center; gap: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--gray-100);
}
.card-agent-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.card-agent-info { flex: 1; min-width: 0; }
.card-agent-name {
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-700);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-closing {
  font-size: 0.75rem; color: var(--gray-400);
  margin-top: 0.125rem;
}

/* Stage badges */
.stage-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 500;
}
.stage-listing { background: #fef3c7; color: #92400e; }
.stage-offer { background: #dbeafe; color: #1e40af; }
.stage-deal { background: #d1fae5; color: #065f46; }
.stage-closed { background: #e5e7eb; color: #374151; }
.stage-cancelled { background: #fee2e2; color: #991b1b; }
.fav-star { color: var(--gray-300); font-size: 1rem; }
.fav-star.active { color: var(--warning); }

/* Project count badge in header */
.project-count-badge {
  display: inline-block;
  font-size: 0.875rem; font-weight: 600;
  color: var(--gray-500);
  margin-left: 0.375rem;
}
.project-count-badge.filtered { color: var(--primary); }

/* ---- Filters Bar ---- */
.filters-bar {
  display: flex; gap: 0.75rem; align-items: center;
  margin-bottom: 1.5rem;
}
.search-input {
  flex: 1;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,232,0.1); }
.filter-select {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--white);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ---- Table ---- */
.table-container {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.data-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ---- Deadlines List ---- */
.deadlines-list { display: flex; flex-direction: column; gap: 0.5rem; }
.deadline-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.deadline-date {
  flex-shrink: 0;
  text-align: center;
  min-width: 52px;
}
.deadline-date .day { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.deadline-date .month { font-size: 0.6875rem; color: var(--gray-500); text-transform: uppercase; }
.deadline-info { flex: 1; min-width: 0; }
.deadline-title { font-size: 0.875rem; font-weight: 500; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deadline-project { font-size: 0.8125rem; color: var(--gray-500); }
.deadline-urgency { flex-shrink: 0; font-size: 0.75rem; font-weight: 500; padding: 0.25rem 0.625rem; border-radius: 999px; }
.urgency-critical { background: #fee2e2; color: var(--danger); }
.urgency-soon { background: #fef3c7; color: #92400e; }
.urgency-normal { background: var(--gray-100); color: var(--gray-600); }

/* ---- Project Detail ---- */
.project-detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; }
.detail-section { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); }
.dates-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.date-item .label { font-size: 0.75rem; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.date-item .value { font-size: 0.9375rem; font-weight: 600; color: var(--gray-800); }
.date-item .value.empty { color: var(--gray-400); font-weight: 400; }
.project-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.375rem; }
.sidebar-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); margin-bottom: 1rem; }
.sidebar-card h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 1rem; color: var(--gray-800); }
.price-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; }
.price-row:last-child { border-bottom: none; }
.price-row.highlight { font-weight: 600; color: var(--gray-900); }

/* ---- Workflow Steps ---- */
.workflow-steps { display: flex; flex-direction: column; gap: 0.5rem; }
.workflow-step { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.step-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gray-300); flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.step-check.done { background: var(--success); border-color: var(--success); }
.step-check.done::after { content: '✓'; color: white; font-size: 0.75rem; }
.step-label { font-size: 0.875rem; color: var(--gray-700); }
.step-label.done { text-decoration: line-through; color: var(--gray-400); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.375rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,232,0.1); }
.form-group input:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.form-group textarea { resize: vertical; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-card { position: relative; background: var(--white); border-radius: var(--radius-lg); padding: 1.5rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.125rem; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--gray-200); background: var(--white); cursor: pointer; font-size: 1.125rem; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--gray-100); }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ---- Settings ---- */
.settings-layout { max-width: 640px; }
.settings-section { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); }
.settings-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--gray-900); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 0; border-bottom: 1px solid var(--gray-100); }
.toggle-row:last-of-type { border-bottom: none; }
.toggle-label { font-size: 0.875rem; font-weight: 500; color: var(--gray-800); }
.toggle-desc { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 999px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- Calendar ---- */

/* Legacy calendar classes kept for compatibility */
.calendar-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.calendar-month { font-size: 1.125rem; font-weight: 600; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 2rem; }
.calendar-day-header { text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; padding: 0.5rem; }
.calendar-day { min-height: 80px; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.5rem; font-size: 0.8125rem; }
.calendar-day.today { border-color: var(--primary); }
.calendar-day.other-month { background: var(--gray-50); }
.calendar-day .day-num { font-weight: 500; color: var(--gray-700); margin-bottom: 0.25rem; }
.calendar-day.today .day-num { color: var(--primary); font-weight: 700; }
.calendar-event { font-size: 0.6875rem; padding: 0.125rem 0.375rem; border-radius: 3px; background: var(--primary-light); color: var(--primary); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* -- Toolbar -- */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 0.5rem; }
.cal-period-label { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); min-width: 180px; text-align: center; }
.cal-view-toggle { display: flex; border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; }
.cal-view-btn {
  padding: 0.375rem 0.875rem; border: none; background: var(--white);
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-600); cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--gray-300);
}
.cal-view-btn:last-child { border-right: none; }
.cal-view-btn:hover { background: var(--gray-50); color: var(--gray-900); }
.cal-view-btn.active { background: var(--primary); color: white; }

/* -- Legend -- */
.cal-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cal-legend-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--gray-600); }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* -- Event type colors -- */
.type-closing    { background: #10b981; }
.type-inspection { background: #f59e0b; }
.type-mortgage   { background: #1a56e8; }
.type-offer      { background: #8b5cf6; }
.type-showing    { background: #0ea5e9; }
.type-open_house { background: #ec4899; }
.type-meeting    { background: #6b7280; }
.type-reminder   { background: #f59e0b; }
.type-listing    { background: #7c3aed; }
.type-general    { background: #9ca3af; }
.type-task       { background: #6366f1; }

/* -- Month View -- */
.cal-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  margin-bottom: 2rem;
}
.cal-month-grid .cal-day-header {
  text-align: center; font-size: 0.75rem; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; padding: 0.5rem 0;
}
.cal-month-cell {
  min-height: 90px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 0.375rem 0.5rem; font-size: 0.8125rem; cursor: pointer;
  transition: border-color 0.15s;
}
.cal-month-cell:hover { border-color: var(--primary-light); background: var(--gray-50); }
.cal-month-cell.other-month { background: var(--gray-50); opacity: 0.55; }
.cal-month-cell.today { border-color: var(--primary); }
.cal-month-cell .cal-day-num {
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
}
.cal-month-cell.today .cal-day-num { background: var(--primary); color: white; font-weight: 700; }
.cal-event-chip {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; padding: 2px 5px; border-radius: 3px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; font-weight: 500; max-width: 100%;
  transition: opacity 0.15s;
}
.cal-event-chip:hover { opacity: 0.85; }
.cal-event-chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cal-event-chip.deal { font-style: italic; }
.cal-more-link { font-size: 0.6875rem; color: var(--primary); cursor: pointer; padding: 1px 3px; }

/* Event chip type backgrounds */
.chip-closing    { background: #d1fae5; color: #065f46; }
.chip-inspection { background: #fef3c7; color: #92400e; }
.chip-mortgage   { background: var(--primary-light); color: var(--primary-dark); }
.chip-offer      { background: #ede9fe; color: #5b21b6; }
.chip-showing    { background: #e0f2fe; color: #0369a1; }
.chip-open_house { background: #fce7f3; color: #9d174d; }
.chip-meeting    { background: var(--gray-100); color: var(--gray-700); }
.chip-reminder   { background: #fef3c7; color: #92400e; }
.chip-listing    { background: #ede9fe; color: #6d28d9; }
.chip-general    { background: var(--gray-100); color: var(--gray-600); }
.chip-task       { background: #e0e7ff; color: #3730a3; }

/* -- Week & Day Views -- */
.cal-week-container, .cal-day-container {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 2rem; box-shadow: var(--shadow-sm);
}
.cal-week-header {
  display: grid; /* set dynamically via JS */
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.cal-week-header-time { width: 56px; flex-shrink: 0; border-right: 1px solid var(--gray-200); padding: 0.5rem; }
.cal-week-col-header, .cal-day-col-header {
  padding: 0.625rem 0.5rem; text-align: center;
  border-right: 1px solid var(--gray-100);
  font-size: 0.8125rem;
}
.cal-week-col-header:last-child, .cal-day-col-header:last-child { border-right: none; }
.cal-week-col-header.today-col { background: var(--primary-light); }
.cal-week-header-day { font-weight: 600; color: var(--gray-900); }
.cal-week-header-day.today-day { color: var(--primary); }
.cal-week-header-date { font-size: 0.75rem; color: var(--gray-500); }

.cal-week-body, .cal-day-body {
  display: flex; overflow-y: auto; max-height: 560px;
}
.cal-time-labels {
  width: 56px; flex-shrink: 0; border-right: 1px solid var(--gray-200);
}
.cal-time-slot-label {
  height: 56px; display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 2px 6px 0 0; font-size: 0.6875rem; color: var(--gray-400);
  border-bottom: 1px solid var(--gray-100);
}
.cal-week-grid, .cal-day-grid {
  flex: 1; display: grid; /* cols set via JS */
  position: relative;
}
.cal-week-col, .cal-day-col {
  position: relative; border-right: 1px solid var(--gray-100); min-width: 0;
}
.cal-week-col:last-child, .cal-day-col:last-child { border-right: none; }
.cal-hour-row {
  height: 56px; border-bottom: 1px solid var(--gray-100);
  position: relative; cursor: pointer;
}
.cal-hour-row:hover { background: var(--gray-50); }
.cal-timed-event {
  position: absolute; left: 2px; right: 2px;
  border-radius: 4px; padding: 2px 5px;
  font-size: 0.6875rem; font-weight: 500;
  overflow: hidden; cursor: pointer; z-index: 2;
  transition: opacity 0.15s;
  border-left: 3px solid transparent;
}
.cal-timed-event:hover { opacity: 0.85; }

/* All-day strip in week/day views */
.cal-allday-strip {
  display: grid; /* cols set via JS */
  background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
  min-height: 32px;
}
.cal-allday-time-spacer { width: 56px; flex-shrink: 0; border-right: 1px solid var(--gray-200); }
.cal-allday-col {
  border-right: 1px solid var(--gray-100); padding: 2px 3px;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-allday-col:last-child { border-right: none; }

/* -- Popover -- */
.cal-popover {
  position: fixed; z-index: 2000;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 1rem;
  width: 280px; box-shadow: var(--shadow-lg);
}
.cal-popover.hidden { display: none; }
.cal-popover-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cal-popover-type {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px;
}
.cal-popover-title { font-size: 0.9375rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.375rem; }
.cal-popover-meta { font-size: 0.8125rem; color: var(--gray-500); margin-bottom: 0.375rem; }
.cal-popover-notes { font-size: 0.8125rem; color: var(--gray-600); margin-bottom: 0.75rem; white-space: pre-wrap; }
.cal-popover-actions { display: flex; gap: 0.5rem; }

/* ---- Landing Page ---- */
.landing { min-height: 100vh; background: var(--white); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

.landing-header { padding: 1.25rem 0; border-bottom: 1px solid var(--gray-100); }
.landing-nav { display: flex; align-items: center; justify-content: space-between; }
.landing-logo { display: flex; align-items: center; gap: 0.625rem; }
.landing-logo .logo-icon { background: var(--primary); color: white; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.landing-logo .logo-text { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); }

.hero { text-align: center; padding: 5rem 0 4rem; }
.hero-badge { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: 0.8125rem; font-weight: 500; padding: 0.375rem 1rem; border-radius: 999px; margin-bottom: 1.5rem; }
.hero-title { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 800; color: var(--gray-900); letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 1.25rem; }
.hero-subtitle { font-size: 1.125rem; color: var(--gray-500); max-width: 560px; margin: 0 auto 2.5rem; line-height: 1.65; }
.hero-form { display: flex; gap: 0.75rem; max-width: 480px; margin: 0 auto 1rem; }
.hero-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  transition: border-color 0.15s;
}
.hero-input:focus { outline: none; border-color: var(--primary); }
.hero-note { font-size: 0.8125rem; color: var(--gray-400); }

.features { padding: 5rem 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; }
.feature-card { padding: 1.5rem; }
.feature-icon { width: 48px; height: 48px; background: var(--primary-light); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.feature-icon svg { width: 24px; height: 24px; stroke: var(--primary); }
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--gray-900); }
.feature-card p { font-size: 0.875rem; color: var(--gray-500); line-height: 1.65; }

.cta-section { text-align: center; padding: 5rem 0; background: var(--primary); border-radius: 24px; margin-bottom: 4rem; }
.cta-section h2 { font-size: 2rem; font-weight: 700; color: white; margin-bottom: 0.75rem; }
.cta-section p { color: rgba(255,255,255,0.8); margin-bottom: 2rem; }
.cta-section .btn-primary { background: white; color: var(--primary); border-color: white; }
.cta-section .btn-primary:hover { background: var(--gray-50); }

.landing-footer { text-align: center; padding: 2rem 0; border-top: 1px solid var(--gray-100); color: var(--gray-400); font-size: 0.875rem; }

/* ---- Landing Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatBubble {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-7px); }
}
@keyframes pulseCta {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  60%       { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}

/* Hero element fade-in stagger */
.hero-badge    { animation: fadeInUp 0.55s ease 0.05s both; }
.hero-title    { animation: fadeInUp 0.6s  ease 0.15s both; }
.hero-subtitle { animation: fadeInUp 0.6s  ease 0.25s both; }
.hero-form     { animation: fadeInUp 0.6s  ease 0.35s both; }
.hero-note     { animation: fadeInUp 0.6s  ease 0.4s  both; }

/* Chat bubble preview */
.hero-chat-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  margin: 2.25rem auto 0;
  text-align: left;
}
.chat-bubble {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  box-shadow: var(--shadow);
  opacity: 0;
}
.chat-bubble-1 { animation: fadeInUp 0.55s ease 0.5s forwards, floatBubble 4s   ease-in-out 1.2s infinite; }
.chat-bubble-2 { animation: fadeInUp 0.55s ease 0.7s forwards, floatBubble 4.6s ease-in-out 1.5s infinite; }
.chat-bubble-3 { animation: fadeInUp 0.55s ease 0.9s forwards, floatBubble 5.2s ease-in-out 1.8s infinite; }
.chat-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }

/* More breathing room between sections */
.features   { padding: 6rem 0; }
.cta-section { margin-bottom: 5rem; }

/* Persona section */
.personas { padding: 6rem 0; text-align: center; }
.personas-title {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}
.personas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.persona-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.persona-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26,86,232,0.06), var(--shadow);
  transform: translateY(-3px);
}
.persona-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; line-height: 1; }
.persona-card h3 { font-size: 1.0625rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.5rem; }
.persona-card p  { font-size: 0.875rem; color: var(--gray-500); line-height: 1.65; }

/* CTA button subtle pulse */
.btn-pulse-cta { animation: pulseCta 2.4s ease-in-out 1s infinite; }

/* ---- Auth Page ---- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); padding: 1.5rem; }
.auth-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.auth-logo { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.5rem; }
.auth-subtitle { font-size: 0.875rem; color: var(--gray-500); margin-bottom: 1.5rem; }
.auth-form .form-group { margin-bottom: 1.25rem; }
.auth-success { text-align: center; padding: 1.5rem; background: var(--gray-50); border-radius: var(--radius); }
.auth-success svg { width: 40px; height: 40px; stroke: var(--success); margin-bottom: 0.75rem; }
.auth-success p { color: var(--gray-700); }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: var(--gray-500); }

/* ---- States ---- */
.empty-state, .loading-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.875rem;
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 0.75rem; display: block; }
.empty-state p { margin: 0.5rem 0 0; }
.hidden { display: none !important; }

/* ---- Toast ---- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--gray-900); color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Settings Page Layout ---- */
.settings-page { max-width: 1000px; }
.settings-page-header { margin-bottom: 2rem; }
.settings-page-header .back-link { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: var(--gray-500); margin-bottom: 1rem; }
.settings-page-header .back-link:hover { color: var(--primary); text-decoration: none; }
.settings-page-header .back-link svg { width: 16px; height: 16px; }
.settings-with-sidebar { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; align-items: start; }
.settings-sidebar { position: sticky; top: 2rem; }
.settings-sidebar-section { margin-bottom: 1.5rem; }
.settings-sidebar-section-title { font-size: 0.6875rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0.5rem; margin-bottom: 0.375rem; }
.settings-nav-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; color: var(--gray-600); text-decoration: none; transition: background 0.15s, color 0.15s; width: 100%; }
.settings-nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.settings-nav-link:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.settings-nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.settings-content { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-sm); }
.settings-content-title { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.25rem; }
.settings-content-desc { font-size: 0.875rem; color: var(--gray-500); margin-bottom: 1.75rem; }
.avatar-section { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.75rem; }
.avatar-preview { width: 80px; height: 80px; border-radius: 50%; background: var(--gray-200); overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid var(--gray-200); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview .avatar-initials { font-size: 1.5rem; font-weight: 700; color: var(--gray-400); }
.avatar-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.avatar-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.875rem; border-radius: var(--radius); font-size: 0.8125rem; font-weight: 500; cursor: pointer; border: 1px solid var(--gray-300); background: white; color: var(--gray-700); transition: all 0.15s; }
.avatar-btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.avatar-btn input[type="file"] { display: none; }
.avatar-hint { font-size: 0.75rem; color: var(--gray-400); }
.danger-zone { border: 1px solid #fecaca; border-radius: var(--radius-lg); padding: 1.5rem; background: #fef2f2; }
.danger-zone-title { font-size: 0.875rem; font-weight: 600; color: var(--danger); margin-bottom: 0.75rem; }
.danger-zone-desc { font-size: 0.8125rem; color: var(--gray-600); margin-bottom: 1rem; }
.coming-soon { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; font-weight: 500; color: var(--gray-500); background: var(--gray-100); padding: 0.2rem 0.625rem; border-radius: 999px; }

/* ====================================================
   RESPONSIVE — Mobile-First Overrides
   ==================================================== */

/* ---- Touch targets: ensure 44px minimum ---- */
.btn { min-height: 44px; }
.btn-sm { min-height: 36px; }
.nav-link { min-height: 44px; }
.filter-select, .search-input { min-height: 44px; }
.modal-close { width: 44px; height: 44px; }
.step-check { width: 24px; height: 24px; }

/* ---- Mobile Header (hidden on desktop) ---- */
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.bottom-tab-bar { display: none; }

/* ====== TABLET: 1024px — icon-only sidebar rail ====== */
@media (max-width: 1024px) {
  .sidebar {
    width: 64px;
    overflow: visible;
  }
  .sidebar .logo-text { display: none; }
  .sidebar-logo { padding: 1.25rem 0; display: flex; justify-content: center; }
  .sidebar-logo .logo-link { justify-content: center; }
  .sidebar .nav-links { padding: 0 0.5rem; }
  .sidebar .nav-link {
    justify-content: center;
    padding: 0.625rem;
    gap: 0;
  }
  .sidebar .nav-link span,
  .sidebar-bottom .nav-link span { display: none; }
  .sidebar-bottom { padding: 0.5rem; }
  .sidebar-bottom .nav-link {
    justify-content: center;
    padding: 0.625rem;
  }
  /* Sidebar user: keep avatar only at tablet width */
  .sidebar-user { padding: 0.625rem; justify-content: center; }
  .sidebar-user-info { display: none; }
  /* Notification badge at tablet: show next to icon */
  .notif-badge { position: static; display: inline-flex !important; margin-left: 0.25rem; font-size: 0.6rem; min-width: 14px; height: 14px; }
  .notif-btn { display: flex; align-items: center; justify-content: center; gap: 0; }
  .notif-btn span:first-of-type { display: none; } /* hide "Notifications" text */
  .main-content {
    margin-left: 64px;
    padding: 1.75rem 2rem;
  }
}

/* ====== TABLET: 900px — layout adjustments ====== */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .project-detail-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dates-grid { grid-template-columns: 1fr; }
  .qa-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ====== MOBILE: 768px — bottom tab bar + off-canvas sidebar ====== */
@media (max-width: 768px) {
  /* Off-canvas sidebar */
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
    overflow-y: auto;
  }
  .sidebar .logo-text,
  .sidebar .nav-link span,
  .sidebar-bottom .nav-link span { display: inline !important; }
  .sidebar .nav-link {
    justify-content: flex-start;
    padding: 0.625rem 0.75rem;
    gap: 0.625rem;
    min-height: 48px;
  }
  .sidebar-bottom .nav-link {
    justify-content: flex-start;
    padding: 0.625rem 0.75rem;
    gap: 0.625rem;
  }
  .sidebar-logo { padding: 1.25rem 1rem 1rem; display: block; }
  .sidebar .nav-links { padding: 0 0.75rem; }
  .sidebar.open { transform: translateX(0); }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 299;
    pointer-events: none;
    transition: background 0.25s ease;
  }
  .sidebar-overlay.open {
    background: rgba(0,0,0,0.5);
    pointer-events: all;
  }

  /* Mobile header */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    height: 56px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
  }
  .hamburger-btn {
    width: 44px; height: 44px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-700);
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    flex-shrink: 0;
  }
  .hamburger-btn svg { width: 22px; height: 22px; }
  .hamburger-btn:hover { background: var(--gray-100); }
  .mobile-logo {
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none;
  }
  .mobile-logo .logo-icon {
    width: 28px; height: 28px;
    background: var(--primary);
    color: white; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.875rem;
  }
  .mobile-logo .logo-text {
    font-size: 1rem; font-weight: 700; color: var(--gray-900);
  }

  /* App shell stacks vertically on mobile */
  .app-shell {
    flex-direction: column;
  }

  /* Main content: no left margin, padding for bottom tab bar */
  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem 1.5rem;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }

  /* Prevent iOS auto-zoom on focused inputs (requires font-size >= 16px) */
  input, select, textarea {
    font-size: 16px;
  }

  /* Bottom tab bar */
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    z-index: 200;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    color: var(--gray-400);
    font-size: 0.6rem;
    font-weight: 500;
    text-decoration: none;
    min-height: 56px;
    gap: 0.2rem;
    transition: color 0.15s;
  }
  .tab-item svg { width: 22px; height: 22px; }
  .tab-item.active { color: var(--primary); }
  .tab-item:hover { text-decoration: none; color: var(--gray-700); }
  .tab-item.active:hover { color: var(--primary); }

  /* Hero form stack */
  .hero-form { flex-direction: column; }

  /* Stats row */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

  /* Filters bar wrap */
  .filters-bar { flex-wrap: wrap; }
  .filter-select { flex: 1 1 calc(50% - 0.375rem); min-width: 0; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; }

  /* Section header on mobile */
  .page-title { font-size: 1.375rem; }

  /* Toast repositioned above tab bar */
  .toast-container { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); right: 1rem; }

  /* Calendar compact */
  .calendar-grid { gap: 2px; }
  .calendar-day { min-height: 60px; padding: 0.25rem; }
  .calendar-day-header { font-size: 0.6875rem; padding: 0.375rem 0.25rem; }
  .calendar-event { font-size: 0.625rem; padding: 0.1rem 0.25rem; }

  /* Quick actions: single column on mobile */
  .qa-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .qa-card { flex-direction: row; padding: 1rem 1.25rem; gap: 1rem; }
  .qa-icon { width: 40px; height: 40px; }

  /* Favorites horizontal scroll */
  .fav-scroll-row { padding: 0.25rem 0.25rem 0.75rem; }

  /* Sidebar user on mobile */
  .sidebar-user { display: none; }
  .sidebar-user-link { font-size: 0.75rem; color: var(--gray-500); }

  /* Modal → bottom sheet on mobile */
  .modal { align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    padding: 1.25rem;
  }
  /* Add drag indicator */
  .modal-card::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0 auto 1rem;
  }

  /* Contacts table → card list */
  .table-container { overflow: hidden; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody,
  .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    position: relative;
  }
  .data-table tr:last-child { border-bottom: none; }
  .data-table td {
    padding: 0.125rem 0;
    border: none;
    font-size: 0.875rem;
  }
  .data-table td:first-child {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9375rem;
    padding-bottom: 0.375rem;
  }
  .data-table td:last-child {
    padding-top: 0.5rem;
  }
  .data-table td[data-label]::before {
    content: attr(data-label) ': ';
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
  }
  .data-table tr:hover td { background: transparent; }

  /* Deadline items compact */
  .deadline-item { padding: 0.75rem; }
  .deadline-urgency { display: none; }

  /* Settings full width */
  .settings-layout { max-width: 100%; }
}

/* ====== MOBILE: 480px — small phone ====== */
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.375rem; }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .filter-select { flex: 1 1 100%; }

  /* Font scaling */
  .page-title { font-size: 1.25rem; }
  .hero-title { font-size: clamp(1.75rem, 8vw, 2.5rem); }

  /* Calendar day even more compact */
  .calendar-day { min-height: 48px; }
  .calendar-event { display: none; } /* show only dot */
  .calendar-day .day-num { font-size: 0.875rem; }

  /* Sidebar logo no text on small phones when open */
  .mobile-logo .logo-text { font-size: 0.9375rem; }

  /* Form group spacing */
  .form-group { margin-bottom: 0.875rem; }
}

/* ====== Disable hover-only styles on touch devices ====== */
@media (hover: none) {
  .project-card:hover { box-shadow: var(--shadow-sm); transform: none; }
  .btn:hover { filter: none; }
  .nav-link:hover { background: transparent; color: var(--gray-400); }
  .nav-link.active:hover { background: rgba(26,86,232,0.2); color: #93b4ff; }
}

/* ---- Favorite Projects — Horizontal Scroll ---- */
.fav-scroll-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.fav-scroll-row::-webkit-scrollbar { height: 6px; }
.fav-scroll-row::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 3px; }
.fav-scroll-row::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ---- Favorite Deal Card ---- */
.fav-card {
  flex-shrink: 0;
  width: 240px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  scroll-snap-align: start;
  text-decoration: none;
  display: block;
  color: inherit;
}
.fav-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }

.fav-card-cover {
  height: 130px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a56e8 0%, #0ea5e9 100%);
}
.fav-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.fav-card-cover .cover-initials {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700;
  color: rgba(255,255,255,0.5);
}

/* Overlay badges on cover */
.fav-card-badges {
  position: absolute;
  top: 0.5rem; left: 0.5rem; right: 0.5rem;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none;
}
.fav-type-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600;
}
.fav-type-buyside { background: #dbeafe; color: #1e40af; }
.fav-type-listside { background: #fef3c7; color: #92400e; }

/* Star overlay: top-right of cover */
.fav-card-star {
  position: absolute;
  top: 0.5rem; right: 0.5rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--warning);
  transition: background 0.15s, transform 0.15s;
  pointer-events: all;
}
.fav-card-star:hover { background: white; transform: scale(1.1); }

/* Card body */
.fav-card-body { padding: 0.75rem; }
.fav-card-status {
  display: flex; align-items: center; gap: 0.375rem;
  margin-bottom: 0.375rem;
}
.fav-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-listing { background: #f59e0b; }
.dot-offer { background: #1a56e8; }
.dot-deal { background: #10b981; }
.dot-closed { background: #6b7280; }
.dot-cancelled { background: #ef4444; }
.fav-status-label { font-size: 0.75rem; font-weight: 500; color: var(--gray-600); }

.fav-mls-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.6875rem; font-weight: 500;
  color: #059669; background: #d1fae5;
  padding: 0.15rem 0.4rem; border-radius: 4px;
  margin-bottom: 0.5rem;
}

.fav-card-address {
  font-size: 0.875rem; font-weight: 600; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.625rem;
  line-height: 1.3;
}

.fav-card-prices {
  display: flex; gap: 0.75rem; margin-bottom: 0.625rem;
}
.fav-price { flex: 1; }
.fav-price-label { font-size: 0.625rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.fav-price-value { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); }

.fav-card-agent {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.fav-agent-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700; flex-shrink: 0;
}
.fav-agent-name { font-size: 0.75rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fav-card-closing {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; color: var(--gray-500);
}
.fav-card-closing svg { width: 13px; height: 13px; color: var(--gray-400); flex-shrink: 0; }
.fav-closing-label { color: var(--gray-400); }

/* ---- Quick Actions ---- */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.qa-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.75rem;
  padding: 1.5rem 1rem;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--gray-700);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  cursor: pointer;
}
.qa-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,232,0.1), var(--shadow);
  transform: translateY(-1px);
  text-decoration: none; color: var(--primary);
}
.qa-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--gray-50);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.qa-icon svg { width: 22px; height: 22px; stroke: var(--gray-500); transition: stroke 0.2s; }
.qa-card:hover .qa-icon { background: var(--primary-light); }
.qa-card:hover .qa-icon svg { stroke: var(--primary); }
.qa-label { font-size: 0.875rem; font-weight: 500; }

/* ---- Sidebar User ---- */
.sidebar-user {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 2px;
  cursor: pointer;
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-initials { font-size: 0.8125rem; font-weight: 700; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-300);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-link { font-size: 0.75rem; color: var(--gray-500); }
.sidebar-user-link:hover { color: var(--primary); text-decoration: none; }

/* Notification bell badge */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  background: var(--danger); color: white;
  border-radius: 999px;
  font-size: 0.625rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}
.project-hero {
  position: relative;
  min-height: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.project-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a56e8 0%, #0ea5e9 100%);
}
.project-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.1) 0%, rgba(0,0,0,.45) 100%);
}
.project-hero-content {
  position: relative;
  z-index: 1;
  padding: 1.5rem 2rem;
}
.project-hero-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.hero-btn {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.35);
  color: white;
  backdrop-filter: blur(4px);
}
.hero-btn:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.5); color: white; }

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: .2rem .625rem;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  font-size: .75rem;
  color: rgba(255,255,255,.95);
  backdrop-filter: blur(4px);
}

/* ---- Metrics Strip ---- */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.metric-item {
  background: var(--white);
  padding: 1rem 1.25rem;
}
.metric-label {
  font-size: .75rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .25rem;
}
.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}
.metric-highlight { color: var(--primary); }

/* ---- Progress Bar ---- */
.progress-bar-track {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress-pct-label {
  font-size: .8125rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ---- Enhanced Workflow Steps ---- */
.workflow-step {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .625rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: background .15s;
}
.workflow-step:hover { background: var(--gray-50); }
.workflow-step.step-done { opacity: .65; }
.step-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: transparent;
  transition: all .15s;
  padding: 0;
}
.step-check:hover { border-color: var(--primary); }
.step-check.done { background: var(--success); border-color: var(--success); }
.step-check.done svg { width: 12px; height: 12px; stroke: white; }
.step-body { flex: 1; min-width: 0; }
.step-label { font-size: .875rem; color: var(--gray-800); font-weight: 500; }
.step-label.done { text-decoration: line-through; color: var(--gray-400); }
.step-desc { font-size: .8125rem; color: var(--gray-500); margin-top: .125rem; }

/* ---- Date Urgency ---- */
.date-urgency {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 999px;
  margin-left: .375rem;
  vertical-align: middle;
}

/* ---- Timeline ---- */
.timeline-list { display: flex; flex-direction: column; }
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: .3125rem;
}
.dot-success { background: var(--success); }
.dot-primary { background: var(--primary); }
.dot-accent { background: var(--accent); }
.dot-default { background: var(--gray-300); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-desc { font-size: .875rem; color: var(--gray-800); }
.timeline-meta { font-size: .75rem; color: var(--gray-400); margin-top: .125rem; }

/* ---- Contacts Rows ---- */
.contact-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.contact-row:last-child { border-bottom: none; }
.contact-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 700;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: .875rem; font-weight: 500; color: var(--gray-900); }
.contact-sub { font-size: .75rem; color: var(--gray-400); }
.contact-remove {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: .875rem; padding: .25rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.contact-row:hover .contact-remove { opacity: 1; }
.contact-remove:hover { color: var(--danger); }

/* ---- Party Action Buttons ---- */
.party-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: .875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .1s, color .1s;
  flex-shrink: 0;
}
.party-action-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ---- Sidebar Card ---- */
.sidebar-card-title { font-size: .9375rem; font-weight: 600; color: var(--gray-800); }

/* ---- Contact Picker ---- */
.contact-picker-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.contact-picker-item:last-child { border-bottom: none; }
.contact-picker-item:hover { background: var(--gray-50); }
.contact-picker-item.selected { background: var(--primary-light); }
.picker-avatar {
  width: 30px; height: 30px;
  font-size: .8125rem;
}

@media (max-width: 768px) {
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .project-hero-title-row { flex-direction: column; }
  .project-hero-content { padding: 1.25rem 1.5rem; }
}

@media (max-width: 480px) {
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .dates-grid { grid-template-columns: 1fr; }
}

@media (max-width: 375px) {
  .metrics-strip {
    display: flex;
    overflow-x: auto;
    gap: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .metrics-strip::-webkit-scrollbar { display: none; }
  .metric-item {
    min-width: 140px;
    flex-shrink: 0;
    border-right: 1px solid var(--gray-200);
  }
  .metric-item:last-child { border-right: none; }
  .header-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .header-actions .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }
  .project-detail-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ==========================================
   TASK INBOX
   ========================================== */

/* Greeting */
.greeting-text {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

/* Task Inbox Section */
.task-inbox-section { margin-bottom: 2.5rem; }

/* Tab Bar */
.task-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.task-tabs::-webkit-scrollbar { display: none; }

.task-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  border-radius: var(--radius) var(--radius) 0 0;
}
.task-tab:hover { color: var(--gray-700); background: var(--gray-50); }
.task-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9px;
  background: var(--gray-200);
  color: var(--gray-600);
}
.task-tab.active .tab-badge {
  background: var(--primary-light);
  color: var(--primary);
}

/* Card Row */
.task-cards-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-200) transparent;
  -webkit-overflow-scrolling: touch;
}
.task-cards-row::-webkit-scrollbar { height: 4px; }
.task-cards-row::-webkit-scrollbar-track { background: transparent; }
.task-cards-row::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

/* Loading / Empty */
.task-cards-loading, .task-cards-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 3rem;
  color: var(--gray-400);
  font-size: 0.875rem;
  min-width: 280px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--gray-200);
}
.task-cards-empty p, .task-cards-loading { margin: 0; }

/* Task Card */
.task-card {
  flex: 0 0 260px;
  width: 260px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: default;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* Thumbnail */
.task-card-thumb {
  height: 110px;
  background: linear-gradient(135deg, #e8effe 0%, #dbeafe 100%);
  overflow: hidden;
  position: relative;
}
.task-card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.task-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.5;
}

/* Card Body */
.task-card-body {
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.task-card-address {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card-type-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.task-type-checkbox {
  background: #e0f2fe;
  color: #0369a1;
}
.task-type-upload {
  background: #ede9fe;
  color: #6d28d9;
}
.task-type-email {
  background: #d1fae5;
  color: #065f46;
}

.task-card-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #ef4444;
}

.task-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.35;
}

.task-card-desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Settings page responsive */
@media (max-width: 900px) {
  .settings-with-sidebar { grid-template-columns: 1fr; }
  .settings-sidebar { position: static; }
}
@media (max-width: 768px) {
  .settings-page-header .page-title { font-size: 1.375rem; }
  .settings-content { padding: 1.25rem; }
}

/* ==========================================
   CONTACTS PAGE
   ========================================== */

/* Filters bar — two-column layout */
.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.filters-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}
.filters-right { display: flex; align-items: center; gap: 0.5rem; }

/* View toggle */
.view-toggle {
  display: flex;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.view-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--gray-400);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn.active { background: var(--white); color: var(--gray-800); box-shadow: var(--shadow-sm); }
.view-btn:hover:not(.active) { background: var(--gray-200); color: var(--gray-600); }

/* Results summary */
.results-summary {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 0.875rem;
}
.results-summary strong { color: var(--gray-700); font-weight: 600; }

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Contact Card */
.contact-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.contact-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--gray-300);
}

.contact-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.contact-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9375rem; font-weight: 700;
  flex-shrink: 0;
}
.contact-card-info { flex: 1; min-width: 0; }
.contact-name { font-size: 0.9375rem; font-weight: 600; color: var(--gray-900); line-height: 1.3; }
.contact-company { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }
.contact-menu-btn {
  width: 28px; height: 28px;
  border: none; background: none;
  cursor: pointer; color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  padding: 0;
}
.contact-menu-btn svg { width: 14px; height: 14px; }
.contact-card:hover .contact-menu-btn { opacity: 1; }
.contact-menu-btn:hover { color: var(--gray-700); background: var(--gray-100); }

.contact-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
  flex: 1;
}
.contact-detail {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--gray-600);
}
.contact-detail svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--gray-400); }
.contact-detail a { color: var(--gray-600); text-decoration: none; }
.contact-detail a:hover { color: var(--primary); text-decoration: underline; }

.contact-card-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100);
}

/* Role badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.175rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.role-badge.role-none {
  background: var(--gray-100);
  color: var(--gray-400);
  border-color: var(--gray-200);
}

/* Visibility badge */
.vis-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.175rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
}
.vis-badge.vis-org { background: rgba(16,185,129,0.1); color: var(--success); }
.vis-badge.vis-private { background: rgba(107,114,128,0.1); color: var(--gray-500); }

/* Project count badge */
.project-count-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-left: auto;
}

/* List view — table rows */
.contact-row { cursor: pointer; }
.contact-row:hover td { background: var(--gray-50); }
.contact-row td { transition: background 0.1s; }

/* Name cell in table */
.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.contact-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.contact-owner { font-size: 0.75rem; color: var(--gray-400); }
.project-cell { font-size: 0.875rem; color: var(--gray-600); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.empty-icon svg { width: 48px; height: 48px; }

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  gap: 1rem;
}
.pagination-controls { display: flex; gap: 0.5rem; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }

/* Modal form — form-row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-bottom: 0.875rem;
}
.form-group-sm .form-control,
.form-group-sm input { max-width: 80px; }

/* Modal actions layout */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
  margin-top: 0.5rem;
  gap: 0.5rem;
}
.modal-actions-right { display: flex; gap: 0.5rem; }

/* Required star */
.required { color: var(--danger); margin-left: 2px; }

/* Stage badge colors (reused) */
.stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.stage-listing   { background: rgba(14,165,233,0.12); color: var(--accent); }
.stage-offer     { background: rgba(245,158,11,0.12); color: var(--warning); }
.stage-deal     { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.stage-closed   { background: rgba(16,185,129,0.12); color: var(--success); }
.stage-cancelled { background: rgba(239,68,68,0.1); color: var(--danger); }

/* Misc helpers */
.muted { color: var(--gray-400); }

/* Responsive adjustments */
@media (max-width: 900px) {
  .contacts-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-left { flex-wrap: wrap; }
  .filters-right { justify-content: flex-end; }
  .contacts-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .contact-card { padding: 0.875rem; }
}
@media (max-width: 480px) {
  .contacts-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   DOCUMENT MANAGEMENT
   ========================================== */

/* Category filter pills */
.doc-filter-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.doc-filter-pill:hover { background: var(--gray-100); }
.doc-filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Drop zone */
.doc-drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.doc-drop-zone:hover, .doc-drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light, rgba(14,165,233,0.05));
}

/* Document rows */
.doc-row {
  display: grid;
  grid-template-columns: 1fr 110px 120px 130px 90px 80px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--gray-50); }
.doc-row-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  border-radius: var(--radius) var(--radius) 0 0;
}
.doc-filename {
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-filename a { color: inherit; text-decoration: none; }
.doc-filename a:hover { color: var(--primary); }
.doc-list-wrap {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.doc-actions { display: flex; gap: 0.375rem; justify-content: flex-end; }
.doc-actions button {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--gray-600);
}
.doc-actions button:hover { background: var(--gray-100); }
.doc-actions .btn-danger-ghost:hover { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }

/* Status badges */
.doc-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.doc-status-draft      { background: var(--gray-100); color: var(--gray-600); }
.doc-status-pending    { background: #fef3c7; color: #92400e; }
.doc-status-approved   { background: #d1fae5; color: #065f46; }
.doc-status-signed     { background: #dbeafe; color: #1e40af; }

/* Category badge */
.doc-category {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm, 4px);
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-700);
  white-space: nowrap;
}

/* Upload progress */
.doc-upload-progress {
  background: var(--gray-100);
  border-radius: 999px;
  height: 4px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.doc-upload-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

@media (max-width: 768px) {
  .doc-row {
    grid-template-columns: 1fr 90px 70px;
  }
  .doc-row > *:nth-child(2),
  .doc-row > *:nth-child(4),
  .doc-row > *:nth-child(5) { display: none; }
}

/* Global documents page */
.docs-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.docs-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}
.docs-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.docs-filter-select {
  min-width: 140px;
}
.docs-bulk-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--primary-light, rgba(14,165,233,0.08));
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
}
.docs-bulk-bar.visible { display: flex; }
.docs-global-row {
  grid-template-columns: 32px 1fr 120px 110px 110px 150px 90px 80px;
}
@media (max-width: 900px) {
  .docs-global-row {
    grid-template-columns: 32px 1fr 110px 80px;
  }
  .docs-global-row > *:nth-child(3),
  .docs-global-row > *:nth-child(5),
  .docs-global-row > *:nth-child(6),
  .docs-global-row > *:nth-child(7) { display: none; }
}

/* ==============================
   Closing Checklist
   ============================== */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--gray-150, #ebebeb);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 0.5rem;
  transition: background 0.15s, border-color 0.15s;
}
.checklist-item:hover { border-color: var(--gray-300); }
.checklist-item-done {
  background: var(--gray-50);
  border-color: var(--gray-150, #ebebeb);
}

.checklist-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 1px;
}
.checklist-check:hover { border-color: var(--success, #16a34a); }
.checklist-check.done {
  background: var(--success, #16a34a);
  border-color: var(--success, #16a34a);
  color: #fff;
}

.checklist-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-800);
  line-height: 1.4;
}
.checklist-title.done {
  text-decoration: line-through;
  color: var(--gray-400);
}

.checklist-notes {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
}

.btn-ghost-sm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  border-radius: var(--radius-sm, 4px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.btn-ghost-sm:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}

/* Checklist Templates Settings Page */
.tmpl-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 0.625rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tmpl-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,232,0.08); }
.tmpl-card-body { flex: 1; min-width: 0; }
.tmpl-card-name { font-weight: 600; font-size: 0.9375rem; color: var(--gray-900); }
.tmpl-card-meta { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }

.tmpl-items-list {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.75rem;
}
.tmpl-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}
.tmpl-item-row:last-child { border-bottom: none; }
.tmpl-item-drag {
  cursor: grab;
  color: var(--gray-300);
  flex-shrink: 0;
}
.tmpl-item-title { flex: 1; }
.tmpl-item-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.25rem;
}
.tmpl-item-del:hover { color: var(--danger, #dc2626); }


/* ================================================================
   LANDING PAGE V2 — PREMIUM REDESIGN
   All selectors prefixed with .lp- to avoid any app-wide conflicts
   ================================================================ */

/* ---- Header — dark to match hero ---- */
.landing .landing-header {
  background: #06091a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 1rem 0;
}
.lp-logo-icon {
  background: linear-gradient(135deg, #1a56e8, #0ea5e9) !important;
  border-radius: 10px !important;
  width: 36px !important;
  height: 36px !important;
  font-size: 1.0625rem !important;
  box-shadow: 0 4px 12px rgba(26,86,232,0.4) !important;
}
.lp-logo-text {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: #ffffff !important;
}
.btn-lp-outline {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 40px;
}
.btn-lp-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.38);
  text-decoration: none;
  color: #ffffff;
}

/* ---- Hero — deep dark gradient ---- */
.lp-hero {
  position: relative;
  background: linear-gradient(160deg, #06091a 0%, #0d1535 35%, #0f1f4a 65%, #091530 100%);
  padding: 5.5rem 0 5rem !important;
  overflow: hidden;
}
.lp-hero-content {
  position: relative;
  z-index: 2;
}

/* Gradient orbs */
.lp-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
}
.lp-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(26,86,232,0.6) 0%, transparent 70%);
  top: -220px; left: -160px;
  opacity: 0.38;
  animation: lpOrbFloat1 13s ease-in-out infinite;
}
.lp-orb-2 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(14,165,233,0.55) 0%, transparent 70%);
  top: -120px; right: -170px;
  opacity: 0.35;
  animation: lpOrbFloat2 16s ease-in-out infinite;
}
.lp-orb-3 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(109,40,217,0.4) 0%, transparent 70%);
  bottom: -60px; left: 35%;
  opacity: 0.22;
  animation: lpOrbFloat3 19s ease-in-out infinite;
}
@keyframes lpOrbFloat1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%       { transform: translate(35px,25px) scale(1.05); }
}
@keyframes lpOrbFloat2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%       { transform: translate(-28px,38px) scale(1.07); }
}
@keyframes lpOrbFloat3 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%       { transform: translate(18px,-18px) scale(1.03); }
}

/* Badge */
.lp-badge {
  background: rgba(26,86,232,0.18) !important;
  color: #7eb3ff !important;
  border: 1px solid rgba(100,160,255,0.3) !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  backdrop-filter: blur(4px);
  font-size: 0.8125rem !important;
}

/* Hero title — gradient white-to-blue */
.lp-title {
  color: #ffffff !important;
  font-size: clamp(2rem, 5.5vw, 3.75rem) !important;
  font-weight: 900 !important;
  letter-spacing: -0.04em !important;
  line-height: 1.1 !important;
  background: linear-gradient(160deg, #ffffff 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Subtitle */
.lp-subtitle {
  color: rgba(255,255,255,0.62) !important;
  font-size: 1.125rem !important;
}

/* Form */
.lp-form {
  max-width: 520px !important;
}
.lp-input {
  background: rgba(255,255,255,0.08) !important;
  border: 1.5px solid rgba(255,255,255,0.15) !important;
  color: #ffffff !important;
  border-radius: 12px !important;
  font-size: 0.9375rem !important;
  min-height: 52px !important;
  padding: 0.75rem 1.125rem !important;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s !important;
}
.lp-input::placeholder { color: rgba(255,255,255,0.38); }
.lp-input:focus {
  border-color: rgba(26,86,232,0.7) !important;
  background: rgba(255,255,255,0.12) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,86,232,0.2);
}

/* Primary CTA button */
.lp-cta-btn {
  background: linear-gradient(135deg, #1a56e8 0%, #0ea5e9 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  min-height: 52px !important;
  padding: 0.75rem 1.5rem !important;
  white-space: nowrap !important;
  box-shadow: 0 4px 20px rgba(26,86,232,0.45), 0 1px 4px rgba(0,0,0,0.2) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  letter-spacing: 0.01em !important;
}
.lp-cta-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 30px rgba(26,86,232,0.55), 0 2px 8px rgba(0,0,0,0.2) !important;
  text-decoration: none !important;
  color: #ffffff !important;
}
.lp-cta-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 10px rgba(26,86,232,0.4) !important;
}

/* Form error */
.lp-form-error {
  color: #fca5a5 !important;
  font-size: 0.875rem !important;
  margin-top: 0.5rem !important;
  text-align: center !important;
}
.lp-form-error.hidden { display: none !important; }

/* Note */
.lp-note {
  color: rgba(255,255,255,0.38) !important;
  font-size: 0.8125rem !important;
}

/* Chat bubbles — glass on dark */
.lp-chat-preview {
  margin-top: 2.5rem !important;
}
.lp-bubble {
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  color: rgba(255,255,255,0.88) !important;
  backdrop-filter: blur(12px);
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.08) !important;
  padding: 1rem 1.25rem !important;
}
.lp-bubble strong { color: #93c5fd; }
.lp-chat-icon { font-size: 1.2rem !important; }

/* ---- Features Section ---- */
.lp-features {
  background: #f8fafc;
  padding: 6rem 0 !important;
}
.lp-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.625rem;
  text-align: center;
  display: block;
}
.lp-section-title {
  font-size: clamp(1.625rem, 3.5vw, 2.25rem) !important;
  font-weight: 800 !important;
  color: var(--gray-900) !important;
  text-align: center !important;
  letter-spacing: -0.03em !important;
  margin-bottom: 3rem !important;
  line-height: 1.2 !important;
}
.lp-features-grid {
  gap: 1.25rem !important;
}
.lp-feature-card {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.07) !important;
  border-radius: 20px !important;
  padding: 1.875rem !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.04) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  position: relative;
  overflow: hidden;
}
.lp-feature-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1a56e8, #0ea5e9);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lp-feature-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06) !important;
}
.lp-feature-card:hover::after { opacity: 1; }
.lp-feature-icon {
  width: 52px !important;
  height: 52px !important;
  background: linear-gradient(135deg, #e8effe 0%, #dbeafe 100%) !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 12px rgba(26,86,232,0.14) !important;
}
.lp-feature-icon svg { stroke: #1a56e8 !important; }
.lp-feature-card h3 {
  font-size: 1.0625rem !important;
  font-weight: 700 !important;
  color: var(--gray-900) !important;
  margin-top: 0.25rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.35 !important;
}
.lp-feature-card p {
  font-size: 0.875rem !important;
  color: var(--gray-500) !important;
  line-height: 1.7 !important;
}

/* ---- Personas Section ---- */
.lp-personas {
  background: #ffffff;
  padding: 6rem 0 !important;
}
.lp-personas-grid {
  gap: 1.25rem !important;
}
.lp-persona-card {
  background: #f8fafc !important;
  border: 1.5px solid var(--gray-200) !important;
  border-radius: 20px !important;
  padding: 2rem 1.75rem !important;
  transition: all 0.25s ease !important;
}
.lp-persona-card:hover {
  background: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(26,86,232,0.07), 0 10px 36px rgba(26,86,232,0.1) !important;
  transform: translateY(-5px) !important;
}
.lp-persona-card .persona-icon {
  font-size: 2.5rem !important;
  margin-bottom: 1rem !important;
  display: block;
}
.lp-persona-card h3 {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: var(--gray-900) !important;
  margin-bottom: 0.5rem !important;
}
.lp-persona-card p {
  font-size: 0.875rem !important;
  color: var(--gray-500) !important;
  line-height: 1.65 !important;
}

/* ---- CTA Section ---- */
.lp-cta.cta-section {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 0 5rem !important;
  margin-bottom: 0 !important;
}
.lp-cta-inner {
  background: linear-gradient(135deg, #0d1535 0%, #1a2d6e 50%, #0c2045 100%);
  border-radius: 28px;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(8,20,80,0.45);
}
.lp-cta-orb {
  position: absolute;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,86,232,0.55) 0%, transparent 70%);
  top: -250px; left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  filter: blur(60px);
}
.lp-cta-inner h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin-bottom: 0.875rem !important;
  letter-spacing: -0.03em !important;
  position: relative;
  z-index: 1;
}
.lp-cta-inner p {
  color: rgba(255,255,255,0.62) !important;
  margin-bottom: 2rem !important;
  font-size: 1.0625rem !important;
  position: relative;
  z-index: 1;
}
.lp-cta-btn-dark {
  position: relative;
  z-index: 1;
  font-size: 1rem !important;
  padding: 0.875rem 2.25rem !important;
  min-height: 56px !important;
  border-radius: 14px !important;
}

/* ---- Footer ---- */
.lp-footer {
  border-top: 1px solid var(--gray-100) !important;
}

/* ================================================================
   MOBILE FIRST — Critical spacing fixes
   ================================================================ */
@media (max-width: 640px) {
  .lp-hero { padding: 4rem 0 3.5rem !important; }

  /* Force adequate side margins — prevent edge-to-edge */
  .lp-hero .container,
  .lp-hero-content { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }

  /* Form stacks, full-width, with consistent rounded corners */
  .lp-form {
    flex-direction: column !important;
    padding: 0 !important;
    gap: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .lp-input {
    width: 100% !important;
    min-height: 52px !important;
    border-radius: 14px !important;
  }
  .lp-cta-btn {
    width: 100% !important;
    min-height: 52px !important;
    border-radius: 14px !important;
    justify-content: center !important;
  }

  /* Hero title slightly smaller */
  .lp-title {
    font-size: clamp(1.875rem, 9vw, 2.75rem) !important;
    letter-spacing: -0.03em !important;
  }
  .lp-subtitle { font-size: 1rem !important; }

  /* Cards */
  .lp-feature-card { padding: 1.5rem !important; border-radius: 16px !important; }
  .lp-persona-card { padding: 1.5rem 1.25rem !important; border-radius: 16px !important; }

  /* CTA inner */
  .lp-cta-inner { padding: 3rem 1.5rem !important; border-radius: 20px !important; }
  .lp-cta.cta-section { padding: 0 1rem 4rem !important; }

  /* Orbs — toned down on mobile */
  .lp-orb-1 { width: 300px; height: 300px; opacity: 0.22; }
  .lp-orb-2 { width: 250px; height: 250px; opacity: 0.22; }
  .lp-orb-3 { display: none; }

  /* Features/personas section padding */
  .lp-features { padding: 4rem 0 !important; }
  .lp-personas { padding: 4rem 0 !important; }
}

@media (max-width: 480px) {
  .lp-title { font-size: clamp(1.75rem, 10vw, 2.5rem) !important; }
  .landing .landing-header { padding: 0.875rem 0 !important; }
  .lp-hero { padding: 3.5rem 0 3rem !important; }
}

/* ---- Global Search Bar ---- */
.search-container {
  padding: 0 0.75rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  pointer-events: none;
  flex-shrink: 0;
}

.global-search-input {
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 32px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--gray-200);
  font-size: 0.8125rem;
  transition: all 0.2s;
  outline: none;
}

.global-search-input::placeholder { color: var(--gray-500); }

.global-search-input:focus {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: var(--white);
}

.global-search-input:focus ~ .search-shortcut { opacity: 0; }

.search-shortcut {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.6875rem;
  font-family: inherit;
  color: var(--gray-400);
  pointer-events: none;
  transition: opacity 0.2s;
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0.75rem;
  right: 0.75rem;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  z-index: 200;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

.search-loading, .search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.875rem;
}

.search-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

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

.search-results { padding: 0.5rem 0; }

.search-section {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.search-result-item:hover { background: var(--gray-50); }

.search-result-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  background: var(--gray-100);
  color: var(--gray-600);
}

.search-result-icon.deal-icon { background: #fef3c7; color: #d97706; }
.search-result-icon.contact-icon { background: #dbeafe; color: #2563eb; }
.search-result-icon.document-icon { background: #d1fae5; color: #059669; }

.search-result-info { flex: 1; min-width: 0; }

.search-result-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-arrow {
  color: var(--gray-300);
  flex-shrink: 0;
}

.search-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--gray-100);
  font-size: 0.6875rem;
  color: var(--gray-400);
  display: flex;
  gap: 1rem;
}

.search-footer kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 0.6875rem;
}

/* =================== Notes Section =================== */

.note-type-pill {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.note-type-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.note-type-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  position: relative;
}

.note-card.pinned {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, white);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.note-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.note-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-600);
}

.note-type-badge.general { background: #f3f4f6; color: #374151; }
.note-type-badge.phone_call { background: #eff6ff; color: #1d4ed8; }
.note-type-badge.showing { background: #f0fdf4; color: #15803d; }
.note-type-badge.negotiation { background: #fefce8; color: #a16207; }
.note-type-badge.inspection { background: #faf5ff; color: #7e22ce; }

.note-card-author {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.note-card-time {
  font-size: 0.6875rem;
  color: var(--gray-400);
}

.note-pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--gray-300);
  padding: 0.125rem;
  transition: color 0.15s;
  line-height: 1;
}

.note-pin-btn:hover,
.note-pin-btn.pinned {
  color: var(--primary);
}

.note-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.note-card-content {
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.note-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--gray-400);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}

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

.note-action-btn.delete:hover {
  color: var(--danger, #dc2626);
  background: #fef2f2;
}

.notes-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.notes-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* ---- Deadline Alert Banner ---- */
.deadline-banner {
  background: white;
  border: 1px solid var(--amber-200, #fde68a);
  border-left: 4px solid var(--amber-500, #f59e0b);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.deadline-banner-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--amber-50, #fffbeb);
  cursor: pointer;
  user-select: none;
}

.deadline-banner-icon { font-size: 1.1rem; flex-shrink: 0; }
.deadline-banner-text { flex: 1; font-size: 0.875rem; color: var(--gray-800); }

.deadline-banner-toggle,
.deadline-banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--gray-500);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  min-width: 44px;
  min-height: 44px;
}
.deadline-banner-toggle:hover,
.deadline-banner-dismiss:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}
.deadline-banner-toggle svg {
  transition: transform 0.2s;
}

.deadline-banner-body {
  border-top: 1px solid var(--gray-100);
}

.deadline-banner-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deadline-list-item {
  border-bottom: 1px solid var(--gray-100);
  border-left: 3px solid transparent;
}
.deadline-list-item:last-child { border-bottom: none; }
.deadline-list-item.urgency-overdue { border-left-color: #ef4444; background: #fef2f2; }
.deadline-list-item.urgency-today   { border-left-color: #f59e0b; background: #fffbeb; }
.deadline-list-item.urgency-soon   { border-left-color: #f59e0b; }
.deadline-list-item.urgency-week   { border-left-color: #3b82f6; }

.deadline-list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: inherit;
  gap: 0.75rem;
  transition: background 0.1s;
}
.deadline-list-link:hover { background: var(--gray-50); }

.deadline-list-address {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-800);
  flex: 1;
}

.deadline-list-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.deadline-list-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

.deadline-list-days {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.deadline-list-days.urgency-overdue { background: #fee2e2; color: #b91c1c; }
.deadline-list-days.urgency-today   { background: #fef3c7; color: #92400e; }
.deadline-list-days.urgency-soon    { background: #fef3c7; color: #92400e; }
.deadline-list-days.urgency-week    { background: #dbeafe; color: #1d4ed8; }

@media (max-width: 640px) {
  .deadline-banner-list { font-size: 0.85rem; }
  .deadline-list-link { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

/* ==========================================
   MOBILE-FIRST UX PASS (Task #1213683)
   ========================================== */

/* ---- Kanban: touch-smooth horizontal scroll ---- */
.board-container {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.board-column { scroll-snap-align: start; }

/* ---- Kanban: sticky column headers ---- */
.board-col-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-100);
}

/* ---- Projects: filter toggle button (mobile only) ---- */
.filters-toggle-btn { display: none; }

/* ---- Projects: FAB (mobile only) ---- */
.projects-fab { display: none; }

@media (max-width: 768px) {
  /* Projects grid: explicit single column at mobile */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* Filters bar: collapsible on mobile */
  .filters-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
  }
  .filters-toggle-btn svg { transition: transform 0.2s; flex-shrink: 0; }
  .filters-toggle-btn.collapsed svg { transform: rotate(-90deg); }

  .filters-bar.mobile-collapsed { display: none; }

  /* Projects: FAB for New Project */
  .projects-fab {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 1.25rem;
    z-index: 150;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(26,86,232,0.4);
    text-decoration: none;
    font-size: 1.75rem;
    line-height: 1;
    transition: background 0.15s, transform 0.15s;
  }
  .projects-fab:hover { background: var(--primary-dark); transform: scale(1.05); text-decoration: none; color: white; }

  /* Projects: hide desktop "+ New Project" button in page header */
  .projects-header-new-btn { display: none; }

  /* Projects: page header actions wrap nicely */
  .page-header-inner-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
  }
  .view-toggle { flex: 1; }
  .view-toggle-btn { flex: 1; justify-content: center; min-height: 44px; }

  /* Kanban: card text doesn't overflow */
  .board-card-address {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Kanban: ensure board container uses full height minus mobile header + tab bar */
  .board-container {
    min-height: calc(100vh - 180px - 56px);
    padding: 0.5rem 0.75rem 1rem;
  }

  /* Kanban: column sticky header offset for mobile header */
  .board-col-header {
    top: 0;
  }
}

/* ---- Touch drag ghost element ---- */
.touch-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.85;
  transform: rotate(2deg) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  border-radius: var(--radius);
  transition: none;
}

/* ============================================================
   DOCUMENT MANAGEMENT — Project-level & Global Documents Page
   ============================================================ */

/* ── Category filter pills ── */
.doc-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: .3125rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.doc-filter-pill:hover {
  background: var(--primary-light, #eff6ff);
  border-color: var(--primary);
  color: var(--primary);
}
.doc-filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Drag-and-drop upload zone ── */
.doc-drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  background: var(--gray-50);
}
.doc-drop-zone:hover { border-color: var(--primary); background: #eff6ff; }
.doc-drop-zone.drag-over { border-color: var(--primary); background: #dbeafe; }

/* ── Document list wrapper ── */
.doc-list-wrap {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

/* ── Doc rows (shared by project-level and global page) ── */
.doc-row {
  display: grid;
  grid-template-columns: 1fr 120px 110px 120px 90px 70px 80px;
  gap: 0;
  align-items: center;
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .875rem;
  min-width: 640px;
}
.doc-row:last-child { border-bottom: none; }
.doc-row-header {
  background: var(--gray-50);
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}
.doc-row:not(.doc-row-header):hover { background: var(--gray-50); }

/* Global docs rows have an extra checkbox column */
.docs-global-row {
  grid-template-columns: 32px 1fr 120px 110px 120px 90px 70px 80px;
}

/* ── Filename link ── */
.doc-filename a {
  color: var(--gray-800);
  font-weight: 500;
  text-decoration: none;
  word-break: break-word;
}
.doc-filename a:hover { color: var(--primary); text-decoration: underline; }

/* ── Category badge ── */
.doc-category {
  display: inline-block;
  padding: .1875rem .5625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
  white-space: nowrap;
}

/* ── Status badges ── */
.doc-status {
  display: inline-block;
  padding: .1875rem .5625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.doc-status-draft    { background: #f1f5f9; color: #64748b; }
.doc-status-pending  { background: #fef3c7; color: #92400e; }
.doc-status-approved { background: #dcfce7; color: #166534; }
.doc-status-signed   { background: #dbeafe; color: #1e40af; }

/* ── Row action buttons ── */
.doc-actions {
  display: flex;
  gap: .25rem;
  justify-content: flex-end;
}
.doc-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
  padding: 0;
}
.doc-actions button:hover { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-800); }
.doc-actions button.btn-danger-ghost { color: var(--danger, #dc2626); border-color: transparent; background: transparent; }
.doc-actions button.btn-danger-ghost:hover { background: #fef2f2; border-color: #fca5a5; }

/* ── Danger ghost button (used elsewhere too) ── */
button.btn-danger-ghost {
  color: var(--danger, #dc2626);
  border-color: transparent;
  background: transparent;
  cursor: pointer;
}
button.btn-danger-ghost:hover { background: #fef2f2; }

/* ============================================================
   GLOBAL DOCUMENTS PAGE (/documents)
   ============================================================ */

.docs-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Bulk action bar */
.docs-bulk-bar {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1rem;
  background: var(--primary-light, #eff6ff);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--primary);
  flex-wrap: wrap;
}
.docs-bulk-bar.visible { display: flex; }

/* Filter row */
.docs-filters {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}
.docs-search { flex: 1; min-width: 200px; }
.docs-search .input { width: 100%; }
.docs-filter-select { min-width: 140px; }

/* Mobile responsiveness for doc rows */
@media (max-width: 640px) {
  .doc-row {
    grid-template-columns: 1fr auto;
    gap: .25rem .5rem;
    padding: .75rem;
    min-width: unset;
  }
  .doc-row > div:nth-child(3),
  .doc-row > div:nth-child(4),
  .doc-row > div:nth-child(5),
  .doc-row > div:nth-child(6) { display: none; }
  .doc-row-header { display: none; }
  .docs-global-row {
    grid-template-columns: 32px 1fr auto;
  }
  .docs-global-row > div:nth-child(3),
  .docs-global-row > div:nth-child(4),
  .docs-global-row > div:nth-child(5),
  .docs-global-row > div:nth-child(6),
  .docs-global-row > div:nth-child(7) { display: none; }
  .doc-filter-pill { font-size: .75rem; padding: .25rem .5rem; }
  .docs-filters { gap: .5rem; }
  .docs-filter-select { min-width: 120px; flex: 1; }
}

/* =================== Unread Badge =================== */
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary, #1a56e8);
  color: #fff;
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1;
}

/* Notification badge in sidebar */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: .625rem;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

/* ==========================================
   NOTIFICATION BELL & DROPDOWN
   ========================================== */

/* Bell button in sidebar */
.notif-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  background: none;
  border: none;
  color: var(--gray-400);
  margin: 0 auto;
}
.notif-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.notif-bell-icon {
  width: 20px;
  height: 20px;
}

/* Override badge position to sit next to bell */
.notif-btn .notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

/* Notification Dropdown — appears below the bell */
.notif-dropdown {
  display: none;
  position: absolute;
  left: 0.75rem;
  bottom: calc(100% + 8px);
  width: 320px;
  max-height: 420px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  z-index: 9999;
  flex-direction: column;
  animation: notif-drop-in 0.18s ease-out;
}
.notif-dropdown.open {
  display: flex;
}

@keyframes notif-drop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

/* Dropdown header */
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.notif-dropdown-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}
.notif-mark-all-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-weight: 500;
}
.notif-mark-all-btn:hover {
  text-decoration: underline;
}

/* Dropdown scrollable body */
.notif-dropdown-body {
  overflow-y: auto;
  flex: 1;
  max-height: 360px;
}
.notif-dropdown-body::-webkit-scrollbar {
  width: 4px;
}
.notif-dropdown-body::-webkit-scrollbar-track {
  background: transparent;
}
.notif-dropdown-body::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 4px;
}

/* Loading spinner */
.notif-dropdown-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.notif-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: notif-spin 0.7s linear infinite;
}
@keyframes notif-spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
}
.notif-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}
.notif-empty-text {
  font-size: 0.8125rem;
  text-align: center;
}

/* Notification items */
.notif-item {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.notif-item:hover {
  background: var(--gray-50);
  text-decoration: none;
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item.unread {
  background: #f0f7ff;
}
.notif-item.unread:hover {
  background: #e8f1ff;
}

/* Notification icon */
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}
.notif-icon-task   { background: #eff6ff; color: #2563eb; }
.notif-icon-project { background: #f0fdf4; color: #16a34a; }
.notif-icon-message { background: #fdf4ff; color: #9333ea; }
.notif-icon-document { background: #fff7ed; color: #c2410c; }
.notif-icon-reminder { background: #fef3c7; color: #d97706; }
.notif-icon-default { background: var(--gray-100); color: var(--gray-600); }

/* Notification content */
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-body {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.notif-item-time {
  font-size: 0.6875rem;
  color: var(--gray-400);
}

/* Unread dot */
.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 0.375rem;
}

/* Day group header */
.notif-day-group {
  padding: 0.375rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Mobile header bell */
.mobile-header-bell {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  position: relative;
  margin-left: auto;
}
.mobile-header-bell svg {
  width: 22px;
  height: 22px;
}
.mobile-notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 14px;
  height: 14px;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 0.5625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  pointer-events: none;
  line-height: 1;
}

/* Pulse animation for new notification */
@keyframes notif-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.notif-badge.pulse {
  animation: notif-pulse 0.6s ease-out;
}
