/* ============================================================
   newapi-claude-probe · 样式
   颜色一律走 CSS 变量，明暗两套主题只需换变量表。
   ============================================================ */

:root,
html[data-theme="dark"] {
  --bg:          #0a0d13;
  --bg-2:        #0f141d;
  --panel:       #131a25;
  --panel-2:     #18202d;
  --panel-3:     #1e2836;
  --line:        #232f40;
  --line-soft:   #1b2432;

  --fg:          #e6edf7;
  --fg-dim:      #9fb0c6;
  --fg-faint:    #6b7d94;

  --accent:      #d97757;   /* Claude clay */
  --accent-2:    #f0946f;
  --accent-dim:  #7c4433;
  --accent-soft: rgba(217,119,87,.14);
  --hl-bg:       rgba(217,119,87,.28);

  --ok:          #3fb950;
  --ok-dim:      #1c5228;
  --ok-fg:       #7ee08a;
  --ok-bg:       rgba(63,185,80,.13);
  --ok-label:    #cfe8d4;

  --bad:         #f2555a;
  --bad-dim:     #5c1f22;
  --bad-fg:      #ff8b8f;
  --bad-bg:      rgba(242,85,90,.14);
  --bad-label:   #f0cfd0;

  --warn:        #e3b341;
  --warn-bg:     rgba(227,179,65,.12);
  --ratio-fg:    #ecc158;
  --ratio-bg:    rgba(227,179,65,.17);
  --ratio-line:  rgba(227,179,65,.42);
  --info:        #58a6ff;

  --topbar-bg:   rgba(10,13,19,.82);
  --sunk:        #0c111a;          /* 输入框 / 药丸 / 进度槽底色 */
  --sunk-2:      #0e141e;          /* 输入框 focus */
  --sunk-3:      #0b1018;          /* chip 状态条 */
  --chip-grad:   #0f1621;
  --chip-hover:  #3d5a7a;
  --placeholder: #46566c;
  --hover-tint:  rgba(255,255,255,.016);
  --scroll-thumb: #26334699;
  --scroll-thumb-hover: #33465faa;
  --log-time:    #44556b;

  --btn-primary-bg:     linear-gradient(160deg, #2b3d57, #22314a);
  --btn-primary-border: #33496a;
  --btn-primary-fg:     #dbe8fb;
  --btn-danger-bg:      #2b1618;
  --btn-danger-border:  #56272b;
  --btn-danger-fg:      #ffb3b6;
  --btn-hover:          brightness(1.16);

  --tip-bg:   #060a10;
  --tip-line: #33465f;
  --tip-fg:   #cddaea;
  --tip-hr:   #1e293b;
  --backdrop: rgba(4,7,12,.74);

  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 70px rgba(0,0,0,.62);
  --glow-a:   rgba(217,119,87,.10);
  --glow-b:   rgba(88,166,255,.07);

  --radius:    14px;
  --radius-sm: 9px;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg:          #f4f6f9;
  --bg-2:        #ffffff;
  --panel:       #ffffff;
  --panel-2:     #f7f9fc;
  --panel-3:     #eaeef4;
  --line:        #d3dae4;
  --line-soft:   #e4e9f0;

  --fg:          #16202e;
  --fg-dim:      #4c5c72;
  --fg-faint:    #7d8ca1;

  --accent:      #c05f3c;
  --accent-2:    #b0522f;
  --accent-dim:  #e9bda9;
  --accent-soft: rgba(192,95,60,.11);
  --hl-bg:       rgba(217,119,87,.30);

  --ok:          #1a7f37;
  --ok-dim:      #9fd8ac;
  --ok-fg:       #10682b;
  --ok-bg:       rgba(26,127,55,.11);
  --ok-label:    #1c4a29;

  --bad:         #cf222e;
  --bad-dim:     #f0b3b7;
  --bad-fg:      #a40e26;
  --bad-bg:      rgba(207,34,46,.10);
  --bad-label:   #7d1a22;

  --warn:        #8a5d00;
  --warn-bg:     rgba(180,120,0,.13);
  --ratio-fg:    #855800;
  --ratio-bg:    rgba(224,168,32,.26);
  --ratio-line:  rgba(163,116,0,.42);
  --info:        #0969da;

  --topbar-bg:   rgba(244,246,249,.85);
  --sunk:        #ffffff;
  --sunk-2:      #ffffff;
  --sunk-3:      #f5f7fa;
  --chip-grad:   #f1f4f9;
  --chip-hover:  #9db4d0;
  --placeholder: #9aa8ba;
  --hover-tint:  rgba(20,32,50,.028);
  --scroll-thumb: #c3ccd9;
  --scroll-thumb-hover: #a9b6c7;
  --log-time:    #9aa8ba;

  --btn-primary-bg:     linear-gradient(160deg, #52739c, #3f5f86);
  --btn-primary-border: #3a5678;
  --btn-primary-fg:     #ffffff;
  --btn-danger-bg:      #fce2e4;
  --btn-danger-border:  #e8a0a6;
  --btn-danger-fg:      #a40e26;
  --btn-hover:          brightness(.965);

  --tip-bg:   #ffffff;
  --tip-line: #c7d1de;
  --tip-fg:   #1e2a3a;
  --tip-hr:   #e3e8ef;
  --backdrop: rgba(28,38,52,.42);

  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 6px 22px rgba(16,24,40,.07);
  --shadow-lg: 0 24px 60px rgba(16,24,40,.20);
  --glow-a:    rgba(217,119,87,.13);
  --glow-b:    rgba(88,166,255,.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(1100px 520px at 12% -12%, var(--glow-a), transparent 62%),
    radial-gradient(900px 480px at 96% -6%, var(--glow-b), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color .18s, color .18s;
}

code, .mono { font-family: var(--mono); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ─────────────── 顶栏 ─────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 26px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: 19px;
  color: #1a0f0a;
  background: linear-gradient(150deg, #f0946f, #d97757);
  box-shadow: 0 4px 16px rgba(217,119,87,.32);
}

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .22px;
  font-family: var(--mono);
}
.brand-text p { margin: 1px 0 0; font-size: 11.5px; color: var(--fg-faint); }

.stats { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 58px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line-soft);
}
.stat-num { font-size: 16px; font-weight: 640; font-family: var(--mono); line-height: 1.2; }
.stat-lbl { font-size: 10.5px; color: var(--fg-faint); letter-spacing: .4px; }
.stat.ok  .stat-num { color: var(--ok); }
.stat.bad .stat-num { color: var(--bad); }

.topbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.backend {
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--fg-faint);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  white-space: nowrap;
}
.backend.up   { color: var(--ok);  border-color: var(--ok-dim); }
.backend.down { color: var(--bad); border-color: var(--bad-dim); }

.theme-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  color: var(--fg-dim);
  font-size: 15px;
  cursor: pointer;
  transition: color .14s, border-color .14s, transform .12s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-dim); }
