:root {
  --ink: #172026;
  --muted: #66747f;
  --line: #d9e1e6;
  --surface: #ffffff;
  --soft: #f4f7f5;
  --green: #0c8b68;
  --green-dark: #06614a;
  --coral: #e75f42;
  --gold: #d69513;
  --blue: #256fc7;
  --shadow: 0 18px 50px rgba(22, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf2ef;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(240px, 1fr) auto auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

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

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 750;
  white-space: nowrap;
}

.primary-action:hover {
  background: var(--green-dark);
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 46px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.lang-button {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.lang-button.is-active,
.lang-button:hover {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 1px 8px rgba(22, 32, 38, 0.08);
}

.account-action,
.admin-action {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.account-action.is-verified {
  border-color: #a5d2c3;
  background: #eef8f4;
  color: var(--green-dark);
}

.account-action.is-pending {
  border-color: #efd28f;
  background: #fff8e5;
  color: #8a5d00;
}

.admin-action {
  border-color: #cdd8e7;
  background: #f4f8fd;
  color: var(--blue);
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 40px;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-heading,
.listings-head,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 12px;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.icon-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.category-list {
  display: grid;
  gap: 6px;
}

.category-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.category-button:hover,
.category-button.is-active {
  border-color: #b6d9cd;
  background: #eef8f4;
}

.category-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--category-color, #dfe8e3);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.category-name {
  min-width: 0;
  overflow: visible;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.category-count {
  color: var(--muted);
  font-size: 13px;
}

.restricted-chip {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f7e9f0;
  color: #9d3768;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.market-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: stretch;
  min-height: 172px;
  padding: 24px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(12, 139, 104, 0.92), rgba(37, 111, 199, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='260' viewBox='0 0 900 260'%3E%3Crect width='900' height='260' fill='%23eef7f2'/%3E%3Cg fill='none' stroke='%23172026' stroke-opacity='.16' stroke-width='4'%3E%3Crect x='55' y='44' width='95' height='70' rx='10'/%3E%3Crect x='192' y='76' width='78' height='112' rx='12'/%3E%3Crect x='318' y='42' width='140' height='92' rx='10'/%3E%3Cpath d='M352 158h72m-36-24v50'/%3E%3Cpath d='M525 72h95l25 72h-145z'/%3E%3Ccircle cx='545' cy='169' r='16'/%3E%3Ccircle cx='613' cy='169' r='16'/%3E%3Crect x='704' y='48' width='90' height='116' rx='45'/%3E%3Cpath d='M720 196h58'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.market-intro h1,
.listings-head h2,
.dialog-head h2 {
  margin: 0;
  line-height: 1.1;
}

.market-intro h1 {
  max-width: 780px;
  font-size: 34px;
}

.site-address {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  align-items: center;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 850;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 112px);
  gap: 10px;
  align-content: center;
}

.quick-stats div {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
}

.quick-stats strong {
  font-size: 24px;
  line-height: 1;
}

.quick-stats span {
  font-size: 13px;
}

.category-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.category-tile {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.category-tile:hover {
  border-color: #a5d2c3;
  box-shadow: 0 10px 24px rgba(12, 139, 104, 0.12);
}

.tile-art {
  position: relative;
  width: 52px;
  height: 42px;
  border-radius: 8px;
  background: var(--category-color);
  overflow: hidden;
}

.tile-art::before,
.tile-art::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
}

.tile-art::before {
  width: 36px;
  height: 36px;
  right: -10px;
  top: -8px;
}

.tile-art::after {
  width: 22px;
  height: 22px;
  left: 8px;
  bottom: 8px;
}

.category-tile strong {
  line-height: 1.2;
}

.category-tile span {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.segmented button {
  padding: 0 12px;
  font-weight: 750;
}

.segmented button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.sort-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

select {
  padding: 0 12px;
}

.listings-head {
  margin-top: 4px;
}

.listings-head .eyebrow {
  color: var(--green-dark);
}

.listings-head h2 {
  font-size: 26px;
}

.result-count {
  color: var(--muted);
  font-weight: 750;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 16px;
}

.listing-card {
  display: grid;
  grid-template-rows: 156px auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.listing-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 156px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(135deg, var(--category-color), #eff5f0);
}

.listing-art.has-photo {
  background: #eef2f4;
}

.listing-art::before {
  position: absolute;
  inset: 24px;
  content: "";
  border: 3px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
}

.listing-art.has-photo::before {
  display: none;
}

.listing-art span {
  z-index: 1;
  display: grid;
  min-width: 64px;
  min-height: 64px;
  place-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.listing-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.listing-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.listing-meta,
.listing-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.listing-meta span {
  color: var(--muted);
  font-size: 13px;
}

.listing-body h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.listing-body p {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.price {
  font-size: 21px;
  font-weight: 900;
}

.soft-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #bdd8cf;
  border-radius: 8px;
  background: #eef8f4;
  color: var(--green-dark);
  font-weight: 800;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #bdd8cf;
  border-radius: 8px;
  background: #eef8f4;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.contact-link:hover {
  border-color: var(--green);
  background: #e1f3ec;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed #aab9c0;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.post-dialog,
.verify-dialog,
.admin-dialog {
  width: min(760px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.post-dialog::backdrop,
.verify-dialog::backdrop,
.admin-dialog::backdrop {
  background: rgba(23, 32, 38, 0.46);
}

.post-card {
  display: grid;
  gap: 20px;
  padding: 22px;
  background: #fff;
}

.dialog-head .eyebrow {
  color: var(--green-dark);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.wide {
  grid-column: 1 / -1;
}

.form-section {
  display: grid;
  gap: 10px;
}

.field-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

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

input,
textarea,
.form-grid select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(12, 139, 104, 0.14);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input[type="file"] {
  padding: 9px;
}

label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.photo-preview,
.admin-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-preview img,
.admin-thumbs img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.plan-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.plan-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  font-weight: 850;
}

.plan-picker label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.plan-picker input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.plan-picker strong,
.plan-picker small {
  display: block;
}

.plan-picker small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.verification-note {
  padding: 14px;
  border: 1px solid #f1d4df;
  border-radius: 8px;
  background: #fff5f8;
}

.verification-note strong {
  display: block;
  margin-bottom: 6px;
}

.verification-note p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.check-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  line-height: 1.4;
}

.check-line input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--green);
}

.admin-dialog {
  width: min(980px, calc(100vw - 24px));
}

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

.admin-section {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.admin-section h3 {
  margin: 0;
  font-size: 16px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-item strong,
.admin-item span {
  overflow-wrap: anywhere;
}

.admin-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.admin-actions button[data-admin-action="approve"],
.admin-actions button[data-admin-action="approve-listing"],
.admin-actions button[data-admin-action="approve-photos"] {
  border-color: #a5d2c3;
  background: #eef8f4;
  color: var(--green-dark);
}

.admin-actions button[data-admin-action="reject"],
.admin-actions button[data-admin-action="reject-listing"],
.admin-actions button[data-admin-action="reject-photos"] {
  border-color: #f1c1bb;
  background: #fff0ee;
  color: #a43a2b;
}

.admin-empty {
  padding: 14px;
  border: 1px dashed #aab9c0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.dialog-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: minmax(160px, 1fr) auto auto auto auto;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .topbar .primary-action {
    justify-self: end;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .category-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .category-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .search {
    grid-column: auto;
    grid-row: auto;
  }

  .language-switch {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar .primary-action {
    grid-column: auto;
    width: 100%;
  }

  .account-action,
  .admin-action {
    width: 100%;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    padding-top: 16px;
  }

  .market-intro {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .market-intro h1 {
    font-size: 28px;
  }

  .quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .category-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .listings-head,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-label {
    margin-left: 0;
  }

  .form-grid,
  .plan-picker,
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .category-list,
  .category-strip,
  .listing-grid {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }
}
