:root {
  --bg: #0b0e13;
  --surface: #151a23;
  --surface-2: #1c222e;
  --border: rgba(255,255,255,.09);
  --text: #f3f5f9;
  --muted: #98a2b3;
  --gold: #d9a84e;
  --gold-2: #eac06a;
  --green: #3ecf8e;
  --red: #ef6a6a;
  --amber: #e8b24a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }
@media (min-width: 1500px) { .container:has(.grid) { max-width: 1500px; } }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; margin-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .2px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 36px; width: auto; background: #f7f1e3;
  padding: 5px 11px; border-radius: 9px;
}
.auth-card .brand-logo { height: 46px; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 1.4px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--gold); color: #1a1405; border: none; cursor: pointer;
  font-weight: 700; font-size: 14.5px; padding: 11px 18px; border-radius: 12px;
  transition: filter .15s ease, transform .05s ease;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); font-weight: 600;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(239,106,106,.4); font-weight: 600; }
.btn-danger:hover { background: rgba(239,106,106,.12); }
.btn-sm { padding: 8px 13px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 11px; padding: 12px 14px; font-size: 15px;
  font-family: inherit; outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); }
.field textarea { min-height: 130px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.flash {
  border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2);
}
.flash-ok { border-color: rgba(62,207,142,.4); color: var(--green); }
.flash-err { border-color: rgba(239,106,106,.4); color: var(--red); }
.flash-info { border-color: rgba(232,178,74,.4); color: var(--amber); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 7px 16px; border-radius: 999px;
}
.badge-active { background: var(--green); color: #052013; }
.badge-sold { background: var(--red); color: #1a0505; }
.badge-uc { background: var(--gold); color: #1a1405; }
.badge-pending { background: rgba(232,178,74,.13); color: var(--amber); }

/* ---------- Listing grid ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 18px; flex-wrap: wrap; gap: 12px; }
.section-head h1 { font-size: 26px; font-weight: 700; }
.filter-tabs { display: flex; gap: 8px; }
.filter-tabs a {
  padding: 8px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface);
}
.filter-tabs a:hover { text-decoration: none; color: var(--text); }
.filter-tabs a.on { background: var(--gold); border-color: var(--gold); color: #1a1405; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.prop-card { overflow: hidden; transition: transform .15s ease, border-color .15s; display: flex; flex-direction: column; }
.prop-card:hover { transform: translateY(-3px); border-color: rgba(217,168,78,.45); text-decoration: none; }
.prop-photo { position: relative; aspect-ratio: 4/3; background: var(--surface-2); overflow: hidden; }
.prop-photo img { width: 100%; height: 100%; object-fit: cover; }
.prop-photo .badge { position: absolute; top: 12px; left: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.55); border: 1.5px solid rgba(0,0,0,.35); }
.prop-photo-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 13.5px; }
.prop-body { padding: 16px 18px 18px; }
.prop-price { font-size: 21px; font-weight: 800; color: var(--gold-2); }
.prop-addr { font-size: 15.5px; font-weight: 600; color: var(--text); margin-top: 2px; }
.prop-meta { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.empty-state { text-align: center; color: var(--muted); padding: 70px 20px; font-size: 15px; }

/* ---------- Property detail ---------- */
.detail-head { margin: 22px 0 20px; }
.detail-head .badge { margin-bottom: 10px; }
.detail-addr { font-size: 28px; font-weight: 800; line-height: 1.2; }
.detail-city { color: var(--muted); font-size: 16px; margin-top: 3px; }
.detail-price { font-size: 26px; font-weight: 800; color: var(--gold-2); margin-top: 12px; }
.fact-row { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 14px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.fact { font-size: 14.5px; }
.fact b { display: block; font-size: 17px; }
.fact span { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; }

.gallery { margin: 22px 0 8px; }
.gallery-main { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/10; background: var(--surface-2); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 92px; height: 68px; object-fit: cover; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; opacity: .75; transition: opacity .15s, border-color .15s;
}
.gallery-thumbs img.on, .gallery-thumbs img:hover { opacity: 1; border-color: var(--gold); }

.detail-section { margin-top: 34px; }
.detail-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.desc { color: #d3d9e2; font-size: 15.5px; white-space: pre-wrap; }

.comp-list, .file-list { display: flex; flex-direction: column; gap: 10px; }
.comp-item, .file-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; font-size: 14.5px;
}
.comp-item:hover, .file-item:hover { text-decoration: none; border-color: rgba(217,168,78,.45); }
.comp-item .comp-label { color: var(--text); font-weight: 600; }
.comp-item .comp-price { color: var(--gold-2); font-weight: 700; white-space: nowrap; }
.file-item .file-name { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.file-item .file-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 8px; margin: 20px 0 22px; flex-wrap: wrap; }
.admin-tabs a {
  padding: 9px 17px; border-radius: 11px; font-size: 14px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface);
}
.admin-tabs a:hover { text-decoration: none; color: var(--text); }
.admin-tabs a.on { background: var(--gold); border-color: var(--gold); color: #1a1405; }

.admin-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px;
  flex-wrap: wrap;
}
.admin-row .thumb { width: 72px; height: 54px; border-radius: 9px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.admin-row .thumb-empty { width: 72px; height: 54px; border-radius: 9px; background: var(--surface-2); flex-shrink: 0; }
.admin-row-main { flex: 1; min-width: 180px; }
.admin-row-title { font-weight: 700; font-size: 15.5px; }
.admin-row-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.admin-row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.editor-section { padding: 24px; margin-bottom: 22px; }
.editor-section h2 { font-size: 17px; margin-bottom: 18px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.photo-cell { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; background: var(--surface-2); border: 1px solid var(--border); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell .cover-tag { position: absolute; top: 8px; left: 8px; background: rgba(217,168,78,.92); color: #1a1405; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; }
.photo-cell .cell-actions { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 6px; }
.photo-cell .cell-actions button, .photo-cell .cell-actions form button {
  background: rgba(10,12,16,.75); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px; font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; backdrop-filter: blur(3px);
}
.photo-cell .cell-actions button:hover { background: rgba(10,12,16,.95); }

.upload-zone {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--gold); color: var(--text); }
.upload-zone input { display: none; }
.upload-progress { font-size: 13px; color: var(--gold-2); margin-top: 10px; display: none; }

.mini-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.mini-row .mini-label { overflow-wrap: anywhere; }

.danger-zone { border-color: rgba(239,106,106,.35); }

.footer-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 40px; }

@media (max-width: 560px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .detail-addr { font-size: 23px; }
  .section-head h1 { font-size: 22px; }
  .admin-row .thumb, .admin-row .thumb-empty { display: none; }
}

@media (max-width: 600px) { .brand-tagline { display: none; } .topbar { gap: 12px; } .topbar-actions { gap: 8px; flex-shrink: 0; } }
@media (max-width: 420px) { .topbar-actions > span { display: none; } }

.gallery-main { position: relative; touch-action: pan-y pinch-zoom; }
.gallery-main:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 52px; border-radius: 12px; border: 1px solid rgba(255,255,255,.5); background: rgba(11,14,19,.8); color: #fff; font-size: 34px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1; }
.gallery-nav:hover, .gallery-nav:focus-visible { background: #151a23; border-color: var(--gold); outline: 2px solid var(--gold); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-counter { position: absolute; bottom: 12px; right: 12px; background: rgba(11,14,19,.85); color: #fff; border-radius: 8px; padding: 3px 9px; font-size: 13px; pointer-events: none; }