.theme-btn:active { transform: scale(.92); }

/* ─────────────── 布局 ─────────────── */

.layout {
  display: grid;
  grid-template-columns: 386px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 26px 56px;
  align-items: start;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}
/* ⚠️ 关键：flex 列在 max-height 下默认会压扁子项，
   叠加 .card{overflow:hidden} 就把卡片内容裁掉了（只剩前几行）。
   禁止收缩，让侧栏整体滚动，而不是把每张卡切一刀。 */
.side > .card { flex: 0 0 auto; }

.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

/* ─────────────── 卡片 ─────────────── */

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--hover-tint);
}
.card-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.card-head .sub { font-size: 11.5px; color: var(--fg-faint); margin-left: auto; }
.card-head > .btn:last-child { margin-left: auto; }

/* 可折叠：标题栏点一下收起，侧栏塞不下时用得着 */
.card-head.clickable { cursor: pointer; user-select: none; }
.card-head.clickable:hover h2 { color: var(--fg); }
.chev {
  flex: 0 0 auto;
  width: 12px;
  font-size: 9px;
  color: var(--fg-faint);
  transition: transform .16s ease;
  transform: rotate(0deg);
}
.card.collapsed .chev { transform: rotate(-90deg); }
.card.collapsed > *:not(.card-head) { display: none; }
.card.collapsed .card-head { border-bottom: none; }

.hint {
  margin: 0;
  padding: 10px 16px 14px;
  font-size: 11.5px;
  color: var(--fg-faint);
  line-height: 1.6;
}
.hint code {
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent);
}

/* ─────────────── 表单 ─────────────── */

.form-grid { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input { flex: 1 1 0; min-width: 0; }
.range-sep { flex: 0 0 auto; color: var(--fg-faint); font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--fg-dim); font-weight: 550; }
.field .opt {
  font-size: 10px; font-weight: 500; margin-left: 6px;
  padding: 0 6px; border-radius: 999px;
  color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn);
}
.field small code {
  background: var(--panel-3); padding: 0 4px; border-radius: 3px;
  font-family: var(--mono); color: var(--accent);
}
.field small { font-size: 10.5px; color: var(--fg-faint); line-height: 1.45; }
.field small.warn { color: var(--warn); }

