:root{
  font-family:var(--font-ui);
  color:var(--text);background:var(--surface);
  --fg:var(--text);--dim:var(--text-muted);--line:var(--border);--focus:var(--accent);
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--surface);color:var(--fg)}
body{min-height:100vh}
main{padding:.65rem}
.shell-title{font-weight:700;margin:0 0 .45rem;letter-spacing:.04em}
.breadcrumb{font-size:.82rem;min-height:1.1rem;margin:0 0 .45rem;color:var(--text-muted)}
.breadcrumb .sep{padding:0 .28rem;color:#666}
.flow-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7rem;align-items:start}
.stage{border-left:1px solid var(--line);padding:.15rem .45rem;min-width:0;background:var(--surface)}
.stage h2{font-size:.82rem;font-weight:400;margin:0 0 .42rem;color:#8c8c8c}
.option-list{display:flex;flex-direction:column;gap:.08rem}
.option{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:.3rem;align-items:start;min-height:1.35rem}
.option label{cursor:pointer;line-height:1.25;overflow-wrap:anywhere}
.option input{margin:.14rem 0 0;accent-color:#ddd}
.option:hover label,.option:focus-within label{background:#e8e8e8;color:#000}
.help-wrap{position:relative;display:inline-flex}
.help-trigger{border:0;background:var(--surface);color:var(--text-muted);padding:0;font:inherit;font-size:.72rem;cursor:help}
.help-trigger:hover,.help-trigger:focus{color:var(--control-text);outline:none}
.help-pop{display:none;position:absolute;right:0;top:1.15rem;z-index:50;width:min(26rem,80vw);padding:.4rem .5rem;border:1px solid #777;background:var(--surface);color:var(--control-text);font-size:.75rem;line-height:1.3;box-shadow:none}
.help-wrap:hover .help-pop,.help-wrap:focus-within .help-pop,.help-wrap.open .help-pop{display:block}
.context-panel,.form-panel,.results-panel{margin-top:.7rem;border-top:1px solid var(--line);padding-top:.55rem}
.context-panel h2,.form-panel h2,.results-panel h2{font-size:.9rem;margin:.1rem 0 .45rem}
.route-card{padding:.25rem 0;margin:.25rem 0;color:var(--text-muted)}
.levels{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.7rem}
.level{border-left:1px solid var(--line);padding:.25rem .45rem}
.level h3{font-size:.82rem;font-weight:400;color:var(--text-muted);margin:0 0 .45rem}
.fields{display:flex;flex-direction:column;gap:.42rem}
.field{display:flex;flex-direction:column;gap:.15rem}
.field-head{display:flex;align-items:center;gap:.25rem;font-size:.78rem}
.field input[type=text],.field input[type=number],.field input[type=date],.field textarea{
 width:100%;padding:.25rem .3rem;border:1px solid var(--control-border);background:var(--surface);color:var(--control-text);font:inherit;border-radius:0
}
.choices{display:flex;flex-wrap:wrap;gap:.25rem .7rem;font-size:.8rem}
.actions{margin-top:.55rem;display:flex;gap:.5rem;flex-wrap:wrap}
.actions button{padding:.28rem .45rem;border:1px solid #888;background:var(--surface);color:var(--control-text);font:inherit;border-radius:0}
.actions button:hover,.actions button:focus{background:#fff;color:#000}
.preview{margin-top:.55rem;padding:.35rem 0;border-top:1px dashed #555}
.mini-ad{display:inline;line-height:1.45;word-break:normal}
.mini-ad span{white-space:normal;margin-right:.35rem}
.mini-ad.featured{background:var(--featured);padding:.05rem .12rem}
.result-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}
.result{border-bottom:1px solid var(--border);padding:.3rem 0;min-width:0}
.result .meta{font-size:.7rem;color:var(--text-muted);margin-top:.15rem}
.need-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.55rem}
.need{border-left:1px solid #444;padding:.2rem .4rem}
.need strong{display:block;font-size:.78rem}
.need ul{padding-left:1rem;margin:.2rem 0;font-size:.75rem}
.empty{color:var(--text-muted)}.multi-toggle{font-size:.72rem;color:var(--text-muted);margin:.2rem 0 .35rem}
.mode-note{font-size:.74rem;color:var(--text-muted);margin:.25rem 0}
@media(max-width:1100px){.flow-grid,.result-grid,.need-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.levels{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.flow-grid,.result-grid,.need-grid,.levels{grid-template-columns:repeat(2,minmax(0,1fr))}main{padding:.45rem}.stage{padding:.12rem .3rem}.help-pop{position:fixed;left:4vw;right:4vw;top:auto;bottom:.6rem;width:auto}}

.breadcrumb{font-size:.9rem;font-weight:700;color:var(--control-text);margin-bottom:.65rem;min-height:1.25rem}
.option label[title]{text-decoration:none}

.option{cursor:pointer}.option label{pointer-events:none}

.crumb-link{
  border:0;
  padding:0;
  margin:0;
  background:var(--surface);
  color:var(--control-text);
  font:inherit;
  font-weight:700;
  cursor:pointer;
}
.crumb-link:hover,.crumb-link:focus{
  text-decoration:underline;
  outline:none;
}

.level-summary{margin:.3rem 0 .65rem;border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:.25rem 0}
.summary-row{line-height:1.45;font-size:.76rem}
.summary-row span{margin-right:.7rem;white-space:normal}
.active-level{max-width:70rem;border-left:1px solid #555}
.property-block{margin:0 0 .55rem}
.property-block h4{font-size:.72rem;font-weight:400;text-transform:uppercase;color:var(--text-muted);margin:.15rem 0 .3rem}

.flow-grid{grid-auto-flow:row;grid-auto-rows:auto}
.stage{width:auto}

.stage h2{margin:0 0 .35rem;color:var(--text-muted)}

.property-groups{display:flex;flex-direction:column;gap:.55rem}
.property-block{margin:0;padding:.2rem 0;border-top:1px solid #292929}
.property-block h4{font-size:.72rem;font-weight:400;color:var(--text-muted);margin:.1rem 0 .3rem}
.field-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.42rem .7rem;align-items:start}
.field-grid .field{min-width:0}
@media(max-width:1100px){.field-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){.field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

.storefront-filters{margin-top:.5rem}
.storefront-filters .field{margin:.35rem 0}
.filter-range{display:grid;grid-template-columns:1fr 1fr;gap:.4rem}
.storefront-filter .choices{display:flex;flex-wrap:wrap;gap:.45rem}

.search-cascade{margin-top:.35rem}
.search-combo-row{display:flex;flex-wrap:wrap;gap:.55rem;align-items:end}
.search-combo,.l1-filter-combo{min-width:12rem;max-width:22rem;padding:.45rem .55rem}
.storefront-filters{margin-top:.6rem}
@media (max-width:700px){
  .search-combo,.l1-filter-combo{min-width:100%;max-width:100%}
}

.storefront-result-head{display:flex;align-items:baseline;justify-content:space-between;gap:.7rem}
.storefront-view-switcher{display:flex;gap:.35rem;flex-wrap:wrap;margin:.25rem 0 .65rem}
.storefront-view-button,.storefront-load-more{font:inherit;border:1px solid var(--control-border);background:var(--surface);color:var(--control-text);padding:.3rem .48rem;cursor:pointer;border-radius:0}
.storefront-view-button[aria-pressed="true"],.storefront-view-button:hover,.storefront-load-more:hover{background:#fff;color:#000}
.storefront-mini-list{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.55rem}
.storefront-mini{border-bottom:1px solid var(--border);padding:.35rem 0;min-width:0}
.storefront-mini-atom{display:block;font-size:.78rem;margin-bottom:.15rem}
.storefront-mini-l1{font-size:.72rem;line-height:1.45}
.storefront-mini-value{margin-right:.55rem}
.storefront-carousel{display:flex;gap:.65rem;overflow-x:auto;scroll-snap-type:x proximity;padding:.15rem 0 .55rem}
.storefront-carousel-card{flex:0 0 min(19rem,82vw);border:1px solid var(--border);padding:.45rem;scroll-snap-align:start}
.storefront-carousel-media{height:7rem;border-bottom:1px solid var(--border);margin:-.45rem -.45rem .45rem;display:grid;place-items:center;color:var(--text-muted)}
.storefront-carousel-line{font-size:.72rem;margin-top:.18rem}
.storefront-matrix-scroll{overflow:auto;max-width:100%;max-height:65vh;border:1px solid var(--border)}
.storefront-matrix{border-collapse:collapse;min-width:max-content;font-size:.72rem}
.storefront-matrix th,.storefront-matrix td{border-right:1px solid #333;border-bottom:1px solid var(--border);padding:.28rem .38rem;max-width:18rem}
.storefront-matrix thead th{position:sticky;top:0;background:var(--surface);z-index:2}
.storefront-matrix tr>th:first-child{position:sticky;left:0;background:var(--surface);z-index:1}
.storefront-map-meta{font-size:.7rem;color:var(--text-muted);margin:.15rem 0 .35rem}
.storefront-map{height:58vh;min-height:360px;border:1px solid #444}
.storefront-map-dot{display:block;width:7px;height:7px;min-width:7px;min-height:7px;padding:0;border:1px solid rgba(0,0,0,.72);border-radius:50%;background:var(--dot-color);box-shadow:0 0 0 1px rgba(255,255,255,.22);cursor:pointer}
.storefront-map-dot:hover,.storefront-map-dot:focus{width:9px;height:9px;min-width:9px;min-height:9px;outline:1px solid #fff}
.storefront-load-more{margin:.7rem 0}
@media(max-width:1100px){.storefront-mini-list{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){.storefront-mini-list{grid-template-columns:repeat(2,minmax(0,1fr))}.storefront-map{height:50vh;min-height:300px}}

.listing-detail-panel{margin-top:.75rem;border-top:1px solid var(--line);padding-top:.6rem}
.listing-detail-head{display:flex;justify-content:space-between;gap:.8rem;align-items:baseline;border-bottom:1px solid var(--border);padding-bottom:.35rem}
.listing-detail-photo-main{min-height:12rem;border:1px solid var(--border);display:grid;place-items:center;color:var(--text-muted);margin:.5rem 0}
.listing-detail-section{margin:.65rem 0}
.listing-detail-section h3{font-size:.8rem;color:var(--text-muted);font-weight:400;margin:.15rem 0 .35rem}
.listing-detail-grid{display:grid;grid-template-columns:minmax(8rem,14rem) minmax(0,1fr);gap:.16rem .65rem;margin:0}
.listing-detail-grid dt{color:var(--text-muted)}.listing-detail-grid dd{margin:0;overflow-wrap:anywhere}
.listing-detail-actions{display:flex;gap:.4rem;flex-wrap:wrap;border-top:1px solid var(--border);padding-top:.5rem;margin-top:.7rem}
.listing-detail-actions button{font:inherit;border:1px solid var(--control-border);background:var(--surface);color:var(--control-text);padding:.3rem .48rem;cursor:pointer;border-radius:0}
.listing-detail-actions button:hover{background:#fff;color:#000}

.listing-reclassify{margin-top:.4rem}
.listing-reclassify-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.35rem}
.listing-reclassify .form-grid{margin-top:.5rem}
@media(max-width:900px){.listing-reclassify-choices{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Shared validation semantics. Theme may override these variables later. */
:root{--validation-pass:#2e7d32;--validation-warn:#9a6700;--validation-error:#b42318}
.field[data-validation="WARN"]{outline:1px solid var(--validation-warn);outline-offset:2px}
.field[data-validation="ERROR"]{outline:1px solid var(--validation-error);outline-offset:2px}
.field-validation{display:block;margin-top:.25rem;font-size:.78rem}
[data-validation="WARN"]>.field-validation{color:var(--validation-warn)}
[data-validation="ERROR"]>.field-validation{color:var(--validation-error)}

.field,.property-groups{gap:var(--space-field)}
.actions button,.storefront-view-button,.storefront-load-more,.listing-detail-actions button{
  background:var(--control-bg);color:var(--control-text);border-color:var(--control-border);border-radius:var(--radius)
}
:root[data-grid-lines="off"] .field-grid .field{outline:none;border-color:transparent}
:root[data-zebra="on"] .result-grid .result:nth-child(even),
:root[data-zebra="on"] .storefront-mini-list .storefront-mini:nth-child(even){background:var(--surface-alt)}
