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

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eff6ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --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-900: #111827;
  --sidebar-bg: #111827;
  --sidebar-w: 220px;
  --header-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-700);
  background: var(--gray-50);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  transition: background .3s;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.sidebar-logo span {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section-label {
  padding: 6px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gray-500);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--gray-400);
  border-left: 3px solid transparent;
  transition: all .15s;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }

.nav-item.active {
  background: rgba(37,99,235,.15);
  color: #fff;
  border-left-color: var(--brand);
}

.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .nav-label { font-size: 13px; font-weight: 500; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .settings-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 8px 0;
  font-size: 13px;
}
.sidebar-footer .settings-btn:hover { color: #fff; }

.signout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.signout-row.hidden { display: none; }
.user-email {
  font-size: 11px;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  color: var(--gray-400);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.signout-btn:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ─── Login ─────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden { display: none; }

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}
.login-card .login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card .login-logo img {
  max-height: 64px;
  max-width: 220px;
  object-fit: contain;
}
.login-card h1 { font-size: 20px; font-weight: 800; color: var(--gray-900); }
.login-card p { font-size: 13px; color: var(--gray-500); margin: 6px 0 22px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.login-error {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 10px;
  text-align: left;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
}
.auth-tab.active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: var(--shadow);
}

.auth-pane { display: none; }
.auth-pane.active { display: block; }

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-grid input { margin-bottom: 10px; }

.pending-icon { font-size: 36px; margin-bottom: 10px; }
#auth-pane-pending p { margin-bottom: 12px; }

/* ─── Main ──────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Top Bar ───────────────────────────────────────────── */
#topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

#topbar h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 12px;
  gap: 8px;
  width: 260px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--gray-700);
  width: 100%;
}

.search-box input::placeholder { color: var(--gray-400); }

/* ─── Content Area ──────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Views ─────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Cards & Stats ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 6px;
}

.stat-card .stat-icon {
  float: right;
  font-size: 28px;
  opacity: .15;
  margin-top: -4px;
}

/* ─── Section Headers ───────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 6px; }

/* ─── Table ─────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

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

thead { background: var(--gray-50); }

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--gray-700); }
th .sort-icon { opacity: .4; margin-left: 4px; }
th.sorted .sort-icon { opacity: 1; color: var(--brand); }

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

.td-actions { display: flex; gap: 6px; }

/* ─── Avatar ─────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.contact-cell { display: flex; align-items: center; gap: 10px; }
.contact-name { font-weight: 600; color: var(--gray-900); }
.contact-company { font-size: 12px; color: var(--gray-500); }

/* ─── Badges / Pills ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

/* ─── Pipeline Board ────────────────────────────────────── */
.pipeline-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-col {
  flex: 0 0 240px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 400px;
}

.pipeline-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pipeline-col-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-600);
  flex: 1;
}

.pipeline-col-header .col-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--gray-300);
  color: var(--gray-600);
  padding: 1px 7px;
  border-radius: 10px;
}

.pipeline-col-header .col-value {
  font-size: 11px;
  color: var(--gray-500);
}

.opp-card {
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all .15s;
}

.opp-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

.opp-card .opp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.opp-card .opp-company {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.opp-card .opp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.opp-card .opp-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

.opp-card .opp-date {
  font-size: 11px;
  color: var(--gray-400);
}

.add-opp-btn {
  width: 100%;
  padding: 8px;
  border: 2px dashed var(--gray-300);
  background: none;
  border-radius: 6px;
  color: var(--gray-400);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.add-opp-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  border: none;
  background: none;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Forms ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s;
  background: #fff;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* ─── Map ────────────────────────────────────────────────── */
#map-container { display: flex; gap: 20px; height: calc(100vh - var(--header-h) - 48px); }
#map { flex: 1; border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow); min-height: 400px; }
#map-sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.map-contact-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all .15s;
}

.map-contact-card:hover,
.map-contact-card.focused {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.map-contact-card .mcn { font-weight: 600; color: var(--gray-900); font-size: 13px; }
.map-contact-card .mca { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.map-brand-btn {
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--gray-300);
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.map-brand-btn:hover { border-color: var(--gray-400); color: var(--gray-900); }
.map-brand-btn.active {
  background: var(--btn-color, var(--brand));
  border-color: var(--btn-color, var(--brand));
  color: #fff;
}
.map-brand-btn[data-brand-id=""].active {
  background: var(--brand);
  border-color: var(--brand);
}

/* ─── Detail Panel ──────────────────────────────────────── */
.detail-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: 24px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.detail-info h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.detail-info p { font-size: 13px; color: var(--gray-500); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  display: block;
  margin-bottom: 3px;
}

.detail-field p { font-size: 13px; color: var(--gray-700); }

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-500);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* ─── Toast ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

/* ─── Map API Key Banner ────────────────────────────────── */
.api-key-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-key-banner p { font-size: 13px; color: #92400e; flex: 1; }
.api-key-banner strong { color: #78350f; }

/* ─── Settings ──────────────────────────────────────────── */
.settings-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: 24px;
  max-width: 560px;
  margin-bottom: 20px;
}

.settings-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.settings-card p {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

/* ─── Dashboard Recent ──────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.dash-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
}

.dash-card-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.dash-card-body { padding: 0; }

.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-50);
  font-size: 13px;
}

.dash-row:last-child { border-bottom: none; }
.dash-row .dr-label { flex: 1; color: var(--gray-700); font-weight: 500; }
.dash-row .dr-sub { font-size: 11px; color: var(--gray-400); }

/* ─── Brand Picker ──────────────────────────────────────── */
.brand-picker {
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  background: #fff;
  cursor: default;
}

.brand-picker-empty {
  font-size: 12px;
  color: var(--gray-400);
  padding: 2px 4px;
  align-self: center;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  user-select: none;
  transition: all .12s;
  color: #fff;
}

.brand-chip:hover { filter: brightness(1.1); }

.brand-chip.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

.brand-chip .chip-check {
  font-size: 10px;
  opacity: 0;
  transition: opacity .12s;
}

.brand-chip.selected .chip-check { opacity: 1; }

/* Brand tag (read-only display in table / detail) */
.brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.brand-tag .brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  flex-shrink: 0;
}

/* Brand list cards */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.brand-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-card-header {
  height: 6px;
}

.brand-card-body {
  padding: 16px;
}

.brand-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 3px;
}

.brand-card-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 12px;
  min-height: 16px;
}

.brand-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}

