/* RETRO//STRESS panel · MudBlazor 风格 (无 JS) */
:root {
  --accent: #00ff41;
  --accent-dim: #0c3;
  --accent-subtle: rgba(0, 255, 65, .15);
  --accent-muted: rgba(0, 255, 65, .08);
  --bg-base: #0a0a0a;
  --bg-surface: #111;
  --bg-elevated: #171717;
  --bg-hover: #1c1c1c;
  --border-subtle: rgba(255, 255, 255, .06);
  --border-default: rgba(255, 255, 255, .1);
  --border-strong: rgba(255, 255, 255, .15);
  --text-primary: rgba(255, 255, 255, .95);
  --text-secondary: rgba(255, 255, 255, .65);
  --text-tertiary: rgba(255, 255, 255, .45);
  --text-muted: rgba(255, 255, 255, .3);
  --success: #00ff41;
  --warning: #ffb800;
  --error: #f44;
  --font-sans: 'Inter', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
  --font-mono: 'SF Mono', Consolas, 'Roboto Mono', ui-monospace, monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-glow: 0 0 20px rgba(0, 255, 65, .15);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  zoom: 0.9;              /* 整体缩小 10% */
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, label, select, input[type="range"] { cursor: pointer; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--bg-base); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ---------- 顶部栏 (MudAppBar) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 22px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.appbar .logo { display: flex; align-items: center; gap: 10px; color: var(--text-primary); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.appbar .logo-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--accent-border, rgba(0,255,65,.3)); border-radius: 8px; background: var(--accent-muted); color: var(--accent); font: 800 13px var(--font-mono); box-shadow: 0 0 14px rgba(0,255,65,.12); }
.appbar .page-title { color: var(--text-secondary); font-size: 13px; border-left: 1px solid var(--border-default); padding-left: 14px; }
.appbar .status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary, #bbb); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.offline { background: var(--error); }

/* ---------- 布局：侧边栏 + 主区 ---------- */
.app-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.drawer {
  border-right: 1px solid var(--border-subtle);
  background: #0e0e0e;
  padding: 16px 10px;
}
.drawer .nav-group { margin-bottom: 18px; }
.drawer .nav-group-title { padding: 6px 12px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.drawer a, .drawer .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; transition: background .15s ease, color .15s ease;
}
.drawer a:hover, .drawer .nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.drawer a.active, .drawer .nav-item.active { background: var(--accent-muted); color: var(--accent); }
.drawer .nav-item .ico { width: 16px; text-align: center; font-size: 12px; opacity: .8; }
.main { padding: 24px; min-width: 0; }

/* ---------- 统计卡片 (stat-card) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: border-color .2s ease, transform .2s ease;
}
.stat-card:hover { border-color: var(--border-default); transform: translateY(-2px); }
.stat-label { font-size: 11px; font-weight: 500; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .08em; }
.stat-number { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ---------- 数据面板 (data-panel) ---------- */
.data-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.data-panel .panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.data-panel .panel-head strong { font-size: 14px; font-weight: 600; }
.data-panel .panel-head .panel-sub { color: var(--text-tertiary); font-size: 12px; }
.data-panel .panel-head .chip { margin-left: auto; }
.panel-body { padding: 18px; }

