/* Stairtop proposal mockup — CMA route styles (comps.html only).
   Speaks the app's exact token vocabulary: teal chrome, yellow primary,
   restrained accents, 8px radius. Product register: dense, familiar, fast. */

.cmamain { min-width: 0; }
.cma-sec { margin-bottom: 16px; }

/* ---------- subject chips ---------- */

.subjectchips { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 8px; }
.subjectchips .fchip.demo { border-style: dashed; color: #8A6D1F; background: #FDF9E8; }

/* ---------- step bar: the walk-through spine ---------- */

.stepbar { list-style: none; display: flex; gap: 0; margin: 16px 0 20px; padding: 0; counter-reset: sb; border-bottom: 1px solid var(--line); }
.stepbar li {
  counter-increment: sb; flex: 1; text-align: center; font-size: 13px; color: var(--muted);
  padding: 10px 6px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; transition: color 0.18s ease-out, border-color 0.18s ease-out;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stepbar li::before { content: counter(sb); display: inline-block; width: 19px; height: 19px; line-height: 19px; margin-right: 7px; border-radius: 50%; background: #EDEFEF; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.stepbar li:hover { color: var(--ink); }
.stepbar li.done { color: var(--ink); }
.stepbar li.done::before { content: "✓"; background: var(--teal); color: #fff; }
.stepbar li.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--teal); }
.stepbar li.on::before { background: var(--yellow); color: var(--yellow-ink); }

.stepnav { display: flex; align-items: center; gap: 14px; margin: 20px 0 8px; }
.stepnav .stepnote { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); }
.stepnav .btn.dark { background: var(--teal); color: #fff; }

.cma-sec { animation: cmastep 0.22s ease-out; }
@keyframes cmastep { from { opacity: 0.4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cma-sec { animation: none; } }

/* ---------- step 1: the map ---------- */

#cma-map.leaflet-host { height: 560px; border: 1px solid var(--line); border-radius: var(--radius); z-index: 0; }
#cma-map.leaflet-host .leaflet-control-layers { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(2, 14, 18, 0.12); font: inherit; font-size: 13px; padding: 8px 10px; }
#cma-map.leaflet-host .leaflet-control-layers-overlays label { margin: 5px 0; display: block; }
#cma-map.leaflet-host .leaflet-tooltip { font: inherit; font-size: 12px; }
#cma-map.leaflet-host .leaflet-popup-content { font: inherit; font-size: 13px; line-height: 1.45; }
.mapchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.maplegend { position: absolute; z-index: 400; left: 10px; bottom: 10px; background: rgba(255,255,255,0.94); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; font-size: 12px; line-height: 1.7; }
.maplegend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* SVG fallback */
.cmasvg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #F2F4F3; }
.cmasvg .hood { fill: #E3E8E7; stroke: #B8C2C0; stroke-width: 1.2; }
.cmasvg .hood.subject { fill: #DCE7E4; stroke: var(--teal); stroke-width: 2; }
.cmasvg .hoodlabel { font-size: 13px; fill: var(--muted); text-anchor: middle; }
.cmasvg .hoodlabel.subject { fill: var(--teal); font-weight: 600; }
.cmasvg .pin { fill: var(--bad); stroke: #fff; stroke-width: 2; }
.maplayers { display: flex; gap: 8px; margin: 12px 0 6px; }
.maplayers .fchip { cursor: pointer; }
.maplayers .fchip.onchip { border-color: var(--teal); color: var(--teal); background: #EDF2F1; }

/* ---------- step 2: the filter surface — chips, air, zero native chrome ---------- */

.cmafilters { margin-bottom: 16px; }
.cf-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 14px 18px 16px; margin-bottom: 10px; }
.cf-gtitle { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.cf-gbody { display: flex; flex-wrap: wrap; gap: 14px 34px; }
.cf-field { display: flex; flex-direction: column; gap: 6px; }
.cf-field > label { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
  transition: border-color 0.15s ease-out, background 0.15s ease-out, color 0.15s ease-out;
}
.chip:hover { border-color: var(--teal); }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 500; }
.cf-hint { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.cf-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 4px 0; flex-wrap: wrap; }
.cf-count { font-size: 13px; color: var(--muted); }
.cf-count b { color: var(--ink); font-size: 15px; }
.cf-reset { font-size: 12.5px; color: var(--teal); background: none; border: 0; cursor: pointer; padding: 6px 2px; text-decoration: underline; }

.soldtable { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.soldrow { display: grid; grid-template-columns: 64px 1fr auto auto auto; gap: 12px; align-items: center; padding: 9px 14px 9px 9px; border-bottom: 1px solid var(--line); background: var(--card); transition: background 0.15s ease-out; }
.soldrow:last-child { border-bottom: 0; }
.soldrow:hover { background: #FAFBFA; }
.soldrow img { width: 64px; height: 46px; object-fit: cover; border-radius: 6px; }
.soldrow .sa { min-width: 0; }
.soldrow .sa strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soldrow .sa span { font-size: 12.5px; color: var(--muted); }
.soldrow .stag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: #EDF2F1; color: var(--teal); white-space: nowrap; }
.soldrow .stag.act { background: #FDF9E8; color: #8A6D1F; }
.soldrow .sp { font-size: 15px; font-weight: 600; text-align: right; }
.soldrow .sp small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.soldrow .sdom { font-size: 12.5px; color: var(--muted); text-align: right; min-width: 64px; }
.soldrow .sdom.slow { color: var(--warn); font-weight: 600; }
.rejectrows .row .pill { background: #FDF2F2; color: #B4443E; border: 0; }

/* ---------- step 3: dossier cards + the band that builds ---------- */

.bandbuild { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 14px 16px 16px; margin-bottom: 14px; }
.bandbuild .bb-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bandbuild .bb-top b { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.bandbuild .bb-top span { color: var(--muted); font-size: 13px; }
.bandbuild .bb-track { position: relative; height: 6px; border-radius: 999px; background: #EDEFEF; margin: 14px 0 6px; }
.bandbuild .bb-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--teal); opacity: 0.85; transition: left 0.25s ease-out, right 0.25s ease-out; }
.bandbuild .bb-dot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--yellow-ink); transform: translate(-50%, -50%); transition: left 0.25s ease-out; }
.bandbuild .bb-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

.cmacards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 22px 20px; }
.cmacard { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out; }
.cmacard.on { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }
.cmacard .cmphoto { position: relative; cursor: zoom-in; margin: 0; height: auto; overflow: visible; border-radius: 0; }
.cmacard img { width: 100%; height: 148px; object-fit: cover; display: block; }
.cmacard .crole { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 72px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(2, 14, 18, 0.78); color: #fff; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; }
.cmacard .star { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.92); font-size: 18px; line-height: 1; cursor: pointer; color: #9AA5A3; box-shadow: 0 1px 4px rgba(2,14,18,0.18); transition: transform 0.15s ease-out, color 0.15s ease-out; }
.cmacard .star:hover { transform: scale(1.08); }
.cmacard .star.on { color: #C79A2A; }
.cmacard .cbody { padding: 11px 13px 13px; }
.cmacard .ctop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmacard .ctop strong { font-size: 14.5px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmacard .cexpand { border: 0; background: none; color: var(--teal); font-size: 12.5px; cursor: pointer; text-decoration: underline; white-space: nowrap; padding: 2px; }
.cmacard .cmeta { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.cmacard .cfits { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 9px; }
.cmacard .cfits span { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: #EEF6F0; color: #14683A; }
.cmacard .cfits span.no { background: #FDF4EA; color: #9A5B12; }
.cmacard .cread { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; font-size: 13px; color: var(--ink); background: var(--bg); resize: vertical; min-height: 48px; }
.cmacard .cread:focus { outline: 2px solid var(--teal); outline-offset: -1px; }

/* expanded comp view */
.cmodal-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(2, 14, 18, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.cmodal { background: var(--card); border-radius: 10px; max-width: 760px; width: 100%; max-height: 92vh; overflow: auto; }
.cmodal img { width: 100%; height: 320px; object-fit: cover; display: block; }
.cmodal .cm-body { padding: 18px 22px 22px; }
.cmodal .cm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cmodal h3 { margin: 0; font-size: 20px; font-weight: 600; }
.cmodal .cm-price { font-size: 20px; font-weight: 600; white-space: nowrap; }
.cmodal .cm-facts { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 14px; }
.cmodal .cm-cols { display: flex; gap: 20px; }
.cmodal .cm-col { flex: 1; min-width: 0; }
.cmodal .cm-col h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.02em; color: var(--muted); font-weight: 600; }
.cmodal .cm-col li { font-size: 13px; margin: 4px 0; }
.cmodal .cm-actions { display: flex; gap: 10px; margin-top: 16px; }
.cmodal .cm-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.92); font-size: 18px; cursor: pointer; box-shadow: 0 1px 4px rgba(2,14,18,0.25); }
.cmodal .cm-photo { position: relative; }
@media (max-width: 640px) { .cmodal .cm-cols { display: block; } .cmodal img { height: 220px; } }

/* ---------- step 4: competition sheet ---------- */

.absorbline { display: flex; gap: 26px; margin: 2px 0 14px; flex-wrap: wrap; }
.absorbline div b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.absorbline div span { font-size: 12px; color: var(--muted); }
.sheetcols { display: flex; gap: 18px; }
.sheetcol { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--card); }
.srow { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.srow:last-child { border-bottom: 0; }
.srow strong { font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow span { color: var(--muted); white-space: nowrap; }
.srow.stale span { color: var(--warn); }

/* ---------- step 5: the close, staged ---------- */

#sec-close { background: var(--teal); border-color: var(--teal); color: #E8F0F2; }
#sec-close .card-head h2 { color: #fff; }
#sec-close .card-head .src { color: #9FB6BD; }
#sec-close .railsay { color: #DCE8EB; font-size: 16.5px; line-height: 1.6; max-width: 62ch; }
#sec-close .sub { color: #C3D4D9; }
#sec-close .note { color: #8FA6AD; }
.closegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.closecard { text-align: left; border: 1px solid rgba(255,255,255,0.16); border-radius: var(--radius); overflow: hidden; background: rgba(255,255,255,0.05); color: #E8F0F2; cursor: pointer; padding: 0 0 11px; font: inherit; transition: border-color 0.15s ease-out, background 0.15s ease-out; }
.closecard:hover { background: rgba(255,255,255,0.09); }
.closecard img { width: 100%; height: 108px; object-fit: cover; display: block; margin-bottom: 9px; }
.closecard strong { display: block; padding: 0 11px; font-size: 13.5px; }
.closecard span { display: block; padding: 1px 11px 0; color: #9FB6BD; font-size: 12.5px; }
.closecard em { display: block; padding: 5px 11px 0; font-size: 12.5px; font-style: normal; color: #C3D4D9; }
.closecard.picked { border-color: var(--yellow); background: rgba(232, 227, 110, 0.10); }
.closeline { margin: 12px 0 4px; font-size: 15px; }
.closeline b { color: var(--yellow); font-size: 19px; }
#sec-close .btn.dark { background: var(--yellow); color: var(--yellow-ink); }
#sec-close .btn.ghost { border-color: rgba(255,255,255,0.3); color: #E8F0F2; }

/* ---------- responsive ---------- */

@media (max-width: 900px) { .sheetcols { display: block; } .sheetcol + .sheetcol { margin-top: 12px; } }
@media (max-width: 720px) {
  .stepbar li { font-size: 0; }
  .stepbar li::before { font-size: 11.5px; margin-right: 0; }
  .soldrow { grid-template-columns: 52px 1fr auto; }
  .soldrow .sdom, .soldrow .stag { display: none; }
  #cma-map.leaflet-host { height: 420px; }
}

/* card vitals: readable at a glance */
.cmacard .cprice { font-size: 17px; font-weight: 600; margin: 2px 0 6px; }
.cmacard .cprice small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.cmacard .cfacts { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 7px; }
.cmacard .cfacts span { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

/* draw-a-border control */
.drawctl a { font-size: 15px; line-height: 26px; }
.drawctl a.on { background: var(--yellow); }

/* price-pill pins */
.pricepin { display: inline-block; padding: 3px 9px; border-radius: 999px; font: 600 11.5px/1.4 "Be Vietnam Pro", system-ui, sans-serif; color: #fff; background: var(--teal); border: 2px solid #fff; box-shadow: 0 1px 5px rgba(2,14,18,0.35); white-space: nowrap; cursor: pointer; }
.pricepin.active { background: #8A6D1F; }
.pricepin.pending { background: #6B7A80; }
.pricepin.subject { background: var(--yellow); color: var(--yellow-ink); letter-spacing: 0.04em; font-size: 10.5px; }

/* polished map furniture */
#cma-map.leaflet-host .leaflet-control-layers { padding: 10px 13px 12px; min-width: 190px; }
#cma-map.leaflet-host .leaflet-control-layers-base label, #cma-map.leaflet-host .leaflet-control-layers-overlays label { margin: 6px 0; display: flex; align-items: center; gap: 7px; cursor: pointer; }
#cma-map.leaflet-host .leaflet-control-layers input { accent-color: var(--teal); }
#cma-map.leaflet-host .leaflet-control-layers-separator { margin: 8px -13px; border-top: 1px solid var(--line); }
#cma-map.leaflet-host .leaflet-bar { border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(2,14,18,0.12); }
#cma-map.leaflet-host .leaflet-bar a { color: var(--ink); }
.drawctl a { font-size: 15px; }
.drawctl a.on { background: var(--yellow) !important; }

/* verify bar (step 1) */
.verifybar { margin: 2px 0 14px; }
.verifybar .cvfacts { display: flex; flex-direction: row; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.verifybar .vrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.verifybar .vask { font-size: 13px; color: var(--muted); }
.verifybar .vok { font-size: 13.5px; font-weight: 600; color: var(--ok); }

/* draw mode: the map owns every click — pins, polygons and popups go inert */
#cma-map.drawing { cursor: crosshair; }
#cma-map.drawing .leaflet-marker-icon,
#cma-map.drawing .leaflet-marker-icon *,
#cma-map.drawing path.leaflet-interactive { pointer-events: none !important; }
