:root {
  color-scheme: dark;
  --bg: #0f1217;
  --surface: #171b22;
  --surface-2: #20252d;
  --line: #343a44;
  --line-strong: #58606d;
  --text: #eef1f5;
  --muted: #a5adba;
  --gold: #e5d45b;
  --green: #61bb55;
  --blue: #5ca7ff;
  --red: #e36b62;
  --purple: #b56ad8;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: linear-gradient(180deg, #11151b 0%, #101319 46%, #151a21 100%);
  color: var(--text);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 16px;
  height: 76px;
  padding: 0 24px;
  background: rgba(16, 19, 25, 0.96);
  border-bottom: 1px solid rgba(229, 212, 91, 0.3);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
  font-weight: 800;
}

.brand-mark {
  color: var(--gold);
  font-size: 30px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.nav a.active,
.nav a:hover {
  color: var(--gold);
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.06);
}

.status-pill {
  justify-self: end;
  min-width: 92px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.status-pill.ok {
  color: #d8ffd3;
  border-color: rgba(97, 187, 85, 0.5);
}

.status-pill.bad {
  color: #ffd5d2;
  border-color: rgba(227, 107, 98, 0.6);
}

main {
  width: min(1920px, 100%);
  margin: 0 auto;
  padding: 16px 22px 28px;
}

.hidden {
  display: none !important;
}

.view {
  min-height: calc(100vh - 138px);
}

.panel {
  background: linear-gradient(180deg, rgba(33, 38, 47, 0.94), rgba(23, 27, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 12px;
}

.hero-panel {
  min-height: 300px;
  padding: 42px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 900;
}

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

h1 {
  max-width: 980px;
  margin-bottom: 22px;
  font-size: 56px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 16px;
  font-size: 30px;
}

h3 {
  font-size: 20px;
}

.hero-actions,
.section-head,
.history-toolbar,
.lot-toolbar,
.search-row,
.grid-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: linear-gradient(180deg, #2a303a, #20252d);
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  color: #101319;
  background: linear-gradient(180deg, #f0e579, #cabb41);
  border-color: #f0e579;
}

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

.metrics-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.metric {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.metric span,
.item-card p,
.fresh-summary span,
.info-grid span,
.footer,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 16px;
  color: var(--gold);
  font-size: 32px;
}

.panel + .panel,
.dashboard-grid + .panel {
  margin-top: 12px;
}

.section-head {
  justify-content: space-between;
  padding: 22px 22px 0;
}

.card-row,
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  padding: 20px 22px 22px;
}

.card-row {
  display: flex;
  overflow-x: auto;
}

.card-row.compact {
  min-height: 150px;
}

.item-card {
  position: relative;
  min-width: 176px;
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #c7ccd2;
  border-radius: var(--radius);
  background: rgba(16, 19, 25, 0.45);
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--gold);
}

.favorite {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(13, 16, 21, 0.72);
}

.item-art {
  height: 96px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.item-art img,
.item-image-large img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.item-fallback {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  font-size: 34px;
}

.market-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

.filters,
.market-panel,
.item-tab,
.item-hero {
  padding: 16px;
}

.filters {
  height: calc(100vh - 120px);
  position: sticky;
  top: 92px;
  overflow: auto;
}

.filter-chip {
  width: 100%;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  cursor: pointer;
}

.filter-chip.active,
.filter-chip:hover {
  border-color: var(--gold);
}

.search-row {
  padding: 4px 0 18px;
}

input,
select {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #151922;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(229, 212, 91, 0.14);
}

#searchInput {
  flex: 1 1 420px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.grid-head {
  justify-content: space-between;
  color: var(--muted);
}

.item-hero {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
}

.item-image-large {
  height: 190px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 16, 21, 0.5);
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 19, 25, 0.76);
}

.tab,
.segmented button {
  min-width: 128px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.tab.active,
.segmented button.active {
  color: var(--gold);
  background: rgba(229, 212, 91, 0.12);
  border-color: rgba(229, 212, 91, 0.24);
}

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

.info-grid > div,
.fresh-summary > div {
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.info-grid strong,
.fresh-summary strong {
  display: block;
  margin-top: 6px;
}

.lot-toolbar,
.history-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.lot-toolbar input {
  width: 138px;
}

.fresh-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.market-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.market-table th,
.market-table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.market-table th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.tier {
  color: var(--muted);
  font-weight: 900;
}

.tier.uncommon {
  color: #5fe05f;
}

.tier.special {
  color: var(--blue);
}

.tier.rare {
  color: var(--purple);
}

.tier.exclusive {
  color: var(--red);
}

.tier.legendary {
  color: var(--gold);
}

.chart {
  width: 100%;
  min-height: 430px;
}

.uplot {
  background: #111620;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.uplot .u-over,
.uplot .u-under {
  border-radius: var(--radius);
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #101319;
}

.segmented button {
  border-radius: 999px;
}

.empty {
  width: 100%;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.loading {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 28px;
  border-top: 1px solid var(--line);
  background: #0f1217;
}

.footer span:first-child {
  color: var(--text);
  font-weight: 900;
}

@media (max-width: 1020px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .status-pill {
    justify-self: stretch;
  }

  .dashboard-grid,
  .market-layout,
  .item-hero {
    grid-template-columns: 1fr;
  }

  .filters {
    height: auto;
    position: static;
  }

  .nav {
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  main {
    padding: 10px;
  }

  .hero-panel,
  .filters,
  .market-panel,
  .item-tab,
  .item-hero {
    padding: 14px;
  }

  h1 {
    font-size: 34px;
  }

  .metrics-panel,
  .fresh-summary {
    grid-template-columns: 1fr;
  }

  .card-row,
  .item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .item-card {
    min-width: 148px;
  }

  .footer {
    flex-direction: column;
  }
}
