* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px; color: #1f2329; background: #f5f7fa;
}
a { color: #1677ff; text-decoration: none; }
pre { margin: 0; white-space: pre-wrap; word-break: break-all; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: #fff; border-right: 1px solid #e8eaed;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { padding: 20px 16px 12px; }
.brand-title { font-size: 26px; font-weight: 700; color: #1b5fd6; letter-spacing: 1px; }
.brand-sub { font-size: 12px; color: #7a8290; margin-top: 2px; }
.nav { display: flex; flex-direction: column; padding: 8px 10px; gap: 6px; }
.nav-item {
  display: block; padding: 14px 18px; border-radius: 8px; color: #1f2329; font-size: 14px;
  border: 1px solid transparent;
}
.nav-item:hover { background: #f3f6fb; }
.nav-item.active { background: #eaf2ff; color: #1b5fd6; border-color: #a8c6ff; font-weight: 500; }
.nav-item.disabled { color: #b4bac3; cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; }
.nav-group-title { font-weight: 500; }
.nav-sub { padding: 9px 18px 9px 34px; font-size: 13px; color: #4b5563; }
.nav-sub.active { color: #1b5fd6; }

/* 创建向导 */
.wizard { display: flex; gap: 24px; align-items: flex-start; }
.step-nav { width: 150px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 20px; }
.step-nav-item { padding: 10px 12px; border-radius: 6px; color: #4b5563; font-size: 13px; cursor: pointer; border-left: 2px solid transparent; }
.step-nav-item .no { display: inline-block; width: 20px; color: #9aa3af; }
.step-nav-item.current { background: #eaf2ff; color: #1b5fd6; border-left-color: #1b5fd6; font-weight: 500; }
.step-nav-item.done .no { color: #137a2b; }
.step-panels { flex: 1; min-width: 0; }
.step-panel[hidden] { display: none !important; }
.step-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.step-desc { font-size: 12px; color: #8a93a1; margin-bottom: 16px; }
.step-actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.req { color: #cf1322; margin-left: 2px; }
.opt { color: #9aa3af; font-size: 11px; margin-left: 6px; }
.form-note { margin-bottom: 14px; font-size: 12px; }
.advanced { margin-top: 16px; }
.advanced summary { cursor: pointer; color: #4b5563; font-size: 13px; margin-bottom: 12px; }

/* 官方风格单列表单 */
.of-form { max-width: 860px; }
.of-row { display: flex; margin-bottom: 18px; align-items: flex-start; }
.of-label { width: 132px; flex-shrink: 0; color: #4b5563; padding-top: 7px; font-size: 13px; }
.of-content { flex: 1; min-width: 0; font-size: 13px; }
.of-section { font-size: 15px; font-weight: 600; margin: 26px 0 18px; padding-top: 16px; border-top: 1px solid #f0f0f0; }
.of-section:first-of-type { border-top: none; }
.of-optional { margin-top: 28px; padding-top: 14px; border-top: 3px solid #ff4d4f; }
.of-optional > summary { cursor: pointer; color: #cf1322; font-size: 15px; font-weight: 600; user-select: none; }
.of-optional-body { padding-top: 4px; }
.of-recv-panel { border: 1px solid #d9dde3; border-radius: 5px; background: #fff; }
.of-recv-panel > summary { padding: 10px 12px; cursor: pointer; color: #1b5fd6; font-weight: 500; user-select: none; }
.of-recv-panel-body { padding: 0 12px 12px; }
.of-recv-auth { padding: 12px 0; }
.of-recv-auth h4 { margin: 14px 0 8px; font-size: 13px; }
.of-recv-auth h4:first-child { margin-top: 0; }
.of-recv-manual { margin-top: 12px; }
.of-recv-manual > summary { cursor: pointer; color: #4b5563; }
.of-input { padding: 7px 10px; border: 1px solid #d9dde3; border-radius: 4px; font-size: 13px; width: 260px; max-width: 100%; }
.of-input:focus, .of-select:focus, .of-textarea:focus { outline: none; border-color: #1677ff; }
.of-select { padding: 7px 10px; border: 1px solid #d9dde3; border-radius: 4px; font-size: 13px; margin-left: 8px; }
.of-textarea { width: 100%; min-height: 84px; padding: 8px 10px; border: 1px solid #d9dde3; border-radius: 4px; font-family: inherit; font-size: 13px; resize: vertical; }
.of-unit { display: inline-flex; align-items: stretch; }
.of-unit .of-input { width: 110px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.of-unit-text { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid #d9dde3; border-left: none; background: #fafafa; border-radius: 0 4px 4px 0; color: #4b5563; }
.of-sep { margin: 0 12px; color: #4b5563; line-height: 34px; }
.of-radio { margin-right: 26px; cursor: pointer; line-height: 34px; }
.of-radio.disabled { color: #b4bac3; cursor: not-allowed; }
.of-radio input { margin-right: 6px; }
.of-hint { margin-top: 6px; color: #8a93a1; font-size: 12px; line-height: 1.6; }
.of-hint-inline { color: #8a93a1; font-size: 12px; margin-left: 6px; }
.of-actions { margin-top: 26px; padding-top: 18px; border-top: 1px solid #f0f0f0; display: flex; gap: 12px; }
.of-advanced { margin-top: 26px; border-top: 1px solid #f0f0f0; padding-top: 16px; }
.of-advanced summary { cursor: pointer; font-size: 15px; font-weight: 600; margin-bottom: 16px; }
[data-field][hidden] { display: none !important; }

/* 收款账号选择 */
.of-recv { border: 1px solid #e8eaed; border-radius: 6px; padding: 8px 12px; max-height: 210px; overflow: auto; background: #fff; }
.of-recv-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.of-recv-item input { margin-right: 2px; }
.of-recv-item .recv-del { margin-left: auto; color: #b4bac3; text-decoration: none; padding: 0 4px; }
.of-recv-item .recv-del:hover { color: #cf1322; }
.of-recv-admin { margin-top: 8px; }
.of-recv-admin summary { cursor: pointer; color: #1677ff; font-size: 12px; }
.of-recv-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.of-recv-group { border-bottom: 1px dashed #f0f0f0; padding: 4px 0; }
.of-recv-group:last-child { border-bottom: none; }
.of-recv-merchant { font-weight: 600; font-size: 13px; padding: 6px 0 2px; display: flex; gap: 8px; align-items: center; }
.of-recv-group .of-recv-item { padding-left: 18px; }
.sidebar-foot { margin-top: auto; padding: 12px 16px; font-size: 12px; color: #7a8290; border-top: 1px solid #f0f0f0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-header { background: #fff; border-bottom: 1px solid #e8eaed; padding: 14px 32px; }
.page-header h1 { margin: 0; font-size: 18px; font-weight: 600; }
.page-body { padding: 24px 32px 48px; max-width: 1500px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; line-height: 1.6; }
.alert-warn { background: #fff7e6; border: 1px solid #ffe7ba; color: #613400; }
.alert-info { background: #e8f3ff; color: #1b5fd6; }
.alert-error { background: #fff1f0; border: 1px solid #ffccc7; color: #a8071a; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 4px; border: 1px solid #1677ff;
  background: #fff; color: #1677ff; cursor: pointer; font-size: 14px; line-height: 1.4;
}
.btn:hover { background: #f0f6ff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: #1677ff; color: #fff; }
.btn-primary:hover { background: #3c8cff; }
.btn-danger { border-color: #ff4d4f; color: #ff4d4f; }
.btn-danger:hover { background: #fff1f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-text { border: none; background: transparent; padding: 2px 6px; }
.refresh-line { margin: 8px 0 18px; color: #4b5563; font-size: 13px; }

.card { background: #fff; border: 1px solid #e8eaed; border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; overflow-x: auto; }
.card h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.empty { text-align: right; color: #8a93a1; padding: 60px 0 40px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #fafafa; color: #4b5563; font-weight: 500; }
td.wrap, th.wrap { white-space: normal; min-width: 130px; }
td.actions { white-space: nowrap; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 12px; background: #f0f2f5; color: #4b5563; }
.tag-ok { background: #e6f7e9; color: #137a2b; }
.tag-bad { background: #fff1f0; color: #a8071a; }
.muted { color: #8a93a1; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: #4b5563; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #d9dde3; border-radius: 4px; font-size: 13px; font-family: inherit;
}
.field textarea { min-height: 60px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #1677ff; }
.form-section { grid-column: 1 / -1; font-weight: 600; color: #1f2329; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e8eaed; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.inline-form .field { min-width: 180px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid #e8eaed; border-radius: 8px; padding: 18px 20px; }
.stat .label { font-size: 12px; color: #7a8290; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 6px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: #7a8290; }
.kv dd { margin: 0; word-break: break-all; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 6px;
  background: #1f2329; color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
.toast.show { opacity: 1; }
.toast.error { background: #cf1322; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 40; }
/* hidden 属性必须能盖过 display:flex，否则遮罩会一直挡住整页点击 */
.modal-mask[hidden] { display: none !important; }
.modal { background: #fff; width: min(900px, 92vw); max-height: 85vh; border-radius: 8px; display: flex; flex-direction: column; }
.modal-head { padding: 12px 16px; border-bottom: 1px solid #e8eaed; display: flex; justify-content: space-between; font-weight: 600; }
.modal-body { padding: 16px; overflow: auto; font-family: Consolas, Menlo, monospace; font-size: 12px; }
[hidden]{display:none!important}.page-header{display:flex;align-items:center;justify-content:space-between;gap:16px}.header-actions{display:flex;gap:8px}#login-panel{min-height:100vh;display:grid;place-items:center;padding:24px;background:#f5f7fb}.login-card{width:380px;max-width:100%;background:white;border:1px solid #e6e8ed;border-radius:10px;padding:36px;box-shadow:0 8px 32px #152c5510}.login-card h1{font-size:20px;margin:14px 0}.login-card label,#settings-form label{display:flex;flex-direction:column;gap:7px;margin:14px 0}.login-card input,#settings-form input,#settings-form select,#settings-form textarea{padding:10px;border:1px solid #d9dee7;border-radius:5px;font:inherit;max-width:100%}#captcha-row{display:flex;align-items:center;gap:12px}#captcha-row input{width:140px}.captcha-button{background:white;border:0;cursor:pointer}.captcha-button img{max-width:145px;height:50px;object-fit:contain}.login-card [type=submit]{width:100%;padding:11px}#oo-dialog{border:1px solid #e3e7ee;border-radius:10px;padding:24px;width:680px;max-width:90vw;max-height:85vh;overflow:auto}#oo-dialog::backdrop{background:#14233c66}#settings-form textarea{min-height:75px;font-family:monospace}#settings-form .check-line{flex-direction:row;align-items:center}.toast{z-index:10000}.of-actions{flex-wrap:wrap}@media(max-width:780px){.layout{display:block}.sidebar{position:relative!important;width:100%!important;height:auto!important}.brand{padding:16px}.nav{display:flex;flex-wrap:wrap;padding:8px;gap:4px}.nav-group{display:contents}.nav .nav-item{padding:9px;font-size:13px}.nav .nav-sub{padding-left:9px}.sidebar-foot{position:static;padding:8px 18px}.main{margin-left:0!important;width:100%;min-width:0}.page-header{padding:16px;flex-wrap:wrap}.page-body{padding:16px}.stats{grid-template-columns:repeat(2,1fr)}.of-row{display:block}.of-label{width:auto!important;text-align:left!important;padding-bottom:8px}.of-value{min-width:0}.of-input,.of-textarea,.of-wide{max-width:100%}.card{padding:16px;overflow:auto}.login-card{padding:24px}.of-form{min-width:0}}
