:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --line: #e6e8eb;
  --line-strong: #d8dbe0;
  --text: #1f2328;
  --muted: #8b9198;
  --green: #10a37f;
  --green-dark: #0d8a6c;
  --green-tint: #f0faf7;
  --red: #e5484d;
  --amber: #b7791f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", system-ui, "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 26px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 11px;
  white-space: nowrap;
}

.page { max-width: 1680px; margin: 0 auto; padding: 18px 26px 72px; }

.topbar-right input { width: 190px; flex: none; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 标签栏 ---------- */

.tabs { display: flex; padding: 0; overflow-x: auto; }

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
}

.tab svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}

.tab:hover { color: var(--text); background: #fafbfc; }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 500; }

.panel { display: none; }
.panel.active { display: block; }

/* ---------- 表单 ---------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }

.inline-box {
  background: var(--green-tint);
  border: 1px dashed #b7e4d6;
  border-radius: 9px;
  padding: 14px 15px 8px;
  margin-bottom: 16px;
}

.inline-box .muted { display: block; margin: 0 0 10px; }
.inline-box .field { margin-bottom: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-action { justify-content: flex-end; align-items: flex-start; }
.field-action .btn { width: auto; }

.label { font-size: 12.5px; color: #4a5058; font-weight: 500; }
.label i { color: var(--red); font-style: normal; margin-left: 1px; }

input, select, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.6; }

input::placeholder, textarea::placeholder { color: #b4b9c0; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, .12);
}

select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.8 6 7.8l3-3' fill='none' stroke='%238b9198' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
  padding-right: 30px;
}

/* ---------- 方案卡 ---------- */

.sub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 10px;
}

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }

.plan {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  padding: 14px 15px;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.plan:hover { border-color: #b9c0c7; }
.plan.active { border-color: var(--green); background: var(--green-tint); }

.plan-name { font-size: 13.5px; font-weight: 600; }
.plan-price { font-size: 16px; font-weight: 600; margin-top: 2px; }
.plan-price em { font-size: 12px; font-weight: 400; font-style: normal; color: var(--muted); }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 15px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.btn:hover { border-color: var(--green); color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { color: var(--green); background: var(--green-tint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  background: var(--green);
  border: none;
  border-radius: 9px;
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.cta svg { width: 16px; height: 16px; fill: currentColor; }
.cta:hover { background: var(--green-dark); }
.cta:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表格 ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
td.actions { display: flex; gap: 6px; }
td.actions .btn { padding: 5px 10px; font-size: 12px; }

/* ---------- 状态 ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok   { color: var(--green); border-color: #b7e4d6; background: var(--green-tint); }
.badge.warn { color: var(--amber); border-color: #f0dcb4; background: #fdf8ee; }
.badge.bad  { color: var(--red);   border-color: #f5c9ca; background: #fdf2f2; }
.badge.run  { color: #2563eb;      border-color: #c3d6f7; background: #f2f7fe; }

.bar { height: 5px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 64px; }
.bar > i { display: block; height: 100%; background: var(--green); transition: width .3s; }

.hint { margin: 10px 0 0; font-size: 12.5px; min-height: 17px; }
.hint.ok { color: var(--green); }
.hint.err { color: var(--red); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0 6px; margin: 0; }

.proxy-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.proxy-controls input { flex: 1 1 300px; min-width: 0; }
.proxy-controls .btn { flex: 0 0 auto; }
@media (max-width: 720px) {
  .proxy-controls input { flex-basis: 100%; }
}
.result {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 12px 0 0;
  color: #5a6169;
}

.steps { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.steps li { padding: 6px 0 6px 18px; border-bottom: 1px solid var(--line); position: relative; }
.steps li:last-child { border-bottom: none; }
.steps li::before { content: "›"; position: absolute; left: 3px; color: var(--green); font-weight: 600; }

.kv { display: grid; grid-template-columns: 108px 1fr; gap: 8px 16px; font-size: 13px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

h3.section { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
code { background: var(--bg); padding: 1.5px 6px; border-radius: 5px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .tab { flex: 1 0 auto; font-size: 12px; padding: 12px 6px; gap: 4px; }
}

/* 支付任务：左侧创建，右侧跟踪进度。 */
.payment-layout.active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.payment-layout > .card { min-width: 0; margin-bottom: 0; }
.payment-layout .card-head, .payment-layout .sub-head { flex-wrap: wrap; gap: 6px 14px; }
.payment-progress { position: sticky; top: 18px; }
.progress-empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.progress-empty strong { color: #5a6169; font-size: 14px; font-weight: 500; }
.progress-empty p { margin: 8px auto 0; max-width: 290px; font-size: 13px; }
.progress-summary { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.progress-summary strong { flex: none; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-summary .bar { flex: 1; min-width: 0; height: 8px; }
.payment-progress .steps { max-height: 360px; overflow-y: auto; margin-bottom: 18px; overflow-wrap: anywhere; }
.progress-message { display: flex; align-items: baseline; gap: 10px; background: var(--bg); border-radius: 8px; padding: 12px; margin: 0 0 14px; overflow-wrap: anywhere; }
.progress-message .badge { flex: none; }
.progress-message > span:last-child { min-width: 0; }
.account-name { overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
#jobTable { min-width: 760px; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pagination > div { display: flex; gap: 8px; }
.field, .plans > * { min-width: 0; }
@media (max-width: 1050px) {
  .payment-layout.active { grid-template-columns: minmax(0, 1fr); }
  .payment-progress { position: static; }
}
@media (max-width: 720px) {
  .page { padding: 14px 12px 40px; }
  .topbar { padding: 12px; flex-wrap: wrap; }
  .topbar-right { flex-wrap: wrap; }
  .grid-3 { grid-template-columns: 1fr; }
}
#jobTable th, #jobTable .actions .btn { white-space: nowrap; }
