/* HAVN Leads ↔ Pipeline — v2.2.2 (separate file so it cascades AFTER
   havn-mission-control.css, no specificity war with existing rules)
   ====================================================================== */
 * LEAD DETAIL DRAWER + LEAD INLINE CONTROLS — v2.2.1
 *
 * v2.2.0 selectors were unscoped and used CSS vars that don't exist in
 * this project (--mc-card / --mc-muted) so they fell through to dark
 * fallbacks on a light dashboard. This block uses the real project tokens
 * (--mc-surface, --mc-text-2, --mc-accent, --mc-accent-soft) and scopes
 * every selector with .havn-mc to win the specificity battle.
 * ====================================================================== */

/* ----- INLINE LEAD CONTROLS (Stage + Status dropdowns in Leads table) ----- */
.havn-mc .havn-mc-stage-select,
.havn-mc .havn-mc-status-select {
	appearance: none;
	-webkit-appearance: none;
	background-color: var(--mc-surface);
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23A1A1AA' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 10px 6px;
	color: var(--mc-text);
	border: 1px solid var(--mc-border);
	border-radius: 999px;
	padding: 6px 28px 6px 12px;
	font-size: 12.5px;
	font-weight: 500;
	font-family: inherit;
	min-width: 120px;
	cursor: pointer;
	line-height: 1.3;
	transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.havn-mc .havn-mc-stage-select:hover,
.havn-mc .havn-mc-status-select:hover {
	border-color: var(--mc-accent);
}
.havn-mc .havn-mc-stage-select:focus,
.havn-mc .havn-mc-status-select:focus {
	outline: none;
	border-color: var(--mc-accent);
	box-shadow: 0 0 0 3px var(--mc-accent-soft);
}

/* Stage-select gold accent — the most prominent control on the row */
.havn-mc .havn-mc-stage-select {
	background-color: var(--mc-accent-soft) !important !important;
	border-color: rgba(212,179,112,.32) !important !important;
	color: var(--mc-text) !important;
	font-weight: 600;
}

/* Status-select colour variants (background-tinted pills, like the prototype) */
.havn-mc .havn-mc-status-select.havn-mc-status-hot {
	background-color: rgba(232,131,111,.16) !important !important;
	color: #E8836F !important;
	border-color: rgba(232,131,111,.40) !important !important;
}
.havn-mc .havn-mc-status-select.havn-mc-status-new {
	background-color: rgba(138,180,248,.16) !important !important;
	color: #8AB4F8 !important;
	border-color: rgba(138,180,248,.40) !important !important;
}
.havn-mc .havn-mc-status-select.havn-mc-status-responded {
	background-color: rgba(111,207,151,.16) !important !important;
	color: #6FCF97 !important;
	border-color: rgba(111,207,151,.40) !important !important;
}
.havn-mc .havn-mc-status-select.havn-mc-status-cold {
	background-color: rgba(161,161,170,.16) !important !important;
	color: var(--mc-text-2) !important;
	border-color: rgba(161,161,170,.40) !important !important;
}

/* Light mode: shift the surface so pills don't disappear into the white table */
.havn-mc.is-light .havn-mc-stage-select {
	background-color: rgba(184,137,59,.10) !important !important;
	border-color: rgba(184,137,59,.35) !important !important;
	color: #5B3E0E !important;
}
.havn-mc.is-light .havn-mc-status-select.havn-mc-status-hot {
	background-color: #FDE8E2 !important !important; color: #B04429 !important; border-color: rgba(176,68,41,.32) !important !important;
}
.havn-mc.is-light .havn-mc-status-select.havn-mc-status-new {
	background-color: #E3EDFF !important !important; color: #2F55A8 !important; border-color: rgba(47,85,168,.32) !important !important;
}
.havn-mc.is-light .havn-mc-status-select.havn-mc-status-responded {
	background-color: #E0F6E8 !important !important; color: #1E7B40 !important; border-color: rgba(30,123,64,.32) !important !important;
}
.havn-mc.is-light .havn-mc-status-select.havn-mc-status-cold {
	background-color: #ECECEC !important !important; color: #52525B !important; border-color: rgba(82,82,91,.25) !important !important;
}

/* Hover/keyboard cue that Lead rows are clickable */
.havn-mc .havn-mc-leads-table tbody tr[data-mc-lead-key] { cursor: pointer; transition: background .15s; }
.havn-mc .havn-mc-leads-table tbody tr[data-mc-lead-key]:hover,
.havn-mc .havn-mc-leads-table tbody tr[data-mc-lead-key]:focus-visible {
	background: var(--mc-accent-soft);
	outline: none;
}

/* Pipeline deal cards should also pop on hover/focus now they're openers */
.havn-mc .havn-mc-deal-row[data-mc-lead-key] { cursor: pointer; }
.havn-mc .havn-mc-deal-row[data-mc-lead-key]:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--mc-accent);
	border-radius: var(--mc-radius, 14px);
}