/* ---------- 徽章 / 标签 (mud-chip) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: var(--accent-muted); color: var(--accent);
  border: 1px solid rgba(0,255,65,.18);
}
.chip.gray { background: rgba(255,255,255,.06); color: var(--text-secondary); border-color: var(--border-default); }
.chip.red { background: rgba(255,68,68,.1); color: var(--error); border-color: rgba(255,68,68,.25); }

/* ---------- 表单 (MudTextField / MudSelect / MudSlider) ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; max-width: 860px; }
.field { margin-bottom: 4px; }
.field > label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.mud-input {
  width: 100%; height: 42px;
  display: flex; align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-primary);
  transition: border-color .15s ease;
}
.mud-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,255,65,.2); }
.mud-input input, .mud-input select {
  width: 100%; height: 100%;
  background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font-size: 14px;
}
.mud-input input { font-family: var(--font-mono); font-size: 13px; }
.mud-input input::placeholder { color: var(--text-muted); }
.mud-input.mud-input-with-btn { display: flex; align-items: center; padding-right: 8px; gap: 8px; }
.mud-input.mud-input-with-btn input { flex: 1; min-width: 0; }
.input-side-btn {
  flex: 0 0 auto;
  align-self: center;
  height: 18px;
  max-height: 18px;
  line-height: 16px;
  padding: 0 6px;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: var(--bg-hover, rgba(255,255,255,.04));
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.input-side-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted, rgba(0,255,65,.12)); }
.input-side-btn:active { background: var(--accent-subtle, rgba(0,255,65,.15)); }
.mud-input select { appearance: none; -webkit-appearance: none; }
/* 下拉选项：暗色背景 + 亮色文字（修复 Windows 白底白字） */
.mud-input select option {
  background: #171717;
  color: #f2f2f2;
  font-size: 13px;
  padding: 4px 8px;
}
.mud-input select option:hover,
.mud-input select option:checked {
  background: var(--accent-muted);
  color: var(--accent);
}
.mud-input select optgroup {
  background: #101010;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
}
.mud-select { position: relative; }
.mud-select::after { content: "▾"; position: absolute; right: 12px; color: var(--text-tertiary); font-size: 10px; pointer-events: none; }
.field-hint { display: block; margin-top: 6px; color: var(--text-muted); font-size: 11px; }
.field-hint b { color: var(--accent); font-weight: 600; }

/* 层级 tabs（chip 式） */
.layer-tabs { display: flex; gap: 8px; margin: 4px 0 16px; }
.layer-tabs label { position: relative; }
.layer-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.layer-tabs span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: all .15s ease;
}
.layer-tabs input:checked + span { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.layer-tabs span .layer-badge {
  font: 600 9px var(--font-mono); padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.08); color: var(--text-tertiary);
}
.layer-tabs input:checked + span .layer-badge { background: var(--accent); color: var(--bg-base); }

