:root {
  color-scheme: light;
  --ink: #0a0a0a;
  --muted: #74777f;
  --line: #dedede;
  --paper: #f2f7ff;
  --panel: #ffffff;
  --steel: #202631;
  --green: #3189ef;
  --gold: #b7791f;
  --red: #b91c1c;
  --blue: #3189ef;
  --shadow: 0 22px 64px rgba(12, 31, 52, 0.16);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(23, 23, 23, 0.1);
  background: rgba(248, 245, 238, 0.92);
  backdrop-filter: blur(16px);
}

.public-page {
  min-height: 100vh;
  background: #edf8ff url("assets/aurora-bg.png") center top / cover fixed no-repeat;
}

.public-topbar {
  position: fixed;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  letter-spacing: 0;
}

.soft-mark {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #161616;
  font-size: 24px;
}

.brand strong,
.brand small {
  display: block;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--steel);
  font-size: 15px;
}

.lang-toggle,
.ghost-button,
.select-button,
.primary-button,
.pill-button,
.round-button,
.link-button {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.lang-toggle,
.ghost-button,
.select-button {
  background: transparent;
  color: var(--ink);
  padding: 9px 12px;
}

.primary-button {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
  padding: 12px 16px;
  font-weight: 700;
}

.lang-toggle:hover,
.ghost-button:hover,
.select-button:hover,
.primary-button:hover,
.pill-button:hover,
.round-button:hover,
.link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 23, 23, 0.12);
}

.pill-button,
.round-button,
.link-button {
  background: transparent;
  color: var(--ink);
}

.round-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #1c1c1c;
  color: white;
  font-weight: 800;
}

.dark-pill {
  border: 0;
  border-radius: 999px;
  background: #1c1c1c;
  color: white;
  padding: 10px 18px;
  font-weight: 800;
}

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

.public-main {
  width: 100%;
}

.hero-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 120px 20px 80px;
}

.hero-center {
  display: grid;
  justify-items: center;
  text-align: center;
}

.hero-center h1 {
  max-width: none;
  font-size: clamp(42px, 5vw, 62px);
  line-height: 1.05;
  font-weight: 900;
}

.hero-center h2 {
  margin-top: 18px;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1.05;
  font-weight: 900;
}

.service-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 4vw, 48px);
  margin: 44px 0 34px;
}

.service-icons span {
  display: grid;
  min-width: 70px;
  height: 70px;
  place-items: center;
  border: 3px solid rgba(10, 10, 10, 0.88);
  border-radius: 999px;
  color: #111;
  font-size: 20px;
  font-weight: 900;
}

.hero-button {
  min-width: 158px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  padding: 15px 32px;
  box-shadow: 0 18px 32px rgba(49, 137, 239, 0.28);
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px;
  padding: 86px max(24px, 10vw);
  background: #050505;
  color: white;
}

.feature-band article {
  display: grid;
  justify-items: center;
  text-align: center;
}

.feature-band h3 {
  margin-top: 18px;
  color: white;
}

.feature-band p {
  max-width: 360px;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.65;
}

.feature-icon {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 2px solid white;
  border-radius: 999px;
  font-weight: 900;
}

.store-section,
.checkout-strip {
  padding: 68px max(24px, 7vw);
}

.store-section {
  background: #f7fbff;
}

.light-header {
  padding-top: 0;
}

.checkout-strip {
  display: grid;
  grid-template-columns: minmax(320px, 0.62fr) minmax(0, 1fr);
  gap: 24px;
  background: #eaf6ff;
}

.market-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 24px;
  align-items: stretch;
  min-height: 520px;
  padding: 52px 0 24px;
}

.market-copy,
.checkout-panel,
.lookup-section,
.status-panel,
.admin-panel,
.admin-auth {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.market-copy {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 70px);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 36%),
    linear-gradient(315deg, rgba(183, 121, 31, 0.16), transparent 40%),
    rgba(255, 255, 255, 0.8);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.05;
}

h3 {
  margin: 18px 0 10px;
  font-size: 24px;
  line-height: 1.1;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trust-row span,
.badge,
.stock,
.metric {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 12px;
  color: var(--steel);
  font-size: 13px;
}

.checkout-panel,
.lookup-section,
.status-panel,
.admin-panel,
.admin-auth {
  padding: 22px;
}

.public-page .checkout-panel,
.public-page .lookup-section {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading span {
  font-size: 22px;
  font-weight: 800;
}

.panel-heading small {
  color: var(--muted);
}

label,
.admin-form {
  display: grid;
  gap: 8px;
}

label {
  margin-bottom: 14px;
  color: var(--steel);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 137, 239, 0.14);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 36px 0 18px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.product-card {
  display: grid;
  min-height: 310px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 12px 36px rgba(40, 64, 82, 0.08);
}

.product-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 16px;
  background: #f5f5f3;
}

.card-topline,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-card p {
  color: var(--muted);
  line-height: 1.5;
}

.price {
  color: var(--blue);
  font-size: 24px;
}

.lookup-section {
  margin: 38px 0 70px;
}

.public-page .lookup-section {
  margin: 0;
}

.lookup-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-top: 18px;
}

