:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172538;
  background: #f3f6fa;
  --muted: #536579;
  --line: #dce4ee;
  --teal: #00776d;
  --teal-dark: #005d55;
  --nav: #102539;
  --paper: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.76rem, 4vw, 2.5rem); font-weight: 750; letter-spacing: -.04em; }
h2 { font-size: 1.19rem; font-weight: 740; }
p { line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
:focus-visible { outline: 3px solid #219a8d; outline-offset: 3px; }
.workspace { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  padding: 30px 17px 17px; background: var(--nav); color: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 11px; padding: 0 8px; font-size: 1.18rem; font-weight: 760; letter-spacing: -.025em; }
.brand-mark { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 10px; background: #bdf0da; color: #124238; font-size: 1.37rem; font-weight: 820; }
.brand small { display: block; margin-top: 2px; color: #a9bfce; font-size: .77rem; font-weight: 550; letter-spacing: .04em; }
nav { display: grid; gap: 5px; margin-top: 35px; }
.nav-link, .logout { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 8px; font-size: .92rem; font-weight: 650; color: #bfd0df; }
.nav-link:hover, .nav-link.active, .logout:hover { background: #233e53; color: #fff; }
.nav-icon { position: relative; display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; }
.grid-icon { border: 1.5px solid currentColor; border-radius: 3px; }
.grid-icon::before, .grid-icon::after, .list-icon::before, .plus-icon::before, .plus-icon::after { content: ""; position: absolute; background: currentColor; }
.grid-icon::before { width: 1px; left: 6px; height: 100%; }
.grid-icon::after { height: 1px; top: 6px; width: 100%; }
.plus-icon { border: 1.5px solid currentColor; border-radius: 50%; }
.plus-icon::before { width: 1px; height: 7px; top: 3px; left: 6px; }
.plus-icon::after { height: 1px; width: 7px; left: 3px; top: 6px; }
.list-icon::before { width: 13px; height: 1.5px; left: 1px; top: 3px; box-shadow: 0 4px currentColor, 0 8px currentColor; }
.logout { margin-top: auto; text-align: left; border: 0; background: transparent; }
.main { width: 100%; max-width: 1450px; margin-inline: auto; padding: clamp(23px, 4vw, 58px); }
.page-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 28px; }
.page-header p, .panel-head p { color: var(--muted); margin-top: 6px; }
.page-header > .pill { margin-top: 7px; }
.pill { display: inline-flex; align-items: center; width: max-content; max-width: 100%; padding: 5px 10px; border-radius: 7px; white-space: nowrap; font-size: .875rem; font-weight: 680; background: #e9edf2; color: #41566c; }
.pill.sandbox, .pill.processing { background: #e4eeff; color: #214f91; }
.pill.mock, .pill.paid { background: #dff5ea; color: #08654b; }
.pill.production, .pill.rejected, .pill.api_error { background: #ffebe9; color: #942c2c; }
.pill.unknown, .pill.refunded { background: #fff0d1; color: #774818; }
.payout-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(265px, 1fr); gap: 20px; align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 7px #132c4a07; }
.panel { padding: 24px; scroll-margin-top: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-head p { margin-top: 4px; font-size: .94rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields .wide { grid-column: span 2; }
label { display: grid; gap: 7px; font-size: .9rem; font-weight: 660; }
input, select {
  width: 100%; min-width: 0; height: 43px; border: 1px solid #cbd7e4; border-radius: 8px;
  padding: 0 11px; background-color: #fff; color: #172538; font-size: .94rem; font-weight: 450;
}
input::placeholder { color: #6c7c90; opacity: 1; }
select {
  appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 49%, #526579 51%), linear-gradient(135deg, #526579 49%, transparent 51%);
  background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.joined { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.button { min-height: 41px; border: 1px solid transparent; padding: 8px 14px; border-radius: 8px; font-size: .9rem; font-weight: 670; white-space: nowrap; }
.subtle { background: #fff; border-color: #cbd7e4; color: #29465e; }
.subtle:hover:enabled { background: #eff5f9; }
.primary { background: var(--teal); color: white; padding-inline: 19px; }
.primary:hover:enabled { background: var(--teal-dark); }
.primary.danger { background: #9d3131; }
.primary.danger:hover:enabled { background: #7c2121; }
.form-action { margin-top: 20px; }
.connection dl, .detail-meta { display: grid; gap: 11px; margin: 17px 0; }
.connection dl > div { border-bottom: 1px solid #edf0f4; padding-bottom: 8px; }
dt { color: var(--muted); font-size: .84rem; margin-bottom: 3px; }
dd { margin: 0; font-size: .91rem; font-weight: 650; overflow-wrap: anywhere; }
.mono, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.connection .mono { font-size: .79rem; line-height: 1.55; }
.callout, .summary { padding: 10px 12px; border-radius: 8px; background: #edf5fa; color: #304e66; font-size: .89rem; }
.callout.warn { color: #832f22; background: #fff1e7; }
.error { padding: 10px 12px; border-radius: 8px; background: #fff0ee; color: #8b302b; font-size: .88rem; margin-top: 12px; }
.records { margin-top: 22px; }
.filters { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(112px, .48fr) minmax(112px, .48fr) auto; gap: 11px; align-items: end; margin-bottom: 17px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 635px; border-collapse: collapse; text-align: left; font-size: .88rem; }
th, td { border-bottom: 1px solid #e5ebf2; padding: 11px 10px; }
th { background: #f4f7fa; color: #526579; font-weight: 650; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td:first-child { max-width: 215px; font-weight: 670; }
.table-scroll .empty { padding: 27px 10px; text-align: center; color: var(--muted); font-weight: 450; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: .86rem; }
.pager { display: flex; gap: 7px; }
.pager .button, .code-head .button { min-height: 34px; padding: 5px 9px; }
.text-button { border: 0; background: transparent; color: var(--teal-dark); font-size: .88rem; font-weight: 690; padding: 4px 0; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: inherit; box-shadow: 0 16px 60px #10253943; }
dialog::backdrop { background: #0c1d32a1; }
.dialog-head { position: sticky; z-index: 1; top: 0; padding: 13px 19px; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.icon-button { background: transparent; color: #455a70; border: 0; border-radius: 6px; min-height: 36px; min-width: 36px; font-size: 1.65rem; line-height: 1; }
.icon-button:hover { background: #eef3f8; }
.dialog-content { padding: 18px 20px 20px; display: grid; gap: 13px; }
.dialog-target { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.summary { font-weight: 620; overflow-wrap: anywhere; }
.code-head { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; gap: 10px; }
pre { margin: 0; padding: 13px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; background: #14283c; color: #dceefa; line-height: 1.55; font-size: .84rem; }
.dialog-content small, .muted { color: var(--muted); font-weight: 450; }
.small { font-size: .82rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: #102539; }
.login-card { width: min(100%, 440px); padding: clamp(23px, 6vw, 40px); }
.login-brand { padding: 0; margin-bottom: 25px; }
.login-card h1 { font-size: 1.85rem; }
.login-card p { color: var(--muted); margin-top: 7px; }
.login-card form { display: grid; gap: 15px; margin-top: 20px; }
.login-card .error { margin: 0; color: #8b302b; }
.toast { position: fixed; bottom: 16px; right: 16px; z-index: 3; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 8px; background: #102539; color: white; box-shadow: 0 4px 20px #10253938; }
@media (max-width: 1060px) {
  .workspace { grid-template-columns: 174px minmax(0, 1fr); }
  .main { padding: 26px; }
  .panel { padding: 19px; }
}
@media (max-width: 870px) {
  .payout-layout { grid-template-columns: minmax(0, 1fr); }
  .connection { grid-row: 1; }
  .connection dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .workspace { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 15px; display: grid; grid-template-columns: 1fr auto; }
  nav { grid-column: span 2; grid-row: 2; display: flex; margin: 9px 0 0; }
  .nav-link { gap: 6px; padding-inline: 8px; }
  .logout { margin: 0; }
  .main { padding: 19px 13px 25px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: span 2; }
}
@media (max-width: 420px) {
  .fields { grid-template-columns: 1fr; }
  .fields .wide { grid-column: auto; }
  .page-header { flex-direction: column; gap: 4px; }
  .panel { padding: 16px; }
  .panel-head { gap: 8px; }
}
.tools { margin-top: 22px; }
.tool-nav { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.tool-nav [aria-pressed="true"] { background: #e1f3ef; color: var(--teal-dark); border-color: #a4d5ca; }
.tool-form { display: grid; justify-items: start; gap: 13px; margin-top: 16px; }
.beneficiary-defaults { margin-top: 14px; font-size: .9rem; }
.beneficiary-defaults + .tool-form { margin-top: 10px; }
.tool-form .fields { width: 100%; }
.callback-controls { display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
#callback-feedback:not(:empty) { margin-bottom: 10px; }
#more-callbacks { margin-top: 10px; }
.callback-record { border-top: 1px solid var(--line); padding: 10px 0; }
.callback-record summary { cursor: pointer; overflow-wrap: anywhere; }
.callback-record p { margin: 6px 0; overflow-wrap: anywhere; }
.callback-record pre { max-height: 350px; overflow: auto; }
.tool-result { display: grid; justify-items: start; gap: 9px; margin-top: 16px; }
.tool-result pre { width: 100%; max-height: 390px; overflow: auto; }
.tool-result .error { margin-top: 0; }
.balance-items { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style-type: none; }
.balance-items li { padding: 7px 11px; background: #edf5fa; border-radius: 7px; font-weight: 680; }
#detail-query-section pre, #detail-webhook-section pre { margin-top: 7px; }
.mock-webhook-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.mock-webhook-form label { min-width: 140px; }
@media (max-width: 680px) {
  nav { flex-wrap: wrap; }
  .callback-controls { grid-template-columns: 1fr; }
}
