:root {
  color-scheme: light;
  --ink: #17202c;
  --muted: #667085;
  --line: #e3e8ef;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --navy: #11213b;
  --blue: #2364df;
  --blue-dark: #1747a6;
  --green: #087a55;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(17, 33, 59, 0.1);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-soft);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 24px 132px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(96, 165, 250, 0.42), transparent 27%),
    radial-gradient(circle at 10% 15%, rgba(34, 211, 238, 0.22), transparent 23%),
    linear-gradient(135deg, #0f1c32 0%, #142d58 58%, #174a8b 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -56% 38%;
  height: 390px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transform: rotate(-8deg);
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 12px;
  color: #9fc6ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow--dark {
  color: var(--blue);
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.hero__copy {
  max-width: 760px;
  margin-bottom: 34px;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero__stats > div {
  min-width: 170px;
  padding: 15px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.stat__label {
  display: block;
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero__stats strong {
  font-size: 1.05rem;
}

.page-shell {
  position: relative;
  z-index: 2;
  width: min(1240px, calc(100% - 32px));
  margin: -76px auto 70px;
}

.toolbar,
.table-card,
.admin-card {
  border: 1px solid rgba(17, 33, 59, 0.07);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) repeat(2, minmax(160px, 0.8fr)) auto;
  gap: 14px;
  align-items: end;
  padding: 20px;
  margin-bottom: 22px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  color: #475467;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d6dde7;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus {
  border-color: #77a5ff;
  box-shadow: 0 0 0 4px rgba(35, 100, 223, 0.1);
}

.button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.button--primary {
  background: var(--blue);
  color: #fff;
}

.button--primary:hover {
  background: var(--blue-dark);
}

.button--dark {
  background: var(--navy);
  color: #fff;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid #fedf89;
  border-radius: 14px;
  background: #fffaeb;
  color: #7a2e0e;
  padding: 14px 16px;
  line-height: 1.5;
}

.table-card {
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  letter-spacing: -0.035em;
}

.section-heading__note {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: right;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfcfe;
  color: #667085;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdff;
}

.pack-link {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 92px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, #f8fafc, #eef2f7);
  overflow: hidden;
}

.pack-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.set-cell {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 190px;
}

.series-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef4ff;
  color: #2457b3;
  font-size: 0.68rem;
  font-weight: 800;
}

.series-pill--mega {
  background: #f4ebff;
  color: #6941c6;
}

.set-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  text-decoration: none;
}

.set-name:hover {
  color: var(--blue);
}

.set-code,
.release-date {
  color: var(--muted);
  font-size: 0.84rem;
}

.id-button {
  border: 1px solid #d9e1eb;
  border-radius: 9px;
  background: #f9fafb;
  color: #344054;
  padding: 7px 10px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.id-button:hover {
  border-color: #a9c5fb;
  color: var(--blue);
}

.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.discounted-price {
  color: var(--green);
}

.price-error {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
}

.loading-cell,
.empty-cell {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.admin-card {
  margin-top: 22px;
  overflow: hidden;
}

.admin-card summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px 26px;
  cursor: pointer;
  list-style: none;
}

.admin-card summary::-webkit-details-marker {
  display: none;
}

.admin-card summary span:first-child {
  display: grid;
  gap: 4px;
}

.admin-card summary small {
  color: var(--muted);
}

.summary-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef4ff;
  color: var(--blue);
  font-size: 1.3rem;
  transition: transform 150ms ease;
}

.admin-card[open] .summary-icon {
  transform: rotate(45deg);
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 0 26px 26px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 38px;
}

.input-suffix > span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  transform: translateY(-50%);
}

.form-status {
  grid-column: 1 / -1;
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-status--success {
  color: var(--green);
}

.form-status--error {
  color: var(--red);
}

.footnotes {
  padding: 18px 6px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.footnotes p {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .field--search {
    grid-column: 1 / -1;
  }

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

  .admin-form .button,
  .form-status {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .hero {
    padding: 56px 20px 112px;
  }

  .hero__stats > div {
    flex: 1 1 140px;
  }

  .page-shell {
    width: min(100% - 20px, 1240px);
    margin-top: -66px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 16px;
  }

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

  .section-heading {
    display: block;
    padding: 24px 20px 18px;
  }

  .section-heading__note {
    margin-top: 10px;
    text-align: left;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tbody {
    padding: 12px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 0 12px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
  }

  tbody tr:last-child {
    margin-bottom: 0;
  }

  td {
    border: 0;
    padding: 7px 0;
  }

  td:first-child {
    grid-row: 1 / span 5;
  }

  td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #98a2b3;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .pack-link {
    width: 82px;
    height: 110px;
  }

  .set-cell {
    min-width: 0;
  }

  .loading-cell,
  .empty-cell {
    grid-column: 1 / -1;
    padding: 30px 12px;
  }

  .loading-cell::before,
  .empty-cell::before {
    display: none !important;
  }

  .admin-form {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .admin-card summary {
    padding: 20px;
  }
}

/* Inventory and admin modal additions */
.hero__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero__topline .eyebrow {
  margin-bottom: 0;
}

.button--ghost {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(10px);
}

.button--ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

.button--secondary {
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
}

.toolbar {
  grid-template-columns: minmax(210px, 1.35fr) repeat(3, minmax(145px, 0.75fr));
}

.inventory-quantity {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 850;
}

.stock-badge--in {
  background: #ecfdf3;
  color: #067647;
}

.stock-badge--out {
  background: #f2f4f7;
  color: #667085;
}

.admin-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.admin-dialog {
  width: min(980px, calc(100% - 28px));
  height: min(860px, calc(100vh - 28px));
  height: min(860px, calc(100dvh - 28px));
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  margin: auto;
  border: 0;
  border-radius: 22px;
  padding: 0;
  background: transparent;
  box-shadow: 0 28px 90px rgba(16, 24, 40, 0.32);
}

.admin-dialog::backdrop {
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(4px);
}

.admin-dialog__shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(17, 33, 59, 0.08);
  border-radius: 22px;
  background: #fff;
}

.admin-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-dialog__header h2 {
  margin-bottom: 6px;
  font-size: clamp(1.55rem, 3vw, 2rem);
  letter-spacing: -0.035em;
}

.admin-dialog__header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
  color: #475467;
  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;
}

.icon-button:hover {
  background: #f9fafb;
}

.admin-panel {
  min-height: 0;
  overflow: hidden;
  padding: 24px 26px 26px;
}

#admin-login-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.admin-editor-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.login-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  max-width: 720px;
}

.login-form .form-status {
  grid-column: 1 / -1;
}

.admin-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-discount-field {
  width: min(220px, 100%);
}

.admin-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-inventory-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.admin-inventory-table th {
  top: 0;
  z-index: 2;
}

.admin-inventory-table td,
.admin-inventory-table th {
  padding: 12px 14px;
}

.admin-set-cell {
  display: grid;
  gap: 3px;
  min-width: 185px;
}

.admin-set-code,
.admin-product-id {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-product-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.inventory-input {
  min-width: 100px;
  max-width: 135px;
  min-height: 40px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

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

.switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background 150ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.25);
  transition: transform 150ms ease;
}

.switch input:checked + .switch__track {
  background: var(--green);
}

.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch__track {
  outline: 3px solid rgba(35, 100, 223, 0.2);
  outline-offset: 2px;
}

.switch input:disabled + .switch__track {
  opacity: 0.45;
}

.switch__label {
  min-width: 82px;
  color: #475467;
  font-size: 0.8rem;
  font-weight: 750;
}

.admin-help {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 1100px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--search {
    grid-column: 1 / -1;
  }

  .toolbar .button--primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .hero__topline {
    align-items: flex-start;
  }

  .button--ghost {
    padding: 0 12px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .field--search,
  .toolbar .button--primary {
    grid-column: auto;
  }

  tbody tr {
    grid-template-columns: 92px 1fr;
  }

  td:first-child {
    grid-row: 1 / span 7;
  }

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

  .admin-dialog__shell {
    border-radius: 18px;
  }

  .admin-dialog__header {
    padding: 20px;
  }

  .admin-panel {
    min-height: 0;
    overflow: hidden;
    padding: 18px;
  }

  #admin-login-panel {
    overflow-y: auto;
  }

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

  .login-form .form-status {
    grid-column: auto;
  }

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

  .admin-discount-field {
    width: 100%;
  }

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

  .admin-inventory-wrap {
    min-height: 0;
    max-height: none;
  }

  .admin-inventory-table,
  .admin-inventory-table thead,
  .admin-inventory-table tbody,
  .admin-inventory-table tr,
  .admin-inventory-table th,
  .admin-inventory-table td {
    display: table-cell;
  }

  .admin-inventory-table {
    min-width: 670px;
  }

  .admin-inventory-table thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .admin-inventory-table tbody {
    padding: 0;
  }

  .admin-inventory-table tbody tr {
    display: table-row;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .admin-inventory-table td {
    display: table-cell;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .admin-inventory-table td:first-child {
    grid-row: auto;
  }

  .admin-inventory-table td::before {
    display: none !important;
  }
}
