/* ============================================================
   QE Buildings Contractor Portal — Blue/Gray/White
   ============================================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #24506e;
  --primary-dark: #0f2840;
  --accent: #4a90c4;
  --accent-light: #6ba8d6;
  --accent-hover: #3a7db0;
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1e2b3a;
  --text-secondary: #5a6b7d;
  --text-muted: #8d99a8;
  --border: #dfe4ea;
  --border-light: #ebeef2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-lg: 16px;
  --blue-50: #eff5fb;
  --blue-100: #dce8f3;
  --blue-200: #b8d1e7;
  --blue-300: #8db5d6;
  --blue-400: #6298c2;
  --blue-500: #4a7fb0;
  --blue-600: #3a6690;
  --blue-700: #2c4e70;
  --gray-50: #f8f9fb;
  --gray-100: #f0f2f5;
  --gray-200: #e2e6eb;
  --gray-300: #cdd3db;
  --gray-400: #a0aab6;
  --gray-500: #7a8694;
  --gray-600: #5a6672;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.nav-content {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand a { display: flex; align-items: center; }
.nav-brand img, .nav-logo { height: 32px; width: auto; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--text-secondary);
  transition: all 0.15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.active { background: var(--primary); color: #fff; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.username { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.logout-btn {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.logout-btn:hover { background: var(--bg); border-color: var(--gray-300); }

/* ============================================================
   MOBILE NAV — SVG icons
   ============================================================ */
.mobile-nav {
  display: flex; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  z-index: 100; box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
  padding: 6px 0 calc(14px + env(safe-area-inset-bottom, 8px));
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px 8px; text-decoration: none; color: var(--text-muted); transition: all 0.15s;
}
.mobile-nav a.active { color: var(--primary); }
.mobile-nav .icon {
  width: 22px; height: 22px; margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center;
}
.mobile-nav .label { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }

.nav-icon-leads::before,
.nav-icon-stats::before,
.nav-icon-settings::before,
.nav-icon-contractors::before,
.nav-icon-proposals::before,
.nav-icon-quotes::before {
  content: ''; display: block; width: 20px; height: 20px; background: currentColor;
}
.nav-icon-leads::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2'/%3E%3C/svg%3E") center/contain no-repeat;
}
.nav-icon-stats::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.nav-icon-settings::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
}
.nav-icon-contractors::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.nav-icon-proposals::before,
.nav-icon-quotes::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.desktop-nav { display: none; }
@media (min-width: 768px) {
  .desktop-nav { display: flex; }
  .mobile-nav { display: none !important; }
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
  max-width: 1200px; margin: 0 auto;
  padding: 72px 20px 32px;
}
@media (max-width: 767px) {
  body:has(.mobile-nav) .container { padding-bottom: 100px; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; background: var(--bg);
}
.login-box {
  width: 100%; max-width: 400px;
  background: var(--card); border-radius: var(--radius-lg);
  padding: 40px 32px; box-shadow: var(--shadow-lg);
}
.login-box h1 { font-size: 22px; color: var(--text); margin-bottom: 4px; text-align: center; font-weight: 700; }
.login-logo { display: block; margin: 0 auto 20px; height: 48px; width: auto; }
.error-msg {
  background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-200);
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; text-align: center;
}
.login-tabs { display: flex; gap: 0; margin-bottom: 24px; }
.login-tab {
  flex: 1; padding: 10px; font-size: 13px; font-weight: 600;
  border: 2px solid var(--border); background: var(--card); color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
}
.login-tab:first-child { border-radius: 8px 0 0 8px; }
.login-tab:last-child { border-radius: 0 8px 8px 0; }
.login-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.login-form input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; margin-bottom: 12px; outline: none; transition: border 0.15s;
  background: var(--gray-50);
}
.login-form input:focus { border-color: var(--accent); background: var(--card); }

/* ============================================================
   BUTTONS — blue/gray/white only
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-light); box-shadow: var(--shadow); }

.btn-cancel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; background: var(--card); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: all 0.15s;
}
.btn-cancel:hover { background: var(--bg); }

.btn-danger {
  display: inline-flex; align-items: center;
  padding: 10px 22px; background: var(--gray-500); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-danger:hover { background: var(--gray-600); }

.btn-delete {
  background: none; color: var(--gray-500); padding: 8px 14px;
  border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-delete:hover { background: var(--gray-100); color: var(--text); }

.btn-call {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; background: var(--blue-50); color: var(--blue-600);
  border: 1px solid var(--blue-200); border-radius: 8px;
  font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.15s;
}
.btn-call:hover { background: var(--blue-100); }

.btn-email {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; background: var(--gray-50); color: var(--blue-700);
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.15s;
}
.btn-email:hover { background: var(--gray-100); }

.btn-text {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; background: var(--blue-50); color: var(--blue-500);
  border: 1px solid var(--blue-100); border-radius: 8px;
  font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.15s;
}
.btn-text:hover { background: var(--blue-100); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; gap: 16px;
}
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 20px; }
}

.back-link { margin-bottom: 16px; }
.back-link a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-muted); font-size: 13px; font-weight: 500; text-decoration: none;
  transition: color 0.15s;
}
.back-link a:hover { color: var(--text); }

/* ============================================================
   LEAD CARDS
   ============================================================ */
