:root {
  --ink: #17212b;
  --muted: #667481;
  --sky: #1687b8;
  --sky-dark: #08658f;
  --sky-pale: #eaf7fc;
  --line: #d9e6ec;
  --paper: #ffffff;
  --wash: #f5fafc;
  --success: #19714a;
  --danger: #b42318;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Manrope", sans-serif; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }
:focus-visible { outline: 3px solid rgba(22, 135, 184, 0.35); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { height: 72px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.96); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.brand span { width: 34px; height: 34px; display: grid; place-items: center; background: var(--sky); color: white; border-radius: 50%; font-family: Georgia, serif; font-size: 22px; }
.topbar nav { display: flex; align-items: center; gap: 24px; font-size: 14px; font-weight: 700; }
.topbar nav > a:not(.button) { color: var(--muted); }
.topbar nav > a.active { color: var(--ink); }
.auth-action { white-space: nowrap; }

.user-menu { position: relative; display: inline-flex; }
.user-menu-trigger { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--wash); color: var(--sky-dark); display: grid; place-items: center; cursor: pointer; padding: 0; }
.user-menu-trigger:hover, .user-menu-trigger[aria-expanded="true"] { background: var(--sky-pale); }
.user-menu-tooltip { position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px; padding: 8px 12px; border-radius: 6px; background: var(--ink); color: white; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 120ms ease; z-index: 25; }
.user-menu-trigger:hover .user-menu-tooltip { opacity: 1; }
.user-menu-trigger[aria-expanded="true"] .user-menu-tooltip { opacity: 0; }
.user-menu-dropdown[hidden] { display: none; }
.user-menu-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 12px 32px rgba(23, 33, 43, 0.14); z-index: 25; display: flex; flex-direction: column; gap: 6px; }
.user-menu-name { font-weight: 800; }
.user-menu-email { color: var(--muted); font-size: 13px; margin-top: -4px; word-break: break-all; }
.user-menu-role { font-size: 12px; font-weight: 700; color: var(--sky-dark); padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-dropdown a { padding: 6px 0; color: var(--ink); font-size: 14px; font-weight: 700; }
.user-menu-dropdown a:hover { color: var(--sky-dark); }

.button { min-height: 44px; border: 1px solid transparent; border-radius: 6px; padding: 10px 18px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; line-height: 1; }
.button.primary { background: var(--sky); color: white; }
.button.primary:hover { background: var(--sky-dark); }
.button.secondary { background: var(--sky-pale); border-color: #c5e7f4; color: var(--sky-dark); }
.button.ghost { background: white; border-color: var(--line); color: var(--muted); }
.button.compact { min-height: 38px; padding: 8px 14px; }
.button.wide { width: 100%; margin-top: 10px; }

.catalogue-shell, .editor-shell, .detail-shell { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }
.catalogue-intro { min-height: 230px; display: flex; align-items: end; justify-content: space-between; padding: 50px 0 34px; border-bottom: 1px solid var(--line); background-image: linear-gradient(120deg, transparent 65%, var(--sky-pale)); }
.eyebrow { margin: 0 0 8px; color: var(--sky-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.catalogue-intro h1, .page-heading h1, .property-copy h1 { margin: 0; max-width: 760px; font-size: clamp(32px, 4vw, 54px); line-height: 1.08; font-weight: 800; }
.catalogue-intro p:last-child, .page-heading > p:last-child { color: var(--muted); margin: 14px 0 0; }
.catalogue-count { display: flex; flex-direction: column; align-items: end; }
.catalogue-count strong { font-size: 54px; line-height: 1; }
.catalogue-count span { color: var(--muted); font-size: 13px; }

.inventory-summary { padding: 24px 0 4px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-card { min-width: 0; min-height: 96px; border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: grid; align-content: center; gap: 2px; background: var(--wash); color: var(--ink); text-align: left; }
button.summary-card:hover, button.summary-card:focus-visible { border-color: #8fc5d9; background: var(--sky-pale); }
.summary-card strong { font-size: 30px; line-height: 1; color: var(--sky-dark); }
.summary-card span { font-weight: 800; }
.summary-card small { color: var(--muted); }
.summary-card.ready { background: #f3fbf7; border-color: #cdeedd; }
.summary-card.draft { background: #fffaf0; border-color: #f1dfad; }
.summary-card.attention { background: #fff7f6; border-color: #f3c5bf; }
.filter-bar { padding: 22px 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; border-bottom: 1px solid var(--line); }
.filter-bar .search-field { grid-column: span 2; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #cbdbe2; border-radius: 6px; background: white; padding: 10px 12px; color: var(--ink); }
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #8fb9ca; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }

.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; padding: 34px 0 64px; }
.listing-card { min-width: 0; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.listing-image { display: block; aspect-ratio: 4 / 3; background: var(--wash); position: relative; overflow: hidden; }
.listing-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 350ms ease; }
.listing-card:hover .listing-image img { transform: scale(1.025); }
.listing-image-placeholder, .property-placeholder { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--sky-dark); background: linear-gradient(145deg, #f7fcfe, #dff3fa); }
.listing-image-placeholder span, .property-placeholder span { font: 48px Georgia, serif; }
.listing-image-placeholder small { color: var(--muted); }
.status-badge { position: absolute; left: 12px; top: 12px; padding: 5px 9px; background: rgba(255,255,255,0.94); border-radius: 4px; font-size: 11px; font-weight: 800; }
.status-badge.published { color: var(--success); }
.listing-card-body { padding-top: 16px; }
.profile-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.profile-photo-placeholder { width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: var(--sky-dark); background: linear-gradient(145deg, #f7fcfe, #dff3fa); font: 32px Georgia, serif; }
.role-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--sky-pale); color: var(--sky-dark); font-size: 13px; font-weight: 700; }
.listing-location, .listing-freshness { margin: 0; color: var(--muted); font-size: 12px; }
.listing-card h2 { margin: 5px 0 10px; font-size: 19px; line-height: 1.3; }
.listing-price { font-size: 17px; color: var(--sky-dark); }
.listing-meta { display: flex; gap: 14px; margin: 15px 0 12px; font-size: 12px; font-weight: 700; }
.listing-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.listing-actions a { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; display: inline-flex; align-items: center; color: var(--sky-dark); font-size: 12px; font-weight: 800; }
.listing-actions a:hover, .listing-actions a:focus-visible { border-color: #8fc5d9; background: var(--sky-pale); }

.editor-shell { width: min(920px, calc(100% - 48px)); padding-bottom: 80px; }
.page-heading { padding: 48px 0 34px; }
.editor-form { display: grid; gap: 18px; }
.form-section { border-top: 1px solid var(--line); padding: 28px 0; }
.section-heading { display: grid; grid-template-columns: 44px 1fr; gap: 12px; margin-bottom: 24px; }
.section-heading > span, details summary > span { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #b7dce9; color: var(--sky-dark); border-radius: 50%; font-size: 11px; font-weight: 800; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.form-section > label + label, .form-section > label + .field-grid, .field-grid + label, .field-grid + .field-grid { margin-top: 16px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.upload-zone { min-height: 132px; place-items: center; align-content: center; border: 1px dashed #8fc5d9; background: var(--wash); color: var(--sky-dark); }
.upload-zone span { color: var(--muted); font-size: 12px; font-weight: 500; }
.upload-zone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-queue { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.photo-queue figure { margin: 0; aspect-ratio: 1; position: relative; overflow: hidden; background: var(--wash); }
.photo-queue img { width: 100%; height: 100%; object-fit: cover; }
.photo-queue figcaption { position: absolute; left: 6px; bottom: 6px; background: white; padding: 3px 6px; border-radius: 3px; font-size: 10px; font-weight: 800; }
.details-section { padding: 0; }
.details-section summary { list-style: none; padding: 28px 0; display: grid; grid-template-columns: 44px 1fr; gap: 12px; cursor: pointer; }
.details-section summary::-webkit-details-marker { display: none; }
.details-section summary strong, .details-section summary small { display: block; }
.details-section summary small { color: var(--muted); font-weight: 500; }
.details-content { padding: 0 0 28px 56px; }
.details-content > label { margin-top: 16px; }
.form-actions { position: sticky; bottom: 0; padding: 14px 0; border-top: 1px solid var(--line); background: rgba(255,255,255,0.96); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-actions > div { display: flex; gap: 8px; }
.submission-notice { position: fixed; top: 50%; left: 50%; z-index: 20; width: min(520px, calc(100% - 32px)); padding: 24px 28px; border: 1px solid var(--sky); border-radius: 10px; background: var(--surface); box-shadow: 0 18px 50px rgba(31, 77, 92, 0.22); color: var(--sky-dark); cursor: pointer; font: inherit; font-weight: 800; text-align: center; transform: translate(-50%, -50%); }
.submission-notice:hover { background: var(--wash); }

.field-hint { display: block; margin-top: -6px; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.phone-input { display: flex; gap: 8px; }
.phone-input .phone-country { flex: 0 0 auto; max-width: 190px; }
.phone-input .phone-number { flex: 1 1 auto; }
.whatsapp-preview { margin-top: 8px; padding: 10px 12px; border-radius: 6px; background: var(--wash); font-size: 13px; color: var(--sky-dark); font-weight: 700; word-break: break-all; }
.whatsapp-preview.empty { color: var(--muted); font-weight: 500; }

.icon-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.icon-option { padding: 4px; border: 2px solid transparent; border-radius: 10px; background: none; cursor: pointer; aspect-ratio: 1; }
.icon-option img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; display: block; }
.icon-option:hover { border-color: var(--line); }
.icon-option.selected { border-color: var(--sky); }

.property-gallery { position: relative; display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: repeat(2, minmax(180px, 31vh)); gap: 5px; margin-top: 28px; overflow: hidden; }
.property-gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery-trigger { min-width: 0; min-height: 0; border: 0; padding: 0; overflow: hidden; background: var(--wash); }
.gallery-trigger img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 350ms ease; }
.gallery-trigger:hover img, .gallery-trigger:focus-visible img { transform: scale(1.025); }
.gallery-trigger:focus-visible { outline: 3px solid var(--sky); outline-offset: -3px; }
.property-gallery > .gallery-trigger:first-child { grid-row: 1 / 3; }
.property-gallery > .gallery-trigger:nth-child(n+4) { display: none; }
.property-gallery.single { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 62vh); }
.property-placeholder { grid-column: 1 / -1; grid-row: 1 / 3; }
.gallery-count { position: absolute; right: 14px; bottom: 14px; min-height: 40px; border: 1px solid rgba(255,255,255,0.7); border-radius: 6px; padding: 8px 13px; background: rgba(20,30,36,0.82); color: white; font-weight: 800; backdrop-filter: blur(8px); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 70px; padding: 46px 0 80px; align-items: start; }
.title-row { display: flex; justify-content: space-between; gap: 32px; }
.title-row h1 { font-size: clamp(29px, 4vw, 48px); }
.title-row p { color: var(--muted); }
.detail-price { flex: 0 0 auto; font-size: 25px; color: var(--sky-dark); }
.facts { margin: 35px 0; padding: 22px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; border-block: 1px solid var(--line); }
.facts div { display: grid; }
.facts strong { font-size: 19px; }
.facts span { color: var(--muted); font-size: 12px; }
.copy-section { padding-top: 20px; max-width: 780px; }
.copy-section h2 { font-size: 20px; }
.copy-section p { color: #34434e; white-space: pre-line; }
.technical-details { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.technical-details div { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.technical-details div:nth-child(odd) { padding-right: 24px; }
.technical-details div:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--line); }
.technical-details dt { color: var(--muted); font-size: 13px; }
.technical-details dd { margin: 0; font-weight: 700; text-align: right; }
.feature-list { columns: 2; padding-left: 20px; }
.feature-list li { margin-bottom: 8px; }
.detail-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.detail-photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.detail-photo-grid .gallery-trigger { aspect-ratio: 4 / 3; }
.detail-photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.contact-panel { position: sticky; top: 100px; border-top: 4px solid var(--sky); padding: 24px; background: var(--wash); }
.contact-panel h2 { margin: 0; font-size: 20px; }
.contact-panel > a { display: block; margin-top: 8px; color: var(--sky-dark); font-weight: 700; }
.share-control { position: relative; }
.share-menu { position: absolute; z-index: 3; inset: calc(100% + 6px) 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: 0 12px 30px rgba(32, 55, 68, 0.14); }
.share-menu[hidden] { display: none; }
.share-option { width: 100%; min-height: 44px; border: 0; border-bottom: 1px solid var(--line); padding: 11px 14px; display: flex; align-items: center; background: white; color: var(--ink); font-weight: 700; text-align: left; text-decoration: none; }
.share-option:last-child { border-bottom: 0; }
.share-option:hover, .share-option:focus-visible { background: var(--sky-pale); color: var(--sky-dark); outline: none; }

body.viewer-open { overflow: hidden; }
.photo-viewer { position: fixed; z-index: 100; inset: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; grid-template-rows: 72px minmax(0, 1fr); background: rgba(8, 12, 15, 0.97); color: white; opacity: 0; transition: opacity 180ms ease; }
.photo-viewer[hidden] { display: none; }
.photo-viewer.is-open { opacity: 1; }
.photo-viewer-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); font-weight: 700; }
.photo-viewer-tools { display: flex; align-items: center; gap: 10px; }
.viewer-reset { min-height: 40px; border: 1px solid rgba(255,255,255,0.35); border-radius: 6px; padding: 8px 12px; background: rgba(18,26,31,0.78); color: white; font-weight: 700; }
.viewer-reset:hover, .viewer-reset:focus-visible { background: white; color: var(--ink); outline: 3px solid var(--sky); outline-offset: 2px; }
.viewer-zoom { min-width: 32px; color: rgba(255,255,255,0.78); font-size: 13px; text-align: center; }
.viewer-icon-button { z-index: 2; width: 48px; height: 48px; border: 1px solid rgba(255,255,255,0.35); border-radius: 50%; display: grid; place-items: center; background: rgba(18, 26, 31, 0.78); color: white; font-size: 38px; line-height: 1; }
.viewer-icon-button:hover, .viewer-icon-button:focus-visible { background: white; color: var(--ink); outline: 3px solid var(--sky); outline-offset: 2px; }
.viewer-close { font-size: 32px; }
.viewer-previous, .viewer-next { align-self: center; justify-self: center; }
.photo-viewer-stage { min-width: 0; min-height: 0; overflow: hidden; display: grid; place-items: center; touch-action: none; }
.photo-viewer-stage img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; transition: opacity 140ms ease, transform 180ms ease; transform-origin: center; will-change: transform; }
.photo-viewer-stage img.is-zoomed { cursor: grab; transition-duration: 0ms; }

.status { min-height: 20px; margin: 0; font-size: 12px; color: var(--muted); }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.loading-state, .empty-state { grid-column: 1 / -1; min-height: 240px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state h1, .empty-state h2 { margin: 0 0 8px; color: var(--ink); }
.loader { width: 30px; height: 30px; border: 3px solid var(--sky-pale); border-top-color: var(--sky); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; gap: 30px; }
  .contact-panel { position: static; }
  .inventory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar, .listing-grid, .field-grid, .field-grid.three, .field-grid.four, .detail-grid, .facts { grid-template-columns: 1fr; }
  .filter-bar .search-field { grid-column: auto; }
  .icon-picker { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 620px) {
  .topbar { height: 62px; padding-inline: 16px; }
  .topbar nav > a:not(.button) { display: none; }
  .catalogue-shell, .editor-shell, .detail-shell { width: min(100% - 32px, 1240px); }
  .catalogue-intro { min-height: 210px; padding-top: 35px; }
  .catalogue-intro h1, .page-heading h1 { font-size: 34px; }
  .catalogue-count { display: none; }
  .filter-bar, .listing-grid, .field-grid, .field-grid.three, .field-grid.four { grid-template-columns: 1fr; }
  .filter-bar .search-field { grid-column: auto; }
  .icon-picker { grid-template-columns: repeat(3, 1fr); }
  .phone-input { flex-direction: column; }
  .phone-input .phone-country { max-width: none; }
  .listing-grid { gap: 32px; }
  .photo-queue { grid-template-columns: repeat(3, 1fr); }
  .details-content { padding-left: 0; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions > div { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions .ghost { display: none; }
  .property-gallery { width: calc(100% + 32px); margin-left: -16px; margin-top: 0; grid-template-columns: 1fr; grid-template-rows: minmax(280px, 55vh); }
  .property-gallery > .gallery-trigger:first-child { grid-row: auto; }
  .property-gallery > .gallery-trigger:nth-child(n+2) { display: none; }
  .detail-grid { padding-top: 30px; }
  .title-row { display: block; }
  .detail-price { display: block; margin-top: 18px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .technical-details { grid-template-columns: 1fr; }
  .technical-details div:nth-child(odd), .technical-details div:nth-child(even) { padding-inline: 0; border-left: 0; }
  .feature-list { columns: 1; }
  .detail-photo-grid { grid-template-columns: 1fr; }
  .photo-viewer { grid-template-columns: 56px minmax(0, 1fr) 56px; grid-template-rows: max(64px, calc(48px + env(safe-area-inset-top))) minmax(0, 1fr); }
  .viewer-icon-button { width: 44px; height: 44px; }
  .photo-viewer-stage { grid-column: 1 / -1; grid-row: 2; }
  .viewer-previous, .viewer-next { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