input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sunk);
  color: var(--fg);
  font-size: 13px;
  font-family: var(--mono);
  outline: none;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--sunk-2);
}
input::placeholder { color: var(--placeholder); }
select { font-family: var(--sans); cursor: pointer; }

.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-dim); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.check-inline { font-size: 12px; white-space: nowrap; }

/* ─────────────── 按钮 ─────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 570;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, filter .14s, background .14s, border-color .14s, opacity .14s;
  white-space: nowrap;
  color: var(--fg);
  background: var(--panel-3);
}
.btn:hover:not(:disabled) { filter: var(--btn-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); color: var(--btn-primary-fg); }
.btn-accent  { background: linear-gradient(160deg, #f0946f, #d97757); border-color: #b85f43; color: #1e1009; font-weight: 640; }
.btn-danger  { background: var(--btn-danger-bg); border-color: var(--btn-danger-border); color: var(--btn-danger-fg); }
.btn-ghost   { background: transparent; border-color: var(--line); color: var(--fg-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-3); color: var(--fg); }
.btn-sm { padding: 4px 10px; font-size: 11.5px; }

.icon-btn {
  background: transparent; border: none; color: var(--fg-faint);
  font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--panel-3); color: var(--fg); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px 16px 0; }
.actions .btn { width: 100%; }
.actions-sub { grid-template-columns: 1fr 1fr; padding-bottom: 16px; }

/* ─────────────── 进度条 ─────────────── */

.progress-wrap { display: flex; align-items: center; gap: 10px; padding: 0 16px 16px; }
.progress { flex: 1; height: 6px; border-radius: 999px; background: var(--sunk); overflow: hidden; border: 1px solid var(--line-soft); }
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .18s ease;
}
.progress-text { font-size: 11px; font-family: var(--mono); color: var(--fg-dim); min-width: 74px; text-align: right; }

/* ─────────────── 平台列表 ─────────────── */

.platform-list { display: flex; flex-direction: column; }

.platform {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .14s;
}
.platform:hover { background: var(--hover-tint); }
.platform.off { opacity: .48; }

.platform-top { display: flex; align-items: center; gap: 9px; }
.platform-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-faint); flex: 0 0 auto; }
.platform-dot.ok   { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-bg); }
.platform-dot.bad  { background: var(--bad);  box-shadow: 0 0 0 3px var(--bad-bg); }
.platform-dot.busy { background: var(--accent); animation: pulse 1.05s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .28; } }

.platform-name { font-weight: 620; font-size: 13.5px; }
.platform-url  { font-size: 11px; color: var(--fg-faint); font-family: var(--mono);
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-acts { margin-left: auto; display: flex; gap: 3px; align-items: center; flex: 0 0 auto; }

.platform-msg { font-size: 11px; color: var(--fg-faint); }
.platform-msg.err { color: var(--bad); }

.group-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.gchip {
  font-size: 11px;
  font-family: var(--mono);
  padding: 2.5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sunk);
  color: var(--fg-faint);
  cursor: pointer;
  user-select: none;
  transition: all .12s;
}
.gchip:hover { border-color: var(--chip-hover); color: var(--fg-dim); }
.gchip.on {
  background: var(--accent-soft);
  border-color: var(--accent-dim);
  color: var(--accent);
}
.gchip .cnt { opacity: .6; margin-left: 4px; }

/* ─────────────── 平台状态面板 ─────────────── */

.pstatus-list { display: flex; flex-direction: column; }

