:root {
  --forest: #1f3d2b;
  --forest-2: #2f6b45;
  --ink: #18201b;
  --muted: #69736b;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --surface-2: #edf1ea;
  --line: #d9dfd5;
  --amber: #dfaf2b;
  --danger: #b3352d;
  --radius: 8px;
  --shadow: 0 18px 42px rgba(31, 61, 43, 0.12);
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header,
.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 14px max(18px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(31, 61, 43, 0.14);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  border-radius: 7px;
  background: var(--forest);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.site-nav,
.admin-header nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-weight: 750;
}

.site-nav a:hover,
.admin-header a:hover {
  color: var(--forest);
}

.header-action,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 850;
}

.header-action,
.button-primary {
  background: var(--forest-2);
  color: #fff;
}

.button-primary:hover,
.header-action:hover {
  background: var(--forest);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--forest);
}

.full {
  width: 100%;
}

.nav-toggle {
  display: none;
}

.hero {
  min-height: 610px;
  display: grid;
  align-items: end;
  padding: 96px max(18px, calc((100vw - var(--max)) / 2)) 52px;
  background:
    linear-gradient(90deg, rgba(20, 31, 23, 0.94), rgba(31, 61, 43, 0.84) 54%, rgba(31, 61, 43, 0.42)),
    url("https://images.unsplash.com/photo-1518709268805-4e9042af2176?auto=format&fit=crop&w=2200&q=78") center / cover;
  color: #fff;
}

.hero-content {
  width: min(100%, 980px);
}

.kicker {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.page-title h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero p:not(.kicker),
.page-title > p {
  max-width: 740px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.12rem;
}

.search-panel {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr auto;
  gap: 12px;
  margin-top: 34px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.search-panel.compact {
  grid-template-columns: 1fr auto;
  max-width: 760px;
  background: var(--surface);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(223, 175, 43, 0.26);
  border-color: var(--amber);
}

.section {
  width: min(100% - 36px, var(--max));
  margin: 0 auto;
  padding: 68px 0;
}

.section-muted {
  width: 100%;
  padding-inline: max(18px, calc((100vw - var(--max)) / 2));
  background: var(--surface-2);
}

.section-heading {
  margin-bottom: 28px;
}

.split-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.category-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: -28px;
  padding-top: 0;
}

.category-strip a {
  min-height: 132px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.category-strip strong,
.category-strip span {
  display: block;
}

.category-strip strong {
  color: var(--forest);
  font-size: 1.08rem;
}

.category-strip span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.ad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ad-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(31, 61, 43, 0.08);
}

.ad-image img {
  width: 100%;
  aspect-ratio: 1.35;
  object-fit: cover;
  background: var(--surface-2);
}

.ad-body {
  padding: 18px;
}

.ad-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ad-meta span,
.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef5ea;
  color: var(--forest);
  font-size: 0.76rem;
  font-weight: 850;
}

.ad-card h3 {
  min-height: 54px;
  margin: 0 0 10px;
  font-size: 1.14rem;
  line-height: 1.22;
}

.ad-card p {
  min-height: 66px;
  margin: 0;
  color: var(--muted);
}

.ad-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.ad-specs div,
.detail-list div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.ad-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.ad-footer strong,
.price {
  color: var(--forest);
  font-size: 1.08rem;
}

.text-link {
  color: var(--forest-2);
  font-weight: 850;
}

.page-title {
  padding-top: 92px;
}

.page-title p {
  color: var(--muted);
}

.ad-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 28px;
  align-items: start;
  padding-top: 92px;
}

.gallery {
  display: grid;
  gap: 12px;
}

.gallery img {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 1.35;
  object-fit: cover;
  background: var(--surface-2);
}

.detail-panel,
.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel {
  position: sticky;
  top: 92px;
  padding: 24px;
}

.detail-panel h1 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
  line-height: 1.06;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.description-section,
.seo-block {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) 1fr;
  gap: 44px;
  align-items: start;
}

.rich-text,
.seo-block p {
  color: var(--muted);
  font-size: 1.06rem;
}

.empty-state {
  border: 1px dashed #bcc8b7;
  border-radius: var(--radius);
  padding: 34px;
  background: rgba(255, 255, 255, 0.62);
}

.empty-state h2,
.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(100% - 36px, var(--max));
  margin: 0 auto;
  padding: 30px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer strong {
  color: var(--ink);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--forest);
  font-weight: 850;
}

.admin-page {
  background: #eef2eb;
}

.admin-header {
  position: sticky;
  background: #fff;
}

.admin-header nav {
  justify-self: end;
}

.admin-shell {
  width: min(100% - 36px, var(--max));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.admin-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.admin-title h1,
.login-card h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-weight: 850;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--forest);
  font-size: 2rem;
}

.admin-card {
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.admin-table td > span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.published {
  background: #e4f4e7;
}

.status.sold {
  background: #f4e6e4;
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.actions a,
.actions button {
  border: 0;
  background: transparent;
  color: var(--forest-2);
  cursor: pointer;
  padding: 0;
  font-weight: 850;
}

.actions button {
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-2 {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.check-row input {
  width: auto;
}

.check-row span {
  margin: 0;
  color: var(--ink);
  text-transform: none;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.image-list label {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.image-list img {
  width: 100%;
  aspect-ratio: 1.25;
  border-radius: 6px;
  object-fit: cover;
}

.image-list input {
  width: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
}

.alert {
  margin: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #f8e6e3;
  color: var(--danger);
  font-weight: 800;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 920px) {
  .site-header {
    grid-template-columns: auto auto;
  }

  .header-action {
    display: none;
  }

  .nav-toggle {
    justify-self: end;
    display: inline-grid;
    gap: 5px;
    width: 42px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: auto;
    background: var(--forest);
  }

  .site-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    display: none;
    padding-top: 6px;
  }

  .site-nav.is-open {
    display: grid;
    gap: 2px;
  }

  .site-nav a {
    padding: 10px 0;
  }

  .search-panel,
  .search-panel.compact,
  .category-strip,
  .ad-grid,
  .ad-detail,
  .description-section,
  .seo-block {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .metric-grid,
  .image-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero {
    min-height: 680px;
    padding-inline: 14px;
  }

  .section,
  .site-footer,
  .admin-shell {
    width: min(100% - 28px, var(--max));
  }

  .section-muted {
    padding-inline: 14px;
  }

  .split-heading,
  .admin-title,
  .site-footer,
  .form-actions,
  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-header {
    display: flex;
  }

  .admin-header nav {
    justify-content: space-between;
    gap: 10px;
  }

  .form-grid,
  .metric-grid,
  .image-list {
    grid-template-columns: 1fr;
  }
}
