:root {
  --primary: #2dd4bf;
  --primary-bright: #4ade80;
  --bg: #05080a;
  --surface: #0a0f12;
  --surface-accent: #0d1418;
  --border: #1a2c32;
  --profit: #4ade80;
  --text-muted: #64748b;
  --text-secondary: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background: var(--bg);
  color: #e2e8f0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 10, 0.7);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 80;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  width: min(360px, 90vw);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #e2e8f0;
}

.modal-card p {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: #e2e8f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  cursor: pointer;
}

.modal-btn.primary {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(45, 212, 191, 0.12);
}

.modal-btn.ghost:hover {
  border-color: var(--text-secondary);
}

.bm-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}

.bm-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.bm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.bm-logo {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.bm-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bm-logo svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.bm-brand h1 {
  font-size: 18px;
  margin: 0;
}

.bm-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.bm-nav .pill {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.bm-nav .pill.active {
  border-color: var(--primary);
  background: rgba(45, 212, 191, 0.1);
  color: var(--primary);
}

.bm-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bm-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.bm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
}

.bm-pill .material-symbols-outlined {
  font-size: 14px;
}

.bm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.pulse {
  width: 6px;
  height: 6px;
  background: var(--primary-bright);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.bm-filters {
  position: sticky;
  top: 64px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  padding: 12px 24px;
  background: rgba(13, 20, 24, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.filter-block p {
  margin: 0 0 8px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  font-weight: 700;
}

.chip-row,
.chip-toggle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.active {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.chip-toggle input {
  display: none;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-value {
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
}

.slider {
  position: relative;
  padding-top: 6px;
}

.slider-track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.slider-fill {
  width: 45%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
}

.slider-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.5);
}

.slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 18px;
  opacity: 0;
  cursor: pointer;
}

.select {
  position: relative;
}

.select select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #e2e8f0;
  font-size: 10px;
  padding: 6px 28px 6px 12px;
  appearance: none;
}

.select .material-symbols-outlined {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-secondary);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.search-field input {
  width: 100%;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 11px;
  outline: none;
}

.search-field .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-secondary);
}

.return-rate {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.return-rate input {
  width: 60px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 11px;
  outline: none;
}

.return-rate .suffix {
  color: var(--text-secondary);
  font-size: 10px;
}

.bonus-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.bonus-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.bm-main {
  display: flex;
  gap: 24px;
  padding: 24px;
  height: calc(100vh - 160px);
  overflow: hidden;
}

.bm-table {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.08);
  display: flex;
  flex-direction: column;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

thead tr {
  background: rgba(13, 20, 24, 0.6);
  border-bottom: 1px solid var(--border);
}

th,
td {
  padding: 10px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--text-muted);
}

tbody td {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  color: #e2e8f0;
  font-size: 12px;
}

.empty-row td {
  padding: 18px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}

.high-density-row {
  height: 44px;
  border-left: 2px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

.high-density-row:hover {
  background: rgba(45, 212, 191, 0.05);
  border-left-color: var(--primary);
}

.high-density-row.alt {
  background: rgba(13, 20, 24, 0.3);
}

.num {
  text-align: right;
}

.center {
  text-align: center;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

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

.item-tier {
  display: none;
}

.item-name {
  font-weight: 700;
  font-size: 12px;
}

.item-meta {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.item-tier-pill {
  font-size: 10px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #e2e8f0;
  letter-spacing: 0.1em;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.6);
}

.item-tier-pill[data-tier="4"] {
  background: rgba(59, 130, 246, 0.2);
}

.item-tier-pill[data-tier="5"] {
  background: rgba(239, 68, 68, 0.2);
}

.item-tier-pill[data-tier="6"] {
  background: rgba(234, 179, 8, 0.2);
}

.item-tier-pill[data-tier="7"] {
  background: rgba(250, 204, 21, 0.2);
}

.item-tier-pill[data-tier="8"] {
  background: rgba(255, 255, 255, 0.14);
}

.item-tier-pill[data-enchant="1"] {
  border-color: #22c55e;
}

.item-tier-pill[data-enchant="2"] {
  border-color: #3b82f6;
}

.item-tier-pill[data-enchant="3"] {
  border-color: #a855f7;
}

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

.profit {
  color: var(--profit);
  font-weight: 700;
}

.loss {
  color: #f87171;
  font-weight: 700;
}

.pill {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.micro {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(13, 20, 24, 0.4);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.pager {
  display: flex;
  gap: 6px;
}

.pager button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
}

.pager button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(45, 212, 191, 0.15);
}

.bm-side {
  width: 340px;
  flex-shrink: 0;
}

.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: sticky;
  top: 170px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.side-header h3 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
}

.side-hero {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.12), rgba(5, 8, 10, 0));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.side-hero[data-tier="4"] {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(5, 8, 10, 0));
}

