:root {
  /* ── 暮色玫瑰 · 薰衣草 主题（为 background.jpg 定制） ── */
  --accent: #eaa4c6;
  --accent-rgb: 234, 164, 198;
  --accent-deep: #d67ba7;
  --accent-soft: rgba(var(--accent-rgb), .15);
  --accent-shadow1: rgba(var(--accent-rgb), .30);
  --accent-shadow2: rgba(var(--accent-rgb), .42);
  --lav: #a99be2;
  --lav-rgb: 169, 155, 226;
  --blue: #9cc6ec;
  --green: #8fd6b0;
  --orange: #f0c483;
  --red: #ec8a9c;
  --text: #f5eff6;
  --text-dim: #c9bcd4;
  --glass: rgba(28, 22, 42, .38);
  --glass-solid: rgba(24, 18, 38, .68);
  --veil-light: rgba(22, 16, 34, .42);
  --veil-dark: rgba(13, 9, 22, .62);
  --stroke: rgba(245, 235, 246, .14);
  --hi: rgba(255, 250, 250, .16);
  --scrollbar-track: rgba(18, 13, 30, .28);
  --scrollbar-thumb: rgba(var(--lav-rgb), .38);
  --scrollbar-thumb-hover: rgba(var(--accent-rgb), .66);
  --scrollbar-thumb-active: rgba(var(--accent-rgb), .82);
  --radius: 18px;
  --ease: cubic-bezier(.22, .8, .3, 1);
  --bg-img: url('background.jpg?v=sf-20260707-6');
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-size: 14px; font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.55; color: var(--text); overflow: hidden; }
::selection { background: var(--accent-soft); }
a { color: var(--lav); text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; color: inherit; }
/* ── 全局滚动条：Firefox 与 Chromium/WebKit ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scrollbar-track); }
*::-webkit-scrollbar-thumb {
  min-width: 28px; min-height: 28px;
  border: 2px solid transparent; border-radius: 999px;
  background: linear-gradient(180deg, var(--scrollbar-thumb), rgba(var(--accent-rgb), .30)) padding-box;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover) padding-box; }
*::-webkit-scrollbar-thumb:active { background: var(--scrollbar-thumb-active) padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, .05);
  border: 1px solid var(--stroke); border-radius: 11px; padding: 10px 13px; width: 100%;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: rgba(201, 188, 212, .55); }
/* 用 background-color 而非 background 简写：避免重置 select 的箭头/渐变背景层（否则聚焦时箭头消失、失焦时从左飞回）。 */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background-color: rgba(255, 255, 255, .08); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="datetime-local"], input[type="number"] { color-scheme: dark; }
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  min-height: 42px; padding: 10px 38px 10px 14px;
  color-scheme: dark; color: var(--text); font-weight: 560; letter-spacing: .01em;
  border-color: rgba(245, 235, 246, .18);
  background-color: rgba(28, 22, 42, .62);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.045)),
    radial-gradient(90px 42px at 100% 0%, rgba(var(--accent-rgb), .18), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%23eaa4c6' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: 0 0, right top, right 11px center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.12);
}
select:hover { border-color: rgba(var(--accent-rgb), .42); background-color: rgba(255,255,255,.08); }
/* 下拉展开的选项列表：暗色贴主题（原生 option 的半透明各浏览器支持不一，此处取近实底暗色）。 */
select option { background: rgba(30, 23, 44, .98); color: var(--text); font-weight: 500; }
select option:checked { background: #3a2942; color: var(--accent); }
select:disabled { cursor: not-allowed; opacity: .58; }
select::-ms-expand { display: none; }

/* 自绘 select：隐藏原生控件，但保留 value/change 作为业务逻辑的数据源。 */
select.native-select-control {
  position: absolute !important; width: 1px !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; opacity: 0 !important; pointer-events: none !important;
}
.custom-select { position: relative; width: 100%; min-width: 0; }
.custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px 9px 14px;
  color: var(--text); text-align: left; border: 1px solid rgba(245,235,246,.18); border-radius: 11px;
  background: linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.045)), rgba(28,22,42,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.12);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.custom-select-trigger:hover { border-color: rgba(var(--accent-rgb),.48); background-color: rgba(255,255,255,.08); }
