:root {
  color-scheme: dark;
  --bg: #080806;
  --bg-soft: #14120f;
  --panel: rgba(18, 17, 14, 0.82);
  --panel-solid: #181612;
  --panel-strong: rgba(27, 24, 19, 0.94);
  --line: rgba(235, 204, 147, 0.18);
  --line-strong: rgba(235, 204, 147, 0.32);
  --text: #f6efe2;
  --muted: #b8ac9a;
  --muted-2: #847b70;
  --gold: #d7a64a;
  --gold-strong: #efc76b;
  --teal: #42b9bd;
  --red: #b85a4b;
  --green: #79bd79;
  --violet: #a583c6;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --radius-sm: 6px;
  --font: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="ember"] {
  --panel: rgba(27, 21, 17, 0.86);
  --panel-solid: #201913;
  --panel-strong: rgba(37, 28, 21, 0.96);
  --line: rgba(244, 176, 91, 0.2);
  --text: #fff5e7;
  --muted: #c6ad91;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(180deg, rgba(8, 8, 6, 0.28), rgba(8, 8, 6, 0.96) 760px),
    var(--bg);
  letter-spacing: 0;
}

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

button {
  color: inherit;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(90deg, rgba(8, 8, 6, 0.64), rgba(8, 8, 6, 0.2) 48%, rgba(8, 8, 6, 0.9)),
    url("./assets/market-hero.png");
  background-position: center top;
  background-size: cover;
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 20%, rgba(215, 166, 74, 0.22), transparent 24%),
    linear-gradient(180deg, transparent 0, rgba(8, 8, 6, 0.86) 68%, var(--bg) 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, auto) 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 6, 0.76);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(239, 199, 107, 0.5);
  border-radius: var(--radius-sm);
  color: var(--gold-strong);
  background: linear-gradient(135deg, rgba(215, 166, 74, 0.28), rgba(66, 185, 189, 0.12));
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: inline-flex;
  justify-self: center;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(20, 18, 15, 0.64);
}

.nav-tab {
  min-width: 70px;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.nav-tab:hover,
.nav-tab:focus-visible {
  color: var(--text);
  outline: none;
}

.nav-tab.is-active {
  color: #11100d;
  background: var(--gold-strong);
}

.top-actions,
.toolbar-controls,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-button,
.primary-action,
.ghost-button,
.text-button,
.quick-actions button,
.alert-card button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 38px;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  place-items: center;
  border-color: var(--line);
  background: rgba(20, 18, 15, 0.66);
}

.icon-button:hover,
.icon-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.quick-actions button:hover,
.quick-actions button:focus-visible,
.alert-card button:hover,
.alert-card button:focus-visible {
  border-color: var(--line-strong);
  background: rgba(50, 42, 30, 0.8);
  outline: none;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  color: #11100d;
  border-color: rgba(239, 199, 107, 0.8);
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  font-weight: 760;
  white-space: nowrap;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.ghost-button {
  padding: 0 14px;
  color: var(--text);
  border-color: var(--line);
  background: rgba(20, 18, 15, 0.66);
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
}

.text-button {
  min-height: 28px;
  padding: 0 8px;
  color: var(--gold-strong);
  background: transparent;
}

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  min-height: 280px;
  padding: 34px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: 38px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(106px, 1fr));
  gap: 10px;
  min-width: 390px;
}

.hero-metrics div {
  min-height: 90px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 44px var(--shadow);
  backdrop-filter: blur(15px);
}

.hero-metrics span {
  display: block;
  overflow: hidden;
  color: var(--gold-strong);
  font-size: 24px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-metrics small {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(300px, 340px);
  gap: 16px;
  align-items: start;
}

.filter-panel,
.market-board,
.tool-panel,
.post-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 22px 54px var(--shadow);
  backdrop-filter: blur(18px);
}

.filter-panel,
.market-board,
.tool-panel {
  padding: 16px;
}

.panel-title,
.board-toolbar,
.section-head,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin-bottom: 18px;
}

.panel-title > svg,
.panel-title > i {
  color: var(--gold-strong);
}

.field,
.sort-control {
  display: grid;
  gap: 7px;
}

