:root {
  --ink: #191a18;
  --muted: #6b6f68;
  --line: #d9dcd5;
  --line-strong: #bfc4bb;
  --paper: #fff;
  --canvas: #f3f4f1;
  --yellow: #f7df1e;
  --yellow-hover: #e7cd00;
  --green: #167c55;
  --red: #b73b32;
  --blue: #296aa6;
  --shadow: 0 12px 32px rgba(25, 26, 24, 0.07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
.hidden { display: none !important; }

.topbar {
  height: 64px;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #d3bc00;
  border-radius: 6px;
  background: var(--yellow);
  font-size: 19px;
  font-weight: 900;
}
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 14px; }
.brand-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.service-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.service-dot { width: 8px; height: 8px; border-radius: 50%; background: #999d96; }
.service-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 124, 85, 0.12); }
.service-dot.offline { background: var(--red); }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 30px clamp(14px, 3vw, 34px) 44px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.eyebrow, .section-label { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; }
.page-heading h1 { margin: 8px 0 0; font-size: 40px; line-height: 1.1; }
.service-metrics { margin: 0; display: grid; grid-template-columns: repeat(3, 100px); border: 1px solid var(--line); background: var(--paper); }
.service-metrics > div { min-height: 56px; padding: 10px 12px; border-left: 1px solid var(--line); }
.service-metrics > div:first-child { border-left: 0; }
.service-metrics dt { color: var(--muted); font-size: 10px; }
.service-metrics dd { margin: 4px 0 0; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

.workspace { margin-top: 24px; display: grid; grid-template-columns: 1.08fr 0.92fr; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.input-pane, .output-pane { min-width: 0; padding: 26px; }
.output-pane { border-left: 1px solid var(--line); background: #fbfcfa; }
.section-heading { min-height: 42px; display: flex; align-items: center; gap: 12px; }
.section-heading > div { min-width: 0; }
.section-heading h2, .activity-heading h2 { margin: 2px 0 0; font-size: 18px; }
.step-number { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 10px; font-weight: 800; }
.status-badge { margin-left: auto; min-width: 64px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); text-align: center; font-size: 10px; font-weight: 700; }
.status-badge.ok { border-color: rgba(22, 124, 85, 0.35); background: rgba(22, 124, 85, 0.08); color: var(--green); }
.status-badge.bad { border-color: rgba(183, 59, 50, 0.35); background: rgba(183, 59, 50, 0.08); color: var(--red); }
.status-badge.running { border-color: rgba(41, 106, 166, 0.35); background: rgba(41, 106, 166, 0.08); color: var(--blue); }

.field-label { display: block; margin: 24px 0 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
textarea, .link-input { width: 100%; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--paper); color: var(--ink); outline: 0; }
textarea { min-height: 178px; padding: 12px; resize: vertical; line-height: 1.55; font-family: Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
textarea:focus, .link-input:focus { border-color: #7a7f76; box-shadow: 0 0 0 3px rgba(25, 26, 24, 0.06); }
.account-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.account-row span { color: var(--muted); font-size: 10px; }
.account-row strong { max-width: 70%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.payment-fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.payment-fieldset legend { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.method-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; }
.method-switch label + label { border-left: 1px solid var(--line-strong); }
.method-switch input { position: absolute; opacity: 0; pointer-events: none; }
.method-switch span { min-height: 40px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.method-switch input:checked + span { background: var(--yellow); color: var(--ink); }
.error-box { margin-top: 15px; padding: 10px 12px; border-left: 3px solid var(--red); background: #fff4f2; color: var(--red); font-size: 11px; line-height: 1.5; }
.form-actions, .result-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.button { min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 780; }
.button.primary { border-color: #d0ba00; background: var(--yellow); color: var(--ink); }
.button.primary:hover:not(:disabled) { background: var(--yellow-hover); }
.button.secondary { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.button.secondary:hover:not(:disabled) { background: #f1f3ef; }

.result-empty { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.result-mark { width: 56px; height: 56px; margin-bottom: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); font-size: 13px; font-weight: 900; }
.result-empty strong { font-size: 14px; }
.result-empty > span:last-child { margin-top: 6px; color: var(--muted); font-size: 10px; }
.result-ready { padding-top: 22px; }
.result-summary { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-summary > div { min-height: 54px; padding: 10px; }
.result-summary > div + div { border-left: 1px solid var(--line); }
.result-summary span, .result-summary strong { display: block; }
.result-summary span { color: var(--muted); font-size: 9px; }
.result-summary strong { margin-top: 5px; font-size: 13px; font-variant-numeric: tabular-nums; }
.qr-wrap { width: 174px; height: 174px; margin: 22px auto; padding: 8px; border: 1px solid var(--line); background: var(--paper); }
.qr-wrap img { width: 100%; height: 100%; display: block; }
.link-input { height: 38px; padding: 0 10px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }
.result-actions { grid-template-columns: 1fr 1fr; }

.activity { margin-top: 16px; border: 1px solid var(--line); background: var(--paper); }
.activity-heading { min-height: 62px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.text-button { padding: 6px 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.text-button:hover { color: var(--ink); }
.log-list { min-height: 82px; max-height: 240px; margin: 0; padding: 14px 18px; overflow: auto; list-style: none; }
.log-empty { min-height: 52px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.log-item { min-height: 45px; display: grid; grid-template-columns: 12px 1fr; gap: 10px; position: relative; }
.log-item::before { content: ""; position: absolute; top: 15px; bottom: -2px; left: 4px; width: 1px; background: var(--line); }
.log-item:last-child::before { display: none; }
.log-marker { width: 9px; height: 9px; margin-top: 5px; z-index: 1; border: 2px solid var(--paper); border-radius: 50%; background: #969a93; box-shadow: 0 0 0 1px #969a93; }
.log-item.ok .log-marker { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.log-item.fail .log-marker { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.log-item strong, .log-item time { display: block; }
.log-item strong { font-size: 11px; line-height: 1.45; }
.log-item time { margin-top: 2px; color: var(--muted); font-size: 9px; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 10; max-width: min(360px, calc(100vw - 36px)); padding: 11px 14px; border-radius: 5px; background: var(--ink); color: white; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 150ms ease, transform 150ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 820px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .service-metrics { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .output-pane { border-top: 1px solid var(--line); border-left: 0; }
  .result-empty { min-height: 260px; }
}

@media (max-width: 520px) {
  .topbar { height: 58px; padding: 0 12px; }
  .brand-copy small { display: none; }
  .shell { padding: 20px 10px 30px; }
  .page-heading h1 { font-size: 32px; }
  .service-metrics > div { padding: 9px; }
  .input-pane, .output-pane { padding: 18px 14px; }
  .form-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
