:root {
  --bg: #f7f8fa; --panel: #ffffff; --ink: #16202c; --muted: #5c6b7d;
  --accent: #0f6fde; --accent-dark: #0a55ab; --buy: #15803d; --buy-dark: #116631;
  --line: #e3e8ef; --warn-bg: #fef3cd; --ok-bg: #dcfce7; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.15rem; }

.demo-banner { background: #1e293b; color: #fbbf24; text-align: center; padding: 6px 10px; font-size: .85rem; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.logo span { color: var(--accent); }
.site-header nav { display: flex; gap: 18px; align-items: center; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px; border-top: 1px solid var(--line); }

.hero { text-align: center; padding: 30px 10px 10px; }
.hero h1 { font-size: 2rem; max-width: 720px; margin: 0 auto 10px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 20px; }
.search { display: flex; gap: 8px; max-width: 560px; margin: 0 auto 14px; }
.search input { flex: 1; }
.kicker { letter-spacing: .25em; font-weight: 700; color: var(--accent); font-size: .8rem; margin-bottom: 0; }
.choose-county { text-transform: uppercase; letter-spacing: .08em; font-size: .95rem; color: var(--muted); margin: 18px 0 6px; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.results-h { margin-top: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; }
a.card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(15,32,44,.10); }
.card-img { position: relative; aspect-ratio: 4/3; background: #e8edf3; cursor: pointer; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-body h3 { margin: 0; font-size: .98rem; }
.loc { color: var(--muted); margin: 2px 0; }
.meta { color: var(--muted); font-size: .85rem; margin: 0; }
.price { font-weight: 700; margin: 0; }
.price-lg { font-size: 1.7rem; font-weight: 800; margin: 0 0 8px; }
.desc { max-width: 600px; }

.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.badge.published { background: var(--ok-bg); color: var(--buy-dark); }
.badge.draft { background: var(--warn-bg); color: #92600a; }
.badge.vid { position: absolute; bottom: 8px; left: 8px; background: rgba(15,23,42,.8); color: #fff; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; font-size: .95rem; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-buy { background: var(--buy); }
.btn-buy:hover { background: var(--buy-dark); }
.btn-print { background: #b91c1c; }
.btn-print:hover { background: #921818; }
.btn-wide { width: 100%; margin-top: 6px; }
.buy-set-title { font-weight: 700; margin: 0 0 4px; }

.legend { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-top: 18px; font-size: .9rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.legend-chip { display: inline-block; color: #fff; font-weight: 700; font-size: .78rem; padding: 3px 10px; border-radius: 999px; }
.legend-chip.mls { background: var(--buy); }
.legend-chip.print { background: #b91c1c; margin-left: 14px; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; }
.linklike.danger { color: #b91c1c; font-size: .85rem; }
.inline { display: inline; }
.hint { color: var(--muted); font-size: .85rem; }

input[type=text], input[type=email], input[type=password], input[type=number], select, input[type=file] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; background: #fff; width: 100%;
}
.price-in { width: 110px !important; display: inline-block; }
label { font-size: .9rem; color: var(--muted); display: block; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 20px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row input[type=text] { flex: 1; min-width: 180px; width: auto; }
.form-row select { width: auto; min-width: 170px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: span 2; }
.actions { margin-top: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.set-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.buy-set {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; text-align: center; min-width: 220px; max-width: 280px;
  box-shadow: 0 8px 28px rgba(15, 32, 44, .18);
}
@media (max-width: 700px) {
  .buy-set { position: static; box-shadow: none; max-width: none; width: 100%; }
}

.stats { display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 22px; flex: 1; min-width: 140px; }
.stat .num { display: block; font-size: 1.4rem; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: .85rem; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }

.notice { border-radius: 8px; padding: 12px 16px; margin: 14px 0; }
.notice.warn { background: var(--warn-bg); }
.notice.ok { background: var(--ok-bg); }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

.auth-box { max-width: 420px; margin: 30px auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.auth-box form { display: flex; flex-direction: column; gap: 12px; }

.lightbox { position: fixed; inset: 0; background: rgba(10,15,22,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 6px; }
.lightbox .lb-title { color: #cbd5e1; }
.lb-close { position: absolute; top: 14px; right: 22px; background: none; border: 0; color: #fff; font-size: 2rem; cursor: pointer; }

.lightbox[hidden] { display: none; }

.modal { position: fixed; inset: 0; background: rgba(10,15,22,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border-radius: var(--radius); padding: 24px 26px; max-width: 480px; width: 100%; box-shadow: 0 16px 48px rgba(15,32,44,.3); }
.modal-close { float: right; background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 0 6px 12px; }
.modal-close:hover { color: var(--ink); }

/* Video tile: inverted colors so it stands out from photo cards */
.video-card { background: var(--accent); border-color: var(--accent-dark); cursor: pointer; }
.video-card .card-body h3, .video-card .price { color: #fff; }
.video-card .meta { color: rgba(255,255,255,.85); }
.video-card .btn { background: #fff; color: var(--accent); }
.video-card .btn:hover { background: #e2edfd; color: var(--accent-dark); }
.video-card:hover { box-shadow: 0 4px 16px rgba(15,111,222,.35); }

.vm-title { font-weight: 800; font-size: 1.1rem; color: var(--ink); margin: 10px 0 2px; }
.vm-title.vm-loading { opacity: .55; }

.sel-wrap { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 5px; line-height: 0; cursor: pointer; box-shadow: 0 1px 4px rgba(15,32,44,.25); }
.sel-wrap input { width: 18px !important; height: 18px; margin: 0; cursor: pointer; }

#sel-bar { position: fixed; left: 24px; bottom: 24px; z-index: 45; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 28px rgba(15,32,44,.18); padding: 12px 16px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 70vw; }
#sel-bar[hidden] { display: none; }
#sel-info { font-weight: 600; }
#sel-info s { color: var(--muted); font-weight: 400; }

details.acc summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 14px; list-style: none; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::before { content: '▸'; color: var(--muted); margin-right: 4px; transition: transform .15s ease; display: inline-block; }
details.acc[open] summary::before { transform: rotate(90deg); }
.acc-title { font-weight: 700; font-size: 1.05rem; flex: 1; }
.acc-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.acc-body { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }

.progress { height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.progress-bar.busy { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 12px, var(--accent-dark) 12px, var(--accent-dark) 24px); background-size: 34px 34px; animation: busy-slide 1s linear infinite; }
@keyframes busy-slide { from { background-position: 0 0; } to { background-position: 34px 0; } }

#window-track { position: relative; height: 26px; background: var(--line); border-radius: 8px; margin: 10px 0 4px; overflow: hidden; }
#window-seg { position: absolute; top: 0; bottom: 0; left: 0; width: 30%; background: var(--accent); opacity: .85; border-radius: 8px; transition: left .05s linear, width .15s ease; }
.len-btn.len-active { background: var(--accent); color: #fff; }
.len-btn:disabled { opacity: .35; cursor: not-allowed; }
