:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --surface-warm: #fffaf1;
  --text: #17201b;
  --muted: #5d6b63;
  --border: #d9e0dc;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --on-primary: #ffffff;
  --accent: #a16207;
  --danger: #b91c1c;
  --focus: #0f766e;
  --shadow: 0 12px 30px rgb(23 32 27 / 8%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgb(15 118 110 / 10%), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

button,
select,
a {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
main:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent);
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  background: var(--text);
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
}

.skip-link:focus {
  top: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.brand strong {
  display: block;
  line-height: 1.15;
  font-size: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--text);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(255 255 255 / 72%);
  padding: 4px;
  box-shadow: 0 6px 18px rgb(23 32 27 / 5%);
}

.topnav a {
  min-height: 36px;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  transition: background-color 160ms ease, color 160ms ease;
}

.topnav a:hover,
.topnav a.is-active {
  background: var(--text);
  color: #ffffff;
}

.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.server-state,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.server-state.is-ok {
  border-color: #99d7cd;
  background: #e7f6f3;
  color: var(--primary-strong);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 32px;
}

.hero-card {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f2f7f4);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero-card h1,
.panel h2,
.choice-card h3,
.plan-card h3,
.guide-section h3,
.delivery-card h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.hero-card h1 {
  font-size: clamp(26px, 4vw, 42px);
}

.hero-card p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 16px;
}

.guide-page,
.admin-page {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.service-panel {
  grid-row: span 2;
}

.help-panel {
  grid-column: 1;
}

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

.panel h2 {
  font-size: 20px;
}

.compact-head {
  align-items: center;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

label,
legend {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.helper-text {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
}

input::placeholder {
  color: #93a19a;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-form input {
  margin-top: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.field-grid legend {
  padding: 0 6px;
}

button,
.ghost-link {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 800;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.ghost-link:hover {
  border-color: #b9c6bf;
  background: #e5ece7;
}

button:active,
.ghost-link:active {
  transform: translateY(1px);
}

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

.primary-button {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.primary-button:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.ghost-button {
  min-height: 36px;
  padding: 7px 10px;
  background: transparent;
}

.danger-button {
  border-color: #fecaca;
  background: #fff7f7;
  color: var(--danger);
}

.danger-button:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fee2e2;
}

.result-box,
.empty-state,
.service-block {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fbfcfa;
  color: var(--muted);
  padding: 12px;
}

.result-box {
  display: none;
  margin-top: 14px;
  white-space: pre-wrap;
}

.result-box.is-visible {
  display: block;
}

.result-box.is-error {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff7f7;
}

.choice-grid,
.plans-view,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.plans-view {
  margin-top: 12px;
}

.choice-card,
.plan-card,
.step-card,
.delivery-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
}

.choice-card h3,
.plan-card h3 {
  font-size: 17px;
}

.choice-card p,
.faq-grid p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.price {
  margin: 0;
  color: var(--primary-strong);
  font-size: 22px;
  font-weight: 900;
}

.service-grid {
  display: grid;
  gap: 12px;
}

.service-block {
  display: grid;
  gap: 10px;
}

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

.meta-item {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.meta-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.meta-value {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101714;
  color: #e8f0eb;
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tight-actions {
  justify-content: flex-end;
}

.step-list {
  display: grid;
  gap: 12px;
}

.step-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.step-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.step-card pre {
  margin-top: 10px;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 850;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.download-link:hover {
  border-color: #b9c6bf;
  background: #e5ece7;
}

.download-link:active {
  transform: translateY(1px);
}

.primary-download {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.primary-download:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

.step-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--text);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
}

.summary-list dt {
  color: var(--muted);
  font-weight: 800;
}

.summary-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-orders label {
  display: block;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.table-action {
  min-height: 32px;
  padding: 5px 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 4px 4px 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-badge.active,
.status-badge.paid,
.status-badge.redeemed,
.status-badge.used {
  border-color: #99d7cd;
  background: #e7f6f3;
  color: #115e59;
}

.status-badge.expired,
.status-badge.suspended,
.status-badge.refunded {
  border-color: #fecaca;
  background: #fff7f7;
  color: var(--danger);
}

.muted-text {
  color: var(--muted);
}

.mono-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 10px;
  background: var(--text);
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

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

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .server-state {
    justify-self: start;
  }

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

  .service-panel,
  .help-panel {
    grid-row: auto;
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .topbar,
  .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topnav {
    width: 100%;
    overflow-x: auto;
  }

  .topnav a {
    flex: 1 0 auto;
    text-align: center;
  }

  .inline-form,
  .field-grid,
  .meta-grid,
  .choice-grid,
  .plans-view,
  .faq-grid,
  .summary-list div {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tight-actions {
    justify-content: flex-start;
  }
}

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