:root {
  --brand: #0b6e4f;
  --brand-dark: #085a40;
  --ink: #1a1f24;
  --muted: #6b7480;
  --line: #e4e8ec;
  --bg: #f7f9fa;
  --card: #fff;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 16px/1.5 -apple-system, "PingFang HK", "Noto Sans TC", Segoe UI, Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #d4831f; outline-offset: 3px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: #fff; padding: 10px 14px; border: 2px solid var(--brand); }
.skip-link:focus { top: 10px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { font-size: 22px; font-weight: 800; color: var(--ink); }
.brand span { color: var(--brand); }
.nav-search { flex: 1; display: flex; max-width: 460px; }
.nav-search input { flex: 1; border: 1px solid var(--line); border-radius: 8px 0 0 8px; padding: 8px 12px; }
.nav-search button { border: 0; background: var(--brand); color: #fff; padding: 0 16px; border-radius: 0 8px 8px 0; cursor: pointer; }
.nav-links { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.nav-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 22px; }

/* Buttons */
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.danger-zone { border-color: #efb7b2; margin-top: 18px; }
.btn-lg { padding: 12px 22px; font-size: 17px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin: 14px 0; }
.flash-success { background: #e7f6ef; color: #0b6e4f; }
.flash-danger { background: #fdecec; color: #b3261e; }
.flash-warning { background: #fff6e5; color: #8a5a00; }
.flash-info { background: #eaf2fb; color: #1a5fb4; }

/* Hero */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: 34px; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 22px; }
.hero-search { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hero-search input, .hero-search select { border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; min-width: 220px; }

/* Sections */
section { margin: 34px 0; }
section h2 { font-size: 20px; margin: 0 0 14px; }

/* Cards grid */
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.grid.cards-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.listing-card { display: block; color: inherit; }
.listing-card:hover { text-decoration: none; transform: translateY(-2px); transition: .15s; }
.card-media { position: relative; aspect-ratio: 4/3; background: #eef1f3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media.placeholder { font-size: 44px; }
.card-media.placeholder.large { aspect-ratio: 16/9; font-size: 70px; }
.card-body { padding: 12px 14px; }
.card-body .price { font-weight: 800; color: var(--brand-dark); font-size: 18px; }
.card-body .title { font-weight: 600; margin: 3px 0; }
.card-body .meta, .card-body .psf { color: var(--muted); font-size: 14px; }

/* Badges & pills */
.badge { position: absolute; top: 8px; left: 8px; font-size: 12px; font-weight: 700; color: #fff; padding: 3px 8px; border-radius: 6px; background: #555; }
.badge-featured { background: #d4831f; }
.badge-premium { background: #7a3ff0; }
.badge-standard { background: #1a5fb4; }
.badge-scraped { left: auto; right: 8px; background: #8a94a0; }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #eef1f3; }
.pill-active { background: #e7f6ef; color: #0b6e4f; }
.pill-pending { background: #fff6e5; color: #8a5a00; }
.pill-expired, .pill-removed { background: #fdecec; color: #b3261e; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; }

/* Forms */
.form-narrow { max-width: 420px; margin: 34px auto; padding: 26px; }
.oauth-form { margin: 16px 0 8px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 40px; padding: 9px 12px; background: #fff;
  color: #1f1f1f; border: 1px solid #747775; border-radius: 999px;
  font-family: "Google Sans", Roboto, Arial, sans-serif; font-size: 14px;
  font-weight: 500; line-height: 20px;
}
.btn-google:hover { background: #f8fafd; border-color: #747775; text-decoration: none; }
.google-icon {
  flex: 0 0 18px; width: 18px; height: 18px; background: #fff center / 18px 18px no-repeat;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAW9yTlQBz6J3mgAAA5dJREFUOMt9kkuMVFUQhr8659zbj9s9Q8bQDkRsIiiKkUdECMaFskESYWMiiWEjwbhQWeAoC4kbFyYufAQwURfGsEGJC1mYoBsXPogQJSNRGHk1DDTME5rp6e577znlYobEhfolVUklf6pS9ZcA6KuroC9Dr1RgKknw8jRBtoNsQMwgGIvYFib6E4mOqom+yExySawDDO88UsPq+0vACKRAO16L8h7eDGkwa0H6RcSAEYwtIW6JGvdUMPEmMXZGTfGsoP6HuxMMsxHEKUS6WSq9LylkzxL5CkaZQwQRUYQgBi/WeLGrvbi9ii4OIgA46i0Iso7J/CDoMgmiGoxIsF3NzDDKaaCLSF0xj3lsLYi7qGKHfjt+4OK6jbvnxulPcR/T8SFa8TYmi8pYIowlZ3UyeZt26ZvOmZPTxfvXQ5TEXuI1qS3uCiY+It5/ZwsVRJXSkf2I/lJ4nlQ+pWPKtGKYLF2gWdmhzerPXF1AJ6+yd+U+9lz+nFo6jRSqdixU/PDASl6/7wWqHhAQ/bV8lKBb8Sg9E5i1u5kqfqTXEuT3MR5/YJyHdpaoDs5d7AMRRJUhIJuPj+8ZR/RU/zVUF6EKqudBN+HlMn8kPNpsAlIA3SOwAgj8G0LbgVmIqCIqQAOn4yhQvwHNeUOUrQob+S8UdeBB5ysUCXO2f/8P1Z30P6jTkI+r6qIcpaehnqnWUqUxUi7cEXmEYcABfr63Ax4GyvOr3XapZifSoNvaik6pLp0IPDPpk4NXpYTvCbagPRF5DbAAzpN343S1ePla1JQFQZBz9pUXxUwG3dJUjRsqZiRED57S0onh9N7RK/VvmS6PUbm5Jputnkuv146no/0TRoJ/QyU8KaCCIMJndudL0rgSWDMaZEVDnV4KyUDD3/XEVRZO36J/9PqWd7u9mztp1S64VMJyk0dvBWSXijoFQbggYvfJoeOWDF13w7vDzVBa1gwL9FqoyViodW9p/3Am0WnUdUOeLPbp4NrQW1SXXo24N0Ax68sLeWVoojjyoTtjHLZXOtky/uUJTQ5Mad/yVuijo6WiV7seWI8GRDLEzIBtqXcFSdXmKrJfrf2kz9cxFR+YjZSOT47dpPrcjFa/6lCayTRCkfmHU0VyxHQR2wY3c9679lC30H6z5251guRzyh0/DjLgbnO2W6ehSyvtUN7cCcXtHrsBGJx7Snc7+PJfPh845vOBw9H1Vafzag/U0T13hr8BRfXERWXvt6cAAAAASUVORK5CYII=");
}
.oauth-consent { font-size: 12px; line-height: 1.45; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.form-wide { max-width: 720px; margin: 24px auto; padding: 26px; }
.form-narrow label, .form-wide label, .filters label { display: block; margin: 12px 0; font-weight: 600; }
input, select, textarea { font: inherit; }
.form-narrow input, .form-wide input, .form-wide select, .form-wide textarea,
.filters input, .filters select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400;
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 130px; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.inline input { width: auto; }
.field-error { color: #b3261e; font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
small.muted { font-weight: 400; }

/* Search layout */
.search-layout { display: grid; grid-template-columns: 260px 1fr; gap: 22px; margin-top: 20px; }
.filters { padding: 18px; align-self: start; position: sticky; top: 78px; }
.results-head { margin-bottom: 14px; color: var(--muted); }
.filter-toggle { display: none; margin: 10px 0; }
.view-switch { display: flex; gap: 6px; margin-bottom: 12px; }
.view-switch .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.save-search { padding: 12px 14px; margin: 0 0 14px; }
.save-search summary { cursor: pointer; font-weight: 600; }
.save-search form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.map { height: 220px; border-radius: var(--radius); background: linear-gradient(120deg,#e9eef2,#dfe7ec); display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: 18px; }

/* Tables */
.table, .facts { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td, .facts th, .facts td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.facts th { width: 140px; color: var(--muted); font-weight: 600; }
.breakdown { margin: 6px 0 0; padding-left: 18px; font-weight: 400; color: var(--muted); font-size: 13px; }
.explainer details summary { cursor: pointer; color: var(--brand); }
.listing-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.listing-admin-actions form { display: inline; }
.listing-admin-actions button { border: 0; padding: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; }

/* Listing detail */
.listing-detail { max-width: 860px; margin: 20px auto; }
/* Horizontal filmstrip: photos are browsed by swiping/scrolling sideways, not
   by stacking down the page. scroll-snap makes each photo settle in frame. */
.gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-padding: 0;
  padding-bottom: 6px;
}
.gallery figure {
  margin: 0;
  flex: 0 0 auto;
  width: min(78%, 620px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* aspect-ratio + object-fit keeps every frame the same shape, so a portrait
   shot cannot stretch. height:auto alone would leave ragged strip heights, and
   omitting it lets the width/height attributes squash the image outright. */
.gallery img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  background: var(--line);
}
.gallery figcaption { font-size: 12px; color: var(--muted); line-height: 1.35; }
.gallery::-webkit-scrollbar { height: 8px; }
.gallery::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.price.big { font-size: 30px; font-weight: 800; color: var(--brand-dark); }
.description { margin: 20px 0; }
.action-card { padding: 24px; }
.action-card h2 { margin-top: 0; }
.advertise-hero { padding: 52px 0 28px; max-width: 760px; }
.advertise-hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.08; margin: 8px 0 16px; }
.advertise-hero p { font-size: 18px; color: var(--muted); }
.eyebrow { color: var(--brand) !important; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.steps-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.steps-grid li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.steps-grid strong { color: var(--brand); font-size: 24px; }
.trust-panel { padding: 24px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lead-list { display: grid; gap: 14px; }
.lead-card { padding: 20px; display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 24px; }
.lead-card input, .lead-card select, .lead-card textarea, .moderation-form input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.moderation-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 6px; margin: 5px 0; }
.media-manager { margin: 20px 0; display: grid; gap: 12px; }
.media-manager-item { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; }
.media-manager-item img { width: 140px; height: 100px; object-fit: cover; border-radius: 8px; }

/* Pager */
.pager { display: flex; gap: 6px; margin: 20px 0; flex-wrap: wrap; }
.pager a { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; }
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Search facets */
.facet { margin: 12px 0; }
.facet-label { display: block; font-weight: 600; margin-bottom: 6px; }
.facet-links { display: flex; gap: 6px; flex-wrap: wrap; }
.facet-links .chip.active, .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Language switch */
/* Hamburger flips to a close glyph purely from ARIA state. */
.nav-toggle-icon::before { content: "\2630"; font-size: 20px; line-height: 1; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { content: "\2715"; }
.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: 5px 10px; color: var(--ink); font-size: 14px; }
.lang-switch a.active { background: var(--brand); color: #fff; }

/* Agency homepage */
.agency-header { display: flex; gap: 18px; align-items: center; padding: 20px; margin: 18px 0; }
.agency-logo { width: 88px; height: 88px; object-fit: contain; border-radius: 10px; }
.agency-logo-preview { max-height: 60px; width: auto; margin-top: 6px; }
.agency-line a { font-weight: 600; }
.floor-plan img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }

/* Sections + listing detail extras */
.section-title { margin: 18px 0 6px; }
.deal-entry { display: flex; gap: 10px; margin: 14px 0 20px; }
.key-specs { font-size: 16px; margin: 6px 0; }
.key-specs b { color: var(--brand-dark); }
.trust-badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.trust-badge { background: #e7f6ef; color: #07543c; border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 650; }
.share-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
fieldset legend { padding: 0 8px; font-weight: 600; color: var(--muted); }
.amenity-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; }
.amenities { margin: 18px 0; }
.listing-actions { padding: 20px; }
.mortgage { padding: 20px; }
.listing-actions input, .listing-actions textarea, .listing-actions select, .report-box input, .report-box textarea, .report-box select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.listing-actions label, .report-box label { display: block; margin: 10px 0; }
.action-row, .inline-form { display: inline-flex; gap: 8px; margin: 6px 8px 12px 0; }
.report-box { margin: 24px 0; }
.report-box summary { cursor: pointer; color: var(--brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Boost / billing */
.btn-sm { padding: 5px 10px; font-size: 13px; margin-top: 6px; display: inline-block; }
.boost-tiers { display: flex; flex-direction: column; gap: 12px; }
.boost-tier { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.boost-tier input { width: auto; }
.boost-price { font-weight: 800; font-size: 18px; margin-left: auto; }

/* Prose / footer */
.prose { max-width: 720px; margin: 30px auto; }
.prose.center { text-align: center; }
.site-footer { border-top: 1px solid var(--line); margin-top: 50px; padding: 24px 0; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.nav-logout { display: inline; margin: 0; }
.nav-logout button { border: 0; background: none; color: var(--brand); font: inherit; padding: 0; cursor: pointer; }

@media (max-width: 760px) {
  .search-layout { grid-template-columns: 1fr; }
  .nav-search { display: none; }
  .filters { position: static; }
  .filter-toggle { display: inline-block; }
  .filters { display: none; }
  .filters.open { display: block; }
  .site-header .wrap { height: auto; min-height: 62px; flex-wrap: wrap; padding-block: 8px; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-links { display: none; width: 100%; align-items: stretch; flex-direction: column; gap: 4px; padding: 8px 0; }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-links form { padding: 8px 4px; }
  /* The switcher is a compact pill, but `align-items: stretch` on the open
     menu blows it out to the full column width. Opt this one child out. */
  .nav-links .lang-switch { align-self: flex-start; width: auto; }
  .gallery figure { width: 88%; }
  .grid.cards-two, .steps-grid { grid-template-columns: 1fr; }
  .lead-card { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Internal admin console */
.admin { max-width: 1100px; margin: 20px auto; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.admin-tiles .tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.admin-tiles .tile b { font-size: 22px; color: var(--brand-dark); }
.admin-tiles .tile span { font-size: 12px; color: var(--muted); }
.admin-tiles .tile.warn b { color: #8a5a00; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; width: auto; }
.admin-table thead th { background: #f2f5f7; font-weight: 700; color: var(--ink); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