/* ----- DRAWER ----- */
.havn-mc-drawer-scrim {
	position: fixed; inset: 0;
	background: rgba(8,8,12,.55);
	backdrop-filter: blur(2px);
	z-index: 9998;
	opacity: 0; pointer-events: none;
	transition: opacity .2s;
}
.havn-mc-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.havn-mc.is-light ~ .havn-mc-drawer-scrim,
body.havn-mc-light .havn-mc-drawer-scrim {
	background: rgba(15,15,20,.32);
}

.havn-mc-drawer {
	position: fixed; top: 0; right: 0; bottom: 0;
	width: min(560px, 100vw);
	z-index: 9999;
	transform: translateX(105%);
	transition: transform .25s cubic-bezier(.4,0,.2,1);
	display: flex; flex-direction: column;
	background: #14161B;
	color: #F4F4F5;
	border-left: 1px solid rgba(255,255,255,.07);
	box-shadow: -20px 0 60px rgba(0,0,0,.45);
	font-family: inherit;
}
.havn-mc-drawer.is-open { transform: translateX(0); }
body.havn-mc-light .havn-mc-drawer {
	background: #FFFFFF;
	color: #15171C;
	border-left: 1px solid rgba(15,23,42,.10);
	box-shadow: -20px 0 60px rgba(15,15,20,.12);
}

.havn-mc-drawer-head {
	padding: 22px 24px 14px;
	border-bottom: 1px solid rgba(255,255,255,.07);
}
body.havn-mc-light .havn-mc-drawer-head { border-bottom-color: rgba(15,23,42,.08); }

.havn-mc-drawer-head-top {
	display: flex; align-items: center; gap: 10px;
}
.havn-mc-drawer-head-top h2 {
	margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.3px;
}
.havn-mc-drawer-close { margin-left: auto; }