.lead-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
@media (max-width: 600px) { .lead-cards { grid-template-columns: 1fr; } }

.lead-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); cursor: pointer; transition: all 0.2s;
  border-left: 3px solid var(--accent);
}
.lead-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.lead-card.status-new { border-left-color: var(--blue-500); }
.lead-card.status-no_answer { border-left-color: var(--gray-400); }
.lead-card.status-need_to_quote { border-left-color: var(--blue-300); }
.lead-card.status-quoted { border-left-color: var(--primary); }
.lead-card.status-dead { border-left-color: var(--gray-300); }
.lead-card.status-proposal_received { border-left-color: var(--blue-400); }
.lead-card.status-proposal_sent { border-left-color: #059669; }
.lead-card.status-quote_requested { border-left-color: var(--blue-300); }
.lead-card.status-denied { border-left-color: #dc2626; }

.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px; gap: 12px;
}
.card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.card-details { display: flex; flex-direction: column; gap: 4px; }
.card-detail { font-size: 13px; color: var(--text-secondary); }
.card-meta {
  display: flex; gap: 10px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-light); flex-wrap: wrap;
}
.meta-item { font-size: 11px; color: var(--text-muted); }
.meta-item strong { color: var(--text-secondary); font-weight: 600; }

/* ============================================================
   STATUS BADGES — blue/gray
   ============================================================ */
