:root {
  color-scheme: dark;
  --bg: #07090f;
  --surface: #111621;
  --surface-2: #171f2d;
  --line: #263244;
  --text: #f4f7fb;
  --muted: #a5b1c3;
  --gold: #d6b25e;
  --gold-2: #f0d78a;
  --teal: #48d2bd;
  --danger: #ff6b6b;
  --warning: #f3c969;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(72, 210, 189, 0.14), transparent 28rem),
    linear-gradient(135deg, #07090f 0%, #0c111b 48%, #15100a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

img {
  display: block;
  max-width: 100%;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-header {
  min-height: 76px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 28px 0 40px;
  margin-top: 64px;
}

.brand,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(214, 178, 94, 0.52);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(214, 178, 94, 0.24), rgba(72, 210, 189, 0.1));
  color: var(--gold-2);
}

.nav-actions {
  color: var(--muted);
  font-weight: 700;
}

.nav-actions form {
  margin: 0;
}

.button,
.link-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #12100a;
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(214, 178, 94, 0.2);
}

.button-small {
  min-height: 38px;
  padding: 0 14px;
}

.button-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.link-button {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0;
}

.link-button:hover,
.nav-actions a:hover {
  color: var(--text);
}

.hero {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 48px;
  align-items: center;
  padding: 42px 0;
}

.hero h1,
.page-header h1,
.auth-panel h1 {
  margin: 0;
  line-height: 1;
  font-size: clamp(3.2rem, 10vw, 7.5rem);
}

.hero p,
.page-header p,
.auth-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-copy {
  max-width: 720px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.bullion-panel {
  position: relative;
  min-height: 430px;
  border: 1px solid rgba(214, 178, 94, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    repeating-linear-gradient(90deg, rgba(214, 178, 94, 0.07), rgba(214, 178, 94, 0.07) 1px, transparent 1px, transparent 28px);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.coin-stack {
  position: absolute;
  inset: 42px 28px 120px;
}

.coin-stack span {
  position: absolute;
  border-radius: 50%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 35% 28%, #fff2af 0 7%, transparent 8%),
    radial-gradient(circle, #f2cf71 0 32%, #a06e1d 33% 38%, #e5bd58 39% 62%, #4b391e 63% 100%);
  box-shadow: 0 30px 52px rgba(0, 0, 0, 0.45);
}

.coin-stack span:nth-child(1) {
  width: 58%;
  left: 4%;
  top: 20%;
}

.coin-stack span:nth-child(2) {
  width: 52%;
  right: 2%;
  top: 4%;
}

.coin-stack span:nth-child(3) {
  width: 44%;
  left: 28%;
  bottom: 0;
}

.market-card,
.empty-state,
.dash-card,
.auth-panel,
.admin-form-shell,
.table-shell,
.stat-grid article,
.product-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 22, 33, 0.82);
  box-shadow: var(--shadow);
}

.market-card {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  padding: 20px;
  display: grid;
  gap: 6px;
}

.market-card span {
  color: var(--muted);
}

.section,
.page-header,
.auth-shell {
  padding: 56px 0 0;
}

.section-heading h2,
.page-header h1,
.auth-panel h2 {
  margin: 0;
}

.product-grid,
.dashboard-grid,
.stat-grid,
.auth-shell {
  display: grid;
  gap: 18px;
}

.product-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

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

.product-card img,
.product-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  object-fit: cover;
}

.product-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(214, 178, 94, 0.24), rgba(72, 210, 189, 0.12));
  color: var(--gold-2);
  font-weight: 900;
}

.product-card h3,
.dash-card h2 {
  margin: 0 0 8px;
}

.product-card p,
.dash-card p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.price-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gold-2);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
}

.auth-shell {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  align-items: start;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(7, 9, 15, 0.78);
  backdrop-filter: blur(18px);
}

.modal-backdrop.is-open {
  display: grid;
}

.auth-modal {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(214, 178, 94, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(155deg, rgba(72, 210, 189, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(23, 31, 45, 0.98), rgba(10, 14, 22, 0.98));
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.58);
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.auth-modal-head {
  padding-right: 42px;
}

.auth-modal-head h2 {
  margin: 0;
  font-size: 2rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  margin: 24px 0;
  background: rgba(0, 0, 0, 0.2);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.auth-tab.is-active {
  background: var(--surface-2);
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(214, 178, 94, 0.18);
}

.auth-pane {
  display: none;
}

.auth-pane.is-active {
  display: block;
}

.compact-form {
  margin-top: 0;
}

.signup-drawer {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.signup-drawer summary {
  color: var(--gold-2);
  cursor: pointer;
  font-weight: 800;
}

.signup-drawer .form-stack {
  margin-top: 18px;
}

.setup-callout {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(72, 210, 189, 0.32);
  border-radius: var(--radius);
  background: rgba(72, 210, 189, 0.08);
}

.setup-callout span {
  color: var(--muted);
  line-height: 1.5;
}

.auth-panel {
  padding: 28px;
}

.muted-panel {
  background: rgba(23, 31, 45, 0.64);
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.admin-form-shell {
  margin-top: 24px;
  padding: 20px;
}

.admin-product-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

.wide-field {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #080c13;
  color: var(--text);
  min-height: 46px;
  padding: 0 14px;
  font: inherit;
}

.page-header {
  max-width: 780px;
}

.page-header h1 {
  font-size: clamp(2.5rem, 7vw, 5.2rem);
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 24px;
}

.dash-card {
  padding: 24px;
  min-height: 190px;
}

.dash-link {
  transition: transform 160ms ease, border-color 160ms ease;
}

.dash-link:hover {
  transform: translateY(-3px);
  border-color: rgba(214, 178, 94, 0.55);
}

.dash-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(214, 178, 94, 0.15);
  color: var(--gold-2);
  font-weight: 900;
  margin-bottom: 16px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 26px;
}

.stat-grid article {
  padding: 20px;
}

.stat-grid strong {
  display: block;
  font-size: 1.8rem;
}

.stat-grid span {
  color: var(--muted);
}

.table-shell {
  margin-top: 24px;
  overflow-x: auto;
}

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

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

th {
  color: var(--gold-2);
}

.flash {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--line);
}

.flash-error {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.flash-warning {
  border-color: rgba(243, 201, 105, 0.5);
  color: var(--warning);
}

.flash-success {
  border-color: rgba(72, 210, 189, 0.5);
  color: var(--teal);
}

@media (max-width: 760px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .nav-actions {
    flex-wrap: wrap;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 20px;
  }

  .bullion-panel {
    min-height: 320px;
  }

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

  .wide-field {
    grid-column: auto;
  }
}
