/* ==========================================================================
   HAVN Appraisals — the appraisal register.  v2.2.196
   Inherits the Mission Control tokens (--mc-*); loaded after
   havn-mission-control.css.

   NOTE ON COLOUR: havn-dashboard.php prints a priority-99 block that paints
   div/span/p/li/strong/small #F4F4F5 !important in dark (#15171C in light).
   Any colour here that is not the body colour must be restated at
   `body .havn-mc .havn-apr-*` with !important, or it silently renders white.
   ========================================================================== */

/* ---- flags (the two things the register exists to surface) ---- */
.havn-apr-flags { display: grid; gap: 10px; margin-bottom: 18px; }

.havn-apr-flag {
	display: flex; align-items: flex-start; gap: 12px;
	padding: 14px 16px;
	background: var(--mc-bg-3);
	border: 1px solid var(--mc-border);
	border-left: 3px solid #E0857B;
	border-radius: var(--mc-radius);
}
.havn-apr-flag.is-compliance { border-left-color: #D4B370; }
.havn-apr-flag > svg { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; }
body .havn-mc .havn-apr-flag > svg { color: #E0857B !important; }
body .havn-mc .havn-apr-flag.is-compliance > svg { color: #D4B370 !important; }
.havn-apr-flag > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
body .havn-mc .havn-apr-flag strong { font-size: 14px; font-weight: 650; color: var(--mc-text) !important; }
body .havn-mc .havn-apr-flag span   { font-size: 12.5px; line-height: 1.5; color: var(--mc-text-3) !important; }
.havn-apr-flag button { flex: 0 0 auto; align-self: center; }

/* ---- conversion gauge with the reference bands ---- */

/* The gauge is short and the reason list beside it is not; without this the
   row stretches both to the taller one and the gauge card ends in a hand's
   width of empty card. */
.havn-apr-row { align-items: start; }

.havn-apr-gauge { display: flex; flex-direction: column; gap: 12px; }

.havn-apr-gauge-track {
	position: relative;
	height: 10px;
	border-radius: 999px;
	background: var(--mc-bg-3);
	border: 1px solid var(--mc-border);
	overflow: visible;
}
.havn-apr-gauge-fill {
	position: absolute; inset: 0 auto 0 0;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--mc-accent), #6FCF97);
	transition: width .6s cubic-bezier(.22,.61,.36,1);
}
.havn-apr-gauge-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
body .havn-mc .havn-apr-gauge-pct { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--mc-text) !important; }

.havn-apr-bm { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.havn-apr-bm li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
/* A dot, not a tick: these carry the outcome colours the pills in the table
   use, so they are a key rather than a scale mark. */
.havn-apr-bm i { width: 8px; height: 8px; background: var(--mc-text-3); border-radius: 50%; flex: 0 0 auto; }
body .havn-mc .havn-apr-bm span   { flex: 1 1 auto; color: var(--mc-text-3) !important; }
body .havn-mc .havn-apr-bm strong { color: var(--mc-text-2) !important; font-variant-numeric: tabular-nums; }
body .havn-mc .havn-apr-bm-note { font-size: 11.5px; line-height: 1.5; margin: 0; color: var(--mc-text-3) !important; }

/* ---- board + toolbar ---- */
.havn-apr-board { padding: 0; overflow: hidden; }
.havn-apr-board .havn-mc-leads-toolbar { flex-wrap: wrap; gap: 10px; }

.havn-mc-chip.is-warn { border-color: #E0857B; }
body .havn-mc .havn-mc-chip.is-warn { color: #E0857B !important; }

/* The count inside a filter chip. Written as `Lost <small>5</small>`, the
   whitespace between them collapses to nothing against the chip's line box, so
   it read as "Lost5". Give the number its own box rather than trusting a space
   to survive. */
[data-apr-filters] .havn-mc-chip { display: inline-flex; align-items: center; gap: 6px; }
[data-apr-filters] .havn-mc-chip small {
	display: inline-block;
	min-width: 18px;
	padding: 1px 5px;
	border-radius: 999px;
	background: var(--mc-bg);
	font-size: 10.5px; font-weight: 700;
	line-height: 1.45;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
body .havn-mc [data-apr-filters] .havn-mc-chip small { color: var(--mc-text-3) !important; }
body .havn-mc [data-apr-filters] .havn-mc-chip.is-active small { color: var(--mc-text) !important; background: rgba(0,0,0,.25); }
body .havn-mc [data-apr-filters] .havn-mc-chip.is-warn small { color: #E0857B !important; }

/* ---- per-row actions menu ---- */
.havn-apr-menu { position: relative; display: inline-block; margin-left: 4px; vertical-align: middle; }

.havn-apr-menu-btn {
	width: 28px; height: 28px;
	display: inline-grid; place-items: center;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 16px; line-height: 1;
	cursor: pointer;
}
body .havn-mc .havn-apr-menu-btn { color: var(--mc-text-3) !important; }
.havn-apr-menu-btn:hover { background: var(--mc-bg); border-color: var(--mc-border); }
body .havn-mc .havn-apr-menu-btn:hover { color: var(--mc-text) !important; }
.havn-apr-menu-btn[aria-expanded="true"] { background: var(--mc-bg); border-color: var(--mc-border-2); }

.havn-apr-menu-pop {
	position: absolute; right: 0; top: calc(100% + 5px);
	z-index: 40;
	min-width: 194px;
	padding: 5px;
	display: flex; flex-direction: column;
	background: var(--mc-surface);
	border: 1px solid var(--mc-border-2);
	border-radius: 12px;
	box-shadow: var(--mc-shadow);
	text-align: left;
}
.havn-apr-menu-pop[hidden] { display: none !important; }
/* The last rows would otherwise open a menu below the table's clipped edge. */
.havn-apr-menu.is-up .havn-apr-menu-pop { top: auto; bottom: calc(100% + 5px); }

.havn-apr-menu-pop button {
	display: flex; align-items: center; gap: 9px;
	width: 100%;
	padding: 8px 10px;
	background: transparent;
	border: 0; border-radius: 8px;
	font: inherit; font-size: 13px;
	text-align: left;
	cursor: pointer;
	white-space: nowrap;
}
body .havn-mc .havn-apr-menu-pop button { color: var(--mc-text-2) !important; }
.havn-apr-menu-pop button:hover { background: var(--mc-bg-3); }
body .havn-mc .havn-apr-menu-pop button:hover { color: var(--mc-text) !important; }
.havn-apr-menu-pop button svg { width: 15px; height: 15px; flex: 0 0 auto; }

.havn-apr-search {
	display: flex; align-items: center; gap: 7px;
	padding: 0 11px;
	height: 34px;
	background: var(--mc-bg-3);
	border: 1px solid var(--mc-border);
	border-radius: 999px;
	min-width: 220px;
}
.havn-apr-search svg { width: 15px; height: 15px; flex: 0 0 auto; }
body .havn-mc .havn-apr-search svg { color: var(--mc-text-3) !important; }
.havn-apr-search input {
	flex: 1 1 auto; min-width: 0;
	background: none; border: 0; outline: none;
	font-size: 13px; color: var(--mc-text);
}

/* ---- the register table ---- */
.havn-apr-tablewrap { overflow-x: auto; }

.havn-apr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.havn-apr-table th {
	text-align: left;
	padding: 10px 14px;
	font-size: 11px; font-weight: 600;
	text-transform: uppercase; letter-spacing: .06em;
	border-bottom: 1px solid var(--mc-border);
	white-space: nowrap;
}
body .havn-mc .havn-apr-table th { color: var(--mc-text-3) !important; }
.havn-apr-table th.is-num, .havn-apr-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.havn-apr-table th.is-act, .havn-apr-table td.is-act { text-align: right; white-space: nowrap; }

.havn-apr-table td { padding: 12px 14px; border-bottom: 1px solid var(--mc-border); vertical-align: top; }
.havn-apr-table tbody tr { transition: background .12s ease; }
.havn-apr-table tbody tr:hover { background: var(--mc-bg-3); }
.havn-apr-table tbody tr[hidden] { display: none; }

.havn-apr-when { white-space: nowrap; }
.havn-apr-when span { display: block; }
body .havn-mc .havn-apr-when span  { color: var(--mc-text-2) !important; }
body .havn-mc .havn-apr-when small { font-size: 11px; color: var(--mc-text-3) !important; }

.havn-apr-who { min-width: 220px; }
.havn-apr-who strong { display: block; font-weight: 600; }
.havn-apr-who small  { display: block; font-size: 11.5px; margin-top: 2px; }
body .havn-mc .havn-apr-who strong { color: var(--mc-text) !important; }
body .havn-mc .havn-apr-who small  { color: var(--mc-text-3) !important; }

.havn-apr-arch, .havn-apr-nowritten, .havn-apr-src {
	display: inline-block;
	margin-top: 5px; margin-right: 5px;
	padding: 1px 7px;
	font-size: 10.5px; font-style: normal; font-weight: 600;
	text-transform: uppercase; letter-spacing: .05em;
	border-radius: 4px;
	border: 1px solid var(--mc-border-2);
}
body .havn-mc .havn-apr-arch      { color: var(--mc-text-3) !important; }
/* Which intake the appraisal came from — HAVN's marketplace, or the agent's
   own prospecting. Both count; an agent just needs to tell them apart. */
body .havn-mc .havn-apr-src.is-havn { color: var(--mc-accent) !important; border-color: var(--mc-accent-soft); }
body .havn-mc .havn-apr-src.is-own  { color: var(--mc-text-3) !important; }
body .havn-mc .havn-apr-nowritten { color: #D4B370 !important; border-color: rgba(212,179,112,.4); }

body .havn-mc .havn-apr-var.is-over  { color: #6FCF97 !important; }
body .havn-mc .havn-apr-var.is-under { color: #E0857B !important; }

/* ---- outcome pill ---- */
.havn-apr-pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11.5px; font-weight: 600;
	white-space: nowrap;
	border: 1px solid transparent;
}
body .havn-mc .havn-apr-pill.is-won        { color: #6FCF97 !important; background: rgba(111,207,151,.12); border-color: rgba(111,207,151,.3); }
body .havn-mc .havn-apr-pill.is-lost       { color: #E0857B !important; background: rgba(224,133,123,.12); border-color: rgba(224,133,123,.3); }
body .havn-mc .havn-apr-pill.is-nurturing  { color: #D4B370 !important; background: rgba(212,179,112,.12); border-color: rgba(212,179,112,.3); }
body .havn-mc .havn-apr-pill.is-pending    { color: #8AB4F8 !important; background: rgba(138,180,248,.12); border-color: rgba(138,180,248,.3); }
body .havn-mc .havn-apr-pill.is-unresolved { color: #15171C !important; background: #E0857B; border-color: #E0857B; }
.havn-apr-reason { display: block; margin-top: 4px; font-size: 11px; }
body .havn-mc .havn-apr-reason { color: var(--mc-text-3) !important; }

/* ---- modals ---- */
.havn-apr-modal { position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; padding: 24px; }
.havn-apr-modal[hidden] { display: none; }
.havn-apr-modal-backdrop { position: absolute; inset: 0; background: rgba(6,8,12,.66); backdrop-filter: blur(2px); }

.havn-apr-modal-panel {
	position: relative;
	width: min(620px, 100%);
	max-height: min(86vh, 900px);
	overflow-y: auto;
	background: var(--mc-surface);
	border: 1px solid var(--mc-border-2);
	border-radius: var(--mc-radius-lg);
	box-shadow: var(--mc-shadow);
	padding: 22px 24px 24px;
}
.havn-apr-modal-panel.is-narrow { width: min(480px, 100%); }

.havn-apr-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
body .havn-mc .havn-apr-modal-head h3 { font-size: 18px; font-weight: 650; margin: 0; color: var(--mc-text) !important; }
.havn-apr-modal-x { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; line-height: 0; }
.havn-apr-modal-x svg { width: 18px; height: 18px; }
body .havn-mc .havn-apr-modal-x svg { color: var(--mc-text-3) !important; }
.havn-apr-modal-x:hover { background: var(--mc-bg-3); }
body .havn-mc .havn-apr-modal-sub { font-size: 13px; margin: 0 0 14px; color: var(--mc-text-3) !important; }

/* ---- form ---- */
.havn-apr-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.havn-apr-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.havn-apr-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 180px; min-width: 0; }
.havn-apr-field-grow { flex: 2 1 260px; }

/* `flex: 1 1 180px` is a WIDTH inside .havn-apr-field-row and a HEIGHT inside
   the form, which is a column — a field placed straight on the form otherwise
   asks for 180px of height and grows to fill what is left. */
.havn-apr-form > .havn-apr-field { flex: 0 0 auto; }

/* A class that sets `display` beats the user-agent's `[hidden] { display: none }`,
   so the conditional reason field would show whatever the JS set. */
.havn-apr-field[hidden],
.havn-apr-form [hidden] { display: none !important; }
body .havn-mc .havn-apr-field > span { font-size: 12px; font-weight: 600; color: var(--mc-text-2) !important; }
body .havn-mc .havn-apr-field em, body .havn-mc .havn-apr-hint { font-style: normal; font-size: 11px; font-weight: 500; color: var(--mc-text-3) !important; }
body .havn-mc .havn-apr-field > span em { color: #E0857B !important; }
body .havn-mc .havn-apr-field > span em.havn-apr-hint { color: var(--mc-text-3) !important; }

.havn-apr-field input,
.havn-apr-field select,
.havn-apr-field textarea {
	width: 100%;
	padding: 9px 11px;
	font-size: 13.5px;
	font-family: inherit;
	color: var(--mc-text);
	background: var(--mc-bg-3);
	border: 1px solid var(--mc-border);
	border-radius: 10px;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.havn-apr-field input:focus,
.havn-apr-field select:focus,
.havn-apr-field textarea:focus {
	border-color: var(--mc-accent);
	box-shadow: 0 0 0 3px var(--mc-accent-soft);
}
.havn-apr-field textarea { resize: vertical; line-height: 1.5; }

.havn-apr-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---- outcome choices ---- */
.havn-apr-choices { display: grid; gap: 9px; }
.havn-apr-choice { cursor: pointer; }
.havn-apr-choice input { position: absolute; opacity: 0; pointer-events: none; }
.havn-apr-choice-body {
	display: flex; flex-direction: column; gap: 2px;
	padding: 11px 14px;
	border: 1px solid var(--mc-border);
	border-radius: 12px;
	background: var(--mc-bg-3);
	transition: border-color .15s ease, background .15s ease;
}
.havn-apr-choice-body::before {
	content: ""; position: absolute; margin-left: -8px; margin-top: 2px;
	width: 3px; height: 26px; border-radius: 2px; background: var(--oc);
	opacity: 0; transition: opacity .15s ease;
}
.havn-apr-choice:hover .havn-apr-choice-body { border-color: var(--mc-border-2); }
.havn-apr-choice input:checked + .havn-apr-choice-body { border-color: var(--oc); background: var(--mc-bg-2); }
.havn-apr-choice input:checked + .havn-apr-choice-body::before { opacity: 1; }
.havn-apr-choice input:focus-visible + .havn-apr-choice-body { box-shadow: 0 0 0 3px var(--mc-accent-soft); }
body .havn-mc .havn-apr-choice-body strong { font-size: 13.5px; font-weight: 650; color: var(--mc-text) !important; }
body .havn-mc .havn-apr-choice-body small  { font-size: 11.5px; color: var(--mc-text-3) !important; }

/* ---- mobile: square, per the v2.2.148 rule (no rounding below 861px) ---- */
@media (max-width: 860px) {
	.havn-apr-flag,
	.havn-apr-modal-panel,
	.havn-apr-choice-body,
	.havn-apr-field input,
	.havn-apr-field select,
	.havn-apr-field textarea { border-radius: 0; }
	.havn-apr-modal { padding: 0; }
	.havn-apr-modal-panel { width: 100%; max-height: 100vh; height: 100%; border: 0; }
	.havn-apr-search { border-radius: 0; width: 100%; }
	.havn-apr-flag { flex-wrap: wrap; }
	.havn-apr-table th:nth-child(4), .havn-apr-table td:nth-child(4),
	.havn-apr-table th:nth-child(5), .havn-apr-table td:nth-child(5) { display: none; }
}

/* ==========================================================================
   CASCADE ARMOUR

   The dashboard renders inside the marketing site's stylesheet, and that
   cascade styles bare `input`, `select`, `textarea` and `button` with its own
   border, radius, padding and height — at a weight this file loses to, because
   the site's block is printed at wp_head priority 99, AFTER this one. Measured
   on havnestate.com: the search field came out 43px tall with a 2px radius
   inside a 34px pill, and the row menu button 92px wide instead of 28px.

   `body`-qualified so a body-level rule cannot outrank it. Same technique as
   the v2.2.79 owner-preview chrome.
   ========================================================================== */

body .havn-mc .havn-apr-search {
	height: 34px !important;
	padding: 0 11px !important;
	border-radius: 999px !important;
}
body .havn-mc .havn-apr-search input,
body .havn-mc .havn-apr-search input[type="search"],
body .havn-mc .havn-apr-search input[type="text"] {
	appearance: none; -webkit-appearance: none;
	width: 100% !important;
	height: 26px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	font-size: 13px !important;
	line-height: 26px !important;
	color: var(--mc-text) !important;
}
body .havn-mc .havn-apr-search input::-webkit-search-cancel-button { appearance: none; -webkit-appearance: none; }

/* The form controls in both dialogs, for the same reason. */
body .havn-mc .havn-apr-field input,
body .havn-mc .havn-apr-field select,
body .havn-mc .havn-apr-field textarea {
	appearance: none; -webkit-appearance: none;
	width: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 9px 11px !important;
	border: 1px solid var(--mc-border) !important;
	border-radius: 10px !important;
	background: var(--mc-bg-3) !important;
	box-shadow: none !important;
	font-family: inherit !important;
	font-size: 13.5px !important;
	color: var(--mc-text) !important;
}
body .havn-mc .havn-apr-field select { padding-right: 30px !important; }
body .havn-mc .havn-apr-field textarea { height: auto !important; line-height: 1.5 !important; }
body .havn-mc .havn-apr-field input:focus,
body .havn-mc .havn-apr-field select:focus,
body .havn-mc .havn-apr-field textarea:focus {
	border-color: var(--mc-accent) !important;
	box-shadow: 0 0 0 3px var(--mc-accent-soft) !important;
}

/* Round, like everything else on the screen — the site's button rule was
   giving these a 10px rectangle next to 999px filter chips. */
body .havn-mc [data-mc-view="appraisals"] .havn-mc-btn,
body .havn-mc .havn-apr-modal .havn-mc-btn {
	border-radius: 999px !important;
}

body .havn-mc .havn-apr-menu-btn {
	width: 28px !important;
	height: 28px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 0 0 4px !important;
	padding: 0 !important;
	border-radius: 8px !important;
	background: transparent !important;
	font-size: 16px !important;
	line-height: 1 !important;
}
body .havn-mc .havn-apr-menu-btn:hover,
body .havn-mc .havn-apr-menu-btn[aria-expanded="true"] {
	background: var(--mc-bg) !important;
	border-color: var(--mc-border) !important;
}
body .havn-mc .havn-apr-menu-pop button {
	width: 100% !important;
	min-width: 0 !important;
	margin: 0 !important;
	padding: 8px 10px !important;
	border: 0 !important;
	border-radius: 8px !important;
	background: transparent !important;
	font-size: 13px !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}
body .havn-mc .havn-apr-menu-pop button:hover { background: var(--mc-bg-3) !important; }
