/* =====================================================
   TOKENS & RESET — BellaVista Style
   ===================================================== */
:root {
  --white:      #ffffff;
  --black:      #111111;
  --grey:       #666666;
  --grey-light: #999999;
  --border:     #e0e0e0;
  --border-light: #ddd;
  --danger:     #e03d3d;
  --success:    #10b981;
  --mercado:    #1e5080;
  --testigo:    #1a5c3a;
  --accent:     #b8962e;
  --display: 'Playfair Display', Georgia, serif;
  --body:    'Inter', 'Helvetica Neue', Helvetica, sans-serif;
  --r: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body::before {
    content: '';
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent);
    z-index: 200;
}
html, body { height: 100%; }
body {
  font-family: var(--body); font-size: 14px;
  -webkit-font-smoothing: antialiased; color: var(--black);
  background: var(--white);
}
button { cursor: pointer; font-family: var(--body); }
input, select, textarea { font-family: var(--body); }
a { text-decoration: none; color: inherit; }
::selection { background: var(--black); color: var(--white); }

/* =====================================================
   BUTTONS — BellaVista outline/solid language
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; transition: all 250ms;
  white-space: nowrap; line-height: 1.4;
}
.btn-primary {
  background: var(--black); color: var(--white);
  border-color: var(--black);
}
.btn-primary:hover { background: transparent; color: var(--black); }
.btn-ghost {
  background: transparent; color: var(--grey);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { border-color: var(--black); color: var(--black); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: 6px 12px; font-size: 10px; }
.btn-lg   { padding: 12px 28px; font-size: 12px; }

/* =====================================================
   HEADER (global — same as landing)
   ===================================================== */
.header {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 1000;
  background: var(--black);
}
.header-inner {
  display: flex; align-items: center; justify-content: center; gap: 40px;
  padding: 14px 40px;
  max-width: 1500px; margin: 0 auto;
  position: relative;
}
.header-left, .header-right {
  display: flex; gap: 32px;
  list-style: none;
  flex: 1;
}
.header-left { justify-content: flex-end; }
.header-right { justify-content: flex-start; }
.header-link {
  font-family: var(--body); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  transition: color 200ms;
  white-space: nowrap;
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
}
.header-link:hover,
.header-link.active { color: #b8962e; }
.header-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 200ms;
}
.header-link:hover::after,
.header-link.active::after {
  transform: scaleX(1);
}
.header-logo {
  font-family: var(--display); font-size: clamp(22px, 2vw, 28px);
  font-weight: 600; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--white);
  white-space: nowrap;
  text-decoration: none;
}

/* Map toolbar (stats + filter toggle) */
.map-toolbar {
  position: fixed; top: 56px; left: 0; right: 0; z-index: 800;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
}
.filter-toggle-btn {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--black); color: var(--white);
  border: none; padding: 7px 16px;
  font-family: var(--body); font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
  transition: background 200ms;
}
.filter-toggle-btn:hover { background: #333; }
.filter-toggle-btn svg { flex-shrink: 0; }

.stats-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center;
}
.stat-pill {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--grey);
  padding: 4px 12px; font-size: 11px; font-weight: 500;
}
.stat-pill strong { color: var(--black); font-weight: 600; }

.header-login-btn {
    position: absolute; right: 40px; top: 50%; transform: translateY(-50%);
    background: none; border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    font-family: var(--body); font-size: 10px; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase;
    padding: 6px 18px; cursor: pointer;
    transition: all 250ms; white-space: nowrap;
}
.header-login-btn:hover { background: var(--white); color: var(--black); border-color: var(--white); }

/* Modal Login */
.modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal-content {
    background: var(--white); padding: 48px 40px 40px;
    max-width: 420px; width: 90%; position: relative;
    text-align: center;
}
.modal-login { max-width: 380px; }

.modal-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none;
    font-size: 24px; color: var(--grey-light);
    cursor: pointer; line-height: 1;
}

.modal-title {
    font-family: var(--display); font-size: 24px; font-weight: 500;
    margin-bottom: 28px;
}

.form-group-modal {
    text-align: left; margin-bottom: 14px;
}
.form-group-modal label {
    display: block;
    font-family: var(--body); font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--grey-light); margin-bottom: 6px;
}
.form-group-modal input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border);
    font-family: var(--body); font-size: 13px; outline: none;
}
.form-group-modal input:focus { border-color: var(--black); }

