:root {
  --bg: #f3eee6;
  --bg-2: #ebe4d8;
  --surface: #fffcf7;
  --ink: #1b1714;
  --muted: #6d645b;
  --line: #e2d9cd;
  --line-strong: #cfc3b3;
  --accent: #2c5c50;
  --accent-2: #1f443b;
  --cta: #d15a2a;
  --cta-2: #b4481d;
  --gold: #c9a15b;
  --danger: #9f2d2d;
  --ok: #2c6a45;
  --shadow: 0 10px 30px rgba(28, 22, 16, 0.07);
  --shadow-sm: 0 2px 8px rgba(28, 22, 16, 0.05);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --serif: "Source Serif 4", "Times New Roman", serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f8e7c8 0%, transparent 50%),
    radial-gradient(900px 400px at 110% 0%, #dce8e2 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--cta); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, white);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
}
.logo {
  display: flex; align-items: baseline; gap: 8px;
  color: var(--ink); flex-shrink: 0;
}
.logo .mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo .dot { color: var(--cta); }
.logo .sub { display: none; color: var(--muted); font-size: 0.78rem; }

.search-form { flex: 1; display: flex; gap: 8px; min-width: 0; }
.search-form input[type="search"] {
  flex: 1; min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
.search-form input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lang-toggle {
  display: inline-flex; border: 1px solid var(--line-strong);
  border-radius: 999px; overflow: hidden; background: var(--surface);
}
.lang-toggle button {
  border: 0; background: transparent; padding: 6px 9px;
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
}
.lang-toggle button.active { background: var(--ink); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 16px; font-weight: 650; letter-spacing: -0.01em;
  transition: 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-2); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-2); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.88rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px;
  scrollbar-width: thin;
}
.chip {
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.chip:hover, .chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Home hero */
.hero { padding: 28px 0 8px; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}
.hero p { margin: 0; color: var(--muted); max-width: 40rem; }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px;
}
.filters select { width: auto; min-width: 220px; flex: 1; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 10px 12px; outline: none; }
.field select, .field input, .field textarea {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 8px 0 32px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  color: inherit;
  min-height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.card.featured { border-color: color-mix(in srgb, var(--gold) 70%, var(--line)); box-shadow: 0 8px 24px rgba(160, 120, 40, 0.12); }
.card.highlighted { background: linear-gradient(#fffaf0, var(--surface)); }
.card-photo {
  aspect-ratio: 4/3; background: var(--bg-2);
  position: relative; overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo .ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--muted); font-weight: 600;
}
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 4px 8px; border-radius: 999px;
  background: #fff; color: var(--ink);
}
.badge-demo { background: var(--ink); color: #fff; }
.badge-feat { background: var(--gold); color: #2a1f0a; }
.card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-price { font-weight: 800; font-size: 1.08rem; }
.card-title { font-weight: 700; line-height: 1.3; }
.card-meta { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 0.82rem; display: flex; justify-content: space-between; gap: 8px; }

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

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-bottom: 40px; }

/* Ad page */
.ad-layout { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 24px; padding: 24px 0 48px; }
.gallery {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.gallery-main { aspect-ratio: 4/3; background: #1b1714; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: 8px; width: 68px; height: 52px; overflow: hidden; background: var(--bg-2); }
.thumbs button.active { border-color: var(--cta); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.ad-copy { margin-top: 20px; }
.ad-copy h1 { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 8px; letter-spacing: -0.03em; }
.ad-desc { white-space: pre-wrap; font-size: 1.02rem; }
.side-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); position: sticky; top: 88px;
}
.side-card .price { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; }
.side-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }
.phone-box { font-size: 1.2rem; font-weight: 700; margin: 8px 0 14px; }
.side-actions { display: flex; flex-direction: column; gap: 8px; }

/* Forms */
.page-narrow { width: min(640px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 64px; }
.page-wide { padding: 24px 0 64px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; box-shadow: var(--shadow-sm);
}
.panel h1, .page-wide h1 { font-family: var(--serif); letter-spacing: -0.03em; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 650; font-size: 0.92rem; }
.hint { color: var(--muted); font-size: 0.84rem; }
.error, .form-error { color: var(--danger); font-weight: 600; min-height: 1.2em; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute !important; left: -9999px; opacity: 0; height: 0; width: 0; }
.photo-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item button {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  border: 0; border-radius: 50%; background: #fff; font-weight: 800;
}
.add-photo {
  border: 1px dashed var(--line-strong); border-radius: 12px; aspect-ratio: 1;
  display: grid; place-items: center; background: #fff; color: var(--muted); font-weight: 650;
}

/* My ads / admin */
.table-cards { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center;
}
.row-card img, .row-card .ph { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--bg-2); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #1b1714; color: #f6e7c8; padding: 10px 14px; border-radius: 10px;
  font-size: 1.15rem; letter-spacing: 0.08em; display: inline-block;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: #1b1714;
  color: #efe7dc;
  padding: 32px 0 24px;
  margin-top: auto;
}
.site-footer a { color: #f3c27d; }
.site-footer .foot-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.site-footer .muted { color: #b7ao97; color: #b8ada2; font-size: 0.9rem; }
#footer-content p { margin: 0 0 8px; }
.foot-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* Toast + modal */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1b1714; color: #fff; padding: 12px 14px; border-radius: 12px;
  box-shadow: var(--shadow); max-width: 320px;
}
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 16, 12, 0.45);
  display: grid; place-items: center; z-index: 70; padding: 16px;
}
.modal { background: var(--surface); border-radius: 18px; padding: 22px; width: min(440px, 100%); box-shadow: var(--shadow); }

body { display: flex; flex-direction: column; }
main { flex: 1; }

.user-menu { position: relative; }
.user-menu .drop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  min-width: 180px; box-shadow: var(--shadow); padding: 6px;
}
.user-menu.open .drop { display: flex; flex-direction: column; }
.user-menu .drop a, .user-menu .drop button {
  background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 8px; color: inherit; width: 100%;
}
.user-menu .drop a:hover, .user-menu .drop button:hover { background: var(--bg-2); }

@media (max-width: 860px) {
  .ad-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .header-row { flex-wrap: wrap; }
  .search-form { order: 3; flex-basis: 100%; }
  .logo .mark { font-size: 1.3rem; }
  .btn-post-label { display: none; }
  .row-2, .site-footer .foot-grid, .row-card { grid-template-columns: 1fr; }
  .row-card img, .row-card .ph { width: 100%; height: 140px; }
}

.pay-disabled {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-2) 60%, var(--surface));
}
.pay-disabled h3 { margin-top: 0; }


/* Free-post CTA on home / category listings */
.post-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  padding: 18px 20px;
  background:
    linear-gradient(120deg, #2c5c50 0%, #1f443b 58%, #35533a 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.post-cta strong {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  display: block;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.post-cta p { margin: 0; color: rgba(255, 255, 255, 0.84); max-width: 38rem; font-size: 0.95rem; }
.post-cta .btn-primary { background: #fff; color: var(--accent-2); font-weight: 800; }
.post-cta .btn-primary:hover { background: #f8e7c8; color: var(--ink); }

.demo-contact {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

@media (max-width: 860px) {
  .post-cta { padding: 16px; }
  .post-cta .btn-primary { width: 100%; text-align: center; }
}