.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.status-badge.status-new { background: var(--blue-100); color: var(--blue-600); }
.status-badge.status-no_answer { background: var(--gray-100); color: var(--gray-500); }
.status-badge.status-need_to_quote { background: var(--blue-50); color: var(--blue-500); }
.status-badge.status-quoted { background: var(--primary); color: #fff; }
.status-badge.status-dead { background: var(--gray-200); color: var(--gray-500); }
.status-badge.status-proposal_received { background: #dbeafe; color: #1d4ed8; }
.status-badge.status-proposal_sent { background: #d1fae5; color: #059669; }
.status-badge.status-quote_requested { background: var(--blue-50); color: var(--blue-500); }
.status-badge.status-denied { background: #FEE2E2; color: #dc2626; }
.status-badge.status-contacted { background: var(--gray-100); color: var(--gray-500); }
.status-badge.status-won { background: var(--blue-100); color: var(--blue-600); }
.status-badge.status-lost { background: var(--gray-200); color: var(--gray-500); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead th {
  background: var(--gray-50); color: var(--text-secondary);
  padding: 10px 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
thead th.num { text-align: center; }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border-light); }
tbody td.num { text-align: center; font-weight: 600; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }
.contractor-cell { display: flex; align-items: center; gap: 10px; }
.contractor-cell img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.no-logo {
  width: 28px; height: 28px; border-radius: 6px; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0;
}

/* ============================================================
   LEAD PROFILE
   ============================================================ */
.lead-profile { max-width: 800px; }
.profile-header {
  background: var(--card); border-radius: var(--radius-lg); padding: 24px 28px;
  margin-bottom: 16px; box-shadow: var(--shadow); position: relative;
}
.profile-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; gap: 16px;
}
.profile-top h1 { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -0.3px; }
.profile-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-delete-corner {
  position: absolute; top: 16px; right: 16px;
  background: none; border: 1px solid var(--gray-300); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all 0.15s; color: var(--gray-500);
}
.btn-delete-corner:hover { background: var(--gray-100); color: var(--text); }

.profile-action-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.action-row { display: flex; gap: 8px; }
.action-row-contact { flex-wrap: wrap; }
@media (max-width: 600px) {
  .action-row-contact a { flex: 1; justify-content: center; text-align: center; }
}

.status-select {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; cursor: pointer;
  outline: none; background: var(--card); transition: border 0.15s;
}
.status-select:focus { border-color: var(--accent); }
.status-select.status-new { background: var(--blue-100); color: var(--blue-600); border-color: var(--blue-200); }
.status-select.status-no_answer { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-300); }
.status-select.status-need_to_quote { background: var(--blue-50); color: var(--blue-500); border-color: var(--blue-200); }
.status-select.status-quoted { background: var(--primary); color: #fff; border-color: var(--primary); }
.status-select.status-dead { background: var(--gray-200); color: var(--gray-500); border-color: var(--gray-300); }
.status-select.status-proposal_received { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.status-select.status-proposal_sent { background: #d1fae5; color: #059669; border-color: #6ee7b7; }
.status-select.status-quote_requested { background: var(--blue-50); color: var(--blue-500); border-color: var(--blue-200); }
.status-select.status-contacted { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-300); }
.status-select.status-won { background: var(--blue-100); color: var(--blue-600); border-color: var(--blue-200); }
.status-select.status-lost { background: var(--gray-200); color: var(--gray-500); border-color: var(--gray-300); }

.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 600px) {
  .profile-grid { grid-template-columns: 1fr; gap: 12px; }
  .profile-top { flex-direction: column; }
  .profile-actions { width: 100%; }
  .profile-top h1 { font-size: 20px; }
}
.field { display: flex; flex-direction: column; gap: 2px; }
.field-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.field-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ============================================================
   NOTES
   ============================================================ */
.notes-section {
  background: var(--card); border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow);
}
.notes-section h3 { font-size: 14px; color: var(--text); margin-bottom: 10px; font-weight: 600; }
.notes-textarea {
  width: 100%; min-height: 100px; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-family: inherit; line-height: 1.6;
  resize: vertical; outline: none; transition: border 0.15s; background: var(--gray-50);
}
.notes-textarea:focus { border-color: var(--accent); background: var(--card); }
.notes-saved { font-size: 11px; color: var(--accent); margin-top: 6px; display: none; font-weight: 500; }
.notes-saved.show { display: block; }

/* ============================================================
   STATS
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); text-align: center; border-top: 3px solid var(--border);
}
.stat-card.status-new { border-top-color: var(--blue-500); }
.stat-card.status-proposal_received { border-top-color: #1d4ed8; }
.stat-card.status-proposal_sent { border-top-color: #059669; }
.stat-card.status-quote_requested { border-top-color: var(--blue-300); }
.stat-card.status-no_answer { border-top-color: var(--gray-400); }
.stat-card.status-need_to_quote { border-top-color: var(--blue-300); }
.stat-card.status-quoted { border-top-color: var(--primary); }
.stat-card.status-dead { border-top-color: var(--gray-300); }
.stat-card.status-contacted { border-top-color: var(--gray-400); }
.stat-card.status-won { border-top-color: var(--blue-500); }
.stat-card.status-lost { border-top-color: var(--gray-300); }
.stat-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); }
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-container { max-width: 700px; }
.settings-section {
  background: var(--card); border-radius: var(--radius); padding: 24px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.settings-section h2 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 12px; }
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; gap: 12px; } }
.info-field { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.info-value { font-size: 14px; color: var(--text); font-weight: 500; }
.help-text { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   CONTRACTOR DETAIL (Admin)
   ============================================================ */
.contractor-detail { max-width: 900px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; }
.detail-info { display: flex; align-items: center; gap: 14px; }
.detail-logo { width: 56px; height: 56px; border-radius: var(--radius); object-fit: cover; }
.detail-info h1 { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.detail-info p { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.detail-actions { display: flex; gap: 8px; }
@media (max-width: 600px) { .detail-header { flex-direction: column; } .detail-info h1 { font-size: 20px; } }

/* ============================================================
   FORMS
   ============================================================ */
.form-container {
  max-width: 700px; background: var(--card); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow);
}
.form-container h1 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.lead-form, .contractor-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; outline: none;
  transition: border 0.15s; background: var(--gray-50);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); background: var(--card);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.checkbox-group { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.checkbox-group label {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: normal;
  text-transform: none; letter-spacing: normal; color: var(--text); cursor: pointer;
}
.checkbox-group input[type="checkbox"] { width: auto; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@media (max-width: 600px) {
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-primary, .form-actions .btn-cancel { width: 100%; justify-content: center; }
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; }

h2 { font-size: 18px; font-weight: 600; color: var(--text); margin: 28px 0 14px; }

/* ============================================================
   CONTRACTOR CARDS (Admin)
   ============================================================ */
.contractor-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.contractor-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: all 0.2s;
}
.contractor-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.cc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cc-avatar {
  width: 42px; height: 42px; border-radius: 10px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.cc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cc-avatar span { color: #fff; font-size: 18px; font-weight: 700; }
.cc-name { font-size: 15px; font-weight: 700; color: var(--text); }
.cc-territory { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.cc-contact { margin-bottom: 14px; }
.cc-detail { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.cc-stats { display: flex; gap: 0; border-top: 1px solid var(--border); padding-top: 14px; }
.cc-stat { flex: 1; text-align: center; }
.cc-stat-num { font-size: 20px; font-weight: 700; color: var(--text); }
.cc-stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }
@media (max-width: 600px) { .contractor-cards { grid-template-columns: 1fr; } }

.pending-quotes-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--blue-200); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 12px 18px; margin-bottom: 16px;
  text-decoration: none; color: var(--accent); font-size: 13px; box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.pending-quotes-banner:hover { box-shadow: var(--shadow); }
.banner-arrow { margin-left: auto; font-size: 16px; color: var(--text-muted); }

/* ============================================================
   QUOTE CARDS — swipe-to-delete + inline delete
   ============================================================ */
.quotes-section { margin-top: 16px; }
.quotes-section h3 { font-size: 14px; margin-bottom: 10px; color: var(--text); font-weight: 600; }
.quote-cards { display: flex; flex-direction: column; gap: 8px; }

.quote-card-swipe-wrapper {
  position: relative; overflow: hidden; border-radius: var(--radius);
}
.quote-card-swipe-delete {
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  background: var(--gray-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quote-card-swipe-delete:hover { background: var(--gray-600); }

.quote-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); padding: 14px 40px 14px 18px;
  box-shadow: var(--shadow); transition: transform 0.2s;
  position: relative; overflow: hidden;
}
.quote-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--quote-accent, var(--gray-400));
}
.quote-card:hover { box-shadow: var(--shadow-hover); }
.quote-card-header { display: flex; justify-content: space-between; align-items: center; }
.quote-dims { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.quote-status-badge {
  font-size: 10px; font-weight: 700; color: #fff;
  padding: 3px 10px; border-radius: 20px; letter-spacing: 0.3px;
}
.quote-card-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); margin-top: 4px; flex-wrap: wrap; }
.quote-card-meta span::before {
  content: ''; display: inline-block; width: 3px; height: 3px;
  border-radius: 50%; background: var(--gray-300); margin-right: 6px; vertical-align: middle;
}
.quote-card-meta span:first-child::before { display: none; }

.quote-card-footer {
  display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border-light);
}
.quote-card-date { font-size: 11px; color: var(--text-muted); }
.quote-inline-delete {
  background: none; border: 1px solid var(--gray-300); border-radius: 6px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--gray-500);
  cursor: pointer; transition: all 0.15s;
}
.quote-inline-delete:hover { background: var(--gray-100); color: var(--text); }

