/* 实时监控大盘 + supplier-spend 共享样式 — 编辑型 MaaS 调（暖纸 + 暖墨 + 琥珀） */

:root {
  --paper:     #FAFAF6;
  --paper-2:   #F4F0E6;
  --paper-3:   #EDE7D6;
  --ink:       #1A1714;
  --ink-2:     #44403A;
  --ink-3:     #7A736A;
  --ink-4:     #A39A8C;     /* very muted on paper */
  --hairline:  #E6E0D2;
  --accent:    #B85C00;
  --accent-2:  #8E4500;
  --accent-soft:#F5E6D2;
  --ok:        #2EA34F;
  --bad:       #DD3A1F;
  --warn:      #B85C00;     /* alias of accent for status semantics */

  --font-display: 'Fraunces', 'Songti SC', 'STSong', Georgia, serif;
  --font-body:    'Geist', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono:    'Geist Mono', 'SF Mono', 'JetBrains Mono', Menlo, Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-feature-settings: "ss01", "ss02";
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Login overlay === */
#login-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 23, 20, 0.78);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
#login-overlay.hidden { display: none; }
#login-form {
  background: #fff; padding: 36px 40px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  width: 380px; max-width: 90vw;
  box-shadow: 0 24px 60px rgba(26,23,20,0.18);
}
#login-form h2 {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.018em;
}
#login-form label {
  display: block; margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
#login-form input, #login-form select {
  width: 100%; padding: 9px 0;
  margin-top: 6px;
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
#login-form input:hover, #login-form select:hover { border-bottom-color: var(--ink-3); }
#login-form input:focus, #login-form select:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}
#login-form button {
  width: 100%; padding: 13px; margin-top: 14px;
  background: var(--ink); color: #FAFAF6;
  border: 0; border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer;
  transition: background .18s;
}
#login-form button:hover { background: var(--accent); }
.login-error {
  display: none;
  padding: 10px 0 10px 14px;
  border-left: 2px solid var(--bad);
  background: transparent;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--bad);
  margin-bottom: 14px;
}

/* === 规则编辑弹窗 === */
.rule-edit-dialog {
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 60px rgba(26,23,20,0.18);
  width: 480px; max-width: 92vw;
}
.rule-edit-dialog::backdrop {
  background: rgba(26, 23, 20, 0.78);
  backdrop-filter: blur(2px);
}
#rule-edit-form { padding: 32px 36px 28px; }
#rule-edit-form h2 {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.018em;
}
#rule-edit-form label {
  display: block; margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
#rule-edit-form input,
#rule-edit-form select,
#rule-edit-form textarea {
  width: 100%; padding: 8px 0; margin-top: 6px;
  border: none; border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
}
#rule-edit-form textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 0;
}
#rule-edit-form input:disabled {
  color: var(--ink-3);
  font-family: var(--font-mono);
}
#rule-edit-form input:focus,
#rule-edit-form select:focus,
#rule-edit-form textarea:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}
.edit-error {
  display: none;
  padding: 8px 0 8px 12px;
  border-left: 2px solid var(--bad);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  color: var(--bad);
  margin: 6px 0 12px;
}
.edit-error.show { display: block; }
.edit-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px;
}
#rule-edit-form #edit-save-btn {
  padding: 10px 22px;
  background: var(--ink); color: #FAFAF6;
  border: 0; border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer; width: auto;
  transition: background .18s;
}
#rule-edit-form #edit-save-btn:hover { background: var(--accent); }
.edit-actions .btn-ghost { padding: 9px 18px; }

