:root {
  --bg: #07111f;
  --surface: #0f1c2e;
  --surface-2: #162942;
  --surface-3: #0a1728;
  --ink: #f4f7fb;
  --muted: #aeb9c8;
  --accent: #63a8ff;
  --accent-2: #c7d0dc;
  --danger: #e56b7a;
  --line: #304359;
  --focus: #9cc9ff;
  --shadow: rgb(0 8 24 / 0.4);
  --nft-card-width: 220px;
  --page-max-width: 1680px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% -10%, rgb(42 103 178 / 0.32), transparent 34rem),
    linear-gradient(180deg, #09182a 0%, var(--bg) 42rem);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--ink);
  padding: 10px 12px;
}

select {
  color-scheme: dark;
}

input::placeholder {
  color: #7d8da1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  max-width: var(--page-max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(14 31 52 / 0.98), rgb(10 22 38 / 0.96));
  padding: 18px 24px 0;
}

.brand-block {
  display: grid;
  gap: 14px;
}

.app-header h1 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 850;
  line-height: 0.95;
}

.app-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.wallet-panel,
.button-row,
.section-header,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-panel {
  position: relative;
  align-self: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: #d7e1ee;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
}

.wallet-menu {
  position: relative;
}

.wallet-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wallet-menu-button::after {
  content: "▾";
  color: var(--accent);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 0.75rem;
}

.wallet-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: none;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgb(0 0 0 / 0.58);
  padding: 8px;
}

.wallet-menu.open .wallet-menu-panel {
  display: grid;
  gap: 6px;
}

.wallet-menu-panel button {
  width: 100%;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.wallet-menu-panel button:hover {
  background: var(--surface-2);
  transform: none;
}

.wallet-menu-panel .danger {
  background: var(--danger);
  color: #21070c;
  text-align: center;
}

.wallet-menu-panel .danger:hover {
  background: #f07f8c;
}

.primary {
  background: var(--accent);
  color: #041321;
}

.secondary {
  background: var(--accent-2);
  color: #07111f;
}

.danger {
  background: var(--danger);
  color: #21070c;
}

.primary:hover {
  background: #87bbff;
}

.secondary:hover {
  background: #dce4ee;
}

.danger:hover {
  background: #f07f8c;
}

.icon-button {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

main {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 24px;
}

.toolbar {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  margin-bottom: 22px;
  padding: 4px;
}

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

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

.view-switch-button.active,
.view-switch-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.header-nav-button {
  position: relative;
  min-height: 40px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.header-nav-button.active,
.header-nav-button:hover {
  border-bottom-color: var(--accent);
  background: var(--surface-2);
  color: var(--ink);
  transform: none;
}

.header-nav .header-nav-button:hover,
.header-nav .header-nav-button:focus-visible {
  transform: none;
}

.tab-button {
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
}

.tab-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 18px;
  padding: 12px;
}

.work-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #31455d;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header h2,
.panel h2,
.admin-section h2,
.contract-columns h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.section-header h2 {
  margin: 0;
}

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

.market-sections {
  display: grid;
  gap: 28px;
}

.market-section {
  display: grid;
  gap: 14px;
}

.market-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.market-section-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.floor-summary {
  color: var(--accent);
  font-weight: 800;
  text-align: right;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--nft-card-width));
  gap: 18px;
  align-items: start;
}

.market-card {
  display: grid;
  gap: 12px;
  width: var(--nft-card-width);
  min-height: 292px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  box-shadow: 0 14px 28px var(--shadow);
  transition:
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.market-card:hover,
.market-card:focus-within {
  border-color: #6dafff;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgb(0 8 24 / 0.58);
}

.market-image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid #2d435d;
}

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

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: lowercase;
  background: linear-gradient(135deg, #0b1828, #12243a);
}

.market-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: linear-gradient(180deg, rgb(7 17 31 / 0) 35%, rgb(7 17 31 / 0.86));
  opacity: 0;
  padding: 12px;
  transition: opacity 140ms ease;
}

.market-card:hover .market-actions,
.market-card:focus-within .market-actions {
  opacity: 1;
}

.market-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
  min-height: 44px;
}

.nft-group {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.nft-group h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.listing-card,
.nft-card,
.panel,
.contract-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 12px 24px var(--shadow);
}

.listing-card,
.nft-card {
  display: grid;
  gap: 12px;
}

.nft-card {
  text-align: left;
}

.nft-card:hover {
  border-color: var(--accent);
}

.listing-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.price {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
}

.muted,
.meta {
  color: var(--muted);
}

.meta,
.address {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
}

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

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

.admin-section {
  margin-top: 20px;
}

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

.contract-card {
  display: grid;
  gap: 6px;
}

.activity-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  min-height: 520px;
}

.activity-filters {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 16px;
  border-right: 1px solid var(--line);
  padding-right: 24px;
}

.activity-filter-heading {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.activity-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-filter-button {
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--muted);
  padding: 8px 10px;
}

.activity-filter-button.active,
.activity-filter-button:hover {
  border-color: #5f7896;
  background: var(--surface-2);
  color: var(--ink);
  transform: none;
}

.activity-results {
  min-width: 0;
}

.activity-results-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.activity-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-table-wrap {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(7 17 31 / 0.72);
}

.activity-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.activity-table th,
.activity-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.activity-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0a1728;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.activity-table td {
  color: var(--ink);
  font-weight: 700;
}

.activity-table tbody tr:hover {
  background: var(--surface-2);
}

.activity-type {
  color: var(--accent);
  text-transform: capitalize;
}

.activity-detail {
  color: var(--muted);
  line-height: 1.45;
}

.contract-name {
  font-weight: 800;
}

.contract-status {
  color: var(--accent-2);
  font-weight: 800;
}

.modal {
  width: min(640px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.modal::backdrop {
  background: rgb(0 0 0 / 0.72);
}

.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 18px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.68);
}

.confirmation-card {
  display: grid;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header h2,
.modal-header p {
  margin: 0;
}

.modal-header p {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .app-header,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header {
    gap: 10px;
    padding-top: 18px;
  }

  .header-nav {
    width: 100%;
    border-top: 1px solid var(--line);
  }

  .wallet-panel {
    align-self: flex-start;
  }

  .header-nav-button {
    flex: 1;
    min-height: 46px;
  }

  .wallet-panel,
  .button-row,
  .toolbar,
  .market-section-header {
    flex-wrap: wrap;
  }

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

  .activity-filters {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 16px;
  }

  .activity-results-toolbar {
    justify-content: flex-start;
  }

  .activity-pagination {
    width: 100%;
    justify-content: space-between;
  }

  .floor-summary {
    text-align: left;
  }

  .market-grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--nft-card-width), 1fr));
  }

  .market-card {
    width: 100%;
  }
}
