/* Relist. Dark navy, gold accent: the same brand tokens as the rest of Top Agent's tools.
   Scene: Jay at his desk at 7am with coffee, working a call list on a big monitor. Dense rows, calm surface. */
:root {
  --ground: #0a1230;
  --surface: #121a33;
  --panel: #18213d;
  --raise: #1f2a4b;
  --line: #28325a;
  --line-strong: #3e4870;
  --ink: #f2f3f6;
  --ink-2: #b3bacb;
  --ink-3: #8b93a8;
  --gold: #d6b25a;
  --gold-hi: #e8c97a;
  --gold-tint: #2b2516;
  --good: #4fc283;
  --good-tint: #16301f;
  --bad: #f0655c;
  --bad-tint: #3a1a18;
  --warn: #e9a23b;
  --warn-tint: #3a2a12;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r: 6px;
  --z-sticky: 10; --z-drawer: 20; --z-toast: 40;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--ink-3); opacity: 1; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Top bar */
.top { position: sticky; top: 0; z-index: var(--z-sticky); height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; }
.mark { width: 10px; height: 10px; background: var(--gold); border-radius: 2px; transform: rotate(45deg); align-self: center; }
.wordmark { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brandsub { color: var(--ink-3); font-size: 12px; }
.scanstate { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; margin-left: auto; min-width: 0; }
.scanstate .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.scanstate .dot.live { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.scanstate .dot.ok { background: var(--good); }
.scanstate .dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.topactions { display: flex; gap: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.btn:hover { background: var(--raise); border-color: #4a5580; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1607; font-weight: 600; }
.btn.primary:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr) auto; min-height: calc(100vh - 56px); }
.rail { border-right: 1px solid var(--line); background: var(--surface); padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
.railsec h3 { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; text-transform: uppercase; margin: 0 8px 8px; }
.railsec.rule { margin-top: auto; }
.railsec.rule p { margin: 0 8px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }

.lanes { display: flex; flex-direction: column; gap: 2px; }
.lane { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); border: 0; background: transparent; color: var(--ink-2); text-align: left; cursor: pointer; width: 100%; transition: background .12s var(--ease), color .12s var(--ease); }
.lane:hover { background: var(--panel); color: var(--ink); }
.lane[aria-current="true"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.lane .ln { flex: 1; }
.lane .lc { font-family: var(--mono); font-size: 12px; color: var(--ink-3); min-width: 22px; text-align: right; }
.lane[aria-current="true"] .lc { color: var(--gold); }
.lane .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--ink-3); }
.lane[data-lane="off_market"] .sw { background: var(--good); }
.lane[data-lane="expiring"] .sw { background: var(--gold); }
.lane[data-lane="stuck"] .sw { background: var(--warn); }
.lane[data-lane="cut"] .sw { background: var(--bad); }
.lane[data-lane="all"] .sw, .lane[data-lane="watch"] .sw { background: var(--ink-3); }

.terr { display: flex; flex-direction: column; }
.terr label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r); cursor: pointer; color: var(--ink-2); font-size: 13px; }
.terr label:hover { background: var(--panel); color: var(--ink); }
.terr label.cur { color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong); }
.terr input { accent-color: var(--gold); margin: 0; }
.terr .tl { flex: 1; }
.terr .tc { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.terr .tc.never { color: var(--line-strong); }
.terr label.off { color: var(--ink-3); }
.tgroup { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; text-transform: uppercase; margin: 10px 8px 4px; display: flex; justify-content: space-between; }
.tgroup span { font-family: var(--mono); font-weight: 400; }
.addterr { display: flex; gap: 6px; padding: 6px 8px 0; }
.addterr input { flex: 1; min-width: 0; }

.fld { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 10px; font-size: 12px; color: var(--ink-3); }
input, select, textarea { background: var(--ground); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 6px 8px; color: var(--ink); height: 32px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
input:hover, select:hover, textarea:hover { border-color: #4a5580; }
textarea { height: auto; min-height: 88px; resize: vertical; line-height: 1.45; }

/* Board */
.board { min-width: 0; padding: 20px 24px 60px; }
.boardhead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.boardhead h1 { font-size: 18px; letter-spacing: -0.01em; }
.boardhead p { margin: 0; color: var(--ink-3); font-size: 13px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.grid { width: 100%; border-collapse: collapse; min-width: 1120px; }
.grid th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-3); padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: #151e3c; }
.grid tbody tr[aria-selected="true"] td { background: var(--panel); box-shadow: inset 3px 0 0 var(--gold); }
.grid tbody tr:last-child td { border-bottom: 0; }
.c-score { width: 78px; } .c-prop { width: 250px; } .c-price { width: 150px; } .c-days { width: 132px; } .c-agent { width: 210px; } .c-stage { width: 138px; }

.score { font-family: var(--mono); font-size: 18px; font-weight: 600; line-height: 1; }
.score.hi { color: var(--gold-hi); } .score.mid { color: var(--ink); } .score.lo { color: var(--ink-2); }
.lanechip { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; background: var(--raise); color: var(--ink-2); }
.lanechip.off_market { background: var(--good-tint); color: var(--good); }
.lanechip.expiring { background: var(--gold-tint); color: var(--gold-hi); }
.lanechip.stuck { background: var(--warn-tint); color: var(--warn); }
.lanechip.cut { background: var(--bad-tint); color: var(--bad); }
.addr { font-weight: 600; }
.sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; white-space: nowrap; }
.addr { white-space: nowrap; }
.price { font-family: var(--mono); font-weight: 500; }
.cut { display: block; white-space: nowrap; margin-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--bad); }
.cut .when { color: var(--ink-3); }
.days { font-family: var(--mono); font-weight: 500; }
.dombar { position: relative; height: 2px; margin-top: 8px; background: var(--line); border-radius: 1px; width: 100px; }
.dombar i { position: absolute; top: 0; left: 0; height: 100%; background: var(--ink-3); border-radius: 1px; }
.dombar b { position: absolute; top: -3px; width: 1px; height: 8px; background: var(--line-strong); }
.dombar b.m90 { left: 50%; } .dombar b.m180 { left: 100%; }
.dombar.exp i { background: var(--gold); }
.dombar.late i { background: var(--warn); }
.domhint { font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.domhint.exp { color: var(--gold-hi); }
.agent { font-weight: 500; }
.sig { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.sig span { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.sig span.up { color: var(--bad); } .sig span.ok { color: var(--good); } .sig span.dim { color: var(--ink-3); }
.stagesel { height: 30px; padding: 4px 26px 4px 8px; font-size: 13px; width: 100%; }
.stagesel.contacted { border-color: var(--gold); } .stagesel.appointment { border-color: var(--good); color: var(--good); }
.stagesel.won { border-color: var(--good); background: var(--good-tint); color: var(--good); }
.stagesel.dead, .stagesel.skip { color: var(--ink-3); }

/* Skeleton */
.sk td { padding: 14px 12px; }
.sk .bar { height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--panel) 0%, var(--raise) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk .bar + .bar { margin-top: 8px; width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty */
.empty { padding: 56px 24px; text-align: center; color: var(--ink-2); }
.empty h2 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 auto; max-width: 46ch; }
.empty .btn { margin-top: 18px; }

/* Drawer */
.drawer { width: 420px; border-left: 1px solid var(--line); background: var(--surface); position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; padding: 20px 20px 40px; animation: slidein .2s var(--ease); }
@keyframes slidein { from { opacity: 0; transform: translateX(8px); } }
.dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dhead h2 { font-size: 17px; line-height: 1.25; letter-spacing: -0.01em; }
.dhead .sub { margin-top: 4px; }
.close { width: 30px; height: 30px; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--ink-3); cursor: pointer; flex: none; font-size: 18px; line-height: 1; }
.close:hover { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.dprice { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 4px; }
.dprice .price { font-size: 22px; font-weight: 600; }
.dprice .score { font-size: 14px; }
.verdict { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.verdict.go { background: var(--good-tint); border-color: #245a3a; color: #d8f3e3; }
.verdict.hold { background: var(--gold-tint); border-color: #5a4a1e; color: #f3e8c6; }
.verdict b { display: block; margin-bottom: 2px; }
.reasons { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.reasons li { padding-left: 14px; position: relative; color: var(--ink-2); font-size: 13px; }
.reasons li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 1px; background: var(--gold); }
.dsec { margin-top: 22px; }
.dsec h3 { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; text-transform: uppercase; margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; }
.facts div { display: flex; flex-direction: column; gap: 1px; }
.facts span { color: var(--ink-3); font-size: 11px; }
.facts strong { font-weight: 500; font-family: var(--mono); font-size: 13px; }
.facts strong.sans { font-family: var(--sans); }
.stagebtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stagebtns .btn { justify-content: center; padding: 0 8px; font-size: 13px; }
.stagebtns .btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1607; font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.timeline li { display: grid; grid-template-columns: 82px 1fr; gap: 10px; }
.timeline .when { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.timeline .k { color: var(--ink-2); }
.timeline .k.price_cut { color: var(--bad); } .timeline .k.off_market { color: var(--good); font-weight: 600; } .timeline .k.first_seen { color: var(--ink-3); }
.notes textarea { width: 100%; }
.saved { font-size: 12px; color: var(--ink-3); margin-top: 4px; min-height: 16px; }
.desc { color: var(--ink-2); font-size: 13px; line-height: 1.5; max-height: 160px; overflow: auto; }
.dphoto { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--r); margin-top: 14px; background: var(--panel); }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); padding: 10px 14px; border-radius: var(--r); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: rise .18s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (max-width: 1180px) { .drawer { position: fixed; right: 0; top: 56px; z-index: var(--z-drawer); box-shadow: -20px 0 40px rgba(0,0,0,.4); } .shell { grid-template-columns: 248px minmax(0, 1fr); } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .drawer { width: 100%; } .brandsub, .scanstate { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Login and password gates */
.gate { position: fixed; inset: 0; z-index: var(--z-drawer); background: var(--ground); display: grid; place-items: center; padding: 20px; }
.gatecard { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.gatecard .brand { margin-bottom: 6px; }
.gatecard .fld { padding: 0; }
.gatecard h2 { font-size: 16px; }
.gatehelp { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.gateerr { color: var(--bad); font-size: 13px; min-height: 18px; }
.gateactions { display: flex; justify-content: flex-end; gap: 8px; }
.gatecard .btn.primary { justify-content: center; }
.workerwarn { background: var(--warn-tint); border: 1px solid #5a4514; color: #f3dfb0; padding: 8px 12px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; }