/* === Topbar === */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 100;
}
.brand {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.012em;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand::before {
  content: '◆';
  color: var(--accent);
  font-size: 11px;
  margin-right: 0;
}
.brand em { font-style: italic; color: var(--accent); font-weight: 400; }
.filters { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type="date"] {
  padding: 7px 12px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .18s;
}
.filters select:hover, .filters input[type="date"]:hover { border-color: var(--ink-3); }
.filters select:focus, .filters input[type="date"]:focus { border-color: var(--accent); outline: none; }

.user-area {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.user-info { color: var(--ink-2); }
.user-info b { color: var(--ink); font-family: var(--font-body); font-weight: 500; letter-spacing: -0.005em; }

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
.btn-ghost:hover { border-color: var(--ink-2); color: var(--ink); background: var(--paper); }

/* === Tabs === */
.tabs {
  display: flex; gap: 0; padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--hairline);
}
.tab {
  padding: 14px 20px;
  border: 0; background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
  letter-spacing: -0.005em;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Container === */
.container { padding: 24px 28px; max-width: 1600px; margin: 0 auto; }

/* === Overview cards === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-top: 2px solid var(--ink);    /* editorial top band, replaces 4px left rail */
  border-radius: 4px;
  padding: 22px 24px;
  position: relative;
  transition: border-top-color .2s ease, transform .2s ease;
}
.card:hover { border-top-color: var(--accent); }
.card.danger  { border-top-color: var(--bad); }
.card.danger .card-value { color: var(--bad); }
.card.warn    { border-top-color: var(--accent); }
.card.success { border-top-color: var(--ok); }

.card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-weight: 500;
}
.card-value {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1;
  font-feature-settings: "ss01", "tnum";
}
.card-sub {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-top: 8px;
}
/* 卡片原价行：紧贴折后价下方，字号与字色弱化以保持视觉层级 */
.card-orig {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 13px;
  font-feature-settings: "tnum";
  letter-spacing: 0.02em;
  margin-top: 6px;
}
.card-orig .card-orig-label {
  color: var(--ink-4);
  margin-right: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
}

/* === Sections === */
.trend-section, .table-section, .errors-section {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 22px 26px;
  margin-bottom: 24px;
}
h3 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.012em;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
h3 small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  margin-left: 0;
}
.trend-chart { height: 360px; }

/* === Tables === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px;
  text-align: left;
  background: var(--paper-2);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
  color: var(--ink);
}
tbody tr:hover { background: var(--paper); }

/* === v2.1 模型为主视图 === */