.brand-card-stat {
  font-size: 12px;
  color: var(--gray-500);
}

.brand-card-stat strong {
  color: var(--gray-900);
  font-weight: 700;
}

/* ─── Dealer Level ──────────────────────────────────────── */
.dealer-level-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: #fff;
  min-height: 42px;
}

.dealer-level-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  user-select: none;
  transition: all .12s;
  color: #fff;
  opacity: .55;
}

.dealer-level-chip:hover { opacity: .8; }

.dealer-level-chip.selected {
  opacity: 1;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

.dealer-level-chip .dl-rank {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Badge used in table, detail, modal preview */
.dealer-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.dl-rank-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Dealer level cards in Brands view */
.dealer-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.dl-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.dl-card-stripe {
  width: 6px;
  flex-shrink: 0;
}

.dl-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dl-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dl-rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.dl-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
}

.dl-card-desc {
  font-size: 12px;
  color: var(--gray-500);
}

.dl-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* ─── Quotes ─────────────────────────────────────────────── */
.quote-editor {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.quote-editor-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  background: var(--gray-50);
}

.quote-meta-block { display: flex; flex-direction: column; gap: 3px; }
.quote-meta-block label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--gray-400);
}
.quote-meta-block .qmv {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.quote-fields {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
}

/* Line-items table inside the editor */
.quote-line-table {
  width: 100%;
  border-collapse: collapse;
}

.quote-line-table th {
  background: var(--gray-50);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  text-align: center;
  white-space: nowrap;
  cursor: default;
}

/* $ prefix inside MSRP / Dealer price cells */
.price-wrap { position: relative; }
.price-wrap .price-symbol {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 12px;
  pointer-events: none;
}
.price-wrap input { padding-left: 20px !important; }

.quote-line-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.quote-line-table tr:last-child td { border-bottom: none; }

.quote-line-table input[type="text"],
.quote-line-table input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-900);
  background: transparent;
  outline: none;
  transition: border-color .12s, background .12s;
  font-family: inherit;
}

.quote-line-table input[type="number"] { text-align: right; }

.quote-line-table input:hover { border-color: var(--gray-300); background: #fff; }
.quote-line-table input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }

.quote-line-table .col-qty   { width: 70px; }
.quote-line-table .col-brand { width: 120px; }
.quote-line-table .col-model { width: 120px; }
.quote-line-table .col-sku   { width: 110px; }
.quote-line-table .col-desc  { min-width: 180px; }
.quote-line-table .col-price { width: 110px; }
.quote-line-table .col-total { width: 110px; }
.quote-line-table .col-del   { width: 36px; }

.quote-line-table .cell-total {
  font-weight: 700;
  color: var(--gray-900);
  text-align: right;
  padding-right: 12px;
  font-size: 13px;
}

.quote-line-table .row-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-300);
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .12s;
}
.quote-line-table .row-delete:hover { color: var(--danger); }

.quote-totals {
  padding: 16px 24px;
  border-top: 2px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
}

.quote-totals-table { min-width: 280px; }
.quote-totals-table td { padding: 4px 8px; font-size: 13px; }
.quote-totals-table td:last-child { text-align: right; font-weight: 600; }
.quote-totals-table tr.grand-total td {
  font-size: 15px;
  font-weight: 800;
  color: var(--gray-900);
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
}

.quote-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}

/* PDF Export Settings (used in Settings card) */
.pdf-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.pdf-opt-group { display: flex; flex-direction: column; gap: 10px; }

.pdf-opt-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
}

/* Status badges for quotes */
.qstatus-draft    { background: var(--gray-100); color: var(--gray-600); }
.qstatus-sent     { background: #dbeafe; color: #1d4ed8; }
.qstatus-accepted { background: #dcfce7; color: #15803d; }
.qstatus-declined { background: #fee2e2; color: #b91c1c; }
.qstatus-expired  { background: #ffedd5; color: #c2410c; }

/* Quote list table */
.quote-number { font-weight: 700; color: var(--brand); font-family: monospace; font-size: 13px; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Responsive helpers ────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.mt-4 { margin-top: 4px; }
.mt-16 { margin-top: 16px; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.fw-600 { font-weight: 600; }
.color-success { color: var(--success); }
.color-danger { color: var(--danger); }
.color-warning { color: var(--warning); }