.field span,
.sort-control span,
.section-head span,
.section-head small {
  color: var(--muted);
  font-size: 12px;
}

.field span b {
  color: var(--gold-strong);
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(235, 204, 147, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(8, 8, 6, 0.46);
  outline: none;
}

input,
textarea {
  padding: 9px 11px;
}

select {
  padding: 8px 32px 8px 10px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(239, 199, 107, 0.72);
  box-shadow: 0 0 0 3px rgba(215, 166, 74, 0.14);
}

.input-icon {
  position: relative;
  display: block;
}

.input-icon svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-icon input {
  padding-left: 38px;
}

.field-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.search-field,
.field-grid,
.range-field,
.modifier-box,
.quick-actions {
  margin-bottom: 16px;
}

.range-field input {
  min-height: 24px;
  accent-color: var(--gold-strong);
}

.modifier-box {
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.14);
  border-radius: var(--radius);
  background: rgba(8, 8, 6, 0.28);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(235, 204, 147, 0.2);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(20, 18, 15, 0.74);
  cursor: pointer;
}

.chip input {
  width: 14px;
  min-height: auto;
  margin: 0;
  accent-color: var(--gold-strong);
}

.chip.is-active,
.chip:has(input:checked) {
  color: #11100d;
  border-color: rgba(239, 199, 107, 0.86);
  background: var(--gold-strong);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.quick-actions button,
.alert-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text);
  border-color: var(--line);
  background: rgba(20, 18, 15, 0.66);
}

.market-board {
  min-height: 720px;
}

.board-toolbar {
  margin-bottom: 12px;
}

.sort-control {
  min-width: 148px;
}

.sort-control select {
  min-height: 36px;
}

.status-row {
  min-height: 38px;
  margin-bottom: 12px;
  padding: 0 10px;
  border: 1px solid rgba(235, 204, 147, 0.12);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(8, 8, 6, 0.22);
  font-size: 13px;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.listing-grid.is-compact {
  grid-template-columns: 1fr;
}

.listing-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background: rgba(19, 17, 14, 0.86);
}

.listing-card:hover {
  border-color: rgba(239, 199, 107, 0.5);
}

.listing-top,
.listing-footer,
.meta-row,
.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.listing-top,
.price-row {
  justify-content: space-between;
}

.listing-title {
  min-width: 0;
}

.listing-title h3 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-title small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rarity {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

.rarity.uncommon {
  color: #0b1a0e;
  background: #79bd79;
}

.rarity.rare {
  color: #08161a;
  background: #42b9bd;
}

.rarity.epic {
  color: #150d1e;
  background: #a583c6;
}

.rarity.legendary {
  color: #1d1105;
  background: #efc76b;
}

.rarity.unique {
  color: #f7ecdd;
  background: #b85a4b;
}

.mods {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mod-tag {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 8, 6, 0.26);
  font-size: 12px;
}

.owner-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.14);
  border-radius: var(--radius);
  background: rgba(8, 8, 6, 0.28);
}

.owner-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.owner-empty {
  display: grid;
  min-height: 84px;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.owner-empty svg {
  color: var(--gold-strong);
}

.owner-listing {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(235, 204, 147, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(20, 18, 15, 0.52);
}

.owner-listing.is-inactive {
  border-color: rgba(132, 123, 112, 0.26);
  opacity: 0.72;
}

.owner-listing strong,
.owner-listing small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-listing small {
  color: var(--muted);
  font-size: 12px;
}

.owner-row-actions,
.owner-actions,
.owner-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.owner-row-actions {
  justify-content: flex-end;
}

.owner-actions .ghost-button,
.owner-card-actions .ghost-button {
  min-height: 34px;
  padding: 0 10px;
}

.owner-card-actions {
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid rgba(235, 204, 147, 0.1);
}

.owner-status {
  color: var(--gold-strong);
}

.meta-row {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
}

.price-row strong {
  color: var(--gold-strong);
  font-size: 24px;
}

.price-row small {
  color: var(--muted);
}

.listing-footer {
  justify-content: space-between;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 204, 147, 0.12);
}

.contact {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.contact b {
  color: var(--text);
}

.card-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.mini-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(8, 8, 6, 0.34);
  cursor: pointer;
}

.mini-button:hover,
.mini-button:focus-visible,
.mini-button.is-saved {
  color: var(--gold-strong);
  border-color: rgba(239, 199, 107, 0.55);
  outline: none;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  color: var(--gold-strong);
}

.insight-rail {
  display: grid;
  gap: 16px;
}

.tool-panel {
  min-width: 0;
}

.estimator-mods .chip-list {
  max-height: 132px;
  overflow: auto;
  padding-right: 2px;
}

.estimate-result {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(239, 199, 107, 0.3);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(215, 166, 74, 0.16), rgba(66, 185, 189, 0.08));
}