/* 分组筛选 chips 区 */
.group-chips-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 8px 4px 14px;
  border-bottom: 1px dashed var(--hairline);
  margin-bottom: 8px;
}
.chips-label {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-right: 4px;
}
.chips-list { display: inline-flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.group-chip {
  display: inline-block; padding: 4px 12px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer; user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.group-chip:hover { border-color: var(--ink-2); color: var(--ink); background: var(--paper); }
.group-chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #FAFAF6;
  font-weight: 500;
}
.group-chip.on:hover { background: var(--accent); border-color: var(--accent); }
.btn-mini { padding: 4px 12px; font-size: 10px; }

/* 模型主行（一级，高亮） */
tbody tr.model-header {
  background: var(--paper-2);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  user-select: none;
}
tbody tr.model-header:hover { background: var(--paper-3); }
tbody tr.model-header td {
  padding: 9px 12px; font-size: 13px; color: var(--ink);
}
tbody tr.model-header b {
  color: var(--ink); font-size: 14px;
  font-family: var(--font-body); font-weight: 600;
  letter-spacing: -0.005em;
}
tbody tr.model-header .model-toggle {
  display: inline-block; width: 14px;
  color: var(--accent);
  margin-right: 4px;
  font-size: 11px;
}
tbody tr.model-header.collapsed { background: var(--paper); }

/* 置顶模型：琥珀渐变 */
tbody tr.model-header.pinned {
  background: linear-gradient(to right, var(--accent-soft) 0%, var(--paper-2) 70%);
  border-left: 2px solid var(--accent);
}
tbody tr.model-header.pinned:hover {
  background: linear-gradient(to right, #F0D8B0 0%, var(--paper-3) 70%);
}

/* 置顶按钮 */
.pin-btn {
  background: transparent; border: 0;
  font-size: 13px; cursor: pointer;
  margin: 0 4px; padding: 1px 4px;
  border-radius: 2px;
  opacity: 0.4; transition: opacity .15s, background .15s;
}
.pin-btn:hover { opacity: 1; background: rgba(26,23,20,0.06); }
.pin-btn.on { opacity: 1; }
.pin-btn.on:hover { background: rgba(184,92,0,0.14); }

/* 通道行 */
tbody tr.channel-row { font-size: 12.5px; color: var(--ink-2); }
tbody tr.channel-row .channel-arrow {
  display: inline-block;
  color: var(--ink-4);
  margin-right: 6px;
  font-family: var(--font-mono);
}
/* 不可用通道：通道名标红 + 加粗 */
tbody tr.channel-row .channel-name-bad {
  color: var(--bad); font-weight: 600;
}

/* 列宽固定（v2.1 顺序：模型 / 分组 / 通道 / ...） */
#models-table { table-layout: fixed; width: 100%; }
#models-table th:nth-child(1),  #models-table td:nth-child(1)  { width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#models-table th:nth-child(2),  #models-table td:nth-child(2)  { width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#models-table th:nth-child(3),  #models-table td:nth-child(3)  { width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#models-table th:nth-child(4),  #models-table td:nth-child(4),
#models-table th:nth-child(5),  #models-table td:nth-child(5)  { width: 70px; }
#models-table th:nth-child(6),  #models-table td:nth-child(6),
#models-table th:nth-child(7),  #models-table td:nth-child(7)  { width: 90px; }
#models-table th:nth-child(8),  #models-table td:nth-child(8),
#models-table th:nth-child(9),  #models-table td:nth-child(9)  { width: 70px; }
#models-table th:nth-child(10), #models-table td:nth-child(10),
#models-table th:nth-child(11), #models-table td:nth-child(11),
#models-table th:nth-child(12), #models-table td:nth-child(12) { width: 90px; }
#models-table th:nth-child(13), #models-table td:nth-child(13) { width: 80px; }
#models-table th:nth-child(14), #models-table td:nth-child(14) { width: 110px; }

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.bad   { color: var(--bad); font-weight: 500; }
.good  { color: var(--ok); }
.muted { color: var(--ink-3); }

/* === Tags（warm earth 取代 candy Tailwind） === */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.tag-perfect    { background: rgba(46,163,79,0.10);   color: var(--ok);     border-color: rgba(46,163,79,0.22); }
.tag-available  { background: rgba(68,64,58,0.06);    color: var(--ink-2);  border-color: var(--hairline); }
.tag-partial    { background: rgba(184,92,0,0.10);    color: var(--accent); border-color: rgba(184,92,0,0.22); }
.tag-unavailable{ background: rgba(221,58,31,0.10);   color: var(--bad);    border-color: rgba(221,58,31,0.22); }
.tag-untested   { background: var(--paper-2);         color: var(--ink-3);  border-color: var(--hairline); }
.tag-cold       { background: var(--paper-2);         color: var(--ink-4);  border-color: var(--hairline); }
.tag-new        { background: rgba(46,163,79,0.10);   color: var(--ok);     border-color: rgba(46,163,79,0.30); font-weight: 600; }
.tag-remark {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--hairline);
  font-family: var(--font-body);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  max-width: 280px;
  white-space: normal;
  word-break: break-all;
  line-height: 1.3;
}
.ch-remark-wrap { margin-top: 4px; line-height: 1; }

/* === 通道单元格 3 行布局（与 v2-models 等页面对齐） === */
.ch-line1 { line-height: 1.4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ch-line-name { line-height: 1.4; color: var(--ink-2); word-break: break-all; margin-top: 2px; }
.ch-id { color: var(--ink); font-family: var(--font-mono); font-weight: 500; font-feature-settings: "tnum"; }
.ch-line2 { margin-top: 4px; line-height: 1; }
.ch-remark-inline { vertical-align: middle; }
body.hide-channel-remark .ch-remark-wrap,
body.hide-channel-remark .ch-remark-inline { display: none; }

/* === 容量配置 - 新增表单 === */
.cap-add-form {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: flex-start;
  padding: 12px 16px; margin-bottom: 12px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
}
.cap-add-form label {
  display: inline-flex; gap: 4px; align-items: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.cap-add-form input, .cap-add-form select {
  padding: 5px 9px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  font-size: 13px;
  font-family: var(--font-body);
  background: white;
  color: var(--ink);
}
.cap-add-form .btn-ghost { padding: 6px 14px; align-self: center; }

/* tag input 容器（容量配置模型多选） */
.cap-add-form .taginput {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--hairline); border-radius: 2px; background: white;
  vertical-align: middle;
  max-width: 480px; max-height: 64px; overflow-y: auto;
}
.cap-add-form .taginput input {
  border: 0; outline: 0; padding: 3px 4px; font-size: 13px;
  flex: 1; min-width: 100px; background: transparent;
  font-family: var(--font-body);
}
.cap-add-form .taginput .tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 8px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.cap-add-form .taginput .tag-chip button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--accent); font-size: 14px; line-height: 1; padding: 0 4px;
  border-radius: 2px;
}
.cap-add-form .taginput .tag-chip button:hover {
  background: rgba(184,92,0,0.20); color: var(--ink);
}
.cap-add-form .taginput:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184,92,0,0.10);
}

