:root {
  --bg: #f7f8fa;
  --surface: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
}

* { box-sizing: border-box; }

.muted { color: var(--muted); font-size: 12px; }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: #f0fdf4; color: var(--ok); font-size: 12px; font-weight: 600;
  border: 1px solid #bbf7d0;
}
.status-pill.running { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.running .status-dot { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.invite-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.invite-label { font-size: 12px; font-weight: 600; color: #374151; white-space: nowrap; }
.invite-input {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.invite-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
#inviteTag { margin-right: 8px; color: var(--primary); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f9fafb; position: sticky; top: 0; z-index: 1; font-weight: 600; color: #4b5563; font-size: 11px; }
.col-idx { width: 40px; text-align: center; color: var(--muted); }
.col-phone { width: 110px; font-family: Consolas, monospace; word-break: break-all; }
.col-status { width: 64px; }
.col-detail { font-size: 11px; color: #4b5563; word-break: break-all; }
.row-running { background: #eff6ff; }
.row-ok { background: #f0fdf4; }
.row-fail { background: #fef2f2; }

.empty-hint { display: none; padding: 30px; text-align: center; color: var(--muted); }
.empty-hint.visible { display: block; }

.table-pager {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: #f9fafb;
  font-size: 12px;
}
.table-pager.hidden { display: none; }
.pager-info { color: #4b5563; min-width: 72px; text-align: center; }

.badge { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-ok { background: #d1fae5; color: #047857; }
.badge-fail { background: #fee2e2; color: #b91c1c; }
.badge-idle { background: #e5e7eb; color: #6b7280; }
.badge-monitor { background: #d1fae5; color: #047857; }
.row-monitor { background: #ecfdf5; }

.log-line-ok { color: #16a34a; }
.log-line-fail { color: #dc2626; }
.log-line-warn { color: #d97706; }
.log-line-info { color: #2563eb; }

.section-log {
  height: 130px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  transition: height 0.2s ease;
}
.section-log.collapsed {
  height: 32px;
}
.section-log.collapsed .log-scroll {
  display: none;
}
.log-toggle {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}
.log-toggle::before {
  content: "▾ ";
  color: var(--muted);
}
.section-log.collapsed .log-toggle::before {
  content: "▸ ";
}
.log-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 6px 10px;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 11px;
  line-height: 1.45;
  background: #fafafa;
  border: none;
  white-space: pre-wrap;
  word-break: break-all;
}

.status-bar {
  flex-shrink: 0; padding: 5px 10px;
  background: #eef2f7; border: 1px solid var(--line); border-radius: 4px;
  font-size: 12px;
}

/* 右侧配置 */
.config-tabs { display: flex; background: #e5e7eb; padding: 4px 4px 0; flex-shrink: 0; }
.config-tab {
  flex: 1; padding: 8px 0; border: none; background: #e5e7eb;
  font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 4px 4px 0 0;
}
.config-tab.active { background: var(--surface); color: var(--primary); font-weight: 600; }

.config-body { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }

.block { background: #f9fafb; border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px; }
.block-warn { background: #fffbeb; border-color: #fde68a; }
.block-monitor { background: #f0fdf4; border-color: #bbf7d0; }
.block-thank { display: flex; flex-direction: column; gap: 8px; }
.monitor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.field-label {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
  line-height: 1.4;
}
.input-narrow {
  width: 72px !important;
  flex: 0 0 72px;
  padding: 6px 8px;
}
.btn-monitor {
  flex: 1;
  background: #059669;
  color: #fff;
  border-color: #059669;
  white-space: nowrap;
  min-height: 34px;
}
.btn-monitor.running { background: #dc2626; border-color: #dc2626; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.check-row label {
  display: block;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  color: #374151;
  cursor: pointer;
}
.block-thank textarea {
  width: 100%;
  min-height: 88px;
  line-height: 1.5;
  resize: vertical;
}
.monitor-status {
  margin-top: 8px; padding: 8px 10px; border-radius: 4px;
  font-size: 11px; line-height: 1.5; background: #f3f4f6; color: var(--muted);
}
.monitor-status.running { background: #ecfdf5; color: #047857; }
.monitor-status.error { background: #fef2f2; color: #b91c1c; }
.block-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.hint { font-size: 11px; color: var(--muted); margin: 4px 0 0; }
.mt { margin-top: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inline-row { display: flex; gap: 6px; align-items: center; }
.inline-row select, .inline-row input { flex: 1; }

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #4b5563;
}
.proxy-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.proxy-test-result {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  word-break: break-all;
}
.proxy-test-result.ok { color: #047857; }
.proxy-test-result.fail { color: #b91c1c; }
.proxy-test-result.testing { color: #2563eb; }
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 10px;
}

textarea, input, select {
  width: 100%; border: 1px solid var(--line); border-radius: 4px;
  padding: 7px 9px; font-size: 13px; font-family: inherit; background: #fff;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }

.btn-row { display: flex; gap: 6px; }
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 4px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #f3f4f6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px; font-weight: 600; flex: 1; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-stop { padding: 10px 14px; background: #f3f4f6; }

.tabs .tab { border-radius: 999px; font-size: 12px; padding: 5px 12px; }
.tabs .tab.active { background: #eff6ff; color: var(--primary); }

.action-bar { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); flex-shrink: 0; }

.modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-box { width: 500px; max-width: 92vw; background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 8px 30px rgba(0,0,0,0.15); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 15px; }
.btn-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#pasteText { font-family: Consolas, monospace; font-size: 12px; margin: 8px 0; }

.toast-host { position: fixed; bottom: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 6px; }
.toast { padding: 10px 16px; border-radius: 6px; font-size: 13px; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast-error { background: #b91c1c; }
.toast-success { background: #047857; }
.toast-info { background: #1d4ed8; }

@media (max-width: 860px) {
  html, body { overflow: auto; }
  .app { height: auto; min-height: 100vh; overflow: auto; }
  .main { flex-direction: column; overflow: visible; }
  .pane-right { width: 100%; border-left: none; border-top: 1px solid var(--line); min-height: 360px; }
  .section-log { height: 160px; }
}