.estimate-result small,
.estimate-result span {
  color: var(--muted);
}

.estimate-result strong {
  color: var(--gold-strong);
  font-size: 25px;
}

.pulse-list {
  display: grid;
  gap: 10px;
}

.pulse-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(235, 204, 147, 0.12);
}

.pulse-item:last-child {
  border-bottom: 0;
}

.pulse-item strong,
.pulse-item small {
  display: block;
}

.pulse-item small {
  color: var(--muted);
}

.pulse-change {
  color: var(--green);
  font-weight: 760;
}

.pulse-change.down {
  color: var(--red);
}

.alert-card {
  display: grid;
  gap: 8px;
}

.alert-card span,
.alert-card strong {
  display: block;
}

.alert-card span {
  color: var(--muted);
  font-size: 12px;
}

.alert-card strong {
  line-height: 1.45;
}

.post-dialog {
  width: min(720px, calc(100% - 24px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.post-dialog::backdrop,
.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
}

.post-form {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--panel-strong);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.detail-dialog {
  width: min(1220px, calc(100% - 28px));
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.detail-shell {
  display: grid;
  max-height: 92vh;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 13, 11, 0.98);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.68);
  overflow: hidden;
}

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

.detail-head h2 {
  max-width: min(720px, 72vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.detail-viewer {
  display: grid;
  grid-template-rows: minmax(330px, 1fr) auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.detail-image-stage {
  display: grid;
  min-height: min(58vh, 610px);
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(235, 204, 147, 0.2);
  border-radius: var(--radius);
  background: #050504;
}

.detail-image-stage img {
  width: 100%;
  height: 100%;
  max-height: min(58vh, 610px);
  object-fit: contain;
}

.detail-empty-image {
  display: grid;
  gap: 8px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detail-empty-image svg {
  color: var(--gold-strong);
}

.detail-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 164px;
  overflow: auto;
}

.detail-thumb {
  display: grid;
  min-height: 76px;
  align-content: end;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(235, 204, 147, 0.18);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(8, 8, 6, 0.16), rgba(8, 8, 6, 0.86)),
    rgba(8, 8, 6, 0.36);
  background-position: center;
  background-size: cover;
  cursor: pointer;
  text-align: left;
}

.detail-thumb:hover,
.detail-thumb:focus-visible,
.detail-thumb.is-active {
  border-color: var(--gold-strong);
  color: var(--text);
  outline: none;
}

.detail-thumb.has-image {
  color: #fff;
}

.detail-thumb span,
.detail-thumb small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-thumb span {
  font-weight: 760;
}

.detail-thumb small {
  font-size: 11px;
}

.detail-side {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}

.detail-summary,
.detail-price-box,
.detail-actions {
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background: rgba(20, 18, 15, 0.68);
}

.detail-summary {
  display: grid;
  gap: 8px;
}

.detail-summary h3,
.detail-summary p {
  margin: 0;
}

.detail-summary small,
.detail-summary p,
.detail-actions small {
  color: var(--muted);
  line-height: 1.5;
}

.detail-price-box {
  display: grid;
  gap: 4px;
}

.detail-price-box span,
.detail-price-box small {
  color: var(--muted);
  font-size: 12px;
}

.detail-price-box strong {
  color: var(--gold-strong);
  font-size: 30px;
}

.detail-slot-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.detail-slot-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(235, 204, 147, 0.13);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(8, 8, 6, 0.28);
  cursor: pointer;
  text-align: left;
}

.detail-slot-row:hover,
.detail-slot-row:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.detail-slot-row.has-image {
  border-color: rgba(66, 185, 189, 0.28);
}

.detail-slot-row span,
.detail-slot-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-slot-row span {
  color: var(--gold-strong);
  font-size: 12px;
}

.detail-actions {
  display: grid;
  gap: 8px;
}

.auth-dialog {
  width: min(460px, calc(100% - 24px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(7px);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 16, 13, 0.98);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.68);
}

.auth-dialog.is-forced #closeUserAuth,
.auth-dialog.is-forced #closeAdminAuth {
  opacity: 0.38;
  cursor: not-allowed;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 6, 0.36);
}