/* === 顶部卡片可点击 + 当前筛选 badge === */
.card-clickable { cursor: pointer; transition: border-top-color .18s, transform .15s; }
.card-clickable:hover { transform: translateY(-1px); }
.card-clickable:active { transform: translateY(0); }
.card.card-active {
  border-top-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 1px 3px rgba(184,92,0,0.10);
}

.card-filter-active {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid rgba(184,92,0,0.22);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
}
.card-filter-active b { color: var(--ink); font-family: var(--font-body); font-weight: 500; letter-spacing: -0.005em; text-transform: none; }
.card-filter-active button {
  background: transparent; border: 0; cursor: pointer;
  color: var(--accent); font-size: 14px; line-height: 1;
  padding: 0 4px; border-radius: 2px;
}
.card-filter-active button:hover { background: rgba(184,92,0,0.20); color: var(--ink); }
.card-filter-active.hidden { display: none; }

.error-content {
  font-family: var(--font-mono); font-size: 12px;
  max-width: 600px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: help;
}

/* 错误标记 · 操作列（备注输入 + 标注按钮） */
.tag-actions-cell { min-width: 200px; }
.tag-note-input {
  width: 100%; box-sizing: border-box;
  padding: 4px 8px; margin-bottom: 6px;
  border: 1px solid var(--hairline); border-radius: 2px;
  font-size: 12px; font-family: var(--font-body);
  color: var(--ink); background: transparent;
  outline: none;
  transition: border-color .18s;
}
.tag-note-input:focus { border-color: var(--accent); }
.tag-note-input.invalid { border-color: var(--bad); }
.tag-note-input::placeholder { color: var(--ink-4); }
.tag-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* 错误标记 · 推荐 chip：根据字典正则命中给出的备注建议，点击一键填入 input */
.tag-rec-chip {
  display: inline-block; max-width: 100%; box-sizing: border-box;
  margin-bottom: 4px; padding: 2px 8px;
  border: 1px solid var(--bad); border-radius: 2px;
  font-size: 11px; line-height: 1.4;
  color: var(--bad); background: transparent;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tag-rec-chip:hover { background: var(--bad); color: #fff; }

/* 推荐的标注按钮：红色边框 + 红字，文字前用 ::before 注入"推荐 "，保留原按钮的对齐 */
.btn-ghost.tag-rec-btn { border-color: var(--bad); color: var(--bad); }
.btn-ghost.tag-rec-btn:hover { border-color: var(--bad); background: var(--bad); color: #fff; }
.btn-ghost.tag-rec-btn::before {
  content: "推荐 ";
  letter-spacing: 0;
  font-weight: 600;
}

/* 错误规则字典 · 正则/说明列截断（悬停看 title 完整内容） */
#rules-table .error-content {
  display: inline-block; vertical-align: middle;
  max-width: 360px;
}
#rules-table td:nth-child(4) {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === 错误聚合表 · 样本错误信息列 === */
#errors-table { table-layout: auto; }
#errors-table th:nth-child(5),
#errors-table td:nth-child(5) {
  width: 260px;
  max-width: 260px;
}
td.err-sample {
  cursor: copy;
  user-select: text;
}
td.err-sample .err-sample-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
}
td.err-sample:hover .err-sample-text { color: var(--accent-2); }
/* 全局浮层（fixed 定位，不被 .table-wrap overflow 裁切） */
#err-sample-pop {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 560px;
  min-width: 280px;
  padding: 10px 12px;
  background: var(--ink);
  color: #FAFAF6;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid rgba(184,92,0,0.35);
  border-radius: 2px;
  box-shadow: 0 12px 28px rgba(26,23,20,0.30);
}
#err-sample-pop .err-pop-hint {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.10);
  color: rgba(250,250,246,0.55);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* 错误聚合表的 关联模型 / 关联通道 列：Top 3 列表 */