.side-hero[data-tier="5"] {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.18), rgba(5, 8, 10, 0));
}

.side-hero[data-tier="6"] {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.2), rgba(5, 8, 10, 0));
}

.side-hero[data-tier="7"] {
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.2), rgba(5, 8, 10, 0));
}

.side-hero[data-tier="8"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(5, 8, 10, 0));
}

.side-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(45, 212, 191, 0.3);
  position: relative;
  overflow: hidden;
}

.side-icon[data-enchant="1"] {
  border-color: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}

.side-icon[data-enchant="2"] {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.side-icon[data-enchant="3"] {
  border-color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);
}

.side-icon-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.2), rgba(45, 212, 191, 0.05));
  border-radius: 16px;
  display: grid;
  place-items: center;
}

.side-icon-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.side-hero h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.side-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.tag {
  font-size: 9px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  color: var(--primary);
}

.tag.muted {
  display: none;
}

#insightTier {
  font-size: 11px;
  padding: 6px 14px;
  letter-spacing: 0.12em;
}

.side-metrics div {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(26, 44, 50, 0.3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.side-metrics strong {
  color: #e2e8f0;
  font-size: 12px;
}

.side-metrics strong.primary {
  color: var(--primary);
}

.material-box {
  margin: 14px 0;
  border-radius: 16px;
  border: 1px solid rgba(26, 44, 50, 0.65);
  background: rgba(7, 12, 15, 0.75);
  padding: 12px;
}

.material-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.material-total {
  color: var(--primary);
  font-weight: 700;
}

.material-list {
  display: grid;
  gap: 8px;
}

.material-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(5, 8, 10, 0.6);
  border: 1px solid rgba(26, 44, 50, 0.35);
  font-size: 11px;
  color: #e2e8f0;
}

.material-row.artefact-row {
  margin-top: 10px;
  border-style: dashed;
}

.material-row[aria-hidden="true"] {
  display: none;
}

.material-name {
  font-weight: 600;
}

.material-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

.material-unit-row {
  background: rgba(5, 8, 10, 0.35);
  border-style: dashed;
  font-size: 10px;
}

.material-unit-row .material-name {
  color: var(--text-secondary);
}


.side-chart {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.side-chart-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 90px;
  background: rgba(5, 8, 10, 0.5);
  border-radius: 12px;
  padding: 10px;
  position: relative;
}

.chart-bars span {
  flex: 1;
  background: rgba(45, 212, 191, 0.25);
  border-radius: 6px 6px 0 0;
}

.chart-bars span.strong {
  background: linear-gradient(180deg, var(--primary), var(--primary-bright));
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.4);
}

.bm-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.teal-glow {
  box-shadow: 0 0 15px rgba(45, 212, 191, 0.08);
}

.teal-gradient-bg {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.15), rgba(5, 8, 10, 0));
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--bg);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.side-card.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border);
}

@media (max-width: 1100px) {
  .bm-header-row {
    flex-wrap: wrap;
  }
  .bm-nav {
    width: 100%;
    justify-content: center;
  }
  .bm-main {
    flex-direction: column;
  }
  .bm-side {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .bm-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bm-meta {
    width: 100%;
    justify-content: space-between;
  }
  .bm-main {
    height: auto;
    overflow: visible;
  }
  .table-wrap {
    max-height: 60vh;
  }
  .side-card {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .bm-filters {
    grid-template-columns: 1fr;
  }
  .bm-header {
    padding: 12px 16px;
  }
  .bm-main {
    padding: 16px;
  }
  .bm-header-row {
    gap: 12px;
  }
  .bm-brand h1 {
    font-size: 16px;
  }
  .bm-pill,
  .bm-status {
    font-size: 9px;
    padding: 5px 10px;
  }
  .table-wrap {
    max-height: 58vh;
  }
  table {
    min-width: 720px;
  }
  th, td {
    padding: 8px 10px;
    font-size: 9px;
  }
  tbody td {
    font-size: 11px;
  }
  .item-icon {
    width: 28px;
    height: 28px;
  }
  .item-name {
    font-size: 11px;
  }
  .side-card {
    padding: 16px;
  }
  .side-hero h2 {
    font-size: 16px;
  }
  .side-icon {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 420px) {
  .bm-nav {
    display: none;
  }
  .bm-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  .bm-main {
    padding: 12px;
  }
  .bm-filters {
    gap: 12px;
    padding: 10px 14px;
    top: 56px;
  }
  .chip {
    font-size: 9px;
    padding: 4px 10px;
  }
  table {
    min-width: 600px;
  }
  th:nth-child(6),
  td:nth-child(6),
  th:nth-child(7),
  td:nth-child(7) {
    display: none;
  }
  .side-card {
    padding: 14px;
  }
  .material-box {
    padding: 10px;
  }
}

@media (max-width: 360px) {
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
  table {
    min-width: 520px;
  }
}
