/* =========================================================
   VerifiedPro 中转控制台 —— 极简浅色主题
   主色 #0f766e / 系统字体 / 无外部资源
   ========================================================= */

:root {
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e7f4f1;
  --primary-line: #bcdcd6;

  --bg: #f5f6f7;
  --surface: #ffffff;

  --border: #e5e7eb;
  --border-strong: #d7dade;

  --text: #111827;
  --text-soft: #4b5563;
  --muted: #6b7280;

  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #f0c2c2;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, p, dl, dd { margin: 0; }
button { font-family: inherit; }

.muted { color: var(--muted); font-size: 12px; }
.text-danger { color: var(--danger); }
.noscript { padding: 24px; text-align: center; }

/* ---------------- 通用控件 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select { cursor: pointer; }

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: #f8f9fa; }
.btn:active { background: #f1f2f4; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-primary:active { background: #094e4a; border-color: #094e4a; }

.btn-block { width: 100%; padding: 10px 14px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.btn-ghost {
  color: var(--text-soft);
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: #f1f2f4; }

.btn-primary-ghost {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary-line);
}
.btn-primary-ghost:hover { background: #d9ece8; }

.btn-danger-ghost {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}
.btn-danger-ghost:hover { background: #fbe4e4; }

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { background: #f1f2f4; color: var(--text); }

/* ---------------- 错误提示条 ---------------- */

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 12px 10px 14px;
  color: #7f1d1d;
  background: #fff;
  border: 1px solid var(--danger-line);
  border-left: 3px solid var(--danger);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  animation: toast-in 0.16s ease-out;
}

.toast-text { font-size: 13px; word-break: break-word; }

.toast-close {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: #9a6c6c;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.toast-close:hover { background: #fbeeee; color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- 登录页 ---------------- */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #fbfcfc 0%, #f1f3f3 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px 26px;
}

.login-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-align: center;
}

.login-sub {
  margin: 6px 0 24px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.form-error {
  margin-bottom: 14px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: 8px;
}

/* ---------------- 顶部栏 / 标签页 ---------------- */

.app-view { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.topbar-left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--primary);
}

.brand-sub { font-size: 13px; color: var(--text-soft); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.current-user {
  font-size: 13px;
  color: var(--text-soft);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  flex: none;
  padding: 11px 14px;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

/* ---------------- 概览 ---------------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric { padding: 18px 20px; }

.metric-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.metric-value {
  margin: 6px 0 4px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-value.is-danger { color: var(--danger); }

.metric-foot { font-size: 12px; color: var(--muted); }

.status-card { padding-bottom: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.75;
  white-space: nowrap;
  border-radius: 999px;
}

.badge-green { color: #0b6b3a; background: #e7f6ec; }
.badge-amber { color: #92600a; background: #fdf4e3; }
.badge-blue { color: #1d4ed8; background: #e9effc; }
.badge-gray { color: #4b5563; background: #f1f2f4; }
.badge-red { color: #a41c1c; background: #fdeaea; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.dot-green { background: #16a34a; }
.dot-amber { background: #d97706; }
.dot-red { background: #dc2626; }
.dot-gray { background: #9ca3af; }

.wadex-error {
  margin: 14px 20px 0;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: 8px;
  word-break: break-word;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 24px;
  padding: 14px 20px 18px;
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f2f4;
}

.meta-item dt {
  flex: none;
  min-width: 60px;
  font-size: 12px;
  color: var(--muted);
}
.meta-item dd { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: #fcfcfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfb; }
.table-compact td { padding: 9px 14px; }
.table-compact th { padding: 8px 14px; }

/* 窄屏时表格横向滚动，而不是把文字挤成竖排 */
.table-accounts { min-width: 620px; }
.table-jobs { min-width: 860px; }
.table-compact { min-width: 600px; }

.col-actions { text-align: right; white-space: nowrap; }

.cell-strong { font-weight: 500; white-space: nowrap; }
.cell-mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: nowrap;
}
.cell-muted { color: var(--muted); font-size: 12.5px; }
.cell-error {
  margin-top: 3px;
  font-size: 12px;
  color: var(--danger);
  white-space: normal;
  word-break: break-word;
  max-width: 320px;
}

.empty-cell {
  padding: 36px 16px !important;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.progress-failed {
  margin-left: 8px;
  color: var(--danger);
  font-size: 12px;
}

/* ---------------- 会话 ---------------- */

.inbox-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.inline-field { display: block; }
.inline-field-grow { flex: 1; min-width: 0; }
.inline-field .field-label { margin-bottom: 5px; }
.inline-field select,
.inline-field input { min-width: 150px; }

.inbox-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 232px);
  min-height: 420px;
}