.err-dist-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: 12px; line-height: 1.5;
  padding: 1px 0;
}
.err-dist-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink);
}
.err-dist-pct {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono); font-size: 11px;
  white-space: nowrap;
}
.err-dist-more { font-size: 11px; padding: 1px 0; cursor: help; }
#errors-table td:nth-child(6),
#errors-table td:nth-child(7) { min-width: 220px; max-width: 280px; vertical-align: top; }

/* === 通用 taginput + 树形 dropdown（supplier-spend 通道多选等用） === */
.ss-ms-wrap { position: relative; display: inline-block; vertical-align: middle; }
.taginput.ss-ms-input {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: white;
  vertical-align: middle;
  max-width: 380px;
  max-height: 64px;
  overflow-y: auto;
  font-family: var(--font-body);
  transition: border-color .18s, box-shadow .18s;
}
.taginput.ss-ms-input input {
  border: 0; outline: 0; padding: 3px 4px; font-size: 13px;
  flex: 1; min-width: 100px; background: transparent;
  color: var(--ink);
}
.taginput.ss-ms-input input::placeholder { color: var(--ink-3); opacity: 0.6; }
.taginput.ss-ms-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184,92,0,0.10);
}
.taginput.ss-ms-input .tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 8px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.taginput.ss-ms-input .tag-chip button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--accent); font-size: 14px; line-height: 1;
  padding: 0 4px; border-radius: 2px;
}
.taginput.ss-ms-input .tag-chip button:hover { background: rgba(184,92,0,0.20); color: var(--ink); }

.td-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 1500;
  min-width: 320px; max-width: 480px; max-height: 360px; overflow-y: auto;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(26,23,20,0.12);
  padding: 4px 0;
  font-family: var(--font-body);
}
.td-dropdown.hidden { display: none; }
.td-fam {
  padding: 7px 12px; font-size: 13px; color: var(--ink);
  background: var(--paper-2); border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-body); font-weight: 500;
}
.td-fam-other { color: var(--ink-3); }
.td-count {
  color: var(--ink-3); font-weight: 400; margin-left: 4px;
  font-family: var(--font-mono); font-size: 11px;
}
.td-fam-select {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 6px; margin: -2px 0; border-radius: 2px;
  cursor: pointer;
}
.td-fam-select:hover { background: rgba(184,92,0,0.18); }
.td-fam-select-spacer { width: 14px; padding: 0; cursor: default; }
.td-fam-select-spacer:hover { background: transparent; }
.td-fam-label {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0; padding: 2px 4px; margin: -2px 0; border-radius: 2px;
  cursor: pointer; user-select: none;
}
.td-fam-label:hover { background: var(--accent-soft); }
.td-fam-arrow {
  display: inline-block; width: 12px; text-align: center;
  font-family: var(--font-mono); color: var(--ink-3);
}
.td-mod {
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 8px;
  word-break: break-all;
}
.td-mod:hover { background: var(--paper); color: var(--ink); }
.td-mod .td-cb { margin: 0; cursor: pointer; flex-shrink: 0; pointer-events: none; }
.td-mod .td-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
  flex-shrink: 0;
}
.td-empty {
  padding: 16px; text-align: center;
  color: var(--ink-3); font-size: 13px;
  font-family: var(--font-display); font-style: italic;
}
.td-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.td-foot a {
  color: var(--accent-2);
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.16em;
}
.td-foot a:hover { color: var(--accent); }

/* === supplier-spend 通道排行表的点击展开 === */
#channels-table .channel-row { cursor: pointer; }
#channels-table .channel-row:hover { background: var(--paper); }
#channels-table .ch-toggle {
  width: 24px; text-align: center;
  color: var(--ink-3);
  user-select: none;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* 表头对齐统一 */
