:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9e0e7;
  --text: #172026;
  --muted: #65717d;
  --accent: #0d8f68;
  --accent-strong: #07684c;
  --warn: #ad3d22;
  --ink: #0f1720;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 720;
}

h2 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secondary-link {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.secondary-link:hover {
  border-color: var(--accent);
  background: #eef8f4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: start;
}

.left-column {
  display: grid;
  gap: 16px;
}

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

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

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

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

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

.form-section {
  display: grid;
  gap: 14px;
}

.form-section + .form-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.inline-status {
  color: var(--muted);
  font-size: 13px;
}

label,
fieldset {
  display: grid;
  gap: 6px;
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.checkbox-row span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

fieldset {
  border: 0;
  padding: 0;
}

label span,
legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(13, 143, 104, 0.24);
  outline-offset: 1px;
  border-color: var(--accent);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  font-size: 14px;
}

.segmented input:checked + span {
  background: var(--accent);
  color: #fff;
}

.segmented input:disabled + span {
  color: #9aa4af;
  cursor: not-allowed;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.primary-actions {
  grid-template-columns: 1fr;
}

.primary-actions button:first-child {
  min-height: 48px;
  font-size: 16px;
}

.advanced-actions {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.advanced-actions summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-actions .actions {
  margin-top: 10px;
}

.compact-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.compact-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.compact-details .grid {
  margin-top: 10px;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  min-height: 32px;
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 13px;
}

.secondary-button:hover {
  border-color: var(--accent);
  background: #eef8f4;
}

button:disabled {
  border-color: #b8c2cc;
  background: #c8d1da;
  cursor: wait;
}

.output {
  display: grid;
  gap: 14px;
}

.review-card {
  display: grid;
  gap: 10px;
}

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

.review-grid div:first-child,
.review-grid div:last-child {
  grid-column: span 2;
}

.review-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

.review-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.review-grid strong {
  display: block;
  min-height: 22px;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

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

.summary div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.messages {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.messages div {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

.account-panel {
  display: grid;
  gap: 14px;
}

.account-list {
  display: grid;
  gap: 8px;
}

.account-row,
.account-empty {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.account-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.account-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-main strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.account-meta,
.account-empty {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.account-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
}

.admin-shell {
  width: min(1040px, calc(100% - 32px));
}

.admin-layout,
.admin-account-list,
.admin-account-card {
  display: grid;
  gap: 14px;
}

.admin-summary {
  display: grid;
  gap: 12px;
}

.admin-vnc-link {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.admin-vnc-link:hover {
  text-decoration: underline;
}

.admin-account-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.status-pill {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafb;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-available,
.status-authorized {
  border-color: rgba(13, 143, 104, 0.35);
  background: #eef8f4;
  color: var(--accent-strong);
}

.status-needs_login,
.status-unhealthy {
  border-color: rgba(173, 61, 34, 0.28);
  background: #fff4ef;
  color: var(--warn);
}

.status-busy,
.status-auth_in_progress,
.status-checking,
.status-cooldown {
  border-color: rgba(128, 110, 0, 0.25);
  background: #fff8dc;
  color: #715f00;
}

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

.admin-account-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

.admin-account-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-account-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-account-grid p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-account-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.payment-link-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(13, 143, 104, 0.28);
  border-radius: 6px;
  background: #eef8f4;
  padding: 12px;
}

.payment-link-card a {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.handoff-status {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
}

.link-meta {
  color: var(--muted);
  font-size: 12px;
}

.form-page {
  background: #eef2f5;
}

.form-shell {
  width: min(520px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.compact-payment-form,
.compact-output {
  margin-top: 14px;
}

.transaction-status {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(13, 143, 104, 0.28);
  border-radius: 8px;
  background: #eef8f4;
  padding: 12px 14px;
}

.transaction-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.transaction-status strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.transaction-status strong[data-state="active"] {
  color: var(--accent-strong);
}

.transaction-status strong[data-state="terminal"] {
  color: var(--accent);
}

.transaction-status strong[data-state="error"] {
  color: var(--warn);
}

.transaction-status p {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.compact-output {
  display: grid;
  gap: 12px;
}

pre {
  max-height: 620px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11181f;
  color: #d8e8df;
  padding: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 680px);
  }

  .topbar,
  .topbar-actions,
  .workspace,
  .account-row,
  .admin-account-heading,
  .admin-account-grid,
  .admin-account-actions,
  .grid.two,
  .grid.three,
  .review-grid,
  .summary {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    display: grid;
  }

  .section-heading {
    align-items: stretch;
    display: grid;
  }

  .review-grid div:first-child,
  .review-grid div:last-child {
    grid-column: auto;
  }
}

@media (max-width: 460px) {
  .actions,
  .account-actions {
    grid-template-columns: 1fr;
  }
}

/* Public payment page — aligned with the MultiTransfer admin visual system. */
.form-page {
  --bg: #d4c3a0;
  --panel: rgba(251, 245, 233, 0.94);
  --line: rgba(40, 44, 30, 0.18);
  --text: #2b2214;
  --muted: #6a5f48;
  --accent: #b0812f;
  --accent-strong: #8a6423;
  --warn: #b34734;
  --ink: #2b2214;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px 16px;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(214, 197, 153, 0.2), rgba(214, 197, 153, 0.2)),
    url("/duna-bg.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  font-family: Sora, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.form-page::before,
.form-page::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 46vw;
  height: 46vw;
  border: 1px solid rgba(255, 249, 229, 0.26);
  border-radius: 50%;
  pointer-events: none;
}

.form-page::before {
  top: -28vw;
  left: -15vw;
}

.form-page::after {
  right: -19vw;
  bottom: -31vw;
}

.form-page .form-shell {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  margin: 0;
  padding: 0;
}

.payment-header {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.payment-link-timer {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: -4px 0 14px;
  border: 1px solid rgba(21, 122, 92, 0.2);
  border-radius: 10px;
  background: rgba(230, 243, 235, 0.72);
  color: #356052;
  padding: 8px 12px;
  font-size: 12px;
}

.payment-link-timer strong {
  color: #12664e;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
}

.payment-link-timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #15916b;
  box-shadow: 0 0 0 4px rgba(21, 145, 107, 0.1);
}

.payment-link-timer-warning {
  border-color: rgba(154, 107, 24, 0.25);
  background: rgba(248, 239, 217, 0.82);
  color: #805e20;
}

.payment-link-timer-warning strong {
  color: #8c6116;
}

.payment-link-timer-warning .payment-link-timer-dot,
.payment-link-timer-expired .payment-link-timer-dot {
  background: #b27a17;
  box-shadow: 0 0 0 4px rgba(178, 122, 23, 0.1);
}

.payment-link-timer-expired {
  border-color: rgba(167, 63, 45, 0.24);
  background: rgba(250, 233, 229, 0.82);
  color: #963d2d;
}

.payment-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.payment-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(246, 224, 160, 0.28);
  border-radius: 10px;
  background: linear-gradient(135deg, #178a6d, #0e5f4b);
  box-shadow: 0 0 16px rgba(21, 122, 92, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: #eafff6;
  font-size: 17px;
  font-weight: 850;
}

.payment-brand h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.payment-brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.form-page .panel {
  border: 1px solid rgba(63, 50, 23, 0.18);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 3px 10px rgba(47, 34, 11, 0.1), 0 24px 55px rgba(47, 34, 11, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 24px;
  backdrop-filter: blur(18px);
}

.form-page .compact-payment-form {
  margin-top: 0;
  gap: 22px;
}

.payment-summary {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 21px;
  text-align: center;
}

.payment-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.payment-summary strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(30px, 8vw, 38px);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.payment-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2px;
}

.payment-section-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.payment-section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.card-badges {
  display: flex;
  gap: 5px;
}

.card-badges span {
  display: inline-grid;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 244, 0.75);
  color: var(--muted);
  padding: 0 7px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.form-page label {
  gap: 8px;
}

.form-page label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.055em;
}

.form-page input {
  min-height: 46px;
  border: 1px solid rgba(67, 54, 28, 0.19);
  border-radius: 9px;
  background: rgba(255, 252, 244, 0.82);
  padding: 10px 12px;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.form-page input:hover {
  border-color: rgba(176, 129, 47, 0.5);
  background: rgba(255, 253, 247, 0.96);
}

.form-page input:focus {
  border-color: #b0812f;
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(176, 129, 47, 0.16);
  outline: none;
}

.form-page input::placeholder {
  color: #9e927b;
  opacity: 0.8;
}

.form-page .primary-actions button {
  min-height: 54px;
  border: 1px solid rgba(246, 224, 160, 0.28);
  border-radius: 10px;
  background: linear-gradient(135deg, #178a6d, #0e5f4b);
  box-shadow: 0 8px 18px rgba(11, 125, 88, 0.24), inset 0 0 0 1px rgba(246, 224, 160, 0.1);
  color: #eafff6;
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.form-page .primary-actions button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1a9475, #116b55);
  box-shadow: 0 11px 24px rgba(11, 125, 88, 0.3), inset 0 0 0 1px rgba(246, 224, 160, 0.14);
}

.form-page .primary-actions button:active {
  transform: translateY(0);
}

.form-page .primary-actions button:disabled {
  transform: none;
  border-color: rgba(67, 54, 28, 0.14);
  background: #d8ccb2;
  box-shadow: none;
  color: #8b806a;
}

.payment-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.payment-security span {
  color: #157a5c;
  font-size: 8px;
}

.payment-result {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 42px 28px !important;
  text-align: center;
}

.payment-result-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  font-family: "Sora", sans-serif;
  font-size: 38px;
  font-weight: 800;
}

.payment-result h2 {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 800;
}

.payment-result p {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.55;
}

.payment-result-success .payment-result-icon {
  background: #e3f5ed;
  color: #0d805e;
  box-shadow: 0 0 0 10px rgba(13, 128, 94, 0.08);
}

.payment-result-failed .payment-result-icon {
  background: #fae9e5;
  color: #a73f2d;
  box-shadow: 0 0 0 10px rgba(167, 63, 45, 0.07);
}

.payment-result-timeout .payment-result-icon {
  background: #f8efd9;
  color: #9a6b18;
  box-shadow: 0 0 0 10px rgba(154, 107, 24, 0.07);
}

.form-page .form-notice {
  border: 1px solid rgba(193, 84, 63, 0.24);
  border-radius: 9px;
  background: rgba(193, 84, 63, 0.1);
  padding: 10px 12px;
  color: #9b3f2e;
  line-height: 1.45;
}

.form-page .status-pill {
  border-color: rgba(40, 44, 30, 0.15);
  background: rgba(251, 245, 233, 0.72);
  backdrop-filter: blur(10px);
}

.form-page .status-available,
.form-page .status-authorized {
  border-color: rgba(21, 122, 92, 0.26);
  background: rgba(230, 243, 235, 0.82);
  color: #12664e;
}

.payment-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 0;
  color: rgba(74, 61, 36, 0.72);
  font-size: 10px;
}

@media (max-width: 520px) {
  .form-page {
    display: block;
    padding: 18px 12px;
  }

  .payment-header {
    min-height: 48px;
  }

  .payment-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .form-page .panel {
    border-radius: 15px;
    padding: 20px 16px;
  }

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

  .payment-section-heading {
    display: grid;
  }

  .payment-footer {
    display: grid;
    gap: 3px;
    justify-content: center;
    text-align: center;
  }
}