.auth-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.auth-tabs button:hover,
.auth-tabs button:focus-visible {
  color: var(--text);
  outline: none;
}

.auth-tabs button.is-active {
  color: #11100d;
  background: var(--gold-strong);
  font-weight: 760;
}

.auth-panel {
  display: none;
  gap: 12px;
}

.auth-panel.is-active {
  display: grid;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.auth-code-row .ghost-button {
  min-width: 118px;
}

.auth-note,
.auth-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-message {
  min-height: 18px;
  color: var(--gold-strong);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.auth-message.is-visible {
  opacity: 1;
}

.auth-account-panel {
  display: grid;
  gap: 12px;
}

.auth-account-panel[hidden] {
  display: none;
}

.auth-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background: rgba(8, 8, 6, 0.26);
}

.auth-account-row span,
.auth-account-row strong {
  display: block;
}

.auth-account-row span {
  color: var(--muted);
  font-size: 12px;
}

.auth-account-row strong {
  margin-top: 3px;
}

body.auth-locked .app-shell {
  filter: blur(1.5px);
  pointer-events: none;
  user-select: none;
}

.admin-dialog {
  width: min(760px, calc(100% - 24px));
}

.admin-topbar {
  grid-template-columns: minmax(220px, auto) 1fr auto;
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
}

.admin-hero {
  min-height: 230px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-listing-layout {
  margin-top: 16px;
}

.admin-blog-layout {
  margin-top: 16px;
}

.admin-side {
  position: sticky;
  top: 88px;
}

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

.admin-class-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(20, 18, 15, 0.48);
  cursor: pointer;
  text-align: left;
}

.admin-class-button:hover,
.admin-class-button:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.admin-class-button.is-active {
  border-color: rgba(239, 199, 107, 0.72);
  color: #11100d;
  background: var(--gold-strong);
}

.admin-class-button span {
  font-weight: 780;
}

.admin-class-button small {
  color: currentColor;
  opacity: 0.76;
}

.admin-editor {
  min-height: 520px;
}

.admin-build-list {
  margin-top: 14px;
}

.admin-class-select {
  min-width: 160px;
}

.admin-form {
  gap: 18px;
}

.admin-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 8, 6, 0.26);
}

.admin-panel .section-head svg {
  color: var(--gold-strong);
}

.admin-list {
  display: grid;
  max-height: min(50vh, 420px);
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.admin-empty {
  display: grid;
  min-height: 140px;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.admin-empty svg {
  color: var(--gold-strong);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(20, 18, 15, 0.52);
}

.admin-listing-list {
  max-height: min(58vh, 560px);
}

.admin-blog-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-blog-form {
  position: sticky;
  top: 88px;
}

.admin-blog-list {
  max-height: min(68vh, 680px);
}

.admin-listing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(20, 18, 15, 0.52);
}

.admin-listing-row.is-inactive {
  opacity: 0.7;
}

.admin-listing-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.admin-listing-main strong,
.admin-listing-main small,
.admin-listing-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-listing-main small,
.admin-listing-main span {
  color: var(--muted);
  font-size: 12px;
}

.admin-listing-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.admin-listing-meta strong {
  color: var(--gold-strong);
  font-size: 18px;
}

.admin-row .field {
  min-width: 0;
}

.locked-badge {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(239, 199, 107, 0.34);
  border-radius: var(--radius-sm);
  color: var(--gold-strong);
  background: rgba(215, 166, 74, 0.1);
  font-size: 12px;
  font-weight: 760;
}

.danger-button {
  color: #f0a092;
  border-color: rgba(184, 90, 75, 0.42);
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: rgba(184, 90, 75, 0.72);
  background: rgba(184, 90, 75, 0.16);
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-inline-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 6, 0.36);
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
}

