:root {
  color-scheme: light;
  --ink: #171918;
  --muted: #626865;
  --line: #d9dedb;
  --surface: #ffffff;
  --canvas: #f2f5f3;
  --red: #e84338;
  --red-dark: #b52620;
  --blue: #2255d9;
  --green: #1c7455;
  --yellow: #ffd24a;
  --shadow: 0 12px 32px rgb(25 34 29 / 9%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

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

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

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

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgb(217 222 219 / 85%);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: var(--red);
  font-family: Georgia, serif;
  font-size: 20px;
}

.header-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions form,
.row-actions form {
  margin: 0;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  border-color: #9fa8a3;
  background: #f7f9f8;
}

.icon-button.danger {
  color: var(--red-dark);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 720;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.button-primary {
  color: #fff;
  background: var(--ink);
}

.button-primary:hover {
  background: #303431;
}

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

.market-hero {
  position: relative;
  min-height: min(410px, 54vh);
  overflow: hidden;
  background: #1c2320;
}

.market-hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(12 17 15 / 82%) 0%, rgb(12 17 15 / 45%) 50%, rgb(12 17 15 / 8%) 100%);
  content: "";
}

.market-hero img {
  width: 100%;
  height: min(410px, 54vh);
  object-fit: cover;
  object-position: center 48%;
}

.market-hero-overlay {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: clamp(20px, 6vw, 86px);
  width: min(650px, calc(100% - 40px));
  color: #fff;
  transform: translateY(-50%);
}

.market-hero h1 {
  max-width: 620px;
  margin: 9px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 500;
  line-height: 0.98;
}

.market-hero p:last-child {
  max-width: 470px;
  margin: 0;
  color: rgb(255 255 255 / 84%);
  font-size: 17px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.market-hero .eyebrow {
  color: var(--yellow);
}

.catalog-section,
.admin-page,
.detail-page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.section-heading,
.admin-heading,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.section-heading h2,
.admin-heading h1,
.form-heading h1 {
  margin: 5px 0 0;
  font-size: 30px;
}

.item-count {
  color: var(--muted);
  font-size: 14px;
}

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

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 5px 20px rgb(25 34 29 / 5%);
}

.product-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e7ece9;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.product-card:hover .product-media img {
  transform: scale(1.025);
}

.product-placeholder,
.detail-placeholder,
.admin-thumb span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-family: Georgia, serif;
  font-size: 64px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
  background: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-media .status-badge {
  position: absolute;
  top: 12px;
  left: 12px;
}

.status-available {
  background: var(--green);
}

.status-reserved {
  color: #251c00;
  background: var(--yellow);
}

.status-sold {
  background: #666d69;
}

.product-card-body {
  display: flex;
  min-height: 100px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.product-card h3 a {
  text-decoration: none;
}

.product-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.product-card strong {
  flex: 0 0 auto;
  font-size: 17px;
}

.empty-state {
  padding: 46px 28px;
  border: 1px dashed #aeb7b2;
  border-radius: 6px;
  text-align: center;
  background: rgb(255 255 255 / 55%);
}

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

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 42px;
  align-items: start;
}

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

.gallery img,
.detail-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: #e5ebe7;
}

.item-summary {
  position: sticky;
  top: 90px;
}

.item-summary h1 {
  margin: 15px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.05;
}

.detail-price {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 780;
}

.item-facts {
  margin: 0;
  border-top: 1px solid var(--line);
}

.item-facts div {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.item-facts dt {
  color: var(--muted);
}

.item-facts dd {
  margin: 0;
  font-weight: 650;
}

.item-description {
  padding: 22px 0;
}

.item-description h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.item-description p {
  margin: 0;
  color: #434844;
  line-height: 1.65;
  white-space: pre-line;
}

.copy-link {
  width: 100%;
}

.auth-page,
.error-page {
  display: grid;
  min-height: calc(100vh - 128px);
  place-items: center;
  padding: 40px 18px;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 7px 0 24px;
  font-size: 30px;
}

.stacked-form,
.item-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #333835;
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #bfc7c2;
  border-radius: 4px;
  color: var(--ink);
  outline: none;
  background: var(--surface);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(34 85 217 / 13%);
}