.login-error { font-size: 12px; color: #c0392b; margin-bottom: 12px; min-height: 18px; }

.btn-login-submit {
    width: 100%; padding: 12px;
    font-family: var(--body); font-size: 11px; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase;
    cursor: pointer; border: none;
    color: var(--white); background: #b8962e;
    transition: background 200ms;
}
.btn-login-submit:hover { background: #a07e24; }
.btn-login-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* =====================================================
   MAP PAGE
   ===================================================== */
body.map-page { overflow: hidden; }
#map { position: fixed; top: 90px; left: 0; right: 0; bottom: 0; z-index: 1; }

.map-loading {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 2000;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; padding: 28px 36px;
  pointer-events: none;
}
.map-loading.done { opacity: 0; transition: opacity 0.3s; }
.map-loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border); border-top-color: var(--black);
  border-radius: 50%;
  animation: map-spin 0.7s linear infinite;
}
.map-loading span {
  font-size: 12px; font-weight: 500; color: var(--grey);
  letter-spacing: 0.04em;
}
@keyframes map-spin { to { transform: rotate(360deg); } }

/* Filter panel */
.filters-panel {
  position: fixed; top: 60px; left: -300px; width: 300px; bottom: 0;
  z-index: 900; background: var(--white);
  box-shadow: none; border-right: 1px solid var(--border);
  transition: left .3s ease;
  display: flex; flex-direction: column;
}
.filters-panel.open { left: 0; }
.filters-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--black); color: var(--white);
  border-bottom: 1px solid var(--border);
}
.filters-header h3 {
  font-family: var(--display); font-size: 14px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.filters-close {
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 22px; line-height: 1; transition: color .15s;
}
.filters-close:hover { color: var(--white); }
.filters-body {
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  flex: 1; overflow-y: auto;
}
.filters-body label {
  display: block;
  font-family: var(--body); font-size: 10px; font-weight: 600;
  color: var(--grey-light); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.filters-body select,
.filters-body input[type="number"] {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border-light); border-radius: 4px;
  font-size: 13px; background: var(--white); color: var(--black); outline: none;
  transition: border-color .2s;
}
.filters-body select:focus,
.filters-body input[type="number"]:focus { border-color: var(--black); }
.filters-actions { display: flex; gap: 8px; margin-top: 4px; }

/* =====================================================
   PRICE MARKERS
   ===================================================== */
.price-marker-wrap { background: none !important; border: none !important; }
.price-bubble {
  background: var(--black);
  border: 1px solid var(--white);
  color: var(--white);
  padding: 5px 12px 5px 9px;
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s;
  letter-spacing: 0.02em;
}
.price-bubble:hover { transform: scale(1.08) translateY(-2px); }
.price-bubble svg { color: var(--grey-light); flex-shrink: 0; }
.price-bubble-tail {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--black);
  margin: 0 auto;
}

.price-bubble.mercado {
  background: var(--mercado);
  border-color: var(--white);
  color: var(--white);
}
.price-bubble.mercado svg { color: rgba(255,255,255,0.7); }
.price-bubble-tail.mercado { border-top-color: var(--mercado); }

.price-bubble.testigo {
  background: var(--testigo);
  border-color: var(--white);
  color: var(--white);
}
.price-bubble.testigo svg { color: rgba(255,255,255,0.7); }
.price-bubble-tail.testigo { border-top-color: var(--testigo); }

/* =====================================================
   CUSTOM POPUP
   ===================================================== */
.custom-popup .leaflet-popup-content-wrapper {
  padding: 0; border-radius: 0; overflow: hidden;
  border: 1px solid var(--border);
}
.custom-popup .leaflet-popup-content { margin: 0; width: 290px !important; }
.custom-popup .leaflet-popup-tip-container { display: none; }
.leaflet-popup-close-button {
  z-index: 10 !important; top: 8px !important; right: 10px !important;
  color: white !important; font-size: 18px !important;
  background: rgba(0,0,0,.5) !important; border-radius: 50% !important;
  width: 22px !important; height: 22px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
}

/* Carousel */
.popup-carousel { position: relative; height: 165px; background: var(--border); overflow: hidden; }
.carousel-track { width: 100%; height: 100%; }
.carousel-slide  { width: 100%; height: 100%; object-fit: cover; display: none; }
.carousel-slide.active { display: block; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.5); color: white;
  border: none; width: 28px; height: 28px; border-radius: 50%;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; transition: background .15s;
}
.carousel-btn:hover { background: rgba(0,0,0,.7); }
.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }
.carousel-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; z-index: 2;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; transition: background .2s; }
.dot.active { background: white; }