.custom-select-trigger:focus-visible, .custom-select.open .custom-select-trigger {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 1px 0 rgba(255,255,255,.08);
}
.custom-select-trigger:disabled { cursor: not-allowed; opacity: .58; }
.custom-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; letter-spacing: .01em; }
.custom-select-chevron { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; color: var(--accent); border-radius: 7px; background: rgba(var(--accent-rgb),.08); transition: transform .2s var(--ease), background .2s; }
.custom-select-chevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.custom-select.open .custom-select-chevron { transform: rotate(180deg); background: rgba(var(--accent-rgb),.16); }
.custom-select-menu {
  position: fixed; z-index: 500; display: none; max-height: min(280px, calc(100vh - 20px)); overflow: auto;
  padding: 6px; border: 1px solid rgba(245,235,246,.18); border-radius: 12px;
  background: rgba(24,18,38,.97); box-shadow: 0 18px 46px rgba(0,0,0,.52), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: select-pop .14s var(--ease) both;
}
.custom-select-menu.open { display: grid; gap: 3px; }
@keyframes select-pop { from { opacity: 0; transform: translateY(-5px) scale(.985); } to { opacity: 1; transform: none; } }
.custom-select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 38px; padding: 8px 9px 8px 11px; color: var(--text-dim); text-align: left;
  border: 1px solid transparent; border-radius: 9px; background: transparent;
  transition: color .14s, background .14s, border-color .14s;
}
.custom-select-option:hover, .custom-select-option:focus-visible { outline: none; color: var(--text); border-color: rgba(245,235,246,.09); background: rgba(255,255,255,.075); }
.custom-select-option.selected { color: var(--accent); border-color: rgba(var(--accent-rgb),.2); background: rgba(var(--accent-rgb),.11); }
.custom-select-option:disabled { opacity: .42; cursor: not-allowed; }
.custom-select-check { display: grid; place-items: center; width: 21px; height: 21px; flex: 0 0 21px; opacity: 0; color: var(--accent); }
.custom-select-check svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.custom-select-option.selected .custom-select-check { opacity: 1; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── 背景层 ── */
.bg { position: fixed; inset: -4%; z-index: -2; background: var(--bg-img); background-size: cover; background-position: center; background-repeat: no-repeat; }
.bg-veil {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 82% -6%, var(--accent-soft), transparent 55%),
    radial-gradient(900px 700px at 10% 110%, rgba(var(--lav-rgb), .12), transparent 55%),
    linear-gradient(180deg, var(--veil-light), var(--veil-dark));
}
.glass {
  background: var(--glass-solid);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42), inset 0 1px 0 var(--hi);
}
.btn {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep)); color: #2a1830; border: none;
  border-radius: 11px; padding: 10px 18px; font-weight: 650; letter-spacing: .01em;
  box-shadow: 0 6px 18px var(--accent-shadow1); transition: transform .18s var(--ease), filter .18s, box-shadow .18s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1.5px); box-shadow: 0 9px 24px var(--accent-shadow2); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--text-dim); box-shadow: none; border: 1px solid var(--stroke); }
.btn.ghost:hover { color: var(--text); border-color: var(--accent); background: rgba(255, 255, 255, .11); transform: translateY(-1.5px); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }

/* ── 品牌 logo ── */
.err { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 12px; }

/* ── 布局：侧边栏 + 主区 ── */
#app { position: fixed; inset: 0; display: grid; grid-template-columns: 236px 1fr; padding: 18px; gap: 18px; opacity: 0; transition: opacity .5s var(--ease); }
#app.in { opacity: 1; }
aside { padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 20px; font-size: 15.5px; font-weight: 700; letter-spacing: .01em; }
.brand .mk { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #2a1830; flex: none; }
.brand .mk-img { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; flex: none; box-shadow: 0 4px 12px var(--accent-shadow1); }
.brand small { display: block; color: var(--text-dim); font-size: 11px; font-weight: 500; margin-top: 2px; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text-dim);
  padding: 11px 14px; border-radius: 12px; font-size: 14px;
  transition: background .2s var(--ease), color .2s, transform .2s var(--ease), box-shadow .2s;
}
nav button .ic { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
nav button:hover { background: rgba(255, 255, 255, .07); color: var(--text); transform: translateX(3px); }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .32), 0 4px 16px rgba(var(--accent-rgb), .14); }
aside .spacer { flex: 1; }
.side-status { padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); font-size: 11.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 5px; }
.side-status span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.side-status strong { color: var(--text); font-weight: 650; font-size: 12px; }

