/* Lendly Capital UI — tokens from brand/STYLE_GUIDE.md. Fonts are self-hosted (no third-party requests). */
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/playfair-display-500.6731c1146478.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/playfair-display-italic-400.58b0a103adf8.woff2") format("woff2"); }
:root { color-scheme: light;
  --lendly-navy: #0B1F3A; --lendly-gold: #B8935F; --lendly-gold-dark: #8F7550; --lendly-ink: #1C2430;
  --lendly-cream: #FBF9F3; --lendly-border: #E7E1D5; --lendly-surface: #FFFDF9;
  --ok: #2E7D4F; --warn: #B7791F; --danger: #B3261E; --muted: #6B6F76;
  --serif: "Playfair Display", "Georgia", "Times New Roman", serif;
  --sans: Helvetica, Arial, "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--lendly-cream); color: var(--lendly-ink); font: 14px/1.45 var(--sans); }
a { color: var(--lendly-gold-dark); }
a:hover { color: var(--lendly-gold); }
h1, h2, h3 { font-family: var(--serif); color: var(--lendly-navy); font-weight: 500; margin: 0 0 .5rem; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.wordmark { font-family: var(--serif); font-size: 22px; color: var(--lendly-navy); text-decoration: none; letter-spacing: .01em; }
.wordmark em { color: var(--lendly-gold); font-style: italic; }
.tagline { color: var(--lendly-gold); font-style: italic; font-size: 11px; margin-left: .5rem; }
header.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px 12px; border-bottom: .5pt solid var(--lendly-gold); }
header.top nav a { margin-left: 18px; color: var(--lendly-ink); text-decoration: none; }
header.top nav a.active, header.top nav a:hover { color: var(--lendly-gold-dark); border-bottom: 2px solid var(--lendly-gold); }
main { max-width: 1180px; margin: 0 auto; padding: 24px 32px 48px; }
footer.bottom { border-top: .5pt solid var(--lendly-gold); margin-top: 32px; padding: 12px 32px; font-size: 9pt; color: var(--lendly-gold-dark); display: flex; justify-content: space-between; }
.card { background: var(--lendly-surface); border: 1px solid var(--lendly-border); border-radius: 4px; padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 18px; } .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.grid-3 > .span-2 { grid-column: span 2; } @media (max-width: 900px) { .grid-3 > .span-2 { grid-column: auto; } } /* Addendum 212 */
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--lendly-border); vertical-align: top; }
th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 3px; border: 1px solid var(--lendly-navy); background: var(--lendly-navy); color: var(--lendly-cream); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #142c52; color: var(--lendly-cream); }
.btn.secondary { background: transparent; color: var(--lendly-gold-dark); border-color: var(--lendly-gold); }
.btn.secondary:hover { background: #f6efe2; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; padding: 7px 9px; border: 1px solid var(--lendly-border); border-radius: 3px; background: #fff; font: inherit; color: var(--lendly-ink); }
.input:focus { outline: 2px solid var(--lendly-gold); outline-offset: 1px; border-color: var(--lendly-gold); }
/* Addendum 151 D: an opaque select everywhere -- explicit background-color (not only the shorthand), a fully encoded
   chevron, and a light colour scheme so a dark-mode Safari/Chrome never paints the control or its list transparent */
select, select.input { -webkit-appearance: none; appearance: none; color-scheme: light; background-color: var(--lendly-cream); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23B8935F' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; color: var(--lendly-navy); border: 1px solid var(--lendly-border); border-radius: 3px; font: inherit; padding-top: 7px; padding-bottom: 7px; padding-left: 9px; }
select option { background-color: #fff; color: var(--lendly-ink); }
select:disabled { opacity: .55; }
select[multiple] { background-image: none; padding-right: 9px; }
select:hover { border-color: var(--lendly-gold-dark); } select:focus { outline: 2px solid var(--lendly-gold); outline-offset: 1px; border-color: var(--lendly-gold); } select option { background: #fff; color: var(--lendly-ink); }
input[type="checkbox"] { accent-color: var(--lendly-navy); }
.field { margin-bottom: 12px; } .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field .help { font-size: 11px; color: var(--muted); } .field .errors { color: var(--danger); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 18px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.pill-ok { background: #e3f1e8; color: var(--ok); } .pill-warn { background: #fbefd9; color: var(--warn); }
.pill-danger { background: #f9e0de; color: var(--danger); } .pill-done { background: #e7ecf3; color: var(--lendly-navy); }
.pill-muted { background: #eeeae2; color: var(--muted); } .pill-status { background: #eef1f5; color: var(--lendly-navy); }
.messages { list-style: none; padding: 0; margin: 0 0 16px; } .messages li { padding: 10px 14px; border-radius: 3px; margin-bottom: 6px; border: 1px solid var(--lendly-border); background: #fff; }
.messages .success { border-color: var(--ok); } .messages .error { border-color: var(--danger); } .messages .warning { border-color: var(--warn); }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding: 0; list-style: none; }
.steps li a { display: block; padding: 6px 10px; border: 1px solid var(--lendly-border); border-radius: 3px; text-decoration: none; color: var(--lendly-ink); font-size: 12px; background: #fff; }
.steps li a.active { border-color: var(--lendly-gold); color: var(--lendly-gold-dark); font-weight: 600; }
.steps li a.internal { border-style: dashed; }
.saved { font-size: 12px; color: var(--ok); } .muted { color: var(--muted); } .small { font-size: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 18px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; } .kv dt { color: var(--muted); font-size: 12px; } .kv dd { margin: 0; }
.block { border-left: 3px solid var(--danger); padding: 8px 12px; background: #fff7f6; margin-bottom: 8px; }
.review-item { border-left: 3px solid var(--lendly-gold); padding: 8px 12px; background: #fffaf1; margin-bottom: 8px; }
.flag-warning { border-left-color: var(--warn); } .flag-error, .flag-blocker { border-left-color: var(--danger); } .flag-info { border-left-color: var(--lendly-navy); }
.rule { padding: 3px 6px; border-radius: 3px; background: #eef1f5; font-size: 11px; }
details summary { cursor: pointer; color: var(--lendly-gold-dark); }
pre { background: #fff; border: 1px solid var(--lendly-border); padding: 10px; overflow: auto; max-height: 420px; font-size: 11px; }
.letterhead { background: #fff; border: 1px solid var(--lendly-border); padding: 48px 56px; max-width: 720px; }
.letterhead .rule { background: none; border-top: .5pt solid var(--lendly-gold); padding: 0; margin: 14px 0 24px; }
.letterhead .foot { display: flex; justify-content: space-between; font-size: 9pt; color: var(--lendly-gold-dark); border-top: .5pt solid var(--lendly-gold); padding-top: 8px; margin-top: 120px; }
.login { max-width: 380px; margin: 60px auto; }
.hx-indicator { display: none; } .htmx-request .hx-indicator { display: inline; }

/* Custom dropdown (web/static/web/select.js): native select hidden, branded button + list */
.ls { position: relative; display: inline-block; width: 100%; }
.ls.ls-sized { width: auto; } .ls.ls-sized .ls-btn { width: auto; min-width: 160px; }
.ls .ls-native { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ls-btn { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #E7E1D5; border-radius: 3px; background: #FBF9F3; color: #0B1F3A; font: inherit; cursor: pointer; }
.ls-btn:hover { border-color: #8F7550; } .ls-btn:focus { outline: 2px solid #B8935F; outline-offset: 1px; border-color: #B8935F; }
.ls-btn:disabled { opacity: .55; cursor: not-allowed; }
.ls-chev { width: 8px; height: 8px; border-right: 1.6px solid #B8935F; border-bottom: 1.6px solid #B8935F; transform: rotate(45deg); margin: 0 4px 3px 0; flex: none; }
.ls-open .ls-chev { transform: rotate(-135deg); margin: 3px 4px 0 0; }
.ls-menu { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none; background: #FFFDF9; border: 1px solid #B8935F; border-radius: 4px; box-shadow: 0 8px 24px rgba(11,31,58,.12); max-height: 260px; overflow: auto; }
.ls-menu li { padding: 7px 12px; color: #1C2430; cursor: pointer; font-size: 13px; }
.ls-menu li:hover { background: #F6EFE2; color: #0B1F3A; }
.ls-menu li.ls-selected { background: #0B1F3A; color: #FBF9F3; }
.ls-menu li.ls-active:not(.ls-selected) { background: #F6EFE2; color: #0B1F3A; } .ls-menu li.ls-active.ls-selected { outline: 2px solid #B8935F; outline-offset: -2px; }  /* Addendum 155 F: keyboard highlight */
.ls-menu li.ls-disabled { color: #9AA0A8; cursor: not-allowed; }

/* Addendum 132 D3: info bubbles -- an (i) that opens a short paragraph; no JS */
details.info { display:inline-block; vertical-align:middle; margin-left:6px; position:relative; font-weight:400 }
details.info > summary { list-style:none; cursor:pointer; display:inline-block; width:18px; height:18px; line-height:18px; text-align:center; border-radius:50%; background:var(--lendly-gold-dark); color:#fff; font-size:12px; font-weight:700; font-style:italic; font-family:Georgia,serif }
details.info > summary::-webkit-details-marker { display:none }
details.info > p { position:absolute; z-index:30; left:0; top:24px; width:340px; max-width:80vw; background:#fff; border:1px solid var(--border,#d9d4c7); border-radius:6px; padding:10px 12px; font-size:12px; line-height:1.45; color:var(--text,#222); box-shadow:0 4px 14px rgba(0,0,0,.14); text-align:left; margin:0 }
/* Addendum 132 B: flags as title -> meaning -> action -> details */
details.flag > summary { cursor:pointer; list-style:none } details.flag > summary::-webkit-details-marker { display:none }
details.flag > summary strong { font-weight:600 }

/* Addendum 142 A: the Deal screen's flagged inputs (amber = warning, red = out of box) */
.field.flag-amber .input, .field.flag-amber select { border-color: var(--warn); background: #fffaf1; }
.field.flag-red .input, .field.flag-red select { border-color: var(--danger); background: #fff7f6; }
.field .flag-note { color: var(--warn); margin-top: 3px; } .field.flag-red .flag-note { color: var(--danger); }


/* Addendum 145 F: a checkbox or radio sits left of its label on the same line, centred, label clickable */
.field.field-check { display: flex; align-items: center; gap: 8px; }
.field.field-check label { display: inline; margin: 0; font-size: 13px; color: var(--lendly-ink); }
.field.field-check input[type=checkbox], .field.field-check input[type=radio] { margin: 0; width: 15px; height: 15px; flex: none; }
.field.field-check .help, .field.field-check .errors { flex-basis: 100%; }
label.checkbox { display: inline-flex; align-items: center; gap: 6px; }
label.checkbox input { margin: 0; width: 15px; height: 15px; }
/* Addendum 153 B: :not(.ls-menu) -- this rule (0,1,1) out-ranked .ls-menu (0,1,0) and left the open dropdown list transparent, borderless and unpadded inside every .field */
ul.input, .field ul:not(.ls-menu) { list-style: none; padding: 0; margin: 0; border: 0; background: transparent; }
.field ul li label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--lendly-ink); }
.field ul li input[type=radio], .field ul li input[type=checkbox] { margin: 0; width: 15px; height: 15px; }
.flag-red-cell { border-color: var(--danger) !important; background: #fff7f6 !important; }

/* Addendum 150 A: the Roles table (staff and portal share web/_roles_table.html) is one card per person below 900 px --
   name on top, then two fields per row (Role / Ownership, Title / -, Signs / Guarantees), the Documents line under them;
   the header strip and the ownership total keep their layout. No horizontal scroll from 360 px up. */
@media (max-width: 900px) {
  #roles-table, #roles-table tbody { display: block; width: 100%; }
  #roles-table tr.roles-head { display: none; }
  #roles-table tr[data-row] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--lendly-border); border-radius: 4px; background: #fff; }
  #roles-table tr[data-row] td { display: block; padding: 0; border: 0; min-width: 0; }
  #roles-table td.rc-name, #roles-table td.rc-docs { grid-column: 1 / -1; }
  #roles-table td.rc-signs { grid-column: 1; } #roles-table td.rc-guar { grid-column: 2; }
  #roles-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
  #roles-table tr[data-row] td.num, #roles-table tr[data-row] td.num .input { text-align: left !important; }
  #roles-table tr[data-row] .input { width: 100% !important; min-width: 0 !important; }
  #roles-table tr.roles-total, #roles-table tr.roles-empty { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 6px 0; }
  #roles-table tr.roles-total td, #roles-table tr.roles-empty td { display: block; padding: 0; border: 0; }
  #roles-table tr.roles-total td:empty { display: none; }
}
/* Addendum 150 C (148 B): the Deal screen's live panel is greyed while a refused field makes its figures stale */
#deal-panel.stale { opacity: .45; filter: grayscale(1); }

/* Addendum 151 D: the enhanced dropdown stays opaque in dark mode too */
.ls-btn { background-color: #FBF9F3; } .ls-menu { background-color: #FFFDF9; color-scheme: light; }
/* Addendum 151 A: party cards on step 1 -- one summary line behind the disclosure arrow (the Notes box's control) */
details.party-card > summary { cursor: pointer; line-height: 1.6; }
details.party-card > summary strong { color: var(--lendly-navy); }
details.party-card > summary .pill { vertical-align: middle; margin-left: 4px; }
details.party-card > .party-body { margin-top: 10px; }
details.party-card[open] > summary { margin-bottom: 2px; }
/* Addendum 152 C: the stale-authorization banner, above the page title on every staff loan screen */
.auth-stale-banner { background: #fbefd9; border-left: 3px solid var(--warn); padding: 10px 14px; margin-bottom: 14px; color: var(--lendly-ink); }
/* Addendum 154 A: list pager (Loans, Prospect queue) -- count line + links; wraps cleanly at phone width */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; margin: 10px 0; }
.pager-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.pager-links a { text-decoration: none; }
.pager-current { display: inline-block; min-width: 22px; padding: 1px 6px; text-align: center; border-radius: 3px; background: #0B1F3A; color: #FBF9F3; font-weight: 600; }
/* Addendum 155 I: the closed dropdown shows its choice on one line */
.ls-btn .ls-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Addendum 169 D: steps past Property while the file waits for the borrower */
.steps a.locked { color: #9AA0A8; border-color: #E7E1D5; background: transparent; }

/* Addendum 180 B: a money box always fits $99,999,999.00; the As-is value's source dropdown sits under the amount, not beside it */
input.money, input[data-money] { min-width: calc(15ch + 20px); }
.money-with-source { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.money-with-source > input { width: 100%; }
/* Addendum 181 C: a field kept in place but not applicable yet (Loan & fees) */
.field.is-waiting > :not([data-waiting-note]) { opacity: .5; pointer-events: none; }
/* Addendum 183 B: nothing pushes a page wider than the window -- grid cells may shrink, long table values wrap */
.grid > * { min-width: 0; }
/* Addendum 196 B: words never break inside themselves in table cells (break-word only breaks a word that cannot fit at all,
   and never shrinks a column below its longest word); headers stay on one line. Only cells marked .wrap-any (long free text,
   file names) may break anywhere. */
.card td { overflow-wrap: break-word; } .card th { white-space: nowrap; }
.card td.wrap-any, .card .wrap-any { overflow-wrap: anywhere; }
/* Addendum 184 B: the loan header's current page */
.btn.secondary.is-current { background: var(--lendly-navy); color: #fff; border-color: var(--lendly-navy); }
/* Addendum 187 E: the loan header -- the title block keeps its own column; the buttons wrap inside theirs */
.loan-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; }
.loan-header-title { flex: 1 1 320px; min-width: 0; }
.loan-header-actions { flex: 0 1 auto; max-width: 62%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; }
.loan-header-actions form { display: inline; margin: 0; }
@media (max-width: 900px) { .loan-header { flex-wrap: wrap; } .loan-header-actions { max-width: none; justify-content: flex-start; } }
/* Addendum 193 B: portal My documents -- both tables share one fixed layout; buttons and pills never break onto two lines
   (183's overflow-wrap:anywhere on card cells applies to the Document column only) */
.portal-items { table-layout: fixed; width: 100%; }
.portal-items col.c-doc { width: 40%; } .portal-items col.c-for { width: 16%; } .portal-items col.c-status { width: 16%; } .portal-items col.c-act { width: 28%; }
.portal-items td, .portal-items th { overflow-wrap: normal; vertical-align: top; }
.portal-items td:first-child { overflow-wrap: anywhere; }
.portal-items .pill { white-space: nowrap; }
.portal-items td:last-child { overflow-wrap: anywhere; }
.portal-items td:last-child .btn { white-space: nowrap; display: inline-block; margin: 2px 4px 2px 0; }
.portal-items td:last-child:has(.btn ~ .btn) .btn { display: block; width: 100%; text-align: center; margin: 3px 0; }  /* two actions: stacked, equal width */
.nowrap, .card td.nowrap { white-space: nowrap; }  /* Addendum 196 B: dates, loan numbers */
