/* Residential Property Intelligence. Built on the tokens in app.css; only adds what the feature needs.
   Rent = violet, sale = cyan: both differ from the parcel green/orange/red and from the sky-blue UI accent.
   Marker strokes (white on dark/satellite, slate on light) keep both readable on every basemap. */
:root {
  --prop-rent: #a06cff;
  --prop-sale: #22c3d6;
}

/* ---- map controls (under the basemap switcher) ---- */
.map-ui { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); }
.prop-toggle, .prop-mode { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line-2); box-shadow: var(--shadow); height: 32px; padding: 0 12px; font-weight: 500; color: var(--t0); }
.prop-toggle:hover:not(:disabled), .prop-mode:hover:not(:disabled) { background: var(--bg-3); }
.prop-toggle[aria-pressed=true], .prop-mode[aria-pressed=true] { background: color-mix(in srgb, var(--prop-rent) 22%, var(--bg-1)); border-color: color-mix(in srgb, var(--prop-rent) 70%, transparent); }
.prop-toggle .sw { border-radius: 50%; }
.prop-toggle.is-busy::after { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg-4); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.prop-ctrl { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); }
.prop-ctrl[hidden] { display: none; }
.prop-ctrl .seg { flex: none; }
.prop-ctrl .seg button { white-space: nowrap; }
.prop-demo-badge { height: 24px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--warn-t); background: var(--warn-bg); border: 1px solid rgba(245, 158, 11, .55); }
.prop-demo-badge[hidden] { display: none; }

/* ---- map labels / markers ---- */
.prop-cl { pointer-events: none; font: 700 11.5px/1 var(--font); color: #0b1018; font-variant-numeric: tabular-nums; text-shadow: none; }

/* ---- panel ---- */
.prop-tabs { position: sticky; top: -16px; z-index: 3; margin: -16px -16px 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg-0) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.prop-tabs[hidden] { display: none; }
.prop-tabs .seg { flex: none; width: 100%; }
#panel[data-pi-tab=props] #progress, #panel[data-pi-tab=props] #empty, #panel[data-pi-tab=props] #results { display: none; }
.props { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.props > [data-slot] { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.props > [data-slot]:empty, .props > [data-slot][hidden] { display: none; }
.pi-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.pi-head h2 { font-size: 16px; font-weight: 650; }
.pi-head .seg { flex: 1 1 100%; }
.pi-head .seg button { white-space: nowrap; }
.pi-scope { color: var(--t1); font-size: 12.5px; margin-top: -4px; }
.pi-scope b { font-weight: 600; font-variant-numeric: tabular-nums; }
.pi-fine { font-size: 11.5px; color: var(--t3); }
.pi-nl { color: var(--t3); font-family: var(--font); font-weight: 400; font-size: .9em; }
.pi-none { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; color: var(--t2); background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; }
.pi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 8px; }
.pi-card { justify-content: space-between; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-2); }
.pi-cl { font-size: 12px; line-height: 1.2; color: var(--t2); font-weight: 500; overflow-wrap: normal; }
.pi-cn { font-family: var(--font); font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pi-card:first-child { border-color: color-mix(in srgb, var(--prop-rent) 45%, transparent); background: color-mix(in srgb, var(--prop-rent) 8%, var(--bg-1)); }
.props .metrics .metric dd { font-size: 16px; }
.pi-hist { width: 100%; height: auto; display: block; overflow: visible; }
.pi-hbar { fill: var(--c); opacity: .9; }
.pi-hbar.is-open { opacity: .55; }
.pi-haxis { stroke: var(--line-2); stroke-width: 1; }
.pi-hmed { stroke: var(--t0); stroke-width: 1.4; stroke-dasharray: 3 2; }
.pi-htxt { fill: var(--t2); font: 500 9.5px var(--font); }
.pi-hmedtxt { fill: var(--t0); }
.pi-bars { display: flex; flex-direction: column; gap: 5px; }
.pi-bars li { display: grid; grid-template-columns: 64px 1fr 62px; align-items: center; gap: 8px; font-size: 12px; }
.pi-bl { color: var(--t1); }
.pi-bt { height: 8px; background: var(--bg-3); border-radius: 8px; overflow: hidden; }
.pi-bt i { display: block; height: 100%; min-width: 0; background: var(--c); border-radius: 8px; }
.pi-bars .is-unk .pi-bt i { background: var(--t3); }
.pi-bn { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.pi-bn small { color: var(--t3); margin-left: 4px; font-family: var(--font); font-size: 10.5px; }
.pi-cov { font-size: 12.5px; color: var(--t1); margin-top: -4px; }
.pi-cov b { color: var(--t2); font-weight: 600; }

/* filters */
.pi-filters { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-2); }
.pi-filters summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; font-weight: 600; list-style: none; border-radius: var(--r-2); }
.pi-filters summary::-webkit-details-marker { display: none; }
.pi-filters summary::after { content: ''; width: 8px; height: 8px; border: solid var(--t2); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-left: auto; transition: transform .15s; }
.pi-filters[open] summary::after { transform: rotate(-135deg); }
.pi-fcount { font-size: 11px; font-weight: 600; color: var(--accent-t); }
.pi-fbody { display: flex; flex-direction: column; gap: 12px; padding: 4px 12px 12px; }
.pi-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pi-fl { font-size: 12px; font-weight: 500; color: var(--t2); }
.pi-input, .pi-num input { width: 100%; height: 34px; padding: 0 10px; background: var(--bg-0); border: 1px solid var(--line-2); border-radius: 8px; color: var(--t0); font: inherit; min-width: 0; }
.pi-input:focus-visible, .pi-num input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.pi-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; color: var(--t3); }
.pi-num { display: block; min-width: 0; }
.pi-field .seg { flex: none; }
.pi-sublist { max-height: 152px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-0); padding: 2px; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
.pi-sublist li[hidden] { display: none; }
.pi-sublist label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.pi-sublist label:hover { background: var(--bg-2); }
.pi-sublist span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-sublist small { color: var(--t3); font-variant-numeric: tabular-nums; font-size: 11px; }
.pi-sublist input, .pi-check input { accent-color: var(--prop-rent); width: 16px; height: 16px; flex: none; margin: 0; }
.pi-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--t1); cursor: pointer; }
.pi-fbody .btn-ghost { align-self: flex-start; }
.chip svg { margin-right: -2px; }

