/* LoanPool by Vantage LMS: the board, the lender's own rows and the form
 * (js-lms/loanpool_shared.js), and the public page around them (loanpool.html).
 * Built on the --vantage-* tokens in brand.css so it follows whichever theme the
 * page is on, in the staff application, the external workspace and the public
 * page alike. Semantic colour only: green for live, amber for lapsed, red for an
 * error; everything else is neutral. */

.lp {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 44px;
    max-width: 1080px;
    font-family: var(--vantage-font-body);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--vantage-text);
}
.lp-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lp-head {
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px;
}
.lp-h {
    margin: 0; font-family: var(--vantage-font-heading); font-size: 18px; font-weight: 600;
    line-height: 1.25; letter-spacing: -0.01em; color: var(--vantage-text);
}
.lp-h3 {
    margin: 0 0 14px; font-family: var(--vantage-font-heading); font-size: 15px; font-weight: 600;
    line-height: 1.3; letter-spacing: -0.005em;
}
.lp-asat { margin: 0; font-size: 12.5px; color: var(--vantage-text-2); font-variant-numeric: tabular-nums; }

/* Filters and form fields */
.lp-filters {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.lp-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.lp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lp-field[hidden] { display: none; }
.lp-field > label, .lp-label { font-size: 12px; color: var(--vantage-text-2); }
.lp-input {
    box-sizing: border-box; width: 100%; min-height: 40px; padding: 0 10px;
    background: var(--vantage-surface); color: var(--vantage-text);
    border: 1px solid var(--vantage-line); border-radius: 8px;
    font: inherit; font-size: 13.5px;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lp-input:hover { border-color: var(--vantage-text-3); }
.lp-input:focus-visible, .lp-btn:focus-visible { outline: 2px solid var(--vantage-accent); outline-offset: 2px; }
.lp-input[aria-invalid="true"] { border-color: var(--lms-danger-ink); }
.lp-unit { position: relative; }
.lp-unit .lp-input { padding-right: 78px; font-variant-numeric: tabular-nums; }
.lp-unit > span {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--vantage-text-2); pointer-events: none;
}
.lp-err { display: block; min-height: 0; font-size: 12px; color: var(--lms-danger-ink); }
.lp-err:empty { display: none; }
.lp-derived { display: flex; align-items: center; min-height: 40px; }

/* Buttons: one filled, one quiet. */
.lp-btn {
    min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px;
    background: var(--vantage-accent); color: var(--vantage-bg);
    font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1), background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lp-btn:hover { opacity: 0.88; }
.lp-btn-quiet { background: transparent; color: var(--vantage-text); }
.lp-btn-quiet:hover { opacity: 1; background: var(--vantage-fill-2); }
.lp-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lp-btn:disabled:hover { opacity: 0.45; }
.lp-btn-quiet:disabled:hover { background: transparent; }

/* The table. Dense data keeps its hairlines. */
.lp-table-wrap { overflow-x: auto; }
.lp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lp-table th {
    padding: 8px 14px 8px 0; text-align: left; font-size: 12px; font-weight: 500;
    color: var(--vantage-text-2); border-bottom: 1px solid var(--vantage-line);
    white-space: nowrap;
}
.lp-table td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--vantage-line-2); vertical-align: middle; }
.lp-table tbody tr { transition: background-color 120ms cubic-bezier(0.4, 0, 0.2, 1); }
.lp-table tbody tr:hover { background: var(--vantage-fill); }
.lp-num { text-align: right; padding-right: 18px !important; white-space: nowrap; }
.lp-table th.lp-num { text-align: right; }
.lp-rate { font-weight: 600; color: var(--vantage-text); }
.lp-actions { white-space: nowrap; text-align: right; }
.lp-tag {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px;
    background: var(--vantage-fill-2); color: var(--vantage-text); font-size: 12px; font-weight: 400;
    white-space: nowrap;
}
.lp-tag-reg { font-weight: 700; }
.lp-live { color: var(--lms-success-ink); font-weight: 500; }
.lp-lapsed { color: var(--lms-warning-ink); font-weight: 600; }

