:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6eb; --text: #1f2329; --muted: #6b7280; --brand: #2f5bea;
  --ok: #1a7f37; --ok-bg: #e6f4ea; --bad: #c62828; --bad-bg: #fdecea; --warn: #9a6700; --warn-bg: #fff4d6;
  --busy: #4b5563; --busy-bg: #eef1f5; --done: #1d4ed8; --done-bg: #e7efff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--brand); }
button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: #fff; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.layout { display: flex; min-height: 100vh; }
.nav { width: 176px; background: #111827; color: #cbd5e1; padding: 16px 0; flex-shrink: 0; }
.nav h1 { font-size: 16px; color: #fff; margin: 0 16px 16px; }
.nav h1 small { display: block; font-size: 11px; color: #94a3b8; font-weight: normal; }
.nav a { display: block; padding: 8px 16px; color: #cbd5e1; text-decoration: none; }
.nav a.active, .nav a:hover { background: #1f2937; color: #fff; }
.nav .me { margin: 16px; font-size: 12px; color: #94a3b8; }
.main { flex: 1; padding: 16px 20px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.panel h2 { font-size: 15px; margin: 0 0 10px; }
.panel h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kpi b { display: block; font-size: 20px; }
.kpi span { color: var(--muted); font-size: 12px; }
table.t { border-collapse: collapse; width: 100%; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
table.t th { color: var(--muted); font-weight: normal; font-size: 12px; }
.pill { display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.pbadge { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 10px; font-size: 12px; line-height: 19px; white-space: nowrap; font-weight: 500; }
.pbadge.p-openai { background: #e7f6ec; color: #1a7f45; }
.pbadge.p-openai-plain { background: #f1f5f9; color: #475569; }
.pbadge.p-agy { background: #e8eefc; color: #2f5bea; }
.pbadge.p-claude { background: #f3ead9; color: #a5650a; }

/* 导入渠道类型选择卡片 */
.prov-cards { display: flex; gap: 12px; margin: 4px 0 12px; }
.prov-card { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px; border: 2px solid #e3e6ea; border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .12s, box-shadow .12s, background .12s; }
.prov-card:hover { border-color: #c3c9d0; }
.prov-card.sel { border-color: var(--pc, #2563eb); background: #fafcff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, #2563eb) 18%, transparent); }
.prov-card .prov-logo { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.prov-card .prov-logo svg { width: 40px; height: 40px; }
.prov-card .prov-name { font-weight: 700; font-size: 16px; color: #1f2430; }
.prov-card .prov-sub { font-size: 12px; color: #6b7280; }
.prov-card .prov-tick { position: absolute; top: 8px; right: 10px; color: var(--pc, #2563eb); opacity: 0; font-size: 16px; transition: opacity .12s; }
.prov-card.sel .prov-tick { opacity: 1; }
.s-ok, .s-warn.ok { background: var(--ok-bg); color: var(--ok); }
.s-bad { background: var(--bad-bg); color: var(--bad); }
.s-warn { background: var(--warn-bg); color: var(--warn); }
.s-busy { background: var(--busy-bg); color: var(--busy); }
.s-done { background: var(--done-bg); color: var(--done); }
.bar { height: 10px; background: #eef1f5; border-radius: 5px; position: relative; overflow: hidden; margin: 4px 0; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); }
.bar .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--bad); }
.bar .mark.high { background: var(--ok); }
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 10px; padding: 8px 10px; }
.err { color: var(--bad); }
.toast { position: fixed; right: 20px; bottom: 20px; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px;
  max-width: 480px; z-index: 1000; white-space: pre-wrap; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 8vh; }
.modal { background: #fff; border-radius: 10px; padding: 16px 18px; width: min(760px, 94vw); max-height: 84vh; overflow: auto; }
.modal h2 { margin-top: 0; font-size: 16px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 96vw); background: #fff; z-index: 950;
  box-shadow: -4px 0 20px rgba(0,0,0,.15); padding: 16px; overflow: auto; }
.legend span { margin-right: 8px; }
.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 10px; align-items: center; }
.form-grid input[type=text], .form-grid input[type=password], .form-grid input[type=number], .form-grid select { width: 100%; }
code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.sheet-wrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: auto; }
.jss_container td.c-ok { background: var(--ok-bg) !important; color: var(--ok); }
.jss_container td.c-bad { background: var(--bad-bg) !important; color: var(--bad); font-weight: 600; }
.jss_container td.c-warn { background: var(--warn-bg) !important; color: var(--warn); }
.jss_container td.c-busy { background: var(--busy-bg) !important; color: var(--busy); }
.jss_container td.c-done { background: var(--done-bg) !important; color: var(--done); }
.jss_container td.c-alert { box-shadow: inset 3px 0 0 var(--bad); }
.jss_container tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jss_container td.c-reason { color: var(--bad) !important; }
.jss_container td .act { padding: 0 6px; font-size: 12px; margin-right: 3px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 6px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.chart { height: 240px; }
.selbar { margin-top: 8px; padding: 4px 6px; border-radius: 6px; min-height: 30px; }
.selbar.on { background: var(--done-bg); }
.jss_contextmenu { z-index: 2000 !important; }
/* 只读列（状态等）控件默认把文字刷成浅灰，状态色要压过它 */
.jss_container td.readonly.c-ok { color: var(--ok) !important; }
.jss_container td.readonly.c-bad { color: var(--bad) !important; }
.jss_container td.readonly.c-warn { color: var(--warn) !important; }
.jss_container td.readonly.c-busy { color: var(--busy) !important; }
.jss_container td.readonly.c-done { color: var(--done) !important; }
/* 单元格一律单行：控件对超过 200 字符 / 带换行的内容会加内联 white-space:pre-wrap 把行撑高，这里压掉 */
.jss_container tbody td { white-space: nowrap !important; height: 27px; max-height: 27px; line-height: 18px; }
/* 编辑栏（类似 Excel 公式栏） */
.fxbar { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto auto; gap: 2px 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
.fx-ref { font-size: 12px; color: var(--muted); padding-top: 4px; min-width: 0; }
.fx-refname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-warn { margin-top: 6px; line-height: 1.5; }
.fx-text { width: 100%; resize: vertical; min-height: 44px; max-height: 40vh; font-size: 12px; line-height: 1.5; }
.fx-text.ro { background: #fafbfc; }
.fx-hint { grid-column: 2; height: 22px; line-height: 22px; white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; }
.fx-btn { padding: 0 8px; font-size: 12px; line-height: 18px; } /* 固定高度：选中格时编辑栏不能变高，否则表格下移、按住的鼠标被当成拖选 */
/* ✓ 列：勾选框放大，方便点 */
.jss_container td input[type=checkbox], .jss_container thead td input.hdr-sel { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; margin: 0; }
.slot-picks { display: flex; flex-direction: column; gap: 3px; max-height: 200px; overflow: auto; }
/* 2026-11-11：号商密码小眼睛、列设置 */
button.icon-btn { padding: 0 6px; border: none; background: transparent; cursor: pointer; font-size: 13px; color: #5b6472; }
button.icon-btn:hover { color: #1f2937; }
.cols-list td { padding: 3px 6px; }
.cols-list button { padding: 1px 7px; }
/* 2026-11-14：上传 OAuth JSON 预览 */
.scan-wrap { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.scan-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.scan-table th { position: sticky; top: 0; background: #f7f8fa; text-align: left; font-weight: 600;
  padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.scan-table td { padding: 4px 8px; border-bottom: 1px solid #f0f1f3; vertical-align: top; white-space: nowrap; }
.scan-table td.emailcell { border-right: 1px solid #f0f1f3; }
.scan-table td.src { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.scan-table tr.badrow td { background: #fff7f7; }
.scan-table tr.mismatch td { opacity: .45; }

.seg { display: inline-flex; border: 1px solid #d0d5dd; border-radius: 8px; overflow: hidden; margin: 0 0 8px; }
.seg button { border: 0; border-radius: 0; background: #fff; padding: 6px 14px; }
.seg button.on { background: #2563eb; color: #fff; }
.pair-list { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.pair-row { display: flex; align-items: center; gap: 8px; }
.pair-row .grow { flex: 1; min-width: 0; }

/* 2026-11-28 状态条 / 导入结果 / 空状态 / 额度 */
.statbar { gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.statbar .stat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid #d0d5dd; color: #344054; text-decoration: none; background: #fff; }
.statbar .stat b { font-weight: 700; }
.statbar .stat:hover { border-color: #98a2b3; }
.statbar .stat.on { outline: 2px solid #2563eb; outline-offset: 0; }
.result-card { margin-top: 8px; padding: 6px 10px; border: 1px solid #c7d7fe; background: #f5f8ff; border-radius: 8px; font-size: 13px; }
.result-card .row { gap: 12px; flex-wrap: wrap; }
.result-errs { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; color: #7a271a; }
.empty-card ol { margin: 6px 0 12px; padding-left: 20px; line-height: 1.8; }
.qwin { display: inline-block; margin: 1px 6px 1px 0; padding: 0 6px; border-radius: 4px; background: #f2f4f7; white-space: nowrap; }
.qwin.bad { background: #fef0c7; color: #93370d; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; padding: 2px 6px; }
button.ghost:hover { background: #f2f4f7; }
.radio-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border: 1px solid #d0d5dd; border-radius: 999px; cursor: pointer; }
.radio-pill.on { border-color: var(--pc, #2563eb); color: var(--pc, #2563eb); font-weight: 600; }
.radio-pill input { margin: 0; }
/* 疑似超售角标：状态格右上角（悬停看 title） */
.jss_worksheet td.q-badge, td.q-badge { position: relative; }
td.q-badge::after { content: '超'; position: absolute; top: 1px; right: 1px; font-size: 9px; line-height: 12px; padding: 0 3px;
  border-radius: 3px; background: #f79009; color: #fff; font-weight: 700; pointer-events: none; }
.qb { font-style: normal; font-size: 9px; padding: 0 3px; border-radius: 3px; background: #f79009; color: #fff; font-weight: 700; }
.region-row { gap: 8px; margin: 2px 0 8px; align-items: center; }
.region-row .muted { flex: 1; min-width: 200px; }
.jss_container td.c-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; }