.conv-panel,
.msg-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.panel-head .card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-list { flex: 1; overflow-y: auto; }

.conv {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #f1f2f4;
  cursor: pointer;
  transition: background 0.12s ease;
}

.conv:hover { background: #fafbfb; }

.conv.is-active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.conv-name {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-time { flex: none; font-size: 11px; color: var(--muted); }

.conv-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 2px;
}

.conv-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-count {
  flex: none;
  min-width: 18px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: var(--muted);
  background: #f1f2f4;
  border-radius: 999px;
}

.msg-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: #fbfcfc;
}

.msg { display: flex; }
.msg-run { margin-top: -6px; }
.msg-out { justify-content: flex-end; }

.bubble {
  max-width: min(74%, 560px);
  padding: 8px 12px 6px;
  background: #f1f3f4;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.msg-out .bubble {
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 12px;
}

.msg-name {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.bubble-text {
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-time {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.msg-out .bubble-time { color: rgba(255, 255, 255, 0.75); }

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-state p { margin: 0; }

/* ---------------- 任务 ---------------- */

.jobs-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.jobs-toolbar .muted { margin-left: auto; }

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ---------------- 扫码弹窗 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.38);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  animation: pop-in 0.16s ease-out;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-body { padding: 18px 20px 20px; }

.qr-hint {
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  min-height: 20px;
}

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 248px;
  height: 248px;
  margin: 14px auto;
  background: #fbfcfc;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
}

.qr-img {
  width: 232px;
  height: 232px;
  background: #fff;
  border-radius: 6px;
  image-rendering: pixelated;
}

.qr-box.is-error::after {
  content: "二维码加载失败，正在重试…";
  padding: 0 20px;
  font-size: 12.5px;
  color: var(--danger);
  text-align: center;
}

.qr-box.is-error .qr-img { display: none; }

.qr-note {
  margin-top: 6px;
  text-align: center;
  line-height: 1.6;
}

/* ---------------- 任务详情抽屉 ---------------- */

.drawer { position: fixed; inset: 0; z-index: 45; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
  animation: drawer-in 0.18s ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
}

.detail-section + .detail-section { margin-top: 22px; }

.detail-heading {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 24px;
}

.detail-meta .meta-item { padding: 7px 0; }

.hint-box {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-soft);
  background: #fbfcfc;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}

.detail-error {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: 8px;
}

.detail-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* ---------------- 窄屏 ---------------- */

@media (max-width: 960px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .main { padding: 16px 16px 40px; }

  .inbox-grid {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    gap: 12px;
  }

  .conv-panel { max-height: 320px; }
  .msg-panel { height: 68vh; min-height: 340px; }

  .inbox-toolbar { flex-direction: column; align-items: stretch; }
  .inline-field select,
  .inline-field input { min-width: 0; }

  .jobs-toolbar { flex-wrap: wrap; }
  .jobs-toolbar .muted { margin-left: 0; }

  .table th, .table td { padding-left: 12px; padding-right: 12px; }
  .drawer-panel { width: 100%; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 23px; }
  .login-card { padding: 26px 20px 22px; }
  .brand-sub { display: none; }
  .meta-item { flex-direction: column; align-items: flex-start; gap: 2px; }
  .detail-meta .meta-item dd { text-align: left; }
}

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

/* 首条消息卡片设置 */
.field textarea {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
}
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 107, 79, 0.12);
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-checkbox input { width: 16px; height: 16px; }