#channels-table th:nth-child(2),
#channels-table td:nth-child(2),
#channels-table th:nth-child(4),
#channels-table th:nth-child(5),
#channels-table th:nth-child(6),
#channels-table th:nth-child(7),
#channels-table td:nth-child(4),
#channels-table td:nth-child(5),
#channels-table td:nth-child(6),
#channels-table td:nth-child(7) { text-align: center; }
#channels-table th:nth-child(8),
#channels-table th:nth-child(9) { text-align: right; }
#channels-table .ch-id {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-feature-settings: "tnum";
}

/* 子表 .cm-table 列：1=模型 | 2=调用数 | 3=错误数 | 4=prompt | 5=completion | 6=消费 | 7=占比 */
.cm-table th:nth-child(2),
.cm-table th:nth-child(3),
.cm-table th:nth-child(4),
.cm-table th:nth-child(5),
.cm-table td:nth-child(2),
.cm-table td:nth-child(3),
.cm-table td:nth-child(4),
.cm-table td:nth-child(5) { text-align: center; }
.cm-table th:nth-child(6),
.cm-table th:nth-child(7) { text-align: right; }
#channels-table .channel-models-row td.cm-body {
  padding: 14px 24px;
  background: var(--paper);
  border-top: 1px dashed var(--hairline);
}
.cm-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.008em;
  margin-bottom: 10px;
}
.cm-table { width: 100%; font-size: 12px; }
.cm-table thead th {
  background: #fff; padding: 7px 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-3);
  font-weight: 500;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cm-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
}
.cm-table tbody tr:hover { background: #fff; }

/* === supplier-spend 默认值配置弹窗 === */
#ss-config-panel.hidden { display: none; }
#ss-config-panel { position: fixed; inset: 0; z-index: 2000; }
#ss-config-panel .ssc-mask {
  position: absolute; inset: 0;
  background: rgba(26, 23, 20, 0.55);
  backdrop-filter: blur(2px);
}
#ss-config-panel .ssc-card {
  position: relative;
  margin: 100px auto 0;
  width: 440px; max-width: 92vw;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(26,23,20,0.20);
  overflow: hidden;
}
.ssc-head {
  display: flex; align-items: center;
  padding: 16px 22px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.ssc-head span { flex: 1; }
.ssc-close {
  background: transparent; border: 0;
  font-size: 22px; line-height: 1;
  color: var(--ink-3); cursor: pointer;
  padding: 0 4px;
  transition: color .15s;
}
.ssc-close:hover { color: var(--ink); }
.ssc-body { padding: 22px 24px; }
.ssc-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; font-size: 13px;
  color: var(--ink-2);
}
.ssc-row > span {
  width: 110px; flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ssc-row select {
  flex: 1; padding: 7px 11px; font-size: 13px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: white;
  color: var(--ink);
  font-family: var(--font-body);
}
.ssc-row select:focus { border-color: var(--accent); outline: none; }
.ssc-hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
}
.ssc-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px;
  background: var(--paper-2);
  border-top: 1px solid var(--hairline);
}
.ssc-foot .btn-primary {
  padding: 9px 18px;
  background: var(--ink); color: #FAFAF6;
  border: 0; border-radius: 2px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background .18s;
}
.ssc-foot .btn-primary:hover { background: var(--accent); }

