:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1d2420;
  --muted: #6b726d;
  --line: #e4e0d6;
  --primary: #9c1a15;
  --primary-hover: #7d1511;
  --primary-text: #9c1a15;
  --primary-ink: #ffffff;
  --primary-soft: #f6e0de;
  --accent: #c08a3e;
  --danger: #b3412e;
  --danger-line: #e7c4bd;
  --danger-soft: #fbeeeb;
  --header-bg: rgba(255,255,255,.92);
  --input-bg: #fbfaf7;
  --hover: #efece4;
  --media-bg: #e9e5da;
  --ph-1: #ece8de;
  --ph-2: #e6e1d5;
  --ph-text: #a49c88;
  --badge-bg: rgba(255,255,255,.95);
  --toast-bg: #1d2420;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121011;
  --surface: #1d1a1b;
  --text: #f1eceb;
  --muted: #a39b9a;
  --line: #332d2e;
  --primary-text: #ec5b52;
  --primary-soft: #3b1715;
  --danger: #f07a68;
  --danger-line: #5a2a25;
  --danger-soft: #2f1916;
  --header-bg: rgba(22,19,20,.9);
  --input-bg: #161314;
  --hover: #2a2526;
  --media-bg: #262122;
  --ph-1: #221e1f;
  --ph-2: #1c1819;
  --ph-text: #6c6364;
  --badge-bg: rgba(29,26,27,.92);
  --toast-bg: #f1eceb;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .toast { color: #121011; }
