:root {
  --ink: #17211c;
  --ink-soft: #28372f;
  --muted: #66736c;
  --line: #d8e2dc;
  --surface: #f5f7f2;
  --surface-strong: #edf4ec;
  --panel: #fffdf8;
  --accent: #14785e;
  --accent-dark: #0b5946;
  --accent-soft: #dcefd9;
  --warm: #f0b84f;
  --peach: #f7d8be;
  --sky: #dfeef7;
  --danger: #b7354b;
  --shadow: 0 16px 42px rgba(31, 49, 41, 0.11);
  --shadow-soft: 0 10px 24px rgba(31, 49, 41, 0.08);
}

* {
  letter-spacing: 0;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.container {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  width: min(100% - 2rem, 1120px);
}

.app-main {
  min-height: calc(100vh - 170px);
}

.narrow-page {
  max-width: 640px;
}

.app-nav {
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.app-nav .container {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.navbar-brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  gap: 0.6rem;
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--ink);
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 -5px 0 rgba(240, 184, 79, 0.7);
  color: #fff;
  display: inline-flex;
  font-size: 0.95rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.navbar-toggler {
  border-color: var(--line);
  border-radius: 8px;
}

.navbar-toggler-icon {
  background: var(--ink);
  border-radius: 999px;
  display: block;
  height: 2px;
  position: relative;
  width: 20px;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
  background: var(--ink);
  border-radius: 999px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  width: 20px;
}

.navbar-toggler-icon::before {
  top: -6px;
}

.navbar-toggler-icon::after {
  top: 6px;
}

.navbar-nav {
  gap: 0.2rem;
}

.nav-link {
  border-radius: 7px;
  color: var(--muted);
  font-weight: 700;
  padding: 0.5rem 0.75rem !important;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface-strong);
  color: var(--ink);
}

.nav-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-chip {
  background: var(--sky);
  border: 1px solid #c8dde9;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
  max-width: 180px;
  overflow: hidden;
  padding: 0.38rem 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  border-radius: 7px;
  font-weight: 750;
}

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
}

.btn-dark:hover,
.btn-dark:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-outline-dark {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus {
  background: var(--ink);
  border-color: var(--ink);
}

.btn-outline-secondary {
  border-color: var(--line);
  color: var(--muted);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
}

.btn-outline-danger {
  border-color: rgba(183, 53, 75, 0.35);
  color: var(--danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background: var(--danger);
  border-color: var(--danger);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

main > h1,
.section-title-row h1,
.section-title-row h2 {
  color: var(--ink);
  font-weight: 850;
  line-height: 1.15;
  margin: 0;
}

.page-band {
  align-items: center;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: -1.5rem calc(50% - 50vw) 2rem;
  padding: 2.4rem max(1rem, calc((100vw - 1120px) / 2));
  width: 100vw;
}

.page-band h1 {
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1.08;
  margin: 0;
  max-width: 720px;
  overflow-wrap: anywhere;
}

.page-band .lead {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-top: 0.7rem;
  max-width: 640px;
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.hero-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 0.45rem;
  justify-items: start;
  min-width: 230px;
  padding: 1.1rem;
}

.summary-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.hero-summary strong {
  color: var(--accent-dark);
  font-size: 2.3rem;
  line-height: 1;
}

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

.server-link {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.82rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
}

.server-link:hover {
  color: var(--ink);
}

.section-block {
  margin-top: 2.1rem;
}

.section-title-row {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
}

.section-title-row h1,
.section-title-row h2 {
  font-size: 1.6rem;
}

.split-actions {
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1.2rem 0;
}

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

.market-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.market-card:hover {
  border-color: #bfd3c7;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.market-card-image {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #eaf0ea;
  color: var(--muted);
  display: grid;
  justify-items: center;
  overflow: hidden;
  text-decoration: none;
}

.market-card-image img,
.item-detail-media img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.market-card-placeholder {
  align-items: center;
  background: var(--accent-soft);
  border: 1px dashed #abc7b3;
  border-radius: 8px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 800;
  justify-content: center;
  min-height: 56px;
  min-width: 112px;
  padding: 0.8rem;
}

.market-card-placeholder.large {
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: 0;
  min-height: 300px;
  width: 100%;
}

.market-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

.market-card-title {
  font-size: 1.03rem;
  font-weight: 850;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
}

.market-card-title a {
  color: var(--ink);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.market-card-title a:hover {
  color: var(--accent-dark);
}

.status-badge {
  background: var(--peach);
  border: 1px solid #e8bf9e;
  border-radius: 999px;
  color: #68401e;
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1;
  padding: 0.38rem 0.55rem;
  white-space: nowrap;
}

.market-card-price {
  color: var(--accent-dark);
  font-size: 1.18rem;
  font-weight: 900;
  margin: 0.75rem 0 0.35rem;
}

.market-card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 0.45rem;
  margin: auto 0 0;
}

.market-card-meta span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 0.24rem 0.52rem;
}

.market-card-meta a {
  color: var(--muted);
  text-decoration: none;
}

.market-card-meta a:hover {
  color: var(--accent-dark);
}

.form-surface,
.list-surface {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}

.form-label {
  color: var(--ink-soft);
  font-weight: 800;
}

.form-control,
.form-select {
  border-color: var(--line);
  border-radius: 7px;
  min-height: 44px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(20, 120, 94, 0.14);
}

textarea.form-control {
  min-height: 150px;
}

.form-text {
  color: var(--muted);
}

.list-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 0;
}

.list-row:first-child {
  padding-top: 0;
}

.list-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-row strong {
  color: var(--ink);
  font-weight: 850;
}

.empty-state {
  background: #fff;
  border: 1px dashed #bfd3c7;
  border-radius: 8px;
  color: var(--muted);
  padding: 1.4rem;
}

.item-detail {
  align-items: start;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.88fr);
  margin-top: 0.5rem;
}

