:root {
  --bg: #f3efe6;
  --bg-deep: #e7e0d2;
  --ink: #1c2420;
  --muted: #5c6b63;
  --line: #c9c0b0;
  --card: #fffdf8;
  --accent: #0f6b4c;
  --accent-2: #c45c26;
  --warn: #8a5a00;
  --danger: #8b2e2e;
  --ok: #0f6b4c;
  --shadow: 0 12px 40px rgba(28, 36, 32, 0.08);
  --radius: 18px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #fff8e8 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, #d9ebe2 0%, transparent 35%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(243, 239, 230, 0.88);
  border-bottom: 1px solid rgba(201, 192, 176, 0.7);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}
.brand {
  font-family: var(--font);
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.nav { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.nav a, .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { background: rgba(15, 107, 76, 0.08); }
.btn-primary {
  background: var(--accent);
  color: #fff !important;
  text-decoration: none !important;
}
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  text-decoration: none !important;
}
.btn-outline:hover {
  background: rgba(15, 107, 76, 0.08);
  text-decoration: none;
}
.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.btn-warn { background: var(--accent-2); color: #fff; border: 0; }
.btn-danger { background: var(--danger); color: #fff; border: 0; }
.btn-ok { background: var(--ok); color: #fff; border: 0; }
.btn-edit-profile {
  width: 100%;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 107, 76, 0.28);
  margin: 0.5rem 0 0.35rem;
}
.btn-edit-profile:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(15, 107, 76, 0.35);
}

.hero {
  padding: 2.5rem 0 1.5rem;
}
.hero h1 {
  font-family: var(--font);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
  max-width: 14ch;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
  font-size: 1.05rem;
}

.auth-stack {
  width: min(520px, 100%);
  margin: 0 auto 3rem;
}
.auth-stack-wide {
  width: min(640px, 100%);
}
.auth-stack .hero {
  padding-bottom: 1rem;
}
.auth-stack .hero h1,
.auth-stack .hero p {
  max-width: none;
  width: 100%;
}
.auth-stack .panel {
  width: 100%;
  margin: 0;
}

.flash {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.ok { border-color: #9dcbba; background: #eef8f3; color: var(--ok); }
.flash.error { border-color: #e0b4b4; background: #fff1f1; color: var(--danger); }

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters-geo {
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr auto;
}
.filters input:not([type="checkbox"]):not([type="radio"]),
.filters select,
.form input:not([type="checkbox"]):not([type="radio"]),
.form select,
.form textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.filter-check {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
}
.filter-check input {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}
.form label { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--muted); }
.auth-stack .form .field > label {
  font-weight: 700;
  color: var(--ink);
}
.auth-stack .form .check {
  font-weight: 400;
  color: var(--ink);
}
.field-error {
  min-height: 1.1em;
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--danger);
  line-height: 1.3;
}
.field-error-form {
  margin: 0 0 1rem;
  font-weight: 600;
}
.field-error:empty {
  display: none;
}
.field.has-error input,
.field.has-error textarea,
.field.has-error select,
.field.has-error .zone-picker,
.score-row.has-error select {
  border-color: var(--danger);
}
.field.has-error input[type="file"] {
  outline: 1px solid var(--danger);
  outline-offset: 2px;
}
.score-row .field-error {
  grid-column: 1 / -1;
}
.form .field { margin-bottom: 1rem; }
.form textarea { min-height: 120px; resize: vertical; }

#zone-filter,
#trade-filter {
  margin-bottom: 0.85rem;
}
.zone-picker {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 360px;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.badge.distance {
  background: #efe6d8;
  color: #6a4a22;
}
.zone-group {
  margin: 0 0 0.55rem;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.zone-group:last-child {
  margin-bottom: 0;
}
.zone-group legend {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.12rem 0;
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.25;
}
.check input { width: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card h2, .card h3 {
  font-family: var(--font);
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.meta { color: var(--muted); font-size: 0.92rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e7f4ee;
  color: var(--accent);
  width: fit-content;
}
.badge.pending { background: #fff3d6; color: var(--warn); }
.badge.rejected { background: #f8e4e4; color: var(--danger); }
.table tr.row-disabled td { opacity: 0.72; }
.admin-actions-cell {
  min-width: 16rem;
  vertical-align: middle;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.6rem;
  align-items: center;
  max-width: 22rem;
}
.admin-actions form {
  display: inline-flex;
  margin: 0;
}
.admin-actions .btn {
  white-space: nowrap;
}
.badge.unverified {
  background: #f8e4e4;
  color: #9b1c1c;
}
.stars { color: var(--accent-2); letter-spacing: 0.05em; }
.card .actions { margin-top: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.stat-card-action {
  justify-content: center;
}
.stat-label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.stat-value {
  margin: 0.35rem 0 0.2rem;
  font-family: var(--font);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}
.stat-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.profile {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.25rem;
  margin: 1.5rem 0 2.5rem;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.panel h1 {
  font-family: var(--font);
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}
.criteria {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}
.criteria div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.25rem;
  font-size: 0.92rem;
}

.aside-reviews .criteria {
  grid-template-columns: 1fr;
}
.aside-reviews .review {
  font-size: 0.95rem;
}
.review {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}
.review:first-child,
.aside-reviews .review:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.review-photos {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.review-photos img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.provider-reply {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: #eef6f2;
  border-radius: 0 12px 12px 0;
}
.provider-reply p { margin: 0.35rem 0; }
.reply-box {
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}
.reply-box summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
.work-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0 1rem;
}
.work-photo {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.work-photo-open {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  width: 100%;
}
.work-photo img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.work-photo figcaption {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.work-photo-delete {
  padding: 0 0.65rem 0.65rem;
}

body.lightbox-open { overflow: hidden; }
.lightbox[hidden] { display: none !important; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 32, 0.55);
}
.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 3.5rem));
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--card, #fffdf8);
  border: 1px solid var(--line, #c9c0b0);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(28, 36, 32, 0.22);
  overflow: hidden;
}
.lightbox-media {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0ebe2;
  padding: 3.25rem 3.75rem 1.25rem;
}
.lightbox-media img {
  display: block;
  max-width: calc(100% - 1rem);
  max-height: min(62vh, 560px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-meta {
  flex: 0 0 auto;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid var(--line, #c9c0b0);
  background: #fff;
}
.lightbox-caption {
  margin: 0;
  color: var(--ink, #1c2420);
  font-size: 0.95rem;
}
.lightbox-counter {
  color: var(--muted, #5c6b63);
  font-size: 0.82rem;
}
.lightbox-close,
.lightbox-nav {
  border: 0;
  cursor: pointer;
  color: var(--ink, #1c2420);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line, #c9c0b0);
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.lightbox-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.lightbox-prev { left: 0.75rem; }
.lightbox-next { right: 0.75rem; }
.lightbox-nav:hover,
.lightbox-close:hover {
  background: #fff;
}

.score-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.score-row select { max-width: 120px; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}
.muted { color: var(--muted); }
.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(201, 192, 176, 0.6);
}

@media (max-width: 900px) {
  .filters, .filters-geo { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: 1fr; }
  .profile { grid-template-columns: 1fr; }
  .criteria { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 1fr; }
}
