/* Layout: one top bar with underline tabs; Listings is cards beside a sticky map; listing and deal are full pages
   with a sticky card on the right; one dialog for filters, the gallery and the checklist editor; one light theme. */
:root {
  --bg: #f4f5f2; --surface: #ffffff; --sunk: #eceee9; --ink: #18201d; --muted: #5d6762; --line: #d9ddd6;
  --accent: #23614f; --accent-ink: #ffffff; --accent-soft: #dcebe4;
  --good: #1f7a46; --good-soft: #dff1e5; --warn: #9a6200; --warn-soft: #f8ecd2; --bad: #b23a2a; --bad-soft: #f8e1dc;
  --need: #b4452c; --need-soft: #fbe6df;
  --shadow: 0 10px 40px rgba(20, 30, 25, .18);
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif; --body: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --barh: 52px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: 12px; } .muted { color: var(--muted); } .pos { color: var(--good); } .neg { color: var(--bad); } .warnc { color: var(--warn); }
.wrap { max-width: 1360px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; } h3 { font-size: 15px; font-weight: 700; }
h4.sub { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--need); vertical-align: middle; flex: none; }

/* Sign-in */
.splash { padding: 60px 16px; text-align: center; color: var(--muted); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { max-width: 420px; width: 100%; text-align: center; padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: default; }
.login h2 { font: 800 24px/1.1 var(--display); margin: 0 0 8px; }
.login p { margin: 0 0 18px; color: var(--muted); }
.login .btn { width: 100%; padding: 10px 16px; font-size: 15px; justify-content: center; }

/* Top bar: one row, underline tabs, the reviewer on this device at the right */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 22px; height: var(--barh); }
.brand { font: 800 17px var(--display); letter-spacing: -.01em; white-space: nowrap; }
.tabs { display: flex; gap: 18px; height: var(--barh); margin-left: 6px; }
.tabs a { border: 0; background: transparent; padding: 0 2px; border-radius: 0; font-weight: 600; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; height: 100%; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .n { font: 700 11px/14px var(--display); color: var(--need); background: var(--need-soft); border-radius: 999px; padding: 1px 6px; }
.me { margin-left: auto; position: relative; }
.me > button { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 8px 4px 4px; border-radius: 999px; }
.me > button:hover { background: var(--sunk); }
.me > button.btn { border: 1px solid var(--line); background: var(--surface); padding: 4px 9px; }
.me .av { width: 28px; height: 28px; font-size: 12px; }
.me .menu { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.me .menu .hd { padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me .menu .hd b { display: block; color: var(--ink); font-size: 13px; }
.me .menu .hd span { display: block; font-size: 11px; margin-top: 3px; overflow-wrap: anywhere; }
.me .menu button { width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.me .menu button:hover { background: var(--sunk); }
.me .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
/* First visit on a device: everyone signs in as hello@, so the device is told who is reviewing */
.pick { display: grid; gap: 8px; }
.pick button { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 14px; font-weight: 600; font-size: 15px; width: 100%; }
.pick button:hover { border-color: var(--accent); background: var(--accent-soft); }
.pick .av { width: 32px; height: 32px; font-size: 13px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.rowbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.foot { color: var(--muted); font-size: 12px; padding-block: 20px 40px; border-top: 1px solid var(--line); margin-top: 24px; }
.foot:empty { display: none; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 10px 0; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.empty b { color: var(--ink); }

/* Page head and the stat strip: one hairline box, four cells, two by two on a phone */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-block: 22px 14px; }
.phead h2 { font-size: 24px; font-weight: 800; }
.phead .sub { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.strip:empty { display: none; }
.strip > div { padding: 12px 16px; border-left: 1px solid var(--line); min-width: 0; }
.strip > div:first-child { border-left: 0; }
.strip small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.strip b { display: block; font: 700 22px/1.2 var(--display); margin-top: 2px; }
.strip b .u { font: 600 13px var(--body); color: var(--muted); }
.strip .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Needs you: an inbox card with who, what and the action */
.inbox { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.inbox header { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.inbox header h3 { font-size: 15px; }
.inbox header .n { font: 700 11px/16px var(--display); color: var(--need); background: var(--need-soft); border-radius: 999px; padding: 1px 7px; }
.inbox header .all { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 2px 4px; }
.inbox header .all:hover { color: var(--accent); }
.inbox ul { list-style: none; margin: 0; padding: 0; }
.inbox li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.inbox li:first-child { border-top: 0; }
.inbox li:hover { background: var(--sunk); }
.inbox li .vdot { width: 28px; height: 28px; font-size: 12px; }
.inbox li .who { font-size: 13px; } .inbox li .who b { font-weight: 700; } .inbox li .who .st { color: var(--muted); } .inbox li .who .st::before { content: "·"; margin: 0 6px; }
.inbox li .t { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox li .act { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }

/* Filter bar */
.fbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--barh)); z-index: 25; background: var(--bg); padding-block: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fbar input[type="search"] { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; min-width: 180px; flex: 1 1 180px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; color: var(--ink); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.need[aria-pressed="true"] { background: var(--need-soft); border-color: var(--need); color: var(--need); }
.chip .n { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 16px; }
.chip.need .n { background: var(--need); color: #fff; }
.chip svg { width: 14px; height: 14px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.askchip { padding: 3px 10px; font-size: 12px; cursor: pointer; }
.askchip input { accent-color: var(--need); margin: 0 2px 0 0; }
.askchip:has(input:checked) { background: var(--need-soft); border-color: var(--need); color: var(--need); }
.pop-anchor { position: relative; }
.popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; display: grid; gap: 4px; }
.popover .all { display: flex; gap: 10px; padding: 2px 4px 8px; font-size: 12px; }
.popover .all button { border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 0; }
.popover label { display: flex; gap: 10px; align-items: center; padding: 6px 4px; border-radius: 6px; }
.popover label:hover { background: var(--sunk); }
.popover label small { margin-left: auto; color: var(--muted); }
.popover input { width: 18px; height: 18px; accent-color: var(--accent); }
.popover .btn.primary { margin-top: 6px; justify-content: center; }
.popover .locs { display: grid; gap: 2px; max-height: min(440px, 50vh); max-height: min(440px, calc(100dvh - 320px)); overflow-y: auto; overscroll-behavior: contain; }
/* The floating map button sits above the filter bar, so it would cover Apply while the town picker is open. */
body:has(#locPop) .fab { display: none; }
.scrim { display: none; }
.popover .grp { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 4px 2px; }
.popover .grp:first-child { padding-top: 0; }

/* Split: cards left, sticky map right */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); gap: 16px; align-items: start; padding-bottom: 24px; }
.results { min-width: 0; }
.rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 0 10px; }
.rhead h2 { font-size: 16px; }
.rhead .sort { margin-left: auto; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.rhead select { background: transparent; border: 0; border-radius: 6px; padding: 4px 2px; font-weight: 600; color: var(--ink); }
.rhead select:hover { background: var(--sunk); }
/* Cards: the photo carries the score and the "needs you" tag; the body is price, facts, address, then a three-stat row */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cards .empty { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; min-width: 0; transition: box-shadow .15s, border-color .15s; position: relative; }
.card:hover, .card.hot { box-shadow: 0 6px 24px rgba(20, 30, 25, .12); border-color: var(--accent); }
.card.failing { opacity: .72; }
.card.needs-me { border-color: var(--need); }
.ph { aspect-ratio: 3 / 2; max-width: 100%; background: var(--sunk); display: grid; place-items: center; color: var(--muted); font-size: 12px; position: relative; overflow: hidden; }
.ph svg { width: 36px; height: 36px; opacity: .35; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .tag { position: absolute; top: 10px; left: 10px; background: var(--surface); color: var(--need); border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.ph .score { position: absolute; top: 10px; right: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.cbody { padding: 12px 14px 14px; display: grid; gap: 3px; }
.price { font: 700 18px/1.2 var(--display); display: flex; align-items: baseline; gap: 8px; }
.price .age { font: 500 12px var(--body); color: var(--muted); margin-left: auto; }
.facts { color: var(--muted); font-size: 13px; }
.facts b { color: var(--ink); font-weight: 600; }
.addr { font-weight: 600; }
.addr span { color: var(--muted); font-weight: 400; }
.line2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.line2 span { display: grid; gap: 1px; min-width: 0; }
.line2 b { color: var(--ink); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; align-items: center; }
.pill { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 7px; background: var(--sunk); color: var(--muted); display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.need { background: var(--need-soft); color: var(--need); }
.pill.unknown { background: var(--bad-soft); color: var(--bad); } .pill.estimated { background: var(--warn-soft); color: var(--warn); } .pill.confirmed { background: var(--good-soft); color: var(--good); }
.score { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 999px; font: 700 13px var(--display); }
.score.good { background: var(--good-soft); color: var(--good); } .score.warn { background: var(--warn-soft); color: var(--warn); } .score.bad { background: var(--bad-soft); color: var(--bad); }
.votes { display: inline-flex; gap: 2px; margin-left: auto; }
.vdot { width: 18px; height: 18px; border-radius: 50%; background: var(--sunk); color: var(--muted); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.vdot.pursue { background: var(--good-soft); color: var(--good); } .vdot.maybe { background: var(--warn-soft); color: var(--warn); } .vdot.pass { background: var(--bad-soft); color: var(--bad); }
.more { display: flex; justify-content: center; padding: 16px; }

/* Map */
.mappane { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--barh) + 58px); height: calc(100vh - var(--barh) - 74px); min-height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); isolation: isolate; z-index: 0; background: var(--sunk); }
.map { width: 100%; height: 100%; background: var(--sunk); }
.leaflet-container { font: inherit; background: var(--sunk); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-bar, .leaflet-touch .leaflet-bar { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); width: 34px; height: 34px; line-height: 34px; font: 500 18px/34px var(--body); }
.leaflet-bar a:hover { background: var(--sunk); }
.pin { background: var(--surface); color: var(--ink); border: 1.5px solid var(--accent); border-radius: 999px; padding: 2px 7px; font: 700 11px/1.3 var(--display); white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.18); transform: translate(-50%, -100%); width: auto !important; height: auto !important; position: relative; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 7px; height: 7px; background: inherit; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: translateX(-50%) rotate(45deg); }
.pin.good { border-color: var(--good); } .pin.good::after { border-color: var(--good); }
.pin.warn { border-color: var(--warn); } .pin.warn::after { border-color: var(--warn); }
.pin.bad { border-color: var(--bad); } .pin.bad::after { border-color: var(--bad); }
.pin.deal { background: var(--accent); color: var(--accent-ink); }
.pin .dot { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border: 2px solid var(--surface); }
.pin.hot, .pin:hover { transform: translate(-50%, -100%) scale(1.12); z-index: 1000 !important; background: var(--ink); color: var(--bg); }
.pin.hot::after, .pin:hover::after { background: var(--ink); }
.maptool { position: absolute; z-index: 5; top: 10px; left: 50px; display: flex; gap: 6px; }
.maptool label { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 9px; font-size: 12px; font-weight: 600; display: flex; gap: 7px; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.12); cursor: pointer; }
.maptool input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.mapcount { position: absolute; z-index: 5; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.hovercard { position: absolute; z-index: 6; width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; pointer-events: none; }
.hovercard .ph { aspect-ratio: 16 / 7; } .hovercard .ph .score { top: 8px; right: 8px; }
.hovercard .cbody { padding: 8px 10px 10px; }
.fab { display: none; position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 700; box-shadow: var(--shadow); gap: 8px; align-items: center; }
.fab svg { width: 16px; height: 16px; }

/* Dialog: filters, the gallery, the checklist editor, new deal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 900px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 16, 13, .45); }
.mhead { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mhead h2 { text-align: center; font-size: 15px; }
.x { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; } .x:hover { background: var(--sunk); }
.mbody { padding: 6px 20px 14px; overflow: auto; max-height: calc(86vh - 120px); }
.msec { padding: 18px 0; border-bottom: 1px solid var(--line); }
.msec:last-child { border-bottom: 0; }
.msec h3 { margin-bottom: 4px; }
.msec .hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin: 12px 11px 0; }
.hist i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .9; transition: background .1s; }
.hist i.out { background: var(--line); }
/* Sliders: one track, one or two thumbs, the fill drawn by a div so dragging only repaints two elements */
.sl { position: relative; height: 34px; margin: 0 11px; }
.sl .track { position: absolute; left: 0; right: 0; top: 15px; height: 4px; background: var(--line); border-radius: 2px; }
.sl .fill { position: absolute; top: 15px; height: 4px; background: var(--ink); border-radius: 2px; }
.sl input[type="range"] { position: absolute; left: -11px; right: -11px; width: calc(100% + 22px); top: 0; height: 34px; margin: 0; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; }
.sl input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 34px; }
.sl input[type="range"]::-moz-range-track { background: transparent; height: 34px; }
.sl input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 22px; height: 22px; margin-top: 6px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab; }
.sl input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); cursor: grab; }
.sl input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); }
.sl .ticks { position: absolute; left: 0; right: 0; top: 24px; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); pointer-events: none; }
.slrow { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.slrow b { font-weight: 700; font-size: 15px; }
.slrow small { color: var(--muted); }
.minmax { display: flex; gap: 10px; margin-top: 10px; }
.minmax label { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; }
.minmax small { color: var(--muted); font-size: 11px; }
.minmax input { border: 0; background: transparent; padding: 0; font-weight: 600; width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg.small button { padding: 4px 10px; font-size: 12px; }
.seg button[disabled] { opacity: .55; cursor: default; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.checks label, .needlbl { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.checks input, .needlbl input { width: 18px; height: 18px; accent-color: var(--accent); }
.needlbl { margin-top: 8px; } .needlbl input { accent-color: var(--need); }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; margin-bottom: 10px; }
.agrid .gname { grid-column: 1 / -1; }
.field { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.field input { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 8px; font-weight: 600; color: var(--ink); width: 100%; }
.shared { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-weight: 600; }
.mfoot { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.mfoot .clear { border: 0; background: transparent; font-weight: 700; text-decoration: underline; padding: 6px 0; }
.mfoot .btn.primary { padding: 10px 18px; }
details.sec > summary { cursor: pointer; font-weight: 700; font-family: var(--display); list-style: none; display: flex; justify-content: space-between; }
details.sec > summary::after { content: "⌄"; color: var(--muted); }
details.sec[open] > summary::after { content: "⌃"; }
details.sec2 { margin-top: 12px; } details.sec2 > summary { cursor: pointer; font-weight: 600; }
/* The gallery in the dialog */
.gallery { padding-top: 12px; }
.gallery .main { position: relative; aspect-ratio: 3 / 2; background: #000; border-radius: 8px; overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery .navb { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 20px; }
.gallery .prev { left: 8px; } .gallery .next { right: 8px; }
.gallery .ctr { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.gallery .strip { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; }
.gallery .strip button { flex: none; border: 2px solid transparent; padding: 0; border-radius: 5px; background: none; }
.gallery .strip button[aria-current="true"] { border-color: var(--accent); }
.gallery .strip img { width: 64px; height: 46px; object-fit: cover; border-radius: 3px; display: block; }

/* Listing page */
.page { padding-block: 14px 40px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding-bottom: 12px; }
.crumbs .back { border: 0; background: transparent; padding: 4px 0; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; }
.crumbs .back:hover { color: var(--ink); }
.crumbs .nav { margin-left: auto; display: flex; gap: 6px; }
.hero { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: clamp(240px, 38vw, 440px); border-radius: 14px; overflow: hidden; position: relative; }
.hero .ph { aspect-ratio: auto; height: 100%; border: 0; padding: 0; cursor: pointer; }
.hero .ph:first-child { grid-row: span 2; }
.hero .showall { position: absolute; right: 14px; bottom: 14px; }
.title { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 14px 0 6px; }
.title h2 { font-size: 24px; }
.title .meta { color: var(--muted); }
.lgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.lmain { min-width: 0; }
.secnav { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--barh)); z-index: 20; background: var(--bg); display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.secnav button { border: 0; background: transparent; padding: 10px 12px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center; }
.secnav button[aria-current="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.sec { padding: 20px 0; border-bottom: 1px solid var(--line); }
.sec h3 { font-size: 18px; margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.sec h3 small { font: 400 13px var(--body); color: var(--muted); }
.sumtext { font-size: 15px; line-height: 1.55; max-width: 68ch; margin: 0 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpi { background: var(--surface); padding: 10px 12px; min-width: 0; }
.kpi small { color: var(--muted); font-size: 12px; font-weight: 500; display: block; }
.kpi b { font: 700 18px/1.2 var(--display); }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi.hi { background: var(--accent-soft); } .kpi.hi b { color: var(--accent); }
.ledger { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ledger td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger td:last-child { text-align: right; white-space: nowrap; }
.ledger tr.total td { font-weight: 700; }
.ledger .in { color: var(--muted); padding-left: 14px; }
.ledger .src { color: var(--muted); font-size: 12px; }
.ledger tr.total .src { font-weight: 400; }
.ovl { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; white-space: nowrap; }
.ovl input { width: 90px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 6px; text-align: right; }
.ovl input[type=checkbox] { width: auto; padding: 0; }
.ledger tr.offrow td:last-child { color: var(--muted); }
.offs { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 4px 0 0; }
.offs label { display: inline-flex; gap: 6px; align-items: center; }
.units { width: 100%; border-collapse: collapse; margin-top: 6px; }
.units th, .units td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.units th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.units .r, .ledger .r, .balloons .r { text-align: right; }
.units input[type="number"] { width: 90px; text-align: right; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 4px 6px; }
.units input[type="text"] { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 4px 6px; }
.util { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ubox { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface); }
.ubox .lbl { font-weight: 600; }
.ubox .src { font-size: 12px; color: var(--muted); }
.scoredet { display: inline-block; }
.scoredet summary { list-style: none; cursor: pointer; display: inline-flex; }
.scoredet summary::-webkit-details-marker { display: none; }
.scoredet .bars { margin-top: 10px; min-width: min(420px, 80vw); }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; margin: 0; }
.dl div { border-bottom: 1px solid var(--line); padding: 6px 0; min-width: 0; }
.dl dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.dl dd { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0 0 0 6px; font-size: 12px; }
.flaglist { display: grid; gap: 6px; padding-left: 18px; margin: 6px 0 0; }
.minimap { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); isolation: isolate; z-index: 0; margin-bottom: 8px; background: var(--sunk); }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); display: grid; gap: 12px; }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(20, 30, 25, .08); padding: 16px; display: grid; gap: 10px; }
.scard .big { font: 800 26px/1.1 var(--display); display: flex; align-items: baseline; gap: 10px; }
.scard .big .score, .scard .big .pill { margin-left: auto; }
.srow { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.srow:last-of-type { border-bottom: 0; }
.srow span { color: var(--muted); } .srow b { font-weight: 600; text-align: right; }
.vote { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.vote button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 0; font-weight: 600; }
.vote button[aria-pressed="true"].pursue { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.vote button[aria-pressed="true"].maybe { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.vote button[aria-pressed="true"].pass { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.scard select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; font-weight: 600; width: 100%; }
.scard .btn.primary { justify-content: center; }
.note { background: var(--sunk); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.note > b { display: block; }
.note.need { background: var(--need-soft); border-left: 3px solid var(--need); }
.note .q { font-style: normal; margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .reply { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.team { display: grid; gap: 10px; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.msg .vdot { width: 30px; height: 30px; font-size: 12px; }
.msg small { color: var(--muted); }
.msg.unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--need); margin-left: 6px; vertical-align: middle; }
.msg .asks { color: var(--need); font-size: 12px; font-weight: 600; }
.ntext { white-space: pre-wrap; overflow-wrap: anywhere; }
.compose { display: grid; gap: 6px; }
.compose .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compose .row .muted { font-size: 12px; }
textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-height: 60px; resize: vertical; }

/* Deals board */
.btoolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-block: 12px 4px; }
.board { padding-block: 10px 40px; display: grid; gap: 18px; min-width: 0; }
.stage { min-width: 0; }
.stage h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 16px; }
.stage h3 .pill { font-size: 11px; }
details.stage > summary { cursor: pointer; font-weight: 600; }
/* Each cell may shrink below its text, so a long one-line note ellipsizes instead of widening the board. */
.drow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 10px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; border-left-width: 4px; }
.drow:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.drow.late { border-left-color: var(--bad); }
.drow.needs-me { border-left-color: var(--need); }
.drow > div { min-width: 0; }
.drow .a { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.drow .a .score { margin-left: 2px; }
.drow .m { color: var(--muted); font-size: 13px; margin-top: 2px; }
.drow .lastnote { margin-top: 6px; font-size: 13px; display: flex; gap: 8px; align-items: center; color: var(--muted); min-width: 0; }
.drow .lastnote span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drow .lastnote b { color: var(--ink); font-weight: 600; }
.dmeta { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: start; font-size: 13px; min-width: 0; }
.dmeta > div { min-width: 0; }
.dmeta small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.dmeta b { font-weight: 600; overflow-wrap: anywhere; }
.dmeta .late { color: var(--bad); }

/* Deal page */
.dhead { padding: 14px 0 0; }
.dhead h2 { font-size: 24px; }
.dhead .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); align-items: center; margin-top: 4px; }
.dtabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--barh)); background: var(--bg); z-index: 20; }
.dtabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center; }
.dtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.dtabs .n { font: 700 11px/14px var(--display); color: var(--need); background: var(--need-soft); border-radius: 999px; padding: 1px 6px; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding-top: 16px; }
.dmain { min-width: 0; display: grid; gap: 18px; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.block h3 { display: flex; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.block h3 .btn { font-weight: 600; }
.block .ledger { margin-top: 4px; }
.dfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.dfields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.dfields label.wide { grid-column: 1 / -1; }
.dfields input, .dfields select, .dfields textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; font-size: 14px; color: var(--ink); width: 100%; min-width: 0; }
.dfields textarea { min-height: 54px; }
.action { display: grid; gap: 10px; }
.action label { display: grid; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.action input, .action select, .action textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; font-weight: 600; color: var(--ink); width: 100%; font-size: 14px; }
.action textarea { min-height: 48px; }
.action .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; }
.stages button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stages button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stageform { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); }
.stageform input { background: var(--surface); }
.conf { display: flex; align-items: center; gap: 10px; }
.conf .bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: var(--good); }
.fact { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.fact > summary { list-style: none; display: grid; grid-template-columns: 1fr auto auto 18px; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; }
.fact > summary::-webkit-details-marker { display: none; }
.fact > summary .lbl { font-weight: 700; min-width: 0; }
.fact > summary .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact > summary .fval { font-weight: 700; text-align: right; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact > summary .chev { color: var(--muted); text-align: right; }
.fact[open] > summary { border-bottom: 1px solid var(--line); background: var(--sunk); border-radius: 10px 10px 0 0; }
.fact[open] > summary .chev { transform: rotate(180deg); }
.fbody { padding: 12px 14px 14px; display: grid; gap: 10px; }
.fbody input[type="number"], .fbody input[type="text"], .fbody select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 8px; }
.fbody .ctl3 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.piece { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 0 0 6px; display: grid; gap: 6px; }
.tablebox { overflow-x: auto; }
.balloons { width: 100%; border-collapse: collapse; font-size: 13px; }
.balloons th, .balloons td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.bars { display: grid; gap: 6px; margin-top: 8px; }
.bar2 { display: grid; grid-template-columns: 140px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar2 .t { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; } .bar2 .t i { display: block; height: 100%; background: var(--accent); }
.bar2 .t i.neg { background: var(--bad); }
.bar2 .r { text-align: right; color: var(--muted); }
/* The checklist: hover reveals the controls, text edits in place, rows drag */
.tasks { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tasks > .task:first-child { border-radius: 11px 11px 0 0; } .tasks > .task:last-child { border-radius: 0 0 11px 11px; } .tasks > .task:only-child { border-radius: 11px; }
.task { display: grid; grid-template-columns: 16px 20px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 44px; position: relative; }
.task:last-child { border-bottom: 0; }
.task.done { opacity: .6; } .task.done .tt { text-decoration: line-through; }
.task input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.task .handle { color: var(--muted); cursor: grab; opacity: .35; font-size: 14px; letter-spacing: -2px; user-select: none; }
.task:hover .handle { opacity: .9; }
.task .tt { cursor: text; border-radius: 4px; padding: 1px 4px; margin-left: -4px; min-width: 0; overflow-wrap: anywhere; }
.task .tt:hover { background: var(--sunk); }
.task .tpl { font-size: 11px; color: var(--muted); font-weight: 500; }
.task .tedit { border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px; width: 100%; background: var(--surface); }
.task .tctl { display: flex; gap: 4px; align-items: center; opacity: .45; }
.task:hover .tctl, .task:focus-within .tctl { opacity: 1; }
.task .tctl select, .task .tctl input[type="date"] { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 4px; font-size: 12px; color: var(--muted); max-width: 130px; }
.task .tctl select:hover, .task .tctl input[type="date"]:hover { border-color: var(--line); background: var(--surface); }
.task .tctl input.late { color: var(--bad); font-weight: 600; }
.task .tctl input.empty { display: none; } .task:hover .tctl input.empty, .task:focus-within .tctl input.empty { display: block; }
.task .clip { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 7px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.task .clip:hover { border-color: var(--accent); }
.task .kebab { border: 0; background: transparent; border-radius: 6px; width: 26px; height: 26px; color: var(--muted); font-weight: 800; }
.task .kebab:hover { background: var(--sunk); color: var(--ink); }
.task.dragging { opacity: .4; }
.task.dropabove { box-shadow: 0 -3px 0 var(--accent); }
.task .tfiles { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }
.task .tfiles .clip { cursor: default; }
.tmenu { position: absolute; right: 8px; top: 36px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 190px; }
.tmenu button { border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; font-weight: 500; display: flex; justify-content: space-between; gap: 10px; }
.tmenu button:hover { background: var(--sunk); }
.tmenu button.danger { color: var(--bad); }
.tmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.skipped summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 0 6px; list-style: none; font-weight: 600; }
.skipped .task { opacity: .55; }
.addrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.addrow input[type="text"] { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.addrow select { border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.flink { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.flink:hover { text-decoration: underline; }
/* Drop zone and file rows */
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 22px 16px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; cursor: pointer; transition: background .12s, border-color .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop svg { width: 28px; height: 28px; opacity: .6; }
.drop b { color: var(--ink); }
.drop .btn { pointer-events: none; }
.frows { display: grid; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.frow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.frow > div { min-width: 0; }
.frow:last-child { border-bottom: 0; }
.frow .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--sunk); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.frow .ic.img { background: var(--good-soft); color: var(--good); }
.frow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow b .flink { white-space: nowrap; }
.frow small { color: var(--muted); }
.frow select { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 4px 6px; font-size: 12px; max-width: 160px; }
.frow .x { width: 28px; height: 28px; font-size: 16px; }
.tl { display: grid; gap: 8px; }
.ev { display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 13px; }
.ev small { color: var(--muted); }
.ev > span { min-width: 0; overflow-wrap: anywhere; }
.ev.note { background: var(--sunk); border-radius: 8px; padding: 8px 10px; }
.ev.note.unread { background: var(--need-soft); }
.ev .asks { color: var(--need); font-weight: 600; }
/* Checklist editor */
.tpl-stage { margin-bottom: 14px; }
.tpl-stage h3 { margin-bottom: 6px; }
.tpl-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.tpl-row input[type="text"] { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 5px 8px; width: 100%; min-width: 0; }
.tpl-row input[type="text"]:hover, .tpl-row input[type="text"]:focus { border-color: var(--line); background: var(--surface); }
.tpl-row .x { width: 26px; height: 26px; font-size: 14px; }
.tpl-row .mv { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; width: 26px; height: 26px; font-size: 11px; color: var(--muted); }
.tpl-row .mv[disabled] { opacity: .35; cursor: default; }

/* Task rows outside a checklist (the listing page and the Tasks view) and avatars; a row opens the task panel */
.avs { display: inline-flex; gap: 2px; }
.av { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0; }
.av.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.trows { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.trow { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 44px; cursor: pointer; }
.trow.av3 { grid-template-columns: 18px minmax(0, 1fr) auto auto; }
.trow .meta { display: flex; gap: 12px; align-items: center; min-width: 0; }
.trow .avs { min-width: 24px; } .trow .avs .av { width: 24px; height: 24px; font-size: 11px; }
.trow:last-of-type { border-bottom: 0; }
.trow:hover { background: var(--sunk); }
.trow.sel { background: var(--accent-soft); }
.trow.done { opacity: .55; } .trow.done .ttl { text-decoration: line-through; }
.trow input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.trow .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .ttl small { color: var(--muted); margin-left: 6px; }
.trow .due { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 56px; text-align: right; }
.trow .due.late { color: var(--bad); font-weight: 700; } .trow .due.today { color: var(--warn); font-weight: 700; }
.gadd { display: flex; gap: 8px; align-items: center; padding: 0 14px; min-height: 40px; border-top: 1px solid var(--line); background: var(--bg); }
.gadd input { flex: 1; border: 0; background: transparent; padding: 4px 0; min-width: 0; font-size: 13px; }
.gadd input::placeholder { color: var(--muted); }
.gadd .btn { display: none; } .gadd:focus-within .btn { display: inline-flex; }
.lsec-tasks .trows { margin-top: 8px; }
/* Where a task sits: a square for a deal, a dot for a listing. */
.chipref { display: inline-flex; gap: 6px; align-items: center; border: 0; background: transparent; padding: 0; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; max-width: 220px; min-width: 0; }
.chipref > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chipref:hover { color: var(--accent); }
.chipref i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }
.chipref.listing i { border-radius: 50%; background: var(--warn); }
.chipref.none { color: var(--muted); font-size: 12px; }

/* The Tasks view: the quick form, the controls, the groups and the task panel */
.quick { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 8px 10px; margin-top: 12px; }
.quick input[type="text"] { border: 0; background: transparent; padding: 6px 4px; font-size: 15px; min-width: 0; }
.quick select, .quick input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface); font-size: 13px; color: var(--muted); max-width: 200px; min-width: 0; }
.quick .btn.primary { white-space: nowrap; }
.tctls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tctls .seg button { padding: 6px 12px; font-size: 13px; }
.tctls label.sel { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.tctls select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--surface); font-weight: 600; }
.tgroups { display: grid; gap: 20px; padding-block: 16px 40px; min-width: 0; }
.tgroup { min-width: 0; }
.tgroup h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.tgroup h3 .av { width: 24px; height: 24px; font-size: 11px; }
.tgroup h3 .c { color: var(--muted); font-weight: 500; }
.tgroup h3 .late { color: var(--bad); font-size: 12px; font-weight: 600; }
.tgroup h3 .fold { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 2px 4px; white-space: nowrap; }
.tgroup h3 .fold:hover { color: var(--ink); }
.tpanel { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--barh)); right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 28; overflow: auto; padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; align-content: start; }
.tpanel .ph-head { display: flex; gap: 8px; align-items: center; min-width: 0; }
.tpanel .ph-head .x { margin-left: auto; flex: none; }
.tpanel .chipref { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.tpanel .ttitle { font: 700 18px/1.3 var(--display); border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; margin-left: -8px; width: calc(100% + 8px); background: transparent; resize: none; }
.tpanel .ttitle:hover, .tpanel .ttitle:focus { border-color: var(--line); background: var(--sunk); }
.tpanel .frow2 { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tpanel .frow2 > span:first-child { color: var(--muted); }
.tpanel select, .tpanel input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface); width: 100%; min-width: 0; }
.tpanel textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); resize: vertical; margin-top: 6px; }
.tpanel .pacts { display: flex; gap: 8px; flex-wrap: wrap; }
.tpanel .plog { display: grid; gap: 6px; font-size: 13px; }
.tpanel .plog small { color: var(--muted); margin-right: 8px; }
#tasksView.panel-open .tgroups { padding-right: min(460px, 40vw); }
.toast { position: fixed; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

@media (max-width: 1000px) { .lgrid, .dgrid { grid-template-columns: 1fr; } .side { position: static; } .hero { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; height: 220px; } .hero .ph:nth-child(n+3) { display: none; } .hero .ph:first-child { grid-row: auto; } }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .mappane { display: none; position: fixed; inset: 0; z-index: 35; border-radius: 0; height: auto; min-height: 0; }
  body.mapon .mappane { display: block; }
  body.mapon .results { display: none; }
  .fab { display: inline-flex; }
  .mapcount { bottom: auto; top: 58px; }
  .drow { grid-template-columns: 1fr; } .dmeta { grid-template-columns: 1fr 1fr; } .dmeta > div:first-child { grid-column: 1 / -1; }
  .frow { grid-template-columns: 34px minmax(0, 1fr) 28px; row-gap: 6px; } .frow select { grid-column: 2 / -1; max-width: none; } .frow .x { grid-column: 3; grid-row: 1; }
  .dhead .meta .sep { display: none; }
  .top .wrap { gap: 12px; min-width: 0; } .brand .long { display: none; } .tabs { gap: 12px; margin-left: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; } .me .nm { display: none; } .me > button { padding: 4px; }
  .tabs { flex: 1 1 auto; }
  .strip { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } .strip > div:nth-child(odd) { border-left: 0; } .strip > div:nth-child(n+3) { border-top: 1px solid var(--line); } .strip > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .task { grid-template-columns: 16px 20px minmax(0, 1fr) auto auto; }
  .task .tctl { grid-column: 3 / -1; grid-row: 2; justify-content: flex-start; opacity: 1; } .task .tctl input.empty { display: block; }
  .trow { grid-template-columns: 18px minmax(0, 1fr); row-gap: 2px; } .trow.av3 { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .trow .ttl { white-space: normal; } .trow .meta { grid-column: 2; font-size: 12px; } .trow .meta:empty { display: none; } .trow .due { min-width: 0; text-align: left; font-size: 12px; } .trow .avs { grid-column: 3; grid-row: 1 / span 2; }
  .quick { grid-template-columns: 1fr 1fr; } .quick input[type="text"] { grid-column: 1 / -1; } .quick select, .quick input[type="date"] { max-width: none; }
  .tpanel { top: 0; width: 100vw; z-index: 45; } #tasksView.panel-open .tgroups { padding-right: 0; }
  .inbox li { grid-template-columns: 28px minmax(0, 1fr); } .inbox li .act { display: none; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
  .bar2 { grid-template-columns: 100px 1fr 44px; }
  .fact > summary { grid-template-columns: 1fr auto 18px; } .fact > summary .fval { grid-column: 1 / -1; text-align: left; max-width: none; }
  .ovl { margin-left: 0; display: flex; margin-top: 4px; }
}
/* On a phone the town picker is a sheet along the bottom edge over a dimmed page that holds still: the list scrolls
   between Select all and Apply, so Apply is always on screen, and a tap on the dimmed page closes it. */
@media (max-width: 640px) {
  #locPop { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: 75vh; max-height: 75dvh; display: flex; flex-direction: column; }
  #locPop .locs { flex: 1 1 auto; min-height: 0; max-height: none; }
  #locPop label { padding-block: 10px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / .35); cursor: pointer; }
  html:has(#locPop) { overflow: hidden; }
}
/* The three tabs must stay on screen on the narrowest phones: the strip scrolls without a scrollbar, so nothing may be cut off. */
@media (max-width: 420px) { .tabs { gap: 8px; } .tabs a { font-size: 13px; gap: 4px; } .tabs .n { padding: 0 5px; } }
@media (max-width: 359px) { .brand { display: none; } }
@media (prefers-reduced-motion: reduce) { .card, .pin, .hist i, .drop { transition: none; } }