/* Carousel loading */
.popup-carousel-loading { background: #1a1a1a; }
.popup-carousel-loading .carousel-slide { display: none; }
.carousel-spinner {
  position: absolute; top: 50%; left: 50%; margin-left: -10px; margin-top: -10px;
  width: 20px; height: 20px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.7);
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
  z-index: 3;
}
.popup-no-photo {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--grey-light); gap: 8px; font-size: 12px;
}

/* Popup body */
.popup-body { padding: 14px 16px 16px; }
.popup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.popup-tipo {
  background: var(--black); color: var(--white);
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.popup-fecha {
  font-size: 10px; font-weight: 500;
  color: var(--grey-light); letter-spacing: 0.05em;
}
.popup-cat {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.popup-cat-mercado { background: var(--mercado); color: var(--white); }
.popup-cat-testigo  { background: var(--testigo); color: var(--white); }
.popup-nombre {
  font-family: var(--body); font-size: 14px; font-weight: 600;
  color: var(--black); margin-bottom: 3px; line-height: 1.3;
  letter-spacing: 0.01em;
}
.popup-dir { font-size: 11px; color: var(--grey); margin-bottom: 8px; }
.popup-precio {
  font-family: var(--body); font-size: 22px; font-weight: 600;
  color: var(--black); margin-bottom: 10px; letter-spacing: -0.02em;
}
.popup-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; margin-bottom: 6px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.popup-stats span { font-size: 12px; color: var(--grey); }
.popup-stats strong { color: var(--black); font-weight: 600; }
.popup-plazo {
  font-size: 11px; color: var(--grey); margin-bottom: 6px;
  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px;
}
.popup-plazo strong { color: var(--black); font-weight: 600; }
.popup-desc {
  font-size: 12px; color: var(--grey); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.btn-clone:hover { border-color: var(--black); color: var(--black); background: transparent; }

/* =====================================================
   ADMIN PAGE — LOGIN
   ===================================================== */
body.admin-page { background: var(--white); }
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--white);
}
.login-card {
  background: var(--white); padding: 44px 40px;
  width: 400px; text-align: center;
  border: 1px solid var(--border);
}
.login-logo {
  width: 64px; height: 64px;
  border: 2px solid var(--black);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.login-logo span {
  font-family: var(--display); font-size: 24px; font-weight: 600;
  color: var(--black); letter-spacing: 0.04em;
}
.login-card h2 {
  font-family: var(--display);
  font-size: 26px; font-weight: 600;
  color: var(--black); margin-bottom: 2px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.login-subtitle {
  font-size: 10px; font-weight: 600;
  color: var(--grey-light); margin-bottom: 28px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.login-card .form-group { text-align: left; margin-bottom: 16px; }
.login-card label {
  display: block;
  font-size: 10px; font-weight: 600;
  color: var(--grey-light); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.login-card input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border-light); font-size: 14px;
  outline: none; transition: border-color .2s;
}
.login-card input:focus { border-color: var(--black); }
.login-card input.error { border-color: var(--danger); }
.error-msg  { color: var(--danger); font-size: 11px; margin-bottom: 12px; min-height: 16px; }
.login-hint { font-size: 11px; color: var(--grey-light); margin-top: 18px; }
.login-hint code { background: transparent; padding: 2px 6px; border: 1px solid var(--border-light); font-family: monospace; }

/* =====================================================
   ADMIN APP LAYOUT
   ===================================================== */
.admin-app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 230px; min-width: 230px;
  background: var(--black);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  padding: 22px 18px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar .brand-logo { border-color: rgba(255,255,255,0.3); }
.sidebar .brand-logo span { color: var(--white); }
.sidebar .brand-name {
  color: var(--white);
  font-family: var(--display); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar .brand-sub  {
  color: rgba(255,255,255,0.5);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.sidebar-nav {
  padding: 14px 10px; flex: 1;
  display: flex; flex-direction: column; gap: 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(255,255,255,0.5); background: none; border: none;
  width: 100%; text-align: left; cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: var(--white); color: var(--black); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .btn-ghost {
  color: rgba(255,255,255,0.5);
  border-color: rgba(255,255,255,0.15);
  font-size: 10px; letter-spacing: 0.1em;
  width: 100%; justify-content: center;
}
.sidebar .btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border-color: rgba(255,255,255,0.3);
}

/* Main content */
.admin-main { flex: 1; overflow-y: auto; min-width: 0; }
.section { display: none; padding: 30px 30px 50px; }
.section.active { display: block; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px;
}
.section-header h1 {
  font-family: var(--display); font-size: 24px; font-weight: 500;
  color: var(--black); letter-spacing: 0.04em;
}

/* =====================================================
   DASHBOARD — STATS GRID
   ===================================================== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--white); padding: 22px 20px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
}
.stat-card.accent { background: var(--black); border-color: var(--black); }
.stat-icon { font-size: 30px; flex-shrink: 0; }
.stat-value {
  font-family: var(--body); font-size: 21px; font-weight: 600;
  color: var(--black); line-height: 1; margin-bottom: 5px;
}
.stat-label {
  font-size: 10px; font-weight: 600;
  color: var(--grey-light);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.stat-card.accent .stat-value { color: var(--white); }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.5); }

/* =====================================================
   SECTION CARD
   ===================================================== */
.section-card {
  background: var(--white); padding: 26px;
  border: 1px solid var(--border);
}
.section-card h2 {
  font-family: var(--display); font-size: 15px; font-weight: 500;
  color: var(--black); margin-bottom: 18px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-header h2 { margin: 0; }

/* Recent list */
.recent-list { display: flex; flex-direction: column; gap: 4px; }
.recent-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px;
  cursor: pointer; transition: background .15s;
  border: 1px solid transparent;
}
.recent-item:hover { background: transparent; border-color: var(--border-light); }
.recent-thumb {
  width: 46px; height: 46px;
  overflow: hidden; background: var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-thumb { font-size: 20px; }
.recent-info { flex: 1; min-width: 0; }
.recent-info strong {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--black);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-info span { font-size: 11px; color: var(--grey-light); }
.recent-meta { text-align: right; flex-shrink: 0; }
.recent-price {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--black);
}
.recent-date  { font-size: 11px; color: var(--grey-light); }
.empty-msg { color: var(--grey-light); font-size: 13px; padding: 10px 0; }

/* =====================================================
   FORM
   ===================================================== */
.form-layout { display: grid; grid-template-columns: 1fr 390px; gap: 22px; align-items: start; }
.form-row       { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 10px; font-weight: 600;
  color: var(--grey-light); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border-light);
  font-size: 13px; color: var(--black); background: var(--white);
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--black); }
.form-group textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.form-actions {
  display: flex; gap: 12px; padding-top: 6px; margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* =====================================================
   PHOTO UPLOAD
   ===================================================== */
.photo-upload-zone {
  border: 1px solid var(--border-light);
  padding: 26px; text-align: center;
  cursor: pointer; transition: all .2s; color: var(--grey-light);
  background: var(--white);
}
.photo-upload-zone:hover,
.photo-upload-zone.dragover { border-color: var(--black); background: transparent; color: var(--black); }
.photo-upload-zone p { font-size: 13px; font-weight: 500; margin: 8px 0 4px; color: var(--grey); }
.photo-upload-zone span { font-size: 11px; color: var(--grey-light); }
.photo-preview-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px;
}
.photo-preview-item {
  position: relative; aspect-ratio: 1;
  overflow: hidden; background: var(--border);
  border: 1px solid var(--border-light);
}
.photo-preview-item.is-primary {
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,.65); color: white;
  border: none; border-radius: 50%;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.photo-remove:hover { background: var(--danger); }
.photo-main-badge {
  position: absolute; bottom: 4px; left: 4px;
  background: var(--black); color: var(--white);
  font-size: 9px; font-weight: 600;
  padding: 2px 6px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.photo-make-main {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(255,255,255,.92); color: var(--black);
  border: 1px solid rgba(0,0,0,.08);
  font-size: 9px; font-weight: 700;
  padding: 3px 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
  cursor: pointer; transition: all .15s;
}
.photo-make-main:hover {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.business-plan-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.business-plan-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  background: var(--white);
}

.business-plan-card svg {
  color: var(--accent);
  flex-shrink: 0;
}

.business-plan-card-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.business-plan-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
}

.business-plan-card-meta {
  font-size: 12px;
  color: var(--grey);
}

.business-plan-remove {
  margin-left: auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--black);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all .15s;
}

.business-plan-remove:hover {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

/* =====================================================
   MAP PICKER
   ===================================================== */
.map-picker-hint {
  font-size: 12px; color: var(--grey-light);
  margin: -10px 0 14px; line-height: 1.5;
}
.pick-map {
  height: 250px; overflow: hidden;
  border: 1px solid var(--border-light);
  cursor: crosshair !important;
}
.coord-display {
  margin-top: 10px; padding: 9px 13px;
  background: var(--white); border: 1px solid var(--border-light);
  font-size: 11px; color: var(--grey-light); font-family: monospace;
}
.coord-display.has-coords { color: var(--success); border-color: rgba(16,185,129,.3); }

/* =====================================================
   TABLE
   ===================================================== */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.table-toolbar input {
  width: 340px; max-width: 100%;
  padding: 9px 13px; border: 1px solid var(--border-light);
  font-size: 13px; outline: none;
}
.table-toolbar input:focus { border-color: var(--black); }
.table-count { font-size: 11px; color: var(--grey-light); flex-shrink: 0; }
.table-wrap { overflow-x: auto; }
.ventas-table { width: 100%; border-collapse: collapse; }
.ventas-table th {
  text-align: left; padding: 10px 14px;
  font-family: var(--body); font-size: 10px; font-weight: 600;
  color: var(--grey-light);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ventas-table td {
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--black); vertical-align: middle;
}
.ventas-table tbody tr:hover td { background: transparent; }
.table-cell-name { display: flex; align-items: center; gap: 12px; }
.table-thumb { width: 42px; height: 42px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border-light); }
.table-thumb-placeholder {
  width: 42px; height: 42px; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.table-name { font-weight: 500; color: var(--black); }
.table-addr { font-size: 11px; color: var(--grey-light); margin-top: 1px; }
.badge {
  padding: 3px 10px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.badge-tipo { background: var(--black); color: var(--white); }
.price-cell { font-weight: 600; color: var(--black); }
.table-actions { display: flex; gap: 6px; }
.btn-icon {
  background: none; border: 1px solid var(--border-light);
  padding: 6px 8px; cursor: pointer; transition: all .15s;
  color: var(--grey); display: inline-flex; align-items: center;
}
.btn-icon:hover { border-color: var(--black); color: var(--black); }
.btn-delete:hover { border-color: var(--danger); color: var(--danger); }
.btn-edit:hover  { border-color: var(--black); color: var(--black); }

/* =====================================================
   SETTINGS
   ===================================================== */
.settings-hint {
  font-size: 13px; color: var(--grey); margin: -10px 0 18px; line-height: 1.5;
}
.settings-hint code {
  background: transparent; padding: 2px 6px;
  border: 1px solid var(--border-light); font-family: monospace;
}

/* =====================================================
   TOAST
   ===================================================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--black); color: var(--white);
  padding: 12px 20px;
  font-size: 12px; font-weight: 500;
  z-index: 9999;
  transform: translateY(90px); opacity: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  pointer-events: none;
  border-left: 3px solid transparent;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left-color: var(--success); }
.toast.error   { background: var(--danger); border-left-color: rgba(255,255,255,.3); }

/* =====================================================
    RESPONSIVE
    ===================================================== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1080px) {
  .form-layout { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .navbar-center { display: none; }
}
@media (max-width: 680px) {
  .section { padding: 20px 16px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .section-header h1 { font-size: 18px; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .sidebar { width: 200px; min-width: 200px; }
}

/* =====================================================
    MOBILE — Map page
    ===================================================== */
.header-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
}
.header-mobile-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--white);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--white);
  display: none;
  flex-direction: column;
  padding: 80px 24px 40px;
  overflow-y: auto;
}
.nav-overlay.open { display: flex; }
.nav-close {
  position: absolute;
  top: 18px;
  right: 24px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--black);
  cursor: pointer;
}
.nav-overlay-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.nav-overlay a {
  display: block;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
  color: var(--black);
  margin-bottom: 14px;
  transition: opacity 200ms;
}
.nav-overlay a:hover { opacity: 0.5; }

@media (max-width: 860px) {
  .header-inner {
    justify-content: space-between;
    padding: 12px 16px;
  }
  .header-left, .header-right, .header-login-btn { display: none; }
  .header-mobile-toggle { display: flex; }
  .header-logo {
    font-size: 18px;
    letter-spacing: 0.06em;
  }

  .map-toolbar {
    top: 54px;
    padding: 8px 12px;
    justify-content: flex-start;
  }
  .filter-toggle-btn {
    position: static;
    transform: none;
    padding: 6px 12px;
    font-size: 9px;
  }
  .stats-bar {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stat-pill {
    padding: 3px 8px;
    font-size: 10px;
    flex-shrink: 0;
  }

  #map { top: 92px; }

  .filters-panel {
    width: 100%;
    left: -100%;
    top: 0;
    bottom: 0;
  }
  .filters-header {
    padding: 14px 16px;
    padding-top: 60px;
  }
}
