:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #16202b; --muted: #5b6876; --line: #dfe3e8; --accent: #0b5cad; --accent-ink: #ffffff;
  --high: #1d6b3c; --medium: #8a5a00; --low: #b3261e; --flag: #6b2c91; --warn-bg: #fff6e0;
  --left: 300px; --right: 360px; --top: 52px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --surface: #1a2129; --ink: #e8edf2; --muted: #9aa7b4; --line: #2c3742; --accent: #6db3ff; --accent-ink: #0b1520;
    --high: #6fd19a; --medium: #f0c060; --low: #ff8a80; --flag: #cfa3f0; --warn-bg: #3a2f12; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; }
button, input, select { font: inherit; color: inherit; }
button { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .divider:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.link { min-height: 0; padding: 4px 6px; border: 0; background: none; color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 13px; }
.muted { color: var(--muted); } .grow { flex: 1; } .n { text-align: right; font-variant-numeric: tabular-nums; }

.top { height: var(--top); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-size: 16px; } .tag { font-weight: 400; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.where { color: var(--muted); }
.seg { display: flex; } .seg button { border-radius: 0; min-height: 36px; } .seg button:first-child { border-radius: 8px 0 0 8px; } .seg button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.panels { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--left) 6px minmax(0, 1fr) 6px var(--right); }
.panel { min-width: 0; min-height: 0; overflow: auto; background: var(--surface); }
.panel.left, .panel.right { padding: 16px; }
.panel > section + section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel.centre { background: var(--bg); overflow: hidden; display: flex; }
.divider { background: var(--line); cursor: col-resize; } .divider:hover, .divider.drag { background: var(--accent); }
.view { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; } .view[hidden] { display: none; }
.map { position: absolute; inset: 0; }
.mapnote { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; box-shadow: 0 2px 8px rgb(0 0 0 / .15); max-width: 90%; }
.empty { margin: auto; max-width: 420px; padding: 24px; text-align: center; color: var(--muted); } .empty h2 { justify-content: center; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 17px; }
.view > .empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; } .view > .empty[hidden] { display: none; }

.check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; } .check input { width: 18px; height: 18px; flex: none; }
.check small { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; border: 1px solid rgb(0 0 0 / .25); }
.layer { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; min-height: 44px; cursor: pointer; }
.layer input { width: 18px; height: 18px; } .layer small { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.layer.off { opacity: .55; cursor: default; }
.field { display: block; margin: 0 0 12px; } .field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; } legend { font-size: 12.5px; color: var(--muted); padding: 0; margin-bottom: 2px; }
.checks { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.sources p { margin: 0 0 8px; font-size: 13px; } .sources b { display: block; }

.listhead { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); } .listhead button { min-height: 36px; }
.tablewrap { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; } th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surface); font-size: 12.5px; color: var(--muted); font-weight: 600; } th.n { text-align: right; }
tbody tr { cursor: pointer; } tbody tr:hover, tbody tr.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; border: 1px solid currentColor; }
.pill.high { color: var(--high); } .pill.medium { color: var(--medium); } .pill.low { color: var(--low); } .pill.flag { color: var(--flag); } .pill.none { color: var(--muted); }
.card h1 { font-size: 19px; margin: 0 0 2px; } .card .sub { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.card .flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; } dt { color: var(--muted); } dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.note { background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0 0; }
.card a { color: var(--accent); overflow-wrap: anywhere; }
.rez { border: 1px dashed var(--flag); border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 14px; }

.hover { position: fixed; z-index: 20; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 20px rgb(0 0 0 / .22); font-size: 13px; max-width: 260px; }
.hover b { display: block; font-size: 14px; margin-bottom: 2px; }
.phonetabs { display: none; }

@media (max-width: 860px) {
  .panels { display: block; position: relative; }
  .panel { position: absolute; inset: 0; display: none; } .panel.show { display: block; } .panel.centre.show { display: flex; }
  .divider { display: none; }
  .phonetabs { display: flex; flex: none; border-top: 1px solid var(--line); background: var(--surface); }
  .phonetabs button { flex: 1; border: 0; border-radius: 0; min-height: 52px; } .phonetabs button[aria-current="true"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); }
  .where { display: none; }
}

