:root {
  color-scheme: light;
  --paper: #f2f4f1;
  --surface: #fff;
  --subtle: #f2f5f2;
  --rail: #142c25;
  --ink: #192720;
  --muted: #53665c;
  --line: #dce5de;
  --control-line: #becdc3;
  --green: #176047;
  --green-hover: #0d4d36;
  --selected: #e4f2e9;
  font: 14px/1.55 Inter, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
select.el-input__inner { appearance: auto; }
:focus-visible, .el-button:focus-visible, .el-input__inner:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* 登录与导航 */
.sign-in { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel {
  width: min(100%, 420px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 10px;
  background: var(--surface);
}
.wordmark, aside strong { font-size: 25px; font-weight: 760; letter-spacing: -.045em; }
.wordmark { color: var(--green); }
.login-panel h1 { margin: 16px 0 24px; font-size: 23px; }
.login-panel form { display: grid; gap: 16px; }
.login-panel input, .login-panel select { width: 100%; height: 42px; }
.login-panel button { min-height: 42px; }
#login-feedback { color: #8b3529; margin: 0; }
#login-feedback:empty, #feedback:empty, .dialog-feedback:empty,
.workspace section > p[role="status"]:empty { display: none; }

.workspace, .api-doc {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
}
aside {
  background: var(--rail);
  color: #eaf4ed;
  padding: 26px 16px 18px;
}
.workspace aside {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
aside strong { display: block; margin: 0 12px 28px; }
aside nav { display: grid; gap: 5px; }
aside a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #dbebe2;
  font-weight: 580;
  text-decoration: none;
}
aside a:hover { background: #213c32; }
aside a[aria-current="page"] { background: #325b4b; color: #fff; }
aside :focus-visible { outline-color: #9ad4b9; }
.rail-footer { margin-top: auto; padding-top: 26px; }
.rail-footer > a { border-top: 1px solid #3b544a; border-radius: 0 0 6px 6px; }
.rail-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  padding: 12px;
  color: #c5d6cc;
  font-size: 13px;
}
.rail-account .el-button {
  min-height: 30px;
  margin-left: auto;
  color: #ecf5ee;
  border-color: #587366;
  background: transparent;
}
.rail-account .el-button:hover { color: #fff; border-color: #87aa98; background: #213c32; }

/* 每个模块独立排布操作栏、筛选和数据。 */
main {
  min-width: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 46px) 44px;
}
.workspace-heading, .module-heading, .module-actions, .dialog-heading, .table-tools, .list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.workspace-heading, .module-heading, .dialog-heading { justify-content: space-between; }
.workspace-heading { margin-bottom: 22px; }
.workspace-heading h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.25; }
h2 { margin: 0 0 16px; font-size: 17px; line-height: 1.4; }
.module-heading { margin-bottom: 16px; }
.module-heading h2, .dialog-heading h2 { margin: 0; }
main section {
  min-width: 0;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
#shared-scope {
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 7px;
}
#shared-scope label { display: flex; align-items: center; gap: 10px; }
#shared-scope input { width: min(36vw, 190px); }
.table-tools, .list-filters { align-items: end; }
.list-filters {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.list-filters > label { flex: 1 1 190px; }
.list-filters > #order-scope { flex: 1 1 170px; }
.list-filters label { width: 100%; }
.list-filters .module-actions { flex: 0 0 auto; }
.table-count { margin: 14px 0 10px; color: var(--muted); font-size: 13px; }
.table-count strong { color: var(--ink); font-variant-numeric: tabular-nums; }
#feedback {
  padding: 10px 14px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

/* Element UI 皮肤 */
form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
label { display: inline-grid; gap: 6px; font-weight: 560; max-width: 100%; }
.el-input__inner, .el-button {
  max-width: 100%;
  border-color: var(--control-line);
  border-radius: 6px;
  font: inherit;
}
.el-input__inner { height: 38px; color: var(--ink); font-weight: 400; }
.el-input__inner::placeholder { color: #66796e; opacity: 1; }
.el-input__inner[type="file"] { height: auto; min-height: 38px; padding: 6px 10px; }
.el-input__inner:focus { border-color: var(--green); }
.el-button { min-height: 38px; padding: 7px 13px; font-weight: 600; }
.el-button + .el-button { margin-left: 0; }
.el-button--primary, .el-button--primary:focus {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
.el-button--primary:is(:hover, :active) {
  color: #fff;
  background: var(--green-hover);
  border-color: var(--green-hover);
}
.el-button--default { color: var(--ink); background: var(--surface); }
.el-button--default:is(:hover, :active, :focus) {
  color: var(--green);
  background: var(--selected);
  border-color: var(--green);
}
.el-button.el-button--text {
  background: transparent;
  border-color: transparent;
  color: var(--green);
}
.el-button--text:hover { background: var(--selected); }
.el-button:disabled { opacity: .55; cursor: not-allowed; }

/* 交易表格、状态和行内操作 */
.table { overflow: auto; margin-top: 12px; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line); }
th { background: var(--subtle); font-size: 13px; font-weight: 650; }
.workspace th, .workspace td { white-space: nowrap; }
.workspace tbody tr:hover { background: #f7faf7; }
.workspace td .el-button {
  min-height: 32px;
  padding: 4px 9px;
  border-color: transparent;
  color: var(--green);
  background: transparent;
}
.workspace td .el-button:hover { background: var(--selected); }
td .el-button + .el-button { margin-left: 6px; }
#orders tr > :nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
#orders td:first-child:not(.empty) { font-variant-numeric: tabular-nums; }
td.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.status-pill {
  border: 0;
  border-radius: 20px;
  padding-inline: 9px;
  font-weight: 600;
  color: var(--muted);
  background: var(--subtle);
}
.status-pill[data-status="paid"] { color: #196044; background: #e2f4e9; }
.status-pill[data-status="pending"] { color: #765116; background: #f8efdb; }
pre { overflow: auto; padding: 12px; background: var(--subtle); }

/* 白底编辑弹窗，提交动作独立成行。 */
dialog {
  width: min(570px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 48px rgb(14 35 26 / 15%);
}
dialog::backdrop { background: rgb(19 39 31 / 50%); }
.dialog-heading { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
dialog form { display: grid; align-items: start; gap: 14px; }
dialog form :is(input, select) { width: 100%; }
dialog form .field-check { display: flex; align-items: center; gap: 8px; }
dialog form input[type="checkbox"] { width: auto; accent-color: var(--green); }
dialog form button { justify-self: start; }
dialog .dialog-actions { display: flex; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--line); }
.dialog-feedback { margin-bottom: 0; color: var(--muted); overflow-wrap: anywhere; }
.field-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
#epusdt-agent-limits fieldset + fieldset { margin-top: 12px; }
#epusdt-authorized { padding-left: 23px; margin-bottom: 0; }
#epusdt-authorized li { padding-block: 5px; }
#epusdt-authorized li > * { margin-right: 8px; }
#fixed-link { margin-left: 8px; }
#fixed-qr { margin-top: 14px; }
details summary { cursor: pointer; color: var(--green); }
.payment-qr { display: inline-block; padding: 16px 0 0; }
.qr-preview { display: grid; place-items: center; padding: 12px; }

.api-doc main { max-width: 1080px; }
.api-doc header { display: flex; justify-content: space-between; color: var(--muted); }
.api-doc aside nav { position: sticky; top: 24px; }
.api-doc aside nav a:first-child { margin-bottom: 12px; }
.api-doc section { scroll-margin-top: 16px; }
.api-doc td code { overflow-wrap: anywhere; }
.api-doc pre { padding: 16px; background: #192720; color: #f9faf3; line-height: 1.65; }

@media (max-width: 760px) {
  .workspace, .api-doc { grid-template-columns: minmax(0, 1fr); }
  .workspace aside { position: static; height: auto; }
  aside { padding: 12px 16px; }
  aside strong { margin: 0 0 8px; }
  aside nav { display: flex; flex-wrap: wrap; gap: 4px; }
  aside a { min-height: 38px; padding: 5px 8px; }
  .rail-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding-top: 6px; }
  .rail-footer > a { border: 0; }
  .rail-account { margin: 0; padding: 0; }
  main { padding-top: 20px; }
  main section { padding: 14px; }
  .workspace-heading { margin-bottom: 14px; }
  .workspace-heading h1 { flex: 1 1 100%; }
  th, td { padding: 10px 12px; }
  #orders thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  #orders table, #orders tbody { display: block; }
  #orders tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  #orders td { padding: 0; border: 0; }
  #orders td:first-child { grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
  #orders td:nth-child(2) { text-align: left; font-weight: 650; }
  #orders td:nth-child(3) { justify-self: end; }
  #orders td:nth-child(4) { align-self: center; }
  #orders td:nth-child(5) { justify-self: end; }
  #orders td.empty { padding: 20px 0; }
}
@media (max-width: 420px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  dialog { padding: 16px; }
}

.security-panel { max-width: 850px; }
.security-setting {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 0;
}
.security-setting + .security-setting { border-top: 1px solid var(--line); }
.security-setting h2 { margin: 0 0 5px; }
.security-setting p, .totp-instructions { margin: 0; color: var(--muted); }
#totp-qr {
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.docs-panel { padding: 0; overflow: hidden; }
.docs-panel iframe {
  display: block;
  width: 100%;
  height: max(540px, calc(100dvh - 132px));
  border: 0;
  background: var(--surface);
}

#agent-step-policy .multi-select { height: 160px; padding: 6px; }
#agent-step-policy fieldset { margin-top: 12px; }
#agent-step-remark label { width: 100%; }
#agent-wizard-back { margin-right: 12px; }
#agent-created-credentials { white-space: pre-wrap; overflow-wrap: anywhere; }

.multi-select.el-input__inner { height: auto; min-height: 86px; padding-block: 6px; }
[data-checkout-picker] { display: grid; gap: 12px; margin-bottom: 12px; }
[data-method-options] { display: flex; gap: 8px 16px; flex-wrap: wrap; }
#wizard-method-grants, #existing-method-grants { display: grid; gap: 8px; align-self: start; }

#submit-payout .dialog-actions { gap: 12px; }

/* 国家搜索下拉保留原表单字段，选项使用可换行的页面控件。 */
.country-select-source { display: none !important; }
.country-picker { min-width: 0; margin-top: 6px; }
.country-picker summary {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.country-picker-panel { padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.country-picker-actions { display: flex; gap: 8px; }
.country-picker-list { display: grid; max-height: 220px; overflow: auto; }
.country-picker-list button {
  width: 100%; text-align: start; padding: 7px 10px; cursor: pointer;
  border: 0; background: transparent; color: inherit; font: inherit;
}
.country-picker-list [aria-pressed="true"] { background: #e8f3ed; color: #176047; font-weight: 650; }
.country-picker-list [aria-pressed="true"]::after { content: " ✓"; }

.api-doc .api-toolbar { align-items: center; flex-wrap: wrap; gap: 12px; }
.api-toolbar > div { display: flex; flex-wrap: wrap; gap: 12px; }
.api-toolbar label { display: flex; align-items: center; gap: 6px; }
.api-toolbar select { width: auto; padding: 6px; color: var(--ink); background: var(--white); }
.api-doc pre { overflow-x: auto; }
#example-runtime { color: var(--muted); }
