/* Appzentic Admin —— 桌面端运营后台（#25 改版）。颜色全部走变量；深色模式跟随系统。 */
/* #38：Windows 没有国旗表情，Chrome 会把国旗画成两个小字母 ⇒ 自带一份只含国旗的字体（Twemoji，CC-BY 4.0，
   来自 country-flag-emoji-polyfill 0.1.8，见 vendor/TwemojiCountryFlags.LICENSE.md）。unicode-range 只覆盖区域指示符，
   别的字符照旧走 --font 里后面的系统字体 */
@font-face { font-family: "Twemoji Country Flags"; unicode-range: U+1F1E6-1F1FF; src: url("/vendor/TwemojiCountryFlags.woff2?v=52") format("woff2"); font-display: swap; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --on-primary: #ffffff;
  --ok: #15803d;      --ok-bg: #dcfce7;
  --warn: #b45309;    --warn-bg: #fef3c7;
  --danger: #b91c1c;  --danger-bg: #fee2e2;
  --info: #1d4ed8;    --info-bg: #dbeafe;
  --neutral: #4b5563; --neutral-bg: #f3f4f6;
  --side-bg: #111827;
  --side-text: #d1d5db;
  --side-muted: #6b7280;
  --side-hover: #1f2937;
  --side-active: #ffffff;
  --qr-bg: #ffffff;
  /* #33 Builds 日志框：浅底深字（原来写死深底，和左边深色菜单栏撞色） */
  --log-bg: #f8fafc;   --log-text: #1f2937;
  /* #29 三类动作按钮：查询蓝、新增绿、执行琥珀橙（提交类仍用 --primary） */
  --search-bg: #2563eb;  --search-hover: #1d4ed8;  --search-text: #ffffff;
  --create-bg: #16a34a;  --create-hover: #15803d;  --create-text: #ffffff;
  --run-bg: #d97706;     --run-hover: #b45309;     --run-text: #ffffff;
  /* #40 右侧运行状况栏的线条：dataviz 校验过的蓝 / 橙（对 #ffffff 底） */
  --series-1: #2a78d6;  --series-2: #eb6834;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --radius: 8px;
  --font: "Twemoji Country Flags", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #111827;
    --surface-2: #161e2e;
    --border: #1f2937;
    --border-strong: #374151;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: #1e1b4b;
    --on-primary: #0b0f17;
    --ok: #4ade80;      --ok-bg: #052e16;
    --warn: #fbbf24;    --warn-bg: #3a2a05;
    --danger: #f87171;  --danger-bg: #3b0d0d;
    --info: #60a5fa;    --info-bg: #0c1f3f;
    --neutral: #9ca3af; --neutral-bg: #1f2937;
    --side-bg: #070a10;
    --search-bg: #3b82f6;  --search-hover: #60a5fa;  --search-text: #0b0f17;
    --create-bg: #22c55e;  --create-hover: #4ade80;  --create-text: #0b0f17;
    --run-bg: #f59e0b;     --run-hover: #fbbf24;     --run-text: #0b0f17;
    --series-1: #3987e5;  --series-2: #d95926;    /* 对 #111827 底校验过 */
    --side-hover: #111827;
    --log-bg: #161e2e;   --log-text: #d1d5db;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { display: flex; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 侧边栏 ---------- */
#sidebar { width: 224px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text); }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--primary); color: #fff; display: grid;
  place-items: center; font-weight: 700; flex: none; }
.brand-name { font-weight: 600; color: #fff; }
.brand-host { font-size: 11px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 8px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--side-muted);
  padding: 14px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px;
  color: var(--side-text); position: relative; }
