:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #66726d;
  --panel: #ffffff;
  --paper: #f6f3eb;
  --line: #ddd8cd;
  --green: #0d7f5f;
  --green-soft: #dff3ea;
  --teal: #007c89;
  --gold: #ba8426;
  --gold-soft: #f5e7c7;
  --red: #b3403a;
  --red-soft: #f5ddda;
  --blue: #315d9c;
  --black: #141917;
  --shadow: 0 12px 30px rgba(23, 32, 28, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 14px;
  background: #18231f;
  color: #f8f6ee;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 12px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span,
.sidebar-footer label {
  color: #bdc9c4;
  font-size: 0.82rem;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6d778, #0d7f5f 58%, #fff 58%);
  color: #18231f;
  font-weight: 900;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  padding: 0 12px;
  background: transparent;
  color: #dfe7e3;
  text-align: left;
  text-decoration: none;
}

.nav-item svg,
.primary-button svg,
.secondary-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.nav-item:hover,
.nav-item.active {
  background: #f8f6ee;
  color: #18231f;
}

.legal-nav-item {
  border-color: rgba(248, 246, 238, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 7px;
  padding: 12px 8px 0;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  letter-spacing: 0;
  line-height: 1.04;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.08rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.92rem;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button {
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 800;
}

.secondary-button {
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 750;
}

.icon-button {
  width: 42px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  filter: brightness(0.98);
  box-shadow: 0 7px 18px rgba(23, 32, 28, 0.08);
}

.full {
  width: 100%;
}

.primary-button,
.secondary-button,
.icon-button {
  text-decoration: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.database-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.section-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.section-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-panel,
.catalog-table-wrap,
.visual-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tool-panel,
.catalog-table-wrap {
  padding: 18px;
}

.panel-heading,
.catalog-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading p,
.catalog-table-head p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.green {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.amber {
  background: var(--gold-soft);
  color: #7c520d;
}

.status-pill.red {
  background: var(--red-soft);
  color: var(--red);
}

.filter-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.input,
.select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.select.compact {
  min-height: 38px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.stat {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.stat span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.stat strong {
  font-size: 1.35rem;
}

.catalog-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 1.15fr 0.9fr 0.72fr 128px;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-header {
  min-height: 42px;
  background: #f1eee5;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sticker-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sticker-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 62px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 3px solid var(--thumb-border, #fff);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
    var(--thumb-bg, linear-gradient(145deg, #dbeee6, #315d9c));
  box-shadow: inset 0 0 0 1px rgba(23, 32, 28, 0.14);
  color: #fff;
  font-weight: 950;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.sticker-thumb::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.sticker-meta {
  min-width: 0;
}

.sticker-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-meta span,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1eee5;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.tag.oe {
  background: var(--gold-soft);
  color: #7c520d;
}

.tag.intl {
  background: #dceff0;
  color: var(--teal);
}

.tag.usc {
  background: #eef0f2;
  color: #52606b;
}

.tag.black {
  background: var(--black);
  color: #fff;
}

.tag.review {
  background: var(--red-soft);
  color: var(--red);
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 34px 42px 34px;
  align-items: center;
  width: 110px;
  min-height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-control button {
  height: 36px;
  border: 0;
  background: #f8f6ee;
  color: var(--ink);
  font-weight: 900;
}

.qty-control span {
  text-align: center;
  font-weight: 850;
}

.sticker-grid,
.seller-grid,
.post-list,
.review-list {
  display: grid;
  gap: 12px;
}

.sticker-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.sticker-card,
.seller-card,
.post-item,
.review-item,
.mini-item,
.breakdown-row,
.profile-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.sticker-card {
  display: flex;
  gap: 12px;
  min-height: 104px;
  padding: 12px;
}

.sticker-card .sticker-thumb {
  width: 58px;
  height: 76px;
}

.sticker-card-content {
  min-width: 0;
}

.sticker-card-content strong {
  display: block;
  margin-bottom: 3px;
}

.progress-block {
  margin-bottom: 18px;
}

.progress-label,
.breakdown-row,
.profile-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.progress-label {
  margin-bottom: 8px;
  font-weight: 850;
}

.progress-track,
.meter-track {
  position: relative;
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e6e0d4;
}

.progress-track span,
.meter-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 180ms ease;
}

.breakdown {
  display: grid;
  gap: 8px;
}

.breakdown-row,
.profile-stat {
  min-height: 48px;
  padding: 0 12px;
}

.visual-panel {
  position: relative;
  min-height: 290px;
  overflow: hidden;
}

.visual-panel img {
  width: 100%;
  height: 100%;
  min-height: 290px;
  object-fit: cover;
  display: block;
}

.visual-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.trade-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
}

.value-meter {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-weight: 900;
}

.alert-banner {
  min-height: 82px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 850;
}

.alert-banner.warn {
  background: var(--gold-soft);
  color: #7c520d;
}

.alert-banner.danger {
  background: var(--red-soft);
  color: var(--red);
}

.seller-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.seller-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.seller-score {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.seller-score strong {
  font-size: 2rem;
  line-height: 1;
}

.post-item,
.review-item {
  padding: 14px;
}

.post-item header,
.review-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
}

.profile-card .avatar {
  width: 58px;
  height: 58px;
}

.profile-stats {
  display: grid;
  gap: 9px;
}

.press-pass {
  min-height: 160px;
  margin: 10px 0 14px;
  padding: 16px;
  border: 1px solid #e2c56e;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(245, 231, 199, 0.95), rgba(255, 255, 255, 0.88)),
    radial-gradient(circle at 80% 20%, rgba(13, 127, 95, 0.18), transparent 36%);
}

.legal-page {
  max-width: 1180px;
}

.legal-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.legal-hero h2 {
  margin-bottom: 10px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.content-stack,
.legal-aside,
.legal-aside .tool-panel {
  display: grid;
  gap: 12px;
}

.legal-section h2,
.legal-aside h2 {
  margin-bottom: 10px;
}

.legal-section ul {
  margin: 0;
  padding-left: 22px;
}

.legal-section li {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.5;
}

.legal-aside {
  position: sticky;
  top: 28px;
}

.legal-aside a,
.footer-links a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.legal-aside a:hover,
.legal-aside a:focus-visible,
.footer-links a:hover,
.footer-links a:focus-visible {
  text-decoration: underline;
}

.site-footer {
  margin-top: 28px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.site-footer p {
  max-width: 980px;
  font-size: 0.88rem;
}

.quick-add {
  width: min(420px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 90px rgba(23, 32, 28, 0.26);
}

.quick-add::backdrop {
  background: rgba(23, 32, 28, 0.38);
}

.quick-add form {
  display: grid;
  gap: 14px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(22px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 8px;
  background: #18231f;
  color: #fff;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 10px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand div:not(.brand-mark),
  .nav-item span,
  .sidebar-footer label {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .database-layout,
  .section-grid.two,
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .legal-aside {
    position: static;
  }

  .table-row {
    grid-template-columns: minmax(180px, 1.5fr) 1fr 0.8fr 0.7fr 116px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: 66px;
    padding: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 58px;
    min-height: 50px;
  }

  .workspace {
    padding: 18px 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .table-header {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 9px;
    min-height: 0;
    padding: 14px;
  }

  .catalog-table {
    border: 0;
    display: grid;
    gap: 10px;
  }

  #catalogRows {
    display: grid;
    gap: 10px;
  }

  .table-row:not(.table-header) {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .stats-grid,
  .trade-columns {
    grid-template-columns: 1fr;
  }

  .visual-overlay,
  .post-item header,
  .review-item header,
  .legal-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-actions {
    justify-content: flex-start;
  }
}
