:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --ok: #059669;
  --danger: #dc2626;
  --notice: #fff7ed;
  --notice-line: #fdba74;
  --notice-text: #9a3412;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, #dbeafe 0, transparent 26%),
    radial-gradient(circle at 92% 0%, #e0e7ff 0, transparent 22%),
    var(--bg);
}

.layout {
  width: min(1100px, calc(100% - 20px));
  margin: 0 auto;
  padding: 16px 0 36px;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.header-left { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  box-shadow: 0 8px 18px rgba(37,99,235,.25);
}
.header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.metric {
  min-width: 86px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.metric em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}
.metric strong { font-size: 14px; }

/* Announcement board (not modal) */
.notice-board {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--notice-line);
  background: linear-gradient(180deg, #fffbeb, var(--notice));
  box-shadow: var(--shadow);
}
.notice-icon {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fb923c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.notice-body { min-width: 0; flex: 1; }
.notice-body h2 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--notice-text);
}
.notice-content {
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.main {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.panel-title.row {
  justify-content: space-between;
  align-items: center;
}
.panel-title .left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.panel-title h3 {
  margin: 0;
  font-size: 16px;
}
.panel-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.panel-title code {
  color: var(--primary);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
.step {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--primary-2);
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.input, textarea.input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: 14px/1.45 inherit;
  outline: none;
}
textarea.input {
  min-height: 92px;
  resize: vertical;
}
textarea.input.tall { min-height: 120px; }
.input.mono, textarea.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
.input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.input:disabled { opacity: .55; background: #f8fafc; }

.form-3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
}
.stripe-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 10px;
}
.stripe-box {
  min-height: 44px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}
@media (max-width: 860px) {
  .stripe-grid { grid-template-columns: 1fr; }
}
.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.field.full { grid-column: 1 / -1; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.btn {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.btn:hover { background: #f8fafc; }
.btn.primary {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-2); }
.btn.danger {
  border-color: #fecaca;
  color: var(--danger);
}
.btn.danger:hover { background: #fef2f2; }
.btn.lg { padding: 11px 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.switch-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.switch-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.manual {
  margin-top: 4px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.msg {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* Stripe live requires HTTPS — warn when page is plain HTTP */
.https-warn {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #fef2f2, #fff1f2);
  box-shadow: var(--shadow);
}
.https-warn[hidden] { display: none !important; }
.https-warn-icon {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.https-warn-body { min-width: 0; flex: 1; }
.https-warn-body h2 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #991b1b;
}
.https-warn-text {
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.list { display: grid; gap: 8px; }
.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 13px;
}
.account-row {
  display: grid;
  grid-template-columns: 28px 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.account-row.is-selected { border-color: #93c5fd; background: #f8fbff; }
.account-row .pick { display: flex; align-items: center; justify-content: center; }
.account-row .pick input { width: 16px; height: 16px; cursor: pointer; }
.select-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
.select-bar .linkish {
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
  background: #fff;
}
.account-row.is-ok { border-color: #86efac; background: #f0fdf4; }
.account-row.is-err { border-color: #fca5a5; background: #fef2f2; }
.account-row.is-run { border-color: #93c5fd; background: #eff6ff; }
.idx {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--primary-2);
  font-weight: 800;
  font-size: 12px;
}
.account-title { font-weight: 750; font-size: 14px; }
.account-meta {
  margin-top: 2px;
  color: var(--muted);
  font: 12px ui-monospace, Consolas, monospace;
}
.account-stage { margin-top: 4px; color: var(--muted); font-size: 12px; }
.account-stage.is-err { color: var(--danger); }
.account-link {
  display: block;
  margin-top: 6px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary);
  font-size: 12px;
  text-align: left;
  word-break: break-all;
  cursor: pointer;
}
.row-actions { display: flex; gap: 6px; align-items: center; }
.badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 750;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}
.badge.ok { background: #d1fae5; color: #047857; }
.badge.err { background: #fee2e2; color: #b91c1c; }
.badge.run { background: #dbeafe; color: #1d4ed8; }
.icon-btn {
  border: 1px solid #fecaca;
  background: #fff;
  color: var(--danger);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.progress { margin-top: 14px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  transition: width .25s ease;
}

@media (max-width: 860px) {
  .header { flex-direction: column; align-items: flex-start; }
  .form-3 { grid-template-columns: 1fr; }
  .panel-title.row { flex-direction: column; align-items: stretch; }
  .panel-title.row .btn { width: 100%; }
}