.side-nav a:hover { background: var(--side-hover); text-decoration: none; }
.side-nav a.active { background: var(--side-hover); color: var(--side-active); font-weight: 600; }
.side-nav a.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary); }
.side-nav svg { flex: none; opacity: 0.85; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid #1f2937; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: #374151; color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; text-transform: uppercase; flex: none; }
#whoami { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { background: none; border: none; color: var(--side-muted); font: inherit; font-size: 12px; cursor: pointer; padding: 4px; }
.side-logout:hover { color: #fff; }

/* ---------- 主区域与页头 ---------- */
#view { flex: 1; min-width: 0; max-width: 1440px; padding: 24px 32px 48px; }
#sidebar[hidden] ~ #view { max-width: none; display: grid; place-items: center; }

/* ---------- #40 右侧运行状况栏：屏幕放得下才显示（1800px 起；rail.js 用同一个数），放不下就不显示 ---------- */
#rail { display: none; }
/* #42：栏宽跟着剩余空间走（内容区先长到 1440，剩下的都给栏）。
   #43 用户定：卡片保持 #40 的大小（约 420px 宽），两列 —— 左边机器指标（Console host）、右边业务指标（Today）；
   栏不够放两列（< 约 700px）时上下叠，机器在上；最宽 920px（两列各约 430），不再往更多列分 */
@media (min-width: 1800px) {
  #rail:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-content: start; gap: 20px 16px;
    flex: 1 1 300px; min-width: 300px; max-width: 920px; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 24px 24px 24px 0; }
  #view { flex-grow: 1000; }
}
.rail-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rail-grid { display: flex; flex-direction: column; gap: 12px; }
.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 52px; }
.rail-head .seg { border: none; background: none; font: inherit; font-size: 12px; cursor: pointer; padding: 0 10px; }
.rail-head .seg.active { background: var(--surface); }
.rail-title { font-weight: 600; }
.rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.rail-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.rail-value { font-size: 22px; font-weight: 600; line-height: 1.2; }
.rail-unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.rail-sub { font-size: 12px; color: var(--muted); }
.rail-error { font-size: 12px; color: var(--danger); }
.rail-pair { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.rail-pair b { color: var(--text); font-size: 15px; font-weight: 600; margin-left: 4px; }
.key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 5px; }
.key.s-1 { background: var(--series-1); }
.key.s-2 { background: var(--series-2); }
.spark { position: relative; margin-top: 8px; }
.spark svg { display: block; width: 100%; height: 48px; overflow: visible; }
.spark-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-line.s-1 { stroke: var(--series-1); }
.spark-line.s-2 { stroke: var(--series-2); }
.spark-area { stroke: none; opacity: 0.1; }
.spark-area.s-1 { fill: var(--series-1); }
.spark-area.s-2 { fill: var(--series-2); }
.spark-base { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-cross { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }
.spark-tip { position: absolute; top: -4px; transform: translate(-50%, -100%); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12); }
.spark-tip b { font-weight: 600; }
.spark-tip-time { color: var(--muted); font-size: 11px; }
/* Today 组的柱状图：柱子最宽 24px、顶上 4px 圆角；今天那根是强调色，前几天淡一档；整列都是悬停区域 */
.bars { position: relative; display: flex; align-items: stretch; height: 56px; margin-top: 8px; border-bottom: 1px solid var(--border); }
.bar-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: min(24px, 60%); background: var(--series-1); opacity: 0.35; border-radius: 4px 4px 0 0; }
.bar-today { opacity: 1; }
.bar-col:hover .bar { opacity: 0.6; }
.bar-col:hover .bar-today { opacity: 0.85; }
.rail-disk + .rail-disk { margin-top: 10px; }
.rail-disk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rail-disk-pct { margin-left: auto; font-weight: 600; }
.rail-flag { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; }
.rail-flag.tone-warn { color: var(--warn); background: var(--warn-bg); }
.rail-flag.tone-danger { color: var(--danger); background: var(--danger-bg); }
/* 用量条：底色是同一色系浅一档，填充按档位（正常蓝、偏高橙、快满红；橙 / 红旁边一定有文字） */
.rail-meter { height: 6px; border-radius: 3px; overflow: hidden; }
.rail-meter span { display: block; height: 100%; border-radius: 3px; }
.rail-meter.tone-info { background: var(--info-bg); }   .rail-meter.tone-info span { background: var(--info); }
.rail-meter.tone-warn { background: var(--warn-bg); }   .rail-meter.tone-warn span { background: var(--warn); }
.rail-meter.tone-danger { background: var(--danger-bg); } .rail-meter.tone-danger span { background: var(--danger); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { flex: 1; min-width: 240px; }
.page-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; color: var(--muted); }
.page-meta:empty { display: none; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumb-sep { color: var(--border-strong); }

/* ---------- 按钮与表单 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-search { background: var(--search-bg); border-color: var(--search-bg); color: var(--search-text); }
.btn-search:hover { background: var(--search-hover); border-color: var(--search-hover); }
.btn-create { background: var(--create-bg); border-color: var(--create-bg); color: var(--create-text); }
.btn-create:hover { background: var(--create-hover); border-color: var(--create-hover); }
.btn-run { background: var(--run-bg); border-color: var(--run-bg); color: var(--run-text); }
.btn-run:hover { background: var(--run-hover); border-color: var(--run-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-link { background: none; border: none; color: var(--primary); font: inherit; cursor: pointer; padding: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 34px; padding: 0 10px; }
textarea { padding: 8px 10px; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search { width: 280px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.stack label input, .stack label select { width: 100%; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 16px; border: none; padding: 0; margin: 0; }
.choices legend { font-weight: 500; margin-bottom: 4px; padding: 0; }
.stack .choices label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.choices .hint { flex-basis: 100%; }
.form-actions { display: flex; gap: 8px; }
.form-error { color: var(--danger); overflow-wrap: anywhere; }
.sub-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.form-narrow { max-width: 720px; }

/* ---------- 卡片、信息表 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 28px; }
.card-head .push-right, .push-right { margin-left: auto; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 12px 16px 0; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.layout-2col > * { min-width: 0; }

/* ---------- 状态胶囊 ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--neutral); background: var(--neutral-bg); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); background: var(--ok-bg); }
.pill-warn { color: var(--warn); background: var(--warn-bg); }
.pill-danger { color: var(--danger); background: var(--danger-bg); }
.pill-info { color: var(--info); background: var(--info-bg); }
.pill-sm { height: 20px; padding: 0 7px; font-size: 11.5px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11.5px;
  font-weight: 500; color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag-bad { color: var(--danger); border-color: var(--danger); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card .table-wrap { border: none; box-shadow: none; border-radius: 0; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 12px;
  font-weight: 600; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data th.num, table.data td.num { text-align: right; }
table.data .link-row { cursor: pointer; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data .empty-row td { text-align: center; color: var(--muted); padding: 32px 12px; }
.cell-title { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.cell-fail { display: block; font-size: 12px; color: var(--danger); margin-top: 2px; overflow-wrap: anywhere; }
.load-more { text-align: center; margin-top: 12px; }

/* ---------- 统计条、分段切换 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
  box-shadow: var(--shadow); }
.stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-ok .stat-value { color: var(--ok); }
.stat-warn .stat-value { color: var(--warn); }
.stat-danger .stat-value { color: var(--danger); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--neutral-bg); border-radius: 8px; }
.seg { height: 28px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 6px; color: var(--muted);
  font-weight: 500; }
.seg:hover { color: var(--text); text-decoration: none; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.view-bar { margin-bottom: 12px; }

/* ---------- 状态框 ---------- */
.loading, .empty { padding: 32px 16px; color: var(--muted); text-align: center; }
.error-box { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; overflow-wrap: anywhere; }
.error-box p { margin: 0 0 8px; }
.error-box .muted { color: inherit; opacity: 0.8; }
.failure-box { background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius); padding: 12px;
  margin-bottom: 12px; }
