:root {
  --bg: #f4efe7;
  --bg-accent: #efe4d3;
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: #fffaf2;
  --text: #2b241d;
  --muted: #6d6156;
  --border: rgba(77, 61, 44, 0.14);
  --shadow: 0 18px 50px rgba(89, 61, 33, 0.12);
  --primary: #b24c2c;
  --primary-strong: #90391d;
  --secondary: #ead9bf;
  --ghost: #f3eadf;
  --wanted: #b85b27;
  --wanted-bg: #fde5d6;
  --maybe: #8f6b10;
  --maybe-bg: #f6edc9;
  --bought: #4f7a56;
  --bought-bg: #dceede;
  --danger: #8d2d24;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 42%),
    linear-gradient(180deg, #f7f1e7 0%, #efe1cf 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -6rem;
  right: -5rem;
  background: rgba(178, 76, 44, 0.18);
}

body::after {
  bottom: -7rem;
  left: -6rem;
  background: rgba(105, 142, 95, 0.16);
}

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

a {
  color: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.hero,
.panel,
.modal-dialog {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  border-radius: var(--radius-lg);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.96;
}

.hero-copy {
  max-width: 48rem;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.layout {
  margin-top: 22px;
  display: grid;
  gap: 18px;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.tabs-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 247, 237, 0.92);
  border-radius: 999px;
}

.tab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab:focus-visible {
  background: rgba(178, 76, 44, 0.1);
  color: var(--text);
  outline: none;
}

.tab.is-active {
  background: var(--primary);
  color: #fff9f3;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 1;
  min-width: 260px;
  flex-wrap: wrap;
}

.status-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-wanted {
  color: var(--wanted);
  background: var(--wanted-bg);
}

.status-maybe {
  color: var(--maybe);
  background: var(--maybe-bg);
}

.status-bought {
  color: var(--bought);
  background: var(--bought-bg);
}

.toolbar-meta {
  color: var(--muted);
  font-weight: 700;
}

.content-panel {
  min-height: 340px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px;
}

.item-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--panel-strong);
  border: 1px solid rgba(89, 61, 33, 0.08);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(78, 54, 30, 0.08);
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(78, 54, 30, 0.12);
}

.item-card[data-status="bought"] {
  opacity: 0.76;
}

.item-media {
  position: relative;
  min-height: 210px;
  background: linear-gradient(135deg, #f7ebdc 0%, #efe3d4 100%);
}

.item-image-wrap,
.item-image-fallback {
  position: absolute;
  inset: 0;
}

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

.item-image-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.item-image.is-hidden,
.item-image-fallback.is-hidden,
.is-hidden {
  display: none !important;
}

.status-badge {
  position: absolute;
  top: 14px;
  left: 14px;
}

.item-body {
  display: grid;
  gap: 10px;
  padding: 18px 18px 10px;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.item-meta p,
.item-title,
.item-price,
.item-notes {
  margin: 0;
}

.item-title {
  font-size: 1.08rem;
  line-height: 1.35;
}

.item-price {
  color: var(--primary-strong);
  font-weight: 700;
}

.item-notes {
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.item-notes-wrap {
  border-top: 1px solid rgba(89, 61, 33, 0.08);
  padding-top: 10px;
}

.item-notes-wrap summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  list-style: none;
}

.item-notes-wrap summary::-webkit-details-marker {
  display: none;
}

.item-notes-wrap summary::after {
  content: "+";
  float: right;
  color: var(--primary);
}

.item-notes-wrap[open] summary::after {
  content: "−";
}

.item-notes-wrap .item-notes {
  margin-top: 10px;
}

.item-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 18px;
}

.icon-link,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  background: rgba(178, 76, 44, 0.1);
  color: var(--primary-strong);
  text-decoration: none;
  font-size: 1.15rem;
  cursor: pointer;
}

.icon-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.icon-link:hover,
.icon-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button-small {
  padding: 10px 14px;
}

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

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--primary-strong);
}

.button-secondary {
  background: var(--secondary);
  color: var(--text);
}

.button-ghost {
  background: var(--ghost);
  color: var(--danger);
}

.hero-action {
  white-space: nowrap;
}

.state {
  padding: 24px 8px;
  color: var(--muted);
  text-align: center;
}

.state h2 {
  margin: 0 0 8px;
  color: var(--text);
}

.state p {
  margin: 0 0 18px;
}

.state.is-error {
  color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(39, 28, 17, 0.4);
}

.modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  padding: 24px;
  border-radius: 28px;
  overflow: auto;
}

.modal-header,
.modal-footer,
.fetch-row,
.form-grid {
  display: grid;
  gap: 16px;
}

.modal-header {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.fetch-row {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin: 18px 0;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(92, 66, 44, 0.14);
  background: rgba(255, 251, 245, 0.94);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(178, 76, 44, 0.18);
  border-color: rgba(178, 76, 44, 0.4);
}

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

.grow {
  min-width: 0;
}

.form-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #efe6d8;
  color: var(--text);
}

.form-message.is-error {
  background: #f6dfdb;
  color: var(--danger);
}

.modal-footer {
  grid-template-columns: repeat(2, auto);
  justify-content: end;
  margin-top: 22px;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .hero,
  .panel,
  .modal-dialog {
    border-radius: 22px;
  }

  .hero {
    padding: 22px;
    flex-direction: column;
    align-items: stretch;
  }

  .tabs-panel {
    align-items: stretch;
  }

  .toolbar {
    align-items: flex-start;
  }

  .fetch-row,
  .form-grid,
  .modal-footer {
    grid-template-columns: 1fr;
  }

  .item-meta {
    flex-direction: column;
  }

  .item-actions {
    flex-wrap: wrap;
  }

  .button,
  .icon-button,
  .icon-link {
    justify-content: center;
  }
}
