/* Appaloosa Deal Feed: one stylesheet, no build step. */
:root {
  --brand: #1f3864;
  --brand-2: #2b4c86;
  --brand-tint: #eaf0fa;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --line: #e3e7ee;
  --line-strong: #cfd6e1;
  --ink: #18202e;
  --ink-2: #3d4757;
  --muted: #6a7486;
  --good: #11704a;  --good-bg: #e5f5ed;
  --warn: #8f5d00;  --warn-bg: #fdf1d6;
  --bad: #b42318;   --bad-bg: #fdeceb;
  --info: #1f4e8c;  --info-bg: #e7effb;
  --mark: #fff0a8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
p { margin: 0 0 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.nav a { color: rgba(255, 255, 255, .78); padding: 8px 12px; border-radius: 7px; font-weight: 550; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .09); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .16); }
.nav .count { background: #f6c453; color: #3d2a00; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; line-height: 18px; }
.nav .count.alert { background: #ffb4ab; color: #5c0b05; }
.user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: rgba(255, 255, 255, .85); white-space: nowrap; }
.user form { margin: 0; }
.user button { background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 7px; padding: 5px 10px; font: inherit; cursor: pointer; }
.user button:hover { background: rgba(255, 255, 255, .1); }
.user a { color: rgba(255, 255, 255, .85); }

/* ---------- page */
.page { max-width: 1440px; margin: 0 auto; padding: 24px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- messages */
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 500; }
.flash.success { background: var(--good-bg); color: var(--good); border-color: #bfe3cf; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #c8d8f0; }
.email-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 14px 18px; font-size: 13px; max-height: 640px; overflow: auto; }
.email-preview .email-subject { font-weight: 600; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.env-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #f0d9a3; padding: 8px 24px; text-align: center; font-weight: 600; font-size: 13px; }
.flash.error, .flash.warning { background: var(--bad-bg); color: var(--bad); border-color: #f4c7c3; }

/* ---------- panels and stat tiles */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.panel-body { padding: 16px 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.tile .pill { white-space: normal; }
.tile .n { font-size: 24px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 550; }
a.tile:hover { text-decoration: none; border-color: var(--line-strong); }
.tile.warn .n { color: var(--warn); }

/* ---------- buttons and inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: 7px 13px; font: 550 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f7f9fc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: #f0c2bd; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=search], input[type=email], input[type=url], input[type=number], input[type=date], input[type=password], select, textarea {
  font: 14px var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(43, 76, 134, .15); }
textarea { resize: vertical; }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field .help { font-size: 12px; color: var(--muted); }
.field .errors, .errorlist { color: var(--bad); font-size: 12.5px; margin: 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 16px; }
.form-section + .form-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section > h2 { margin-bottom: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; cursor: pointer; background: #fff; }
.checks input { margin: 0; }
.toggle { display: flex; gap: 10px; align-items: flex-start; }
.toggle input { margin-top: 3px; }

/* ---------- filters */
.filters { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-row .search { flex: 1 1 260px; min-width: 200px; }
.filter-row select { width: auto; min-width: 150px; }
.segmented { display: inline-flex; max-width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow-x: auto; background: #fff; }
.segmented label { padding: 6px 12px; font-weight: 550; font-size: 13px; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); white-space: nowrap; position: relative; }
.segmented label:last-child { border-right: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--brand); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); background: #fff; border-radius: 16px; padding: 3px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 4px; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
.table-wrap > table.data { min-width: 640px; }  /* scroll inside the panel rather than squeeze columns */
.table-wrap > table.data.wide { min-width: 1000px; }
table.data td.practice { min-width: 240px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; white-space: nowrap; position: sticky; top: 0; }
table.data th.num { text-align: right; }
table.data th a { color: inherit; }
table.data th a.sorted { color: var(--brand); }
table.data td { padding: 11px 12px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafbfd; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-title:hover { color: var(--brand-2); }
.cell-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink-2); margin-bottom: 6px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- pills */
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 12px; padding: 1px 9px; font-size: 11.5px; font-weight: 650; white-space: nowrap; line-height: 20px; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.muted { background: #eef1f5; color: #4b5565; }
.pill.brand { background: var(--brand); color: #fff; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; margin-left: 5px; vertical-align: 1px; }
.down { color: var(--bad); font-weight: 650; }
.up { color: var(--good); font-weight: 650; }
.score { display: inline-flex; align-items: center; gap: 6px; }
.score b { font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* ---------- listing detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.detail > *, .stack > * { min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; }
.fact { padding: 12px 16px; border-bottom: 1px solid #eef1f5; border-right: 1px solid #eef1f5; }
.fact .l { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-size: 16px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fact .v small { font-size: 12px; font-weight: 600; color: var(--muted); }
.fact .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 3px #fff; }
.timeline li::after { content: ""; position: absolute; left: 10.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.price_change::before { background: var(--bad); }
.timeline li.new::before { background: var(--good); }
.timeline li.status_change::before, .timeline li.stale::before, .timeline li.relisted::before { background: #e3a008; }
.timeline .when { font-size: 12px; color: var(--muted); }
.score-bars { display: grid; gap: 8px; }
.score-bar { display: grid; grid-template-columns: 96px 1fr 34px; gap: 8px; align-items: center; font-size: 12.5px; }
.score-bar .track { background: #eef1f5; border-radius: 4px; height: 8px; overflow: hidden; }
.score-bar .fill { background: var(--brand-2); height: 100%; }
.big-score { display: flex; align-items: baseline; gap: 8px; }
.big-score b { font-size: 30px; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------- review */
.review-card { margin-bottom: 18px; }
.review-card .panel-head { align-items: flex-start; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.review-grid > div { padding: 16px 18px; }
.review-grid > div + div { border-left: 1px solid var(--line); background: #fbfcfe; }
.match { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.match.new { background: var(--good-bg); color: var(--good); }
.match.update { background: var(--info-bg); color: var(--info); }
.match.choose { background: var(--warn-bg); color: var(--warn); }
.match label { font-weight: 500; color: var(--ink); display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.checks-failed { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.checks-failed ul { margin: 4px 0 0; padding-left: 18px; }
.quote { font-size: 12px; color: var(--muted); border-left: 2px solid var(--line-strong); padding-left: 7px; margin-top: 2px; font-style: italic; overflow-wrap: anywhere; }
.email-text { white-space: pre-wrap; font: 13px/1.6 var(--font); color: var(--ink-2); max-height: 560px; overflow: auto; overflow-wrap: anywhere; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.review-actions { display: flex; gap: 10px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.review-actions input[type=text] { flex: 0 1 260px; min-width: 160px; }
.done { padding: 14px 18px; display: flex; align-items: center; gap: 10px; }

/* ---------- inbox / email */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .n { font-size: 11.5px; background: #eef1f5; color: var(--ink-2); border-radius: 9px; padding: 0 6px; }
.email-frame { width: 100%; height: 620px; border: 0; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
dl.meta { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: 13.5px; }
dl.meta dt { color: var(--muted); font-weight: 600; }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }
dl.meta.counts { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
dl.meta.counts dd { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
details > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }

/* ---------- login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #1f3864 0%, #2b4c86 55%, #f4f6fa 55.1%); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(16, 24, 40, .18); padding: 28px; }
.auth-card .brand { color: var(--ink); margin-bottom: 18px; }
.auth-card .brand-mark { background: var(--brand); color: #fff; }

/* ---------- people: one-click call and email */
.icon { flex: none; vertical-align: -3px; }
.contact-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.contact-actions .btn { gap: 6px; }
.contact-actions.compact .btn { padding: 4px 7px; }
.contact-cell { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.contact-name { font-weight: 550; }
.person + .person { padding-top: 14px; border-top: 1px solid var(--line); }
.contact-forms { display: grid; gap: 12px; }
.contact-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-grid.narrow { max-width: 560px; }
.contact-form { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 0; background: #fbfcfe; min-width: 0; }
.contact-form.has-error { border-color: #f0c2bd; }
.contact-form > .errors { color: var(--bad); font-size: 12.5px; margin-bottom: 8px; }
.contact-flags { margin-top: 12px; gap: 18px; }
.contact-flags .toggle span { font-weight: 500; font-size: 13px; color: var(--ink-2); }
.toggle.remove span { color: var(--bad); }
details.form-section > summary { list-style: none; cursor: pointer; }
details.form-section > summary::-webkit-details-marker { display: none; }
details.form-section > summary h2 { display: inline; }
details.form-section > summary::before { content: "▸ "; color: var(--muted); }
details.form-section[open] > summary::before { content: "▾ "; }

ul.evidence { margin: 6px 0 0; padding-left: 16px; overflow-wrap: anywhere; }
ul.evidence li + li { margin-top: 4px; }

/* ---------- listing-email sign-ups: one row per firm, with its next step */
.callout { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 16px; padding: 14px 18px; background: var(--brand-tint); border: 1px solid #c8d6ee; border-left: 4px solid var(--brand); }
.callout-text { flex: 1 1 320px; min-width: 0; }
.callout-text b { font-size: 15px; color: var(--brand); }
.callout-text .small { margin-top: 2px; color: var(--ink-2); }
.progress { height: 8px; max-width: 460px; margin-top: 10px; background: #d3ddec; border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.tabs .n.todo { background: var(--warn-bg); color: var(--warn); }
a.tile { color: inherit; }
a.tile:hover { text-decoration: none; border-color: var(--line-strong); }
.group-head { display: flex; gap: 8px; align-items: center; margin: 0; padding: 14px 18px 4px; font-size: 12px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.group-head .n { font-size: 11.5px; background: #eef1f5; color: var(--ink-2); border-radius: 9px; padding: 0 6px; letter-spacing: 0; }
.signup { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3fr); gap: 8px 16px; align-items: start; padding: 12px 18px; border-top: 1px solid var(--line); }
.group-head + .signup { border-top: 0; }
.signup.compact { grid-template-columns: minmax(0, 1fr); padding: 0; border-top: 0; }
.signup-steps { margin-top: 6px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.signup-actions { margin-top: 10px; gap: 8px; }
.btn.xs { padding: 1px 7px; font-size: 11.5px; font-weight: 600; flex: none; }
.copy-list { display: grid; gap: 10px; }
.copy-item .k { font-size: 11px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.copy-item .v { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.copy-item .btns { display: inline-flex; gap: 4px; margin-left: auto; }
.signup-mail { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-top: 10px; padding: 9px 12px; background: var(--info-bg); border-radius: var(--radius-sm); font-size: 13px; }
.signup-mail .row { gap: 8px; }
.mail-line + .mail-line { padding-top: 8px; border-top: 1px solid var(--line); }
@media (min-width: 1101px) {
  .detail.signups > aside { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; }
}

/* ---------- AI settings */
.prompt-editor { font: 13px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; min-height: 420px; }
.prompt-text { white-space: pre-wrap; font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink-2); background: #f6f8fb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
.prompt-text.small { font-size: 11.5px; max-height: 260px; margin-top: 6px; }
.version + .version { padding-top: 12px; border-top: 1px solid var(--line); }
.version form { margin-top: 8px; }
.try-listing + .try-listing { padding-top: 12px; border-top: 1px solid var(--line); }
dl.meta.compact { grid-template-columns: 96px minmax(0, 1fr); gap: 2px 10px; font-size: 13px; margin-top: 6px; }
.score-bar .fill.over { background: var(--warn); }
code { font: 12.5px ui-monospace, Consolas, monospace; background: #f1f4f8; padding: 1px 5px; border-radius: 4px; }

/* ---------- footer */
.foot { max-width: 1440px; margin: 0 auto; padding: 0 24px 28px; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .review-grid > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .detail.signups > aside { order: -1; }  /* the details to sign up with come first */
}
@media (max-width: 720px) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; height: auto; gap: 4px 12px; padding: 10px 12px 6px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 13px; }
  .user .name { display: none; }
  .page { padding: 16px 12px 48px; }
  .foot { padding: 0 12px 24px; }
  .filter-row select { flex: 1 1 140px; min-width: 0; }
  dl.meta { grid-template-columns: 96px minmax(0, 1fr); }
  .signup { grid-template-columns: minmax(0, 1fr); }
}
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }

/* "?" tips: what a field is for. Hover or focus shows one; a tap opens it (app.js). */
.field-label, .toggle-row { display: flex; align-items: center; gap: 6px; }
.toggle-row { align-items: flex-start; }
.tip { position: relative; display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; border-radius: 50%; background: #e7ecf4; color: var(--ink-2); font-size: 11px; font-weight: 700; line-height: 1; cursor: help; user-select: none; }
.toggle-row .tip { margin-top: 3px; }
.tip:hover, .tip:focus, .tip.open { background: var(--brand); color: #fff; outline: none; }
.tip-text { display: none; position: absolute; top: calc(100% + 6px); left: -8px; z-index: 30; width: max-content; max-width: 300px; padding: 8px 10px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
.tip.flip .tip-text { left: auto; right: -8px; }
.tip:hover .tip-text, .tip:focus .tip-text, .tip.open .tip-text { display: block; }
@media (max-width: 720px) {
  .tip-text, .tip.flip .tip-text { position: fixed; top: auto; left: 16px; right: 16px; bottom: 16px; width: auto; max-width: none; font-size: 13.5px; padding: 12px 14px; }
}

/* ---------- broker requests */
.req-item { padding: 12px 18px; border-top: 1px solid var(--line); }
.group-head + .req-item { border-top: 0; }
.req-item-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.req-item-head > div { min-width: 0; }
.req-item-head form { flex: none; margin: 0; }
.pill-select { width: auto; padding: 3px 8px; font-size: 12.5px; font-weight: 650; border-radius: 12px; }
.pill-select.good { background: var(--good-bg); color: var(--good); border-color: #bfe3cf; }
.pill-select.info { background: var(--info-bg); color: var(--info); border-color: #c8d8f0; }
.pill-select.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a3; }
.req-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }
.req-answer { white-space: pre-wrap; margin-top: 8px; font-size: 13px; background: #f6f8fb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; overflow-wrap: anywhere; }
.req-tools { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.req-tools details[open] { flex-basis: 100%; }
.req-tools form, details.inline-form form { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.req-tools form.stack { display: block; }
details.inline-form { display: inline-block; margin-left: 6px; }
details.inline-form[open] { display: block; margin-left: 0; }
.compose .tabs { padding: 0 8px; }
.compose textarea { font: 13px/1.55 var(--font); }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13px; overflow-wrap: anywhere; }
.event-list .when { font-size: 12px; color: var(--muted); }
.event-list li.broker { border-left: 3px solid var(--good); padding-left: 8px; }
.event-list li.note { border-left: 3px solid var(--line-strong); padding-left: 8px; }
.link-box { font: 12px/1.5 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; background: #f6f8fb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }

/* ---------- the broker's upload page */
.portal-top { background: var(--brand); color: #fff; }
.portal-top .inner { max-width: 880px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.portal { max-width: 880px; margin: 0 auto; padding: 24px 20px 64px; }
.portal-group { margin-bottom: 16px; }
form.upload { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.upload.stack { display: block; }
form.upload input[type=file] { flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: 13px; }
.upload-bar { flex-basis: 100%; height: 6px; background: #d3ddec; border-radius: 3px; overflow: hidden; }
.upload-bar > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.upload-error { flex-basis: 100%; margin: 0; }
@media (max-width: 720px) {
  .portal { padding: 16px 12px 48px; }
  .req-item { padding: 12px; }
}

/* ---------- underwriting runs */
.live-run { border-color: #c8d6ee; }
.live-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font: 12.5px/1.5 ui-monospace, Consolas, monospace; color: var(--ink-2); max-height: 320px; overflow: auto; overflow-wrap: anywhere; }
.live-log .when { color: var(--muted); margin-right: 6px; }
.turn + .turn { padding-top: 14px; border-top: 1px solid var(--line); }
.claude-summary { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--ink-2); background: #f6f8fb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 520px; overflow: auto; overflow-wrap: anywhere; }
.table-wrap > table.data.results { min-width: 0; }
table.data.results td { padding: 7px 10px; }
.claude-summary p { margin: 0 0 8px; }
.claude-summary ul, .claude-summary ol { margin: 0 0 8px; padding-left: 20px; }
.claude-summary table.data { margin: 4px 0 10px; background: #fff; }
.claude-summary table.data th { position: static; }