.form-alert,
.field-error {
  color: var(--red-dark);
}

.form-alert {
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  background: #fff1f0;
}

.field-error {
  font-size: 12px;
  font-weight: 600;
}

.admin-heading {
  margin-bottom: 24px;
}

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

.admin-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.admin-thumb {
  width: 92px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: #e7ece9;
}

.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-thumb span {
  font-size: 34px;
}

.admin-item-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.admin-item-title h2 {
  margin: 0;
  font-size: 17px;
}

.admin-item-main p {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form-heading {
  margin-bottom: 24px;
}

.item-form {
  gap: 14px;
}

.form-section {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.form-section h2 {
  margin: 0 0 20px;
  font-size: 17px;
}

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

.span-two {
  grid-column: span 2;
}

.currency-input {
  display: flex;
  min-height: 43px;
  align-items: center;
  border: 1px solid #bfc7c2;
  border-radius: 4px;
  background: var(--surface);
}

.currency-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(34 85 217 / 13%);
}

.currency-input > span {
  padding-left: 12px;
  color: var(--muted);
}

.currency-input input {
  border: 0;
  box-shadow: none;
}

.existing-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.existing-photo {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.existing-photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.existing-photo span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 12px;
}

.existing-photo input {
  width: 16px;
  min-height: 16px;
}

.upload-field {
  display: grid;
  min-height: 120px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #9fa9a3;
  border-radius: 5px;
  cursor: pointer;
  background: #f8faf9;
}

.upload-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-field span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 760;
}

.upload-field small {
  color: var(--muted);
  font-weight: 500;
}

.publish-section {
  padding-block: 17px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-row span {
  display: grid;
  gap: 3px;
}

.toggle-row small {
  color: var(--muted);
  font-weight: 500;
}

.toggle-row input {
  width: 44px;
  min-height: 24px;
  accent-color: var(--green);
}

.form-actions {
  padding-top: 8px;
}

.error-page {
  align-content: center;
  text-align: center;
}

.error-page h1 {
  margin: 8px 0;
}

.error-page > p:not(.eyebrow) {
  margin: 0 0 22px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
}

@media (max-width: 840px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .item-summary {
    position: static;
  }

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

@media (max-width: 600px) {
  .site-header {
    min-height: 58px;
    padding: 9px 14px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .market-hero {
    min-height: 340px;
  }

  .market-hero img {
    height: 340px;
    object-position: 57% center;
  }

  .market-hero::after {
    background: linear-gradient(0deg, rgb(12 17 15 / 82%) 0%, rgb(12 17 15 / 15%) 85%);
  }

  .market-hero-overlay {
    top: auto;
    bottom: 28px;
    left: 18px;
    width: calc(100% - 36px);
    transform: none;
  }

  .market-hero h1 {
    font-size: 44px;
  }

  .catalog-section,
  .admin-page,
  .detail-page {
    width: min(100% - 24px, 1180px);
    padding-top: 28px;
  }

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

  .section-heading h2,
  .admin-heading h1,
  .form-heading h1 {
    font-size: 25px;
  }

  .product-card-body {
    min-height: 88px;
  }

  .admin-heading {
    align-items: flex-end;
  }

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

  .admin-thumb {
    width: 72px;
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }

  .admin-item-title {
    display: grid;
    gap: 4px;
  }

  .form-section {
    padding: 18px;
  }

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

  .span-two {
    grid-column: auto;
  }

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

  .form-actions {
    align-items: stretch;
  }

  .form-actions .button {
    flex: 1;
  }

  .site-footer {
    display: grid;
    justify-content: start;
    gap: 4px;
  }
}
