:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --line-strong: #b9c5d2;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --focus: #f59e0b;
}

* {
  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;
  color: var(--text);
  background: #eef2f5;
}

.checkout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.workspace {
  width: min(100%, 1240px);
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgb(23 32 42 / 10%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.logout-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.header-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.header-balance-item {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #f8fafc;
}

.logout-button:hover {
  color: var(--text);
  background: #f8fafc;
}

.danger-button {
  width: auto;
  min-height: 34px;
  justify-self: start;
  margin: 4px 0 0;
  padding: 0 12px;
  color: #991b1b;
  border: 1px solid #fecaca;
  background: #fff1f2;
  font-size: 13px;
}

.danger-button:hover {
  color: #7f1d1d;
  background: #ffe4e6;
}

.secondary-button {
  width: auto;
  min-height: 34px;
  margin: 4px 0 0;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.secondary-button:hover {
  background: #f8fafc;
}

.mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
}

h1 {
  margin: 0 0 24px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 18px 0 10px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

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

.section-heading h1 {
  margin: 0;
}

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

.form button,
.form p,
.form .check-row {
  grid-column: 1 / -1;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 180px));
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #eef3f5;
  overflow-x: auto;
}

.tab-button {
  min-height: 40px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.tab-button:hover {
  color: var(--text);
  background: #fff;
}

.tab-button.is-active {
  color: var(--text);
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 1px 3px rgb(23 32 42 / 8%);
}

.tab-panels {
  min-height: calc(100vh - 172px);
  padding: 28px 32px;
}

.tab-panel {
  max-width: 560px;
}

#tab-checkout {
  max-width: 760px;
  margin: 0 auto;
}

#tab-checkout h1 {
  text-align: center;
}

#tab-checkout .form {
  margin-left: auto;
  margin-right: auto;
}

.tab-panel#tab-records,
.tab-panel#tab-token-users {
  max-width: 1000px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

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

input,
select,
button {
  width: 100%;
  min-height: 46px;
  border-radius: 7px;
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

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

button {
  margin-top: 6px;
  border: 0;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

#status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#withdraw-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#withdraw-query-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#login-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(15 118 110 / 8%), transparent 34%),
    linear-gradient(315deg, rgb(245 158 11 / 10%), transparent 38%),
    #eef2f5;
}

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

.login-workspace {
  width: min(100%, 920px);
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1fr);
  overflow: hidden;
  border: 1px solid rgb(185 197 210 / 80%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(23 32 42 / 14%);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(160deg, rgb(15 118 110 / 94%), rgb(17 94 89 / 92%)),
    url("data:image/svg+xml,%3Csvg width='640' height='640' viewBox='0 0 640 640' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16' stroke-width='1'%3E%3Cpath d='M72 120h496M72 220h496M72 320h496M72 420h496M72 520h496M120 72v496M220 72v496M320 72v496M420 72v496M520 72v496'/%3E%3Cpath d='M118 418l86-96 86 46 92-130 76 70 64-86' stroke-opacity='.28' stroke-width='4'/%3E%3Ccircle cx='204' cy='322' r='8' fill='%23ffffff' fill-opacity='.72' stroke='none'/%3E%3Ccircle cx='290' cy='368' r='8' fill='%23ffffff' fill-opacity='.72' stroke='none'/%3E%3Ccircle cx='382' cy='238' r='8' fill='%23ffffff' fill-opacity='.72' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
}

.login-brand .mark {
  color: var(--accent);
  background: #fff;
}

.login-visual-copy {
  display: grid;
  gap: 10px;
}

.login-visual-copy p {
  margin: 0;
  color: rgb(255 255 255 / 78%);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-visual-copy strong {
  max-width: 320px;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 52px;
}

.login-panel-header {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.login-eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.login-panel h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.16;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label {
  gap: 9px;
  color: #3d4b5c;
}

.login-form input {
  min-height: 50px;
  border-color: #cdd7e2;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 15px;
}

.login-form input:focus {
  border-color: var(--accent);
  background: #fff;
}

.login-form button {
  min-height: 50px;
  margin-top: 4px;
  border-radius: 8px;
  background: #0f766e;
  box-shadow: 0 10px 22px rgb(15 118 110 / 24%);
}

.login-form button:hover {
  background: #115e59;
}

.login-form #login-status {
  min-height: 24px;
  color: #7c8795;
}

.records {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 18px;
}

.record-section {
  min-width: 0;
}

.record-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.record-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.token-user-list {
  margin-top: 18px;
}

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

.limit-info-box {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

@media (max-width: 920px) {
  .workspace {
    min-height: calc(100vh - 28px);
  }

  .tab-panels {
    padding: 20px;
  }

  .record-list,
  .records {
    grid-template-columns: 1fr;
  }

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

  .login-visual {
    min-height: 220px;
  }

  .login-visual-copy strong {
    font-size: 34px;
  }

  .login-panel {
    padding: 34px;
  }
}

@media (max-width: 520px) {
  .checkout {
    padding: 10px;
  }

  .brand {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .header-balance {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .login-shell {
    padding: 12px;
  }

  .login-visual {
    min-height: 170px;
    padding: 20px;
  }

  .login-visual-copy strong {
    font-size: 28px;
  }

  .login-panel {
    padding: 26px 20px;
  }

  .login-panel h1 {
    font-size: 26px;
  }
}

.qr-container {
  margin-top: 24px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-code-wrapper {
  display: inline-block;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  transition: transform 0.3s ease;
}

.qr-code-wrapper:hover {
  transform: scale(1.03);
}

.qr-address-box {
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
  font-family: monospace;
  word-break: break-all;
  user-select: all;
  background: rgba(15, 118, 110, 0.05);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid rgba(15, 118, 110, 0.15);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