.item-detail-media {
  background: #eaf0ea;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.item-detail-body {
  min-width: 0;
  padding-top: 0.35rem;
}

.item-detail-body h1 {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.16;
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-price {
  color: var(--accent-dark);
  font-size: 1.75rem;
  font-weight: 950;
  margin: 1rem 0 0.35rem;
}

.detail-copy {
  background: rgba(255, 253, 248, 0.72);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding: 1.25rem 0;
  white-space: pre-wrap;
}

.document-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  margin-top: 1.25rem;
  padding: 1rem;
}

.document-box pre {
  color: var(--ink-soft);
  margin: 0;
  white-space: pre-wrap;
}

.alert {
  border-radius: 8px;
}

footer {
  background: rgba(255, 253, 248, 0.76);
}

@media (max-width: 992px) {
  .page-band {
    grid-template-columns: 1fr;
  }

  .hero-summary {
    justify-self: stretch;
  }

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

@media (min-width: 992px) {
  .navbar-toggler {
    display: none;
  }

  .navbar-collapse {
    align-items: center;
    display: flex !important;
    flex-basis: auto;
    flex-grow: 1;
  }
}

@media (max-width: 991.98px) {
  .app-nav .container {
    flex-wrap: wrap;
  }

  .navbar-toggler {
    align-items: center;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    padding: 0;
    width: 42px;
  }

  .navbar-collapse {
    flex-basis: 100%;
  }

  .navbar-collapse:not(.show) {
    display: none !important;
  }

  .navbar-collapse.show {
    display: block;
  }
}

@media (max-width: 768px) {
  .page-band {
    margin-top: -1rem;
    padding-bottom: 1.7rem;
    padding-top: 1.7rem;
  }

  .page-band h1 {
    font-size: 1.75rem;
  }

  .section-title-row,
  .split-actions,
  .list-row {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title-row .btn,
  .split-actions .btn {
    width: 100%;
  }

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

  .nav-actions {
    align-items: stretch;
    margin-top: 0.6rem;
  }

  .nav-actions .btn,
  .nav-actions form,
  .nav-actions form .btn {
    width: 100%;
  }

  .user-chip {
    max-width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .market-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }
}