/* sign-in pages and the People panel */
body.signin { justify-content: center; align-items: center; padding: 16px; }
.signbox { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.signbox .brand { font-weight: 700; margin: 0 0 18px; } .signbox h1 { font-size: 22px; margin: 0 0 14px; } .signbox form { margin: 14px 0; } .signbox .codeform { padding-top: 14px; border-top: 1px solid var(--line); }
.signbox a { color: var(--accent); } .small { font-size: 13px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; width: 100%; }
.note.bad { background: color-mix(in srgb, var(--low) 14%, transparent); }
.me { color: var(--muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top form { margin: 0; } .top .plain { min-height: 36px; }
dialog.people { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: min(560px, calc(100vw - 32px)); }
dialog.people::backdrop { background: rgb(0 0 0 / .45); }
dialog.people h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .person div { flex: 1; min-width: 0; overflow-wrap: anywhere; } .person small { display: block; color: var(--muted); }
.person select, .person button { min-height: 36px; }
.addperson { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; } .addperson .wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .me { display: none; } }

/* the deals board */
.board { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 14px; overflow-x: auto; align-items: flex-start; } .board[hidden] { display: none; }
.lane { flex: 0 0 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; max-height: 100%; display: flex; flex-direction: column; }
.lane.dropping { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lane-h { margin: 0; padding: 12px 14px; font-size: 14px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); } .lane-h small { color: var(--muted); font-weight: 400; }
.lane-b { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.kcard { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; font-size: 14px; touch-action: pan-y; }
.kcard b { display: block; overflow-wrap: anywhere; } .kcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); } .kcard.lifted { opacity: .35; }
.kcard select { margin-top: 8px; width: 100%; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.kcard.ghost { position: fixed; z-index: 30; pointer-events: none; box-shadow: 0 10px 28px rgb(0 0 0 / .3); transform: rotate(2deg); }
.boardfoot { padding: 0 16px 10px; }
.dealline { margin: 0 0 12px; } .card > button, .dealline button:not(.link) { min-height: 40px; }
dl.form dd select, dl.form dd input { min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); max-width: 170px; width: 100%; }
.dnote { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 0 0 10px; } .dnote small { color: var(--muted); } .dnote p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.noteform { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; } .noteform textarea, .noteform input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; font: inherit; min-height: 40px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; max-width: min(520px, calc(100vw - 32px)); }
@media (max-width: 860px) { .lane { flex-basis: 82vw; } .toast { bottom: 70px; } }

/* the directory of professionals */
.pros { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.pro { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 14px; overflow-wrap: anywhere; }
.pro small { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; } .pro b { display: block; font-size: 15px; margin: 2px 0; }
.pro:hover, .pro:focus-visible { border-color: var(--accent); }
label.inline { display: flex; align-items: center; gap: 8px; } label.inline select { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 8px; }
.proform textarea, .sendbox textarea, .sendbox select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; font: inherit; min-height: 40px; }
.proform { margin-bottom: 12px; } .lenderonly[hidden] { display: none; } .sendbox textarea { font-size: 13px; }

/* saved searches and dictation */
.savesearch { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); } .savesearch button { min-height: 40px; width: 100%; }
.savedrow { padding: 8px 0; border-bottom: 1px solid var(--line); } .savedrow small { display: block; font-size: 12.5px; }
.savedname { font-size: 15px !important; font-weight: 600; padding-left: 0 !important; text-align: left; } .savedctl { display: flex; align-items: center; justify-content: space-between; }
button.mic[aria-pressed="true"] { border-color: var(--low); color: var(--low); }

/* deal analysis */
.bigline { margin: 12px 0 6px; } .bigline b { font-size: 22px; font-variant-numeric: tabular-nums; }
.checkline { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); } .checkline .pill { flex: none; margin-top: 2px; } .checkline small { display: block; color: var(--muted); }
.analysis details { margin-top: 10px; } .analysis summary { cursor: pointer; color: var(--accent); min-height: 36px; } .rules { margin-top: 8px; } .rules button { min-height: 40px; }
.mapkey { margin-top: 14px; text-align: left; display: grid; gap: 8px; }
