:root {
  color-scheme: light;
  --ink: #1d2527;
  --muted: #667176;
  --line: #d8dedf;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --gold: #d69f25;
  --rose: #bc475c;
  --shadow: 0 16px 40px rgba(30, 41, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(214, 159, 37, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8f5ef 0%, #edf6f4 48%, #f9f3f5 100%);
  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;
}

.app-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(29, 37, 39, 0.1);
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1.5rem, 8vw, 7rem);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.25rem, 2.6vw, 1.85rem);
  line-height: 1.05;
}

.brand p,
.section-heading p,
.seller-line,
label span {
  color: var(--muted);
}

.brand p {
  margin-top: 0.2rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}

.account-actions {
  display: flex;
  justify-content: flex-end;
  min-width: 9.5rem;
}

.tab-button,
.secondary-button,
.primary-button {
  min-height: 2.6rem;
  border: 0;
  border-radius: 7px;
  padding: 0.6rem 0.9rem;
  font-weight: 750;
}

.tab-button {
  background: transparent;
  color: var(--muted);
}

.tab-button.is-active,
.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover,
.tab-button.is-active:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.icon-button {
  display: grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 750;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.toolbar,
.panel {
  border: 1px solid rgba(29, 37, 39, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.notice {
  margin-bottom: 1rem;
  border: 1px solid rgba(188, 71, 92, 0.26);
  border-radius: 8px;
  background: #fff2f4;
  color: #713341;
  padding: 0.85rem 1rem;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(11rem, 16rem);
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
}

fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
}

legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  padding: 0 0.35rem;
}

label span {
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 0.65rem 0.75rem;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}

.section-heading h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.section-heading.compact {
  align-items: start;
}

.section-heading.compact h2 {
  font-size: 1.25rem;
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.agreement-box {
  display: grid;
  max-height: 240px;
  gap: 0.65rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 0.85rem;
}

.standalone-agreement {
  max-height: min(48vh, 440px);
  margin-bottom: 0.85rem;
}

.agreement-box h3 {
  font-size: 1rem;
}

.agreement-box p,
.agreement-check span {
  color: #405056;
  font-size: 0.92rem;
  line-height: 1.45;
}

.agreement-check {
  grid-template-columns: auto 1fr;
  align-items: start;
  margin-top: 0.25rem;
}

.agreement-check input {
  width: 1.1rem;
  min-height: 1.1rem;
  margin-top: 0.2rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(29, 37, 39, 0.48);
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.auth-modal {
  width: min(100%, 520px);
}

.agreement-modal {
  width: min(100%, 720px);
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

#authStatus.is-error {
  color: var(--rose);
  font-weight: 750;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.item-card {
  overflow: hidden;
  border: 1px solid rgba(29, 37, 39, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(30, 41, 45, 0.1);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.item-card:hover,
.item-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(30, 41, 45, 0.14);
}

.item-image {
  display: grid;
  min-height: 180px;
  aspect-ratio: 4 / 3;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(214, 159, 37, 0.18)),
    #eef4f2;
  color: var(--muted);
  font-weight: 800;
  overflow: hidden;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-body {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
}

.item-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.item-category {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.item-price {
  color: var(--rose);
  font-weight: 850;
}

.item-description {
  color: #405056;
  line-height: 1.45;
}

.seller-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.8fr);
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

form.panel {
  display: grid;
  gap: 0.9rem;
}

form.panel.is-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.payment-fields {
  display: grid;
  gap: 0.75rem;
}

.payment-field {
  grid-template-columns: 3rem minmax(4.5rem, 6rem) minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
}

.payment-field img,
.payment-option img {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  object-fit: contain;
  padding: 0.2rem;
}

.image-preview {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.preview-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.seller-list {
  display: grid;
  gap: 0.75rem;
}

.seller-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
  background: white;
}

.seller-thumb {
  display: grid;
  width: 4.5rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 7px;
  background: #eef4f2;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
}

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

.seller-row h3 {
  font-size: 1rem;
}

.seller-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 0;
}

.text-button.delete {
  color: var(--rose);
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
}

.item-modal {
  width: min(100%, 980px);
  max-height: min(92vh, 860px);
  overflow: auto;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr);
  gap: 1rem;
}

.gallery {
  display: grid;
  gap: 0.75rem;
}

.detail-image {
  display: grid;
  min-height: 380px;
  aspect-ratio: 4 / 3;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(214, 159, 37, 0.18)),
    #eef4f2;
  color: var(--muted);
  font-size: 2rem;
  font-weight: 850;
  overflow: hidden;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fbfa;
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.thumbnail-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.5rem;
}

.thumbnail-button {
  overflow: hidden;
  min-height: 4.5rem;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #eef4f2;
  padding: 0;
}

.thumbnail-button.is-active {
  border-color: var(--accent);
}

.thumbnail-button img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.detail-copy {
  display: grid;
  align-content: start;
  gap: 0.9rem;
}

.detail-price {
  color: var(--rose);
  font-size: 1.6rem;
  font-weight: 850;
}

.payment-options {
  display: grid;
  gap: 0.65rem;
}

.payment-option {
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  gap: 0.7rem;
  min-height: 3.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0.45rem 0.65rem;
  text-decoration: none;
  font-weight: 800;
}

.payment-option:hover {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--accent-strong);
}

.payment-note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-controls {
    align-items: stretch;
    gap: 1rem;
  }

  .tabs,
  .toolbar,
  .detail-layout,
  .seller-layout,
  .form-row,
  .payment-field {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    flex: 1 1 auto;
  }

  .account-actions {
    flex: 0 0 auto;
    min-width: 7.75rem;
  }

  .account-actions .secondary-button {
    width: 100%;
    min-height: 3rem;
  }

  .section-heading .secondary-button {
    width: 100%;
  }

  .detail-image {
    min-height: 260px;
  }
}