main { position: relative; overflow: hidden; border-radius: var(--radius); }
.main-glass-bg {
  position: absolute; inset: -1px; z-index: 0; pointer-events: none;
  background: var(--glass-solid); border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42), inset 0 1px 0 var(--hi);
}
.main-content { position: relative; z-index: 1; overflow: auto; overflow-x: hidden; padding: 28px 32px; height: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; font-weight: 700; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0, 0, 0, .3); }
.page-head .hint { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }
.page-head .head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
section.page { transition: opacity .15s var(--ease), transform .15s var(--ease); }
section.page.leaving { opacity: 0; }
section.page.entering { opacity: 0; transform: translateY(14px); }

/* ── 卡片 / 统计 ── */
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card { background: var(--glass-solid); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, .42), inset 0 1px 0 var(--hi); padding: 20px 22px; transition: transform .22s var(--ease), box-shadow .22s, border-color .22s; }
.card.hoverable:hover { transform: translateY(-4px); box-shadow: 0 22px 54px rgba(0, 0, 0, .48), inset 0 1px 0 var(--hi); border-color: rgba(var(--accent-rgb), .32); }
.grid.stats .card { animation: rise .55s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
section.page.entering .grid.stats .card { animation-play-state: paused; }
html.data-refresh-stable .grid.stats .card { animation: none; }
/* 统计小卡：统一为 标签 / 数值 / 明细 三段式，等高、左对齐、行距一致。 */
.card.stat { display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 18px 20px; }
.stat .label { color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 1.3; }
.stat .value { font-size: 26px; font-weight: 720; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; margin: 0; margin-top: auto; }
.stat .value.accent { color: var(--accent); text-shadow: 0 0 22px rgba(var(--accent-rgb), .35); }
.stat .value.blue { color: var(--blue); }
.stat .value.green { color: var(--green); }
.stat .value.orange { color: var(--orange); }
.stat .value.red { color: var(--red); }
.stat .detail, .stat .sub { color: var(--text-dim); font-size: 11.5px; line-height: 1.4; margin: 0; display: block; overflow-wrap: anywhere; }

/* ── 表格 ── */
.section-block { margin-top: 22px; }
.section-block:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h3 { font-size: 16px; font-weight: 650; }
.reasoning-policy-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 19px; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255,255,255,.04); }
.reasoning-policy-card h3 { font-size: 16px; font-weight: 650; margin-bottom: 3px; }
.reasoning-policy-card .hint { color: var(--text-dim); font-size: 12.5px; }
.reasoning-policy-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.switch-control { display: flex; align-items: center; gap: 12px; min-width: 174px; padding: 9px 11px; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(255,255,255,.04); cursor: pointer; }
.switch-control > span { display: flex; flex: 1; flex-direction: column; line-height: 1.25; }
.switch-control strong { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text); }
.switch-control small { margin-top: 3px; color: var(--text-dim); font-size: 10.5px; }
.switch-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-control i { position: relative; width: 42px; height: 24px; flex: none; border: 1px solid var(--stroke); border-radius: 999px; background: rgba(255,255,255,.09); transition: background .2s, border-color .2s; }
.switch-control i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform .2s var(--ease), background .2s; }
.switch-control input:checked + i { border-color: rgba(var(--accent-rgb),.7); background: rgba(var(--accent-rgb),.3); }
.switch-control input:checked + i::after { transform: translateX(18px); background: var(--accent); }
.switch-control input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch-control:has(input:disabled) { opacity: .58; cursor: wait; }
.subagent-limit-control { min-width: 238px; padding: 9px 11px; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(255,255,255,.04); }
.subagent-limit-control > label { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 11px; white-space: nowrap; }
.subagent-limit-control input { width: 66px; padding: 6px 7px; border: 1px solid var(--stroke); border-radius: 8px; outline: none; background: rgba(255,255,255,.07); color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.subagent-limit-control input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.subagent-limit-control input:disabled { opacity: .55; cursor: not-allowed; }
.subagent-limit-control:has(input:disabled) { opacity: .58; }
.subagent-limit-control:has(input[aria-invalid="true"]) { border-color: rgba(255,94,113,.65); }
.field-error { display: none; margin-top: 5px; color: var(--red); font-size: 10.5px; line-height: 1.35; }
.field-error:not(:empty) { display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; white-space: nowrap; position: sticky; top: 0; background: rgba(18, 13, 30, .62); z-index: 1; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .16s; }
tbody tr:hover { background: rgba(255, 255, 255, .05); }
.num { text-align: right; }
th.num { text-align: right; }
.mono { font-family: ui-monospace, Consolas, "SF Mono", Menlo, monospace; }
.muted, .message { color: var(--text-dim); }
.token-cost { display: block; margin-top: 2px; color: var(--text-dim); font-size: 10.5px; white-space: nowrap; }
.ok { color: var(--green); font-weight: 650; }
.warn { color: var(--orange); font-weight: 650; }
.bad { color: var(--red); font-weight: 650; }
.accent-txt { color: var(--accent); }
.blue-txt { color: var(--blue); }
.green-txt { color: var(--green); }
.orange-txt { color: var(--orange); }
.table-wrap { overflow: auto; border: 1px solid var(--stroke); border-radius: 12px; max-height: 620px; scrollbar-gutter: stable; }
.table-wrap::-webkit-scrollbar-track, .error-detail::-webkit-scrollbar-track, .task-body::-webkit-scrollbar-track, .task-scroll::-webkit-scrollbar-track {
  margin: 5px; border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-thumb, .error-detail::-webkit-scrollbar-thumb, .task-body::-webkit-scrollbar-thumb, .task-scroll::-webkit-scrollbar-thumb {
  border-width: 2px;
}
.table-wrap table { min-width: max-content; }
/* 最近请求：占满主内容区的剩余高度，窗口变化时表格滚动区自动伸缩。 */
#page-recent { height: 100%; min-height: 0; flex-direction: column; }
#page-recent:not(.hidden) { display: flex; }
#page-recent .page-head { flex: none; }
.recent-table-wrap { flex: 1 1 auto; min-height: 160px; max-height: none; }
/* 最近请求：JS 按内容测量基础宽度，并将剩余空间平均分给 11 列。 */
.recent-table { width: max-content; table-layout: auto; }
.recent-table th, .recent-table td { white-space: nowrap; }
.recent-table th:nth-child(4), .recent-table td:nth-child(4) { text-align: center; }
.recent-table th:nth-child(3), .recent-table td:nth-child(3) { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.recent-table th.recent-center-head { text-align: center; }
.recent-table th:nth-child(11), .recent-table td:nth-child(11) { text-align: center; }
.recent-table.recent-widths-applied { table-layout: fixed; }

/* ── 徽章 ── */
.badge { display: inline-flex; align-items: center; min-height: 24px; border: 1px solid var(--stroke); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 650; white-space: nowrap; background: rgba(255,255,255,.05); }
.badge.ok { border-color: rgba(143, 214, 176, .45); background: rgba(143, 214, 176, .12); color: var(--green); }
.badge.warn { border-color: rgba(240, 196, 131, .45); background: rgba(240, 196, 131, .12); color: var(--orange); }
.badge.bad { border-color: rgba(236, 138, 156, .45); background: rgba(236, 138, 156, .12); color: var(--red); }

/* ── 工具栏 / 时间范围 ── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); border-radius: 14px; margin-bottom: 18px; }
.toolbar.plain { background: transparent; border: none; padding: 0; }
.preset-group { display: inline-flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.055); border: 1px solid var(--stroke); border-radius: 13px; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); flex-wrap: wrap; }
.preset { border: none; border-radius: 10px; padding: 8px 13px; background: transparent; color: var(--text-dim); font-weight: 650; font-size: 12.5px; transition: background .18s var(--ease), color .18s, box-shadow .18s; }
.preset:hover { color: var(--text); background: rgba(255,255,255,.075); }
.preset.active { color: #2a1830; background: linear-gradient(180deg, var(--accent), var(--accent-deep)); box-shadow: 0 6px 18px rgba(var(--accent-rgb), .24); }
.custom-range { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-dim); font-size: 12px; }
.custom-range input { width: auto; min-width: 0; height: 40px; }
.apply, .refresh { border: 1px solid var(--stroke); background: rgba(255,255,255,.06); color: var(--text-dim); padding: 9px 14px; border-radius: 11px; font-weight: 600; transition: border-color .2s, color .2s, background .2s; }
.apply:hover, .refresh:hover { border-color: var(--accent); color: var(--text); background: rgba(255,255,255,.11); }
.range-summary { flex: 1 1 260px; color: var(--text-dim); font-size: 13px; }
.refresh { margin-left: auto; }

/* ── 表单字段（账号池等） ── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 7px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-row .field { margin-bottom: 0; flex: 1 1 180px; }
.form-row .field.grow { flex: 2 1 300px; }
.form-row .field.narrow { flex: 0 0 130px; }
.form-row .field.reset-url-field { flex: 1 1 min(680px, 100%); }
.reset-url-field textarea { min-height: 86px; resize: vertical; }
.account-settings-row { gap: 12px; }
.account-settings-row > .field { min-width: 180px; }
.account-settings-row > .field:nth-child(2), .account-settings-row > .field:nth-child(4) { flex: 0 0 auto; min-width: 0; }
.account-proxy-switch { min-width: 205px; align-self: flex-end; }
.proxy-config-card { margin-bottom: 18px; padding: 0; overflow: hidden; }
.proxy-overview { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; border-bottom: 1px solid var(--stroke); background: linear-gradient(120deg, rgba(234,164,198,.1), rgba(159,143,207,.045) 55%, transparent); }
.proxy-overview-copy { min-width: 0; }
.proxy-overview-copy > strong { display: block; margin: 5px 0 4px; font-size: 17px; letter-spacing: -.01em; }
.proxy-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-size: 10.5px; font-weight: 800; letter-spacing: .14em; }
.proxy-eyebrow .ic { width: 14px; height: 14px; }
.proxy-master-controls { display: flex; align-items: flex-end; gap: 12px; flex: 0 0 auto; }
.proxy-compact-field { display: grid; gap: 7px; min-width: 210px; color: var(--text-dim); font-size: 11.5px; }
.proxy-compact-field select { min-width: 210px; }
.proxy-primary-action { min-width: 110px; }
.proxy-config-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.25fr); gap: 18px; padding: 18px; }
.proxy-config-pane { display: flex; flex-direction: column; min-width: 0; min-height: 390px; overflow: hidden; border: 1px solid var(--stroke); border-radius: 14px; background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018)); box-shadow: inset 0 1px 0 rgba(255,255,255,.045); }
.proxy-config-pane.webshare-pane { border-color: rgba(159,143,207,.22); }
.proxy-pane-head { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 15px 18px; border-bottom: 1px solid var(--stroke); background: rgba(255,255,255,.025); }
.proxy-pane-head h4 { margin: 0; font-size: 14.5px; }
.proxy-pane-head p { margin: 3px 0 0; color: var(--text-dim); font-size: 11.5px; }
.proxy-pane-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; color: var(--accent); border: 1px solid rgba(234,164,198,.22); background: rgba(234,164,198,.1); }
.proxy-pane-icon.webshare { color: var(--lav); border-color: rgba(159,143,207,.28); background: rgba(159,143,207,.12); }
.proxy-pane-icon .ic { width: 17px; height: 17px; }
.proxy-source-tag { margin-left: auto; padding: 3px 8px; border: 1px solid rgba(234,164,198,.2); border-radius: 999px; color: var(--accent); background: rgba(234,164,198,.07); font-size: 9.5px; font-weight: 800; letter-spacing: .1em; }
.proxy-source-tag.webshare { color: var(--lav); border-color: rgba(159,143,207,.25); background: rgba(159,143,207,.08); }
.proxy-pane-body { flex: 1 1 auto; padding: 18px; }
.proxy-field { display: grid; gap: 8px; margin: 0; color: var(--text-dim); font-size: 12px; }
.proxy-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.proxy-field small { color: var(--text-dim); font-size: 10.5px; font-weight: 400; }
.proxy-field input, .proxy-field select, .proxy-field textarea { width: 100%; }
.proxy-field textarea { min-height: 154px; resize: vertical; line-height: 1.5; }
.proxy-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; margin-top: 16px; }
.proxy-help { display: flex; align-items: flex-start; gap: 7px; margin: 12px 0 0; color: var(--text-dim); font-size: 11.5px; line-height: 1.5; }
.proxy-help .ic { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; }
.proxy-action-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; min-height: 68px; margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--stroke); background: rgba(5,4,10,.16); }
.proxy-action-bar .btn { min-width: 118px; }
.proxy-action-bar.webshare-actions { justify-content: space-between; flex-wrap: nowrap; }
.proxy-action-status { min-width: 0; color: var(--text-dim); font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; }
.proxy-action-buttons { display: flex; flex: 0 0 auto; gap: 10px; }
.proxy-node-head { margin: 2px 2px 10px; }
.proxy-node-head h4 { font-size: 13px; }
.proxy-table-wrap { max-height: 340px; }
.proxy-node-url { display: block; color: var(--text-dim); font-size: 11px; margin-top: 4px; }
.proxy-account-select { min-width: 160px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--text-dim); }
.status-dot.good::before { background: var(--green); box-shadow: 0 0 8px rgba(75,205,145,.45); }
.status-dot.bad::before { background: var(--red); }
.usage-estimate-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; color: var(--orange); background: rgba(234,164,198,.1); border: 1px solid rgba(234,164,198,.22); font-size: 10px; font-weight: 700; vertical-align: middle; }

/* 账号列表改为纵向信息卡，不再为 11 列宽表制造横向滚动。 */
.account-list { display: grid; gap: 9px; min-width: 0; }
.account-list-empty { padding: 28px; text-align: center; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255,255,255,.025); }
.account-card { min-width: 0; overflow: hidden; border: 1px solid var(--stroke); border-radius: 15px; background: rgba(255,255,255,.035); box-shadow: inset 0 1px 0 rgba(255,255,255,.045); transition: border-color .18s, background .18s; }
.account-card:hover { border-color: rgba(var(--accent-rgb),.27); background: rgba(255,255,255,.052); }
.account-card.is-disabled { background: rgba(255,255,255,.018); }
.account-card.is-disabled .account-card-grid, .account-card.is-disabled .account-identity { opacity: .58; }
.account-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 9px; border-bottom: 1px solid var(--stroke); }
.account-identity { min-width: 0; }
.account-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.account-name { min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.account-state { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 11.5px; white-space: nowrap; }
.account-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px rgba(75,205,145,.42); }
.account-card.is-disabled .account-state { color: var(--text-dim); }
.account-card.is-disabled .account-state::before { box-shadow: none; }
.account-subline { display: flex; gap: 5px 11px; flex-wrap: wrap; margin-top: 3px; color: var(--text-dim); font-size: 10.5px; }
.account-subline span { min-width: 0; overflow-wrap: anywhere; }
.account-card-actions { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; max-width: 440px; }
.account-card-actions .row-btn { margin: 0; }
.account-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); min-width: 0; }
.account-panel { min-width: 0; padding: 9px 14px 10px; border-right: 1px solid var(--stroke); }
.account-panel:last-child { border-right: none; }
.account-detail-label { display: block; margin-bottom: 5px; color: var(--text-dim); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; }
.account-detail-main { display: block; min-width: 0; color: var(--text); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.account-detail-sub { display: block; margin-top: 2px; color: var(--text-dim); font-size: 10.5px; line-height: 1.3; overflow-wrap: anywhere; }
.account-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.account-metric { min-width: 0; padding: 4px 6px; border: 1px solid rgba(245,235,246,.09); border-radius: 8px; background: rgba(255,255,255,.03); text-align: center; }
.account-metric span { display: block; color: var(--text-dim); font-size: 9px; white-space: nowrap; }
.account-metric strong { display: block; margin-top: 1px; font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.account-proxy-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-proxy-source { color: var(--text-dim); font-size: 10.5px; white-space: nowrap; }
.account-proxy-value { display: block; margin-top: 4px; font-size: 11.5px; overflow-wrap: anywhere; word-break: break-word; }
.account-proxy-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.account-card .row-btn { height: 25px; padding: 0 8px; font-size: 11.5px; }
.account-error { display: flex; align-items: center; gap: 8px; padding: 6px 14px; color: var(--text-dim); font-size: 10.5px; border-top: 1px solid var(--stroke); background: rgba(236,138,156,.025); }
.account-error .error-button { height: 24px; }
@media (max-width: 980px) {
  .proxy-config-grid { grid-template-columns: 1fr; }
  .proxy-config-pane { min-height: 0; }
  .account-card-head { align-items: stretch; flex-direction: column; }
  .account-card-actions { justify-content: flex-start; max-width: none; }
}
@media (max-width: 680px) {
  .proxy-overview { align-items: stretch; flex-direction: column; }
  .proxy-master-controls { align-items: stretch; flex-direction: column; }
  .proxy-compact-field, .proxy-compact-field select { min-width: 0; width: 100%; }
  .proxy-field-grid { grid-template-columns: 1fr; }
  .proxy-action-bar.webshare-actions { align-items: stretch; flex-direction: column; }
  .proxy-action-buttons { width: 100%; }
  .proxy-action-buttons .btn { flex: 1 1 0; min-width: 0; }
  .account-settings-row > .field, .account-proxy-switch { flex: 1 1 100%; width: 100%; min-width: 0; }
  .account-settings-row > .field:nth-child(2), .account-settings-row > .field:nth-child(4) { flex: 1 1 calc(50% - 6px); }
  .account-card-head, .account-panel { padding-left: 14px; padding-right: 14px; }
  .account-panel { border-right: none; border-bottom: 1px solid var(--stroke); }
  .account-panel:last-child { border-bottom: none; }
}

/* ── 图片缩略 ── */
.image-list { display: flex; gap: 6px; flex-wrap: wrap; }
.image-pill { display: inline-flex; max-width: 180px; min-height: 24px; align-items: center; border: 1px solid var(--stroke); border-radius: 999px; padding: 2px 8px; color: var(--text-dim); background: rgba(255,255,255,.05); overflow: hidden; text-overflow: ellipsis; }
.image-pill a { color: var(--lav); overflow: hidden; text-overflow: ellipsis; }
.image-thumb { width: 46px; height: 46px; object-fit: cover; border: 1px solid var(--stroke); border-radius: 8px; background: rgba(0,0,0,.2); display: block; }

/* ── 异步任务详情 ── */
.async-preview { display: block; width: min(680px, 42vw); max-height: 7.25em; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; color: var(--text); line-height: 1.45; }
.task-button, .link-button { height: 30px; border: 1px solid var(--stroke); border-radius: 8px; padding: 0 12px; color: var(--text); background: rgba(255,255,255,.06); cursor: pointer; white-space: nowrap; transition: border-color .2s, background .2s; }
.task-button:hover, .link-button:hover { border-color: var(--accent); background: rgba(255,255,255,.11); }
.error-button { height: 30px; border: 1px solid rgba(236, 138, 156, .4); border-radius: 8px; padding: 0 10px; color: var(--red); background: rgba(236, 138, 156, .1); cursor: pointer; white-space: nowrap; }
.error-button:hover { background: rgba(236, 138, 156, .18); }

/* ── 账号行操作按钮 ── */
.row-actions { white-space: nowrap; }
.row-actions .row-btn + .row-btn { margin-left: 6px; }
.row-btn { height: 28px; border: 1px solid var(--stroke); border-radius: 8px; padding: 0 10px; font-size: 12.5px; color: var(--text); background: rgba(255,255,255,.06); cursor: pointer; white-space: nowrap; transition: border-color .2s, background .2s; }
.row-btn:hover { border-color: var(--accent); background: rgba(255,255,255,.11); }
.row-btn.danger { color: var(--red); border-color: rgba(236, 138, 156, .4); background: rgba(236, 138, 156, .1); }
.row-btn.danger:hover { background: rgba(236, 138, 156, .18); border-color: var(--red); }
/* 禁用行整体置灰，但操作列保持可点击。 */
tr.row-disabled > td { opacity: .45; }
tr.row-disabled > td.row-actions { opacity: 1; }
/* 自动禁用徽标：位于操作列（不置灰），突出显示原因。 */
.auto-disabled-badge { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; color: var(--red); border: 1px solid rgba(236, 138, 156, .45); background: rgba(236, 138, 156, .12); white-space: nowrap; cursor: help; }

/* ── 对话框 ── */
dialog { color: var(--text); background: var(--glass-solid); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 0; box-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 1px 0 var(--hi); }
/* 全局 *{margin:0} 会覆盖 UA 的 margin:auto，导致 showModal 弹窗跑到左上角；这里显式居中。 */
dialog[open] { margin: auto; }
dialog::backdrop { background: rgba(6, 4, 12, .58); }
/* 布局只在打开时生效；未打开时交还 UA 的 display:none，否则空弹窗会一直显示且关不掉。 */
.dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
.dialog[open] { display: flex; flex-direction: column; }
.dialog.wide { width: min(1040px, calc(100vw - 32px)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--stroke); flex: none; }
.dialog-head h2 { font-size: 17px; }
.dialog-close { height: 32px; border: 1px solid var(--stroke); border-radius: 8px; padding: 0 12px; color: var(--text); background: rgba(255,255,255,.06); cursor: pointer; }
.dialog-close:hover { border-color: var(--accent); }
.account-form-dialog { width: min(700px, calc(100vw - 32px)); }
.account-dialog-head > div { min-width: 0; }
.account-dialog-head p { margin-top: 3px; color: var(--text-dim); font-size: 11.5px; overflow-wrap: anywhere; }
.account-dialog-form { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.account-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 17px 18px; }
.account-dialog-intro { margin-bottom: 14px; padding: 11px 12px; color: var(--text-dim); font-size: 12px; line-height: 1.5; border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,.035); }
.account-dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.account-dialog-field { display: grid; min-width: 0; gap: 6px; color: var(--text-dim); font-size: 11.5px; }
.account-dialog-field.wide { grid-column: 1 / -1; }
.account-dialog-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.account-dialog-field small { color: rgba(201,188,212,.72); font-size: 10px; }
.account-dialog-field textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.account-dialog-field textarea.tall { min-height: 165px; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 12px; }
.account-dialog-field .invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(236,138,156,.12); }
.account-dialog-error { min-height: 17px; margin-top: 9px; color: var(--red); font-size: 11.5px; }
.account-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 18px; border-top: 1px solid var(--stroke); background: rgba(5,4,10,.15); }
.account-dialog-actions .btn { min-width: 92px; }
.account-dialog-actions .btn.danger { color: #2a1018; background: linear-gradient(180deg, #ef9aaa, #d96f83); box-shadow: 0 6px 18px rgba(236,138,156,.22); }
.error-detail { max-height: min(56vh, 520px); margin: 0; padding: 16px 18px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 ui-monospace, Consolas, Menlo, monospace; color: #ffd7de; }
/* 弹窗：KPIs 固定在顶部，task-body 作为唯一滚动区，避免外层+内层双滚动条。 */
.task-detail { padding: 16px 18px; overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.task-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; flex: none; }
.task-body { overflow: auto; flex: 1; min-height: 0; }
.task-kpi { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,.04); padding: 10px 12px; }
.task-kpi span { display: block; color: var(--text-dim); font-size: 12px; }
.task-kpi strong { display: block; margin-top: 4px; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.task-block { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,.03); margin-top: 12px; overflow: hidden; }
.task-block-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--stroke); color: var(--text-dim); font-weight: 700; }
.task-block summary.task-block-title { cursor: pointer; list-style: none; }
.task-block summary.task-block-title::-webkit-details-marker { display: none; }
.task-text { margin: 0; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font: 13px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; color: var(--text); }
.task-scroll { max-height: 260px; overflow: auto; }
.task-body > .task-block:first-child { margin-top: 0; }
.task-images { padding: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.task-muted { color: var(--text-dim); font-weight: 500; }
.task-error { color: #ffd0d8; }

/* ── toast ── */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(22px); padding: 13px 24px; font-size: 13px; opacity: 0; transition: all .34s var(--ease); pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 移动端菜单 ── */
.menu-btn { display: none; position: fixed; top: 14px; left: 14px; z-index: 99; width: 40px; height: 40px; border: 1px solid var(--stroke); background: var(--glass); border-radius: 11px; align-items: center; justify-content: center; color: var(--text); }
.menu-btn svg { width: 20px; height: 20px; stroke-width: 2; }
.menu-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.menu-overlay.open { opacity: 1; pointer-events: auto; }

/* ── 响应式 ── */
@media (pointer: coarse) {
  *::-webkit-scrollbar { width: 7px; height: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *::-webkit-scrollbar-thumb { transition: none; }
}
@media (max-width: 1000px) {
  .task-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .menu-btn { display: flex; }
  #app { grid-template-columns: 1fr; padding: 0; gap: 0; }
  aside {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    width: 260px; border-radius: 0; transform: translateX(-100%);
    transition: transform .3s var(--ease); padding: 20px 14px;
  }
  aside.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .main-content { padding: 16px; padding-top: 68px; }
  main { border-radius: 0; }
  .page-head h2 { font-size: 20px; }
	.reasoning-policy-card { align-items: stretch; flex-direction: column; }
	.reasoning-policy-actions { justify-content: flex-start; }
  .subagent-limit-control { min-width: min(100%, 238px); }
  .async-preview { width: min(70vw, 420px); }
  .refresh { margin-left: 0; }
}
@media (max-width: 600px) {
  .grid.stats { grid-template-columns: 1fr 1fr; }
  .task-kpis { grid-template-columns: 1fr; }
  .preset-group { width: 100%; }
  .preset { flex: 1; text-align: center; }
  .async-preview { width: min(78vw, 320px); }
  .account-dialog-fields { grid-template-columns: 1fr; }
  .account-dialog-field.wide { grid-column: auto; }
}
@media (max-width: 480px) {
  .grid.stats { grid-template-columns: 1fr; }
  .toast { left: 16px; right: 16px; transform: translateY(22px); text-align: center; }
  .toast.show { transform: translateY(0); }
}