.lookup-form.compact {
  grid-template-columns: 1fr auto;
}

.order-result {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.credential {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 16px;
}

.credential-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.credential code {
  display: block;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f5f3;
  padding: 9px;
}

.auth-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 12, 18, 0.78);
  backdrop-filter: blur(5px);
}

.auth-overlay[hidden],
.auth-pane[hidden] {
  display: none !important;
}

.auth-dialog {
  position: relative;
  width: min(448px, calc(100vw - 32px));
  overflow: hidden;
  border-radius: 24px;
  background: #dff0ff;
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.38);
}

.auth-pane {
  display: grid;
  gap: 18px;
  padding: 30px 24px 0;
  background: white;
  border-radius: 24px 24px 20px 20px;
}

.auth-pane h2 {
  text-align: center;
  font-size: 24px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input {
  min-height: 48px;
  border-width: 2px;
  border-radius: 13px;
  background: #f7f7f7;
}

.auth-submit {
  min-height: 50px;
  margin-top: 4px;
  border-radius: 13px;
}

.auth-footer {
  display: grid;
  place-items: center;
  min-height: 68px;
  margin: 0 -24px;
  background: #dff0ff;
}

.link-button {
  border: 0;
  color: var(--blue);
  font-weight: 800;
  padding: 8px;
}

.close-button {
  position: absolute;
  z-index: 1;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #f2f2f2;
  color: #333;
  cursor: pointer;
  font-size: 22px;
}

.turnstile-box {
  min-height: 0;
}

.turnstile-box:not([hidden]) {
  min-height: 70px;
}

.terms-check {
  justify-content: center;
  margin-bottom: 0;
  font-weight: 500;
}

.auth-message {
  min-height: 18px;
  margin: 0;
  text-align: center;
}

.narrow-main {
  width: min(760px, calc(100vw - 36px));
  padding: 50px 0;
}

.admin-layout {
  padding: 28px 0 70px;
}

.admin-auth {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.admin-auth-wide {
  grid-column: 1 / -1;
}

.admin-login-form {
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.token-fallback {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 10px;
}

.csv-import-form,
.table-wrap-spaced {
  margin-top: 16px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 500;
}

.inline-check input {
  width: auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  border-radius: var(--radius);
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

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

.publish-form,
.publish-layout,
.publish-fields,
.form-actions {
  display: grid;
  gap: 14px;
}

.publish-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
}

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

.span-2 {
  grid-column: 1 / -1;
}

.delivery-area {
  min-height: 210px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.image-preview {
  position: relative;
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f5f3;
}

.image-preview.is-empty::before {
  content: "Image preview";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  display: block;
}

.form-actions {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
}

.product-list-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.admin-product-thumb {
  width: 64px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f5f3;
}

.json-area {
  min-height: 220px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--steel);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.pending,
.status-pill.released {
  background: rgba(183, 121, 31, 0.14);
  color: var(--gold);
}

.status-pill.error {
  background: rgba(185, 28, 28, 0.12);
  color: var(--red);
}

@media (max-width: 900px) {
  .market-shell,
  .feature-band,
  .checkout-strip,
  .product-grid,
  .admin-grid,
  .publish-layout,
  .publish-fields,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .lookup-form,
  .lookup-form.compact,
  .admin-auth,
  .admin-login-form,
  .form-actions,
  .token-fallback {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    flex-wrap: wrap;
  }

  .public-topbar {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding: 14px 12px;
  }

  .public-topbar .nav {
    gap: 8px;
  }

  .public-topbar .nav a {
    display: none;
  }

  .hero-center h1 {
    font-size: 34px;
  }

  .hero-center h2 {
    font-size: 30px;
  }

  .service-icons span {
    min-width: 54px;
    height: 54px;
    font-size: 15px;
  }

  .store-section,
  .checkout-strip {
    padding: 54px 18px;
  }

  .feature-band {
    padding: 70px 24px;
  }

  .auth-dialog {
    align-self: center;
  }
}