.failure-box h3 { color: var(--danger); margin: 0 0 6px; text-transform: none; letter-spacing: 0; font-size: 13px; }
.failure-box pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; }
.banner-warn, .refresh-error { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 8px 12px;
  margin-bottom: 12px; overflow-wrap: anywhere; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }

/* ---------- Builds：日志、安装 ---------- */
.log { font-family: var(--mono); font-size: 12px; line-height: 1.5; max-height: 70vh; min-height: 200px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; background: var(--log-bg); color: var(--log-text);
  border: 1px solid var(--border); padding: 12px; border-radius: 6px; margin: 0; }
.install { text-align: center; }
.install p { margin: 8px 0; }
.qr { display: inline-block; background: var(--qr-bg); padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.qr svg { display: block; width: 200px; height: 200px; }

/* ---------- Feedbacks：对话、截图 ---------- */
.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; max-width: 760px; }
.msg-user { background: var(--surface-2); }
.msg-engineer { background: var(--primary-soft); border-color: transparent; margin-left: 48px; }
.msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.shots img { display: block; width: 112px; height: 112px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Users：钱包 ---------- */
.balance { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0 0 12px; }
.amount-in { color: var(--ok); }

/* ---------- Servers：卡片网格、负载条 ---------- */
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 24px 0 10px; }
.group-head:first-child { margin-top: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.grid-cards .card { margin: 0; }
.server-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.server-head .cell-title { font-size: 15px; }
.server-sub { color: var(--muted); font-size: 12px; margin: 4px 0 12px; overflow-wrap: anywhere; }
.server-apps { margin: 8px 0 0; overflow-wrap: anywhere; }
table.agents { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
table.agents td { padding: 5px 0; border-top: 1px solid var(--border); }
table.agents td:first-child { font-weight: 600; width: 84px; }
table.agents td.num { color: var(--muted); }
.slot { display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center; gap: 8px; font-size: 12.5px; margin: 5px 0; }
.slot-bar { height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; }
.slot-fill { display: block; height: 100%; border-radius: 3px; }
.slot-ok { background: var(--ok); }
.slot-high { background: var(--warn); }
.slot-full { background: var(--danger); }
.slot-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Health / Pricing ---------- */
.doctor-output { max-height: 60vh; }
.doctor-output .line-bad { color: #f87171; font-weight: 600; }
.doctor-output .line-warn { color: #fbbf24; }
.account { padding: 12px 0; border-top: 1px solid var(--border); }
.account:first-of-type { border-top: none; padding-top: 0; }
.account-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.model-entry.disabled { opacity: 0.55; }
.model-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }

/* ---------- 登录 ---------- */
.login { width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.login .brand { padding: 0 0 6px; }
.login .brand-name { color: var(--text); }
.login label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.login input { width: 100%; }

/* ---------- 弹窗（#28：Notifications / Apps 详情、新建通知） ---------- */
.modal { padding: 0; border: none; border-radius: 12px; width: min(720px, calc(100vw - 48px)); max-height: calc(100vh - 64px);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
.modal[open] { display: flex; flex-direction: column; }
.modal-form { width: min(560px, calc(100vw - 48px)); }
/* #44 Models 的 Gateways 弹窗与表单 */
.modal-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.gw-names { display: grid; gap: 8px; border: none; padding: 0; margin: 0; }
.gw-names legend { font-weight: 500; margin-bottom: 4px; padding: 0; }
/* #53 AI Gateway Test：结论一行、要看的问题列表 */
.gwt-verdict { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 15px; }
.gwt-findings { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.gwt-findings li div { margin-top: 2px; overflow-wrap: anywhere; }
.stack label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
/* #48 一行一个配置项：名字在左、框在右（#49：不是 label 的行用 .form-row，同一个网格） */
.stack.form-rows .form-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 12px; }
.form-label { font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border-strong); background: transparent; color: inherit; border-radius: 999px; padding: 3px 12px; font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 500; }
/* #49 Models 卡片 */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.model-card { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; margin: 0; }
.model-card:hover { border-color: var(--primary); text-decoration: none; }   /* 整张卡片是链接：不给里面的字加下划线（#58） */
.model-card.disabled { opacity: 0.55; }
.model-card-head { display: flex; align-items: center; gap: 8px; }
.model-price { font-variant-numeric: tabular-nums; }
.model-vendors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
/* #56 AI Vendors 卡片：借 Models 的卡片；官方的卡片不能点（没有详情）⇒ 不变色 */
.vendor-status { margin-left: auto; }
.vendor-balance { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
div.vendor-card:hover { border-color: var(--border); }
/* #57 logo：Console 的图是方形 app 图标（多半带底色）⇒ 统一 32px 圆角；不认识的 vendor 用首字母方块 */
.vendor-logo { width: 32px; height: 32px; flex: none; border-radius: 8px; object-fit: cover; }
.vendor-logo-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.stack.form-rows label { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 12px; font-weight: 500; }
.stack.form-rows label.check input { width: auto; justify-self: start; }
.account-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 32px; margin-bottom: 12px; }
/* #44 AI Vendors 详情：流水按月翻 */
.month-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal::backdrop { background: rgba(17, 24, 39, 0.45); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; font-size: 16px; overflow-wrap: anywhere; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 2px 8px;
  border-radius: 6px; cursor: pointer; }
.modal-close:hover { background: var(--neutral-bg); color: var(--text); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 12px 12px; }
.modal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--muted); }
.modal-body .table-wrap { margin-bottom: 4px; }
.modal-body h3:first-child { margin-top: 0; }

/* ---------- 搜索框（#28：Search 按钮 + 框内 ×） ---------- */
.search-form { display: flex; gap: 8px; }
.search-field { position: relative; display: inline-flex; }
.search-field input { padding-right: 32px; }
.search-clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: none;
  border-radius: 50%; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.search-clear:hover { background: var(--neutral-bg); color: var(--text); }