/* Who posted it, shown to a signed-in brokerage only. */
.lp-lender { min-width: 150px; }
.lp-lender-in { display: flex; align-items: center; gap: 10px; font-weight: 600; overflow-wrap: anywhere; }
.lp-logo {
    flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: contain;
    background: var(--vantage-surface); box-shadow: inset 0 0 0 1px var(--vantage-line-2);
}
.lp-monogram {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: var(--vantage-text-2);
}
.lp-seen { margin: 0 0 12px; color: var(--vantage-text-2); }

/* Empty, error and notice states. */
.lp-state {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 28px 0; border-top: 1px solid var(--vantage-line-2);
}
.lp-state strong { font-size: 14px; font-weight: 600; }
.lp-state span { color: var(--vantage-text-2); }
.lp-state-error { flex-direction: row; align-items: center; gap: 12px; color: var(--lms-danger-ink); }
.lp-state-error span { color: inherit; }
.lp-note { margin: 0 0 12px; color: var(--lms-warning-ink); font-weight: 500; }
.lp-msg { margin: 0 0 10px; color: var(--vantage-text-2); }
.lp-msg:empty { margin: 0; }
.lp-msg-error { color: var(--lms-danger-ink); }

/* The form sits under the lender's own rows. */
.lp-form { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--vantage-line-2); }
.lp-check { display: flex; align-items: center; gap: 8px; margin-top: 16px; min-height: 32px; cursor: pointer; }
.lp-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--vantage-accent); }
.lp-check input:focus-visible { outline: 2px solid var(--vantage-accent); outline-offset: 2px; }
@media (pointer: coarse) { .lp-check { min-height: 44px; } }
.lp-form-err { margin: 12px 0 0; }
.lp-form-actions { display: flex; gap: 8px; margin-top: 18px; }

/* Loading: skeleton rows. */
.lp-skel {
    height: 44px; margin-bottom: 8px; border-radius: 8px; background: var(--vantage-fill);
    animation: lp-pulse 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes lp-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .lp-skel { animation: none; }
    .lp-input, .lp-btn, .lp-table tbody tr { transition: none; }
}

/* A touch screen gets 44px targets. */
@media (pointer: coarse) {
    .lp-input, .lp-btn { min-height: 44px; }
}

/* A phone: each row becomes a small block of labelled pairs, so nothing scrolls sideways. */
@media (max-width: 640px) {
    .lp { gap: 36px; }
    .lp-table-wrap { overflow-x: visible; }
    .lp-table thead {
        position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
    }
    .lp-table, .lp-table tbody { display: block; }
    .lp-table tr {
        display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px;
        padding: 16px 0; border-bottom: 1px solid var(--vantage-line-2);
    }
    .lp-table td { display: block; padding: 0; border: 0; text-align: left !important; }
    .lp-table td::before {
        content: attr(data-label); display: block; margin-bottom: 2px;
        font-size: 11.5px; color: var(--vantage-text-2); font-weight: 400;
    }
    .lp-table td.lp-lender { grid-column: 1 / -1; }
    .lp-table td.lp-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
    .lp-table td.lp-actions::before { display: none; }
    .lp-state-error { flex-direction: column; align-items: flex-start; }
    /* "Sort by" has the longest option text, so it takes the full row. */
    .lp-filters .lp-field:last-child { grid-column: 1 / -1; }
}

/* ─── The public page (loanpool.html) ──────────────────────────────────────
 * Light only, in the look of the BrokerHub home page: Geist, a centred headline
 * over a peach wash and dot grid, orange streams gathering into a warm stage that
 * holds the board, and a dark footer. Its own tokens, scoped to .lpp, so the
 * staff screen and the workspace page (which share .lp-*) keep the look of the
 * application. Orange #f95a00 is decoration only; orange text is #b8420a. */
@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('/fonts-lms/ui/geist-latin.woff2') format('woff2');
}
.lpp {
    --lpp-ink: #111214;
    --lpp-orange: #f95a00;
    --lpp-orange-ink: #b8420a;
    --lpp-tint: #fff0e6;
    --lpp-warm: #fff4ec;
    --vantage-bg: #ffffff;
    --vantage-surface: #ffffff;
    --vantage-text: var(--lpp-ink);
    --vantage-text-2: #3f4147;
    --vantage-text-3: #5c5f66;
    --vantage-line: #cfcfcc;
    --vantage-line-2: #e8e8e6;
    --vantage-fill: var(--lpp-warm);
    --vantage-fill-2: var(--lpp-tint);
    --vantage-accent: var(--lpp-ink);
    --vantage-font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --vantage-font-heading: var(--vantage-font-body);
    min-height: 100vh; display: flex; flex-direction: column;
    background: #ffffff; color: var(--vantage-text);
    font-family: var(--vantage-font-body);
    -webkit-font-smoothing: antialiased;
}
html:has(.lpp) { background: #ffffff; color-scheme: light; }
.lpp ::selection { background: var(--lpp-orange); color: var(--lpp-ink); }
.lpp-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); box-sizing: border-box; }