/* 滑动条 (MudSlider) */
.range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; max-width: 560px; }
.range-field { min-width: 0; }
.range-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
  color: var(--text-secondary); font-size: 12px; font-weight: 500;
}
.range-top label { cursor: pointer; }
.range-field output { color: var(--accent); font: 600 13px var(--font-mono); }
.range-field input[type="range"] { width: 100%; height: 20px; margin: 2px 0 0; appearance: none; -webkit-appearance: none; background: transparent; }
.range-field input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--bg-hover); }
.range-field input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; appearance: none; -webkit-appearance: none; border: 3px solid #dfffe8; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.range-field input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--bg-hover); }
.range-field input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid #dfffe8; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* 启动按钮 (MudButton filled) */
.launch-btn {
  width: 220px; height: 44px; margin-top: 18px;
  border: 0; border-radius: var(--radius-md);
  background: var(--accent); color: var(--bg-base);
  font-size: 14px; font-weight: 700; letter-spacing: .04em;
  transition: all .2s ease;
}
.launch-btn:hover { background: var(--accent-dim); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.launch-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- 运行中表格 (mud-table) ---------- */
.table-wrap { overflow-x: auto; }
.mud-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.mud-table thead th {
  padding: 6px 8px;
  color: var(--text-tertiary);
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.mud-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}
.mud-table tbody tr:hover { background: var(--bg-hover); }
.mud-table tbody tr:last-child td { border-bottom: 0; }
.td-mono { font-family: var(--font-mono); font-size: 12px; }
.mud-table .td-mono.td-key-name,
.mud-table .td-target { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.mud-table .progress-cell { min-width: 120px; max-width: 180px; }
.cell-method { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.progress-cell { min-width: 150px; }
.progress { height: 4px; border-radius: 4px; background: var(--accent-muted); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.seconds { color: var(--text-secondary); font: 500 12px var(--font-mono); margin-top: 4px; }
.btn-stop {
  padding: 5px 14px;
  border: 1px solid rgba(255,68,68,.35);
  border-radius: var(--radius-sm);
  background: rgba(255,68,68,.08);
  color: #ff8080;
  font-size: 12px;
  transition: all .15s ease;
}
.btn-stop:hover { background: rgba(255,68,68,.18); border-color: var(--error); }
.btn-stop-all {
  padding: 5px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  transition: all .15s ease;
}
.btn-stop-all:hover { background: var(--bg-hover); color: var(--text-primary); }
.empty-state {
  padding: 46px 20px; text-align: center;
  color: var(--text-tertiary); font-size: 13px;
}
.empty-state .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ---------- Toast (bubble stack, newest on top, max 5) ---------- */
#toastHost {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 36px));
}
.toast {
  position: relative;
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 400px; width: max-content; min-width: 200px;
  padding: 12px 16px 12px 14px;
  background: rgba(12, 18, 16, .92);
  border: 1px solid rgba(0, 255, 65, .22);
  border-radius: 18px 18px 4px 18px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45), 0 0 16px rgba(0, 255, 65, .08);
  backdrop-filter: blur(8px);
  animation: toastBubbleIn .28s cubic-bezier(.2,.8,.2,1);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.toast.ok::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
.toast.error {
  border-color: rgba(255, 68, 68, .4);
  border-radius: 18px 18px 4px 18px;
}
.toast.error::before { background: var(--error); box-shadow: 0 0 8px var(--error); }
.toast.info::before { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.toast.plan {
  border-color: rgba(46, 230, 200, .55);
  background: linear-gradient(135deg, rgba(8, 48, 46, .96), rgba(12, 36, 52, .96));
  color: #dffcf6;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 18px rgba(46, 230, 200, .18);
}
.toast.plan::before { background: #2ee6c8; box-shadow: 0 0 10px #2ee6c8; }
.toast.plan .toast-title { display: block; font-weight: 700; color: #7dffe6; margin-bottom: 4px; }
.toast.plan .toast-msg { display: block; color: #dffcf6; line-height: 1.4; word-break: break-all; }
@keyframes toastBubbleIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 提示条（未配置 key 等） ---------- */
.notice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 18px;
  border: 1px solid rgba(255,184,0,.3);
  border-radius: var(--radius-md);
  background: rgba(255,184,0,.06);
  color: var(--text-secondary);
  font-size: 13px;
}
.notice b { color: var(--warning); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .launch-wrap { flex-direction: column; }
  .mini-stats { width: 100%; grid-template-columns: repeat(4, 1fr); }
  .compact-grid { grid-template-columns: 1fr 1fr; }
  .compact-grid .method-desc { grid-column: 1 / -1; min-height: auto; }
}
@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .drawer { display: none; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .compact-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- 自动续测开关 ---------- */
.auto-reload-row { margin-top: 18px; }
.auto-reload-label {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  color: var(--text-secondary); font-size: 13px;
}
.auto-reload-label input { position: absolute; opacity: 0; pointer-events: none; }
.auto-reload-box {
  width: 18px; height: 18px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-elevated);
  transition: all .15s ease;
}
.auto-reload-box::after {
  content: "✓"; color: var(--bg-base);
  font-size: 12px; font-weight: 800; opacity: 0;
  transform: scale(.5); transition: all .15s ease;
}
.auto-reload-label input:checked + .auto-reload-box {
  background: var(--accent); border-color: var(--accent);
}
.auto-reload-label input:checked + .auto-reload-box::after { opacity: 1; transform: scale(1); }
.auto-reload-label input:checked ~ .auto-reload-text { color: var(--accent); }

/* ---------- Toast 消失动画 ---------- */
.toast { transition: opacity .35s ease, transform .35s ease; }
.toast.hide { opacity: 0; transform: translateY(8px) scale(.96); }

/* ---------- API Key 选择行（已迁到 panel-head，样式保留兼容） ---------- */
.key-row {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  max-width: 460px;
}
.key-row .field-label {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap;
}
.key-select { flex: 1; min-width: 0; }
.key-select select { padding: 7px 32px 7px 12px; height: 36px; }
.key-row .field-hint { color: var(--text-tertiary); font-size: 11px; }

/* ---------- 刷新时间指示 ---------- */
.refresh-time {
  font: 12px var(--font-mono);
  color: var(--text-tertiary);
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

/* ---------- 方法说明 ---------- */
.method-desc {
  padding: 10px 12px;
  min-height: 52px;
  display: flex; align-items: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--text-secondary);
  font-size: 12px; line-height: 1.5;
}

/* ---------- 启动表单：左表单 + 右统计（同一面板内） ---------- */
.launch-wrap { display: flex; gap: 18px; align-items: flex-start; }
.launch-fields { flex: 1; min-width: 0; }

/* 同一行：持续时间 | 并发数量 | 方法说明（前两列缩小50%） */
.compact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.5fr) minmax(0, 0.5fr) minmax(0, 2fr);
  gap: 14px;
  margin-top: 12px;
  align-items: stretch;
}

/* 缩小版统计卡（测试方法右侧） */
.mini-stats {
  width: 208px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
.mini-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
}
.mini-stat span { display: block; font-size: 10px; color: var(--text-tertiary); }
.mini-stat b { display: block; font: 700 19px var(--font-mono); color: var(--accent); margin: 3px 0 1px; }
.mini-stat i { display: block; font-style: normal; font-size: 9px; color: var(--text-tertiary); }

/* ---------- 计划任务面板 ---------- */
.sched-key-inline {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap;
}
.sched-key-inline select {
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 12px; max-width: 180px;
}
/* 测试页：API Key 紧挨「异步 · 不刷新」右侧 */
.test-key-inline { margin-left: 0; }
.test-key-inline select { max-width: 200px; min-width: 120px; }
.data-panel.test-main-panel .panel-head .chip { margin-left: auto; }
.data-panel.test-main-panel .panel-head .test-key-inline { margin-left: 0; }

/* − / + 数值步进器 */
.num-stepper {
  display: inline-flex; align-items: stretch;
  height: 36px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  max-width: 100%;
}
.num-stepper-btn {
  width: 36px; flex: 0 0 36px;
  border: 0; background: transparent;
  color: var(--text-primary);
  font-size: 18px; font-weight: 600; line-height: 1;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.num-stepper-btn:hover { background: var(--bg-hover); color: var(--accent); }
.num-stepper-btn:active { background: var(--accent-muted); }
.num-stepper-val {
  width: 64px; min-width: 48px; flex: 1 1 auto;
  border: 0; border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--accent);
  font: 600 14px var(--font-mono);
  text-align: center;
  outline: 0;
  -moz-appearance: textfield;
}
.num-stepper-val::-webkit-outer-spin-button,
.num-stepper-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,255,65,.2); }
.range-field .num-stepper { width: 100%; height: 38px; }

.td-key-name { color: var(--accent); font-weight: 600; white-space: nowrap; }
.s-key-chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.s-meta .s-dur b, .s-meta .s-conc b, .s-meta .s-key b { color: var(--accent); font-weight: 700; }
.sched-row2 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
  align-items: end;
  max-width: 860px;
}
.sched-row2 .field { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sched-row2 .field > label { white-space: nowrap; margin: 0; }
.sched-row2 .field-hint { color: var(--text-tertiary); font-size: 11px; line-height: 1.4; }
.sched-row2 .mud-input { width: 100%; }
.sched-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.sched-actions .launch-btn { margin-top: 0; }
.sched-list-head { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding-bottom: 2px; min-width: 0; }
.sched-list-head strong { font-size: 13px; color: var(--text-secondary); flex: 0 0 auto; }
.sched-list-head .sched-cap-hint {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
  text-align: right;
  color: #ffb4b4;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 62%;
}
.sched-list-head .sched-cap-hint:empty { display: none; }
.sched-list-head .btn-stop-all { margin-left: 8px; flex: 0 0 auto; }
.sched-card {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 8px; margin-bottom: 6px;
  background: var(--bg-elevated);
  transition: border-color .15s ease;
  min-width: 0;
  overflow: hidden;
  height: 36px;
  box-sizing: border-box;
}
.sched-card:hover { border-color: var(--border-default); }
.sched-card.s-off { opacity: .55; }
.sched-card.s-running {
  border-color: rgba(0, 255, 65, .65);
  box-shadow: 0 0 0 1px rgba(0, 255, 65, .35), 0 0 18px rgba(0, 255, 65, .22);
  background-color: rgba(0, 255, 65, .06);
  background-image:
    linear-gradient(90deg, rgba(0, 255, 65, .14) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 255, 65, .14) 1px, transparent 1px),
    repeating-linear-gradient(135deg, rgba(0, 255, 65, .16) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(45deg, rgba(0, 255, 65, .10) 0 2px, transparent 2px 10px);
  background-size: 10px 10px, 10px 10px, 20px 20px, 20px 20px;
  animation: sched-grid-run 1.1s linear infinite;
}
.sched-card.s-running .s-name { color: var(--accent); }
@keyframes sched-grid-run {
  0% { background-position: 0 0, 0 0, 0 0, 0 0; filter: brightness(1); }
  50% { filter: brightness(1.18); }
  100% { background-position: 10px 0, 0 10px, 20px 0, 0 20px; filter: brightness(1); }
}
.sched-card > .chip {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 2px 7px;
  font-size: 11px;
}
.sched-card .s-main {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.sched-card .s-name {
  flex: 0 0 auto;
  font-weight: 600; font-size: 12px; color: var(--accent);
  white-space: nowrap;
}
.sched-card .s-countdown {
  flex: 0 0 auto;
  font: 600 12px var(--font-mono);
  color: var(--warning);
  white-space: nowrap;
  margin-left: 0 !important;
}
.sched-card .s-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-card .s-target {
  color: var(--error);
  font-weight: 700;
  font-family: var(--font-mono);
  animation: s-target-blink .7s ease-in-out infinite;
}
@keyframes s-target-blink {
  0%, 100% { color: var(--error); text-shadow: 0 0 0 transparent; opacity: 1; }
  50% { color: #ff8888; text-shadow: 0 0 10px rgba(255,68,68,.85); opacity: .72; }
}
.sched-card .s-conc {
  color: #ffcc33;
  font-weight: 700;
  font-family: var(--font-mono);
}
.sched-card .s-err { display: none; }
.sched-card .s-actions {
  margin-left: 6px;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.sched-card .s-actions .btn-stop-all,
.sched-card .s-actions .btn-stop {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  width: auto;
  white-space: nowrap;
}
.sched-card .s-badge { font-size: 11px; }
/* 时间输入暗色适配 */
.mud-input input[type="time"] {
  font-family: var(--font-mono); font-size: 13px;
  color-scheme: dark;
}
.mud-input input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .7; }

@media (max-width: 860px) {
  .sched-row2 { grid-template-columns: 1fr; align-items: stretch; }
  .sched-row2 .field,
  .sched-row2 .field .mud-input,
  .sched-row2 .field .field-hint { width: 100% !important; }
}

/* ---------- 调试开关 + 实时日志弹窗 ---------- */
.debug-fab {
  position: fixed; left: 18px; bottom: 18px; z-index: 90;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border: 1px solid rgba(0,255,65,.3);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all .15s ease;
}
.debug-fab:hover { background: var(--accent-muted); box-shadow: var(--shadow-glow); }

.debug-panel {
  position: fixed; left: 18px; bottom: 64px; z-index: 95;
  width: min(680px, calc(100vw - 36px));
  max-height: 60vh;
  display: flex; flex-direction: column;
  background: #0d0d0d;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.debug-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.debug-head strong { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.debug-switch {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--text-secondary);
}
.debug-switch input { accent-color: var(--accent); cursor: pointer; }
.debug-head .btn-stop-all { margin-left: auto; }
.debug-log {
  margin: 0; padding: 14px;
  flex: 1 1 auto; overflow: auto;
  font: 12px/1.6 var(--font-mono);
  color: #c9ffd6;
  background: #050505;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------- 计划卡片内的倒计时 ---------- */
.sched-card .s-countdown {
  font: 600 12px var(--font-mono);
  color: var(--warning);
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: 0 !important;
}
.sched-card.s-running .s-countdown { color: var(--accent); }
.sched-card.s-off .s-countdown { color: var(--text-muted); }

/* ---------- 计划触发弹窗 ---------- */
.popup-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .6);
}
.popup-box {
  position: fixed; left: 50%; top: 50%; z-index: 301;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 40px));
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 22px;
  color: var(--text-primary);
}
.popup-title {
  font-size: 15px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.popup-msg {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 16px; line-height: 1.6;
  word-break: break-all;
}
.popup-box .btn-stop-all { display: block; margin-left: auto; }

/* ---------- API Key 管理 ---------- */
.keys-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 960px;
}
.keys-form-grid .field { margin: 0; }
.keys-list { margin-top: 14px; }
.keys-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--bg-elevated);
}
.keys-card .s-actions { margin-left: auto; display: flex; gap: 8px; }
.keys-card .s-meta b { color: var(--accent); font-family: var(--font-mono); }
.mud-input:has(textarea),
.mud-input.mud-textarea {
  display: block;          /* 关闭 flex，彻底避免贴边绘制 */
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  overflow: hidden;
  align-items: unset;
}
.mud-input textarea {
  display: block;
  width: 100%;
  min-height: 68px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--text-primary);
  font: 13px/1.5 var(--font-mono);
  box-sizing: border-box;
  overflow: auto;
  vertical-align: top;
}
@media (max-width: 860px) {
  .keys-form-grid { grid-template-columns: 1fr 1fr; }
}