.pstatus {
  display: grid;
  grid-template-columns: minmax(120px, 190px) repeat(3, minmax(60px, auto)) 1fr;
  gap: 14px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.pstatus:last-child { border-bottom: none; }
.pstatus-name { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pstatus-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstatus-kv { display: flex; flex-direction: column; }
.pstatus-kv b { font-family: var(--mono); font-size: 14px; font-weight: 620; }
.pstatus-kv i { font-style: normal; font-size: 10.5px; color: var(--fg-faint); }
.pstatus-note { font-size: 11.5px; color: var(--fg-faint); text-align: right; }
.pstatus-note.err { color: var(--bad); }

@media (max-width: 700px) {
  .pstatus { grid-template-columns: 1fr 1fr 1fr; }
  .pstatus-name { grid-column: 1 / -1; }
  .pstatus-note { grid-column: 1 / -1; text-align: left; }
}

/* ─────────────── 模型分布矩阵 ─────────────── */

.card-matrix { min-height: 240px; }

.matrix-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.matrix-tools input[type=search] { width: 210px; padding: 5px 10px; font-size: 12px; }
.matrix-tools select { width: auto; padding: 5px 26px 5px 10px; font-size: 12px; }
.matrix-tools select:disabled { opacity: .45; cursor: not-allowed; }

/* 视图切换：分段按钮 */
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sunk);
}
.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--fg-faint);
  font-family: inherit;
  font-size: 12px;
  font-weight: 560;
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .14s, color .14s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--fg-dim); }
.seg-btn.on {
  background: var(--panel-3);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}

/* 分组视图的行头：平台 / 分组 */
.grow-title { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.grow-plat  { font-size: 12.5px; color: var(--fg-dim); }
.grow-sep   { color: var(--fg-faint); font-size: 12px; }
.grow-group { font-family: var(--mono); font-size: 13.5px; font-weight: 650; color: var(--fg); }
.grow-plat em, .grow-group em { font-style: normal; background: var(--hl-bg); border-radius: 3px; }

.tag.ratio-tag {
  color: var(--ratio-fg);
  background: var(--ratio-bg);
  border-color: var(--ratio-line);
  font-weight: 620;
}

.matrix { display: flex; flex-direction: column; }

.empty {
  padding: 54px 24px;
  text-align: center;
  color: var(--fg-faint);
  font-size: 13px;
  line-height: 1.9;
}
.empty b { color: var(--fg-dim); display: block; margin-bottom: 6px; font-size: 14.5px; }

.model-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .14s;
}
.model-row:last-child { border-bottom: none; }
.model-row:hover { background: var(--hover-tint); }

.model-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.model-name {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 620;
  color: var(--fg);
  letter-spacing: .1px;
}
.model-name em { font-style: normal; background: var(--hl-bg); border-radius: 3px; padding: 0 1px; }

.tag {
  font-size: 10.5px;
  font-family: var(--mono);
  padding: 1.5px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg-faint);
  background: var(--sunk);
  white-space: nowrap;
}
.tag.ok  { color: var(--ok);  border-color: var(--ok-dim);  background: var(--ok-bg); }
.tag.bad { color: var(--bad); border-color: var(--bad-dim); background: var(--bad-bg); }