.quote-card-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--gray-300); font-weight: 300;
}

/* Hide old emoji-based delete btn */
.quote-delete-btn { display: none; }

/* ============================================================
   GROUPED SECTIONS on Dashboard
   ============================================================ */
.lead-section { margin-bottom: 24px; }
.lead-section h2 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.section-count { font-weight: 500; color: var(--text-muted); font-size: 14px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header.collapsible {
  cursor: pointer; user-select: none; padding: 10px 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.section-header.collapsible:hover { background: var(--gray-50); }
.collapse-arrow { font-size: 12px; color: var(--text-muted); transition: transform 0.2s; }
.section-search {
  width: 100%; max-width: 400px; padding: 9px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  outline: none; background: var(--card); transition: border 0.15s;
}
.section-search:focus { border-color: var(--accent); }

/* ============================================================
   MOBILE RESPONSIVE — Quote Detail Page
   ============================================================ */
@media (max-width: 768px) {
  .doc-grid {
    grid-template-columns: 1fr !important;
  }
  .quote-workspace [style*='grid-template-columns: 1fr 1fr'] ,
  .quote-workspace [style*='grid-template-columns:1fr 1fr'] {
    grid-template-columns: 1fr !important;
  }
}
.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .admin-two-col {
    grid-template-columns: 1fr !important;
  }
}

/* PDF Preview Fitting */
.pdf-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}
.pdf-preview-wrap {
  width: 100%;
  height: 100%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
@media (max-width: 768px) {
  /* Make preview cards taller on mobile so PDF is readable */
  .doc-card-preview {
    height: 280px !important;
  }
  /* Make modal full-screen on mobile */
  .pdf-modal-inner {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    position: fixed !important;
  }
  .pdf-modal-frame {
    height: calc(100% - 48px) !important;
    min-height: 0;
  }
}
@media (max-width: 768px) {
  #constructionInclusions {
    grid-template-columns: 1fr !important;
  }
}

@media(min-width:769px) {
  .modal-container { inset: 3% 5% !important; border-radius: 12px !important; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,.25); background: #fff; }
}
@media(max-width:768px) {
  .modal-container { background: #fff; }
}

.nav-icon-proposals::before {
  content: ''; display: block; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}