.segmented input:checked + span {
  color: #11100d;
  background: var(--gold-strong);
  font-weight: 760;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(239, 199, 107, 0.38);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(19, 17, 14, 0.94);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.blog-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 22px 54px var(--shadow);
  backdrop-filter: blur(18px);
}

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

.blog-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 2px;
}

.blog-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 13px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(20, 18, 15, 0.52);
  cursor: pointer;
  text-align: left;
}

.blog-card:hover,
.blog-card:focus-visible,
.blog-card.is-active {
  border-color: rgba(239, 199, 107, 0.62);
  background: rgba(28, 23, 17, 0.86);
  outline: none;
}

.blog-card strong,
.blog-card small,
.blog-card p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-card strong {
  white-space: nowrap;
}

.blog-card small {
  color: var(--muted);
  font-size: 12px;
}

.blog-card p {
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.blog-category {
  display: inline-grid;
  width: fit-content;
  min-height: 24px;
  place-items: center;
  padding: 0 8px;
  border: 1px solid rgba(239, 199, 107, 0.34);
  border-radius: var(--radius-sm);
  color: var(--gold-strong);
  background: rgba(215, 166, 74, 0.1);
  font-size: 12px;
  font-weight: 760;
}

.blog-reader {
  min-height: 520px;
  padding: 18px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background: rgba(14, 13, 11, 0.84);
}

.blog-reader-head {
  display: grid;
  gap: 9px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(235, 204, 147, 0.12);
}

.blog-reader-head h2 {
  font-size: 24px;
}

.blog-reader-head small {
  color: var(--muted);
}

.blog-content {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  color: var(--text);
  line-height: 1.85;
}

.blog-content p {
  margin: 0;
  color: var(--muted);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .insight-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .nav-tabs {
    grid-column: 1 / -1;
    justify-self: stretch;
    overflow-x: auto;
  }

  .nav-tab {
    flex: 1 0 84px;
  }

  .hero-strip,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-strip {
    min-height: 220px;
  }

  .hero-metrics {
    min-width: 0;
  }

  .insight-rail {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-blog-grid,
  .blog-layout {
    grid-template-columns: 1fr;
  }

  .admin-listing-row {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .admin-listing-meta {
    justify-items: start;
  }

  .admin-side {
    position: static;
  }

  .admin-blog-form {
    position: static;
  }

  .detail-shell {
    overflow: auto;
  }

  .detail-body {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .detail-side {
    grid-template-rows: auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .admin-entry {
    padding: 0 10px;
  }

  .primary-action {
    padding: 0 11px;
  }

  .app-shell {
    width: calc(100% - 20px);
    padding-top: 16px;
  }

  h1 {
    font-size: 30px;
  }

  .hero-metrics,
  .listing-grid,
  .field-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics div {
    min-height: 74px;
  }

  .board-toolbar,
  .status-row,
  .listing-footer,
  .price-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .sort-control {
    flex: 1;
  }

  .detail-dialog {
    width: calc(100% - 12px);
    max-height: 96vh;
  }

  .detail-shell {
    max-height: 96vh;
    padding: 10px;
  }

  .detail-head h2 {
    max-width: 72vw;
  }

  .detail-image-stage {
    min-height: 280px;
  }

  .detail-image-stage img {
    max-height: 420px;
  }

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

  .auth-code-row {
    grid-template-columns: 1fr;
  }

  .auth-code-row .ghost-button,
  .auth-account-row .ghost-button {
    width: 100%;
  }

  .auth-account-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.kit-workspace {
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(330px, 390px);
}

.kit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kit-grid.is-compact {
  grid-template-columns: 1fr;
}

.kit-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background: rgba(19, 17, 14, 0.86);
  cursor: pointer;
}

.kit-card:hover,
.kit-card.is-selected {
  border-color: rgba(239, 199, 107, 0.58);
  background: rgba(28, 23, 17, 0.9);
}

.kit-card-head,
.buyer-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kit-card h3,
.buyer-title h3 {
  margin: 0 0 5px;
}

.kit-card small,
.buyer-title small {
  color: var(--muted);
}

.score-pill {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #11100d;
  background: var(--gold-strong);
  font-size: 12px;
  font-weight: 760;
}

.kit-shot-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-shot,
.image-frame,
.slot-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(235, 204, 147, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(215, 166, 74, 0.15), rgba(66, 185, 189, 0.07)),
    rgba(8, 8, 6, 0.34);
  background-position: center;
  background-size: cover;
}

.mini-shot {
  display: grid;
  min-height: 72px;
  place-items: end start;
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.mini-shot.has-image,
.image-frame.has-image,
.slot-tile.has-image {
  color: #fff;
}

.buyer-panel {
  min-width: 0;
}

.buyer-panel .tool-panel {
  position: sticky;
  top: 92px;
}

.buyer-summary {
  display: grid;
  gap: 12px;
}

.buyer-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.buyer-title strong {
  color: var(--gold-strong);
  font-size: 24px;
}

.buyer-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  padding: 12px;
  border: 1px solid rgba(235, 204, 147, 0.14);
  border-radius: var(--radius);
  background: rgba(8, 8, 6, 0.25);
}

.buyer-stats span {
  color: var(--muted);
  font-size: 12px;
}

.buyer-stats b {
  color: var(--gold-strong);
}

.overview-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.image-frame {
  display: grid;
  min-height: 118px;
  align-content: end;
  padding: 12px;
}

.image-frame span,
.image-frame small,
.slot-tile span,
.slot-tile strong,
.slot-tile small {
  position: relative;
  z-index: 1;
}

.image-frame::after,
.slot-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.58));
}

.image-frame span,
.slot-tile span {
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 760;
}

.image-frame small,
.slot-tile small {
  color: var(--muted);
}

.slot-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.slot-tile {
  display: grid;
  min-height: 78px;
  align-content: end;
  gap: 3px;
  padding: 9px;
}

.slot-tile strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buyer-actions {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.buyer-actions button {
  width: 100%;
}

.buyer-actions small {
  color: var(--muted);
  line-height: 1.5;
}

.empty-panel {
  display: grid;
  gap: 8px;
  min-height: 260px;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-panel svg {
  color: var(--gold-strong);
}

.kit-dialog {
  width: min(1080px, calc(100% - 24px));
}

.upload-section {
  display: grid;
  gap: 10px;
}

.paste-tip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(66, 185, 189, 0.28);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(66, 185, 189, 0.08);
  font-size: 12px;
  line-height: 1.5;
}

.paste-tip svg {
  flex: 0 0 auto;
  color: var(--teal);
}

.upload-grid {
  display: grid;
  gap: 10px;
}

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

.slot-upload-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.upload-tile {
  position: relative;
  display: grid;
  min-height: 112px;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 12px;
  border: 1px dashed rgba(235, 204, 147, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(8, 8, 6, 0.18), rgba(8, 8, 6, 0.72)),
    var(--preview, rgba(8, 8, 6, 0.26));
  background-position: center;
  background-size: cover;
  cursor: pointer;
  text-align: center;
}

.upload-tile input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-tile strong {
  color: var(--text);
  font-size: 13px;
}

.upload-tile small,
.upload-tile em {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-tile.has-file {
  border-style: solid;
  border-color: rgba(239, 199, 107, 0.6);
}

.upload-tile.is-active {
  border-style: solid;
  border-color: var(--gold-strong);
  box-shadow:
    inset 0 0 0 1px rgba(239, 199, 107, 0.34),
    0 0 0 2px rgba(239, 199, 107, 0.16);
}

.upload-picker {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(235, 204, 147, 0.25);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(8, 8, 6, 0.72);
  font-size: 11px;
  cursor: pointer;
}

.upload-picker:hover,
.upload-picker:focus-visible {
  color: var(--text);
  border-color: var(--line-strong);
  outline: none;
}

.upload-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(235, 204, 147, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 6, 0.42);
}

@media (max-width: 1260px) {
  .kit-workspace {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .buyer-panel {
    grid-column: 1 / -1;
  }

  .buyer-panel .tool-panel {
    position: static;
  }

  .slot-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .kit-grid,
  .overview-upload,
  .slot-upload-grid,
  .overview-gallery {
    grid-template-columns: 1fr;
  }

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