:root {
  color-scheme: light;
  --ink: #10213f;
  --muted: #5f6f86;
  --line: #d9e1ec;
  --surface: #ffffff;
  --background: #f3f6fa;
  --soft-blue: #eaf0ff;
  --accent: #1747be;
  --accent-dark: #103b9f;
  --warning-bg: #fff4d7;
  --warning-ink: #6b4b00;
  --danger: #b42318;
  --success: #15724f;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(33, 64, 112, 0.1);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--background);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar,
.checkout-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.demo-badge,
.demo-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.demo-badge {
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.manager-page {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 36px;
}

.page-intro {
  max-width: 700px;
  margin-bottom: 28px;
}

.section-kicker,
.preview-label,
.dialog-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-intro > p:last-child {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.manager-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.form-panel,
.preview-panel,
.checkout-card,
.state-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: clamp(22px, 4vw, 38px);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset + fieldset {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

legend {
  margin-bottom: 20px;
  padding: 0;
  font-size: 18px;
  font-weight: 750;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid.three-columns {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.three-columns .field {
  grid-column: span 2;
}

.three-columns .wide-field {
  grid-column: span 3;
}

.full-width {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.field label span {
  color: var(--muted);
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #b9c5d5;
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
  color: #75849a;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 71, 190, 0.14);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
}

.amount-control {
  position: relative;
}

.amount-control input {
  padding-right: 42px;
}

.amount-control span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
}

.field-error {
  min-height: 16px;
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.3;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
}

.primary-button,
.copy-button,
.secondary-button {
  min-height: 48px;
  padding: 11px 19px;
  border: 0;
  border-radius: 10px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, transform 100ms ease, opacity 160ms ease;
}

.primary-button,
.copy-button {
  background: var(--accent);
  color: #f9fbff;
}

.primary-button:hover,
.copy-button:hover {
  background: var(--accent-dark);
}

.primary-button:active,
.copy-button:active,
.secondary-button:active,
.payment-methods button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-status {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.form-status--success {
  color: var(--success);
}

.result-panel {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid #b9d9cc;
  border-radius: var(--radius);
  background: #f0faf6;
}

.result-panel[hidden],
[hidden] {
  display: none !important;
}

.result-title {
  margin: 0 0 3px;
  color: var(--success);
  font-weight: 800;
}

.result-panel p:not(.result-title) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.link-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 16px 0 12px;
}

.link-control input {
  min-width: 0;
  background: var(--surface);
}

.text-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  text-underline-offset: 3px;
}

.preview-panel {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.preview-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.preview-topline p {
  margin: 0;
  font-weight: 750;
}

.preview-topline span {
  color: var(--muted);
  font-size: 12px;
}

.preview-content {
  padding: 26px 20px 20px;
}

.preview-amount {
  margin: 0 0 24px;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.preview-content dl,
.order-details {
  margin: 0;
}

.preview-content dl > div,
.order-details > div {
  display: grid;
  grid-template-columns: minmax(85px, 0.55fr) minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.method-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.method-preview span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.preview-note {
  margin: 0;
  padding: 16px 20px;
  background: var(--soft-blue);
  color: #29497f;
  font-size: 12px;
  line-height: 1.5;
}

.local-note {
  padding: 0 20px 34px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.checkout-page {
  background: #eef3f9;
}

.checkout-header {
  width: 100%;
}

.secure-caption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.checkout-shell {
  width: min(620px, calc(100% - 32px));
  margin: 42px auto;
}

.demo-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 13px 16px;
  border-radius: 11px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 13px;
}

.checkout-card {
  padding: clamp(24px, 6vw, 40px);
}

.checkout-summary {
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.checkout-summary h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 58px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.checkout-service {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.order-details {
  padding: 8px 0 22px;
}

.payment-methods h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-methods h2 {
  grid-column: 1 / -1;
}

.payment-methods button {
  min-height: 74px;
  padding: 14px;
  border: 1px solid #bfcbdc;
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 100ms ease;
}

.payment-methods button:hover,
.payment-methods button:focus-visible {
  border-color: var(--accent);
  background: var(--soft-blue);
  outline: 0;
}

.method-name,
.method-hint {
  display: block;
}

.method-name {
  font-weight: 800;
}

.method-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.checkout-footnote {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.loading-card {
  display: grid;
  gap: 18px;
}

.skeleton {
  border-radius: 8px;
  background: #e8edf4;
  animation: pulse 1.1s ease-in-out infinite alternate;
}

.skeleton.short {
  width: 110px;
  height: 16px;
}

.skeleton.amount {
  width: 220px;
  max-width: 70%;
  height: 54px;
}

.skeleton.row {
  height: 46px;
}

@keyframes pulse {
  to {
    opacity: 0.52;
  }
}

.demo-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(16, 33, 63, 0.24);
}

.demo-dialog::backdrop {
  background: rgba(16, 33, 63, 0.52);
}

.demo-dialog form {
  padding: 28px;
}

.demo-dialog h2 {
  margin: 0;
  font-size: 24px;
}

.demo-dialog p:not(.dialog-label) {
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.state-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.state-card {
  width: min(460px, 100%);
  padding: 36px;
  text-align: center;
}

.state-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.state-card .state-logo {
  margin-bottom: 18px;
}

.state-card h1 {
  margin: 10px 0;
  font-size: 32px;
}

.state-card p:not(.demo-label) {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  background: var(--soft-blue);
  color: var(--accent-dark);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.manager-badge {
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--soft-blue);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.admin-badge {
  background: #fff0ed;
  color: #8f1d14;
}

.logout-button,
.manager-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.logout-button:hover,
.manager-link:hover {
  color: var(--accent);
}

.public-payment-page {
  display: grid;
  grid-template-columns: minmax(280px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(36px, 6vw, 84px);
  align-items: start;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(46px, 7vw, 88px) 0;
}

.public-payment-copy {
  position: sticky;
  top: 34px;
}

.public-payment-copy h1 {
  margin: 0;
  color: var(--accent-dark);
  font-size: clamp(42px, 6vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.public-payment-copy > p:not(.section-kicker) {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.safe-list {
  display: grid;
  gap: 14px;
  margin: 34px 0 0;
  padding: 0;
  color: #34445e;
  font-size: 14px;
  line-height: 1.4;
  list-style: none;
}

.safe-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 11px;
  align-items: center;
}

.safe-list span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft-blue);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.public-form-panel {
  box-shadow: 0 24px 70px rgba(33, 64, 112, 0.12);
}

.public-actions {
  align-items: flex-start;
  flex-direction: column;
}

.consent-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #edf3ff 0%, #f7f9fc 52%, #eef3f8 100%);
}

.login-card {
  width: min(430px, 100%);
  padding: clamp(28px, 6vw, 44px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 38px;
}

.login-card h1 {
  margin: 0;
  font-size: 38px;
  letter-spacing: -0.04em;
}

.login-intro {
  margin: 10px 0 26px;
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 16px;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 4px;
}

.checkout-notice {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #ead49b;
  border-radius: 11px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 13px;
  line-height: 1.45;
}

.checkout-notice--success {
  border-color: #b9d9cc;
  background: #f0faf6;
  color: var(--success);
}

.hosted-payment {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.hosted-payment h2 {
  margin: 0;
  font-size: 20px;
}

.hosted-payment > p:not(.payment-status) {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.payment-brand-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.payment-brand-list span {
  display: grid;
  place-items: center;
  min-height: 45px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faff;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.payment-button {
  width: 100%;
  margin-top: 16px;
}

.payment-status {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.state-payment-link {
  display: block;
  margin: -8px 0 20px;
}

.manager-refund {
  margin-top: 32px;
}

.refund-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1fr);
  gap: 32px;
  align-items: end;
}

.refund-heading h2 {
  margin: 6px 0 0;
  font-size: clamp(24px, 3vw, 34px);
}

.refund-heading > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.refund-lookup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 24px;
}

.refund-lookup .secondary-button {
  min-width: 150px;
}

.refund-details {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f9fd;
}

.refund-details dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 18px;
  width: 100%;
  margin: 0;
}

.refund-details dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.refund-details dd {
  margin: 0;
  font-weight: 750;
}

.danger-button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: #b42318;
  color: #fff;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.danger-button:hover {
  background: #8f1d14;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.embed-page {
  min-height: 0;
  background: var(--background);
}

.embed-shell {
  width: min(920px, calc(100% - 24px));
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.embed-heading {
  display: flex;
  gap: 18px;
  align-items: center;
}

.embed-heading .state-logo {
  flex: 0 0 72px;
}

.embed-heading h1 {
  margin: 5px 0 0;
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -0.04em;
}

.embed-intro {
  max-width: 720px;
  margin: 22px 0 28px;
  color: var(--muted);
  line-height: 1.55;
}

.embed-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.embed-form .full-width,
.embed-actions {
  grid-column: 1 / -1;
}

.embed-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 4px;
}

.embed-result {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #b9d4c5;
  border-radius: 14px;
  background: #f0faf4;
}

.embed-result p {
  margin: 0 0 14px;
}

.embed-result .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 900px) {
  .manager-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .public-payment-page {
    grid-template-columns: 1fr;
  }

  .public-payment-copy {
    position: static;
    max-width: 680px;
  }

  .refund-heading {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .refund-details {
    align-items: stretch;
    flex-direction: column;
  }

  .refund-details dl {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .checkout-header {
    min-height: 64px;
    padding: 10px 16px;
  }

  .brand small,
  .secure-caption {
    display: none;
  }

  .demo-badge {
    max-width: 145px;
    font-size: 10px;
    text-align: center;
  }

  .manager-badge {
    display: none;
  }

  .manager-link {
    font-size: 12px;
  }

  .manager-page {
    width: min(100% - 24px, 1240px);
    padding-top: 30px;
  }

  .refund-lookup,
  .refund-details dl {
    grid-template-columns: 1fr;
  }

  .refund-lookup .secondary-button,
  .danger-button {
    width: 100%;
  }

  .embed-shell {
    width: 100%;
    padding: 24px 16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .embed-heading .state-logo {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  .embed-form {
    grid-template-columns: 1fr;
  }

  .embed-form .full-width,
  .embed-actions {
    grid-column: 1;
  }

  .embed-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-intro h1 {
    font-size: 34px;
  }

  .form-grid,
  .form-grid.three-columns {
    grid-template-columns: 1fr;
  }

  .three-columns .field,
  .three-columns .wide-field {
    grid-column: 1;
  }

  .form-panel {
    padding: 20px 16px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .link-control {
    grid-template-columns: 1fr;
  }

  .payment-methods {
    grid-template-columns: 1fr;
  }

  .public-payment-page {
    width: min(100% - 24px, 1240px);
    padding: 34px 0;
  }

  .public-payment-copy h1 {
    font-size: 44px;
  }

  .payment-brand-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@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;
  }
}