.lpp-bar { position: relative; z-index: 1; padding: 14px 0; border-bottom: 1px solid var(--vantage-line-2); background: #ffffff; }
.lpp-mark { display: inline-flex; align-items: center; gap: 11px; min-height: 40px; text-decoration: none; color: inherit; }
.lpp-mark:focus-visible { outline: 2px solid var(--lpp-orange-ink); outline-offset: 4px; border-radius: 6px; }
.lpp-mark svg { width: 30px; height: 30px; flex: none; color: var(--lpp-orange); }
.lpp-word { display: flex; flex-direction: column; line-height: 1.1; }
.lpp-word b { font-size: 19px; font-weight: 600; letter-spacing: -0.03em; }
.lpp-word span { margin-top: 2px; font-size: 11.5px; color: var(--vantage-text-2); }

/* The hero: wash and dot grid behind, the streams below the words. */
.lpp-main { position: relative; isolation: isolate; flex: 1; padding-bottom: clamp(64px, 8vw, 104px); overflow-x: clip; }
.lpp-main::before {
    content: ""; position: absolute; inset: 0 0 auto; height: 640px; z-index: -1; pointer-events: none;
    background:
        radial-gradient(circle, rgba(17, 18, 20, 0.13) 1px, transparent 1.6px) 50% 0 / 24px 24px,
        linear-gradient(180deg, #fff3ea 0%, rgba(255, 243, 234, 0) 70%);
    -webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 0%, #000 25%, transparent 78%);
    mask-image: radial-gradient(ellipse 75% 85% at 50% 0%, #000 25%, transparent 78%);
}
.lpp-intro { position: relative; padding: clamp(48px, 7vw, 92px) 0 clamp(32px, 5vw, 56px); text-align: center; }
.lpp-title {
    margin: 0 auto 18px; max-width: 22ch;
    font-family: var(--vantage-font-heading); font-size: clamp(40px, 5vw, 64px);
    font-weight: 500; line-height: 1.1; letter-spacing: -0.035em; color: var(--lpp-ink); text-wrap: balance;
}
/* Large text only: darker than the decorative orange, to clear 3:1 on the wash. */
.lpp-title em { font-style: normal; color: #ea5400; }
.lpp-sub { margin: 0 auto; max-width: 54ch; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; color: var(--vantage-text-2); text-wrap: pretty; }
@media (min-width: 900px) {
    .lpp-intro { padding-bottom: 170px; }
    .lpp-intro::after {
        content: ""; position: absolute; left: 50%; bottom: 0; z-index: -1; pointer-events: none;
        width: 100vw; height: clamp(200px, 20.84vw, 520px); transform: translateX(-50%);
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 300'%3E%3Cg fill='none' stroke='%23f95a00' stroke-opacity='.2' stroke-width='1.1'%3E%3Cpath d='M-20 20C173 20 230 250 432 250H720'/%3E%3Cpath d='M1460 20C1267 20 1210 250 1008 250H720'/%3E%3Cpath d='M-20 54C173 54 230 250 432 250H720'/%3E%3Cpath d='M1460 54C1267 54 1210 250 1008 250H720'/%3E%3Cpath d='M-20 88C173 88 230 250 432 250H720'/%3E%3Cpath d='M1460 88C1267 88 1210 250 1008 250H720'/%3E%3Cpath d='M-20 122C173 122 230 250 432 250H720'/%3E%3Cpath d='M1460 122C1267 122 1210 250 1008 250H720'/%3E%3Cpath d='M-20 156C173 156 230 250 432 250H720'/%3E%3Cpath d='M1460 156C1267 156 1210 250 1008 250H720'/%3E%3Cpath d='M-20 190C173 190 230 250 432 250H720'/%3E%3Cpath d='M1460 190C1267 190 1210 250 1008 250H720'/%3E%3C/g%3E%3Cpath d='M720 250V300' stroke='%23f95a00' stroke-opacity='.55' stroke-width='1.6'/%3E%3Ccircle fill='%23f95a00' cx='720' cy='250' r='4.5'/%3E%3Cg fill='%23f95a00'%3E%3Ccircle cx='342' cy='250' r='3'/%3E%3Ccircle cx='558' cy='250' r='2.5'/%3E%3Ccircle cx='574' cy='250' r='2.5'/%3E%3Ccircle cx='856' cy='250' r='3'/%3E%3Ccircle cx='214' cy='220' r='2.5'/%3E%3Ccircle cx='1226' cy='220' r='2.5'/%3E%3Ccircle cx='720' cy='284' r='2.5'/%3E%3C/g%3E%3C/svg%3E") 50% 100% / 100% 100% no-repeat;
        /* The upper strands stay clear of the words. */
        -webkit-mask-image: radial-gradient(ellipse 34% 60% at 50% 20%, transparent 70%, #000 100%);
        mask-image: radial-gradient(ellipse 34% 60% at 50% 20%, transparent 70%, #000 100%);
    }
}

/* Dots travel the streams, unless the visitor asks for less motion. */
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
    .lpp-intro::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 300'%3E%3Cstyle%3E.r%7Bfill:none%3Bstroke:%23f95a00%3Bstroke-opacity:.85%3Bstroke-width:5.5%3Bstroke-linecap:round%3Bstroke-dasharray:.01 200%3Banimation:run linear infinite%7D%40keyframes run%7Bfrom%7Bstroke-dashoffset:0%7Dto%7Bstroke-dashoffset:-100%7D%7D%3C/style%3E%3Cg fill='none' stroke='%23f95a00' stroke-opacity='.2' stroke-width='1.1'%3E%3Cpath d='M-20 20C173 20 230 250 432 250H720'/%3E%3Cpath d='M1460 20C1267 20 1210 250 1008 250H720'/%3E%3Cpath d='M-20 54C173 54 230 250 432 250H720'/%3E%3Cpath d='M1460 54C1267 54 1210 250 1008 250H720'/%3E%3Cpath d='M-20 88C173 88 230 250 432 250H720'/%3E%3Cpath d='M1460 88C1267 88 1210 250 1008 250H720'/%3E%3Cpath d='M-20 122C173 122 230 250 432 250H720'/%3E%3Cpath d='M1460 122C1267 122 1210 250 1008 250H720'/%3E%3Cpath d='M-20 156C173 156 230 250 432 250H720'/%3E%3Cpath d='M1460 156C1267 156 1210 250 1008 250H720'/%3E%3Cpath d='M-20 190C173 190 230 250 432 250H720'/%3E%3Cpath d='M1460 190C1267 190 1210 250 1008 250H720'/%3E%3C/g%3E%3Cpath d='M720 250V300' stroke='%23f95a00' stroke-opacity='.55' stroke-width='1.6'/%3E%3Ccircle fill='%23f95a00' cx='720' cy='250' r='4.5'/%3E%3Cpath class='r' pathLength='100' d='M-20 20C173 20 230 250 432 250H720' style='animation-duration:17s%3Banimation-delay:-2s'/%3E%3Cpath class='r' pathLength='100' d='M1460 20C1267 20 1210 250 1008 250H720' style='animation-duration:19s%3Banimation-delay:-11s'/%3E%3Cpath class='r' pathLength='100' d='M-20 54C173 54 230 250 432 250H720' style='animation-duration:16s%3Banimation-delay:-7s'/%3E%3Cpath class='r' pathLength='100' d='M1460 54C1267 54 1210 250 1008 250H720' style='animation-duration:21s%3Banimation-delay:-15s'/%3E%3Cpath class='r' pathLength='100' d='M-20 88C173 88 230 250 432 250H720' style='animation-duration:18s%3Banimation-delay:-13s'/%3E%3Cpath class='r' pathLength='100' d='M1460 88C1267 88 1210 250 1008 250H720' style='animation-duration:15s%3Banimation-delay:-4s'/%3E%3Cpath class='r' pathLength='100' d='M-20 122C173 122 230 250 432 250H720' style='animation-duration:20s%3Banimation-delay:-9s'/%3E%3Cpath class='r' pathLength='100' d='M1460 122C1267 122 1210 250 1008 250H720' style='animation-duration:16s%3Banimation-delay:-1s'/%3E%3Cpath class='r' pathLength='100' d='M-20 156C173 156 230 250 432 250H720' style='animation-duration:22s%3Banimation-delay:-18s'/%3E%3Cpath class='r' pathLength='100' d='M1460 156C1267 156 1210 250 1008 250H720' style='animation-duration:17s%3Banimation-delay:-6s'/%3E%3Cpath class='r' pathLength='100' d='M-20 190C173 190 230 250 432 250H720' style='animation-duration:19s%3Banimation-delay:-16s'/%3E%3Cpath class='r' pathLength='100' d='M1460 190C1267 190 1210 250 1008 250H720' style='animation-duration:18s%3Banimation-delay:-10s'/%3E%3Cpath class='r' pathLength='100' d='M720 250V300' style='animation-duration:3s'/%3E%3C/svg%3E"); }
}

/* The board on its warm stage. */
.lpp .lp { max-width: none; margin-top: 0; gap: 0; font-size: 14.5px; }
.lpp .lp-section {
    padding: clamp(16px, 4vw, 48px); border-radius: 16px;
    background: linear-gradient(180deg, #ffe3d1, var(--lpp-warm) 420px);
}
.lpp .lp-head { margin-bottom: 20px; }
.lpp .lp-h { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; }
.lpp .lp-asat { font-size: 13.5px; color: var(--vantage-text-2); }
.lpp .lp-filters { gap: 12px; margin-bottom: 0; }
.lpp .lp-field > label { font-size: 13px; font-weight: 600; color: var(--lpp-ink); }
.lpp .lp-input {
    min-height: 46px; padding: 0 5px; border: 1px solid var(--vantage-line); border-radius: 8px;
    background: #ffffff; font-size: 14px;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lpp .lp-input:hover { border-color: var(--lpp-ink); }
.lpp .lp-input:focus-visible {
    outline: 2px solid var(--lpp-orange-ink); outline-offset: 2px;
    border-color: var(--lpp-ink); box-shadow: 0 0 0 3px rgba(249, 90, 0, 0.3);
}
.lpp .lp-btn { border-radius: 8px; font-weight: 600; }
.lpp .lp-btn:focus-visible { outline: 2px solid var(--lpp-orange-ink); outline-offset: 2px; }
.lp-filtered { margin: 6px 0 0; min-height: 0; }
.lp-filtered[hidden] { display: none; }
.lp-filtered .lp-btn { padding-left: 0; padding-right: 8px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }
.lpp .lp-filtered .lp-btn { text-decoration-color: var(--lpp-orange); text-decoration-thickness: 1.5px; }
.lpp .lp-filtered .lp-btn:hover { background: transparent; color: #9c3708; }

/* The results sit on a white card, whatever state they are in. */
.lpp #lp-board {
    margin-top: 20px; padding: 6px clamp(16px, 2.4vw, 28px); border-radius: 12px; background: #ffffff;
    box-shadow: 0 20px 40px -24px rgba(17, 18, 20, 0.3);
}
.lpp #lp-board[aria-busy="true"] { padding-top: 16px; padding-bottom: 8px; }
.lpp .lp-skel { background: var(--lpp-tint); }
.lpp .lp-table th { padding: 16px 20px 14px 0; border-bottom: 1px solid var(--vantage-line-2); font-size: 13px; color: var(--vantage-text-3); }
.lpp .lp-table td { padding: 22px 20px 22px 0; border-bottom: 1px solid var(--vantage-line-2); }
.lpp .lp-table tbody tr:last-child td { border-bottom: 0; }
.lpp .lp-table tbody tr:hover { background: var(--lpp-warm); }
.lpp .lp-num { padding-right: 18px !important; }
.lpp .lp-table th:last-child, .lpp .lp-table td:last-child { padding-right: 8px !important; }
.lpp .lp-table th:first-child, .lpp .lp-table td:first-child { padding-left: 8px; }
.lpp .lp-rate { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--lpp-orange-ink); }
.lpp .lp-tag { padding: 3px 11px; border-radius: 999px; background: var(--lpp-tint); color: var(--lpp-orange-ink); font-size: 12.5px; font-weight: 600; }
.lpp .lp-tag-reg { background: var(--lpp-ink); color: #ffffff; }
.lpp .lp-state { padding: 48px 8px; border-top: 0; align-items: flex-start; }
.lpp .lp-state strong { font-size: 18px; letter-spacing: -0.01em; }
.lpp .lp-state span { font-size: 15px; }
.lpp .lp-state-error { align-items: center; }
.lpp .lp-state .lp-btn { border: 1px solid var(--vantage-line); margin-top: 8px; }
.lpp .lp-state-error .lp-btn { margin-top: 0; }
.lpp .lp-state .lp-btn:hover { border-color: var(--lpp-ink); background: #ffffff; }

.lpp-foot { padding: clamp(40px, 5vw, 64px) 0 40px; background: var(--lpp-ink); font-size: 12.5px; line-height: 1.65; color: #a9acb3; }
.lpp-foot p { max-width: 86ch; margin: 0 0 10px; }
.lpp-foot p:last-child { margin: 24px 0 0; padding-top: 20px; max-width: none; border-top: 1px solid rgba(255, 255, 255, 0.12); color: #ffffff; }

@media (prefers-reduced-motion: reduce) { .lpp .lp-input { transition: none; } }

/* A tablet: seven columns have to fit without clipping the rate. */
@media (min-width: 641px) and (max-width: 899px) {
    .lpp .lp-section { padding: 16px; }
    .lpp .lp-filters { grid-template-columns: repeat(3, 1fr); }
    .lpp #lp-board { padding: 6px 8px; }
    .lpp .lp-table { font-size: 13px; }
    .lpp .lp-table th { padding-right: 8px; white-space: normal; vertical-align: bottom; }
    .lpp .lp-table td { padding-right: 8px; }
    .lpp .lp-table th.lp-num, .lpp .lp-table td.lp-num { padding-right: 8px !important; }
    .lpp .lp-tag { padding: 3px 8px; font-size: 12px; }
    .lpp .lp-rate { font-size: 17px; }
}

@media (max-width: 640px) {
    /* The stacked cells carry no rules of their own (the desktop rows' rules would otherwise win). */
    .lpp .lp-table td, .lpp .lp-table tbody tr:last-child td { padding: 0; border-bottom: 0; }
    .lpp .lp-table td:first-child, .lpp .lp-table td:last-child { padding: 0 !important; }
    .lpp .lp-table tr { padding: 20px 0; gap: 14px 18px; }
    .lpp .lp-table tbody tr:last-child { border-bottom: 0; }
    .lpp .lp-table tbody tr:hover { background: transparent; }
    .lpp .lp-rate { font-size: 22px; }
    .lpp .lp-state { padding: 32px 0; }
    .lpp .lp-state-error { align-items: flex-start; }
    /* Half a phone's width cuts off "Not owner occupied": from Charge down, a filter has its own row. */
    .lpp .lp-filters .lp-field:nth-child(n+3) { grid-column: 1 / -1; }
}

/* ─── Contact a Broker and Contact Lender (public page only) ──────────────── */
.lp-head:has(.lp-contact-broker) { justify-content: flex-start; align-items: center; }
.lp-contact-broker { margin-left: auto; }
.lp-btn-line {
    min-height: 38px; padding: 0 14px; background: transparent; color: var(--vantage-text);
    box-shadow: inset 0 0 0 1px var(--vantage-text); white-space: nowrap;
}
.lp-btn-line:hover { opacity: 1; background: var(--vantage-text); color: var(--vantage-bg); }
.lpp .lp-table td.lp-contact { padding-left: 4px; }
@media (min-width: 641px) and (max-width: 899px) {
    .lpp .lp-btn-line { padding: 4px 10px; white-space: normal; line-height: 1.2; }
}
@media (max-width: 640px) {
    .lp-contact-broker { margin-left: 0; width: 100%; }
    .lpp .lp-table td.lp-contact { padding-left: 0; }
    .lp-btn-line { width: 100%; }
}

/* The enquiry form: a modal dialog in the page's look. */
.lpe {
    width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
    border: 0; border-radius: 14px; background: #ffffff; color: var(--vantage-text);
    box-shadow: 0 30px 60px -20px rgba(17, 18, 20, 0.45);
    font-family: var(--vantage-font-body); font-size: 14.5px; line-height: 1.5;
    opacity: 0; transform: translateY(8px);
    transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1), transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lpe.lpe-open { opacity: 1; transform: none; }
.lpe::backdrop { background: rgba(17, 18, 20, 0.45); }
.lpe-in { padding: clamp(20px, 4vw, 32px); }
.lpe-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.lpe-h { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; }
.lpe-x {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin: -6px -8px 0 0; border: 0; border-radius: 8px;
    background: transparent; color: var(--vantage-text); cursor: pointer;
}
.lpe-x:hover { background: var(--lpp-tint); }
.lpe-x:focus-visible, .lpe-type input:focus-visible + span { outline: 2px solid var(--lpp-orange-ink); outline-offset: 2px; }
.lpe-x:disabled { opacity: 0.45; cursor: not-allowed; }
.lpe-rate { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--lpp-warm); color: var(--vantage-text-2); font-variant-numeric: tabular-nums; }
.lpe-rule {
    margin: 22px 0 10px; padding: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--vantage-text-3);
}
.lpe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.lpe-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lpe-wide { margin-top: 14px; }
.lpe-field > label { font-size: 13px; font-weight: 600; color: var(--vantage-text); }
.lpe-opt { margin-left: 6px; font-weight: 400; color: var(--vantage-text-3); }
.lpe .lp-input { min-height: 46px; padding: 0 12px; border-radius: 8px; font-size: 15px; }
.lpe .lp-input:hover { border-color: var(--lpp-ink); }
.lpe .lp-input:focus-visible { outline: 2px solid var(--lpp-orange-ink); outline-offset: 2px; border-color: var(--lpp-ink); }
.lpe .lp-input::placeholder { color: #7a7d84; }
.lpe-textarea { padding: 10px 12px !important; min-height: 84px !important; resize: vertical; line-height: 1.45; }
.lpe-inactive { visibility: hidden; }
.lpe-types { margin: 0; padding: 0; border: 0; min-width: 0; }
.lpe-types legend { float: left; width: 100%; }
.lpe-type-row { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.lpe-type { position: relative; display: inline-flex; cursor: pointer; }
.lpe-type input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lpe-type span {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
    box-shadow: inset 0 0 0 1px var(--vantage-line); font-size: 14px; color: var(--vantage-text);
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lpe-type:hover span { box-shadow: inset 0 0 0 1px var(--lpp-ink); }
.lpe-type input:checked + span { background: var(--lpp-ink); color: #ffffff; box-shadow: none; font-weight: 600; }
.lpe-error { margin: 16px 0 0; color: var(--lms-danger-ink); font-weight: 500; }
.lpe-error:empty { display: none; }
.lpe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.lpe-actions .lp-btn { min-height: 46px; padding: 0 20px; }
.lpe-foot { margin: 16px 0 0; font-size: 12.5px; color: var(--vantage-text-3); }
.lpe-state[data-state="done"], #lpe-form[data-state="done"] .lpe-state[data-state="idle"] { display: none; }
#lpe-form[data-state="done"] .lpe-done { display: block; }
.lpe-done { padding-top: 12px; outline: none; }
.lpe-done-h { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.lpe-done p { margin: 0 0 6px; color: var(--vantage-text-2); }
.lpe-ref strong { color: var(--vantage-text); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
#lpe-form[aria-busy="true"] .lp-input { opacity: 0.7; }
/* Sending is busy, not disabled: the label stays readable. */
#lpe-form[aria-busy="true"] #lpe-send { opacity: 1; cursor: progress; }
.lpe .lp-input[aria-invalid="true"], .lpe .lp-input[aria-invalid="true"]:hover { border-color: var(--lms-danger-ink); box-shadow: inset 0 0 0 1px var(--lms-danger-ink); }
@media (pointer: coarse) { .lpe-type span, .lpe .lp-input { min-height: 46px; } }
@media (max-width: 520px) {
    .lpe-grid { grid-template-columns: 1fr; }
    .lpe-actions .lp-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .lpe { transform: none; transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1); }
    .lpe-type span { transition: none; }
}