/* خريطة ليلية في الوضع الداكن */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.5); }
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip { background: var(--surface); color: var(--text); }
:root[data-theme="dark"] .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(29,26,27,.8); color: var(--muted); }
body { transition: background .25s, color .25s; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-whatsapp { background: #1f9d55; color: #fff; }
.icon-btn {
  border: 0; background: var(--hover); width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 16px; color: var(--text);
}
.theme-btn { width: 40px; height: 40px; font-size: 18px; flex: none; }
.link-btn {
  background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer;
  text-decoration: underline; padding: 0;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
/* الشعار: حزم صحراوي يتقدمه بيت */
:root { --logo-gold: #C9A35C; --logo-house: #8E1B1F; }
:root[data-theme="dark"] { --logo-house: #F7F3EA; }
.brand-mark { width: 50px; height: 42px; display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: auto; display: block; }
.logo-dune { fill: var(--logo-gold); }
.logo-house { fill: var(--logo-house); }
.logo-door { fill: var(--surface); }
.brand strong { display: block; font-family: "Reem Kufi", "Tajawal", sans-serif; font-size: 20px; font-weight: 700; line-height: 1.2; }
.brand small { display: block; color: var(--accent); font-size: 13px; margin-top: -4px; font-weight: 700; }
.nav { display: flex; gap: 22px; margin-inline-start: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--primary-text); }

/* Hero */
.hero {
  background:
    linear-gradient(160deg, rgba(60,9,7,.95), rgba(156,26,21,.88)),
    radial-gradient(circle at 20% 20%, #c08a3e 0, transparent 50%);
  color: #fff; padding: 64px 0 80px;
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; }
.hero h1 span { color: #f0c27a; }
.hero p { opacity: .88; font-size: 18px; margin: 10px 0 28px; }.search-bar {
  display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 8px;
  background: var(--surface); padding: 8px; border-radius: 14px; box-shadow: var(--shadow);
}
.search-bar input, .search-bar select {
  font: inherit; border: 1px solid var(--line); background: var(--input-bg); color: var(--text);
  border-radius: 10px; padding: 11px 12px; min-width: 0;
}

/* Sections */
.section { padding: 48px 0 8px; }
#listings { margin-top: -40px; padding-top: 0; }
#listings .section-head {
  background: var(--surface); padding: 14px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-head h2 { font-size: 24px; }
.count { color: var(--muted); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s; border: 1px solid transparent;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.1); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.card-media { position: relative; aspect-ratio: 16 / 10; background: var(--media-bg); overflow: hidden; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .card-media img, .card:hover .card-media video { transform: scale(1.04); }
.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; color: var(--ph-text);
  background: repeating-linear-gradient(45deg, var(--ph-1) 0 12px, var(--ph-2) 12px 24px);
}
.badges { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 6px; }
.badge {
  font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--badge-bg); color: var(--text);
}
.badge-sale { background: var(--primary); color: #fff; }
.badge-rent { background: var(--accent); color: #fff; }
.photo-count {
  position: absolute; bottom: 10px; inset-inline-end: 10px; font-size: 12px;
  background: rgba(0,0,0,.55); color: #fff; padding: 2px 8px; border-radius: 999px;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.price { color: var(--primary-text); font-weight: 800; font-size: 20px; }
.price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.card-title { font-size: 17px; font-weight: 700; }
.location { color: var(--muted); font-size: 14px; display: flex; gap: 4px; align-items: center; }
.specs {
  display: flex; gap: 14px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); flex-wrap: wrap;
}
.specs b { color: var(--text); }

.add-card {
  font: inherit; color: var(--text); cursor: pointer; min-height: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px;
  text-align: center; transition: border-color .15s, background .15s, transform .15s;
}
.add-card:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-3px); }
.add-card b { font-size: 18px; }
.add-card .muted { font-size: 14px; }
.add-icon {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 32px; line-height: 1; margin-bottom: 6px;
  box-shadow: 0 8px 20px rgba(156,26,21,.3);
}

/* Floating add button (phones) */
.fab {
  display: none; position: fixed; bottom: 20px; left: 16px; z-index: 1500;
  align-items: center; gap: 6px; font: inherit; font-weight: 800; font-size: 15px;
  background: var(--primary); color: #fff; border: 0; border-radius: 999px; padding: 13px 20px;
  box-shadow: 0 10px 28px rgba(156,26,21,.45); cursor: pointer;
}
.fab span { font-size: 22px; line-height: 1; }

.empty {
  text-align: center; padding: 48px 16px; background: var(--surface);
  border-radius: var(--radius); border: 2px dashed var(--line); color: var(--muted);
}

/* Map */
.map { height: 440px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); z-index: 0; }
.map-small { height: 260px; box-shadow: none; border: 1px solid var(--line); }
.leaflet-container { font-family: inherit; }
.map-popup { direction: rtl; text-align: right; min-width: 180px; }
.map-popup img { border-radius: 8px; margin-bottom: 6px; aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.map-popup b { display: block; font-size: 14px; }
.map-popup .p { color: var(--primary-text); font-weight: 800; }
.map-popup button { margin-top: 6px; width: 100%; padding: 6px; font-size: 13px; }

/* Price pins */
.pin-wrap { direction: ltr; }
.pin-wrap:hover, .pin-wrap.active { z-index: 9999 !important; }
.price-pin {
  position: absolute; left: 0; bottom: 9px; transform: translateX(-50%);
  background: var(--primary); color: #fff;
  font: 800 13px/1 "Tajawal", system-ui, sans-serif; letter-spacing: .2px;
  padding: 7px 12px 6px; border-radius: 999px; white-space: nowrap; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.28);
  transition: transform .18s ease, background .18s, box-shadow .18s;
}
.price-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
  background: inherit; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg); border-bottom-right-radius: 2px;
}
.price-pin.rent { background: var(--accent); }
.pin-wrap:hover .price-pin { transform: translateX(-50%) scale(1.1); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.pin-wrap.active .price-pin { background: var(--text); color: var(--surface); transform: translateX(-50%) scale(1.12); }
.pin-wrap.active .price-pin::after { background: var(--text); }

.map-legend {
  direction: rtl; display: flex; gap: 14px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 13px; font-weight: 700;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.map-legend .sale { background: var(--primary); }
.map-legend .rent { background: var(--accent); }

/* Contact & footer */
.contact {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 28px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px; margin-top: 48px;
}
.contact-info { display: flex; flex-direction: column; gap: 16px; }
.contact-info h2, .contact-info p { margin: 0; }
.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.office-hours { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.office-hours > span { font-size: 22px; }
.office-hours b { display: block; font-size: 14px; }
.office-hours div span { color: var(--muted); font-size: 15px; }
.office-map { height: 280px; box-shadow: none; border: 1px solid var(--line); }

/* دبوس المكتب */
.office-pin {
  position: absolute; left: 0; bottom: 9px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 2px solid var(--logo-gold);
  font: 800 13px/1 "Tajawal", system-ui, sans-serif; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.office-pin svg { width: 30px; height: 25px; display: block; }
.office-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--surface); border-right: 2px solid var(--logo-gold); border-bottom: 2px solid var(--logo-gold);
  transform: rotate(45deg); border-bottom-right-radius: 2px;
}
.map-legend .office { background: var(--logo-gold); }
.map-popup .muted { display: block; font-size: 13px; margin: 2px 0 4px; }
.map-popup a.btn { margin-top: 6px; width: 100%; padding: 6px; font-size: 13px; color: #fff; }
.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-tools { display: flex; gap: 16px; }

/* Dialogs */
.dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(680px, 100% - 24px);
  max-height: calc(100vh - 32px); background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.dialog-wide { width: min(960px, 100% - 24px); }
.dialog::backdrop { background: rgba(30,8,10,.55); }
.dialog-body { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-head h3 { font-size: 21px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label, .field-label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.span-2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--input-bg); color: var(--text);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.search-bar input:focus, .search-bar select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field-label { margin-bottom: 6px; }

/* سنوي / شهري */
.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 12px;
}
.form-grid .segmented label { display: block; cursor: pointer; font-weight: 700; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 9px; border-radius: 9px; color: var(--muted);
  transition: background .15s, color .15s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(156,26,21,.3); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
#rentPeriodWrap:not([hidden]) { animation: slideDown .2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } }

.price-pin small { font-size: 10px; font-weight: 700; opacity: .85; margin-inline-start: 2px; }
.coords { font-size: 13px; margin-top: 6px; }

.dropzone {
  display: grid !important; place-items: center; padding: 22px; border: 2px dashed var(--line);
  border-radius: 12px; cursor: pointer; color: var(--muted); font-weight: 500 !important;
  background: var(--input-bg); transition: border-color .15s, background .15s;
}
.dropzone.over, .dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--media-bg); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-video { background: #111; }
.thumb .play-tag {
  position: absolute; bottom: 4px; inset-inline-start: 4px; font-size: 11px;
  background: rgba(0,0,0,.7); color: #fff; padding: 1px 6px; border-radius: 6px;
}
.thumb .main-tag {
  position: absolute; bottom: 4px; inset-inline-start: 4px; font-size: 11px;
  background: var(--primary); color: #fff; padding: 1px 6px; border-radius: 6px;
}
.thumb-actions { position: absolute; top: 4px; inset-inline-end: 4px; display: flex; gap: 4px; }
.thumb-actions button {
  width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 1;
}
.thumbs .loading { display: grid; place-items: center; font-size: 12px; color: var(--muted); }

/* Details */
.gallery {
  position: relative; border-radius: 14px; overflow: hidden; background: var(--media-bg);
  height: clamp(220px, 42vh, 380px);
}
.gallery .stage { width: 100%; height: 100%; }
.gallery .stage img { width: 100%; height: 100%; object-fit: cover; }
.gallery .stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.gallery .nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px;
  border-radius: 50%; border: 0; background: var(--badge-bg); color: var(--text); cursor: pointer; font-size: 20px;
}
.gallery .prev { right: 12px; }
.gallery .next { left: 12px; }
.gallery .counter {
  position: absolute; bottom: 12px; left: 12px; background: rgba(0,0,0,.6); color: #fff;
  font-size: 13px; padding: 2px 10px; border-radius: 999px;
}
.strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 4px; }
.strip img, .strip-video {
  width: 72px; height: 52px; object-fit: cover; border-radius: 8px; cursor: pointer;
  opacity: .6; flex: none; border: 2px solid transparent; transition: opacity .15s;
}
.strip-video { background: #111; color: #fff; font-size: 16px; display: grid; place-items: center; padding: 0; }
.strip img:hover, .strip-video:hover { opacity: .85; }
.strip img.active, .strip-video.active { opacity: 1; border-color: var(--primary); }
.gallery .nav-btn { z-index: 1; }
.gallery .counter { z-index: 1; }
.details-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-top: 20px; }
.details-grid h3 { font-size: 24px; }
.spec-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.spec-box { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.spec-box b { display: block; font-size: 20px; color: var(--primary-text); }
.spec-box span { font-size: 13px; color: var(--muted); }
.desc { white-space: pre-line; }
.side-card { background: var(--bg); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.side-card .price { font-size: 26px; }
.side-card .map-small { height: 200px; }
/* معلومات صاحب العقار — للإدارة فقط */
.owner-fields { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; min-width: 0; }
.owner-fields legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.owner-box { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.owner-box h4 { margin: 0; font-size: 14px; }
.owner-box .owner-notes { white-space: pre-wrap; font-size: 14px; }
.owner-box .owner-actions { display: flex; gap: 8px; }
.owner-box .owner-actions .btn { flex: 1; }
.admin-row { display: flex; gap: 8px; }
.admin-row .btn { flex: 1; }

/* Photo zoom */
.gallery .stage img { cursor: zoom-in; }
.zoom-btn {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
  border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; backdrop-filter: blur(6px);
}
.zoom-btn:hover { background: var(--primary); }

.zoom-dialog {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; inset: 0;
  padding: 0; border: 0; background: rgba(12,10,10,.97); color: #fff; overflow: hidden;
}
.zoom-dialog::backdrop { background: rgba(0,0,0,.85); }
.zoom-dialog[open] { animation: zoomIn .2s ease; }
@keyframes zoomIn { from { opacity: 0; } }
.zoom-viewport {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  touch-action: none; cursor: zoom-in; user-select: none;
}
.zoom-viewport.zoomed { cursor: grab; }
.zoom-viewport.zoomed.dragging { cursor: grabbing; }
.zoom-viewport img {
  max-width: 92vw; max-height: calc(100vh - 140px); object-fit: contain;
  transition: transform .15s ease-out; will-change: transform; pointer-events: none;
}
.zoom-viewport.dragging img { transition: none; }
.zoom-close {
  position: absolute; top: 16px; right: 16px; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; cursor: pointer;
}
.zoom-close:hover { background: var(--primary); }
.zoom-toolbar {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2; direction: ltr;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px;
  background: rgba(30,26,27,.92); box-shadow: 0 10px 30px rgba(0,0,0,.5); backdrop-filter: blur(8px);
}
.zoom-toolbar button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 22px; line-height: 1;
}
.zoom-toolbar button:hover { background: var(--primary); }
.zoom-toolbar .zoom-reset { width: auto; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.zoom-toolbar input[type="range"] { width: 170px; accent-color: var(--primary); cursor: pointer; }
.zoom-level { min-width: 48px; text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

/* ===== Admin page ===== */
.locked .admin-app, .locked .fab { display: none !important; }
.login-gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(160deg, rgba(60,9,7,.95), rgba(156,26,21,.88));
}
.login-card {
  width: min(400px, 100%); background: var(--surface); color: var(--text); border-radius: 20px;
  padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-card .brand-mark { margin: 0 auto 4px; width: 84px; height: 70px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: -6px 0 4px; }
.login-card .btn { padding: 12px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; text-align: right; }
.field input {
  font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; background: var(--input-bg); color: var(--text);
}
.field input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.form-error { color: var(--danger); font-size: 14px; font-weight: 700; min-height: 1em; }

.nav-btn-link { background: none; border: 0; font: inherit; color: var(--muted); font-weight: 500; cursor: pointer; padding: 0; }
.nav-btn-link:hover { color: var(--primary-text); }
.mobile-only { display: none; }
.title-actions { gap: 8px; flex-wrap: wrap; }
.title-actions .btn { flex: 1; padding: 9px 12px; font-size: 14px; }

.admin-main { padding: 32px 0 48px; }
.admin-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.admin-title h1 { font-size: 28px; }
.admin-title p { margin: 4px 0 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--primary);
}
.stat-card span { font-size: 14px; }
.stat-card b { font-size: 30px; line-height: 1.1; }

.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-filters { display: flex; gap: 8px; flex: 1; max-width: 520px; }
.admin-filters input, .admin-filters select {
  font: inherit; border: 1px solid var(--line); background: var(--input-bg); color: var(--text);
  border-radius: 10px; padding: 9px 12px; min-width: 0;
}
.admin-filters input { flex: 1; }
.admin-filters input:focus, .admin-filters select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

.admin-item {
  display: grid; grid-template-columns: 104px minmax(0, 1.7fr) minmax(0, 1fr) auto auto;
  align-items: center; gap: 18px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
.admin-item:last-child { border-bottom: 0; }
.admin-item:hover { background: var(--hover); }
.ai-thumb { width: 104px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--media-bg); }
.ai-thumb img, .ai-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-main b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-main .muted { font-size: 13px; }
.ai-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.ai-tags .badge { font-size: 12px; padding: 1px 9px; }
.badge-outline { background: transparent; border: 1px solid var(--line); }
.badge-warn { background: #fff3d6; color: #8a5a00; }
:root[data-theme="dark"] .badge-warn { background: #3a2e12; color: #f2c46b; }
.ai-price { font-size: 17px; white-space: nowrap; }
.ai-specs { display: flex; gap: 10px; font-size: 13px; white-space: nowrap; }
.ai-actions { display: flex; gap: 6px; }
.ai-actions .btn { padding: 7px 12px; font-size: 13px; }
.panel .empty { border: 0; border-radius: 0; box-shadow: none; }

.backup-panel { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px; flex-wrap: wrap; }
.backup-panel h3 { font-size: 18px; }
.backup-panel p { margin: 4px 0 0; font-size: 14px; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dialog-narrow { width: min(440px, 100% - 24px); }

.confirm-body { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.confirm-icon {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: var(--danger-soft); border: 1px solid var(--danger-line);
}
.confirm-body h3 { font-size: 21px; }
.confirm-body p { margin: 0; font-size: 14px; }
.confirm-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: right;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.confirm-item .ai-thumb { width: 72px; height: 52px; flex: none; }
.confirm-foot { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.confirm-foot .btn { flex: 1; padding: 11px; }
.btn-danger-solid { background: #c0281f; color: #fff; }
.btn-danger-solid:hover { background: #9e1f18; }
.form-grid.single { grid-template-columns: 1fr; }

@media (max-width: 1000px) {
  .admin-item { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .ai-thumb { width: 90px; height: 64px; }
  .ai-specs { grid-column: 2 / -1; }
  .ai-actions { grid-column: 1 / -1; }
  .ai-actions .btn { flex: 1; }
}
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .mobile-only { display: inline-flex; }
}
@media (max-width: 520px) {
  .admin-item { grid-template-columns: 80px minmax(0, 1fr); gap: 10px 12px; }
  .ai-thumb { width: 80px; height: 60px; }
  .ai-price, .ai-specs { grid-column: 2; }
  .admin-title { flex-direction: column; align-items: stretch; }
  .admin-filters { max-width: none; }
  .stat-card b { font-size: 24px; }
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--toast-bg); color: #fff; padding: 10px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 3000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive */
@media (max-width: 860px) {
  .nav { display: none; }
  .header-inner { justify-content: space-between; gap: 10px; }
  .theme-btn { margin-inline-start: auto; }
  .fab { display: inline-flex; }
  #addBtn { display: none; }
  .search-bar { grid-template-columns: 1fr 1fr; }
  .search-bar input { grid-column: span 2; }
  .details-grid { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; padding: 20px; }
}
@media (max-width: 520px) {
  .brand strong { font-size: 17px; }
  .brand small { font-size: 11px; }
  .btn { padding: 9px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .spec-boxes { grid-template-columns: repeat(2, 1fr); }
  .map { height: 340px; }
  .hero { padding: 40px 0 70px; }
  .dialog-body { padding: 16px; }
  .zoom-toolbar { gap: 6px; padding: 6px 8px; }
  .zoom-toolbar input[type="range"] { width: 90px; }
  .zoom-toolbar .zoom-reset { padding: 0 10px; }
}