.model-actions { margin-left: auto; display: flex; gap: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  position: relative;              /* 给右上角倍率角标定位 */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 152px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--chip-grad));
  overflow: hidden;
  cursor: pointer;
  transition: border-color .14s, transform .1s, box-shadow .14s;
}
.chip:hover { border-color: var(--chip-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.chip:active { transform: translateY(0); }

/* 上半部分左右两块：左平台名、右分组名，中间一条竖线分隔 */
.chip-head { display: flex; align-items: stretch; min-width: 0; }

.chip-plat, .chip-group {
  padding: 5px 9px 4px;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.chip-plat {
  flex: 0 1 auto;
  color: var(--fg-faint);
  border-right: 1px solid var(--line-soft);
}
.chip-group {
  flex: 1 1 auto;
  color: var(--fg-dim);
  font-weight: 620;
  padding-right: 30px;             /* 给右上角倍率角标让位 */
  text-align: center;
}
.chip-plat em, .chip-group em, .chip-model em {
  font-style: normal; background: var(--hl-bg); border-radius: 3px;
}

/* 分组视图的标签：行头已经写了平台/分组/倍率，这里只放模型名 */
.chip.chip-m { min-width: 0; }
.chip-model {
  flex: 1 1 auto;
  padding: 5px 11px 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chip-ratio {
  position: absolute;
  top: 0;
  right: 0;
  padding: 1px 4px 2px;
  font-size: 9px;
  font-family: var(--mono);
  line-height: 1.5;
  letter-spacing: -.2px;
  font-weight: 620;
  color: var(--ratio-fg);
  background: var(--ratio-bg);
  border-left: 1px solid var(--ratio-line);
  border-bottom: 1px solid var(--ratio-line);
  border-radius: 0 9px 0 8px;
  pointer-events: none;
}

.chip-status {
  padding: 3px 9px 4px;
  font-size: 11px;
  font-family: var(--mono);
  text-align: center;
  border-top: 1px solid var(--line-soft);
  background: var(--sunk-3);
  color: var(--fg-faint);
  letter-spacing: .2px;
}

.chip.s-idle    .chip-status { color: var(--fg-faint); }
.chip.s-running .chip-status { color: var(--accent); background: var(--accent-soft); }
.chip.s-ok      { border-color: var(--ok-dim); }
.chip.s-ok      .chip-status { color: var(--ok-fg); background: var(--ok-bg); font-weight: 620; }
.chip.s-ok      .chip-group,
.chip.s-ok      .chip-model  { color: var(--ok-label); }
.chip.s-ok      .chip-plat   { color: var(--ok-label); opacity: .7; }
.chip.s-fail    { border-color: var(--bad-dim); }
.chip.s-fail    .chip-status { color: var(--bad-fg); background: var(--bad-bg); font-weight: 640; letter-spacing: .5px; }
.chip.s-fail    .chip-group,
.chip.s-fail    .chip-model  { color: var(--bad-label); }
.chip.s-fail    .chip-plat   { color: var(--bad-label); opacity: .7; }
.chip.s-warn    { border-color: var(--warn); }
.chip.s-warn    .chip-status { color: var(--warn); background: var(--warn-bg); font-weight: 600; }

.chip.s-running .chip-status {
  background-image: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  background-size: 220% 100%;
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { background-position: 200% 0; } to { background-position: -60% 0; } }

/* ─────────────── 日志 ─────────────── */

.log {
  max-height: 190px;
  overflow-y: auto;
  padding: 8px 12px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
}
.log-line { display: flex; gap: 8px; padding: 1px 0; }
.log-time { color: var(--log-time); flex: 0 0 auto; }
.log-msg  { color: var(--fg-dim); word-break: break-word; min-width: 0; }
.log-line.ok   .log-msg { color: var(--ok); }
.log-line.err  .log-msg { color: var(--bad); }
.log-line.warn .log-msg { color: var(--warn); }
.log-line.step .log-msg { color: var(--accent); font-weight: 600; }

/* ─────────────── 悬浮提示 ─────────────── */

.tooltip {
  position: fixed;
  z-index: 200;
  max-width: 520px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--tip-bg);
  border: 1px solid var(--tip-line);
  box-shadow: var(--shadow-lg);
  font-size: 11.5px;
  font-family: var(--mono);
  line-height: 1.62;
  color: var(--tip-fg);
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}
.tooltip b { color: var(--accent); font-weight: 620; }
.tooltip .t-err { color: var(--bad); }
.tooltip .t-ok  { color: var(--ok); }
.tooltip hr { border: none; border-top: 1px solid var(--tip-hr); margin: 7px 0; }

/* ─────────────── 弹窗 ─────────────── */

.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative;
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop .16s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 620; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 16px; border-top: 1px solid var(--line-soft); }

/* ─────────────── 杂项 ─────────────── */

[hidden] { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--fg);
  animation: toast-in .2s ease;
}
.toast.ok  { border-color: var(--ok-dim);  color: var(--ok-fg); }
.toast.err { border-color: var(--bad-dim); color: var(--bad-fg); }
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }

/* ─────────────── 登录闸门 ─────────────── */

.gate {
  position: fixed; inset: 0; z-index: 500;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(900px 460px at 50% -10%, var(--glow-a), transparent 62%),
    radial-gradient(700px 400px at 50% 110%, var(--glow-b), transparent 60%);
}
.gate-box {
  width: min(360px, 100%);
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 30px 26px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.gate-mark {
  width: 46px; height: 46px; margin: 0 auto 4px;
  display: grid; place-items: center;
  border-radius: 13px; font-size: 22px; color: #1a0f0a;
  background: linear-gradient(150deg, #f0946f, #d97757);
  box-shadow: 0 6px 20px rgba(217,119,87,.34);
}
.gate-box h1 { margin: 0; font-size: 15px; font-family: var(--mono); font-weight: 650; }
.gate-box p { margin: 0 0 6px; font-size: 12px; color: var(--fg-faint); }
.gate-box input { text-align: center; font-family: var(--sans); }
.gate-err {
  font-size: 12px; color: var(--bad);
  background: var(--bad-bg); border: 1px solid var(--bad-dim);
  border-radius: var(--radius-sm); padding: 6px 10px;
}

.card-head .sub.warn-sub { color: var(--warn); }
.hint b { color: var(--fg-dim); }
