:root {
  --bg: #07080c;
  --bg-soft: #0c0e14;
  --panel: #11131b;
  --panel-2: #161923;
  --line: #232838;
  --line-soft: #1b2030;
  --text: #e9ecf5;
  --muted: #8b93ab;
  --muted-2: #626b82;
  --gold: #e8b86d;
  --gold-2: #f3cf94;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #7aa2ff;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(232, 184, 109, 0.10), transparent 60%),
    radial-gradient(700px 400px at 95% 0%, rgba(122, 162, 255, 0.08), transparent 55%),
    radial-gradient(800px 600px at 50% 120%, rgba(232, 184, 109, 0.05), transparent 60%);
}

/* ── topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 8, 12, 0.82);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; color: var(--gold); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: 0.22em; font-weight: 700; }
.brand-text span { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }

.status-wrap { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--panel);
  white-space: nowrap;
}
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: none; }
.status-online { border-color: rgba(74, 222, 128, 0.35); color: #b7f7cd; }
.status-online i { background: var(--green); box-shadow: 0 0 10px rgba(74, 222, 128, 0.7); }
.status-connecting { border-color: rgba(251, 191, 36, 0.35); color: #fde9b0; }
.status-connecting i { background: var(--amber); animation: pulse 1.1s infinite; }
.status-offline { color: var(--muted); }
.status-busy { border-color: rgba(122, 162, 255, 0.4); color: #cfdcff; }
.status-busy i { background: var(--blue); box-shadow: 0 0 10px rgba(122, 162, 255, 0.7); animation: pulse 1.2s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}
.ghost-btn:hover { color: var(--text); border-color: #38405a; background: var(--panel); }

/* ── layout ─────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 40px) 10px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(22, 25, 35, 0.85), rgba(13, 15, 21, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h2 { font-size: 15px; margin: 0; letter-spacing: 0.04em; font-weight: 600; }
.tag { font-size: 11.5px; color: var(--muted-2); }
.run-actions { display: flex; gap: 6px; }

/* ── form ───────────────────────────────────────────────── */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.02em; }
.field-label em { font-style: normal; color: var(--gold); font-size: 11px; margin-left: 4px; }
.field-input { display: flex; gap: 8px; }
.field-input input {
  flex: 1;
  min-width: 0;
  background: #0a0c12;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input input:focus { border-color: rgba(232, 184, 109, 0.55); box-shadow: 0 0 0 3px rgba(232, 184, 109, 0.08); }
.field-input.narrow { max-width: 320px; }
.peek {
  background: #0a0c12;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 12px;
  cursor: pointer;
}
.peek:hover { color: var(--text); }
.field-hint { display: block; font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #0a0c12;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}
.seg {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.15s;
}
.seg.active { background: linear-gradient(180deg, rgba(232, 184, 109, 0.18), rgba(232, 184, 109, 0.08)); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(232, 184, 109, 0.35); }

.check-field {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #0a0c12;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  cursor: pointer;
  margin-bottom: 4px;
}
.check-field input { margin-top: 3px; accent-color: var(--gold); width: 15px; height: 15px; flex: none; }
.check-field span { font-size: 12.5px; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.check-field em { font-style: normal; font-size: 11px; color: var(--muted-2); line-height: 1.45; }

.actions { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 4px; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.btn {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  color: #14100a;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  font-family: inherit;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.secondary {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
  font-weight: 500;
  padding: 9px 10px;
  font-size: 12.5px;
}
.btn.secondary:hover:not(:disabled) { border-color: #39415c; }
.btn.danger { background: linear-gradient(180deg, #b91c1c, #991b1b); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 12.5px; display: inline-block; text-decoration: none; }
.hidden { display: none !important; }

/* ── campaign ───────────────────────────────────────────── */
.campaign { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.campaign-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 3px 0; }
.campaign-row span { color: var(--muted); }
.campaign-row b { font-weight: 500; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── steps ──────────────────────────────────────────────── */
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; padding: 0; }
.steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #0b0d13;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px;
  transition: 0.2s;
}
.steps li i {
  width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 1.5px solid var(--muted-2);
  display: grid; place-items: center;
  font-size: 10px;
  color: var(--muted-2);
}
.steps li strong { display: block; font-size: 12.5px; font-weight: 600; }
.steps li span { display: block; font-size: 11px; color: var(--muted-2); line-height: 1.4; }
.steps li.active { border-color: rgba(232, 184, 109, 0.45); background: rgba(232, 184, 109, 0.06); }
.steps li.active i { border-color: var(--gold); color: var(--gold); animation: pulse 1.4s infinite; }
.steps li.active i::after { content: "●"; font-size: 8px; }
.steps li.done { border-color: rgba(74, 222, 128, 0.35); }
.steps li.done i { border-color: var(--green); color: var(--green); }
.steps li.done i::after { content: "✓"; font-size: 10px; font-weight: 700; }
.steps li.failed { border-color: rgba(248, 113, 113, 0.45); }
.steps li.failed i { border-color: var(--red); color: var(--red); }
.steps li.failed i::after { content: "!"; font-weight: 700; }

/* ── alerts ─────────────────────────────────────────────── */
.alert {
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 12px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
  color: #fecaca;
  white-space: pre-wrap;
  word-break: break-word;
}
.alert.warn { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); color: #fde9b0; }
.alert.ok { border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); color: #b7f7cd; }

/* ── terminal ───────────────────────────────────────────── */
.terminal-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #080a0f; }
.terminal-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: #0d1017;
  border-bottom: 1px solid var(--line-soft);
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.red { background: #ff5f57; } .dot.amber { background: #febc2e; } .dot.green { background: #28c840; }
.terminal-title { margin-left: 8px; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }
.terminal {
  margin: 0;
  padding: 12px 14px;
  height: 320px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.62;
  color: #cfd6e6;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal .l-info { color: #cfd6e6; }
.terminal .l-success { color: #7ff0a8; }
.terminal .l-warn { color: #ffd479; }
.terminal .l-error { color: #ff9b9b; }
.terminal .l-sys { color: #6d7791; font-style: italic; }

/* ── receipt ────────────────────────────────────────────── */
.receipt {
  margin-top: 14px;
  border: 1px solid rgba(74, 222, 128, 0.28);
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.07), rgba(74, 222, 128, 0.02));
  border-radius: 12px;
  padding: 14px;
}
.receipt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.receipt-head h3 { margin: 0; font-size: 13.5px; color: #b7f7cd; }
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; }
.receipt-grid div { display: flex; flex-direction: column; gap: 2px; }
.receipt-grid dt { font-size: 11px; color: var(--muted-2); }
.receipt-grid dd { margin: 0; font-size: 12.5px; font-family: var(--mono); word-break: break-all; }

/* ── setup ──────────────────────────────────────────────── */
.setup { padding: 8px clamp(16px, 4vw, 40px) 24px; max-width: 1440px; margin: 0 auto; }
.setup-inner {
  border: 1px solid rgba(232, 184, 109, 0.28);
  background: linear-gradient(180deg, rgba(232, 184, 109, 0.06), rgba(232, 184, 109, 0.015));
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px);
}
.setup-inner h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: 0.02em; }
.setup-lead { color: var(--muted); max-width: 820px; margin: 0 0 18px; font-size: 13px; }
.setup-lead strong { color: var(--gold-2); font-weight: 600; }
.setup-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 14px; }
.setup-steps li { display: flex; flex-direction: column; gap: 8px; padding-left: 2px; align-items: flex-start; }
.setup-steps > li > b { font-size: 13px; }
.setup-note { font-size: 12px; color: var(--muted-2); }
.setup-note a { color: var(--gold); }
.setup-note code { font-family: var(--mono); background: #0a0c12; border: 1px solid var(--line-soft); padding: 1px 5px; border-radius: 5px; font-size: 11.5px; }
.code-line {
  display: flex; align-items: center; gap: 8px;
  background: #080a0f; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; max-width: 560px; overflow: auto;
}
.code-line code { font-family: var(--mono); font-size: 12.5px; color: var(--gold-2); white-space: nowrap; }
.copy-mini {
  margin-left: auto; background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 7px; padding: 3px 8px; font-size: 11px; cursor: pointer;
}
.copy-mini:hover { color: var(--text); }
.advanced { margin-top: 16px; font-size: 12px; color: var(--muted); }
.advanced summary { cursor: pointer; margin-bottom: 8px; }

/* ── footer ─────────────────────────────────────────────── */
.footer {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 18px clamp(16px, 4vw, 40px) 30px;
  color: var(--muted-2); font-size: 11.5px; max-width: 1440px; margin: 0 auto;
}
.footer .sep { opacity: 0.5; }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .actions-row { grid-template-columns: 1fr 1fr; }
}
