:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687382;
  --line: #d7dee8;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --accent: #126b5f;
  --accent-dark: #0d4e46;
  --warn: #b7432e;
  --ok: #167348;
  --shadow: 0 24px 80px rgba(23, 32, 42, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(18, 107, 95, 0.12), rgba(197, 74, 57, 0.08)),
    #eef3f8;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.checkout {
  width: min(1120px, 100%);
  min-height: 720px;
  display: grid;
  grid-template-columns: 370px 1fr;
  background: var(--panel);
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 34px;
  background: #10231f;
  color: #f7fbfa;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e5f0ed;
  color: var(--accent-dark);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 5px;
  color: #527469;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary .eyebrow {
  color: #9ec7bd;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.screen-head p:last-child {
  max-width: 580px;
  color: var(--muted);
  line-height: 1.55;
}

.merchant,
.amount-block {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.merchant span,
.amount-block span,
.receipt span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary .merchant span,
.summary .amount-block span {
  color: #9fb5af;
}

.merchant strong,
.amount-block strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.amount-block strong {
  font-size: 2.4rem;
}

.amount-block small,
.timeline small {
  color: #b9cbc6;
}

.timeline {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  gap: 14px;
  align-items: center;
  opacity: 0.58;
}

.timeline li.active,
.timeline li.done {
  opacity: 1;
}

.timeline li > span {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  font-weight: 800;
}

.timeline li.active > span,
.timeline li.done > span {
  background: #d9f1eb;
  border-color: #d9f1eb;
  color: var(--accent-dark);
}

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

.panel {
  position: relative;
  padding: 34px;
  background: var(--panel);
}

.mode-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.mode-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}

.screen {
  display: none;
  max-width: 670px;
}

.screen.current {
  display: block;
}

.details,
.receipt {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0;
}

.details div,
.receipt div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 7px 0 0;
  font-weight: 800;
}

.secondary {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 107, 95, 0.12);
}

select {
  cursor: pointer;
}

small {
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.primary {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary:hover,
.primary:focus {
  background: var(--accent-dark);
}

.primary:disabled,
.secondary:disabled {
  cursor: wait;
  opacity: 0.68;
}

.processing {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--muted);
  font-weight: 800;
}

.processing[hidden] {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #cdd8e3;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.receipt {
  margin-top: 30px;
}

.receipt-note {
  grid-column: 1 / -1;
}

.receipt strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.valid {
  color: var(--ok);
}

.invalid {
  color: var(--warn);
}

.shell.blurred {
  filter: blur(7px);
  pointer-events: none;
  user-select: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 35, 31, 0.45);
}

.modal-backdrop[hidden] {
  display: none;
}

.pending-modal {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.pending-modal h2 {
  margin-bottom: 18px;
  line-height: 1.12;
}

.pending-modal p {
  max-width: 390px;
  margin: 0 auto 10px;
  color: var(--muted);
  line-height: 1.65;
}

.modal-order {
  max-width: 260px;
  margin: 18px auto 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.modal-order span,
.modal-order strong {
  display: block;
}

.modal-order span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal-order strong {
  margin-top: 5px;
  font-size: 1.05rem;
}

.pending-modal .primary {
  width: 100%;
  margin-top: 18px;
}

.admin-shell {
  min-height: 100vh;
  padding: 32px;
}

.login-page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}

.login-page[hidden],
.admin-page[hidden] {
  display: none;
}

.login-card {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 24px;
  font-size: 2rem;
}

.admin-page {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-header h1 {
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3rem);
}

.admin-nav {
  display: flex;
  gap: 10px;
}

.admin-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.admin-stats div,
.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 50px rgba(23, 32, 42, 0.08);
}

.admin-stats div {
  padding: 18px;
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

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

.admin-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f4ef;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 900;
  white-space: nowrap;
}

.actions {
  white-space: nowrap;
}

.table-action {
  min-height: 34px;
  margin-right: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  cursor: pointer;
}

.table-action.danger {
  background: var(--warn);
}

.empty-state {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 860px) {
  .shell {
    padding: 16px;
    place-items: stretch;
  }

  .checkout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .summary,
  .panel {
    padding: 24px;
  }

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

  .admin-shell {
    padding: 18px;
  }

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

  .admin-nav {
    width: 100%;
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .details,
  .receipt,
  .field-grid,
  .timeline {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .primary,
  .secondary {
    width: 100%;
  }

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