/* === 通知配置编辑弹窗（含用户额度预警策略编辑） === */
#notif-editor-overlay.hidden, #qac-editor-overlay.hidden { display: none; }
#notif-editor-overlay, #qac-editor-overlay { position: fixed; inset: 0; z-index: 2050; }
#notif-editor-overlay .ssc-mask, #qac-editor-overlay .ssc-mask { position: absolute; inset: 0; background: rgba(26,23,20,0.55); backdrop-filter: blur(2px); }
#notif-editor-overlay .ssc-card, #qac-editor-overlay .ssc-card {
  position: relative;
  margin: 60px auto 0;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(26,23,20,0.20);
  overflow: hidden;
}
.ne-row { margin-bottom: 16px; }
.ne-row label { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 6px; }
.ne-row input[type="text"], .ne-row input[type="number"], .ne-row textarea, .ne-row select {
  width: 100%; padding: 8px 11px; font-size: 13px; font-family: var(--font-body);
  border: 1px solid var(--hairline); border-radius: 2px; background: white; color: var(--ink);
  margin-top: 2px; box-sizing: border-box;
}
.ne-row textarea { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; resize: vertical; }
.ne-row input:focus, .ne-row textarea:focus, .ne-row select:focus { outline: none; border-color: var(--accent); }
.ne-row-2col, .ne-row-3col { display: grid; gap: 14px; }
.ne-row-2col { grid-template-columns: 1fr 2fr; }
.ne-row-3col { grid-template-columns: 1fr 1fr 1fr; }
.ne-row-template { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.ne-section-title { font-family: var(--font-mono); font-size: 10px; color: var(--ink-2);
  letter-spacing: 0.22em; text-transform: uppercase; padding-top: 12px; margin-bottom: 12px;
  border-top: 1px solid var(--hairline); }
.ne-inline { text-transform: none !important; letter-spacing: 0 !important; font-family: var(--font-body) !important;
  font-size: 13px !important; color: var(--ink-2) !important; display: flex; align-items: center; gap: 12px; }
.ne-checks { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; }
.ne-checks label { font-family: var(--font-body) !important; font-size: 12px !important; color: var(--ink-2) !important;
  letter-spacing: 0 !important; text-transform: none !important; display: inline-flex; align-items: center; gap: 4px;
  margin: 0; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 2px; cursor: pointer;
  transition: background .15s, border-color .15s; }
.ne-checks label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.ne-checks input { margin: 0; }
.ne-vars { padding: 10px 12px; background: var(--paper-2); border: 1px solid var(--hairline); border-radius: 2px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.6; color: var(--ink-2); }
.ne-vars-title { font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 500; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--hairline); }
.ne-vars ul { list-style: none; padding: 0; margin: 0; }
.ne-vars li { padding: 1px 0; }
.ne-vars code { font-family: var(--font-mono); color: var(--accent-2); font-size: 10.5px; }
.ne-result { padding: 10px 14px; border-left: 2px solid var(--accent); background: var(--accent-soft);
  border-radius: 2px; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink); white-space: pre-wrap;
  word-break: break-all; line-height: 1.5; }
.ne-result.hidden { display: none; }
.ne-result.error { border-left-color: var(--bad); background: rgba(221,58,31,0.08); color: var(--bad); }

/* hint：跟在 input 下方的小字说明（不继承 label 的 mono 大写） */
.ne-row label .ne-hint {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  margin-top: 6px;
  line-height: 1.5;
}
.ne-row label .ne-hint code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* webhook secret 输入：带显示切换 / 生成 / 复制 三个 mono 小按钮 */
.ne-secret-wrap {
  display: flex; align-items: stretch; gap: 6px;
  margin-top: 2px;
}
.ne-secret-wrap input {
  flex: 1; margin-top: 0 !important;
  font-family: var(--font-mono) !important;
  font-size: 12.5px !important;
  letter-spacing: 0.02em;
}
.ne-secret-wrap .ne-secret-btn {
  flex-shrink: 0;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  background: white;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color .15s, color .15s, background .15s;
}
.ne-secret-wrap .ne-secret-btn:hover {
  border-color: var(--ink-2); color: var(--ink); background: var(--paper);
}
.ne-secret-wrap .ne-secret-btn:active { background: var(--paper-2); }

/* notifications 表格的渠道徽章 */
.notif-channel-tag { display: inline-block; padding: 2px 8px; border-radius: 2px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px solid var(--hairline); }
.notif-channel-tag.email   { background: rgba(46,163,79,0.10); color: var(--ok); border-color: rgba(46,163,79,0.30); }
.notif-channel-tag.webhook { background: rgba(184,92,0,0.10); color: var(--accent-2); border-color: rgba(184,92,0,0.30); }
.notif-channel-tag.ai      { background: rgba(61,106,138,0.10); color: #3D6A8A; border-color: rgba(61,106,138,0.30); }
.notif-channel-tag.cn      { background: rgba(139,77,140,0.10); color: #8B4D8C; border-color: rgba(139,77,140,0.30); }
.notif-filter-summary { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