.havn-mc-drawer-meta {
	color: #A1A1AA;
	font-size: 13px;
	margin-top: 6px;
	line-height: 1.45;
}
body.havn-mc-light .havn-mc-drawer-meta { color: #5B6473; }

.havn-mc-drawer-pillrow {
	display: flex; align-items: center; gap: 8px;
	margin-top: 12px;
	flex-wrap: wrap;
}
.havn-mc-drawer-pillrow [data-mc-drawer-updated] { margin-left: auto; font-size: 11px; }

.havn-mc-drawer-tabs {
	display: flex; gap: 2px;
	padding: 12px 16px 0;
	border-bottom: 1px solid rgba(255,255,255,.07);
	overflow-x: auto;
}
body.havn-mc-light .havn-mc-drawer-tabs { border-bottom-color: rgba(15,23,42,.08); }
.havn-mc-drawer-tab {
	background: none; border: 0; cursor: pointer;
	padding: 10px 14px;
	color: #A1A1AA;
	font: inherit; font-size: 13px;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	border-radius: 8px 8px 0 0;
	white-space: nowrap;
	transition: color .15s, border-color .15s;
}
.havn-mc-drawer-tab:hover { color: #F4F4F5; }
body.havn-mc-light .havn-mc-drawer-tab { color: #5B6473; }
body.havn-mc-light .havn-mc-drawer-tab:hover { color: #15171C; }
.havn-mc-drawer-tab.is-active {
	color: #D4B370;
	border-bottom-color: #D4B370;
	font-weight: 600;
}
body.havn-mc-light .havn-mc-drawer-tab.is-active { color: #B8893B; border-bottom-color: #B8893B; }

.havn-mc-drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.havn-mc-drawer-loading,
.havn-mc-drawer-error {
	color: #A1A1AA; padding: 40px 8px; text-align: center; font-size: 14px;
}
.havn-mc-drawer-error { color: #E8836F; }

.havn-mc-drawer-foot {
	padding: 14px 20px;
	border-top: 1px solid rgba(255,255,255,.07);
	display: flex; gap: 10px; align-items: center;
	background: inherit;
}
body.havn-mc-light .havn-mc-drawer-foot { border-top-color: rgba(15,23,42,.08); }
.havn-mc-drawer-foot .havn-mc-btn-primary { margin-left: auto; }

/* Drawer fields */
.havn-mc-drawer-grid {
	display: grid; gap: 14px;
	grid-template-columns: 1fr 1fr;
}
.havn-mc-drawer-field {
	display: flex; flex-direction: column; gap: 4px;
}
.havn-mc-drawer-field.full { grid-column: 1 / -1; }
.havn-mc-drawer-field label {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 1.3px;
	color: #A1A1AA;
}
body.havn-mc-light .havn-mc-drawer-field label { color: #5B6473; }

.havn-mc-drawer-field input,
.havn-mc-drawer-field select,
.havn-mc-drawer-field textarea {
	background: rgba(255,255,255,.04);
	color: #F4F4F5;
	border: 1px solid rgba(255,255,255,.08);
	border-radius: 10px;
	padding: 9px 12px;
	font: inherit;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}
body.havn-mc-light .havn-mc-drawer-field input,
body.havn-mc-light .havn-mc-drawer-field select,
body.havn-mc-light .havn-mc-drawer-field textarea {
	background: #FBFBF9;
	color: #15171C;
	border-color: rgba(15,23,42,.10);
}
.havn-mc-drawer-field input:focus,
.havn-mc-drawer-field select:focus,
.havn-mc-drawer-field textarea:focus {
	border-color: #D4B370;
	box-shadow: 0 0 0 3px rgba(212,179,112,.18);
}
.havn-mc-drawer-field textarea { min-height: 110px; resize: vertical; }

.havn-mc-drawer-section-title {
	font-size: 11px; text-transform: uppercase;
	letter-spacing: 1.3px;
	color: #A1A1AA;
	margin: 18px 0 10px;
}
body.havn-mc-light .havn-mc-drawer-section-title { color: #5B6473; }

.havn-mc-drawer-progress {
	height: 8px; border-radius: 999px;
	background: rgba(255,255,255,.05);
	border: 1px solid rgba(255,255,255,.08);
	overflow: hidden;
	margin-top: 6px;
}
body.havn-mc-light .havn-mc-drawer-progress {
	background: #F1F1ED;
	border-color: rgba(15,23,42,.08);
}
.havn-mc-drawer-progress > span {
	display: block; height: 100%;
	background: linear-gradient(90deg, #6FCF97, #D4B370);
	transition: width .25s;
}

.havn-mc-drawer-photos {
	display: grid; gap: 8px;
	grid-template-columns: repeat(3, 1fr);
}
.havn-mc-drawer-photo {
	aspect-ratio: 1;
	border-radius: 12px;
	background: rgba(255,255,255,.03);
	border: 1px solid rgba(255,255,255,.08);
	display: grid; place-items: center;
	color: #A1A1AA;
	font-size: 11px; text-align: center;
	overflow: hidden;
}
body.havn-mc-light .havn-mc-drawer-photo {
	background: #FBFBF9;
	border-color: rgba(15,23,42,.08);
	color: #5B6473;
}
.havn-mc-drawer-photo img { width: 100%; height: 100%; object-fit: cover; }

.havn-mc-drawer-timeline {
	display: flex; flex-direction: column; gap: 14px;
}
.havn-mc-drawer-timeline-item {
	display: grid; grid-template-columns: 18px 1fr; gap: 12px;
	align-items: flex-start;
}
.havn-mc-drawer-timeline-dot {
	width: 10px; height: 10px; border-radius: 50%;
	background: #D4B370;
	margin-top: 6px; margin-left: 4px;
	box-shadow: 0 0 0 4px rgba(212,179,112,.18);
}
.havn-mc-drawer-timeline-item.event-call  .havn-mc-drawer-timeline-dot { background: #8AB4F8; box-shadow: 0 0 0 4px rgba(138,180,248,.18); }
.havn-mc-drawer-timeline-item.event-email .havn-mc-drawer-timeline-dot { background: #6FCF97; box-shadow: 0 0 0 4px rgba(111,207,151,.18); }
.havn-mc-drawer-timeline-item .body b { font-weight: 600; }
.havn-mc-drawer-timeline-item .ts {
	color: #A1A1AA; font-size: 12px; margin-top: 2px;
}
body.havn-mc-light .havn-mc-drawer-timeline-item .ts { color: #5B6473; }

.havn-mc-drawer-task {
	display: grid; grid-template-columns: 22px 1fr auto;
	gap: 10px; align-items: center;
	padding: 10px 12px;
	background: rgba(255,255,255,.03);
	border: 1px solid rgba(255,255,255,.08);
	border-radius: 12px;
	margin-bottom: 8px;
}
body.havn-mc-light .havn-mc-drawer-task {
	background: #FBFBF9;
	border-color: rgba(15,23,42,.08);
}
.havn-mc-drawer-task.is-done .label { color: #A1A1AA; text-decoration: line-through; }
.havn-mc-drawer-task input[type="checkbox"] { width: 18px; height: 18px; accent-color: #D4B370; }
.havn-mc-drawer-task .due { font-size: 12px; color: #A1A1AA; }

.havn-mc-drawer-add-task {
	display: flex; gap: 8px;
	margin-top: 8px;
}
.havn-mc-drawer-add-task input {
	flex: 1;
	background: rgba(255,255,255,.04);
	border: 1px solid rgba(255,255,255,.08);
	color: #F4F4F5;
	border-radius: 10px;
	padding: 9px 12px;
	font: inherit;
}
body.havn-mc-light .havn-mc-drawer-add-task input {
	background: #FBFBF9;
	color: #15171C;
	border-color: rgba(15,23,42,.10);
}

/* Toast */
.havn-mc-toast {
	position: fixed; bottom: 24px; left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: #14161B;
	color: #F4F4F5;
	border: 1px solid rgba(212,179,112,.45);
	padding: 11px 18px;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0,0,0,.5);
	opacity: 0; transition: all .2s;
	pointer-events: none;
	z-index: 10000;
	font-size: 13px;
}
body.havn-mc-light .havn-mc-toast {
	background: #FFFFFF;
	color: #15171C;
	border-color: rgba(184,137,59,.45);
	box-shadow: 0 8px 32px rgba(15,15,20,.12);
}
.havn-mc-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
	.havn-mc-drawer { width: 100vw; border-left: 0; }
	.havn-mc-drawer-grid { grid-template-columns: 1fr; }
}

/* HAVN typography — v2.2.5 */
.havn-mc-drawer-head-top h2,
.havn-mc-drawer-section-title {
	font-family: "Fraunces", "Times New Roman", serif;
	font-weight: 600;
	letter-spacing: -0.02em;
}

/* ============================================================
 * EXTERNAL LEADS (v2.2.15) — HAVN / External tabs + add modal
 * ============================================================ */
.havn-mc .havn-mc-leads-tabs {
	display: flex;
	gap: 4px;
	padding: 4px;
	margin-bottom: 14px;
	background: var(--mc-surface);
	border: 1px solid var(--mc-border);
	border-radius: 12px;
	width: fit-content;
}
.havn-mc .havn-mc-leads-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border: 0;
	background: transparent;
	color: var(--mc-text-2);
	font: inherit;
	font-weight: 600;
	font-size: 13px;
	border-radius: 9px;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.havn-mc .havn-mc-leads-tab svg { width: 16px; height: 16px; }
.havn-mc .havn-mc-leads-tab:hover { color: var(--mc-text); }
.havn-mc .havn-mc-leads-tab.is-active {
	background: var(--mc-accent-soft);
	color: var(--mc-accent);
}
.havn-mc .havn-mc-leads-tab-count {
	min-width: 20px;
	padding: 1px 7px;
	border-radius: 999px;
	background: rgba(127, 127, 127, .18);
	color: inherit;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
}
.havn-mc .havn-mc-leads-panel { display: none; }
.havn-mc .havn-mc-leads-panel.is-active { display: block; }

.havn-mc .havn-mc-chip-static {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	border: 1px solid var(--mc-border);
	background: var(--mc-surface);
	color: var(--mc-text-2);
	font-size: 11px;
	font-weight: 600;
	cursor: default;
}

/* ---- Add external lead modal ---- */
.havn-mc .havn-mc-ext-modal {
	position: fixed;
	inset: 0;
	z-index: 1200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.havn-mc .havn-mc-ext-modal[hidden] { display: none; }
.havn-mc .havn-mc-ext-modal-scrim {
	position: absolute;
	inset: 0;
	background: rgba(6, 8, 12, .74);
	backdrop-filter: blur(3px);
}
/* Opaque card — was var(--mc-surface) (rgba ~.03) which let the board show
   through. Solid in both themes so it reads as a real dialog. */
.havn-mc .havn-mc-ext-modal-card {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	overflow-y: auto;
	background: #14161d;
	border: 1px solid var(--mc-border-2);
	border-radius: 18px;
	padding: 22px 24px 20px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.havn-mc.is-light .havn-mc-ext-modal-card,
body.havn-mc-light .havn-mc-ext-modal-card {
	background: #ffffff;
	border-color: rgba(0, 0, 0, .12);
	box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}
.havn-mc.is-light .havn-mc-ext-modal-scrim,
body.havn-mc-light .havn-mc-ext-modal-scrim {
	background: rgba(20, 24, 32, .45);
}
.havn-mc.is-light .havn-mc-ext-field input,
.havn-mc.is-light .havn-mc-ext-field select,
.havn-mc.is-light .havn-mc-ext-field textarea,
body.havn-mc-light .havn-mc-ext-field input,
body.havn-mc-light .havn-mc-ext-field select,
body.havn-mc-light .havn-mc-ext-field textarea {
	background: #f6f6f8;
	border-color: rgba(0, 0, 0, .12);
	color: #1a1a1a;
}
.havn-mc .havn-mc-ext-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}
.havn-mc .havn-mc-ext-modal-head h3 {
	margin: 0;
	font-family: "Fraunces", "Times New Roman", serif;
	font-weight: 600;
	font-size: 21px;
	color: var(--mc-text);
}
.havn-mc .havn-mc-ext-modal-x {
	border: 0;
	background: transparent;
	color: var(--mc-text-2);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.havn-mc .havn-mc-ext-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin: 14px 0 18px;
}
.havn-mc .havn-mc-ext-span2 { grid-column: 1 / -1; }
.havn-mc .havn-mc-ext-field { display: flex; flex-direction: column; gap: 5px; }
.havn-mc .havn-mc-ext-field > span {
	font-size: 12px;
	font-weight: 600;
	color: var(--mc-text-2);
}
.havn-mc .havn-mc-ext-field em { color: var(--mc-accent); font-style: normal; }
.havn-mc .havn-mc-ext-field input,
.havn-mc .havn-mc-ext-field select,
.havn-mc .havn-mc-ext-field textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--mc-border);
	border-radius: 9px;
	background: rgba(127, 127, 127, .06);
	color: var(--mc-text);
	font: inherit;
	font-size: 14px;
	box-sizing: border-box;
}
.havn-mc .havn-mc-ext-field textarea { resize: vertical; }
.havn-mc .havn-mc-ext-field input:focus,
.havn-mc .havn-mc-ext-field select:focus,
.havn-mc .havn-mc-ext-field textarea:focus {
	outline: none;
	border-color: var(--mc-accent);
}
.havn-mc .havn-mc-ext-modal-foot {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}
@media (max-width: 560px) {
	.havn-mc .havn-mc-ext-grid { grid-template-columns: 1fr; }
	.havn-mc .havn-mc-ext-span2 { grid-column: auto; }
}

/* ---- Address autocomplete dropdown (v2.2.54) — shared by the external-lead
   modal and the lead-drawer Property tab. Photon/OSM, NZ-biased. ---- */
.havn-addr-ac {
	position: fixed; /* on <body>, positioned via JS from the input rect — escapes any overflow:auto ancestor */
	z-index: 1300;   /* above the modal (1200) and the lead drawer */
	background: #14161d;
	border: 1px solid var(--mc-border-2);
	border-radius: 10px;
	max-height: 260px;
	overflow-y: auto;
	box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.havn-addr-ac[hidden] { display: none; }
.havn-addr-ac-item {
	display: block; width: 100%; text-align: left;
	padding: 9px 12px; cursor: pointer;
	border: 0; border-bottom: 1px solid var(--mc-border);
	background: none; font: inherit; color: var(--mc-text);
}
.havn-addr-ac-item:last-child { border-bottom: 0; }
.havn-addr-ac-item:hover, .havn-addr-ac-item.is-hi { background: rgba(212, 179, 112, .14); }
.havn-addr-ac-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.havn-addr-ac-item small { display: block; font-size: 11.5px; color: var(--mc-text-3); }
.havn-mc.is-light .havn-addr-ac, body.havn-mc-light .havn-addr-ac { background: #fff; border-color: rgba(0, 0, 0, .12); }
.havn-mc.is-light .havn-addr-ac-item, body.havn-mc-light .havn-addr-ac-item { color: #1a1a1a; }