/* suburb table */
.pi-th { margin: 0; }
.pi-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-1); scrollbar-width: thin; }
.pi-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.pi-table th, .pi-table td { padding: 6px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.pi-table thead th { font-size: 12px; color: var(--t2); font-weight: 600; background: var(--bg-2); }
.pi-table thead button, .pi-table tbody th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: inherit; cursor: pointer; border-radius: 4px; }
.pi-table thead button:hover { color: var(--t0); }
.pi-table tbody th { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.pi-table tbody th button { color: var(--t0); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pi-table tbody th button:hover { color: var(--accent-t); text-decoration: underline; }
.pi-table .pi-r { text-align: right; }
.pi-table tbody tr:last-child > * { border-bottom: 0; }
.pi-table tr.is-sel > * { background: color-mix(in srgb, var(--prop-rent) 16%, transparent); }

/* data source + import */
.pi-data { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.pi-data.is-empty { border-top: 0; padding-top: 0; }
.pi-src { display: flex; flex-direction: column; font-size: 12.5px; color: var(--t2); }
.pi-src b { color: var(--t0); font-weight: 600; overflow-wrap: anywhere; }
.pi-src small { color: var(--t3); }
.pi-drop { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px dashed var(--line-2); border-radius: var(--r-2); background: var(--bg-1); color: var(--t1); cursor: pointer; transition: background .15s, border-color .15s; }
.pi-drop:hover, .pi-drop.is-over, .pi-drop:focus-within { background: var(--bg-2); border-color: var(--accent); }
.pi-drop.is-busy { opacity: .6; cursor: progress; }
.pi-drop span { display: flex; flex-direction: column; font-size: 13px; }
.pi-drop small { color: var(--t3); font-size: 11.5px; }
.pi-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pi-summary { padding: 10px 12px; font-size: 12.5px; color: var(--t1); background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; }
.pi-summary ul { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; color: var(--t2); }
.pi-summary li::before { content: '– '; }
.pi-emptycard h2 { font-size: 16px; }

.pi-ask { padding: 10px 12px; font-size: 12.5px; color: var(--t0); background: rgba(56, 189, 248, .08); border: 1px solid rgba(56, 189, 248, .4); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }

/* detail */
.pi-photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--r-2); scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; flex: none; }
.pi-photos figure { margin: 0; flex: 0 0 86%; scroll-snap-align: start; }
.pi-photos img { width: 100%; height: 190px; object-fit: cover; display: block; border-radius: var(--r-2); background: var(--bg-2); }
.pi-photo-ph { display: flex; align-items: center; justify-content: center; gap: 10px; height: 120px; flex: none; color: var(--t3); background: repeating-linear-gradient(135deg, var(--bg-1), var(--bg-1) 10px, var(--bg-2) 10px, var(--bg-2) 20px); border: 1px dashed var(--line-2); border-radius: var(--r-2); font-size: 12.5px; text-align: center; padding: 0 16px; }
.pi-price { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.pi-price small { font-size: 13px; color: var(--t2); font-weight: 400; font-family: var(--font); }
.pi-wide { grid-column: 1 / -1; }
.pi-desc { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--t1); font-size: 13px; }
.pi-links { grid-template-columns: 1fr; }
.pi-disabled { opacity: .55; cursor: default; }
.pi-demo-tag { color: var(--warn-t); }
.detail .notice { margin: 0; }

@media (max-width: 767px) {
  .prop-ctrl .seg-map button { padding: 0 9px; height: 28px; font-size: 12px; }
  .prop-toggle, .prop-mode { height: 30px; font-size: 12px; padding: 0 10px; }
  .pi-cards { gap: 6px; }
  .pi-card { padding: 8px; }
  .pi-cn { font-size: 19px; }
  .pi-photos img { height: 170px; }
}
@media (max-width: 380px) {
  .pi-cards { grid-template-columns: repeat(2, 1fr); }
  .pi-bars li { grid-template-columns: 56px 1fr 58px; }
}
@media (prefers-reduced-motion: reduce) {
  .pi-filters summary::after { transition: none; }
  .pi-photos { scroll-behavior: auto; }
}

/* The detail overlays rest off-panel (translateX). overflow:hidden still lets focus or scrollIntoView
   scroll the panel sideways; clip prevents any panel scroll. Falls back to hidden where unsupported. */
.panel { overflow: clip; }
.pi-live { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.pi-live .d-h { margin-top: 0; }

@media (max-width: 767px) {
  .pi-filters summary, .pi-input, .pi-num input { min-height: 40px; }
  .prop-toggle, .prop-mode { height: 40px; }
  .prop-ctrl .seg-map button { height: 40px; }
  .pi-sublist label { min-height: 40px; }
}
