:root {
  --crm-navy: #111827;
  --crm-blue: #2563eb;
  --crm-soft: #f5f7fb;
  --crm-border: #e5e7eb;
  --crm-muted: #64748b;
}

body { background: var(--crm-soft); color: #172033; min-height: 100vh; }
.crm-navbar { background: var(--crm-navy); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.crm-navbar .navbar-brand, .crm-navbar .nav-link { color: rgba(255,255,255,.78); }
.crm-navbar .navbar-brand { color: #fff; font-weight: 800; letter-spacing: -.02em; }
.crm-navbar .navbar-brand small { color: #93c5fd; font-size: .72rem; font-weight: 700; }
.crm-navbar .nav-link { border-radius: .55rem; font-weight: 600; padding-left: .8rem !important; padding-right: .8rem !important; }
.crm-navbar .nav-link:hover, .crm-navbar .nav-link.active { color: #fff; background: rgba(255,255,255,.1); }
.navbar-toggler { background: #fff; }
.brand-badge { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--crm-blue); color: #fff; }
.page-heading h1 { font-size: clamp(1.65rem, 2.4vw, 2.2rem); font-weight: 800; letter-spacing: -.035em; margin: 0; }
.page-heading p { color: var(--crm-muted); margin: .35rem 0 0; }
.crm-card { background: #fff; border: 1px solid var(--crm-border); border-radius: 16px; box-shadow: 0 8px 28px rgba(15,23,42,.045); }
.crm-card .card-header { background: transparent; border-bottom: 1px solid var(--crm-border); padding: 1rem 1.2rem; }
.crm-card .card-body { padding: 1.2rem; }
.metric-card { padding: 1.15rem; height: 100%; }
.metric-card .metric-label { color: var(--crm-muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .045em; }
.metric-card .metric-value { font-size: 2rem; line-height: 1.15; font-weight: 800; letter-spacing: -.04em; margin-top: .4rem; }
.table > :not(caption) > * > * { padding: .85rem .75rem; vertical-align: middle; }
.table thead th { color: var(--crm-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.lead-company { font-weight: 750; color: #172033; }
.lead-meta { font-size: .83rem; color: var(--crm-muted); }
.status-badge { font-size: .72rem; font-weight: 750; letter-spacing: .02em; }
.form-control, .form-select { border-color: #d8dee8; border-radius: 10px; padding: .65rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #93b4fb; box-shadow: 0 0 0 .2rem rgba(37,99,235,.12); }
.btn { border-radius: 9px; font-weight: 650; }
.email-field { position: relative; }
.email-field textarea { min-height: 300px; resize: vertical; line-height: 1.55; }
.copy-state { min-width: 82px; }
.lead-sidebar dt { color: var(--crm-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.lead-sidebar dd { margin-bottom: 1rem; overflow-wrap: anywhere; }
.timeline { position: relative; padding-left: 1.25rem; }
.timeline:before { content: ""; position: absolute; left: .3rem; top: .5rem; bottom: .5rem; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; padding: 0 0 1.15rem .75rem; }
.timeline-item:before { content: ""; position: absolute; left: -1.02rem; top: .35rem; width: 10px; height: 10px; background: var(--crm-blue); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #bfdbfe; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-title { font-weight: 700; }
.timeline-meta { color: var(--crm-muted); font-size: .8rem; }
.queue-email { font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dbeafe, transparent 35%), var(--crm-soft); }
.login-card { width: 100%; max-width: 460px; padding: 2rem; }
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .empty-icon { width: 64px; height: 64px; margin: 0 auto 1rem; display: grid; place-items: center; border-radius: 18px; background: #e8f0ff; color: var(--crm-blue); font-size: 1.7rem; font-weight: 900; }
.pre-wrap { white-space: pre-wrap; }
.site-detail { height: 100%; border: 1px solid var(--crm-border); border-radius: 12px; padding: .85rem; background: #f8fafc; }
.site-detail span { display: block; color: var(--crm-muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.site-detail strong { display: block; margin-top: .25rem; overflow-wrap: anywhere; }
.site-image-card { height: 100%; overflow: hidden; border: 1px solid var(--crm-border); border-radius: 14px; background: #fff; }
.site-image-card img { display: block; width: 100%; height: 210px; object-fit: cover; background: #e2e8f0; }
.site-image-card.is-active { border-color: var(--crm-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.image-choice-panel { border-top: 1px solid var(--crm-border); scroll-margin-top: 90px; }
.image-choice-card { height: 100%; overflow: hidden; border: 1px solid var(--crm-border); border-radius: 12px; background: #fff; }
.image-choice-card img { display: block; width: 100%; height: 165px; object-fit: cover; background: #e2e8f0; }
.image-search-modal { border: 0; border-radius: 16px; overflow: hidden; }
.image-search-modal .modal-header, .image-search-modal .modal-footer { border-color: var(--crm-border); }
.image-search-toolbar { position: sticky; top: -1rem; z-index: 2; margin: -1rem -1rem 0; padding: 1rem; background: #fff; border-bottom: 1px solid var(--crm-border); }
.image-search-status.alert { margin-bottom: 0; padding: .75rem 1rem; }
.image-search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.manual-image-result { min-width: 0; overflow: hidden; border: 1px solid var(--crm-border); border-radius: 12px; background: #fff; }
.manual-image-result > img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e2e8f0; }
.manual-image-result-body { padding: .85rem; }
.manual-image-result-tags { min-height: 2.5rem; overflow: hidden; color: #172033; font-size: .9rem; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.manual-image-result-meta { margin-top: .45rem; overflow: hidden; color: var(--crm-muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 991.98px) {
  .crm-navbar .dropdown { margin: .75rem 0 .25rem; }
  .table-responsive { border-radius: 0 0 16px 16px; }
}
@media (max-width: 575.98px) {
  .image-search-grid { grid-template-columns: 1fr; }
  .image-search-modal .modal-footer { align-items: stretch; flex-direction: column; }
  .image-search-modal .modal-footer .btn { width: 100%; }
}

.lead-action-cards h2 { font-weight: 750; }
.lead-action-cards form { margin: 0; }
.lead-action-cards .badge { white-space: normal; text-align: right; }
.lead-select-column { width: 42px; }
.lead-assignment-check, #selectVisibleLeads { width: 1.1em; height: 1.1em; }