/* ---------- 计划页 / 测试页：左边主面板，右边单独腾空做历史框 ---------- */
.sched-frame,
.test-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px; /* 右侧固定腾出历史框空间 */
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
  width: 100%;
}
.sched-main-panel,
.test-main-panel { min-width: 0; margin-bottom: 0; }
.data-panel.test-main-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}
.data-panel.test-main-panel > .panel-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sched-main-panel .layer-tabs,
.test-main-panel .layer-tabs {
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  margin: 0;
}
.sched-main-panel .layer-tabs label,
.test-main-panel .layer-tabs label { flex: 0 0 auto; }

/* 测试页：L4/L7 与迷你统计同一行，统计靠右 */
.layer-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.mini-stats-inline {
  width: auto;
  flex: 0 1 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
  align-content: center;
  margin-left: auto;
}
.mini-stats-inline .mini-stat {
  padding: 6px 8px;
  min-width: 0;
}
.mini-stats-inline .mini-stat span { font-size: 9px; }
.mini-stats-inline .mini-stat b { font-size: 15px; margin: 2px 0 0; }
.mini-stats-inline .mini-stat i { font-size: 8px; }

.td-target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  word-break: break-all;
}
.btn-copy-target {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.btn-copy-target:hover {
  color: var(--accent);
  border-color: rgba(0,255,65,.4);
  background: var(--accent-muted);
}

/* 右侧独立 data-panel 历史框 */
.data-panel.hist-panel {
  min-width: 0;
  width: 100%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 480px;
  background: var(--bg-surface);
}
.data-panel.hist-panel .panel-head.hist-wx-bar {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #161616;
}
.data-panel.hist-panel .hist-wx-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: .02em;
}
.hist-wx-ico {
  margin-left: auto;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--accent);
  font-size: 16px; cursor: pointer;
}
.hist-wx-ico:hover { background: var(--accent-muted); }
.hist-panel-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  min-height: 0;
}
.hist-list,
.hist-wx-list {
  flex: 1 1 auto;
  display: flex; flex-direction: column; gap: 0;
  overflow: auto;
  padding: 0;
  max-height: none;
  min-height: 320px;
  background: #101010;
}
.hist-wx-empty {
  padding: 36px 16px; text-align: center;
  color: var(--text-tertiary); font-size: 13px;
}
.hist-wx-sep {
  padding: 6px 14px 4px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  background: #0c0c0c;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hist-wx-item {
  border-bottom: 1px solid var(--border-subtle);
  background: #101010;
  transition: background .12s ease;
}
.hist-wx-item:hover { background: #171717; }
.hist-wx-item.is-pin { background: rgba(0,255,65,.04); }
.hist-wx-main {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 12px;
  min-width: 0;
}
.hist-qr { flex: 0 0 auto; display: block; color: #00ff41; }
.hist-qr-inline { display: inline-flex; flex: 0 0 auto; }
.hist-wx-text { flex: 1 1 auto; min-width: 0; }
.hist-wx-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.hist-wx-sub {
  margin-top: 2px;
  font: 11px/1.3 var(--font-mono);
  color: var(--text-tertiary);
}
.hist-wx-ops {
  flex: 0 0 auto;
  display: flex; gap: 4px;
  opacity: .55;
}
.hist-wx-item:hover .hist-wx-ops { opacity: 1; }
.hist-op {
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 5px;
  cursor: pointer;
  line-height: 1.4;
}
.hist-op.primary { color: var(--accent); border-color: rgba(0,255,65,.35); }
.hist-op.danger { color: #ff8080; border-color: rgba(255,68,68,.35); }
.hist-op:hover { background: var(--bg-hover); }
.hist-wx-foot {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  background: #141414;
  margin-top: auto;
}
.hist-wx-more {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.hist-wx-more:hover { color: var(--accent); border-color: rgba(0,255,65,.35); }
.hist-wx-hint {
  margin-left: auto;
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap;
}
.hist-card, .hist-row, .hist-title, .hist-meta, .hist-actions, .hist-more-row, .hist-pin-chip { /* legacy unused */ }
.hist-view-pre {
  margin: 0 0 14px;
  padding: 12px;
  max-height: 40vh; overflow: auto;
  background: #050505;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #c9ffd6;
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap; word-break: break-all;
}
.hist-replace-box { width: min(480px, calc(100vw - 40px)); }
.hist-replace-list {
  max-height: 40vh; overflow: auto;
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
}
.hist-replace-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
}
.hist-replace-item:hover { border-color: rgba(0,255,65,.35); }
.hist-replace-item input { accent-color: var(--accent); }
.hist-replace-label { font-size: 12px; color: var(--text-primary); min-width: 0; }
.hist-replace-label small { color: var(--text-tertiary); }
.hist-replace-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }

@media (max-width: 980px) {
  .sched-frame,
  .test-frame { grid-template-columns: 1fr; }
  .data-panel.hist-panel { min-height: 420px; max-height: 70vh; }
  .mini-stats-inline { width: 100%; margin-left: 0; grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
  .mini-stats-inline { grid-template-columns: 1fr 1fr; }
}



.btn-clear-cache {
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: #1a1a1a;
  color: var(--text-secondary, #bbb);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.btn-clear-cache:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted, rgba(255,180,80,.12));
}
.btn-clear-cache:disabled { opacity: .6; cursor: wait; }


/* 测试页：运行中固定在 test-main-panel 内部底部 */
.active-under-launch,
.active-inline-panel {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed rgba(0, 255, 65, .28);
  clear: both;
  flex: 0 0 auto;
  width: 100%;
}
.active-under-launch > .active-under-head,
.active-under-launch > .panel-head,
.active-inline-panel > .panel-head {
  padding: 0 0 10px;
  margin: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.active-under-launch > .active-under-head strong,
.active-under-launch > .panel-head strong,
.active-inline-panel > .panel-head strong {
  font-size: 13px;
  color: var(--accent);
}
.active-under-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.active-under-head .btn-stop-all { margin-left: auto; }

.active-under-launch > .panel-body,
.active-inline-panel > .panel-body {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}
.active-under-launch #chipActive,
.active-inline-panel #chipActive {
  max-width: min(520px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 0;
}
.test-main-panel .launch-fields { margin-bottom: 0; flex: 0 0 auto; }
.test-main-panel #launchForm { flex: 0 0 auto; }
.test-main-panel > .panel-body {
  display: block;
}
