/* ===========================================================================
   The Screener (tab 3). Ships with screener.js — the pair is the whole feature.
   Everything reads the tokens declared in styles.css :root.

   Desktop-primary, and deliberately so: a side-by-side comparison at 375px is
   two 187px columns. Below 900px the split unstacks (see the media query at the
   end) and the phone keeps 16px inputs / 38px targets like the rest of the app.
   ========================================================================= */

.screener { font-variant-numeric: tabular-nums; }
.screener .sc-split { display: grid; grid-template-columns: 1fr 1fr; }
.screener .sc-side { background: var(--card); min-width: 0; display: flex; flex-direction: column; }
.screener .sc-side.left { border-right: 2px solid #cbd5e1; }

/* ---------------------------------------------------------------- band 1 */
.sc-band1 {
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: stretch; gap: 12px; padding: 8px 10px;
}
.sc-b1lab {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; align-self: center; line-height: 1.2; white-space: nowrap;
}
.sc-rail { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.sc-bkt {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  padding: 5px 10px 6px; text-align: left; min-width: 92px; line-height: 1.2;
  display: flex; flex-direction: column; gap: 2px; font-family: inherit;
}
.sc-bkt:hover:not(:disabled) { border-color: #94a3b8; background: #fbfcfe; }
.sc-bkt .k { font-size: 17px; font-weight: 700; color: var(--ink); }
.sc-bkt .m { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sc-bkt.active { background: var(--navy); border-color: var(--navy); }
.sc-bkt.active .k, .sc-bkt.active .m { color: #fff; }
.sc-bkt.active .m { opacity: .82; }
.sc-bkt:disabled { opacity: .42; cursor: not-allowed; background: #f8fafc; }
.sc-bkt:disabled .k { font-weight: 500; }

.sc-mkt {
  flex: 0 0 auto; border-left: 1px solid var(--line); padding-left: 12px;
  display: flex; align-items: center; gap: 12px;
}
.sc-fig { line-height: 1.15; }
.sc-fig .lab {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.sc-fig .val { font-size: 21px; font-weight: 700; }
.sc-fig .val.up { color: var(--ok); }
.sc-fig .val.dn { color: var(--err); }
.sc-fig .sub { font-size: 11.5px; color: var(--muted); }
.sc-fig .sub.warn { color: var(--warn); font-weight: 600; }
.sc-apply {
  border: 1px solid #b6c4de; background: var(--shir-blue); color: var(--shir-ink);
  font: 600 12.5px/1 inherit; padding: 8px 9px; border-radius: 5px; cursor: pointer;
  white-space: nowrap; align-self: center;
}
.sc-apply:hover:not(:disabled) { background: #c9d5ec; }
.sc-apply:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- band 2 */
.sc-band2 { border-bottom: 2px solid #cbd5e1; }
.sc-head { padding: 7px 11px 6px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sc-htop { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-name {
  font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0;
}
.sc-facts {
  font-size: 12.5px; color: var(--muted); margin-top: 1px;
  display: flex; gap: 9px; flex-wrap: wrap;
}
.sc-facts .flag { color: var(--warn); font-weight: 600; }
.sc-tag {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  letter-spacing: .03em; white-space: nowrap; flex: 0 0 auto;
}
.sc-tag.subject { background: #e2e8f0; color: #334155; }
.sc-tag.direct { background: #dbeafe; color: #1e40af; }
.sc-tag.aspirational { background: var(--ok-bg); color: #14532d; }
.sc-tag.inferior { background: var(--err-bg); color: #7f1d1d; }
.sc-tag.untyped { background: var(--warn-bg); color: #78350f; }

.sc-cyc { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.sc-cyc button {
  width: 27px; height: 27px; border: 1px solid var(--line); background: #fff;
  border-radius: 5px; cursor: pointer; font-size: 14px; color: var(--ink);
  display: grid; place-items: center; font-family: inherit;
}
.sc-cyc button:hover { background: #f1f5f9; border-color: #94a3b8; }
.sc-cyc .pos {
  font-size: 12.5px; color: var(--muted); min-width: 48px; text-align: center; font-weight: 600;
}
.sc-dots { display: flex; gap: 3px; align-items: center; margin-left: 2px; }
.sc-dot {
  width: 7px; height: 7px; border-radius: 99px; background: #cbd5e1;
  border: none; padding: 0; cursor: pointer;
}
.sc-dot.on { background: var(--navy); transform: scale(1.32); }
.sc-dot.absent { background: transparent; border: 1px solid #cbd5e1; cursor: not-allowed; }

.sc-body { flex: 1 1 auto; overflow-y: auto; }
/* Nine rows visible, scroll for the rest — the same count a COMPS section holds.
   9 * 27px + 24px sticky header. */
.sc-scroll9 { max-height: 267px; }

table.sc-mix { width: 100%; border-collapse: collapse; font-size: 14px; }
table.sc-mix th {
  position: sticky; top: 0; background: #f8fafc; z-index: 2;
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; text-align: right; padding: 4px 8px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.sc-mix th.l, table.sc-mix td.l { text-align: left; }
table.sc-mix td {
  padding: 3px 8px; text-align: right; border-bottom: 1px solid #f1f5f9;
  white-space: nowrap; height: 27px;
}
table.sc-mix tbody tr.anchor { background: #eef4ff; }
table.sc-mix tbody tr.anchor td { border-bottom-color: #c9dcff; }
table.sc-mix tbody tr.sc-pick { cursor: pointer; }
table.sc-mix tbody tr.sc-pick:hover { background: #f8fafc; }
table.sc-mix tbody tr.anchor:hover { background: #e6efff; }
table.sc-mix .plan { font-weight: 600; }
table.sc-mix .rent { font-weight: 700; }
table.sc-mix .psf { color: var(--muted); font-size: 12.5px; }

.sc-near { font-size: 10.5px; color: var(--direct); font-weight: 700; letter-spacing: .04em; }
.sc-st {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px;
  border-radius: 3px; text-transform: uppercase;
}
.sc-st.orig { background: #f1f5f9; color: #475569; }
.sc-st.part { background: var(--warn-bg); color: #78350f; }
.sc-st.reno { background: #e0e7ff; color: #3730a3; }
.sc-st.none { background: transparent; color: var(--muted); }
.sc-vac { color: var(--muted); font-size: 13px; }
.sc-vac.hi { color: var(--warn); font-weight: 700; }

.sc-dlt {
  font-weight: 700; font-size: 13px; padding: 1px 6px; border-radius: 4px;
  display: inline-block; min-width: 50px; text-align: right;
}
.sc-dlt.up { background: var(--ok-bg); color: #14532d; }
.sc-dlt.dn { background: var(--err-bg); color: #7f1d1d; }
.sc-dlt.flat { background: #f1f5f9; color: #475569; }

/* The market-rent input carries three states.
   seed = came from the proforma and nobody has confirmed it -> grey
   user = typed here -> SHIR ink, the app's "you own this cell" colour
   none = no value anywhere -> red, because an unpriced plan is an error */
.sc-mrent {
  width: 68px; font: 700 13px/1 inherit; text-align: right; padding: 3px 5px;
  border: 1px solid #b6c4de; border-radius: 4px;
  background: var(--shir-blue); color: var(--shir-ink);
}
.sc-mrent.seed { color: #94a3b8; font-weight: 600; }
.sc-mrent.user { color: var(--shir-ink); }
.sc-mrent.none { background: var(--err-bg); border-color: #f87171; }
.sc-mrent.none::placeholder { color: var(--err); opacity: 1; }
.sc-mrent.sample { width: 34px; height: 17px; padding: 0; vertical-align: middle; }

.sc-foot {
  flex: 0 0 auto; border-top: 1px solid var(--line); background: #fbfcfe;
  padding: 5px 11px; display: flex; gap: 14px; align-items: baseline;
  font-size: 12.5px; flex-wrap: wrap;
}
.sc-foot .kv { display: flex; gap: 5px; align-items: baseline; }
.sc-foot .kv .k {
  color: var(--muted); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600;
}
.sc-foot .kv .v { font-weight: 700; font-size: 15px; }
.sc-foot .kv .k.warn, .sc-foot .kv .v.warn { color: var(--warn); }
.sc-foot .kv .v.up { color: var(--ok); }
.sc-foot .kv .v.dn { color: var(--err); }

.sc-empty {
  display: grid; place-items: center; min-height: 120px; text-align: center;
  padding: 18px; color: var(--muted); font-size: 14px; gap: 4px;
}
.sc-empty .big { font-size: 17px; font-weight: 600; color: var(--ink); }

/* ---------------------------------------------------------------- band 3 */
.sc-band3 { border-bottom: 2px solid #cbd5e1; }
.sc-attrs { padding: 8px 11px 10px; display: flex; gap: 9px; align-items: flex-start; }
.sc-panel { flex: 1 1 0; min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.sc-panel > h4 {
  margin: 0; padding: 3px 7px; background: #f8fafc; border-bottom: 1px solid var(--line);
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--navy);
  font-weight: 700; display: flex; justify-content: space-between; gap: 6px; align-items: baseline;
}
.sc-panel > h4 .cov {
  color: var(--muted); font-weight: 600; letter-spacing: .02em;
  text-transform: none; font-size: 10.5px;
}
.sc-panel > h4 .src {
  color: var(--warn); font-weight: 700; letter-spacing: .02em; text-transform: none;
  font-size: 10px; border-bottom: 1px dotted var(--warn); cursor: help;
}
table.sc-arow { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.sc-arow td { padding: 1px 6px; border-bottom: 1px solid #f4f7fa; height: 19px; }
table.sc-arow td.al {
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 1px; width: 99%;
}
table.sc-arow td.av { text-align: right; white-space: nowrap; width: 1%; }
table.sc-arow tr:hover td { background: #fafbfd; }

.sc-g {
  display: inline-block; width: 15px; height: 15px; line-height: 15px;
  border-radius: 99px; font-size: 11px; font-weight: 700; text-align: center;
}
.sc-g.y { background: var(--ok-bg); color: var(--ok); }
.sc-g.n { background: var(--err-bg); color: var(--err); }
.sc-g.b { color: #cbd5e1; font-weight: 400; }
.sc-txt {
  font-size: 10.5px; font-weight: 700; color: var(--warn);
  background: var(--warn-bg); padding: 1px 4px; border-radius: 3px;
}
.sc-fee { font-weight: 600; font-size: 12.5px; }
.sc-fee.zero { color: #cbd5e1; font-weight: 400; }

/* ---------------------------------------------------------------- band 4 */
.sc-photos { padding: 8px 11px 10px; }
.sc-phead {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.sc-phead .cov { text-transform: none; letter-spacing: .02em; font-weight: 600; }
.sc-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sc-shot { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: #f8fafc; }
.sc-shot img { display: block; width: 100%; aspect-ratio: 300 / 220; object-fit: cover; }
.sc-shot .cap {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 2px 6px; background: #fff; border-top: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sc-shot.none {
  border-style: dashed;
  background: repeating-linear-gradient(45deg, #fbfcfe, #fbfcfe 6px, #f4f7fa 6px, #f4f7fa 12px);
}
.sc-shot.none .ph {
  aspect-ratio: 300 / 220; display: grid; place-items: center; color: #b6c2d2;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}

.sc-legend {
  background: var(--card); padding: 5px 11px; display: flex; gap: 13px; align-items: center;
  font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); flex-wrap: wrap;
}
.sc-legend i { font-style: normal; display: inline-flex; align-items: center; gap: 4px; }

/* ------------------------------------------------------------------ phone
   The split is a desktop idea. Below 900px each side becomes a full-width
   block, in reading order: subject, then the comp, then attributes, then
   photos. Inputs go back to 16px so iOS does not zoom the viewport on focus,
   and rows grow to a thumb target. */
@media (max-width: 899px) {
  .screener .sc-split { grid-template-columns: 1fr; }
  .screener .sc-side.left { border-right: none; border-bottom: 2px solid #cbd5e1; }
  .sc-band1 { flex-wrap: wrap; }
  .sc-mkt { border-left: none; padding-left: 0; width: 100%; flex-wrap: wrap; }
  .sc-scroll9 { max-height: 340px; }
  table.sc-mix td { height: 38px; padding: 5px 8px; }
  .sc-mrent { width: 78px; font-size: 16px; padding: 7px 6px; }
  .sc-attrs { flex-direction: column; }
  .sc-panel { width: 100%; }
  table.sc-arow td { height: 30px; }
  .sc-cyc button { width: 38px; height: 38px; }
}
