
  /* ============ 主题变量: 深色为默认, 浅色经 prefers-color-scheme / [data-theme] 覆盖 ============
     语义色规约: 红=严重 黄=关注 绿=正常 灰=历史 蓝=交互。
     文本档均按 WCAG AA(≥4.5:1)对各自主题底色校准; 终端画面(termlog)双主题保持深色。
     面板垂直节奏: 所有顶层面板 margin-bottom 统一走 --gap-panel(桌面 14 / 移动 12)。 */
  :root {
    --gap-panel: 14px;
    color-scheme: dark;
    --bg: #0b0d14; --bg-elev: #121522; --bg-panel: #131726; --bg-deep: #0e111a;
    --bg-input: #121522; --bg-hover: #1a1e30; --bg-active: #22273d;
    --border: rgba(255,255,255,.08); --border-soft: rgba(255,255,255,.06); --border-faint: rgba(255,255,255,.04);
    --btn-bg: #1c2133; --btn-hover: #252b42; --btn-press: #2d3450; --btn-border: rgba(255,255,255,.1);
    --btn-soft-bg: #151928; --btn-soft-border: rgba(255,255,255,.08); --btn-soft-hover-bd: rgba(255,255,255,.18);
    --chip-bg: #151928; --chip-border: rgba(255,255,255,.08);
    --chip-on-bg: #f8fafc; --chip-on-tx: #0b0d14;
    --text-title: #f8fafc; --text-hi: #f1f5f9; --text: #cbd5e1; --text-mid: #94a3b8;
    --text-soft: #64748b; --text-dim: #94a3b8; --text-faint: #64748b;
    --text-ghost: #475569; --text-dead: #334155;
    --header-bg: rgba(11,13,20,.88); --tabbar-bg: rgba(14,17,26,.85);
    /* iOS Liquid Glass 材质: 悬浮胶囊/浮动按钮/玻璃圆钮共用 */
    --glass-bg: rgba(28,28,30,.72); --glass-bd: rgba(255,255,255,.08);
    --glass-shadow: 0 10px 30px rgba(0,0,0,.36);
    --nav-pill: rgba(0,0,0,.42); --accent: #0a84ff;
    --scrim: rgba(0,0,0,.92); --skel: #1a1a1a; --focus: #4a90d9;
    --c-red: #e06c6c; --c-red-bg: #2a1a1a;
    --c-warn: #f0b662; --c-warn-bg: #2a2118; --c-warn-border: #5a4422;
    --c-green: #6ec89a; --c-green-bg: #14261c; --c-green-btn: #2e7d4f;
    --c-orange: #e0884c; --c-gray: #9a9a9a; --c-blue: #8ab4f8;
    --c-violet: #9d8cf5; --c-violet-soft: #6b5bd6;
    --link-blue: #6ea8dc; --dot-off: #555;
    --accent-blue-bg: #1d2733; --accent-blue-bd: #2c3a4d; --accent-blue-tx: #9db8d9;
    --accent-blue-hover: #243445; --detail-bg: #101418;
    --tbadge-wd-bg: #2a2010; --tbadge-wd-tx: #e0a84c; --tbadge-wd-bd: #4a3a18;
    --tbadge-rd-bg: #1e2832; --tbadge-rd-tx: #6ea8dc; --tbadge-rd-bd: #26405a;
    --tbadge-sc-bg: #1c1c1c; --tbadge-sc-tx: #9a9a9a; --tbadge-sc-bd: #2e2e2e;
    --term-bg: #0a0e12; --term-bd: #1c242e; --term-tx: #9fd4a0;
    --ts-dim: #5c7a9a; --evt-ts: #63849f;
    --ch-cpu: #6ea8dc; --ch-load: #6ec89a; --ch-mem: #e0a84c; --ch-swap: #b48ead;
    --ch-grid: #1c1c1c;
  }
  /* 浅色: 同一组变量(跟随系统且未被 [data-theme=dark] 覆盖时生效) */
  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
      color-scheme: light;
      --bg: #f2f2f7; --bg-elev: #fff; --bg-panel: #fafafa; --bg-deep: #ececec;
      --bg-input: #fff; --bg-hover: #e9e9e9; --bg-active: #e2e2e2;
      --border: #e0e0e0; --border-soft: #e4e4e4; --border-faint: #eaeaea;
      --btn-bg: #e4e4e4; --btn-hover: #d8d8d8; --btn-press: #d0d0d0; --btn-border: #c9c9c9;
      --btn-soft-bg: #fff; --btn-soft-border: #c9c9c9; --btn-soft-hover-bd: #999;
      --chip-bg: #fff; --chip-border: #cfcfcf;
      --chip-on-bg: #1f1f1f; --chip-on-tx: #fff;
      --text-title: #111; --text-hi: #1a1a1a; --text: #242424; --text-mid: #333;
      --text-soft: #464646; --text-dim: #575757; --text-faint: #666;
      --text-ghost: #757575; --text-dead: #8f8f8f;
      --header-bg: rgba(245,245,245,.92); --tabbar-bg: rgba(250,250,250,.86);
      --glass-bg: rgba(242,242,247,.72); --glass-bd: rgba(0,0,0,.06);
      --glass-shadow: 0 10px 30px rgba(0,0,0,.12);
      --nav-pill: rgba(118,118,128,.24); --accent: #0066cc;
      --scrim: rgba(0,0,0,.55); --skel: #e2e2e2; --focus: #2b6cb0;
      --c-red: #b33939; --c-red-bg: #fbeaea;
      --c-warn: #8a5800; --c-warn-bg: #fdf3dd; --c-warn-border: #e3c88f;
      --c-green: #1e7d4f; --c-green-bg: #e6f4ec; --c-green-btn: #1e7d4f;
      --c-orange: #a85413; --c-gray: #5f6368; --c-blue: #2b6cb0;
      --c-violet: #6c5ce7; --c-violet-soft: #5a4bd0;
      --link-blue: #2b6cb0; --dot-off: #b8b8b8;
      --accent-blue-bg: #e8f0fb; --accent-blue-bd: #c4d8f0; --accent-blue-tx: #3a6ea5;
      --accent-blue-hover: #d8e7fa; --detail-bg: #f0f5fa;
      --tbadge-wd-bg: #fdf3dd; --tbadge-wd-tx: #8a5800; --tbadge-wd-bd: #e6cf9e;
      --tbadge-rd-bg: #e8f0fb; --tbadge-rd-tx: #3a6ea5; --tbadge-rd-bd: #c4d8f0;
      --tbadge-sc-bg: #ececec; --tbadge-sc-tx: #5c5c5c; --tbadge-sc-bd: #d5d5d5;
      --ts-dim: #5a7a99; --evt-ts: #51708c;
      --ch-cpu: #3572b0; --ch-load: #1e7d4f; --ch-mem: #a8731a; --ch-swap: #8d6a9e;
      --ch-grid: #e4e4e4;
    }
  }
  /* 浅色手动覆盖(设置里选「浅色」) */
  :root[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f2f7; --bg-elev: #fff; --bg-panel: #fafafa; --bg-deep: #ececec;
    --bg-input: #fff; --bg-hover: #e9e9e9; --bg-active: #e2e2e2;
    --border: #e0e0e0; --border-soft: #e4e4e4; --border-faint: #eaeaea;
    --btn-bg: #e4e4e4; --btn-hover: #d8d8d8; --btn-press: #d0d0d0; --btn-border: #c9c9c9;
    --btn-soft-bg: #fff; --btn-soft-border: #c9c9c9; --btn-soft-hover-bd: #999;
    --chip-bg: #fff; --chip-border: #cfcfcf;
    --chip-on-bg: #1f1f1f; --chip-on-tx: #fff;
    --text-title: #111; --text-hi: #1a1a1a; --text: #242424; --text-mid: #333;
    --text-soft: #464646; --text-dim: #575757; --text-faint: #666;
    --text-ghost: #757575; --text-dead: #8f8f8f;
    --header-bg: rgba(245,245,245,.92); --tabbar-bg: rgba(250,250,250,.86);
    --glass-bg: rgba(242,242,247,.72); --glass-bd: rgba(0,0,0,.06);
    --glass-shadow: 0 10px 30px rgba(0,0,0,.12);
    --nav-pill: rgba(118,118,128,.24); --accent: #0066cc;
    --scrim: rgba(0,0,0,.55); --skel: #e2e2e2; --focus: #2b6cb0;
    --c-red: #b33939; --c-red-bg: #fbeaea;
    --c-warn: #8a5800; --c-warn-bg: #fdf3dd; --c-warn-border: #e3c88f;
    --c-green: #1e7d4f; --c-green-bg: #e6f4ec; --c-green-btn: #1e7d4f;
    --c-orange: #a85413; --c-gray: #5f6368; --c-blue: #2b6cb0;
      --c-violet: #6c5ce7; --c-violet-soft: #5a4bd0;
    --link-blue: #2b6cb0; --dot-off: #b8b8b8;
    --accent-blue-bg: #e8f0fb; --accent-blue-bd: #c4d8f0; --accent-blue-tx: #3a6ea5;
    --accent-blue-hover: #d8e7fa; --detail-bg: #f0f5fa;
    --tbadge-wd-bg: #fdf3dd; --tbadge-wd-tx: #8a5800; --tbadge-wd-bd: #e6cf9e;
    --tbadge-rd-bg: #e8f0fb; --tbadge-rd-tx: #3a6ea5; --tbadge-rd-bd: #c4d8f0;
    --tbadge-sc-bg: #ececec; --tbadge-sc-tx: #5c5c5c; --tbadge-sc-bd: #d5d5d5;
    --ts-dim: #5a7a99; --evt-ts: #51708c;
    --ch-cpu: #3572b0; --ch-load: #1e7d4f; --ch-mem: #a8731a; --ch-swap: #8d6a9e;
    --ch-grid: #e4e4e4;
  }
  /* 深色手动覆盖(系统浅色时选「深色」) */
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0d14; --bg-elev: #121522; --bg-panel: #131726; --bg-deep: #0e111a;
    --bg-input: #121522; --bg-hover: #1a1e30; --bg-active: #22273d;
    --border: rgba(255,255,255,.08); --border-soft: rgba(255,255,255,.06); --border-faint: rgba(255,255,255,.04);
    --btn-bg: #1c2133; --btn-hover: #252b42; --btn-press: #2d3450; --btn-border: rgba(255,255,255,.1);
    --btn-soft-bg: #151928; --btn-soft-border: rgba(255,255,255,.08); --btn-soft-hover-bd: rgba(255,255,255,.18);
    --chip-bg: #151928; --chip-border: rgba(255,255,255,.08);
    --chip-on-bg: #f8fafc; --chip-on-tx: #0b0d14;
    --text-title: #f8fafc; --text-hi: #f1f5f9; --text: #cbd5e1; --text-mid: #94a3b8;
    --text-soft: #64748b; --text-dim: #94a3b8; --text-faint: #64748b;
    --text-ghost: #475569; --text-dead: #334155;
    --header-bg: rgba(11,13,20,.88); --tabbar-bg: rgba(14,17,26,.85);
    --glass-bg: rgba(28,28,30,.72); --glass-bd: rgba(255,255,255,.08);
    --glass-shadow: 0 10px 30px rgba(0,0,0,.36);
    --nav-pill: rgba(0,0,0,.42); --accent: #0a84ff;
    --scrim: rgba(0,0,0,.92); --skel: #1a1a1a; --focus: #4a90d9;
    --c-red: #e06c6c; --c-red-bg: #2a1a1a;
    --c-warn: #f0b662; --c-warn-bg: #2a2118; --c-warn-border: #5a4422;
    --c-green: #6ec89a; --c-green-bg: #14261c; --c-green-btn: #2e7d4f;
    --c-orange: #e0884c; --c-gray: #9a9a9a; --c-blue: #8ab4f8;
    --c-violet: #9d8cf5; --c-violet-soft: #6b5bd6;
    --link-blue: #6ea8dc; --dot-off: #555;
    --accent-blue-bg: #1d2733; --accent-blue-bd: #2c3a4d; --accent-blue-tx: #9db8d9;
    --accent-blue-hover: #243445; --detail-bg: #101418;
    --tbadge-wd-bg: #2a2010; --tbadge-wd-tx: #e0a84c; --tbadge-wd-bd: #4a3a18;
    --tbadge-rd-bg: #1e2832; --tbadge-rd-tx: #6ea8dc; --tbadge-rd-bd: #26405a;
    --tbadge-sc-bg: #1c1c1c; --tbadge-sc-tx: #9a9a9a; --tbadge-sc-bd: #2e2e2e;
    --term-bg: #0a0e12; --term-bd: #1c242e; --term-tx: #9fd4a0;
    --ts-dim: #5c7a9a; --evt-ts: #63849f;
    --ch-cpu: #6ea8dc; --ch-load: #6ec89a; --ch-mem: #e0a84c; --ch-swap: #b48ead;
    --ch-grid: #1c1c1c;
  }

  * { box-sizing: border-box; }
  body { margin: 0; font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
         background: var(--bg); color: var(--text); }
  header { position: static; background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
           border-bottom: none; padding: 14px 24px 6px;
           display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  header h1 { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.3px;
              color: var(--text-title);
              display: inline-flex; align-items: baseline; gap: 8px; }
  header h1 .h-home-link { color: inherit; text-decoration: none; display: inline-flex;
                           align-items: baseline; gap: 8px; }
  header h1 .h-home-link:hover .h-brand { color: var(--c-orange); }
  header h1 .h-logo { align-self: center; color: var(--c-orange); display: inline-flex; flex: none; }
  header h1 .h-brand { font-size: 22px; }
  header h1 .h-sep { color: var(--text-faint); font-weight: 400; }
  header h1 .h-host { font-size: 15px; font-weight: 500; color: var(--text-mid);
                      display: inline-flex; align-items: baseline; gap: 6px; }
  header h1 .h-server { width: 7px; height: 7px; border-radius: 50%; background: var(--c-green);
                        flex: none; align-self: center; }
  /* 顶栏连接 chip: ssh/LAN IP 点击复制(折叠自原首页独立面板, 零新增纵向空间) */
  .h-conn { display: inline-flex; align-items: center; gap: 6px; }
  .h-conn .gcopy { font-family: ui-monospace, monospace; font-size: 11px; padding: 2px 8px;
                   border-radius: 999px; border: 1px solid var(--border-faint);
                   color: var(--text-faint); cursor: pointer; user-select: none;
                   transition: color .12s, border-color .12s; }
  .h-conn .gcopy b { font-weight: 500; }
  .h-conn .gcopy:hover { color: var(--text-hi); border-color: var(--text-faint); }
  header .meta { color: var(--text-soft); font-size: 12.5px; }
  header .spacer { flex: 1; }
  .lang-switch { position: relative; z-index: 50; flex: none; }
  .lang-trigger { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px;
    border: 1px solid var(--chip-border); border-radius: 999px; background: var(--chip-bg); color: var(--text-mid);
    font: 600 11px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .035em; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s; }
  .lang-trigger:hover, .lang-trigger[aria-expanded="true"] { background: var(--bg-hover); border-color: var(--border); color: var(--text-title); }
  .lang-globe { color: var(--accent); }
  .lang-chevron { opacity: .65; transition: transform .15s; }
  .lang-trigger[aria-expanded="true"] .lang-chevron { transform: rotate(180deg); }
  .lang-menu { position: absolute; top: calc(100% + 9px); right: 0; width: 238px; padding: 7px;
    border: 1px solid var(--glass-bd); border-radius: 17px; background: var(--glass-bg);
    box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); }
  .lang-menu[hidden] { display: none; }
  .lang-menu-title { padding: 8px 10px 7px; color: var(--text-ghost); font-size: 10px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; }
  .lang-option { display: flex; align-items: center; width: 100%; gap: 10px; padding: 9px 10px;
    border: 0; border-radius: 11px; background: transparent; color: var(--text); text-align: left;
    font: 500 12.5px/1.35 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .lang-option:hover, .lang-option[aria-checked="true"] { background: var(--bg-hover); color: var(--text-title); }
  .lang-option-main { flex: 1; }
  .lang-option-detail { color: var(--text-ghost); font: 500 10px/1 ui-sans-serif, system-ui, sans-serif; }
  .lang-check { width: 14px; color: var(--accent); opacity: 0; font-size: 12px; text-align: center; }
  .lang-option[aria-checked="true"] .lang-check { opacity: 1; }
  /* ---------------- 自绘控件体系 ----------------
     不使用任何系统原生控件: 所有按钮/开关均为自绘元素。
     span[role=button] 语义: 可点击;键盘 Enter/Space 由全局委托触发 click。 */
  .btn, .chip, .tcol, .ctl-btn, .svctl-btn, .mbtn, .aglog-refresh {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    user-select: none; -webkit-user-select: none; touch-action: manipulation;
    cursor: pointer; transition: background .12s, border-color .12s, color .12s, transform .05s; }
  .btn { background: var(--btn-bg); color: var(--text-hi); border: 1px solid var(--btn-border);
         border-radius: 16px; padding: 7px 14px; font-size: 13px; }
  .btn:hover { background: var(--btn-hover); }
  .btn:active { background: var(--btn-press); transform: translateY(1px); }
  .btn.spinning { opacity: .7; }
  /* topbar 刷新按钮(玻璃圆钮): 点击=立即刷新, 长按=锁定/解锁自动刷新(锁定=琥珀描边+锁形角标) */
  .icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; position: relative;
              border-radius: 50%; background: var(--glass-bg); border: 1px solid var(--glass-bd);
              -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); }
  #refresh.locked { border-color: var(--c-warn); color: var(--c-warn); }
  #refresh .ic-badge { position: absolute; top: -5px; right: -5px; width: 15px; height: 15px;
                       border-radius: 50%; background: var(--c-warn); color: var(--bg);
                       display: none; align-items: center; justify-content: center; }
  #refresh.locked .ic-badge { display: inline-flex; }
  /* 移动端下拉刷新指示器: 原生 App 悬浮环形 (38px), 毛玻璃材质 + 圆环进度与加载旋转 */
  #ptr-indicator {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 100;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-bd);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    backdrop-filter: blur(24px) saturate(1.8);
    border-radius: 50%;
    color: var(--accent);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-50%, -46px, 0) scale(0.72);
    transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s ease, box-shadow 0.2s ease;
    will-change: transform, opacity;
  }
  #ptr-indicator.on { opacity: 1; }
  #ptr-indicator.pulling { transition: none; }
  #ptr-indicator.ready {
    box-shadow: 0 6px 22px rgba(97, 175, 239, 0.38);
  }
  #ptr-indicator.loading {
    opacity: 1;
  }
  #ptr-indicator .ptr-core {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    color: var(--accent);
    transition: transform 0.08s linear;
  }
  #ptr-indicator.loading .ptr-core {
    animation: ptr-spin 0.75s linear infinite;
    color: #10b981;
  }
  #ptr-indicator svg.ptr-ring {
    position: absolute;
    inset: -1px;
    transform: rotate(-90deg);
    width: 38px;
    height: 38px;
    pointer-events: none;
  }
  #ptr-indicator .ptr-ring circle {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 103.7;
    stroke-dashoffset: 103.7;
    transition: stroke-dashoffset 0.06s linear, stroke-width 0.15s ease, stroke 0.2s ease;
  }
  #ptr-indicator.ready .ptr-ring circle {
    stroke-width: 3;
    stroke: var(--accent);
  }
  #ptr-indicator.loading .ptr-ring circle {
    stroke: #10b981;
  }
  @keyframes ptr-spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) {
    #ptr-indicator { transition: none !important; }
    #ptr-indicator.loading .ptr-core { animation: none !important; }
  }
  /* 全局移除右下角悬浮刷新按钮: 完全通过下拉手势与顶栏按钮刷新 */
  .fab-refresh { display: none !important; }
  .btn[aria-disabled="true"], .btn.disabled { opacity: .5; cursor: default; pointer-events: none; }
  .btn:focus-visible, .chip:focus-visible, .tcol:focus-visible,
  .ctl-btn:focus-visible, .svctl-btn:focus-visible, .mbtn:focus-visible, .aglog-refresh:focus-visible {
    outline: 2px solid var(--focus); outline-offset: 2px; }
  /* ---------------- 内联 SVG 图标对齐体系(emoji 全量替换) ---------------- */
  .ic { display: inline-block; vertical-align: -0.15em; line-height: 1; }
  .lb-ico, .glight, .al-ico, .rc-ico, .lv-ico, .evt-ico {
    display: inline-flex; align-items: center; flex: none; }
  .lb-ico { color: var(--text-dim); margin-right: 5px; }
  .t-green { color: var(--c-green); } .t-warn { color: var(--c-warn); }
  .t-red { color: var(--c-red); } .t-orange { color: var(--c-orange); }
  main { padding: 0 24px 40px; }

  /* ---------------- 移动 App 化基础(桌面端多数隐藏) ----------------
     字号走 rem(html=100%),尊重系统字体大小设置;
     手势元素(页签栏/图表)仅手机布局出现; 日志/agent/骨架屏双端共用。 */
  [hidden] { display: none !important; }  /* 防 class 的 display:flex 盖过 hidden 属性 */
  html { font-size: 100%; -webkit-text-size-adjust: 100%; }
  #pages { display: contents; }          /* 桌面: 透明容器,子元素即 main 内容 */
  #tabbar, .gmore { display: none; }
  /* 日志/agent/骨架/时间线桌面可达; 分类过滤走 .cat-off */
  .gextra { display: block; }
  /* 服务卡头行显式圆形操作钮: 复制地址 + 打开(替代旧左滑手势) */
  .svc-act { display: inline-flex; align-items: center; justify-content: center;
             width: 44px; height: 44px; border-radius: 50%; flex: none; cursor: pointer;
             background: var(--btn-soft-bg); border: 1px solid var(--btn-soft-border);
             color: var(--text-mid); }
  .svc-act:active { transform: scale(.92); }
  .svc-open { display: inline-flex; align-items: center; justify-content: center;
              width: 44px; height: 44px; border-radius: 50%; flex: none;
              background: var(--accent-blue-bg); border: 1px solid var(--accent-blue-bd);
              color: var(--accent-blue-tx); text-decoration: none; }
  .skel-line { height: 14px; border-radius: 6px; margin: 10px 0;
               background: var(--skel); animation: skel-pulse 1.1s ease-in-out infinite; }
  @keyframes skel-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
  /* 桌面日志页: agent 选择器收窄左置, 事件时间线全宽(桌面=横向空间原则) */
  #logpage .ui-select { max-width: 460px; }
  #logpage .agentlog { max-height: 65vh; }
  .logbar select { width: 100%; background: var(--chip-bg); color: var(--text);
                   border: none; border-radius: 999px;
                   padding: 10px 16px; font-size: 13px; min-height: 44px; }
  #chart-wrap canvas { width: 100%; height: 150px; display: block; touch-action: none; }
  #chart-empty { color: var(--text-dead); font-size: 12px; padding: 18px 0; }
  .gmore { display: none; color: var(--text-dim); font-size: 11px; }
  .sysbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: var(--gap-panel); }
  .stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
          padding: 10px 16px; min-width: 130px; }
  .stat .label { color: var(--text-dim); font-size: 11px; margin-bottom: 3px;
                 display: inline-flex; align-items: center; }
  .stat .value { font-size: 14px; font-weight: 600; font-family: ui-monospace, monospace;
                 color: var(--text-hi); white-space: nowrap; }
  .stat .value.bad { color: var(--c-red); }   /* P1-2: 指标值 >90 红 */
  .stat .value.warn { color: var(--c-warn); } /* P1-2: 指标值 ≥75 黄 */
  .tbadge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
            margin-right: 6px; vertical-align: 1px; }
  .tbadge.wd { background: var(--tbadge-wd-bg); color: var(--tbadge-wd-tx); border: 1px solid var(--tbadge-wd-bd); }
  .tbadge.rd { background: var(--tbadge-rd-bg); color: var(--tbadge-rd-tx); border: 1px solid var(--tbadge-rd-bd); }
  .tbadge.sc { background: var(--tbadge-sc-bg); color: var(--tbadge-sc-tx); border: 1px solid var(--tbadge-sc-bd); }
  .filters { display: flex; gap: 8px; margin-bottom: var(--gap-panel); flex-wrap: wrap; align-items: center; }
  /* 日志页: logbar → chips → 列表 垂直节奏(此前 chips 紧贴选择器) */
  #logpage .logbar { margin-bottom: 14px; }
  #logpage .filters { margin-top: 2px; }
  #logpage #logbody { margin-top: 4px; }
  .aglog-list { gap: 0; }   /* 行距改由行内 padding 控制, 分隔线代替空隙 */
  .filters .spacer { flex: 1; }
  .watchdog-panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
                    padding: 12px 14px; margin-bottom: var(--gap-panel); }
  .watchdog-panel h2 { margin: 0 0 8px; font-size: 13px; color: var(--text-dim); font-weight: 500; }
  .watchdog-panel table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  .watchdog-panel th { text-align: left; color: var(--text-ghost); font-weight: 400; font-size: 11.5px;
                       padding: 4px 8px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
  .watchdog-panel td { padding: 5px 8px; border-bottom: 1px solid var(--border-faint); vertical-align: top; }
  .watchdog-panel tr:last-child td { border-bottom: none; }
  .watchdog-panel .tname { font-family: ui-monospace, monospace; color: var(--text-hi); word-break: break-all; }
  .watchdog-panel .tsch { color: var(--text-soft); white-space: nowrap; }
  .watchdog-panel .tscope { color: var(--text-faint); font-size: 11px; }
  .watchdog-panel .tcmd { color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 11px;
                          word-break: break-all; max-width: 420px; }
  .watchdog-panel .tlink { cursor: pointer; }
  .watchdog-panel .tlink:hover { color: var(--c-blue); text-decoration: underline; }
  .watchdog-panel .agent-detail td { background: var(--detail-bg); padding: 10px 14px; }
  .agentlog { max-height: 380px; overflow-y: auto; }
  .aglog-title { font-size: 12px; color: var(--text-faint); margin: 6px 0 4px; display: flex;
                 align-items: center; gap: 8px; }
  .aglog-refresh { background: var(--accent-blue-bg); border: 1px solid var(--accent-blue-bd);
                   color: var(--accent-blue-tx);
                   padding: 2px 10px; font-size: 11px; border-radius: 14px; cursor: pointer; }
  .aglog-refresh:hover { background: var(--accent-blue-hover); }
  .aglog-list { display: flex; flex-direction: column; gap: 2px; }
  .aglog-row { display: flex; gap: 10px; font-family: ui-monospace, monospace; font-size: 11.5px;
               line-height: 1.5; padding: 7px 2px; border-bottom: 1px solid var(--border-faint); }
  .aglog-row:last-child { border-bottom: none; }
  .aglog-ts { color: var(--ts-dim); white-space: nowrap; flex: none; }
  .aglog-txt { color: var(--text-mid); word-break: break-all; }
  .termlog { background: var(--term-bg); border: 1px solid var(--term-bd); border-radius: 6px; padding: 8px 10px;
             font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.45;
             color: var(--term-tx); overflow-x: auto; white-space: pre; margin: 2px 0 8px; }
  .aglog-empty { color: var(--text-dead); font-size: 12px; padding: 8px 0; }
  .mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; padding: 4px 0 12px; }
  .mcard { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
  .mcard .mhead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .mcard .mname { font-weight: 600; color: var(--text-hi); font-size: 14px; }
  .mcard .mdesc { color: var(--text-ghost); font-size: 11px; }
  .mcard .mstate { margin: 8px 0 10px; font-size: 12.5px; color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
  .mcard .mdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
  .mcard .mbtns { display: flex; gap: 8px; flex-wrap: wrap; }
  .mcard .mbtn { background: var(--btn-soft-bg); border: 1px solid var(--btn-soft-border); color: var(--text);
                  border-radius: 14px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
  .mcard .mbtn:hover { border-color: var(--btn-soft-hover-bd); color: var(--text-title); }
  .mcard .mbtn[aria-disabled="true"] { opacity: .5; cursor: default; }
  .mcard .mresult { margin-top: 8px; font-size: 12px; color: var(--c-green); min-height: 15px; word-break: break-all; }
  .chip { background: var(--chip-bg); color: var(--text-soft); border: 1px solid transparent;
          border-radius: 999px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
  .chip:hover { background: var(--bg-hover); }
  .chip.active { background: var(--chip-on-bg); border-color: var(--chip-on-bg); color: var(--chip-on-tx); }
  .chip span { opacity: .6; margin-left: 4px; font-size: 11px; }
  a.chip { text-decoration: none; }
  a.chip:hover { color: var(--text-title); border-color: var(--btn-hover); }
  .toolchips { margin-bottom: var(--gap-panel); }

  /* ---------------- Goal 进度卡片 / 负载水位 / 事件时间线 ---------------- */
  .gpanel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
            padding: 12px 14px; margin-bottom: var(--gap-panel); }
  .gpanel h2 { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); font-weight: 500; }
  .gpanel .ghint { color: var(--text-faint); font-weight: 400; font-size: 11.5px; }
  .gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 10px; align-items: stretch; }
  .gcard { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
  .tmux-goals-title { margin: 18px 0 8px; color: var(--text-dim); font-size: 12px; font-weight: 500; }
  .tmux-goals-meta { color: var(--text-faint); font-size: 11px; margin-bottom: 8px; }
  .tmux-session-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; margin-bottom: 8px; }
  .tmux-session-head, .tmux-pane-head { display: flex; align-items: baseline; gap: 7px; color: var(--text-soft); font-size: 11px; }
  .tmux-session-head b, .tmux-pane-head b { color: var(--text-hi); font-size: 12px; }
  .tmux-session-head span { margin-left: auto; color: var(--text-faint); }
  .tmux-pane-summary { border-top: 1px solid var(--border); margin-top: 7px; padding-top: 7px; }
  .tmux-pane-cwd { margin-left: auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-faint); }
  .tmux-live { color: var(--ok, #7ecb91); }
  .tmux-pane-summary pre { margin: 5px 0 0; padding: 7px 8px; max-height: 150px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--bg-deep); border-radius: 7px; color: var(--text-soft); font: 10.5px/1.45 var(--font-mono, monospace); }
  .gcard .ghead { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
  .gcard .glight { font-size: 13px; }
  .gcard .gname { font-weight: 600; color: var(--text-hi); font-size: 14px; word-break: break-all; }
  .gcard .gstate { color: var(--text-faint); font-size: 11.5px; }
  .g-detail-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex: none;
                  cursor: pointer; color: var(--c-blue); font-size: 11.5px; user-select: none; }
  .g-detail-btn:hover, .g-detail-btn:focus-visible { text-decoration: underline; }
  /* 详情弹层: 宽弹层(≤1280px)下 KV 双栏 + 全宽彩色终端; 移动端单栏(见 768 媒体块) */
  .ui-modal.detail-wide .ui-dialog { width: min(1280px, calc(100vw - 64px)); }
  .g-detail-body { max-height: min(78vh, 760px); overflow-y: auto; font-size: 12px; }
  .g-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
  .g-detail-section { margin: 0 0 14px; min-width: 0; }
  .g-detail-section h3 { margin: 0 0 6px; color: var(--text-dim); font-size: 12px; font-weight: 600; }
  .g-detail-kv { display: grid; grid-template-columns: 84px 1fr; gap: 5px 10px; }
  .g-detail-kv .k { color: var(--text-ghost); }
  .g-detail-kv .v { color: var(--text-main); word-break: break-word; font-family: ui-monospace, monospace; }
  .g-detail-log { white-space: pre; background: var(--term-bg); color: var(--term-tx); border: 1px solid var(--term-bd);
                 border-radius: 8px; padding: 12px 14px; max-height: min(44vh, 430px); overflow: auto;
                 font: 12px/1.5 ui-monospace, monospace; }
  .g-detail-events { display: grid; gap: 4px; }
  .g-detail-event { padding: 5px 7px; border-left: 2px solid var(--border); color: var(--text-main); }
  .g-detail-event .time { color: var(--text-ghost); margin-right: 7px; }
  .g-detail-event .kind { color: var(--accent); margin-right: 5px; }
  .gcard .gsub { color: var(--text-dim); font-size: 11.5px; margin-top: 2px;
                 word-break: break-all; line-height: 1.45; }
  .gcard .grow { display: flex; justify-content: space-between; gap: 10px;
                 font-size: 12.5px; color: var(--text-soft); padding: 3px 0 0; }
  /* 桌面首页网格: Web磁贴(左 2fr) / Goal摘要(右 1fr); 最近活动/仓库在下方全宽 */
  .hp-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: var(--gap-panel); }
  .hp-grid .gpanel { margin-bottom: 0; }
  .hp-grid #recent { grid-column: 1 / -1; }
  /* 磁贴最小宽 200px, 放不下自动换行(auto-fill) */
  .hp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
  .hp-tile { display: flex; flex-direction: column; align-items: stretch; gap: 3px;
             background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px;
             padding: 10px 12px; text-decoration: none; color: var(--text-hi); font-weight: 600; font-size: 13px; }
  .hp-tile:hover { border-color: var(--btn-hover); background: var(--bg-hover); }
  .hp-tile-main { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
  .hp-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hp-tile-sub { font-size: 10.5px; font-weight: 400; color: var(--text-faint);
                font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis;
                white-space: nowrap; }
  .hp-tile-port { color: var(--text-faint); font-weight: 400; font-size: 11px; font-family: ui-monospace, monospace; flex: none; }
  .hp-tile-main-r { display: inline-flex; align-items: center; gap: 5px; flex: none; }
  .hp-tile.sv-paused { opacity: .6; border-style: dashed; }
  .hp-tile-res { font-size: 10.5px; font-family: ui-monospace, monospace; color: var(--text-faint); }
  .hp-tile-res.hot { color: var(--c-orange); }
  .hp-tile-res.crit { color: var(--c-red); font-weight: 700; }
  /* 磁贴内迷你 暂停/恢复: 小方块图标钮(嵌在 <a> 内, 点击由委托拦截) */
  .svctl-btn.hp-sv { width: 24px; height: 24px; min-height: 0; padding: 0; gap: 0;
            border-radius: 7px; background: transparent; color: var(--text-faint);
            display: inline-flex; align-items: center; justify-content: center; }
  .svctl-btn.hp-sv:hover { background: var(--btn-hover); color: var(--text-hi); border-color: var(--btn-hover); }
  .svctl-btn.hp-sv.paused { color: var(--c-warn); border-color: var(--c-warn-border); background: var(--c-warn-bg); }
  .hp-goal-line { font-size: 13px; color: var(--text-main); margin-bottom: 8px; }
  .hp-goal-row { display: flex; align-items: baseline; gap: 7px; padding: 5px 0; font-size: 12.5px;
                 border-bottom: 1px solid var(--border-faint); }
  .hp-goal-row:last-child { border-bottom: none; }
  .hp-goal-name { color: var(--text-hi); font-weight: 600; word-break: break-all; }
  .hp-goal-ctx { color: var(--text-faint); font-family: ui-monospace, monospace; font-size: 11px; }
  .hp-goal-ago { margin-left: auto; color: var(--text-ghost); font-size: 11px; flex: none; }
  @media (max-width: 1100px) { .hp-grid { grid-template-columns: 1fr 1fr; } .hp-grid #recent { grid-column: 1 / -1; } }
  .gcard .grow + .grow { border-top: none; }
  .gcard .grow > span:first-child { color: var(--text-ghost); flex: none; }
  .gcard .gtx { font-family: ui-monospace, monospace; color: var(--text-mid); }
  .gcard .gtx.warn { color: var(--c-warn); font-weight: 600; }
  .gcard .gtx.stop { color: var(--c-red); font-weight: 600; }
  .gcard .gretry { color: var(--c-orange); font-family: ui-monospace, monospace; }
  .gcard .gidle { font-family: ui-monospace, monospace; }
  .gcard .gstalled, .gcard .gstalled + * { color: var(--text-ghost) !important; }
  .gcard .gprog { font-family: ui-monospace, monospace; font-size: 11.5px;
                  color: var(--text-dim); line-height: 1.55;
                  word-break: break-all;
                  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .gcard .gfoot { margin-top: auto; padding-top: 8px; display: flex; align-items: center;
                  gap: 8px; flex-wrap: wrap; }
  .gfoot-none { color: var(--text-dead); font-size: 12px; }
  .gcopy { display: inline-flex; align-items: center; gap: 6px; background: var(--btn-soft-bg);
           border: 1px solid var(--btn-soft-border); color: var(--text); border-radius: 14px;
           padding: 6px 14px; font-size: 12.5px; cursor: pointer; user-select: none; }
  .gcopy:hover { border-color: var(--btn-soft-hover-bd); color: var(--text-title); }
  /* ---- 按钮两级收敛: primary=描边胶囊(.btn/.tl-run/.ctl-btn) ghost=文字链 ---- */
  .ghost, .g-ignore-btn { display: inline-flex; align-items: center; gap: 4px; flex: none;
           color: var(--c-blue); font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; }
  .ghost:hover, .g-ignore-btn:hover { text-decoration: underline; }
  .g-ignore-btn.ignored { color: var(--text-dim); text-decoration: none; cursor: default; }
  .ghint.hp-more, .ghint.rc-more { color: var(--c-blue); cursor: pointer; }
  .ghint.hp-more:hover, .ghint.rc-more:hover { text-decoration: underline; }
  .gempty { color: var(--text-faint); font-size: 12.5px; padding: 10px 0; }
  .gdone { margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 8px; }
  .gdone summary { cursor: pointer; color: var(--text-dim); font-size: 12.5px; user-select: none;
                   display: flex; align-items: center; gap: 6px; }
  .gdone summary:hover { color: var(--text); }
  .gdone-row { display: flex; gap: 10px; align-items: baseline; padding: 4px 0;
               font-size: 12px; border-bottom: 1px solid var(--border-faint); flex-wrap: wrap; }
  .gdone-row:last-child { border-bottom: none; }
  .gdone-name { color: var(--text-mid); font-weight: 600; word-break: break-all; }

  /* 仓库面板: agent/goal 改动过的仓库(名称/分支/统计/最近提交/文件占比) */
  .rp-refresh { margin-left: auto; color: var(--text-dim); cursor: pointer;
                display: inline-flex; padding: 4px; border-radius: 8px; flex: none; }
  .rp-refresh:hover { color: var(--accent); background: var(--bg-hover); }
  .rp-refresh.spin svg { animation: rp-spin .9s linear infinite; }
  @keyframes rp-spin { to { transform: rotate(360deg); } }
  .rp-row { padding: 10px 0; border-bottom: 1px solid var(--border-faint); cursor: pointer;
            border-radius: 8px; transition: background .12s; }
  .rp-row:hover { background: var(--bg-hover); }
  .rp-row:last-child { border-bottom: none; }
  .rp-l1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
  .rp-name { color: var(--text-hi); font-weight: 600; word-break: break-all; }
  .rp-branch { color: var(--accent); font-family: ui-monospace, monospace; font-size: 11.5px; }
  .rp-meta { color: var(--text-dim); font-size: 11.5px; font-family: ui-monospace, monospace; }
  .rp-dirty { color: var(--c-warn); }
  .rp-last { margin-top: 4px; font-size: 12px; color: var(--text-mid); overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
  /* Agent 操作轨迹条: 近14天逐日双行色块 —— 每日一个 .tr-day(上下两根 i):
     上行=里程碑(完成/提交/干预/恢复), 下行=活动健康(工具调用紫/失败高发红)。
     ⚠ 优先级: 基础规则 .rp-traj .tr-day i = 0,2,1, 颜色规则必须用
     .rp-traj .tr-day i.tr-xxx = 0,3,0 覆盖(背景+opacity 一并写, 踩过两次)。 */
  .rp-traj { display: flex; gap: 3px; margin-top: 7px; }
  .rp-traj .tr-day { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .rp-traj .tr-day i { flex: none; min-width: 0; height: 4.5px; border-radius: 2px;
                       background: var(--border-faint); opacity: .55; }
  .rp-traj .tr-day i.tr-commit, .traj-strip .tr-day i.tr-commit, .traj-legend i.tr-commit { background: var(--c-blue); opacity: 1; }
  .rp-traj .tr-day i.tr-warn, .traj-strip .tr-day i.tr-warn, .traj-legend i.tr-warn { background: var(--c-warn); opacity: 1; }
  .rp-traj .tr-day i.tr-good, .traj-strip .tr-day i.tr-good, .traj-legend i.tr-good { background: var(--c-green); opacity: 1; }
  .rp-traj .tr-day i.tr-done, .traj-strip .tr-day i.tr-done, .traj-legend i.tr-done { background: var(--c-green-btn); opacity: 1; }
  .rp-traj .tr-day i.tr-agent, .traj-strip .tr-day i.tr-agent, .traj-legend i.tr-agent { background: var(--c-violet); opacity: 1; }
  .rp-traj .tr-day i.tr-error, .traj-strip .tr-day i.tr-error, .traj-legend i.tr-error { background: var(--c-red); opacity: 1; }
  .tr-ev-error .traj-ev-ico { color: var(--c-red); }
  /* 轨迹详情浮层 */
  .traj-sheet { position: fixed; inset: 0; z-index: 70; background: var(--bg);
                display: flex; flex-direction: column; }
  html.traj-noscroll, html.traj-noscroll body { overflow: hidden; }
  .traj-top { display: flex; align-items: center; gap: 8px;
              padding: calc(8px + env(safe-area-inset-top)) 12px 6px; }
  .traj-iconbtn { width: 38px; height: 38px; flex: none; border-radius: 50%;
                  display: inline-flex; align-items: center; justify-content: center;
                  background: var(--btn-soft-bg); border: 1px solid var(--btn-soft-border);
                  color: var(--text-mid); cursor: pointer; }
  .traj-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
  .traj-name { font-size: 15px; font-weight: 600; color: var(--text-title);
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .traj-sub { font-size: 11px; color: var(--text-faint); font-family: ui-monospace, monospace; }
  .traj-stripwrap { padding: 14px 16px 2px; }
  .traj-strip { display: flex; gap: 4px; height: 30px; }
  .traj-strip .tr-day { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .traj-strip .tr-day i { flex: 1 1 0; min-width: 0; border-radius: 4px;
                          background: var(--border-faint); opacity: .5; }
  .traj-days { display: flex; gap: 4px; margin-top: 4px; }
  .traj-days b { flex: 1 1 0; text-align: center; font-size: 9.5px; font-weight: 400;
                 color: var(--text-ghost); white-space: nowrap; overflow: hidden; }
  .traj-legend { display: flex; gap: 14px; padding: 10px 16px; font-size: 11px;
                 color: var(--text-dim); flex-wrap: wrap; }
  .traj-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .traj-legend i { width: 9px; height: 9px; border-radius: 2.5px; display: inline-block;
                   background: var(--border-faint); }
  /* 类别筛选 chips: 点击只看该类事件, 再点取消 */
  .traj-filter { display: flex; gap: 6px; padding: 4px 16px 10px; flex-wrap: wrap;
                 border-bottom: 1px solid var(--border-faint); }
  .trf-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 9px;
              border-radius: 999px; border: 1px solid var(--chip-border); background: var(--chip-bg);
              color: var(--text-dim); cursor: pointer; user-select: none; }
  .trf-chip b { font-weight: 600; color: var(--text-mid); font-variant-numeric: tabular-nums; }
  .trf-chip.on { border-color: var(--c-blue); color: var(--c-blue); background: var(--accent-blue-bg); }
  .trf-chip.on b { color: var(--c-blue); }
  .traj-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
               padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); }
  .traj-ev { display: flex; align-items: baseline; gap: 8px; padding: 8px 0;
             border-bottom: 1px solid var(--border-faint); font-size: 12.5px; }
  .traj-ev-ico { flex: none; align-self: center; color: var(--text-ghost); }
  .tr-ev-commit .traj-ev-ico { color: var(--c-blue); }
  .tr-ev-agent .traj-ev-ico { color: var(--c-violet); }
  .tr-ev-warn .traj-ev-ico { color: var(--c-warn); }
  .tr-ev-good .traj-ev-ico, .tr-ev-done .traj-ev-ico { color: var(--c-green); }
  .traj-ev-kind { flex: none; font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
                  background: var(--chip-bg); color: var(--text-dim); border: 1px solid var(--chip-border); }
  .traj-ev-text { flex: 1 1 auto; min-width: 0; color: var(--text-soft); word-break: break-all; }
  .traj-ev-text b { color: var(--text-hi); }
  .traj-ev-time { flex: none; color: var(--text-ghost); font-family: ui-monospace, monospace; font-size: 11px; }
  @media (min-width: 1024px) {   /* 桌面: 轨迹详情不铺满, 居中 760px 卡片 */
    #traj-view { left: 50%; right: auto; top: 6vh; bottom: auto;
                 width: 760px; height: min(88vh, 920px);
                 transform: translateX(-50%);
                 border: 1px solid var(--border); border-radius: 14px;
                 box-shadow: 0 24px 64px rgba(0,0,0,.45); }
    #traj-view.opening { animation: none; }
  }

  .evt-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.7;
             font-family: ui-monospace, monospace; flex-wrap: wrap; align-items: baseline; }
  .evt-ts { color: var(--evt-ts); flex: none; }  /* 4.7:1 on --bg-panel */
  .evt-name { color: var(--c-warn); flex: none; }
  .evt-txt { color: var(--text-soft); word-break: break-all; min-width: 200px; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  /* 服务页桌面容器: 与其他页一致的圆角面板(移动端行卡片自带容器, 面板只留边框透明) */
  .svc-panel { margin-bottom: var(--gap-panel); }
  .svc-panel table { background: transparent; }
  .svc-panel thead th { position: static; background: transparent; }
  thead th { text-align: left; color: var(--text-faint); font-weight: 500; font-size: 12px;
             padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
             z-index: 5; background: var(--bg); }
  tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border-faint); vertical-align: top; }
  tbody tr:hover { background: var(--bg-panel); }
  .name { white-space: nowrap; }
  .svc { font-weight: 600; color: var(--text-hi); }
  .port a { color: var(--text-hi); font-weight: 600; text-decoration: none; font-family: ui-monospace, monospace; font-size: 14px; }
  .port a:hover { text-decoration: underline; color: var(--text-title); }
  .addr, .pid { color: var(--text-faint); font-family: ui-monospace, monospace; white-space: nowrap; }
  /* P1-5: 命令列等宽 + 限宽(auto 表格下 nowrap 会把列撑爆 → max-width 锁住, 单行省略) */
  .cmd, .cwd { color: var(--text-soft); white-space: normal; word-break: break-all;
               font-family: ui-monospace, monospace; min-width: 220px; max-width: 430px;
               overflow: hidden; }
  table[data-col="cmd"] td.cwd { display: none; }
  table[data-col="cwd"] td.cmd { display: none; }
  th.colswitch { min-width: 220px; }
  .cmd-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
  /* P1-5: 命令列单行省略(等宽继承 .cmd), 长命令不再拆行(88/00), 完整内容走"详情"弹层 */
  .cmd-cell .cmd-text { flex: 1 1 auto; min-width: 0; overflow: hidden;
                        text-overflow: ellipsis; white-space: nowrap; }
  .svc-detail { flex: none; font-size: 12px; color: var(--c-blue); cursor: pointer;
                user-select: none; white-space: nowrap; }
  .svc-detail:hover { text-decoration: underline; }
  .cmd-ctl { flex: none; display: inline-flex; }
  .svc-detail-dialog .ui-dialog-msg { font-size: 13px; }
  .svc-detail-kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; align-items: start; }
  .svc-detail-kv .k { color: var(--text-ghost); font-size: 12px; padding-top: 2px; }
  .svc-detail-kv .v { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--text-main);
                      word-break: break-all; user-select: all; }
  .tcol { background: none; border: none; border-radius: 0; padding: 0; color: var(--text-ghost);
          font-size: 12px; font-weight: 500; cursor: pointer; }   /* 列名样式, 非胶囊 */
  .tcol + .tcol { margin-left: 12px; }
  .tcol:hover { color: var(--text-hi); }
  .tcol.active { color: var(--text-faint); }   /* 与 thead th 同色 = 当前列名 */
  .badge { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 999px;
           font-size: 11px; font-weight: 500; vertical-align: 1px; }
  .badge-docker  { background: var(--tbadge-sc-bg); color: var(--text-mid); border: 1px solid var(--btn-hover); }
  .badge-systemd { background: var(--tbadge-sc-bg); color: var(--text-soft); border: 1px solid var(--tbadge-sc-bd); }
  .badge-direct  { background: var(--chip-bg); color: var(--text-faint); border: 1px solid var(--chip-border); }
  .badge-self    { background: var(--btn-bg); color: var(--text-title); border: 1px solid var(--btn-hover); }
  .badge-paused  { background: var(--c-warn-bg); color: var(--c-warn); border: 1px solid var(--c-warn-border); }
  /* P0-6: 服务行行首运行状态点 红=paused/异常 绿=正常 灰=未知(受管状态查询前/查询失败) */
  .svc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
             background: var(--c-green); margin-right: 7px; flex: none; }
  .svc-dot.off { background: var(--dot-off); }
  .svc-dot.bad { background: var(--c-red); }
  .detail { display: block; color: var(--text-ghost); font-size: 11px; font-family: ui-monospace, monospace; margin-top: 2px; }
  .local { color: var(--text-dim); font-size: 11px; }
  .ctl { white-space: nowrap; }
  .ctl-btn, .svctl-btn { background: var(--btn-bg); border: 1px solid var(--btn-border); color: var(--text-hi);
            border-radius: 16px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
  .ctl-btn:hover, .svctl-btn:hover { background: var(--btn-hover); }
  .ctl-btn[aria-disabled="true"], .svctl-btn[aria-disabled="true"] { opacity: .5; cursor: default; }
  /* 每服务资源行: PID 列下方 CPU·MEM·时长 小字(等宽淡色, 与 .detail 同族) */
  .svc-res { color: var(--text-faint); font-size: 11px; font-family: ui-monospace, monospace; }
  .pid-res { margin-top: 3px; }
  .svc-summary-res, .res { color: var(--text-faint); font: 11.5px ui-monospace, monospace; }
  .svc-actions { white-space: nowrap; }
  .svc-actions .svc-detail { margin-right: 10px; }
  .svc-summary { display: flex; align-items: center; gap: 10px; padding: 4px 12px 10px; }
  .svc-summary .port { font: 600 13px ui-monospace, monospace; }
  .svc-summary-res { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .svc-summary-detail { display: inline-flex; align-items: center; gap: 7px; }
  .pid-svctl { margin-top: 5px; }
  .pid-svctl .svctl-btn { padding: 3px 10px; font-size: 11.5px; border-radius: 14px; }
  .empty { color: var(--text-faint); text-align: center; padding: 48px 0; }
  /* 空状态(iOS 风): 灰色大图标 + 粗体主标题 + 灰色副标题, 垂直居中大量留白 */
  .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center;
                 gap: 10px; padding: 44px 24px; text-align: center; }
  .empty-state .es-ico { color: var(--text-ghost); display: inline-flex; }
  .empty-state .es-title { font-size: 22px; font-weight: 700; color: var(--text-hi); }
  .empty-state .es-sub { font-size: 13px; color: var(--text-dim); }
  /* 浮动玻璃刷新圆钮(桌面+移动同款): topbar 滚出视口后由 IntersectionObserver 显示;
     点击=刷新/长按=锁定自动刷新, 与 topbar 刷新钮同一状态 */
  .fab-refresh { position: fixed; right: 20px; bottom: 24px; z-index: 45;
                 width: 48px; height: 48px; border-radius: 50%;
                 display: flex; align-items: center; justify-content: center;
                 background: var(--glass-bg); border: 1px solid var(--glass-bd);
                 -webkit-backdrop-filter: blur(20px) saturate(1.8);
                 backdrop-filter: blur(20px) saturate(1.8);
                 box-shadow: var(--glass-shadow); color: var(--text-hi);
                 cursor: pointer; user-select: none; -webkit-user-select: none;
                 transition: transform .18s ease, opacity .18s ease; }
  .fab-refresh:active { transform: scale(.92); }
  .fab-refresh.locked { color: var(--c-warn); }
  /* ---------------- 手机端 (<768px): App 化布局 ----------------
     4 页横向滑动(概览/服务/Goal/管理) + 底部页签栏 + safe-area;
     服务表→紧凑卡片, Goal 卡收起次要信息;
     ≥769px 恢复桌面布局,所有规则只在此断点内生效。 */
  @media (max-width: 900px) { .cmd, .cwd { min-width: 120px; } }

  /* ---------------- 手机端 (<768px): App 化布局 ----------------
     六页横向滑动(概览/日志/Goal/服务/模型/ツール) + 底部页签栏 + safe-area;
     服务表→卡片(头行圆形 复制/打开 按钮), goal 卡收起次要信息;
     ≥769px 恢复桌面布局,所有规则只在此断点内生效。 */
  /* ---------------- 概要摘要组件 + 日志时间线(桌面隐藏,手机显示) ----------------
     字号体系: 状态数字 22-24px / 正文 14px / 辅助 12px。 */
  .mgrid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start;
            margin-bottom: var(--gap-panel); }
  .mcell { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
           padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
  .mnum { font-size: 22px; font-weight: 700; color: var(--text-title); font-variant-numeric: tabular-nums; }
  .mnum.alert { color: var(--c-warn); }
  .mlabel { font-size: 12px; color: var(--text-dim); }
  .al-btn:not(.gcopy) { display: inline-flex; align-items: center; color: var(--c-blue); background: none;
            border: none; padding: 4px 6px; font-size: 12.5px; cursor: pointer; user-select: none; }
  .al-btn:not(.gcopy):hover { text-decoration: underline; }
  .al-btn.ignore { color: var(--text-dim); }
  .alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border-faint); }
  .alert-item:last-child { border-bottom: none; }
  .al-ico { font-size: 17px; }
  .al-main { flex: 1 1 auto; min-width: 0; }
  .al-line { font-size: 14px; color: var(--text-hi); display: flex; gap: 8px; align-items: baseline; min-width: 0; }
  .al-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .al-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
  .al-act { display: flex; align-items: center; gap: 6px; flex: none; }
  .rc-row { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--border-faint);
            font-size: 14px; color: var(--text-mid); }
  .rc-row:last-child { border-bottom: none; }
  .rc-ico { flex: none; }
  .rc-kind { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  .rc-kind .rc-name { color: var(--text-hi); font-weight: 600; }
  .rc-sub { font-size: 12px; color: var(--text-dim); overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
  .rc-title { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .rc-tag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; line-height: 1.35; flex: none; }
  .rc-tag.rc-gh { background: rgba(147, 83, 211, 0.16); color: #bf5af2; border: 1px solid rgba(191, 90, 242, 0.32); }
  .rc-tag.rc-synced { background: rgba(48, 209, 88, 0.14); color: #30d158; border: 1px solid rgba(48, 209, 88, 0.28); }
  .rc-tag.rc-local { background: rgba(120, 120, 128, 0.16); color: var(--text-dim); border: 1px solid var(--border); }
  .h-badge-ro { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
                background: rgba(10, 132, 255, 0.14); color: #0a84ff; border: 1px solid rgba(10, 132, 255, 0.28); }
  .h-online-link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; cursor: pointer; }
  .h-online-link:hover { color: var(--text-hi); border-color: rgba(10, 132, 255, .55); background: rgba(10, 132, 255, .22); }
  .h-ro-arrow { color: var(--text-mid); font-weight: 500; }
  html.is-readonly .svc-actions .ctl-btn,
  html.is-readonly .svc-actions .svctl-btn,
  html.is-readonly .svctl-btn,
  html.is-readonly .mbtn,
  html.is-readonly .act-btn,
  html.is-readonly .agent-ctl-btn,
  html.is-readonly #hp-aiclean-run,
  html.is-readonly #tl-clean-scan,
  html.is-readonly #tl-clean-exec,
  html.is-readonly #tl-aiclean-run,
  html.is-readonly #tl-usvc-showlock,
  html.is-readonly #tl-usvc-unlockwrap,
  html.is-readonly #refresh,
  html.is-readonly #fab-refresh,
  body.is-readonly .svc-actions .ctl-btn,
  body.is-readonly .svc-actions .svctl-btn,
  body.is-readonly .svctl-btn,
  body.is-readonly .mbtn,
  body.is-readonly .act-btn,
  body.is-readonly .agent-ctl-btn,
  body.is-readonly #hp-aiclean-run,
  body.is-readonly #tl-clean-scan,
  body.is-readonly #tl-clean-exec,
  body.is-readonly #tl-aiclean-run,
  body.is-readonly #tl-usvc-showlock,
  body.is-readonly #tl-usvc-unlockwrap,
  body.is-readonly #refresh,
  body.is-readonly #fab-refresh {
    display: none !important;
  }
  .rc-ago { color: var(--text-dim); font-size: 12px; flex: none; }
  /* 日志时间线: 第一行 图标+类型+相对时间, 第二行一句话摘要, 详情默认折叠 */
  .lv { border-bottom: 1px solid var(--border-faint); padding: 9px 2px 9px 9px;
        border-left: 3px solid transparent; }
  .lv-ok { border-left-color: var(--c-green); }   /* P1-3: 事件行左缘状态色条 */
  .lv-warn { border-left-color: var(--c-warn); }
  .lv-fail { border-left-color: var(--c-red); }
  .lv-recover { border-left-color: var(--c-blue); }
  /* P1-3: 日志状态筛选 chips 色点 成功=绿 告警=黄 失败=红 恢复=蓝 */
  .cdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
  .cdot-ok { background: var(--c-green); }
  .cdot-warn { background: var(--c-warn); }
  .cdot-fail { background: var(--c-red); }
  .cdot-recover { background: var(--c-blue); }
  .lv:last-child { border-bottom: none; }
  .lv-line1 { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--text-hi); min-width: 0; }
  .lv-ico { flex: none; display: inline-flex; align-items: center; }
  .lv-kind { font-weight: 600; flex: none; }
  .lv-loop { color: var(--c-warn); font-size: 12.5px; flex: none; }
  .lv-ago { margin-left: auto; color: var(--text-dim); font-size: 12px; flex: none; }
  .lv-line2 { font-size: 14px; color: var(--text-mid); margin-top: 3px; line-height: 1.5;
              display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .lv.open .lv-line2 { display: block; }
  .lv-fold { margin-top: 6px; font-size: 12px; color: var(--c-blue); display: inline-flex;
             align-items: center; gap: 4px; cursor: pointer; }
  .lv-fold::before { content: "▸"; transition: transform .15s; }
  .lv.open .lv-fold::before { transform: rotate(90deg); }
  .lv-meta { display: none; margin-top: 6px; background: var(--bg-deep); border: 1px solid var(--btn-soft-border);
             border-radius: 6px; padding: 8px 10px; font-family: ui-monospace, monospace;
             font-size: 11px; color: var(--text-dim); word-break: break-all; line-height: 1.6; }
  .lv.open .lv-meta { display: block; }
  .lv-children { display: none; margin-top: 6px; border-left: 2px solid var(--border-soft); padding-left: 8px; }
  .lv.open > .lv-children { display: block; }
  .lv-more { font-size: 12px; color: var(--text-dim); padding: 10px 0 2px; }

  @media (max-width: 768px) {
  /* 手机: 首页网格单列堆叠(磁贴两列小格); 面板间距收紧到 12 */
  :root { --gap-panel: 12px; }
  .hp-grid { display: block; }
  .hp-grid .gpanel { margin-bottom: var(--gap-panel); }
  .hp-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 7px; }
  .hp-tile { padding: 9px 10px; font-size: 12.5px; }
    .meta { display: none !important; }  /* 移动端: 更新时间/端口数与主体状态卡重复,隐藏 */
    html { -webkit-tap-highlight-color: transparent; }
    /* topbar 不固定(iOS Large Title 风, 基础样式已静态化/透明/大标题/玻璃圆钮):
       移动端仅收窄边距+safe-area, header 由 JS 移入 main 随内容滚出视口 */
    header { padding: 12px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
             padding-top: calc(8px + env(safe-area-inset-top)); gap: 6px 8px; }
    /* 确定性两行 grid: 行1=品牌+刷新钮, 行2=连接 chips 整行(flex-wrap 数学不可控) */
    header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
    header h1 { grid-row: 1; grid-column: 1; min-width: 0; }
    header .spacer { display: none; }
    header .lang-switch { grid-row: 1; grid-column: 2; }
    header #refresh { grid-row: 1; grid-column: 3; }
    .h-conn { grid-row: 2; grid-column: 1 / -1; justify-self: start; padding: 2px 2px 0; }
    .h-conn .gcopy { min-height: 30px; padding: 4px 11px; }  /* 触控可点但不吃全局 .gcopy 38px */
    .btn, .chip, .mbtn, .ctl-btn, .tcol, .aglog-refresh { padding: 9px 14px; font-size: 13px; min-height: 38px; }
    /* 内部滚动: main 自滚, 底部页签栏固定在文档流尾, 不再遮住最后一屏 */
    html, body { height: 100%; }
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-thumb { background: var(--chip-border); border-radius: 2px; }
  ::-webkit-scrollbar-track { background: transparent; }
    body { display: flex; flex-direction: column; overflow: hidden;
           overscroll-behavior: none; }
    main { flex: 1 1 auto; min-height: 0; overflow-y: auto;
           -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
           padding: 0 max(12px, env(safe-area-inset-right)) 16px
                    max(12px, env(safe-area-inset-left)); }
    /* 每页底部留出 悬浮底栏(64px)+悬浮空隙(12px)+余量(24px)+safe-area: 末条完整露出 */
    #track > .pg { padding-bottom: calc(52px + 12px + env(safe-area-inset-bottom, 0px)); }

    /* 底部导航栏: 更沉底、紧凑贴手、单手操作更顺畅, 带下滑隐藏动效 */
    #tabbar { display: flex; position: fixed; left: 10px; right: 10px;
              bottom: calc(4px + env(safe-area-inset-bottom, 0px)); z-index: 40;
              border-radius: 20px; padding: 4px 6px;
              background: var(--glass-bg);
              -webkit-backdrop-filter: blur(24px) saturate(1.8);
              backdrop-filter: blur(24px) saturate(1.8);
              border: 1px solid var(--glass-bd);
              box-shadow: 0 4px 24px rgba(0, 0, 0, 0.38);
              transition: transform .28s cubic-bezier(0.2, 0, 0, 1), opacity .22s ease;
              will-change: transform, opacity; }
    #tabbar.tabbar-hidden {
      transform: translateY(calc(100% + 24px));
      opacity: 0;
      pointer-events: none;
    }
    #tabbar .tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
                   padding: 4px 0 2px; min-height: 44px; border-radius: 16px;
                   color: var(--text-faint); font-size: 10px;
                   cursor: pointer; user-select: none; -webkit-user-select: none;
                   -webkit-tap-highlight-color: transparent;
                   transition: background .18s ease, color .18s ease; }
    #tabbar .tab.active { background: var(--nav-pill); color: var(--accent); }
    #tabbar .tab svg { width: 19px; height: 19px; }
    /* 概要页签未处理告警徽章: 红点+数字 */
    .tbadge-dot { position: absolute; top: 1px; left: calc(50% + 10px); min-width: 16px; height: 16px;
                  padding: 0 4px; border-radius: 999px; background: #c04848; color: #fff;
                  font-size: 10px; font-weight: 700; display: flex; align-items: center;
                  justify-content: center; border: 1.5px solid var(--glass-bg); }

    /* 浮动刷新圆钮基础样式在全局(桌面同款): 移动端适度下移 */
    .fab-refresh { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }

    /* 移动端活动页深度精简: 隐藏多余的标题、介绍、筛选芯片，直奔全部提交流 */
    #activity-page .act-header,
    #activity-page #act-filters {
      display: none !important;
    }
    #activity-page {
      padding: 0 !important;
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
    }
    .act-group-card {
      margin-bottom: 8px !important;
      padding: 6px 8px !important;
    }
    .act-card {
      padding: 8px 6px !important;
    }

    /* 两层结构: #pages(裁剪窗口) > #track(500% 轨道) > .pg(各 1/5 = 屏宽) */
    #pages { display: block; width: 100%; overflow: hidden; }
    body { overscroll-behavior-x: none; }
    #pages { touch-action: pan-y; } /* 纵向保留原生高速滚动，横向交由左右滑动切页手势接管 */
    .filters { touch-action: pan-x; }
    #track { display: flex; align-items: flex-start; width: 500%;
             will-change: transform;
             transition: transform .26s cubic-bezier(.22,.61,.36,1),
                         height .26s cubic-bezier(.22,.61,.36,1); }
    #track.stick { transition: none; }
    #track > .pg { flex: 0 0 20%; min-width: 20%; max-width: 20%; }
    .skel { display: block; }
    #chart-wrap, #logpage, #agents-page, #toolspage, #activity-page, #network-page { display: block; }  /* 移动专用面板 */
    #logpage[hidden], #agents-page[hidden], #toolspage[hidden], #activity-page[hidden], #network-page[hidden] { display: none !important; }
    /* 概要摘要组件(指标2×2+需要处理+最近活动) */
    .mgrid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: var(--gap-panel); }
    .svc-panel { background: transparent; border: none; padding: 0; box-shadow: none; }
    #alerts, #recent { display: block; margin-bottom: var(--gap-panel); }
    #recent h2 { display: flex; justify-content: space-between; align-items: baseline; }
    .rc-more { cursor: pointer; }
    #events { display: none; }  /* 概要页只留 3-5 条摘要(最近活动), 全量事件进日志页 */
    .lv { display: block; }
    #log-filters { display: flex; flex-wrap: nowrap; overflow-x: auto;
                   -webkit-overflow-scrolling: touch; scrollbar-width: none;
                   margin: 0 -12px 10px; padding: 0 12px 4px; }
    #log-filters::-webkit-scrollbar { display: none; }
    #log-filters .chip { flex: none; }

    .sysbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap-panel); }   /* 双列 2×N(桌面为 5 列 grid) */
    .stat { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); padding: 8px 12px;
            touch-action: manipulation; } /* 双击手势目标: 消除 300ms 缩放 */
    .stat .value { font-size: 12.5px; }

    /* chips 横向滚动 */
    .filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
               scrollbar-width: none; margin: 0 -12px var(--gap-panel); padding: 0 12px 4px; }
    .filters::-webkit-scrollbar { display: none; }
    .filters .spacer { display: none; }
    .chip { flex: none; font-size: 12.5px; }
    /* 横滚 chips 容器左右渐隐: JS setupFiltersFade 按滚动位置加类, 仅溢出时生效 */
    .filters.hf-ov { --hf: 22px; }
    .filters.hf-ov.hf-r:not(.hf-l) { -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - var(--hf)), transparent 100%);
                                     mask-image: linear-gradient(to right, #000 0, #000 calc(100% - var(--hf)), transparent 100%); }
    .filters.hf-ov.hf-l:not(.hf-r) { -webkit-mask-image: linear-gradient(to left, #000 0, #000 calc(100% - var(--hf)), transparent 100%);
                                     mask-image: linear-gradient(to left, #000 0, #000 calc(100% - var(--hf)), transparent 100%); }
    .filters.hf-ov.hf-l.hf-r { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--hf), #000 calc(100% - var(--hf)), transparent 100%);
                               mask-image: linear-gradient(to right, transparent 0, #000 var(--hf), #000 calc(100% - var(--hf)), transparent 100%); }
    /* agent 子页签条同款渐隐: 右侧还有页签时露出可滑提示 */
    .agent-subnav.hf-ov { --hf: 22px; }
    .agent-subnav.hf-ov.hf-r:not(.hf-l) { -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - var(--hf)), transparent 100%);
                                          mask-image: linear-gradient(to right, #000 0, #000 calc(100% - var(--hf)), transparent 100%); }
    .agent-subnav.hf-ov.hf-l:not(.hf-r) { -webkit-mask-image: linear-gradient(to left, #000 0, #000 calc(100% - var(--hf)), transparent 100%);
                                          mask-image: linear-gradient(to left, #000 0, #000 calc(100% - var(--hf)), transparent 100%); }
    .agent-subnav.hf-ov.hf-l.hf-r { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--hf), #000 calc(100% - var(--hf)), transparent 100%);
                                    mask-image: linear-gradient(to right, transparent 0, #000 var(--hf), #000 calc(100% - var(--hf)), transparent 100%); }

    /* 服务列表 → 卡片(头行右侧显式 44px 圆形 复制/打开 按钮, 无滑扫手势) */
    #svc thead { display: none; }
    #svc tbody tr { display: block; background: var(--bg-panel); border: 1px solid var(--border);
                    border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
    #svc tbody tr:has(> td.empty) { background: none; border: none; }
    #svc tbody td { display: block; border: none; padding: 0; }
    #svc tbody td.empty { text-align: center; padding: 32px 0; }
    .td-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
               padding: 10px 12px 4px; }
    .td-head .svc { flex: 1 1 auto; }
    .td-rows { padding: 4px 12px 10px; }
    .td-rows .kv { display: flex; justify-content: space-between; gap: 12px;
                   align-items: baseline; padding: 3px 0; }
    .td-rows .k { color: var(--text-ghost); font-size: 11px; flex: none; }
    .td-rows .v { text-align: right; word-break: break-all; white-space: normal; min-width: 0; }
    /* P1-6: 长命令默认折叠 2 行, 点展开(mclamp 切换) */
    .td-rows .v .mclamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                          overflow: hidden; word-break: break-all; cursor: pointer; }
    .td-rows .v .mclamp.open { -webkit-line-clamp: unset; display: block; }
    .svc-summary-detail .svc-detail { font-size: 11px; }
    .svc-summary-detail .ctl-btn, .svc-summary-detail .svctl-btn { min-height: 30px; padding: 4px 8px; font-size: 11px; }
    .ctl-btn, .svctl-btn { min-height: 44px; padding: 10px 16px; font-size: 13px; }
    .svctl-btn.hp-sv { min-height: 0; width: 28px; height: 28px; padding: 0; }  /* 磁贴迷你钮不受 44px 拉高 */
    .colswitch, .tcol { display: none; }
    .empty { padding: 32px 0; }

    /* watchdog / agent / tmux 面板表 → 卡片 */
    .watchdog-panel { padding: 10px 12px; }
    .watchdog-panel thead { display: none; }
    .watchdog-panel tbody tr { display: block; padding: 6px 0; }
    .watchdog-panel td { display: flex; justify-content: space-between; gap: 12px;
                         align-items: baseline; border: none; padding: 3px 0;
                         white-space: normal !important; }
    .watchdog-panel td::before { content: attr(data-label); color: var(--text-ghost); font-size: 11px;
                                 flex: none; }
    .watchdog-panel td:first-child { display: block; padding: 2px 0 4px; }
    .watchdog-panel td:first-child::before { content: none; }
    .watchdog-panel .tcmd { max-width: none; }
    .watchdog-panel .agent-detail td { display: block; padding: 8px 4px; }
    .watchdog-panel .agent-detail td::before { content: none; }
    .aglog-row { flex-wrap: wrap; gap: 2px 8px; padding: 4px 0; }
    .aglog-ts { flex: none; }
    .termlog { font-size: 10.5px; -webkit-overflow-scrolling: touch; }

    /* 日志页: 展开式(不嵌套滚动) */
    #logpage .agentlog { max-height: none; overflow: visible; }
    .logbar { margin-bottom: var(--gap-panel); }

    /* 服务管理卡片 */
    .mgrid { grid-template-columns: 1fr; gap: 10px; }
    .mcard { padding: 12px; }
    .mcard .mbtns { gap: 6px; }
    .mcard .mbtn { flex: 1 1 auto; min-width: 88px; padding: 11px 8px; font-size: 13.5px; }
    .mcard .mresult { font-size: 12.5px; }

    /* Goal 卡片/负载线/事件: 单列可读 */
    .gcards { grid-template-columns: 1fr; gap: 8px; }
    .gcard .grow { flex-wrap: wrap; }
    .gextra { display: none; }               /* 手机: 次要信息默认收起 */
    .gcard.open .gextra { display: block; }
    .gmore { display: inline-flex; margin-left: auto; transition: transform .15s; }
    .gcard.open .gmore { transform: rotate(90deg); }
    .gpanel { padding: 10px 12px; }
    .rp-l1 { font-size: 13px; }
    .evt-row { gap: 6px; }
    .evt-txt { min-width: 0; flex: 1 1 100%; padding-left: 14px; }
    .gcopy { min-height: 38px; padding: 9px 16px; font-size: 13px; }
    /* 详情弹层移动端: 单栏 + 终端收窄; 弹层贴边留 12px */
    .ui-modal { padding: 12px; }
    .ui-modal .ui-dialog { border-radius: 16px; }
    .g-detail-grid { grid-template-columns: 1fr; gap: 0; }
    .g-detail-log { font-size: 10.5px; max-height: 300px; padding: 9px 10px; line-height: 1.42; }
    .gdone-row { font-size: 11.5px; }
  }
  @media (prefers-reduced-motion: reduce) {
    #track, .gmore { transition: none !important; }
    .skel-line { animation: none; }
    .fab-refresh, #tabbar .tab { transition: none !important; }
    .fab-refresh:active { transform: none; }
  }
  /* 玻璃材质降级: 低端设备不支持 backdrop-filter → 不透明实底 */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #tabbar, .fab-refresh, .icon-btn { background: var(--bg-elev); }
  }
  /* ---------------- ツール页: 4 分组(巡检/运维/直达/偏好) + 桌面 2 列 ---------------- */
  .tl-group { margin-top: 16px; }
  .tl-grouph { margin: 0 0 4px; font-size: 13px; color: var(--text-dim); font-weight: 500;
               display: flex; align-items: center; gap: 8px; }
  .tl-grouph::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border-faint); }
  .tl-group .tl-sec { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px;
                      padding: 12px 14px; }
  .tl-group .tl-sec + .tl-sec { margin-top: 0; }
  #toolspage { row-gap: 12px; }
  @media (min-width: 769px) {
    #toolspage[hidden] { display: none !important; }
    /* 工具页: 运维操作一排(3列) → 巡检诊断一排(3列) → 计划任务全宽; 分组头不再占整行 */
    #toolspage { display: grid; grid-template-columns: repeat(6, 1fr); column-gap: 14px; align-items: start; }
    #toolspage > h2, #tlg-pref { grid-column: 1 / -1; }
    #tlg-insp, #tlg-ops { grid-column: 1 / -1; display: contents; }
    #tlg-insp .tl-grouph, #tlg-ops .tl-grouph { grid-column: 1 / -1; }
    /* 卡片按内容自适应高度; 计划任务全宽第二排(内部限高), 避免撑高同行 */
    #tl-health, #tl-net, #tl-clean, #tl-usvc { grid-column: span 2; align-self: start; }
    #tlg-insp { grid-column: 1; }
    #tlg-ops { grid-column: 2; }
    .tl-group { margin-top: 20px; }
  }
  /* 计划任务(服务页): 与服务表同一套表格样式, 仅限高滚动 + 列宽 */
  #cron-panel #tl-cron-body { max-height: 340px; }
  #cron-panel table { background: transparent; }
  #cron-panel thead th { position: static; background: transparent; }
  #cron-panel .cron-sch { color: var(--text-soft); white-space: nowrap; font-family: ui-monospace, monospace; font-size: 12.5px; }
  #cron-panel .cron-src { white-space: nowrap; }
  #cron-panel .cron-scope { color: var(--text-faint); font-size: 11.5px; }
  #cron-panel td.empty { text-align: center; color: var(--text-dead); padding: 18px 0; }
  .toolspage .tl-sec h3 { margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); font-weight: 500;
                          display: flex; align-items: center; gap: 6px; }
  .tl-sechead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .tl-sechead h3 { margin: 0; flex: 1 1 auto; }
  .tl-run { flex: none; cursor: pointer; user-select: none; }
  #tl-cron-body { overflow-y: auto; padding-right: 4px; }
  .tl-row { display: flex; align-items: center; gap: 8px; padding: 5px 0;
            font-size: 12.5px; border-bottom: 1px dashed var(--border-faint); }
  .tl-row:last-child { border-bottom: none; }
  .tl-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); }
  .tl-dot.warn { background: var(--c-warn); }
  .tl-dot.bad { background: var(--c-red); }
  .tl-dot.off { background: var(--dot-off); }
  .tl-name { color: var(--text-mid); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tl-val { margin-left: auto; color: var(--text-faint); font-family: ui-monospace, monospace;
            font-size: 11.5px; white-space: nowrap; }
  .tl-val b { color: var(--text-hi); font-weight: 600; }
  .tl-head-big { font-size: 15px; font-weight: 600; }
  .themechips { margin-bottom: 0; }
  .tl-cleanrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 12.5px;
                 border-bottom: 1px dashed var(--border-faint); }
  .clean-toggle { width: 22px; height: 22px; flex: none; display: inline-flex; align-items: center;
                  justify-content: center; border: 1px solid var(--chip-border); border-radius: 6px;
                  color: var(--text-dead); cursor: pointer; }
  .clean-toggle.selected { background: var(--accent-blue-bg); border-color: var(--accent-blue-bd); color: var(--accent-blue-tx); }
  .tl-cleanrow:last-child { border-bottom: none; }
  .tl-cleanrow .lbl { flex: 1 1 auto; min-width: 0; }
  .tl-cleanrow .lbl small { display: block; color: var(--text-dead); font-size: 11px; margin-top: 1px;
                            word-break: break-all; }
  .tl-cleanrow .sz { flex: none; color: var(--text-hi); font-family: ui-monospace, monospace; font-size: 12px; }
  .tl-docker-pre { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 8px;
                   padding: 8px 10px; font: 11px ui-monospace, monospace; color: var(--text-dim);
                   overflow-x: auto; white-space: pre; margin: 8px 0; }
  #tl-lightbox { position: fixed; inset: 0; z-index: 80; background: var(--scrim);
      display: flex; align-items: center; justify-content: center; flex-direction: column; }
  #tl-lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; }
  .tl-lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px;
      width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
      font-size: 18px; color: var(--text-mid); background: var(--btn-soft-bg);
      border: 1px solid var(--chip-border);
      border-radius: 50%; cursor: pointer; }
  .tl-usvc-unlock { display: inline-flex; gap: 6px; align-items: center; }
  .tl-usvc-unlock input { width: 110px; background: var(--bg-input); color: var(--text);
      border: 1px solid var(--chip-border); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
  .tl-netrow { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 12.5px; }
  .tl-netrow .tl-val { margin-left: 0; }
  .tl-netrow .sep { flex: 1 1 auto; border-bottom: 1px dotted var(--btn-hover); }
  /* 非原生交互控件: 确认层/通知层/复选框/选择器统一使用主题变量 */
  body.modal-open { overflow: hidden; }
  .ui-modal[hidden], .ui-notice[hidden] { display: none !important; }
  .ui-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.46); }
  .ui-dialog { width: min(440px, 100%); padding: 22px; border: 1px solid var(--glass-bd); border-radius: 22px; background: var(--glass-bg); color: var(--text-title); box-shadow: 0 18px 60px rgba(0,0,0,.32); backdrop-filter: blur(22px); }
  .ui-dialog-title { display:flex; align-items:center; gap:9px; font-weight:700; font-size:16px; margin-bottom:12px; }
  .ui-dialog-msg { white-space: pre-wrap; line-height:1.55; color:var(--text-main); }
  .ui-dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:20px; }
  .ui-action { min-height:40px; padding:9px 16px; border-radius:13px; border:1px solid var(--glass-bd); background:var(--btn-soft-bg); color:var(--text-main); cursor:pointer; font:inherit; }
  .ui-action.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
  .ui-action:hover { filter:brightness(1.08); }
  .ui-notice { position:fixed; z-index:1100; left:50%; bottom:32px; transform:translateX(-50%); max-width:min(520px, calc(100vw - 32px)); padding:12px 16px; border:1px solid var(--glass-bd); border-radius:15px; background:var(--glass-bg); color:var(--text-main); box-shadow:0 12px 36px rgba(0,0,0,.28); backdrop-filter:blur(18px); }
  .ui-select { position:relative; display:flex; align-items:center; justify-content:space-between; min-height:40px; min-width:min(100%, 360px); padding:9px 12px 9px 13px; border:1px solid var(--glass-bd); border-radius:13px; background:var(--glass-bg); color:var(--text-main); cursor:pointer; }
  .ui-select-chevron { color:var(--text-dim); display:flex; }
  .ui-select-menu { position:absolute; z-index:900; left:0; right:0; top:calc(100% + 7px); max-height:260px; overflow:auto; padding:5px; border:1px solid var(--glass-bd); border-radius:15px; background:var(--bg-elev); box-shadow:0 14px 40px rgba(0,0,0,.28); }
  .ui-select-menu[hidden] { display:none; }
  .ui-option { padding:10px 11px; border-radius:10px; color:var(--text-main); cursor:pointer; }
  .ui-option:hover, .ui-option.active { background:var(--btn-soft-hover); color:var(--text-title); }
  .select-model { position:absolute !important; width:1px !important; height:1px !important; opacity:0 !important; pointer-events:none !important; }
  input[type="checkbox"] { appearance:none; -webkit-appearance:none; width:18px; height:18px; margin:0 8px 0 0; vertical-align:-4px; border:1px solid var(--btn-soft-bd); border-radius:5px; background:var(--btn-soft-bg); cursor:pointer; }
  input[type="checkbox"]:checked { border-color:var(--accent); background:var(--accent); }
  input[type="checkbox"]:checked::after { content:""; display:block; width:5px; height:9px; margin:2px 0 0 5px; border:solid #fff; border-width:0 2px 2px 0; transform:rotate(45deg); }
  select { appearance:none; -webkit-appearance:none; min-height:40px; padding:9px 34px 9px 13px; border:1px solid var(--glass-bd); border-radius:13px; color:var(--text-main); background:var(--glass-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%238b8b95' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center; font:inherit; color-scheme:dark; }
  [data-theme="light"] select { color-scheme:light; }
  @media (prefers-reduced-motion: reduce) { .ui-modal, .ui-notice, .ui-dialog { transition:none !important; } }

  .copy-toast { position: fixed; left: 50%; bottom: 32px;
      transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
      background: var(--glass-bg); color: var(--c-green); border: 1px solid var(--glass-bd);
      -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
      box-shadow: var(--glass-shadow);
      border-radius: 999px; padding: 9px 18px; font-size: 12.5px; z-index: 60;
      pointer-events: none; transition: opacity .3s; }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .copy-toast { background: var(--bg-elev); color: var(--c-green); }
  }
  /* 桌面端分类条(右上角): 移动端隐藏(有底部页签); 选中态复用 --nav-pill+--accent */
  #catbar { display: none; gap: 6px; align-items: center; }
  #catbar .cat { appearance: none; border: 1px solid var(--chip-border); background: var(--chip-bg);
      color: var(--text-mid); border-radius: 999px; padding: 7px 15px; font-size: 12.5px;
      cursor: pointer; transition: background .18s ease, color .18s ease; }
  #catbar .cat:hover { color: var(--text-hi); }
  #catbar .cat.active { background: var(--nav-pill); border-color: transparent; color: var(--accent); font-weight: 600; }
  .cat-off { display: none !important; }   /* 分类过滤: 仅桌面 JS 加, 断点切回移动时移除 */
  @media (min-width: 769px) { #catbar { display: flex; } }
  /* "全部"模式预览折叠: 分区限高渐隐 + 右下"查看更多"跳对应分类 */

/* ===== Agent 运行时总览 (rt-*) ===== */
@keyframes rtPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* 过滤 chips + 工具行 */
.rt-toolbar { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; }
.rt-filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 2px; -webkit-mask-image: linear-gradient(90deg, #000 94%, transparent); mask-image: linear-gradient(90deg, #000 94%, transparent); }
.rt-filters::-webkit-scrollbar { display: none; }
.rt-f { flex: none; font-size: 12px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--chip-border); background: var(--chip-bg); color: var(--text-dim); cursor: pointer; transition: color .15s, background .15s; }
.rt-f em { font-style: normal; opacity: .55; margin-left: 5px; font-size: 10.5px; }
.rt-f:hover { color: var(--text-hi); }
.rt-f.on { background: var(--chip-on-bg); color: var(--chip-on-tx); border-color: transparent; font-weight: 600; }
.rt-f.on em { opacity: .7; }

/* 分组区块 */
.rt-sec { margin: 16px 0 2px; }
.rt-sechead { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-dim); font-weight: 700; margin: 0 0 10px; letter-spacing: .04em; }
.rt-sechead .rt-sq { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.rt-sq.run { background: var(--c-green); box-shadow: 0 0 5px rgba(110,200,154,.5); }
.rt-sq.idle { background: var(--c-gray); }
.rt-sq.none { background: transparent; border: 1.5px dashed var(--text-ghost); }
.rt-sechead em { font-style: normal; color: var(--text-ghost); font-weight: 500; }

/* 卡片: 左侧状态竖条 + 内容 */
.rt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: stretch; }
.rt-card { position: relative; background: var(--bg-panel); border: 1px solid var(--border-faint); border-radius: 12px; padding: 12px 14px 11px 17px; display: flex; flex-direction: column; gap: 8px; min-width: 0; overflow: hidden; }
.rt-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.rt-card.run { border-color: rgba(110,200,154,.22); }
.rt-card.run::before { background: var(--c-green); animation: rtPulse 2.6s ease-in-out infinite; }
.rt-card.idle::before { background: var(--border-soft); }

.rt-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rt-head b { font-size: 13.5px; white-space: nowrap; }
.rt-ver { margin-left: auto; font-size: 10.5px; color: var(--text-ghost); max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-sub { font-size: 11.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-procline { font-size: 11.5px; color: var(--text-dim); }
.rt-procline b { color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 额度块: 标签+大百分比 / 6px 条 / 重置时间 */
.rt-q { display: flex; flex-direction: column; gap: 3px; }
.rt-q-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-dim); }
.rt-q-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-q-top b { font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.rt-q.green .rt-q-top b { color: var(--c-green); }
.rt-q.warn .rt-q-top b { color: var(--c-warn); }
.rt-q.red .rt-q-top b { color: var(--c-red); }
.rt-q-track { height: 6px; border-radius: 4px; background: rgba(128,128,128,.14); overflow: hidden; }
.rt-q-track i { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }
.rt-q.green .rt-q-track i { background: var(--c-green); }
.rt-q.warn .rt-q-track i { background: var(--c-warn); }
.rt-q.red .rt-q-track i { background: var(--c-red); }
.rt-q-sub { font-size: 10px; color: var(--text-ghost); }
.rt-q.red .rt-q-sub { color: var(--c-red); opacity: .8; }
.rt-qnone { font-size: 11.5px; color: var(--text-ghost); }

/* 任务行 */
.rt-tasks { display: flex; flex-direction: column; gap: 5px; border-top: 1px dashed var(--border-faint); padding-top: 8px; margin-top: 2px; }
.rt-task { display: flex; align-items: baseline; gap: 7px; font-size: 12px; cursor: pointer; min-width: 0; }
.rt-task:hover .rt-taskgoal { color: var(--accent); }
.rt-taskgoal { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-taskmeta { flex: none; font-size: 10.5px; color: var(--text-ghost); font-variant-numeric: tabular-nums; }
.rt-dot2 { width: 7px; height: 7px; border-radius: 50%; flex: none; align-self: center; }
.rt-dot2.run { background: var(--c-green); }
.rt-dot2.warn { background: var(--c-warn); }
.rt-dot2.dim { background: var(--text-ghost); }

/* 按钮 */
.rt-actions { margin-top: auto; display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.rt-btn { font-size: 12px; padding: 4px 13px; border-radius: 8px; border: 1px solid var(--chip-border); background: var(--chip-bg); color: var(--text-dim); cursor: pointer; flex: none; }
.rt-btn:hover { color: var(--accent); border-color: var(--accent); }
.rt-btn.danger:hover { color: var(--c-red); border-color: var(--c-red); }
.rt-btn.ghost { border-color: transparent; background: transparent; }
.rt-btn:disabled { opacity: .5; cursor: default; }

/* 未安装: 虚线单行 */
.rt-none-list { display: flex; flex-direction: column; gap: 6px; }
.rt-none-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px dashed var(--border-faint); border-radius: 10px; font-size: 12.5px; color: var(--text-dim); }
.rt-none-row b { font-weight: 600; }
.rt-none-row .rt-btn { margin-left: auto; }

/* 其他 */
.rt-low { font-size: 12.5px; color: var(--c-warn); background: rgba(200,150,40,.08); border: 1px solid rgba(200,150,40,.3); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.rt-qrefresh { font-size: 12px; color: var(--text-ghost); margin-top: 8px; }
.rt-empty { padding: 28px 12px; text-align: center; color: var(--text-ghost); font-size: 12.5px; }
.rt-hist { font-size: 11px; color: var(--text-ghost); margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 768px) {
  .rt-grid { grid-template-columns: 1fr; }
  .rt-toolbar { flex-wrap: wrap; }
  .rt-toolbar .rt-btn { margin-left: auto; }
}

/* ===== Agent 页 · 模型区块 (rt-m*) ===== */
.rt-sq.model { background: var(--c-violet); box-shadow: 0 0 5px rgba(157,140,245,.4); }
.rt-mhint { font-size: 11px; color: var(--text-ghost); margin: -4px 0 10px; }
.rt-mgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.rt-mcard { background: var(--bg-panel); border: 1px solid var(--border-faint); border-radius: 12px; padding: 10px 13px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rt-mhead { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rt-mhead b { font-size: 12.5px; white-space: nowrap; }
.rt-mkey { width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); flex: none; }
.rt-mkey.ok { background: var(--c-green); }
.rt-mprobe { font-style: normal; font-size: 9.5px; color: var(--c-warn); border: 1px solid rgba(200,150,40,.4); border-radius: 999px; padding: 1px 7px; flex: none; }
.rt-mhost { margin-left: auto; font-size: 10px; color: var(--text-ghost); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-mrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--border-faint); font-size: 11.5px; }
.rt-mid { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.rt-macts { display: flex; align-items: center; gap: 6px; flex: none; }
.rt-mst { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.rt-mst.ok { color: var(--c-green); }
.rt-mst.err { color: var(--c-red); cursor: help; }
.rt-mst.testing { color: var(--text-ghost); animation: rtPulse 1.4s ease-in-out infinite; }
.rt-macts .rt-btn { font-size: 10.5px; padding: 2px 9px; }
@media (max-width: 768px) { .rt-mgrid { grid-template-columns: 1fr; } }

/* ---- AI 一键清理: 首页面板 + 日志弹层 ---- */
.hp-aiclean-body { display: flex; align-items: center; gap: 12px; padding: 4px 0 10px; }
.hp-aiclean-st { font-size: 12px; color: var(--text-ghost); }
.hp-aiclean-st.running { color: var(--c-green); animation: rtPulse 1.4s ease-in-out infinite; }
.hp-aiclean-st.error { color: var(--c-red); }
.aiclean-dialog { width: min(860px, calc(100vw - 48px)); height: min(78vh, 720px); display: flex; flex-direction: column;
  padding: 18px 20px; border: 1px solid var(--glass-bd); border-radius: 22px; background: var(--glass-bg);
  color: var(--text-title); box-shadow: 0 18px 60px rgba(0,0,0,.32); backdrop-filter: blur(22px); }
.aiclean-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; padding-bottom: 10px; }
.aiclean-st { font-size: 12px; font-weight: 400; color: var(--text-ghost); }
.aiclean-st.running { color: var(--c-green); animation: rtPulse 1.4s ease-in-out infinite; }
.aiclean-st.error { color: var(--c-red); }
.aiclean-log { flex: 1; overflow: auto; margin: 0; padding: 12px 14px; border-radius: 12px; font: 11.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0,0,0,.28); color: var(--text-body, #d8d4cc); white-space: pre-wrap; word-break: break-all; }
.aiclean-actions { display: flex; justify-content: center; padding-top: 10px; }

/* ---- 活动页 (Activity Stream) ---- */
#activity-page { display: flex; flex-direction: column; gap: 14px; }
.act-header { display: flex; align-items: baseline; justify-content: space-between; }
.act-repo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rc-col, var(--text-soft));
  flex-shrink: 0;
}
.btn-act-resume {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-faint);
  background: rgba(128,128,128,.08);
  color: var(--text-soft);
  font-size: 11.5px;
  cursor: pointer;
  transition: all .12s ease;
}
.btn-act-resume:hover {
  background: var(--bg-hover);
  color: var(--text-title);
}
.act-filters { margin-bottom: 6px; }
/* ---- 活动页 GitHub 风格时间线 ---- */
.act-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 32px;
}
.act-date-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.act-date-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: -32px;
  padding: 4px 0 2px;
  user-select: none;
}
.act-node-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 20px;
  flex: none;
  background: transparent;
  z-index: 2;
}
.act-node-svg {
  width: 24px;
  height: 18px;
  color: var(--text-soft);
}
.act-date-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.act-date-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-ghost);
}

/* 仓库连续提交簇: 同一仓库连续提交归为一簇，不同仓库之间通过独立卡片和间距严格隔开 */
.act-repo-cluster {
  position: relative;
}
.act-group-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-faint);
  border-radius: 14px;
  overflow: visible;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.act-card {
  position: relative;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid var(--border-faint);
  background: transparent;
  transition: background .12s ease;
}
.act-card:first-child {
  border-top: none;
  border-top-left-radius: 13px;
  border-top-right-radius: 13px;
}
.act-card:last-child {
  border-bottom-left-radius: 13px;
  border-bottom-right-radius: 13px;
}
.act-card:only-child {
  border-radius: 13px;
}
.act-card:hover {
  background: rgba(128,128,128,.03);
}

/* 节点与小柱子: 只有同一仓库连续提交才由该仓库专属颜色的小柱子连接 */
.act-node {
  position: absolute;
  left: -25px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rc-col, var(--text-soft));
  box-shadow: 0 0 0 3px var(--bg, #0a0a0a);
  z-index: 2;
  transition: transform .12s ease;
}
.act-card:hover .act-node {
  transform: scale(1.15);
}

/* 纵向小柱子脊柱: 起于首条提交节点，止于末条提交节点 */
.act-spine {
  position: absolute;
  left: -21px;
  width: 2.5px;
  background: var(--rc-col, var(--border-subtle));
  border-radius: 1.5px;
  z-index: 1;
}
.act-spine.spine-bot {
  top: 24px;
  bottom: 0;
}
.act-spine.spine-full {
  top: 0;
  bottom: 0;
}
.act-spine.spine-top {
  top: 0;
  height: 24px;
}

@media (max-width: 768px) {
  .act-timeline { padding-left: 26px; gap: 14px; }
  .act-date-header { margin-left: -26px; }
  .act-node-icon { width: 20px; }
  .act-node {
    left: -20px;
    top: 17px;
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 2px var(--bg, #0a0a0a);
  }
  .act-spine {
    left: -17px;
    width: 2px;
  }
  .act-spine.spine-bot {
    top: 21px;
    bottom: 0;
  }
  .act-spine.spine-top {
    top: 0;
    height: 21px;
  }
  .act-card { padding: 11px 12px; gap: 8px; }
}
.act-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.act-badge-repo {
  font-weight: 600;
  color: var(--text-title);
  background: rgba(128,128,128,.12);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11.5px;
}
.act-branch {
  color: var(--text-ghost);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.act-sha {
  font-family: var(--mono, ui-monospace, monospace);
  color: var(--text-soft);
  font-size: 11.5px;
  background: rgba(128,128,128,.08);
  padding: 2px 6px;
  border-radius: 4px;
}
.act-time {
  margin-left: auto;
  color: var(--text-ghost);
  font-size: 11px;
  white-space: nowrap;
}
.act-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.act-subj {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title);
  line-height: 1.45;
  word-break: break-word;
}
.rc-img {
  background: rgba(168, 85, 247, .16);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, .3);
}
.act-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-ghost);
  margin-top: 1px;
}
.act-time-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-soft);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px;
}
.act-author {
  font-size: 11.5px;
  color: var(--text-ghost);
}
.act-dot-sep {
  color: var(--border-subtle, rgba(128,128,128,.3));
}
.act-f-row.is-img {
  background: rgba(168, 85, 247, .08);
  border-radius: 4px;
  padding: 1px 4px;
}
.act-img-dot {
  color: #c084fc;
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}
.act-files-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 4px;
  font-weight: 500;
}
.act-files-box {
  background: rgba(0,0,0,.08);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px;
  max-height: 240px;
  overflow-y: auto;
}
.act-f-row {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.fbadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}
.fbadge-m { background: rgba(234, 179, 8, .18); color: #eab308; }
.fbadge-a { background: rgba(34, 197, 94, .18); color: #22c55e; }
.fbadge-d { background: rgba(239, 68, 68, .18); color: #ef4444; }
.fbadge-r { background: rgba(147, 51, 234, .18); color: #a855f7; }
.act-f-path {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft);
}
.act-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.btn-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-hover, rgba(128,128,128,.1));
  border: 1px solid var(--border-faint);
  border-radius: 7px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-title);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}
.btn-act:hover {
  background: var(--bg-panel);
  border-color: var(--border-subtle);
  color: var(--c-primary, #60a5fa);
}
.btn-act-gh {
  color: var(--text-title);
}
.btn-act-diff {
  color: var(--text-soft);
}
.btn-act-diff.active {
  background: rgba(59, 130, 246, .14);
  border-color: rgba(59, 130, 246, .4);
  color: var(--c-primary, #60a5fa);
}
.act-diff-box {
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-faint);
  background: rgba(0,0,0,.22);
}
.act-diff-pre {
  margin: 0;
  padding: 12px 14px;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-body, #d8d4cc);
}
.diff-line { display: block; min-height: 1.4em; }
.diff-add { background: rgba(34, 197, 94, .14); color: #4ade80; }
.diff-del { background: rgba(239, 68, 68, .14); color: #f87171; }
.diff-hunk { background: rgba(59, 130, 246, .12); color: #93c5fd; font-weight: 600; }
.diff-meta { color: var(--text-ghost); }
.diff-stat { color: #facc15; }

/* ==========================================================================
   Tmux Hub (Tmux 会话中枢)
   ========================================================================== */
.tmux-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.tmux-header h2 {
  margin: 0;
}
.tmux-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.tmux-stat-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-faint);
  border-radius: 9px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tmux-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tmux-stat-val small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-soft);
}
.tmux-stat-lbl {
  font-size: 11px;
  color: var(--text-soft);
}
.tmux-session-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-subtle, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
  position: relative;
}
.tmux-session-card:hover {
  border-color: var(--border-faint, rgba(255,255,255,.18));
}
.tmux-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.tmux-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tmux-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tmux-status-dot.attached {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, .6);
}
.tmux-status-dot.detached {
  background: #3b82f6;
  opacity: .85;
}
.tmux-status-dot.agent {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, .5);
}
.tmux-sname {
  font-size: 15px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-title);
  letter-spacing: -.2px;
}
.tmux-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
}
.tmux-badge-att {
  background: rgba(34, 197, 94, .12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, .25);
}
.tmux-badge-det {
  background: rgba(148, 163, 184, .1);
  color: var(--text-soft);
  border: 1px solid var(--border-faint);
}
.tmux-badge-agent {
  background: rgba(245, 158, 11, .14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, .3);
}
.tmux-badge-repo {
  color: #fff;
  font-weight: 600;
  font-size: 10.5px;
}
.tmux-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-tmux-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border-faint);
  background: var(--bg-hover, rgba(128,128,128,.1));
  color: var(--text-title);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  white-space: nowrap;  /* CJK 可在字间折行: 防按钮被 flex 挤压成一字一行的竖条 */
  flex: none;
}
.btn-tmux-act:hover {
  background: var(--bg-panel);
  border-color: var(--c-primary, #60a5fa);
  color: var(--c-primary, #60a5fa);
}
.btn-tmux-act.active {
  background: rgba(96, 165, 250, .14);
  border-color: rgba(96, 165, 250, .4);
  color: var(--c-primary, #60a5fa);
}
.tmux-meta-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.tmux-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tmux-meta-item code {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-body);
}

/* 标签 / 窗口切换条 */
.tmux-tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-faint);
}
.tmux-tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-hover, rgba(128,128,128,.08));
  border: 1px solid var(--border-faint);
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.tmux-tab-chip:hover {
  color: var(--text-title);
  border-color: var(--border-subtle);
}
.tmux-tab-chip.active {
  background: rgba(96, 165, 250, .12);
  border-color: rgba(96, 165, 250, .45);
  color: var(--c-primary, #60a5fa);
  font-weight: 600;
}
.tmux-tab-star {
  color: #38bdf8;
  font-weight: 700;
}

/* 窗格信息与命令 */
.tmux-pane-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 2px;
  margin-bottom: 6px;
}
.tmux-pane-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tmux-cmd-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(96, 165, 250, .14);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, .25);
}
.tmux-cmd-badge.bun { background: rgba(244, 114, 182, .14); color: #f472b6; border-color: rgba(244, 114, 182, .25); }
.tmux-cmd-badge.node { background: rgba(34, 197, 94, .14); color: #4ade80; border-color: rgba(34, 197, 94, .25); }
.tmux-cmd-badge.zsh, .tmux-cmd-badge.bash { background: rgba(168, 85, 247, .14); color: #c084fc; border-color: rgba(168, 85, 247, .25); }
.tmux-cmd-badge.agy, .tmux-cmd-badge.omp { background: rgba(245, 158, 11, .14); color: #fbbf24; border-color: rgba(245, 158, 11, .25); }

.tmux-pane-title {
  font-size: 12px;
  color: var(--text-body);
  max-width: 450px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tmux-pane-meta {
  font-size: 11px;
  color: var(--text-ghost);
}

/* 终端画面实时预览 */
.tmux-term-preview {
  margin-top: 8px;
  border-radius: 9px;
  border: 1px solid var(--border-faint);
  background: #090c10;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.4);
  overflow: hidden;
}
.tmux-term-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 11px;
  color: var(--text-soft);
}
.tmux-term-dots {
  display: flex;
  gap: 5px;
}
.tmux-term-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
}
.tmux-term-pre {
  margin: 0;
  padding: 10px 14px;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #c9d1d9;
  overflow-x: auto;
  white-space: pre;
  max-height: 260px;
}

/* 关联 Goal 提示条 */
.tmux-goal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .2);
  font-size: 12px;
}
.tmux-goal-banner-left {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fbbf24;
}
.tmux-goal-banner-obj {
  color: var(--text-body);
}

/* ==========================================================================
   Agent Hub (Agent 智能体中枢)
   ========================================================================== */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.agent-header h2 {
  margin: 0;
}
.agent-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-agent-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-faint);
  background: var(--bg-hover, rgba(128,128,128,.1));
  color: var(--text-title);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.btn-agent-top:hover {
  background: var(--bg-panel);
  border-color: var(--c-primary, #60a5fa);
  color: var(--c-primary, #60a5fa);
}
.btn-agent-top.loading {
  opacity: .6;
  pointer-events: none;
}
a.btn-agent-top {
  text-decoration: none;
}
.btn-magpie-portal {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}
.btn-magpie-portal:hover {
  background: rgba(168, 85, 247, 0.22);
  border-color: #a855f7;
  color: #e9d5ff;
}
.mp-portal-link {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  text-decoration: none;
}
.mp-portal-link:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #bae6fd;
}

/* Agent 子视图切换 */
.agent-subnav {
  display: flex;
  gap: 6px;
  margin: 4px 0 14px 0;
  padding: 4px;
  background: var(--bg-hover, rgba(128,128,128,.08));
  border: 1px solid var(--border-faint);
  border-radius: 9px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.agent-subnav::-webkit-scrollbar {
  display: none;
}
.agent-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: all .15s ease;
  user-select: none;
}
.agent-subnav-btn:hover {
  color: var(--text-title);
}
.agent-subnav-btn.active {
  color: var(--chip-on-tx, #111);
  background: var(--chip-on-bg, #f2f2f2);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* Magpie 网关流量面板 */
.mp-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.mp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mp-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 6px;
  border: 1px solid var(--border-faint);
  background: var(--bg-panel, rgba(0,0,0,.2));
  color: var(--text-soft);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.mp-tool-btn:hover {
  color: var(--text-title);
  border-color: var(--border);
}
.mp-tool-btn.active {
  background: var(--bg-hover, rgba(255,255,255,.08));
  color: var(--text-title);
  border-color: var(--border-faint);
}
.mp-period-fresh {
  font-size: 11px;
  color: var(--text-dim);
}
.mp-kpis {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
}
.mp-kpi-sub {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.mp-chart-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-faint);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.mp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mp-card-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mp-chart-sub {
  font-size: 12px;
  color: var(--text-soft);
}
.mp-timeline-chart {
  display: block;
  min-height: 170px;
  padding-top: 4px;
  position: relative;
  outline: none;
  touch-action: pan-y;
}
.mp-timeline-chart:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.mp-trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.mp-trend-grid { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 2 4; }
.mp-trend-axis { fill: var(--text-dim); font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mp-trend-area { fill: color-mix(in srgb, var(--ch-cpu) 14%, transparent); }
.mp-trend-line {
  fill: none; stroke: var(--ch-cpu); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--ch-cpu) 28%, transparent));
}
.mp-trend-dot { fill: var(--ch-cpu); opacity: .65; pointer-events: none; }
.mp-trend-guide { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 4; pointer-events: none; }
.mp-trend-focus { fill: var(--bg-elev); stroke: var(--ch-cpu); stroke-width: 2; pointer-events: none; }
.mp-trend-tip {
  position: absolute; z-index: 5; min-width: 168px; max-width: 240px;
  padding: 9px 11px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-elev); color: var(--text-soft);
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  font-size: 11.5px; line-height: 1.45; pointer-events: none;
  transform: translate(-50%,-100%);
  animation: mp-tip-in .12s ease-out;
}
.mp-trend-tip.below { transform: translate(-50%,0); }
.mp-trend-tip.side { transform: none; }
.mp-trend-tip-kicker { font-size: 10.5px; color: var(--text-dim); white-space: nowrap; }
.mp-trend-tip-cost { margin: 1px 0 6px; font-size: 18px; font-weight: 700; color: var(--text-title); font-variant-numeric: tabular-nums; }
.mp-trend-tip-rows { display: grid; grid-template-columns: auto auto; gap: 2px 14px; align-items: baseline; }
.mp-trend-tip-rows span { color: var(--text-dim); white-space: nowrap; }
.mp-trend-tip-rows b { text-align: right; font-weight: 600; color: var(--text-title); font-variant-numeric: tabular-nums; }
.mp-trend-tip-rows .bad, .mp-trend-tip-rows b.bad { color: var(--c-red); }
@keyframes mp-tip-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mp-trend-tip { animation: none; } }
.mp-grid-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 768px) {
  .mp-grid-columns {
    grid-template-columns: 1fr;
  }
}
.mp-column-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-faint);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
}
.mp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: var(--bg-panel, rgba(0,0,0,.2));
  border: 1px solid var(--border-faint);
  border-radius: 7px;
  transition: border-color .15s;
}
.mp-item:hover {
  border-color: var(--border);
}
.mp-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.mp-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.mp-item-stats {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mp-track {
  width: 100%;
  height: 4px;
  background: rgba(128,128,128,.15);
  border-radius: 2px;
  overflow: hidden;
}
.mp-track-fill {
  height: 100%;
  background: var(--ch-cpu, #6ea8dc);
  border-radius: 2px;
  transition: width .25s ease;
}
.mp-accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.mp-account-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mp-account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.mp-account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-account-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--tbadge-rd-bg);
  color: var(--tbadge-rd-tx);
  border: 1px solid var(--tbadge-rd-bd);
  text-transform: uppercase;
}
.mp-account-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mp-account-quota {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border-faint);
  font-size: 11px;
  color: var(--c-green);
  display: flex;
  align-items: center;
  justify-content: space-between;
}


#agent-view-routing {
  --card: var(--bg-panel, #131313);
  --card-2: var(--bg-hover, #1f1f1f);
  --pill: var(--bg-hover, #222);
  --pill-hover: var(--bg-active, #2a2a2a);
  --line: var(--border, #262626);
  --line-2: var(--border-soft, #1f1f1f);
  --fg: var(--text-title, #f2f2f2);
  --fg-2: var(--text, #d6d6d6);
  --muted: var(--text-dim, #909090);
  --faint: var(--text-ghost, #777);
  --accent-soft: rgba(10, 132, 255, 0.15);
  --green: var(--c-green, #6ec89a);
  --green-soft: rgba(110, 200, 154, 0.15);
  --red: var(--c-red, #e06c6c);
  --red-soft: rgba(224, 108, 108, 0.15);
  --amber: var(--c-warn, #f0b662);
  --amber-soft: rgba(240, 182, 98, 0.15);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --code: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --c1: #a5b4fc;
  --c2: #818cf8;
  --c3: #38bdf8;
  --c4: #f59e0b;
  --c5: #f43f5e;
  --c6: #a855f7;
  --c7: #10b981;
  --k-system: var(--c6);
  --k-tools: var(--c2);
  --k-memory: var(--c4);
  --k-files: var(--c3);
  --k-results: var(--c5);
  --k-chat: var(--c1);
  --k-free: rgba(128, 128, 128, 0.12);
}

.rt-head-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 10px;
  padding: 0 4px;
}
.rt-head-bar .label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title);
}
.rt-head-bar .note {
  font-size: 11.5px;
  color: var(--text-dim);
}
.rt-head-bar .grow {
  flex: 1;
}
.rt-mask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.08));
  color: var(--text-soft);
  font-size: 11.5px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.rt-mask:hover {
  background: var(--bg-active, rgba(255, 255, 255, 0.1));
  color: var(--text-title);
}

/* Magpie Native Routing & Context Window Styles */
.rt {
  margin: 0 0 16px;
}
.rt-top {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}
.rt-what {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.rt-what b {
  color: var(--fg);
  font-weight: 600;
}
.rt-mode {
  margin: 0;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.45;
}
.rt-stage {
  position: relative;
  display: grid;
  grid-template-columns: 120px 120px minmax(0, 1fr);
  column-gap: 52px;
  align-items: start;
  padding: 18px 2px;
}
.rt-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rt-wires path { fill: none; stroke: var(--line); stroke-width: 1.5; transition: opacity .3s; }
.rt-wires path.live { stroke: var(--agent, var(--muted)); stroke-dasharray: 3 5; animation: rtflow .7s linear infinite; }
.rt-wires path.lit { stroke: var(--agent, var(--muted)); }
.rt-wires path.rest { stroke-dasharray: 2 6; opacity: .45; }
@keyframes rtflow { to { stroke-dashoffset: -8; } }

.rt-sky { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rt-sky .pkt { fill: var(--agent, var(--fg)); filter: drop-shadow(0 0 3px var(--agent, var(--muted))); }
.rt-sky .pkt.back { fill: var(--card); stroke: var(--agent, var(--fg)); stroke-width: 2.25; }
.rt-sky .pkt.back.err { fill: var(--agent, var(--card)); stroke: var(--red); }
.rt-sky path.via { fill: none; stroke: none; }
.rt-sky .pkt.held { animation: rtheld 1.2s ease-in-out infinite; }
@keyframes rtheld { 50% { opacity: .45; } }
.rt-flier { color: var(--fg); }
.rt-flier .body, .rt-flier .tail, .rt-flier .wing path:first-child, .rt-flier .wing.far { fill: currentColor; }
.rt-flier .wing.far { opacity: .45; }
.rt-flier .belly { fill: var(--card); }
.rt-flier .wing .bar { fill: none; stroke: var(--card); stroke-width: 1.3; stroke-linecap: round; }
.rt-flier .wing { transform-box: fill-box; transform-origin: 50% 100%; animation: rtflap .42s cubic-bezier(.45, 0, .3, 1) infinite; }
.rt-flier .wing.far { animation-delay: -.03s; }
@keyframes rtflap { 0%, 100% { transform: scaleY(1); } 55% { transform: scaleY(-.62) skewX(-8deg); } }
.rt-flier .rt-lift { animation: rtcome .3s ease-out; transition: transform .45s cubic-bezier(.3, 0, .2, 1), opacity .45s; }
.rt-flier.away .rt-lift { transform: translate(14px, -16px) scale(.8); opacity: 0; }
@keyframes rtcome { from { transform: translate(-6px, -10px) scale(.85); opacity: 0; } }

.rt-srcs { align-self: start; z-index: 1; min-width: 0; display: grid; gap: 10px; }
.rt-srcs.many .rt-node { padding: 8px 8px 7px; }
.rt-src b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0; border-radius: 50%; background: var(--agent); vertical-align: middle; }

.rt-node {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  box-sizing: border-box;
}
.rt-node .rt-ic {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 3px;
  overflow: hidden;
  flex: none;
}
.rt-node .rt-ic .ic,
.rt-node .rt-ic img,
.rt-node .rt-ic svg {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
.rt-node .rt-bird {
  width: 22px;
  height: 22px;
  margin-bottom: 3px;
  object-fit: contain;
  display: block;
}
.rt-node b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rt-node small {
  font-size: 10.5px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rt-hub {
  align-self: start;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
}
.rt-hub i {
  font-style: normal;
  font-size: 10px;
  font-weight: 560;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--line);
  color: var(--fg);
}
.rt-hub.tick, .rt-src.tick { animation: rttick .4s ease-out; }
@keyframes rttick { 40% { transform: scale(1.04); } }

.rt-accts { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; min-width: 0; }
.rt-accts li {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 5px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12.5px;
  transition: opacity .2s, background-color .2s, border-color .2s;
  cursor: pointer;
}
.rt-accts li:hover:not(.rt-sub) {
  background: rgba(255, 255, 255, 0.03);
}
.rt-accts li { margin-left: calc(var(--depth, 0) * 16px); }

/* a group in the group: a heading its models hang from, set in under it */
.rt-accts li.rt-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 2px 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.rt-accts li.rt-sub b {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  flex: none;
}
.rt-accts li.rt-sub.on { color: var(--fg); }
.rt-accts li.rt-sub svg { flex: none; }
.rt-accts li.rt-sub .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
}
.rt-accts li.rt-sub .ic img,
.rt-accts li.rt-sub .ic svg {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: block;
}
.rt-accts li.rt-sub code.mdl {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--code);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-2);
}
.rt-accts li.rt-sub i {
  margin-left: auto;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 560;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg-2);
  white-space: nowrap;
}
.rt-accts li.idle { display: block; color: var(--muted); text-align: center; }

.rt-accts b {
  font-weight: 560;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  min-width: 0;
}
.rt-accts b > span:not(.ic) { font-weight: 450; color: var(--muted); }
.rt-accts b > span.who { color: var(--fg); font-weight: 560; font-size: 12.5px; }
.rt-accts b .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  flex: none;
}
.rt-accts b .ic img, .rt-accts b .ic svg {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: block;
}
.rt-accts b .fb {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 560;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--amber);
  background: var(--amber-soft);
}
.rt-accts b code.mdl, .rt-req code, .rt-act code.mdl {
  font: 500 11px/1.5 var(--code);
  color: var(--fg-2);
  background: var(--card-2);
  border-radius: 4px;
  padding: 0 5px;
}
.rt-accts b code.mdl { margin-left: 6px; font-weight: 450; }
.rt-accts em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt-accts .bar { grid-column: 2 / 4; height: 3px; border-radius: 2px; background: var(--card-2); overflow: hidden; }
.rt-accts .bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--muted); transition: width .4s; }
.rt-accts li.nobar .bar { display: none; }
.rt-accts li.on {
  border-color: rgba(48, 209, 88, 0.4);
  background: rgba(48, 209, 88, 0.05);
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.08);
}
.rt-accts li.filtered {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
}
.rt-accts li.on em { color: var(--green); font-weight: 500; }
.rt-accts li.on .bar i { background: var(--green); }
.rt-accts li.on .dot { background: var(--green); border-color: var(--green); }
.rt-accts li.now .dot { animation: rtlive 1.8s infinite; }
@keyframes rtlive { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 40%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.rt-accts li.low em { color: var(--fg-2); }
.rt-accts li.rest { opacity: .55; }
.rt-accts li.rest em { color: var(--red); opacity: .9; }
@keyframes rtlive { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fg) 40%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.rt-accts li.low em { color: var(--fg-2); }
.rt-accts li.rest { opacity: .55; }
.rt-accts li.rest > :not(.tag) { opacity: .5; }
.rt-accts li.rest em { color: var(--red); opacity: .85; }
.rt-accts li.left > :not(.tag) { opacity: .45; }
.rt-accts li.hit { animation: rthit .45s; }
.rt-accts li.new { animation: rtin .4s ease-out; }
@keyframes rthit { 20% { translate: -5px; } 40% { translate: 4px; } 60% { translate: -2px; } 80% { translate: 1px; } }
.rt-accts .tag { position: absolute; right: 10px; top: -10px; padding: 1px 7px; border-radius: 6px; background: var(--red); color: #fff; font: var(--code-style, normal) 600 10.5px/1.5 var(--code-font, var(--code)); font-stretch: var(--code-stretch, 100%); opacity: 0; transform: translateY(4px) scale(.9); transition: opacity .25s, transform .25s; pointer-events: none; }
.rt-accts li.tagged .tag { opacity: 1; transform: none; }
/* a provider's keys for one model, folded into one row (#1319): it opens
   to head them, as a group in the group heads its models */
.rt-accts li.rt-fold { grid-template-columns: 10px minmax(0, 1fr) auto auto; cursor: pointer; user-select: none; }
.rt-accts li.rt-fold em { white-space: normal; text-align: right; }
.rt-accts li.rt-fold .chev { display: inline-flex; color: var(--muted); transition: transform .2s; }
.rt-accts li.rt-fold:hover .chev { color: var(--fg); }
.rt-accts li.rt-fold.open { background: var(--card-2); }
.rt-accts li.rt-fold.open .chev { transform: rotate(180deg); }
.rt-accts li.rt-fold:focus { outline: none; }
.rt-accts li.rt-fold:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.rt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.rt-cap { flex: 1 1 20em; margin: 0; min-height: 3em; display: flex; align-items: center; font-size: 13px; line-height: 1.45; color: var(--fg); }
.rt-cap.in { animation: rtin .4s ease-out; }
@keyframes rtin { from { opacity: 0; transform: translateY(4px); } }
.rt-stats { display: flex; gap: 18px; font-size: 11px; color: var(--muted); }
.rt-stats > span { display: flex; flex-direction: column; }
.rt-stats b { font-size: 19px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; color: var(--fg); font-variant-numeric: tabular-nums; }
.rt-log { padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
.rt-log-head { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; font-size: 12px; font-weight: 600; color: var(--fg); }
.rt-log-head .grow { flex: 1; }
/* a request's request and response, opened from the story's head */
.rt-bodies { margin-top: 8px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--card); }
.rt-bodies[hidden] { display: none; }
.rt-bodies > .call-details { border-top: 0; }
.rt-bodies > .call-archive { border: 0; }
.rt-bodies > .none, .rt-bodies-gone { margin: 0; padding: 10px 12px; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.rt-bodies > .call-archive-err { padding: 10px 12px 4px; }
.rt-bodies > .call-archive-err + button.text { margin: 0 12px 10px; }
.rt-steps { list-style: none; margin: 6px 0 0; padding: 0; display: grid; align-content: start; gap: 5px; counter-reset: rt; }
.rt-steps li { position: relative; padding-left: 20px; font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
.rt-steps li::before { content: ""; position: absolute; left: 5px; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.rt-steps li.why { color: var(--fg); }
.rt-steps li.why::before { background: var(--fg); }
.rt-steps li.aside { color: var(--muted); }
.rt-steps li.said { font-family: var(--code-font, var(--code)); font-size: 11.5px; overflow-wrap: anywhere; white-space: pre-wrap; }
:where(html[data-fonts]) .rt-steps li.said { font-style: var(--code-style, inherit); font-weight: var(--code-weight, inherit); font-stretch: var(--code-stretch, 100%); }
.rt-stats > span.rt-errs:not([aria-disabled="true"]) { cursor: pointer; }
.rt-stats > span.rt-errs:not([aria-disabled="true"]):hover b { color: var(--red); }
.rt-steps li.aside::before { background: none; border: 1px solid var(--muted); width: 4px; height: 4px; }
.rt-steps li.ok::before { background: var(--green); }
.rt-steps li.bad::before { background: var(--red); }
.rt-steps li.wait::before { animation: rtlive 1.8s infinite; }
/* where a try's time went: one stacked bar, magpie's, the network's and
   the vendor's told apart by a swatch, each part named with its time */
.rt-time { display: grid; gap: 5px; max-width: 560px; }
.rt-time-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; color: var(--fg-2); }
.rt-time-who { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.rt-time-who::before, .rt-time-parts li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--rt-time); }
.rt-time-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); gap: 1px; }
.rt-time-bar span { min-width: 2px; background: var(--rt-time); }
.rt-time-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.rt-time-parts li { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; }
.rt-time-parts .v { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.rt-time .magpie { --rt-time: var(--accent); }
.rt-time .net { --rt-time: var(--amber); }
.rt-time .vendor { --rt-time: var(--fg-2); }
.rt-off { padding: 18px 4px; text-align: center; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .rt-accts li.now .dot, .rt-wires path.live, .rt-sky .pkt.held, .rt-accts li.new, .rt-accts li.hit, .rt-hub.tick, .rt-src.tick, .rt-cap.in, .rt-steps li.wait::before, .masking .pii { animation: none; }
  .rt-accts li { transition: none; }
}
/* The narrow and wide layouts below go by a box's own width, as container
   queries would: client.js sets max560 on a box 560px wide or less, min1150
   on one 1150px or wider. Not container queries: in WebKit they kept the
   page from scrolling to its end (#1249). :where() keeps each rule as
   strong as it was inside its query. */
/* a narrow list: what a row says goes under its name */
.rt-accts:where(.max460) li { grid-template-columns: 10px minmax(0, 1fr); }
.rt-accts:where(.max460) em { grid-column: 2; white-space: normal; }
.rt-accts:where(.max460) .bar { grid-column: 2; }
.rt-accts:where(.max460) li.rt-fold { grid-template-columns: 10px minmax(0, 1fr) auto; }
.rt-accts:where(.max460) li.rt-fold em { grid-row: 2; text-align: left; }
.rt-accts:where(.max460) li.rt-fold .chev { grid-column: 3; grid-row: 1; }
/* narrow: magpie and the agent side by side, the accounts under them */
/* 移动端专属流水线 Pipeline (PC 端隐藏) */
.rt-pipeline-m { display: none; }

/* 移动端 (≤768px): 聚焦当前任务与指派流向，摒弃小内滚框 */
@media (max-width: 768px) {
  .rt-pipeline-m {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }
  .rt-m-reqs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
  }
  .rt-m-reqs-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    flex: none;
  }
  .rt-m-reqs-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
  }
  .rt-m-reqs-scroll::-webkit-scrollbar { display: none; }
  .rt-m-req-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1.3;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--fg-2);
    white-space: nowrap;
    cursor: pointer;
    flex: none;
    transition: all .15s ease;
  }
  .rt-m-req-chip.active {
    background: var(--card-2);
    border-color: rgba(48, 209, 88, 0.45);
    color: var(--fg);
    font-weight: 600;
  }
  .rt-m-req-chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
  }
  .rt-m-req-chip .dot.live {
    background: #30d158;
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.6);
  }

  /* 核心流水线三段卡片 */
  .rt-m-pipeline-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .rt-m-pipeline-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .rt-m-pipeline-title b {
    color: var(--fg);
    font-weight: 600;
  }
  .rt-m-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1.35fr;
    align-items: center;
    gap: 4px;
  }
  .rt-m-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--faint);
    width: 14px;
    flex: none;
  }
  .rt-m-arrow svg {
    width: 13px;
    height: 13px;
    stroke: var(--muted);
    opacity: 0.7;
  }
  .rt-m-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 4px 7px;
    border-radius: 8px;
    background: var(--card-2);
    border: 1px solid var(--line);
    min-width: 0;
    box-sizing: border-box;
  }
  .rt-m-node.rt-m-winner {
    background: rgba(48, 209, 88, 0.08);
    border-color: rgba(48, 209, 88, 0.35);
    box-shadow: 0 0 12px rgba(48, 209, 88, 0.12);
  }
  .rt-m-node-tag {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    white-space: nowrap;
    letter-spacing: .02em;
  }
  .rt-m-node-tag.winner-tag {
    color: #30d158;
  }
  .rt-m-node .rt-ic, .rt-m-node .rt-bird {
    width: 22px;
    height: 22px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }
  .rt-m-node .rt-ic img, .rt-m-node .rt-ic svg {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }
  .rt-m-node b {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--fg);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
  }
  .rt-m-node small {
    font-size: 10px;
    color: var(--muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .rt-m-node code.mdl {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--card);
    color: var(--fg-2);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    margin-top: 2px;
  }
  .rt-m-node code.mdl.highlight {
    color: #30d158;
    background: rgba(48, 209, 88, 0.15);
    font-weight: 600;
  }

  /* 命中节点执行详情条 */
  .rt-m-winner-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(48, 209, 88, 0.05);
    border: 1px solid rgba(48, 209, 88, 0.18);
  }
  .rt-m-winner-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
  }
  .rt-m-winner-row1 b {
    color: var(--fg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
  }
  .rt-m-winner-status {
    font-size: 11px;
    font-weight: 600;
    color: #30d158;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
  }
  .rt-m-winner-row2 {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 10.5px;
    color: var(--muted);
  }
  .rt-m-winner-row2 span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
  }
  .rt-m-winner-row2 b {
    color: var(--fg-2);
    font-weight: 500;
  }

  /* 移动端舞台重构: 隐藏孤立方块与断线，全宽平铺候选列表，不限高不内滚 */
  .rt-stage {
    grid-template-columns: 1fr;
    padding: 4px 0 0;
    column-gap: 0;
    row-gap: 0;
  }
  .rt-srcs, .rt-hub, .rt-wires, .rt-sky {
    display: none !important;
  }
  .rt-pool-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 8px 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .rt-accts {
    grid-column: 1 / -1;
    padding-left: 0;
    max-height: none !important;
    overflow-y: visible !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }
  .rt-accts li {
    grid-template-columns: 8px minmax(0, 1fr);
    padding: 8px 10px;
    margin-bottom: 4px;
  }
  .rt-accts li.on {
    border-color: rgba(48, 209, 88, 0.4);
    background: rgba(48, 209, 88, 0.05);
  }
  .rt-accts em { grid-column: 2; white-space: normal; }
  .rt-accts .bar { grid-column: 2; }
  .rt-stats { gap: 14px; }
  .ctx-waffle { grid-template-columns: repeat(20, 1fr) !important; }
}
@media (max-width: 640px) {
  .rt-head-bar .note { display: none; }
  .rt-head-bar .label { font-size: 13px; }
  .rt-head-bar .rt-mask { padding: 3px 7px; font-size: 11px; }
}
:where(.rt.max560) .rt-stage { grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 26px; padding: 16px 0; }
:where(.rt.max560) .rt-accts { grid-column: 1 / -1; padding-left: 0; }
.rt-accts:where(.max560) li { grid-template-columns: 10px minmax(0, 1fr); }
.rt-accts:where(.max560) em { grid-column: 2; white-space: normal; }
.rt-accts:where(.max560) .bar { grid-column: 2; }
:where(.rt.max560) .rt-stats { gap: 14px; }
/* the Routing view */
#agent-view-routing .row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 16px 0 8px; padding: 0 2px; min-height: 26px; }
#agent-view-routing .row-head .label { font-size: 13px; font-weight: 600; color: var(--fg); letter-spacing: .01em; }
#agent-view-routing .row-head .note { font-size: 11px; color: var(--faint); }
/* 标题行右侧的小页签（Live / Today N / By Request）: 与全站 chips 同语言 */
.rt-tab-btn { font-size: 11px; font-weight: 500; line-height: 1.5; padding: 3px 10px; border-radius: 999px; color: var(--muted); cursor: pointer; user-select: none; transition: background .15s ease, color .15s ease; }
.rt-tab-btn:hover { color: var(--fg-2); background: var(--card-2); }
.rt-tab-btn.on { color: var(--fg); background: var(--card-2); font-weight: 600; }
@media (max-width: 480px) {
  #agent-view-routing .row-head .note { flex: 1 1 100%; order: 1; margin-top: 2px; }
}
.rt-mask, .rt-newgroup { display: inline-flex; align-items: center; gap: 5px; }
.rt-mask svg, .rt-newgroup svg { width: 13px; height: 13px; flex: none; }
/* the routing groups' New group, at the top too: the groups sit below the
   requests, out of sight on a first look (#944) */
.rt-newgroup { margin-right: 6px; }
.rt-gnew { display: inline-flex; align-items: center; gap: 4px; }
/* on, it says so in its struck eye and its words, a shade darker: a
   page tool, not a banner */
.rt-mask[aria-pressed="true"] { color: var(--fg); font-weight: 600; }
/* 账号与邮箱: 默认清晰，仅在 .masking 或静态快照 body.is-static 下模糊打码 */
.pii {
  transition: filter .2s ease, opacity .2s ease;
}
.masking .pii,
body.is-static .pii,
.masking .is-masked {
  filter: blur(4px);
  opacity: .55;
  user-select: none;
}
.masking .pii:hover,
body.is-static .pii:hover,
.masking .is-masked:hover {
  filter: blur(4px) !important;
}
/* 静态快照下彻底隐藏所有打码切换按钮 */
body.is-static #rtMask,
body.is-static #mp-btn-mask,
body.is-static .rt-mask {
  display: none !important;
}

/* 返回实时按钮 */
.btn-rt-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(48, 209, 88, 0.45);
  background: rgba(48, 209, 88, 0.12);
  color: #30d158;
  cursor: pointer;
  margin-left: 8px;
  user-select: none;
  transition: all .15s ease;
}
.btn-rt-live:hover {
  background: rgba(48, 209, 88, 0.22);
  transform: translateY(-0.5px);
}

/* 账号反查筛选提示条 */
.rt-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--fg-2);
}
.btn-rt-clear-filter {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
}
.btn-rt-clear-filter:hover {
  color: var(--fg);
}

/* 静态快照中的脱敏占位符: 打码, 不可取消 */
.redact-mosaic { filter: blur(2.2px); opacity: .5; user-select: none; -webkit-user-select: none; }
#agent-view-routing .rt { margin: 0; }
.rt-more { padding-bottom: 12px; }
.rt-cols { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 16px; }
/* side by side, the accounts end where the requests do and scroll like
   them, not run on down the page beside an empty column: of no height of
   their own, they take what the requests give the row, and no less than a
   few accounts'. Only where the requests' column still keeps each request
   on one line (wider than 760px, see below): narrower, one column of
   one-line requests reads better than two with each request on three
   (#860, huoranxuanyuan). Where the page is 1150px wide or more. Kept to
   28%, no more than 360px: in a page kept to 1200px the accounts had room
   to spare while the requests' models were cut (#1926, hibaliqya-yonma) */
:where(.rt-more.min1150) .rt-cols { grid-template-columns: minmax(0, 1fr) clamp(260px, 28%, 360px); }
:where(.rt-more.min1150) .rt-cols:not(.solo) .rt-col:last-child { display: flex; flex-direction: column; }
:where(.rt-more.min1150) .rt-cols:not(.solo) .rt-acts { flex: 1 1 auto; height: 0; min-height: 216px; overflow-y: auto; overscroll-behavior: contain; }
/* each column sized by its own width: a request's row lays itself out by
   the list's width, not the page's (#273: in two columns of ~470px the
   rows kept to one line, and the reasoning was drawn over the numbers) */
.rt-col { min-width: 0; }
/* the model that answered keeps room of its own (at least 14em, or 30%
   of a narrower list) and the metrics wrap in theirs, up to 40%: an auto
   column took the widest row's metrics for every row, and the model went
   to "· hi…" (#1926, hibaliqya-yonma) */
.rt-reqs { padding: 4px; max-height: 420px; overflow-y: auto; display: grid; grid-template-columns: auto fit-content(32%) minmax(min(14em, 30%), 1fr) fit-content(40%); row-gap: 2px; }
.rt-req { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; column-gap: 12px; padding: 6px 8px; font: inherit; font-size: 12px; text-align: left; color: var(--fg-2); background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.rt-req:hover { background: var(--card-2); }
.rt-req[aria-pressed="true"] { background: var(--card-2); border-color: var(--line); color: var(--fg); }
.rt-req .at { font-variant-numeric: tabular-nums; color: var(--muted); }
.rt-req .asked { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rt-req .asked i.ag { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--agent); }
.rt-req .asked .ic, .rt-req .asked .ic img, .rt-req .asked .ic svg { width: 14px; height: 14px; flex: none; }
.rt-req .m, .rt-req .to span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-req .to { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--fg); }
.rt-req .to .said { flex-shrink: 100000; min-width: min(9em, 60%); }
.rt-req .to .said.split { display: flex; }
.rt-req .to .said .who { flex: 0 1000 auto; min-width: 2.5em; }
.rt-req .to .said .mdl { flex: none; max-width: calc(100% - 2.5em); white-space: pre; }
/* on a phone the account keeps a few letters, not a sliver of one (40px,
   where phone-rows.test.cjs calls a text cut to a sliver) */
@media (max-width: 600px) {
  .rt-req .to .said .who { min-width: 40px; }
  .rt-req .to .said .mdl { max-width: calc(100% - 40px); }
}
.rt-req .to i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.rt-req.moved .to i { background: var(--accent); }
.rt-req.bad .to { color: var(--red); }
.rt-req.bad .to i { background: var(--red); }
.rt-req.wait .to i { background: var(--muted); animation: rtlive 1.8s infinite; }
/* the reasoning keeps to its own box: what it was asked at is cut first,
   then what it was sent at, never drawn over the numbers beside it (#435) */
.rt-req .to .ef { flex: 0 1 auto; display: flex; min-width: 0; margin-left: -2px; color: var(--muted); }
.rt-req .ef::before { content: "· "; flex: none; white-space: pre; }
.rt-req .to .ef span { min-width: 0; white-space: pre; }
.rt-req .to .ef .was { flex-shrink: 100000; }
.rt-req .to .ef.picked { color: var(--fg-2); }
.rt-req .ef .was { opacity: .75; }
/* what a call was for (a Codex guardian review, a title…): a quiet grey tag by the model */
.rt-req .asked .kind, .rp-req .kind, .rt-steps li .kind { flex: none; font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px; color: var(--muted); background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; }
.rt-steps li .kind { display: inline-block; vertical-align: 1px; }
.rt-steps li .rt-named { white-space: nowrap; }
.rt-steps li .rt-named > .ic { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
/* in a narrow row the model keeps its room first: the tag gives way, to an ellipsis */
.rt-req .asked .kind { flex: 0 100 auto; min-width: 3.2em; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.rt-req .asked.kinded .m { flex: none; max-width: calc(100% - 3.2em - 40px); }
.rt-req .to .swap, .rt-steps li .swap { font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px; color: var(--amber); background: var(--amber-soft); white-space: nowrap; }
.rt-req .to .swap { flex: none; max-width: 70%; }
.rt-req .to .routed, .pr-to .routed { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.rt-steps li.swap::before { background: var(--amber); }
/* short of room, where it went gives way down to the provider's name, then this does
   (.upstreamed, set with the tag: Safari before 15.4 has no :has()) */
.rt-req .to.upstreamed .said { min-width: min(10em, 45%); }
.rt-req .to .upstream, .pr-to .upstream { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.rt-req .meta { display: flex; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; gap: 2px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.rt-metric { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; min-width: 0; }
.rt-metric .k { color: var(--muted); }
.rt-metric .v { font-variant-numeric: tabular-nums; }
.rt-req .tokens, .rt-session .rt-token-total { cursor: help; }
.rt-req .meta .retry-count { white-space: nowrap; }
.rt-req .meta > * + .rt-metric::before { content: "·"; margin: 0 2px; }
.rt-req .meta .cost-metric { margin-left: 10px; color: var(--fg-2); }
.rt-req .meta .cost-metric::before { display: none; }
.rt-req .meta[hidden] { display: none; }
.rt-session { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; padding: 9px 8px; margin-top: 4px; font: inherit; font-size: 12px; text-align: left; color: var(--fg-2); background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; }
button.rt-session { cursor: pointer; }
.rt-session .arrow { flex: none; width: 10px; color: var(--muted); }
.rt-session .nm { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rt-session .summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rt-session > .cost { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; }
.rt-session > .cost[hidden] { display: none; }
.rt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.rt-filters > .rt-days { flex: 1; min-width: 0; }
.rt-group-by { flex: none; }
/* Purpose is a list tool in its heading; the bar below chooses day and view. */
.rt-purpose-tools { flex: none; display: inline-flex; align-items: center; margin-left: 8px; border-radius: 6px; }
.rt-purpose-tools.set { background: var(--pill); }
.rt-purpose { display: inline-flex; align-items: center; gap: 3px; max-width: 180px; height: 24px; }
.rt-purpose span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-purpose svg { flex: none; opacity: .7; transition: transform .15s var(--ease); }
.rt-purpose.open svg { transform: rotate(180deg); }
.rt-metric-pick { display: inline-flex; align-items: center; gap: 3px; height: 24px; margin-left: 6px; }
.rt-metric-pick.open svg { transform: rotate(180deg); }
.pop.proto-menu.rt-metric-menu { width: 190px; max-width: calc(100vw - 16px); background: var(--card); }
.rt-metric-menu .pm-item { align-items: center; }
.rt-metric-menu .pm-tick { height: 13px; width: 13px; border: 1px solid var(--line); border-radius: 3px; }
.rt-metric-menu .on .pm-tick { border-color: var(--muted); }
.rt-metric-menu .pm-note { display: none; }
.rt-purpose-tools.set .rt-purpose { color: var(--fg-2); }
.rt-purpose-clear { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 24px; padding: 0; }
.pop.proto-menu.rt-purpose-menu { width: 190px; max-width: calc(100vw - 16px); background: var(--card); }
.rt-purpose-menu .pm-head, .rt-purpose-menu .pm-note { display: none; }
.rt-purpose-menu .pm-item { align-items: center; padding: 7px 8px; }
.rt-purpose-menu .pm-tick { height: 13px; width: 13px; border: 1px solid var(--line); border-radius: 3px; }
.rt-purpose-menu .on .pm-tick { border-color: var(--muted); }
.rt-purpose-menu .pm-name { font-weight: 400; overflow-wrap: anywhere; }
:where(.rt-col.max440) .rt-purpose { max-width: 150px; }
/* Keep the compact row on wide lists. In a narrow column the destination
   and the metrics go under the model; individual metrics stay whole. */
/* Where a request's numbers don't fit their column on one line (set by
   metaFit), they go on a line of their own under where it went, which keeps
   its room (#2288, xishuchkui-code). */
:where(.rt-col.meta-under:not(.max760)) .rt-reqs { grid-template-columns: auto fit-content(45%) minmax(0, 1fr); }
:where(.rt-col.meta-under:not(.max760)) .rt-req { row-gap: 2px; }
:where(.rt-col.meta-under:not(.max760)) .rt-req .meta { grid-column: 2 / -1; grid-row: 2; justify-content: flex-start; }
:where(.rt-col.max760) .rt-reqs { grid-template-columns: auto minmax(0, 1fr); }
:where(.rt-col.max760) .rt-req { row-gap: 2px; }
:where(.rt-col.max760) .rt-req .asked { grid-column: 2; grid-row: 1; }
:where(.rt-col.max760) .rt-req .to { grid-column: 2; grid-row: 2; }
:where(.rt-col.max760) .rt-req .meta { grid-column: 2; grid-row: 3; justify-content: flex-start; }
.rt-acts { padding: 4px 0; }
.rt-cols.solo { grid-template-columns: minmax(0, 1fr); }
.rt-reqs.none { display: block; background: none; border-color: transparent; }
.rt-reqs.none .empty-state { padding: 14px 12px 18px; font-size: 12px; line-height: 1.6; }
.rt-reqs.none .empty-state b { font-size: 13px; }
.rt-prov { display: flex; align-items: center; gap: 7px; padding: 8px 12px 4px; font-size: 12px; }
.rt-prov .ic, .rt-prov .ic img, .rt-prov .ic svg { width: 14px; height: 14px; }
.rt-prov > span:last-child { margin-left: auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.rt-prov:not(:first-child) { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
/* a routing named where it can be changed: a way to where it is set */
.rt-go { cursor: pointer; }
.rt-go::after { content: " ›"; }
/* :focus-visible in rules of its own: Safari before 15.4 drops a list
   holding it whole, hover included */
.rt-prov > span.rt-go:hover { color: var(--fg); border-color: var(--fg); }
.rt-prov > span.rt-go:focus-visible { color: var(--fg); border-color: var(--fg); }
.rt-hub i.rt-go:hover { box-shadow: 0 0 0 3px var(--card-2), 0 0 0 4px var(--fg); }
.rt-hub i.rt-go:focus-visible { box-shadow: 0 0 0 3px var(--card-2), 0 0 0 4px var(--fg); }
.rt-go:focus-visible { outline: none; }
.rt-found { animation: rtfound 1.4s ease-out; }
@keyframes rtfound { 0%, 40% { box-shadow: inset 0 0 0 2px var(--fg); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { .rt-found { animation: none; } }
.rt-act { display: grid; gap: 3px; padding: 6px 12px 6px 33px; font-size: 12px; }
.rt-act .nm { display: flex; gap: 6px; min-width: 0; }
.rt-act .nm b { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-act .nm span { color: var(--muted); white-space: nowrap; }
.rt-act .st { color: var(--fg-2); }
.rt-act .st:empty { display: none; }
.rt-act .st.rest { color: var(--red); }
.rt-act .st.left { color: var(--muted); }
/* the accounts' allowances read again by hand (#1834), beside the heading */
.rt-read { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; margin: -3px 0 -3px 6px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.rt-read[hidden] { display: none; }
.rt-read:hover { color: var(--fg); background: var(--pill-hover); }
.rt-read:focus-visible { color: var(--fg); background: var(--pill-hover); outline: none; }
.rt-read svg { flex: none; }
.rt-read.busy { cursor: default; color: var(--fg-2); }
.rt-read.busy svg > * { transform-box: view-box; transform-origin: 50% 50%; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .rt-read.busy svg > * { animation: none; } }
/* a subscription account's windows each (#1833), under its one figure */
.rt-act .wins { display: flex; flex-wrap: wrap; gap: 2px 12px; min-width: 0; color: var(--fg-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.rt-act .wins span { min-width: 0; overflow-wrap: anywhere; }
.rt-act .tally { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.rt-act .tally .bad { color: var(--red); }
.rt-act .mdls { display: flex; flex-wrap: wrap; gap: 4px; }
.rt-act .mdls code { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-act .fix { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px; }
.rt-act .bar { height: 3px; border-radius: 2px; background: var(--card-2); overflow: hidden; }
.rt-act .bar i { display: block; height: 100%; border-radius: 2px; background: var(--muted); }
/* a provider's keys summed up in one row (#1319), opened to each */
.rt-act.rt-keys { cursor: pointer; user-select: none; }
.rt-act.rt-keys .chev { display: inline-flex; align-self: center; margin-left: auto; color: var(--muted); transition: transform .2s; }
.rt-act.rt-keys:hover .chev { color: var(--fg); }
.rt-act.rt-keys.open .chev { transform: rotate(180deg); }
.rt-act.rt-keys:focus { outline: none; }
.rt-act.rt-keys:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.rt-livedot { width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--green); animation: rtlive 1.8s infinite; --fg: var(--green); }
@media (prefers-reduced-motion: reduce) { .rt-livedot { animation: none; } }
/* routing groups, and the providers routing over several of their own */
.rt-gsec { display: grid; gap: 6px; margin-top: 16px; }
.rt-gsec .row-head .note { margin-right: 6px; }
/* the groups filtered by name and model, beside Select and New group */
.rt-gsec .rt-gfilter { width: 190px; min-width: 0; flex: 0 1 190px; height: 24px; margin: 0 6px 0 4px; }
.rt-gsec .rt-pools { margin-bottom: 0; }
.rt-gsec .row-head + .list + .row-head { margin-top: 8px; }
.rt-groups > *, .rt-pools > * { border-top: 1px solid var(--line-2); }
.rt-groups > :first-child, .rt-pools > :first-child { border-top: 0; }
.rt-group { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; cursor: pointer; transition: background .12s; }
.rt-group:hover { background: var(--card-2); }
.rt-group.off { opacity: .6; }
/* switched off as a whole: dimmed but for its switch, which brings it back */
.rt-group.disabled > :not(.rt-gon) { opacity: .5; }
.rt-group .rt-gon { flex: none; transform: scale(.85); }
.rt-group .ics { display: flex; gap: 3px; flex: none; min-width: 18px; }
.rt-group .ics .ic { width: 16px; height: 16px; }
/* a group's logos are its handle (#779), as an agent row's logo is: the
   grip in the row's left margin is drawn only while the row is under the
   pointer, dragged, or its handle has the keyboard or its menu open —
   always there it is clutter, as on the Agents page. .ag-handle is in the
   selector so it outweighs body.window .ag-handle, whose 28px held a stack
   of logos in, spilling it over the card's left edge onto the name (ARNO
   on Discord) */
.rt-group .rt-ghandle.ag-handle { position: relative; align-items: center; justify-content: center; width: auto; min-width: 24px; height: 24px; padding: 0 3px; }
.rt-group .rt-ghandle::before { content: ""; position: absolute; left: -7px; top: 50%; width: 5px; height: 11px; margin-top: -5.5px; background: radial-gradient(circle, var(--muted) .9px, transparent 1.2px) 0 0 / 3.5px 3.75px; opacity: 0; transition: opacity .15s; }
.rt-group:is(:hover, .dragging) .rt-ghandle::before, .rt-group .rt-ghandle.open::before { opacity: 1; }
/* apart: Safari before 15.4 drops a whole selector list with :focus-visible in it */
.rt-group .rt-ghandle:focus-visible::before { opacity: 1; }
/* while a row is dragged the others slide out of its way */
.rt-groups.sorting { user-select: none; -webkit-user-select: none; }
.rt-groups.sorting > .rt-group { transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.rt-groups.sorting .rt-ghandle { cursor: grabbing; }
.rt-groups > .rt-group.dragging { position: relative; z-index: 2; background: var(--card); box-shadow: 0 6px 18px rgba(20, 22, 30, .12), 0 0 0 1px var(--line); border-radius: 8px; transition: none; }
@media (prefers-reduced-motion: reduce) { .rt-groups.sorting > .rt-group { transition: none; } }
.rt-group .main { flex: 1; min-width: 0; }
.rt-group .nm { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.rt-group .nm b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-group .nm code.mdl { font: var(--code-style, normal) 500 11px/1.5 var(--code-font, var(--code)); font-stretch: var(--code-stretch, 100%); color: var(--fg-2); background: var(--card-2); border-radius: 5px; padding: 0 5px; white-space: nowrap; }
.rt-group .nm small.auto { font-size: 11px; color: var(--faint); white-space: nowrap; }
.rt-group .mem { margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  /* 路由组模型列表窄屏换行, 避免整行截断(需放在基础规则之后) */
  .rt-group .mem { white-space: normal; overflow-wrap: anywhere; }
}
/* a pattern the group finds models by, and how many it matches now */
.rt-group .mem.pat code, .rt-pats code { font: var(--code-style, normal) 500 11px/1.5 var(--code-font, var(--code)); font-stretch: var(--code-stretch, 100%); color: var(--fg-2); }
.rt-group .mem.pat.none, .rt-pats .fbrow.none small { color: var(--amber); }
/* a classifier that failed (#1929): a dot, never a stripe */
.rt-group .mem.clsfail { color: var(--amber); }
.rt-group .mem.clsfail .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.rt-patadd { display: flex; gap: 6px; align-items: center; }
.rt-pats .fbl:not(:empty) + .rt-patadd { margin-top: 4px; }
.rt-patadd input { flex: 1; min-width: 0; }
.rt-group .tags { display: flex; gap: 4px; flex: none; }
.rt-group .tag { font-size: 11px; line-height: 18px; padding: 0 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); white-space: nowrap; }
.rt-group .tag.bad { color: var(--red); }
.rt-group .tag.idle { opacity: .55; }
/* a manual group's members on its card: the one picked, marked by a dot */
.rt-picks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.rt-pick { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0; height: 22px; padding: 0 8px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.rt-pick:hover { color: var(--fg); border-color: var(--muted); background: var(--card); }
.rt-pick .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--faint); }
.rt-pick .ic, .rt-pick .ic-stack { width: 13px; height: 13px; flex: none; }
.rt-pick .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-pick small { color: var(--faint); font-size: 10.5px; white-space: nowrap; }
.rt-pick.on { color: var(--fg); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); cursor: default; }
.rt-pick.on .dot { background: var(--accent); box-shadow: none; }
.rt-pick.off { opacity: .55; }
.rt-pick:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.rt-gnone { padding: 14px; font-size: 12px; line-height: 1.5; }
.rt-gfound, .rt-gnames { display: flex; align-items: center; gap: 12px; padding: 2px 4px 4px; }
.rt-gfound .txt, .rt-gnames .txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rt-gfound b, .rt-gnames b { font-size: 12.5px; font-weight: 600; }
.rt-gfound small, .rt-gnames small { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
/* the names setting's three choices go under its words when it is narrow */
.rt-gnames { flex-wrap: wrap; }
.rt-gnames .txt { flex-basis: 220px; }
.rt-ghidden { display: flex; align-items: center; padding: 4px 12px 4px 8px; }
.rt-ghidden .rt-gremoved { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--faint); }
.rt-ghidden .rt-gremoved:hover, .rt-ghidden .rt-gremoved.open { color: var(--fg-2); }
.rt-gsel { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; }
.rt-group.rt-gpick { cursor: default; }
.rt-group.rt-gpick.on { background: var(--card-2); }
.rt-gedit { cursor: default; scroll-margin-top: 12px; }
.rt-gedit .ehead.fold { cursor: pointer; }
.rt-gedit .segs { max-width: 100%; }
/* its hint as close under the choices as every other row's: 4px */
.rt-gedit .ctx-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rt-gedit .ctx-wrap .hint { flex-basis: 100%; margin-top: 0; }
.rt-gedit .gsuffix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.rt-gedit .gsuffix .hint { overflow-wrap: anywhere; }
.rt-gedit .ctx-wrap input.ctx-in { width: 96px; flex: none; }
.rt-gedit .ctx-wrap input.first-in { width: 64px; }
.rt-gedit .ctx-wrap .first-unit { margin-left: -2px; color: var(--muted); font-size: 12px; }
.rt-gedit .ctx-wrap .first-unit[hidden] { display: none; }
.rt-pool { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px 10px 14px; }
.rt-pool .nm { flex: 1 1 12em; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.rt-pool .nm .ic { width: 16px; height: 16px; }
.rt-pool .nm b { font-weight: 600; }
.rt-pool .nm span:last-child { font-size: 12px; color: var(--muted); }
/* a label column and a control column, so Routing's and Stays' segments
   start at one edge whatever their labels' widths */
.rt-pool .ctl { display: grid; grid-template-columns: auto auto; align-items: center; justify-items: start; gap: 6px 8px; }
.rt-pool .lab { display: contents; }
.rt-pool .lab small { font-size: 11px; color: var(--muted); }
@media (max-width: 560px) { body:not(.web) .rt-group .tags { display: none; } }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  body.web .rt-group {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; /* the logos as wide as they are */
    gap: 6px 8px; padding: 12px 12px 12px 14px; /* the grip's room, as wide */
  }
  body.web .rt-group .tags { display: flex; flex-wrap: wrap; grid-column: 2 / -1; grid-row: 2; }
  body.web .rt-group > .text { grid-column: 3; grid-row: 1; }
  body.web .rt-group .nm { flex-wrap: wrap; }
  body.web .rt-group .mem { white-space: normal; overflow-wrap: anywhere; }
  body.web .rt-pick { height: auto; min-height: 44px; padding: 8px; font-size: 12.5px; }
  body.web .rt-pick { flex-wrap: wrap; }
  body.web .rt-gedit { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
  body.web .rt-gedit label { text-align: left; padding-top: 8px; }
  body.web .rt-gedit .segs { flex-wrap: wrap; }
  body.web .rt-gedit .fbrow { flex-wrap: wrap; justify-content: normal; }
  body.web .rt-gedit .fbrow .n { flex: 1 1 calc(100% - 60px); white-space: normal; overflow-wrap: anywhere; }
  body.web .rt-gedit .fbrow > .grow { display: none; }
  body.web .rt-gedit .fbrow .text { min-width: 44px; }
  body.web .rt-cond { height: auto; min-height: 44px; }
  body.web .rt-gadd { min-height: 44px; }
  body.web .rt-pool .ctl { grid-template-columns: minmax(0, 1fr); }
  body.web .rt-pool .lab small { padding-top: 6px; }
  body.web .rt-pool .segs { flex-wrap: wrap; }
  body.web .rt-stats { flex-wrap: wrap; gap: 10px 16px; }
  /* the upstream a request went to takes a line of its own on a phone,
     so the reasoning beside the provider isn't cut to two letters */
  body.web .rt-req .to.upstreamed { flex-wrap: wrap; row-gap: 0; }
  body.web .rt-req .to.upstreamed .said { flex: 1 1 0; min-width: 0; }
  body.web .rt-req .to .upstream { flex-basis: 100%; padding-left: 12px; }
  body.web #agent-view-routing .row-head .note { flex: 1 1 100%; order: 1; margin: 2px 0 0; }
}
.rt-gsec .segs .opt { white-space: nowrap; }
/* the groups, in a page 520px wide or less */
:where(.rt-more.max520) .rt-gsec .row-head .note { display: none; }
:where(.rt-more.max520) .rt-gsec .rt-gfilter { flex: 1 1 auto; width: auto; }
:where(.rt-more.max520) .rt-gedit { grid-template-columns: minmax(0, 1fr); gap: 4px; }
:where(.rt-more.max520) .rt-gedit label { text-align: left; padding-top: 8px; }
:where(.rt-more.max520) .rt-gedit .segs .opt { padding-left: 9px; padding-right: 9px; }
/* the models and patterns take the column's width and no more: a grid's
   auto track grows to its widest row's content, so a long model name with
   its chips pushed the rows past the editor's edge, cut off there, and
   the patterns below no longer lined up with them. Tight, the name gives
   way (it ellipsizes, to 8em), and tighter still (German's longer words)
   the chips go on a line of their own, right-aligned, rather than past
   the edge; none of them is ever cut */
.rt-gedit .fallback, .rt-gedit .fallback:not(.rt-rules) .fbl { grid-template-columns: minmax(0, 1fr); }
/* in :where, so a phone's own row (body.web, above) still wins */
:where(.rt-gedit .fallback:not(.rt-rules)) .fbrow { flex-wrap: wrap; justify-content: flex-end; row-gap: 2px; }
:where(.rt-gedit .fallback:not(.rt-rules)) .fbrow .n { flex: 1 1 8em; }
.rt-gedit .fbrow .n { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-gedit .fbrow .n > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rt-gedit .fbrow .n > small { flex: 0 100 auto; } /* gives way before the name */
.rt-gedit .fbrow .n small { color: var(--muted); font-size: 11.5px; }
.rt-gedit .fbrow.off .n { color: var(--muted); text-decoration: line-through; }
.rt-gedit .fbrow .rt-mon { transform: scale(.85); }
/* a named member's number is its handle: the grip beside it shows on
   hover, dragged or from the keyboard only, as on the groups' cards */
.rt-gedit .fbrow .rt-mhandle.ag-handle { position: relative; width: 18px; height: 22px; margin: 0 -2px; font: inherit; color: var(--muted); font-variant-numeric: tabular-nums; }
.rt-gedit .fbrow .rt-mhandle::before { content: ""; position: absolute; left: -7px; top: 50%; width: 5px; height: 11px; margin-top: -5.5px; background: radial-gradient(circle, var(--muted) .9px, transparent 1.2px) 0 0 / 3.5px 3.75px; opacity: 0; transition: opacity .15s; }
.rt-gedit .fbrow:is(:hover, .dragging) .rt-mhandle::before { opacity: 1; }
/* apart: Safari before 15.4 drops a whole selector list with :focus-visible in it */
.rt-gedit .fbrow .rt-mhandle:focus-visible::before { opacity: 1; }
.rt-gedit .fbl.sorting { user-select: none; -webkit-user-select: none; }
.rt-gedit .fbl.sorting > .fbrow { transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.rt-gedit .fbl.sorting .rt-mhandle { cursor: grabbing; }
.rt-gedit .fbl > .fbrow.dragging { position: relative; z-index: 2; background: var(--card); box-shadow: 0 6px 18px rgba(20, 22, 30, .12), 0 0 0 1px var(--line); border-radius: 8px; transition: none; }
@media (prefers-reduced-motion: reduce) { .rt-gedit .fbl.sorting > .fbrow { transition: none; } }
.rt-gedit .fbrow.muted > :not(.rt-mon):not(.text) { opacity: .45; }
/* a member's own reasoning, beside its Up and Remove */
.rt-gedit .fbrow .rt-fixed { height: 24px; padding: 0 9px; font-size: 11.5px; flex: none; }
/* a member's weight under By weight (#1910), edited in place */
.rt-gedit .fbrow .rt-weight { font-variant-numeric: tabular-nums; }
.rt-gedit .fbrow .rt-weight-in { width: 64px; flex: none; height: 24px; font-size: 12px; padding: 0 6px; }
/* a group a member of a group is: it takes no reasoning of its own (its
   models reason as it says, provider.SaveGroup), so its chip names the group
   it follows and opens that group's card instead. It takes the room it needs
   and gives it back when the row is tight, rather than widening it: the
   desktop app's member row doesn't wrap (only body.web's does) */
.rt-gedit .fbrow .rt-inner { flex: 0 1 auto; min-width: 0; }
.rt-gedit .fbrow .rt-inner > span { overflow: hidden; text-overflow: ellipsis; }
.rt-gadd {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px 0 9px; border-radius: 8px;
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.rt-gadd:hover, .rt-gadd.open { color: var(--fg); border-color: var(--muted); background: var(--card); }
.rt-gadd svg { flex: none; }
/* Add a rule, and beside it a rule by what the message asks for */
.rt-gadds { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-gadds > [hidden] { display: none; }
/* a group's rules, each one line read as a sentence: the conditions it
   has, → and the model it sends that turn to first; its acts under ⋯ */
.rt-rules .fbl:not(:empty) + .rt-gadds { margin-top: 2px; }
/* the rules share their columns (each rule a subgrid of the list), so
   every rule's → and model start at one x: the number, the conditions
   (as wide as the widest rule's, to at most half the width before they wrap), what
   it does, the ⋯. Where subgrid isn't, each rule keeps the same columns
   on its own */
.rt-rules .fbl { display: grid; grid-template-columns: 16px fit-content(50%) minmax(0, 1fr) auto; gap: 0; }
.rt-rule { grid-column: 1 / -1; display: grid; grid-template-columns: 16px fit-content(50%) minmax(0, 1fr) auto; align-items: start; column-gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
@supports (grid-template-columns: subgrid) { .rt-rule { grid-template-columns: subgrid; } }
.rt-rule:first-child { border-top: 0; padding-top: 2px; }
.rt-rule > .i { line-height: 26px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; }
.rt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
/* on a narrow page what it does goes under the conditions */
@media (max-width: 640px) {
  .rt-rules .fbl { display: flex; flex-direction: column; }
  .rt-rule { grid-template-columns: 16px minmax(0, 1fr) auto; row-gap: 6px; }
  .rt-rule > .rt-then { grid-column: 2; grid-row: 2; }
  .rt-rule > .rt-rmore { grid-column: 3; grid-row: 1; }
}
.rt-arrow { color: var(--muted); font-size: 12px; padding: 0 1px; }
/* a set condition, and the × on its corner that takes it off: shown on
   hover or focus, always where nothing hovers */
.rt-c { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.rt-cx {
  position: absolute; top: -5px; right: -5px; z-index: 1; display: grid; place-items: center;
  width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .12s, color .12s;
}
.rt-cx:hover { color: var(--fg); border-color: var(--muted); }
.rt-c:hover > .rt-cx, .rt-c:focus-within > .rt-cx { opacity: 1; pointer-events: auto; }
@media (hover: none) { .rt-cx { opacity: 1; pointer-events: auto; } }
/* the quiet + that adds a condition; in words while the rule has none */
.rt-addc {
  display: inline-grid; grid-auto-flow: column; place-items: center; gap: 5px;
  width: 24px; height: 24px; padding: 0; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.rt-addc.wide { width: auto; height: 26px; padding: 0 10px 0 8px; border: 1px dashed var(--line); }
.rt-addc:hover, .rt-addc.open, .rt-addc:focus-visible { color: var(--fg); background: var(--card-2); }
.rt-addc.wide:hover, .rt-addc.wide.open { border-color: var(--muted); }
/* the rule's ⋯: on hover, as the usage rows' */
.rt-rule > .rt-rmore { align-self: start; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.rt-rule:hover > .rt-rmore, .rt-rule > .rt-rmore:focus-visible, .rt-rule > .rt-rmore.open { opacity: 1; }
@media (hover: none) { .rt-rule > .rt-rmore { opacity: 1; } }
/* how a part works, under an ⓘ beside it */
.rt-info { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--muted); cursor: help; outline: none; }
.rt-info:hover, .rt-info:focus-visible { color: var(--fg); }
.rt-info:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.rt-info[hidden] { display: none; }
.rt-gadds { align-items: center; }
.rt-pickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rt-cond {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 100%;
  transition: color .15s, border-color .15s, background .15s;
}
.rt-cond:hover { color: var(--fg); border-color: var(--muted); }
.rt-cond.on { border-style: solid; color: var(--fg); background: var(--card-2); }
/* a chip in a Settings row too, where .row .ic makes icons 18–22px (duanckham on X) */
.rt-cond .ic, .row .rt-cond .ic, body.window .row .rt-cond .ic { width: 14px; height: 14px; flex: none; }
.rt-cond > span { overflow: hidden; text-overflow: ellipsis; }
/* a group's logos overlap in discs whose rings sit outside them: clipped, the first lost its edge */
.rt-cond > .ic-stack { overflow: visible; }
.rt-cond.tk { cursor: text; }
.rt-cond.in { cursor: text; }
.rt-cond.fd { cursor: text; }
.rt-cond.fd input, .editor .rt-cond.fd input[type="text"] { width: 24ch; }
.rt-cond.xf { cursor: text; }
.rt-cond.xf input, .editor .rt-cond.xf input[type="text"] { width: 24ch; }
/* a narrow line squeezes what was typed (it scrolls in its box), never
   the word that says what the box is */
.rt-cond.in > span:not(.rt-grow), .rt-cond.fd > span, .rt-cond.xf > span { flex: none; }
.rt-cond.fd > input, .rt-cond.xf > input { min-width: 0; flex: 0 1 auto; }
/* the intent, a sentence, shown whole: its box as wide as the words and
   onto more lines where the line ends. A hidden copy of the words, in the
   same cell and font, gives the box its size; the pill rounds less once
   it is more than one line */
.rt-cond.in { height: auto; min-height: 26px; padding-top: 2px; padding-bottom: 2px; border-radius: 13px; white-space: normal; }
.rt-cond.in > span:first-child { align-self: flex-start; line-height: 20px; }
.rt-cond > .rt-grow { align-self: flex-start; display: inline-grid; flex: 0 1 auto; min-width: min(6ch, 100%); max-width: 100%; overflow: visible; }
.rt-grow::after, .rt-grow > textarea, .editor .rt-grow > textarea {
  grid-area: 1 / 1; box-sizing: border-box; margin: 0; padding: 0 2px; border: 0; min-width: 0;
  font: inherit; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.rt-grow::after { content: attr(data-v) " "; visibility: hidden; }
.rt-grow > textarea, .editor .rt-grow > textarea {
  width: 100%; height: 100%; min-height: 20px; resize: none; overflow: hidden;
  background: transparent; color: inherit; outline: none; box-shadow: none; border-radius: 0;
}
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  /* a phone's page sets its boxes at 16px; a rule's fields keep the line's
     own size (iOS gets maximum-scale=1 from layout.js, so focus doesn't zoom) */
  body.web .rt-cond input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  body.web .rt-grow, body.web .rt-grow > textarea { font-size: inherit; }
  body.web .rt-cond.in { padding-top: 11px; padding-bottom: 11px; } /* the first line in the middle of the 44px pill */
  body.web .rt-grow > textarea { min-height: 0; }
}
/* a rule's hours: two times in the pill, typed; one that isn't a time is marked */
.rt-cond.tm { cursor: text; }
.rt-cond.tm input.clock, .editor .rt-cond.tm input.clock[type="text"] { width: 5.5ch; text-align: center; }
.rt-cond.tm.bad { border-style: solid; border-color: var(--amber, var(--muted)); }
.rt-cond[hidden] { display: none; }
.rt-classifier { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.rt-classifier[hidden] { display: none; }
.rt-classifier .w { color: var(--muted); font-size: 12px; }
.rt-classifier .hint { flex-basis: 100%; }
/* the effort's classifier offering to pick the model too: a line of its
   own, wrapping rather than running past a narrow window */
.rt-classifier .rt-cls-more { margin-left: -7px; white-space: normal; text-align: left; color: var(--accent); }
/* the levels a group names for agents (#295): one toggle each */
.rt-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
.rt-levels[hidden] { display: none; }
/* the field is the pill: the editor's boxed input (its border and focus ring) stays off it */
.rt-cond input, .editor .rt-cond input[type="text"], .editor .rt-cond input[type="number"], .editor .rt-cond input:focus { box-shadow: none; border-radius: 0; }
.editor .rt-cond input:focus-visible { box-shadow: none; border-radius: 0; }
.rt-cond:focus-within { border-style: solid; border-color: var(--accent); color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.rt-cond input, .editor .rt-cond input[type="text"], .editor .rt-cond input[type="number"] { width: 7ch; height: 20px; padding: 0 2px; border: 0; background: transparent; color: inherit; font: inherit; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.rt-cond input::-webkit-outer-spin-button, .rt-cond input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rt-rwarn { color: var(--amber, var(--muted)); font-size: 11.5px; }
.rt-rwarn:empty { display: none; }

/* a replay: the time it is replaying, what is in flight then, and a track */
.rt-replay { margin: 10px 0 2px; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 6px; }
.rp-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rp-tag { font-size: 11px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.rp-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: rppulse 1.2s ease-in-out infinite; }
@keyframes rppulse { 50% { opacity: .3; } }
.rp-clock { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--fg); }
.rp-day { font-size: 11px; color: var(--muted); }
.rp-skip { font-size: 11px; color: var(--accent); }
.rp-top .grow { flex: 1; }
.rp-what { display: grid; gap: 3px; min-height: 20px; }
.rp-req { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; cursor: pointer; }
.rp-req b { color: var(--fg); font-weight: 600; }
.rp-req.on .rp-n { color: var(--fg); }
.rp-req i.ag { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--agent); }
.rp-req .rp-to { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-req .rp-at { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; color: var(--faint); }
.rp-n { flex: none; font-variant-numeric: tabular-nums; }
.rp-wait { font-size: 12px; color: var(--faint); }
.rp-track { position: relative; height: 16px; cursor: pointer; }
.rp-track::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; border-radius: 1px; background: var(--line); }
.rp-mark { position: absolute; top: 4px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 1.5px; background: var(--agent); opacity: .45; transition: opacity .2s, transform .2s; }
.rp-mark.on { opacity: 1; transform: scaleY(1.5); }
.rp-head { position: absolute; top: 1px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--fg); pointer-events: none; }
@media (max-width: 520px) { .rp-req .rp-at { display: none; } }

/* the days the routing history keeps: live, then each day, newest first */
.rt-days, .rt-group-by { display: flex; gap: 4px; overflow-x: auto; padding: 0 2px 6px; scrollbar-width: none; }
.rt-days::-webkit-scrollbar, .rt-group-by::-webkit-scrollbar { display: none; }
.rt-day { flex: none; display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--muted); padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: none; white-space: nowrap; }
.rt-day small { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.rt-day:hover { color: var(--fg); }
.rt-day.on { color: var(--fg); border-color: var(--fg); }
/* the days that fit, the rest under the last pill (#961) */
.rt-days { overflow-x: hidden; }
.rt-days .rt-day[hidden] { display: none; }
.rt-day-more svg { flex: none; align-self: center; opacity: .7; transition: transform .15s var(--ease); }
.rt-day-more.open svg { transform: rotate(180deg); }

/* the tray panel's Routing tab: a small stage, then the gateway's latest
   requests, two lines each */
.pr-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); column-gap: 38px; align-items: center; height: 104px; padding: 0 10px; border-radius: 11px; background: var(--card); box-shadow: var(--card-edge); overflow: hidden; }
.ps-wires, .ps-sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ps-wire { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-linecap: round; transition: stroke .25s; }
.ps-wire.on { stroke: color-mix(in srgb, var(--agent, var(--accent)) 55%, transparent); }
.ps-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps-from { align-items: flex-end; }
.ps-to { align-items: flex-start; }
.ps-node { display: flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; color: var(--fg); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.ps-node .ic, .ps-node .ic img, .ps-node .ic svg { width: 13px; height: 13px; flex: none; }
.ps-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.ps-name small { margin-left: 4px; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.ps-dst > i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.ps-dst.bad > i { background: var(--red); }
.ps-dst.wait > i { background: var(--muted); animation: rtlive 1.8s infinite; }
.ps-hub { position: relative; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--fg); background: var(--card); box-shadow: inset 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, .08); }
.ps-hub svg { width: 24px; height: 24px; }
.ps-hub.busy { animation: ps-ring 1.8s ease-out infinite; }
@keyframes ps-ring { 0% { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 0 color-mix(in srgb, var(--fg) 16%, transparent); } 70%, 100% { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 7px transparent; } }
.ps-dot { fill: var(--agent, var(--accent)); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--agent, var(--accent)) 60%, transparent)); transition: fill .2s, opacity .3s; }
.ps-dot.ok { fill: var(--green); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--green) 60%, transparent)); }
.ps-dot.bad { fill: var(--red); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--red) 60%, transparent)); }
.ps-dot.wait { animation: ps-wait 1.2s ease-in-out infinite; }
.ps-dot.gone { opacity: 0; }
@keyframes ps-wait { 50% { opacity: .45; } }
.panel-routing { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 6px; }
.pr-head { display: flex; align-items: center; gap: 8px; min-height: 22px; padding: 0 2px 0 4px; font-size: 12px; color: var(--muted); }
.pr-head .rt-livedot { margin-left: 0; flex: none; }
.pr-today { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-today b { color: var(--fg); font-weight: 600; }
.pr-head .text { flex: none; font-size: 12px; }
.skeleton.pr-sk { display: inline-block; width: 150px; height: 9px; border-radius: 4px; vertical-align: middle; }
.skeleton.pr-sk-row { height: 40px; border-radius: 11px; }
.pr-none { margin: 0; padding: 12px; border-radius: 11px; background: var(--card); box-shadow: var(--card-edge); font-size: 12px; line-height: 1.55; color: var(--muted); }
.pr-none b { display: block; color: var(--fg); font-weight: 550; }
.pr-list { display: flex; flex-direction: column; padding: 4px; border-radius: 11px; background: var(--card); box-shadow: var(--card-edge); }
.pr-req { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 6px 8px; border-radius: 8px; font: inherit; font-size: 12px; text-align: left; color: var(--fg-2); background: none; border: 0; cursor: pointer; }
.pr-req:hover { background: var(--card-2); }
.pr-a, .pr-to { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pr-a .ic, .pr-a .ic img, .pr-a .ic svg { width: 14px; height: 14px; flex: none; }
.pr-who { flex: none; color: var(--fg); font-weight: 550; }
.pr-a .m { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: var(--code-style, normal) 500 11px/1.5 var(--code-font, var(--code)); font-stretch: var(--code-stretch, 100%); color: var(--fg-2); background: var(--card-2); border-radius: 5px; padding: 0 5px; }
.pr-a .kind { flex: 0 100 auto; min-width: 3.2em; max-width: 8em; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px; color: var(--muted); background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; }
.pr-req .at { justify-self: end; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 11px; }
.pr-to { padding-left: 20px; gap: 5px; color: var(--fg-2); }
.pr-to > i { flex: none; width: 14px; margin-left: -20px; margin-right: 1px; text-align: center; font-style: normal; font-size: 11px; color: var(--faint); }
.pr-req.moved .pr-to > i { color: var(--accent); }
.pr-req.bad .pr-to { color: var(--red); }
.pr-req.bad .pr-to > i { color: var(--red); }
.pr-req.wait .pr-to > i { color: var(--fg-2); animation: ps-wait 1.2s ease-in-out infinite; }
.pr-where { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-m { flex: 0 2 auto; min-width: 2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pr-m::before { content: "· "; }
.pr-to .swap { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px; color: var(--amber); background: var(--amber-soft); white-space: nowrap; }
.pr-line { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.pr-line .pr-to { flex: 1 1 auto; }
.pr-req .meta { flex: none; max-width: 100%; margin-left: auto; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
@media (prefers-reduced-motion: reduce) { .pr-req.wait .pr-to > i, .ps-dst.wait > i, .ps-hub.busy, .ps-dot.wait { animation: none; } }
@supports not (grid-template-columns: subgrid) {
  .rt-req { grid-template-columns: auto fit-content(32%) minmax(min(14em, 30%), 1fr) fit-content(40%); }
  @media (max-width: 700px) {
    .rt-reqs { grid-template-columns: auto minmax(0, 1fr); }
    .rt-req { grid-template-columns: auto minmax(0, 1fr); row-gap: 2px; }
    .rt-req .asked { grid-column: 2; grid-row: 1; }
    .rt-req .to { grid-column: 2; grid-row: 2; }
    .rt-req .meta { grid-column: 2; grid-row: 3; justify-content: flex-start; }
  }
}
/* templates: groups for common needs made of the user's own models, each
   added in a click (provider.Templates) */
.rt-gtpl { padding: 10px 12px 12px; display: grid; gap: 8px; }
.rt-gtpl-head { font-size: 12px; color: var(--muted); }
/* Import a group (laincatx on X): the text pasted, then what came of it */
.rt-gimport { padding: 10px 12px 12px; display: grid; gap: 8px; min-width: 0; border-bottom: 1px solid var(--line); }
.rt-gimport-text { width: 100%; box-sizing: border-box; min-height: 72px; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font-family: var(--code-font, var(--code)); font-size: 12px; line-height: 1.45; resize: vertical; outline: none; overflow-wrap: anywhere; }
.rt-gimport-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.rt-gimport .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.rt-gimport-done { font-size: 12.5px; font-weight: 600; }
.rt-gimport-missing, .rt-gimport-note { font-size: 12px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.rt-gimport-missing { color: var(--danger, #d66); }
.rt-gtpl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.rt-gtpl-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.rt-gtpl-card .hd { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rt-gtpl-card .hd b { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.rt-gtpl-card .hd .ic, .rt-gtpl-card .hd .ic-stack { flex: none; }
.rt-gtpl-card .desc { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.rt-gtpl-card .mem { font-size: 11.5px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-gtpl-card .mem.why { color: var(--faint); white-space: normal; }
.rt-gtpl-card.off b { color: var(--muted); }
.rt-gtpl-card .acts { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.rt-gtplbtn { display: inline-flex; align-items: center; gap: 4px; }


/* Magpie Native Context Window Styles */
/* Context windows: a request's prompt as a card (Routing, the Usage page's
   Context tab) and each agent's score and tags. */
:root {
  --k-system: var(--c6); --k-tools: var(--c2); --k-memory: var(--c4);
  --k-files: var(--c3); --k-results: var(--c5); --k-chat: var(--c1);
  --k-free: color-mix(in srgb, var(--fg) 7%, transparent);
}
.k-system { --k: var(--k-system); }
.k-tools { --k: var(--k-tools); }
.k-memory { --k: var(--k-memory); }
.k-files { --k: var(--k-files); }
.k-results { --k: var(--k-results); }
.k-chat { --k: var(--k-chat); }
i.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 2.5px; background: var(--k); }
i.dot.free { background: var(--k-free); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 10%, transparent); }

.ctx-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 14px; min-width: 0; font-variant-numeric: tabular-nums; }
.ctx-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-head .grow, .ctx-foot .grow, .ctx-contents-head .grow, .ctx-agent-head .grow, .ctx-agent-foot .grow, .ctx-sess-head .grow { flex: 1; }
.ctx-title { font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; }
.ctx-model { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font, var(--code)); font-size: 11px; color: var(--muted); }
.ctx-state { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 500; background: var(--pill); color: var(--fg-2); }
.ctx-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.ctx-state.counted i { background: var(--green); }
.ctx-state.live { background: var(--green-soft); color: var(--green); }
.ctx-state.live i { background: var(--green); animation: ctx-pulse 1.4s ease-in-out infinite; }
/* every word of the state in one cell, the one that is on shown: the pill
   is as wide whatever the request's state, so nothing beside it moves */
.ctx-state-w { display: inline-grid; }
.ctx-state-w > span { grid-area: 1 / 1; text-align: center; white-space: nowrap; }
.ctx-state-w > span:not(.on) { visibility: hidden; }
@keyframes ctx-pulse { 50% { opacity: .35; transform: scale(.8); } }

.ctx-k { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
:root[lang="zh"] .ctx-k, :root[lang="ja"] .ctx-k { letter-spacing: .02em; }
.ctx-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px 28px; }
.ctx-top > :only-child { grid-column: 1 / -1; }
.ctx-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* the figure and its words apart: a flex item's leading space is dropped,
   so the gap is the space ("—命中" read as one, dumplings on Discord) */
.ctx-big { display: flex; align-items: baseline; gap: .35em; white-space: nowrap; color: var(--muted); font-size: 13px; }
.ctx-big b { font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; color: var(--fg); }
.ctx-sub { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[lang="zh"] .ctx-sub, :root[lang="ja"] .ctx-sub { letter-spacing: .02em; }
.ctx-health { height: 17px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: 9px; font-size: 10px; letter-spacing: .03em; }
.ctx-health.ok { background: var(--green-soft); color: var(--green); }
.ctx-health.warn { background: var(--amber-soft); color: var(--amber); }
.ctx-health.bad { background: var(--red-soft); color: var(--red); }
.ctx-bar { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--k-free); overflow: hidden; }
.ctx-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--green); transform-origin: left; animation: ctx-grow .7s var(--ease, ease) backwards; }
.ctx-cache .ctx-bar { margin: 3px 0 2px; }
.ctx-cache .ctx-bar i { transition: width .3s var(--ease, ease); }
/* under way: the last request's cache, dimmed till this one's comes */
.ctx-cache :is(.ctx-big, .ctx-bar) { transition: opacity .3s var(--ease, ease); }
.ctx-cache.was :is(.ctx-big, .ctx-bar) { opacity: .45; }
/* nothing to show: a dash and the words why, no empty bar; the bar keeps
   its room, so the card doesn't move when the figure comes */
.ctx-cache.none .ctx-big b { color: var(--faint); }
.ctx-cache.none .ctx-bar { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .ctx-cache .ctx-bar i, .ctx-cache :is(.ctx-big, .ctx-bar) { transition: none; } }
@keyframes ctx-grow { from { transform: scaleX(0); } }

/* the window, a cell for each 1/400 of it */
/* refined waffle: many thin cells (each = 1/400 of the window); fewer on narrow screens */
.ctx-waffle { display: grid; grid-template-columns: repeat(80, minmax(0, 1fr)); gap: 1.5px; }
@media (max-width: 720px) { .ctx-waffle { grid-template-columns: repeat(40, minmax(0, 1fr)); } }
.ctx-waffle > i { aspect-ratio: 1; border-radius: 2px; background: var(--k, var(--k-free)); transition: opacity .16s, transform .16s; animation: ctx-cell .32s var(--ease, ease) backwards; animation-delay: var(--d, 0ms); }
.ctx-waffle > i.free { --k: var(--k-free); }
@keyframes ctx-cell { from { opacity: 0; transform: scale(.4); } }
.ctx-waffle[data-f] > i { opacity: .16; }
.ctx-waffle[data-f="system"] > i.k-system, .ctx-waffle[data-f="tools"] > i.k-tools,
.ctx-waffle[data-f="memory"] > i.k-memory, .ctx-waffle[data-f="files"] > i.k-files,
.ctx-waffle[data-f="results"] > i.k-results, .ctx-waffle[data-f="chat"] > i.k-chat,
.ctx-waffle[data-f="free"] > i.free, .ctx-waffle[data-f="item"] > i.on { opacity: 1; }
.ctx-waffle[data-f="item"] > i.on { transform: scale(1.12); }
.ctx-tip { position: absolute; z-index: 5; min-width: 190px; max-width: 280px; padding: 8px 10px; border-radius: 9px; background: #17171b; color: #ededf1; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); font-size: 11.5px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
.ctx-tip[hidden] { display: none; }
.ctx-tip-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.ctx-tip-head .grow { flex: 1; }
.ctx-tip-head span:last-child { color: #a1a1aa; }
.ctx-tip-row { display: flex; gap: 10px; color: #b9b9c1; }
.ctx-tip-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tip-row.on { color: #fff; font-weight: 500; }
.ctx-tip-more { color: #85858d; font-size: 10.5px; }

.ctx-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: -4px; }
.ctx-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--fg-2); cursor: default; padding: 2px 0; }
.ctx-leg .v { color: var(--muted); }
.ctx-leg:hover .n { color: var(--fg); }

.ctx-contents { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ctx-contents-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-contents-head .segs { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex: none; }
.ctx-contents-head .segs .opt { height: 20px; padding: 0 9px; font-size: 11px; white-space: nowrap; flex: none; }
:where(.ctx-card.max520) .ctx-contents-head { flex-wrap: wrap; }
:where(.ctx-card.max520) .ctx-contents-head .segs { flex: 1 1 100%; }
.ctx-rows { display: flex; flex-direction: column; }
.ctx-row { display: flex; align-items: center; gap: 8px; min-height: 26px; padding: 0 6px; margin: 0 -6px; border-radius: 6px; font-size: 12px; }
.ctx-row:hover { background: var(--pill); }
.ctx-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; white-space: nowrap; }
.ctx-name b { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 100%; }
.ctx-name small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; min-width: 0; }
.ctx-x { font-size: 11px; color: var(--muted); }
.ctx-tag { flex: none; font-family: var(--code-font, var(--code)); font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--pill); color: var(--muted); }
.ctx-mini { flex: none; width: 72px; height: 4px; border-radius: 2px; background: var(--k-free); overflow: hidden; }
.ctx-mini i { display: block; height: 100%; border-radius: 2px; background: var(--k); }
.ctx-v { flex: none; width: 48px; text-align: right; color: var(--fg-2); font-size: 11.5px; }
:where(.ctx-card.max420) :is(.ctx-mini, .ctx-tag) { display: none; }
.ctx-empty { font-size: 12px; color: var(--muted); padding: 4px 0; }
.ctx-more { align-self: flex-start; margin-top: 2px; font-size: 11.5px; }

.ctx-foot { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 11px; color: var(--muted); }
.ctx-crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font, var(--code)); font-size: 10.5px; color: var(--muted); }
.ctx-note { white-space: nowrap; flex: none; }
.ctx-session { display: flex; align-items: center; gap: 12px; margin-top: -4px; }
.ctx-session .ctx-spark { flex: 1; height: 34px; }
.ctx-spark { position: relative; display: block; width: 100%; }
.ctx-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ctx-spark .at { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--card); border: 1.6px solid var(--k-chat); box-sizing: border-box; pointer-events: none; }
.ctx-spark .win { stroke: var(--line); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ctx-spark .area { fill: color-mix(in srgb, var(--k-chat) 14%, transparent); }
.ctx-spark .line { fill: none; stroke: var(--k-chat); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ctx-spark .hit { fill: transparent; cursor: pointer; }
.ctx-spark .hit:hover { fill: color-mix(in srgb, var(--fg) 7%, transparent); }

/* Routing: the card under the story of the request */
.rt-log .ctx-card { margin-top: 12px; }
/* folded: its head alone, how full it is beside the title */
.ctx-fold { display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 22px; margin: -2px 0 -2px -4px; padding: 0 6px 0 4px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; }
.ctx-fold:hover { background: var(--pill); }
.ctx-fold .tw { display: inline-flex; width: 10px; flex: none; color: var(--faint); }
.ctx-fold .tw svg { transition: transform .2s var(--ease, ease); }
.ctx-card.shut .ctx-fold .tw svg { transform: rotate(-90deg); }
.ctx-short { display: none; flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ctx-card.shut .ctx-short { display: inline; }
/* the padding is the open card's, so the title stays where it is when it
   opens and the page doesn't follow it (it moved 4px with a 10px one) */
.ctx-card.shut > :not(.ctx-head) { display: none; }
/* its head alone, the space under it is the space over it */
.ctx-card.shut { padding-bottom: 14px; }
:where(.ctx-card.shut.max420) .ctx-model { display: none; }
/* folded, the head is one line of a fixed height whatever a live request
   puts in it, so nothing under it moves; a thin bar of what fills the
   window, a part each, takes the room between the figure and the model */
.ctx-card.shut .ctx-head { height: 20px; white-space: nowrap; }
.ctx-stack { display: none; flex: 1 1 0; min-width: 24px; max-width: 360px; height: 6px; border-radius: 3px; background: var(--k-free); overflow: hidden; }
.ctx-card.shut .ctx-stack { display: flex; }
.ctx-stack i { flex: none; height: 100%; background: var(--k); transition: width .3s var(--ease, ease); }
@media (prefers-reduced-motion: reduce) { .ctx-stack i { transition: none; } }

/* the Usage page's Context tab */
.ctx-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; margin: 4px 0 18px; }
.ctx-agent, .ctx-tune { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; font-variant-numeric: tabular-nums; }
.ctx-agent-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-who-box { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ctx-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-who .ic { width: 20px; height: 20px; flex: none; }
.ctx-who b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-who-sub { font-size: 11px; color: var(--muted); }
.ctx-grade { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.ctx-grade-word { font-size: 10.5px; font-weight: 600; }
.ctx-ring { position: relative; width: 52px; height: 52px; --tone: var(--accent); }
.ctx-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ctx-ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ctx-ring .track { stroke: var(--k-free); }
.ctx-ring .arc { stroke: var(--tone); stroke-dashoffset: var(--to); animation: ctx-arc .9s var(--ease, ease) backwards; }
.ctx-pane.still .ctx-waffle > i, .ctx-pane.still .ctx-bar i, .ctx-pane.still .ctx-ring .arc { animation: none; }
@keyframes ctx-arc { from { stroke-dashoffset: 163.36; } }
.ctx-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.ctx-ring.great, .ctx-grade-word.great { --tone: var(--green); color: var(--green); }
.ctx-ring.good, .ctx-grade-word.good { --tone: var(--c2); color: var(--c2); }
.ctx-ring.fair, .ctx-grade-word.fair { --tone: var(--amber); color: var(--amber); }
.ctx-ring.poor, .ctx-grade-word.poor { --tone: var(--red); color: var(--red); }
/* colorblind mode turns --c2 amber, as fair's; good keeps a blue, its
   palette's --c1 (#2073) */
:root[data-colorblind="1"] :is(.ctx-ring, .ctx-grade-word).good { --tone: var(--c1); color: var(--c1); }
.ctx-ring b { color: var(--fg); }
.ctx-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.ctx-score { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 11.5px; color: var(--fg-2); cursor: default; }
.ctx-score .ctx-bar { height: 4px; }
.ctx-score .ctx-bar i { background: var(--green); }
.ctx-score.warn .ctx-bar i { background: var(--amber); }
.ctx-score.bad .ctx-bar i { background: var(--red); }
.ctx-score .v { color: var(--muted); font-size: 10.5px; }
.ctx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-tags:empty { display: none; }
.ctx-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 500; background: var(--pill); color: var(--fg-2); cursor: default; }
.ctx-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--c7); }
.ctx-chip.good { background: var(--green-soft); color: var(--green); }
.ctx-chip.good i { background: var(--green); }
.ctx-chip.warn { background: var(--amber-soft); color: var(--amber); }
.ctx-chip.warn i { background: var(--amber); }
.ctx-chip.info i { background: var(--accent); }
.ctx-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.ctx-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: default; }
.ctx-fact b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.ctx-fact .ctx-k { font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; display: block; }
.ctx-mix { display: flex; flex-direction: column; gap: 6px; }
.ctx-share { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--k-free); }
.ctx-share i { display: block; min-width: 3px; background: var(--k); }
.ctx-mix-keys { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px; color: var(--muted); }
.ctx-mix-keys span { display: inline-flex; align-items: center; gap: 5px; }
.ctx-agent-foot { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: auto; }
.ctx-models { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ctx-models code { font-family: var(--code-font, var(--code)); font-size: 10.5px; padding: 2px 6px; border-radius: 5px; background: var(--pill); color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ctx-agent-foot .text { flex: none; font-size: 11.5px; }

.ctx-sess-head { margin-top: 6px; }
.ctx-sess-head .segs .opt { height: 20px; padding: 0 9px; font-size: 11px; }
.ctx-sess-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ctx-sess + .ctx-sess { border-top: 1px solid var(--line-2, var(--line)); }
.ctx-sess-row { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1.3fr) minmax(80px, 1fr) 44px minmax(0, auto) 92px; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; }
.ctx-sess-row:hover { background: var(--pill); }
.ctx-sess-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx-sess-row .ic { width: 18px; height: 18px; }
.ctx-sess-name { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.ctx-sess-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-sess-name b.raw { font-family: var(--code-font, var(--code)); font-weight: 500; letter-spacing: .02em; }
.ctx-sess-name code { font-family: var(--code-font, var(--code)); font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-sess-row .ctx-spark { height: 24px; }
.ctx-sess-peak { justify-self: end; font-weight: 600; }
.ctx-sess-peak.ok { color: var(--green); }
.ctx-sess-peak.warn { color: var(--amber); }
.ctx-sess-peak.bad { color: var(--red); }
.ctx-sess-meta, .ctx-sess-when { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-sess-when { text-align: right; }
.ctx-sess.open { background: var(--card-2); }
.ctx-sess.open > .ctx-card { margin: 0 12px 12px; }
@media (max-width: 640px) {
  .ctx-sess-row { grid-template-columns: 20px minmax(0, 1fr) 64px 40px; }
  .ctx-sess-meta, .ctx-sess-when { display: none; }
  .ctx-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ctx-scores { grid-template-columns: 1fr; }
  .ctx-top { grid-template-columns: 1fr; }
}
.ctx-none { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 48px 16px; color: var(--muted); font-size: 12.5px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }
.ctx-none b { color: var(--fg); font-size: 13.5px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .ctx-waffle > i, .ctx-bar i, .ctx-ring .arc, .ctx-state.live i { animation: none; }
  .ctx-waffle > i { transition: none; }
}

/* Safari 15: no color-mix, so the free cells and the line's area are
   tinted by opacity */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --k-free: rgba(128, 128, 128, .12); }
  i.dot.free { box-shadow: inset 0 0 0 1px var(--line); }
  .ctx-spark .area { fill: var(--k-chat); fill-opacity: .14; }
  .ctx-spark .hit:hover { fill: var(--line); }
}

/* tuned for you */
.ctx-tune { gap: 10px; }
.ctx-tune-total { font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft); border-radius: 11px; padding: 3px 10px; white-space: nowrap; }
.ctx-tune-row { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 4px; border-top: 1px solid var(--line); min-width: 0; }
.ctx-tune-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ctx-tune-title b { font-size: 13px; font-weight: 600; flex: none; }
.ctx-tunes { align-items: start; }
.ctx-tunes > :only-child { grid-column: 1 / -1; }
.ctx-tune-title code { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ctx-tune-vals { display: flex; align-items: flex-end; gap: 12px; min-width: 0; }
.ctx-tune-val { display: flex; flex-direction: column; gap: 2px; flex: none; }
.ctx-tune-val .ctx-k { font-size: 9.5px; }
.ctx-tune-val b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.ctx-tune-val.now b { color: var(--fg-2); }
.ctx-tune-row:not(.done) .ctx-tune-val.now b { text-decoration: line-through; text-decoration-color: var(--muted); text-decoration-thickness: 1px; color: var(--muted); }
.ctx-tune-val.best b { color: var(--green); }
.ctx-tune-arrow { color: var(--muted); font-size: 14px; padding-bottom: 3px; }
.ctx-tune-chart { position: relative; height: 112px; margin: 2px 6px 0; cursor: default; }
.ctx-tc-plot { position: absolute; inset: 0 0 18px; }
.ctx-tc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ctx-tune-chart .hot { stop-color: var(--red); stop-opacity: .32; }
.ctx-tune-chart .cool { stop-color: var(--red); stop-opacity: .02; }
.ctx-tune-chart .level { stroke: var(--green); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; opacity: .7; }
.ctx-tune-chart .line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ctx-tc-plot svg { animation: ctx-draw 1s var(--ease, ease) backwards; }
@keyframes ctx-draw { from { clip-path: inset(-20px 100% -20px 0); } to { clip-path: inset(-20px 0 -20px 0); } }
@keyframes ctx-pop { from { opacity: 0; transform: scale(.4); } }
.ctx-tc-dot { animation: ctx-pop .35s .8s var(--ease, ease) backwards; }
.ctx-tc-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid var(--card); box-sizing: border-box; }
.ctx-tc-dot.now { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 22%, transparent); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.ctx-tc-dot.worst { background: color-mix(in srgb, var(--red) 55%, var(--card)); }
.ctx-tc-dot.best { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 22%, transparent), 0 0 14px color-mix(in srgb, var(--green) 60%, transparent); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.ctx-tc-tag { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--red); letter-spacing: -.01em; }
.ctx-tc-dot.best .ctx-tc-tag { color: var(--green); }
.ctx-tc-dot.worst .ctx-tc-tag { font-weight: 600; opacity: .8; }
.ctx-tc-tag.start { left: -4px; transform: none; }
.ctx-tc-tag.end { left: auto; right: -4px; transform: none; }
.ctx-tc-x { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; font-size: 10px; color: var(--muted); }
.ctx-tc-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ctx-tc-x span.start { transform: none; margin-left: -6px; }
.ctx-tc-x span.end { transform: translateX(-100%); margin-left: 6px; }
.ctx-tc-x span.best { color: var(--green); font-weight: 600; }
.ctx-tc-x span.now { color: var(--red); font-weight: 600; }
.ctx-pane.tune-still .ctx-tune-chart :is(svg, .ctx-tc-dot) { animation: none; }
@media (prefers-reduced-motion: reduce) { .ctx-tune-chart :is(svg, .ctx-tc-dot) { animation: none; } }
.ctx-tune-note { padding: 0 4px 12px; }
.ctx-tune-why { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fg-2); }
/* what the advice doesn't weigh (#1854), quieter than the facts it follows */
.ctx-tune-caveat { margin: -4px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.ctx-tune-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ctx-tune-src { font-size: 11px; color: var(--muted); margin-top: -7px; overflow-wrap: anywhere; }
.ctx-tune-foot .grow { flex: 1; }

/* a part, a cell or an item clicked opens its text (masaka on Discord) */
.ctx-click { cursor: pointer; }
.ctx-leg.ctx-click { border-radius: 5px; }
.ctx-click:focus-visible { outline: 2px solid var(--accent, var(--fg)); outline-offset: 1px; }
.ctx-waffle > i:not(.free) { cursor: pointer; }
.modal .dialog.wide { width: min(880px, 100%); }
.modal .editor.ctx-view { height: min(760px, calc(100vh - 80px)); }
.modal .editor.ctx-view > .ehead { gap: 8px; }
.modal .editor.ctx-view > .ehead b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-view-total { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.modal .editor.ctx-view > .ebody { display: block; }
.ctx-view-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ctx-view-note { margin: 0; font-size: 11.5px; color: var(--muted); }
.ctx-view-wait, .ctx-view-gone { margin: 0; padding: 12px 0; font-size: 12px; color: var(--muted); }
.ctx-vi-list { display: flex; flex-direction: column; gap: 2px; }
.ctx-vi { min-width: 0; border-radius: 8px; }
.ctx-vi.open { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.ctx-vi-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--fg); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.ctx-vi-head:hover { background: var(--pill); }
.ctx-vi-head .grow { flex: 1; }
.ctx-vi-head .ctx-name { min-width: 0; }
.ctx-vi-head .tw { display: inline-flex; width: 10px; flex: none; color: var(--faint); }
.ctx-vi-head .tw svg { transform: rotate(-90deg); transition: transform .2s var(--ease, ease); }
.ctx-vi.open > .ctx-vi-head .tw svg { transform: none; }
.ctx-vi-text { display: flex; flex-direction: column; gap: 10px; padding: 4px 8px 10px 26px; min-width: 0; }
.ctx-piece { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ctx-piece-head { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.ctx-piece-head .grow { flex: 1; }
.ctx-role { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ctx-piece-name { font-family: var(--code-font, var(--code)); font-size: 11px; color: var(--fg-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-piece-note { font-size: 11.5px; color: var(--muted); }
.ctx-text-box { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ctx-text { margin: 0; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 6px; background: var(--pill); font-family: var(--code-font, var(--code)); font-size: 11.5px; line-height: 1.5; color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.ctx-text-more[hidden] { display: none; }
.ctx-view-all { margin-right: auto; }


/* 供应商与模型列表 (Providers & Models - Magpie 原生风格) */
.mp-pv-card-panel {
  background: var(--bg-card, #161618);
  border: 1px solid var(--border-card, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  overflow: hidden;
}
.mp-pv-table {
  display: flex;
  flex-direction: column;
}
.mp-pv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-faint, rgba(255, 255, 255, 0.05));
  transition: background-color .15s ease;
}
.mp-pv-row:last-child {
  border-bottom: none;
}
.mp-pv-row:hover {
  background: rgba(255, 255, 255, 0.025);
}
.mp-pv-row.off {
  opacity: 0.55;
}
.mp-pv-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}
.mp-pv-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.mp-pv-icon-wrap .mp-icon-mask {
  width: 20px;
  height: 20px;
}
.mp-icon-mask {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
.mp-icon-generic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-soft, #a1a1aa);
}
.mp-pv-who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mp-pv-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-pv-sub {
  font-size: 11.5px;
  color: var(--text-dim, #8a8a93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-pv-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-left: auto;
}
.mp-pv-uses {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mp-pv-use-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.mp-pv-use-badge .mp-icon-mask {
  width: 15px;
  height: 15px;
}
.mp-pv-use-badge img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.mp-pv-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  flex: none;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
}
.mp-pv-status-pill.mono {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
}
.mp-pv-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-green, #6ec89a);
  flex: none;
}
.mp-pv-status-dot.off {
  background: var(--text-dim);
}
@media (max-width: 640px) {
  .mp-pv-row {
    padding: 8px 10px;
    gap: 10px;
  }
  .mp-pv-status-pill {
    max-width: 130px;
    font-size: 11px;
    padding: 2px 6px;
    gap: 4px;
  }
  .mp-pv-status-pill.mono {
    font-size: 10.5px;
  }
  .mp-pv-right {
    gap: 6px;
  }
  .mp-pv-use-badge {
    width: 22px;
    height: 22px;
  }
  .mp-pv-use-badge img {
    width: 14px;
    height: 14px;
  }
  .mp-pv-chev {
    display: none;
  }
}

/* KPI 统计卡片条 */
.agent-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.agent-kpi-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-faint);
  border-radius: 9px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.agent-kpi-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 6px;
}
.agent-kpi-val small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-soft);
}
.agent-kpi-lbl {
  font-size: 11px;
  color: var(--text-soft);
}

/* 低额度预警横幅 */
.agent-low-quota-banner {
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.agent-low-quota-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
  color: #f87171;
  margin-bottom: 6px;
}
.agent-low-quota-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-low-quota-item {
  font-size: 12px;
  color: var(--text-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-low-quota-item b {
  color: #fbbf24;
}

/* Agent 卡片 */
.agent-card {
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-subtle, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all .15s ease;
}
.agent-card:hover {
  border-color: var(--border-faint, rgba(255,255,255,.18));
}
.agent-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.agent-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b7280;
}
.agent-status-dot.on {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, .6);
}
.agent-status-dot.idle {
  background: #3b82f6;
}
.agent-aname {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-title);
  letter-spacing: -.2px;
}
.agent-pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
}
.agent-pill.run {
  background: rgba(34, 197, 94, .12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, .25);
}
.agent-pill.idle {
  background: rgba(148, 163, 184, .1);
  color: var(--text-soft);
  border: 1px solid var(--border-faint);
}
.agent-pill.none {
  background: transparent;
  color: var(--text-ghost);
  border: 1px dashed var(--border-faint);
}
.agent-acc-badge {
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg-hover, rgba(128,128,128,.1));
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-faint);
}

/* 额度进度条可视化 */
.agent-quota-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-faint);
}
.agent-quota-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.agent-bucket-row {
  margin-bottom: 8px;
}
.agent-bucket-row:last-child {
  margin-bottom: 0;
}
.agent-bucket-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  margin-bottom: 3px;
  color: var(--text-body);
}
.agent-bucket-meta .reset-txt {
  font-size: 11px;
  color: var(--text-ghost);
}
.agent-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.agent-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}
.agent-bar-fill.high { background: #22c55e; }
.agent-bar-fill.mid { background: #f59e0b; }
.agent-bar-fill.low { background: #ef4444; }

/* 活跃进程与会话列表 */
.agent-procs-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.agent-proc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(0,0,0,.12);
  font-size: 11.5px;
}
.agent-proc-pid {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600;
  color: #38bdf8;
}
.agent-proc-cwd {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-soft);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-proc-res {
  color: var(--text-ghost);
}

/* 智能体底层环境栏 */
.agent-env-section {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-faint);
  background: var(--bg-card, rgba(255,255,255,.025));
}
.agent-env-head {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.agent-env-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.agent-env-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border-faint);
  font-size: 12px;
}
.agent-env-chip b {
  color: var(--text-title);
}
.agent-env-chip span {
  font-family: ui-monospace, Menlo, monospace;
  color: #93c5fd;
}

/* --- PVE 虚拟机状态面板 (Windows11 / DEBIAN) --- */
.hp-vms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}
@media (max-width: 860px) {
  .hp-vms-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.hp-vm-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  background: var(--bg-card, rgba(255,255,255,.025));
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.2));
  transition: border-color .15s ease, background .15s ease;
}
.hp-vm-card:hover {
  border-color: var(--border-hover, rgba(255,255,255,.16));
}
.hp-vm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.06));
}
.hp-vm-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.hp-vm-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  flex-shrink: 0;
}
.hp-vm-ico.stopped {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dead, #71717a);
}
.hp-vm-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-title, #fff);
  letter-spacing: -0.2px;
}
.hp-vm-uptime {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted, #94a3b8);
}
.hp-vm-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: lowercase;
}
.hp-vm-status-badge.running {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.hp-vm-status-badge.stopped {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim, #a1a1aa);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.hp-vm-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 5px;
  transition: all .15s ease;
}
.hp-vm-link:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}
.hp-vm-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.hp-vm-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hp-vm-row-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hp-vm-k {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim, #94a3b8);
  font-weight: 400;
}
.hp-vm-k .ic {
  color: var(--text-muted, #64748b);
}
.hp-vm-v {
  color: var(--text-title, #f1f5f9);
  font-family: var(--font-mono, monospace);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}
.hp-vm-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.hp-vm-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .3s ease;
}
.hp-vm-bar-fill.cpu {
  background: #38bdf8;
}
.hp-vm-bar-fill.mem {
  background: #22c55e;
}
.hp-vm-bar-fill.mem.warn {
  background: #f59e0b;
}
.hp-vm-bar-fill.mem.bad {
  background: #ef4444;
}
.hp-vm-ips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 2px;
}
.hp-vm-ip-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-soft, #cbd5e1);
}
.hp-vm-ip-tag.clickable {
  color: #38bdf8;
  cursor: pointer;
  text-decoration: none;
}
.hp-vm-ip-tag.clickable:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

/* --- PVE 虚拟机详情全屏滑层 / 面板 --- */
.vm-sheet {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: var(--bg, #0d1117);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vm-sheet[hidden] {
  display: none !important;
}
.vm-sheet.opening {
  animation: vmSheetFade .2s ease;
}
@keyframes vmSheetFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.vm-sheet-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.08));
  background: var(--bg-card, rgba(255,255,255,.02));
  flex-shrink: 0;
}
.vm-sheet-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vm-sheet-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-title, #fff);
  letter-spacing: -.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vm-sheet-sub {
  font-size: 11.5px;
  color: var(--text-soft, rgba(255,255,255,.6));
  font-family: var(--font-mono, monospace);
}
.vm-sheet-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn-open-pve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 7px;
  padding: 6px 12px;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn-open-pve:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.4);
}
@media (max-width: 600px) {
  .btn-open-pve span {
    display: none;
  }
  .btn-open-pve {
    padding: 7px 9px;
  }
}
.vm-sheet-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.06));
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.vm-sheet-nav .chip {
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-dim, #94a3b8);
  background: rgba(255, 255, 255, 0.05);
  transition: all .15s ease;
}
.vm-sheet-nav .chip.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
  font-weight: 600;
}
.vm-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.vmd-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 860px) {
  .vmd-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .vmd-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.vmd-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 10px;
}
.vmd-kpi-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-dim, #94a3b8);
}
.vmd-kpi-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-title, #fff);
  font-family: var(--font-mono, monospace);
}
.vmd-kpi-sub {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.vmd-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 860px) {
  .vmd-charts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.vmd-chart-card {
  padding: 14px 16px;
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.vmd-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vmd-chart-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title, #fff);
  display: flex;
  align-items: center;
  gap: 6px;
}
.vmd-chart-badge {
  font-size: 11.5px;
  font-family: var(--font-mono, monospace);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim, #94a3b8);
}
.vmd-chart-box {
  width: 100%;
  height: 150px;
  position: relative;
}
.vmd-svg-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.vmd-table-card {
  padding: 14px 16px;
  background: var(--bg-card, rgba(255,255,255,.025));
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.vmd-table-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-title, #fff);
  display: flex;
  align-items: center;
  gap: 6px;
}
.vmd-kv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vmd-kv-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.05));
  font-size: 12.5px;
}
.vmd-kv-item:last-child {
  border-bottom: none;
}
.vmd-kv-k {
  color: var(--text-dim, #94a3b8);
  flex-shrink: 0;
}
.vmd-kv-v {
  color: var(--text-title, #f1f5f9);
  font-family: var(--font-mono, monospace);
  text-align: right;
  word-break: break-all;
}
.vmd-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
}
.vmd-task-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.vmd-task-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
}
.vmd-task-time {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}
.vmd-snap-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.vmd-snap-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vmd-snap-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title, #fff);
}
.vmd-snap-desc {
  font-size: 11.5px;
  color: var(--text-dim, #94a3b8);
}

/* --- 首页四大中枢 Portal 概览网格 --- */
.hp-portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 14px;
}
@media (max-width: 860px) {
  .hp-portal-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.hp-portal-card {
  display: flex;
  flex-direction: column;
  min-width: 0; /* 栅格/弹性子项: 阻止 nowrap 长文(如提交信息)撑宽轨道, 移动端右侧圆角不再被裁 */
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  background: var(--bg-card, rgba(255,255,255,.025));
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.2));
  transition: border-color .15s ease, background .15s ease;
}
.hp-portal-card:hover {
  border-color: var(--border-hover, rgba(255,255,255,.16));
}
.hp-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.06));
}
.hp-portal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hp-portal-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
}
.hp-portal-title h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-title, #fff);
  letter-spacing: -0.2px;
}
.hp-portal-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: var(--text-soft, rgba(255,255,255,.65));
}
.hp-portal-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #38bdf8;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all .15s ease;
}
.hp-portal-jump:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}
.hp-portal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

/* 1. 活动概览条目 */
.hp-act-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,.15);
  border: 1px solid var(--border-faint, rgba(255,255,255,.04));
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.hp-act-row:hover {
  background: rgba(255,255,255,.04);
  border-color: var(--border-soft, rgba(255,255,255,.1));
}
.hp-act-topline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.hp-act-repo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--rc-bg, rgba(255,255,255,.08));
  color: var(--rc-col, #38bdf8);
  border: 1px solid var(--rc-bd, rgba(255,255,255,.12));
}
.hp-act-author {
  color: var(--text-soft, rgba(255,255,255,.6));
  font-size: 11.5px;
}
.hp-act-time {
  margin-left: auto;
  color: var(--text-dead, rgba(255,255,255,.4));
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
}
.hp-act-msg {
  font-size: 12.5px;
  color: var(--text-main, #eee);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* 2. Tmux 概览条目 */
.hp-tmux-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,.15);
  border: 1px solid var(--border-faint, rgba(255,255,255,.04));
  cursor: pointer;
  transition: background .15s ease;
}
.hp-tmux-row:hover {
  background: rgba(255,255,255,.04);
}
.hp-tmux-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.hp-tmux-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title, #fff);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hp-tmux-sub {
  font-size: 11.5px;
  color: var(--text-soft, rgba(255,255,255,.6));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-tmux-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

/* 3. 服务概览磁贴网格 */
.hp-svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.hp-svc-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border-faint, rgba(255,255,255,.05));
  text-decoration: none;
  color: inherit;
  transition: all .15s ease;
}
.hp-svc-chip:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(74, 222, 128, 0.35);
  transform: translateY(-1px);
}
.hp-svc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.hp-svc-name {
  font-weight: 600;
  color: var(--text-title, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-svc-port {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #4ade80;
}
.hp-svc-res {
  font-size: 10.5px;
  color: var(--text-dead, rgba(255,255,255,.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 4. Agent 概览卡 */
.hp-agent-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hp-agent-kpis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hp-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(0,0,0,.2);
  border: 1px solid var(--border-faint, rgba(255,255,255,.06));
  font-size: 11.5px;
}
.hp-agent-pill b {
  color: #fff;
}
.hp-agent-pill.green {
  border-color: rgba(74, 222, 128, 0.25);
  color: #4ade80;
}
.hp-agent-pill.warn {
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}
.hp-agent-procs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}
.hp-agent-proc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0,0,0,.15);
  font-size: 11.5px;
  border: 1px solid var(--border-faint, rgba(255,255,255,.04));
}
.hp-agent-proc-name {
  font-weight: 600;
  color: #a78bfa;
}
.hp-agent-proc-detail {
  color: var(--text-dead, rgba(255,255,255,.5));
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
}

/* Agent 详情全屏滑层 / 面板 (风格同 traj-sheet，体验流畅，无任何 popup 弹窗困扰) */
.agent-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 70;
  background: var(--bg, #0d1117);
  overflow: hidden;
}
.agent-sheet[hidden] {
  display: none !important;
}
.agent-sheet.opening {
  animation: agentSheetFade .2s ease;
}
@keyframes agentSheetFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.agent-sheet-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.08));
}
.agent-sheet-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agent-sheet-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-sheet-sub {
  font-size: 11px;
  color: var(--text-soft);
  font-family: ui-monospace, Menlo, monospace;
}
.agent-sheet-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.06));
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.agent-sheet-nav .chip {
  font-size: 12px;
  padding: 4px 11px;
  cursor: pointer;
  user-select: none;
}
.agent-sheet-body {
  /* 绝对定位钉在页签下方到屏幕底。不要用 height:0 + flex 撑开，
     那个组合在开着开发者工具时会保持 0 高，正文被裁成一片黑。 */
  position: absolute;
  left: 0;
  right: 0;
  top: 132px;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px calc(32px + env(safe-area-inset-bottom));
}

/* 详情分区样式 */
.ad-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ad-sec-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ad-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.ad-info-card {
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border-faint, rgba(255,255,255,.06));
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ad-info-label {
  font-size: 11px;
  color: var(--text-ghost);
}
.ad-info-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  word-break: break-all;
}
.ad-fallback-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.ad-fallback-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border-faint);
  color: var(--text-soft);
}

/* Skills 矩阵 */
.ad-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.ad-skill-card {
  background: rgba(0,0,0,.15);
  border: 1px solid var(--border-faint, rgba(255,255,255,.06));
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s ease;
}
.ad-skill-card:hover {
  border-color: rgba(168, 85, 247, .4);
}
.ad-skill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ad-skill-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #c084fc;
}
.ad-skill-cat {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, .12);
  color: #c084fc;
}
.ad-skill-desc {
  font-size: 11.5px;
  color: var(--text-soft);
  line-height: 1.4;
}

/* 平台与网关 */
.ad-platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(0,0,0,.16);
  border: 1px solid var(--border-faint);
}
.ad-platform-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ad-platform-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 500;
}
.ad-platform-badge.connected {
  background: rgba(34, 197, 94, .12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, .25);
}

/* 记忆与设定 */
.ad-memory-box {
  background: rgba(0,0,0,.15);
  border: 1px solid var(--border-faint);
  border-radius: 9px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ad-memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ad-memory-title {
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
}
.ad-memory-count {
  font-size: 11px;
  color: var(--text-ghost);
}
.ad-memory-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ad-memory-item {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-body);
  padding: 6px 8px;
  background: rgba(255,255,255,.02);
  border-radius: 6px;
  border-left: 2px solid #38bdf8;
}

/* Cron 任务 */
.ad-cron-card {
  background: rgba(0,0,0,.15);
  border: 1px solid var(--border-faint);
  border-radius: 9px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ad-cron-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ad-cron-name {
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
}
.ad-cron-sched {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  background: rgba(251, 191, 36, .12);
  color: #fbbf24;
  padding: 2px 7px;
  border-radius: 4px;
}
.ad-cron-prompt {
  font-size: 11.5px;
  color: var(--text-soft);
  line-height: 1.45;
  background: rgba(0,0,0,.2);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border-faint);
  max-height: 120px;
  overflow-y: auto;
}
.ad-cron-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-ghost);
  flex-wrap: wrap;
}

/* ---------------- Tmux 全屏/沉浸式实时终端滑层 (Tmux Terminal Sheet) ---------------- */
.tmux-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 75;
  background: #080a0e;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tmux-sheet[hidden] {
  display: none !important;
}
.tmux-sheet.opening {
  animation: agentSheetFade .18s ease;
}
.tmux-sheet-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.08));
  background: rgba(13,17,23,.92);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.tmux-sheet-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tmux-sheet-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title, #fff);
  letter-spacing: -.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tmux-sheet-pane-badge {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, .15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, .25);
}
.tmux-sheet-sub {
  font-size: 11px;
  color: var(--text-ghost, rgba(255,255,255,.45));
  font-family: ui-monospace, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tmux-sheet-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-tmux-sheet-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-faint, rgba(255,255,255,.08));
  color: var(--text-soft, rgba(255,255,255,.75));
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.btn-tmux-sheet-act:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.btn-tmux-sheet-act.active {
  background: rgba(56, 189, 248, .15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, .3);
}
.tmux-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}
.tmux-live-dot.on {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, .7);
  animation: liveDotPulse 2s infinite ease-in-out;
}
@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.85); }
}
.tmux-sheet-select {
  background: rgba(0,0,0,.35);
  border: 1px solid var(--border-faint, rgba(255,255,255,.1));
  color: var(--text-soft, rgba(255,255,255,.75));
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.tmux-sheet-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.06));
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.tmux-sheet-tabs:empty {
  display: none;
}
.tmux-sheet-tab {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border-faint, rgba(255,255,255,.06));
  color: var(--text-soft, rgba(255,255,255,.7));
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tmux-sheet-tab:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.tmux-sheet-tab.active {
  background: rgba(56, 189, 248, .15);
  border-color: rgba(56, 189, 248, .35);
  color: #38bdf8;
  font-weight: 600;
}
.tmux-sheet-body {
  flex: 1 1 auto;
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #06090e;
  padding: 10px 14px calc(24px + env(safe-area-inset-bottom));
}
.tmux-fullscreen-pre {
  margin: 0;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #e6edf3;
  white-space: pre-wrap;
  word-break: break-all;
}
.tmux-fullscreen-pre code {
  font-family: inherit;
}
.tmux-sheet-scroll-btn {
  position: absolute;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, .88);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, .4);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  z-index: 10;
  transition: all .15s ease;
}
.tmux-sheet-scroll-btn:hover {
  background: rgba(56, 189, 248, .2);
}

/* 终端 ANSI 颜色着色类 */
.ansi-bold { font-weight: 700; }
.ansi-dim { opacity: 0.65; }
.ansi-italic { font-style: italic; }
.ansi-underline { text-decoration: underline; }
.ansi-fg-black   { color: #484f58; }
.ansi-fg-red     { color: #ff7b72; }
.ansi-fg-green   { color: #7ee787; }
.ansi-fg-yellow  { color: #d29922; }
.ansi-fg-blue    { color: #58a6ff; }
.ansi-fg-magenta { color: #bc8cff; }
.ansi-fg-cyan    { color: #39c5cf; }
.ansi-fg-white   { color: #d0d7de; }
.ansi-fg-bright-black   { color: #6e7681; }
.ansi-fg-bright-red     { color: #ffa198; }
.ansi-fg-bright-green   { color: #56d364; }
.ansi-fg-bright-yellow  { color: #e3b341; }
.ansi-fg-bright-blue    { color: #79c0ff; }
.ansi-fg-bright-magenta { color: #d2a8ff; }
.ansi-fg-bright-cyan    { color: #56d4dd; }
.ansi-fg-bright-white   { color: #f0f6fc; }
.ansi-bg-black   { background-color: #21262d; }
.ansi-bg-red     { background-color: rgba(255, 123, 114, 0.2); }
.ansi-bg-green   { background-color: rgba(126, 231, 135, 0.2); }
.ansi-bg-yellow  { background-color: rgba(210, 153, 34, 0.2); }
.ansi-bg-blue    { background-color: rgba(88, 166, 255, 0.2); }
.ansi-bg-magenta { background-color: rgba(188, 140, 255, 0.2); }
.ansi-bg-cyan    { background-color: rgba(57, 197, 207, 0.2); }
.ansi-bg-white   { background-color: rgba(208, 215, 222, 0.2); }

/* ================================================================
   概览 Agent 卡片组 (多维度额度进度条)
   ================================================================ */
.hp-ag-item {
  padding: 10px 6px;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}
.hp-ag-item:last-child {
  border-bottom: none;
}
.hp-ag-item:hover, .hp-ag-item:focus-visible {
  background: var(--bg2);
  outline: none;
}
.hp-ag-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.hp-ag-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.hp-ag-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-ag-procs {
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--bd);
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.hp-ag-cwds {
  display: flex;
  gap: 4px;
  overflow: hidden;
}
.hp-ag-cwd {
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg2);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.hp-ag-buckets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 7px 16px;
}
.hp-bucket-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hp-bucket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  line-height: 1.3;
}
.hp-bucket-name {
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.hp-bucket-right {
  display: flex;
  align-items: center;
  gap: 5px;
}
.hp-bucket-reset {
  font-size: 10px;
  color: var(--text-dead);
}
.hp-bucket-val {
  font-weight: 700;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.hp-bucket-val.high { color: var(--green); }
.hp-bucket-val.mid { color: #f59e0b; }
.hp-bucket-val.low { color: var(--red); }
.hp-bucket-track {
  width: 100%;
  height: 5px;
  background: rgba(125, 125, 125, 0.16);
  border-radius: 3px;
  overflow: hidden;
}
.hp-bucket-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.hp-bucket-fill.high { background: #22c55e; }
.hp-bucket-fill.mid { background: #f59e0b; }
.hp-bucket-fill.low { background: #ef4444; }
.hp-ag-noquota {
  font-size: 11px;
  color: var(--text-dead);
  padding: 2px 0;
}


/* ================================================================
   Goal 「▶ 恢复运行」按钮 (Plan C)
   ================================================================ */
.g-resume-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer;
  background: #16a34a; color: #fff;
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
  transition: background .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.g-resume-btn:hover { background: #15803d; }
.g-resume-btn:active { background: #14532d; }
.g-resume-btn:disabled { opacity: .5; cursor: not-allowed; }
.g-resume-btn.ok { background: #374151; }
@media (max-width: 480px) {
  .g-resume-btn { padding: 6px 14px; font-size: 13px; }
}

/* ================================================================
   Tmux 会话与智能体任务中枢扩展样式 (融合 Goal 与独立后台进程)
   ================================================================ */
.tmux-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tmux-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bd);
}
.tmux-goal-banner-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.tmux-resumable-card {
  border-left: 3px solid #f97316;
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.03) 0%, transparent 100%);
}
.tmux-resumable-desc {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg2);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.4;
  word-break: break-all;
}
.tmux-standalone-card {
  border-left: 3px solid #ec4899;
}
.tmux-proc-cmd-box {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bg2);
  border-radius: 6px;
  font-size: 11.5px;
  overflow-x: auto;
}
.tmux-proc-cmd-box code {
  color: #f472b6;
  font-family: monospace;
}

/* 智能推进唤醒按钮高亮样式 */
.btn-tmux-wake {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.38) !important;
  font-weight: 600 !important;
}
.btn-tmux-wake:hover {
  background: rgba(245, 158, 11, 0.28) !important;
  border-color: rgba(245, 158, 11, 0.6) !important;
}
.btn-tmux-wake.working {
  opacity: 0.75;
  cursor: wait;
}
.btn-tmux-wake.success {
  background: rgba(34, 197, 94, 0.22) !important;
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.5) !important;
}

/* 提交卡片作者头像与评论紧凑布局 */
.act-author-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.act-avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* --- Tailscale 网络与服务中枢样式 --- */
.ts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ts-header h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.ts-header-actions {
  display: flex;
  gap: 6px;
}
.btn-ts-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft, rgba(255,255,255,0.08));
  background: var(--bg-card, rgba(30,34,42,0.6));
  color: var(--fg, #e2e8f0);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ts-action:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.ts-card {
  background: var(--bg-card, rgba(26,29,36,0.7));
  border: 1px solid var(--border-soft, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
}
.ts-self-card {
  border-left: 3px solid #3b82f6;
}
.ts-self-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ts-self-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}
.ts-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
}
.ts-badge.running {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.ts-self-ips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}
.ts-ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.25);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.ts-ip-chip:hover {
  background: rgba(255,255,255,0.08);
}
.ts-dns-text {
  font-size: 11px;
  color: var(--fg-dim, #94a3b8);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  word-break: break-all;
}

.ts-sec-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-dim, #cbd5e1);
  margin: 14px 0 8px 2px;
}

/* Serve 代理网格 */
.ts-serve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.ts-serve-card {
  background: var(--bg-card, rgba(26,29,36,0.6));
  border: 1px solid var(--border-soft, rgba(255,255,255,0.07));
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ts-serve-info {
  min-width: 0;
  flex: 1;
}
.ts-serve-path {
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  font-weight: 700;
  color: #60a5fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ts-serve-proxy {
  font-size: 10.5px;
  color: var(--fg-dim, #94a3b8);
  margin-top: 2px;
}
.ts-serve-btns {
  display: flex;
  gap: 5px;
  margin-left: 8px;
}
.btn-ts-mini {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft, rgba(255,255,255,0.1));
  background: rgba(255,255,255,0.06);
  color: var(--fg, #f8fafc);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.btn-ts-mini:active {
  transform: scale(0.95);
}

/* Peers 设备卡片列表 */
.ts-peers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ts-peer-card {
  background: var(--bg-card, rgba(26,29,36,0.6));
  border: 1px solid var(--border-soft, rgba(255,255,255,0.07));
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.2s;
}
.ts-peer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ts-peer-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
.ts-os-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
}
.ts-conn-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ts-conn-pill.direct {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.ts-conn-pill.relay {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.ts-conn-pill.offline {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.ts-peer-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.ts-peer-ip {
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  color: #cbd5e1;
}
.ts-peer-traffic {
  font-size: 10.5px;
  color: var(--fg-dim, #64748b);
}
.ts-peer-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.ts-ping-res {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  margin-left: 4px;
}
.ts-ping-res.err {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Netcheck 诊断卡片 */
.ts-netcheck-panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease-out;
}
.ts-diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.ts-diag-item {
  background: rgba(255,255,255,0.04);
  padding: 8px;
  border-radius: 6px;
  text-align: center;
}
.ts-diag-label {
  font-size: 10px;
  color: var(--fg-dim, #94a3b8);
  margin-bottom: 2px;
}
.ts-diag-val {
  font-size: 12px;
  font-weight: 700;
}
.ts-diag-val.ok { color: #10b981; }
.ts-diag-val.warn { color: #f59e0b; }

/* --- 服务管理面板 (Manage Panel) --- */
.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.manage-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manage-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.manage-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.manage-card-desc {
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.4;
}
.manage-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-faint);
}
.manage-card-status {
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
}
.manage-card-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.manage-card-btns .danger {
  color: var(--c-red, #e06c6c);
}
.manage-card-btns .primary {
  color: var(--c-green, #6ec89a);
}
.manage-audit-list {
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  padding: 8px 12px;
  max-height: 220px;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.manage-audit-item {
  white-space: pre-wrap;
  word-break: break-all;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .05);
}
.manage-audit-item:last-child {
  border-bottom: none;
}
.manage-paused-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
/* 终端页面样式 */
.terminal-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--term-bg);
  border: 1px solid var(--term-bd);
  border-radius: 4px;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.terminal-title {
  flex: 1;
  font-weight: bold;
  color: var(--text-title);
}

.btn-terminal-action {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text);
  padding: 6px 10px;
  margin-left: 8px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-terminal-action:hover {
  background: var(--btn-hover);
}

.terminal-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.terminal-pre {
  margin: 0;
  white-space: pre;
  word-wrap: normal;
  word-break: keep-all;
}

.terminal-code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--term-tx);
}

.terminal-input-container {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border-top: 1px solid var(--border);
}

.terminal-prompt {
  color: var(--c-green);
  margin-right: 8px;
  font-family: ui-monospace, monospace;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.manage-paused-table th {
  text-align: left;
  color: var(--text-ghost);
  font-weight: 400;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-soft);
}
.manage-paused-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: middle;
}
.st-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
}
.st-badge.running { background: rgba(110, 200, 154, .18); color: #6ec89a; }
.st-badge.blocked { background: rgba(229, 192, 123, .18); color: #e5c07b; }
.st-badge.idle { background: rgba(150, 150, 150, .14); color: #888; }
.st-badge.completed { background: rgba(97, 175, 239, .18); color: #61afef; }
.btn-task-trigger {
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.btn-tmux-preview.active {
  background: var(--bg-hover);
  color: var(--c-blue);
}

/* ---------------- Tmux 交互式终端与快速操作栏 (Interactive Terminal Bar) ---------------- */
.tmux-sheet-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(13, 17, 23, .97);
  border-top: 1px solid var(--border-faint, rgba(255, 255, 255, .08));
  backdrop-filter: blur(12px);
  z-index: 20;
}
.tmux-bar-keys {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tmux-bar-keys::-webkit-scrollbar {
  display: none;
}
.btn-term-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: all .12s ease;
}
.btn-term-key:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, .16);
}
.btn-term-key.danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, .35);
  background: rgba(248, 113, 113, .12);
}
.btn-term-key.primary {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, .35);
  background: rgba(56, 189, 248, .12);
}
.tmux-bar-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tmux-term-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease;
}
.tmux-term-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, .2);
}
.btn-tmux-term-send {
  flex-shrink: 0;
  height: 38px;
  padding: 0 15px;
  border-radius: 8px;
  background: #0284c7;
  color: #fff;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
  touch-action: manipulation;
  transition: all .15s ease;
}
.btn-tmux-term-send:active {
  transform: scale(0.96);
  background: #0369a1;
}

/* 终止/关闭会话按钮 */
.btn-tmux-sheet-act.danger,
.btn-tmux-act.danger {
  color: #f87171 !important;
}
.btn-tmux-sheet-act.danger:hover,
.btn-tmux-act.danger:hover {
  background: rgba(248, 113, 113, .18) !important;
  border-color: rgba(248, 113, 113, .35) !important;
}

/* ---------------- 新建智能体/终端弹层 (New Agent Modal) ---------------- */
.tmux-new-dialog {
  width: 92%;
  max-width: 520px;
  background: #0d1117;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, .14));
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tmux-new-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .02);
}
.tmux-new-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #f0f6fc;
}
.btn-tmux-close {
  background: transparent;
  border: none;
  color: var(--text-ghost, rgba(255, 255, 255, .45));
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .15s;
}
.btn-tmux-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
.tmux-new-body {
  padding: 16px 18px;
  overflow-y: auto;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tmux-agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.tmux-agent-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
  position: relative;
}
.tmux-agent-card:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
}
.tmux-agent-card.active {
  background: rgba(255, 255, 255, .08);
  border-color: var(--agent-accent, #38bdf8);
  box-shadow: 0 0 0 1px var(--agent-accent, #38bdf8), inset 0 0 12px rgba(56, 189, 248, .08);
}
.tmux-agent-icon {
  color: var(--agent-accent, #38bdf8);
}
.tmux-agent-name {
  font-weight: 700;
  font-size: 13px;
  color: #f0f6fc;
}
.tmux-agent-desc {
  font-size: 10.5px;
  color: var(--text-ghost, rgba(255, 255, 255, .45));
  line-height: 1.25;
}
.tmux-cwd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.tmux-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}
.tmux-form-input, .tmux-form-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f0f6fc;
  font-size: 12.5px;
  font-family: ui-monospace, Menlo, monospace;
  outline: none;
  transition: border-color .15s;
}
.tmux-form-input:focus, .tmux-form-textarea:focus {
  border-color: #38bdf8;
}
.tmux-form-textarea {
  resize: vertical;
  min-height: 56px;
  font-family: inherit;
}
.tmux-new-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .02);
}
.btn-tmux-primary {
  background: #0284c7 !important;
  color: #fff !important;
  border: none !important;
}
.btn-tmux-primary:hover {
  background: #0369a1 !important;
}

/* Magpie 智能路由策略弹窗 & 工具调用详情抽屉 */
.rt-hub i.rt-go { cursor: pointer; transition: all .15s ease; }
.rt-src { cursor: pointer; transition: transform .15s ease; }
.rt-src:hover { transform: scale(1.03); }
.rt-group { cursor: pointer; transition: background .15s ease, border-color .15s ease; box-sizing: border-box; max-width: 100%; }
.rt-group:hover { background: var(--card-2); }
.rt-group.active { border-color: var(--accent); background: rgba(10, 132, 255, 0.08); }

/* 图标尺寸强约束，防止 SVG/图片以原尺寸撑大 */
.rt-pool .nm .ic,
.rt-group .ics .ic,
.rt-gedit .fbrow .ic,
.rt-prov .ic,
.rt-cond .ic {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: none !important;
}
.rt-pool .nm .ic img,
.rt-pool .nm .ic svg,
.rt-group .ics .ic img,
.rt-group .ics .ic svg,
.rt-gedit .fbrow .ic img,
.rt-gedit .fbrow .ic svg,
.rt-prov .ic img,
.rt-prov .ic svg,
.rt-cond .ic img,
.rt-cond .ic svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 16px !important;
  max-height: 16px !important;
  object-fit: contain !important;
  display: block !important;
}

/* 路由组与账号池容器防撑宽约束 */
.rt-gsec {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.rt-gsec .list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}
.rt-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-2);
}
.rt-group:first-child { border-top: 0; }
.rt-group .main { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.rt-group .nm { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.rt-group .nm b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-group .mem {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.rt-group .tags { display: flex; gap: 6px; flex: none; align-items: center; }
.rt-group .tag {
  font-size: 11px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

/* 账号池 */
.rt-pool {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-2);
  box-sizing: border-box;
  max-width: 100%;
}
.rt-pool:first-child { border-top: 0; }
.rt-pool .nm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.rt-pool .nm b { font-weight: 600; white-space: nowrap; }
.rt-pool .nm span:last-child { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rt-pool .ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.rt-pool .lab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rt-pool .lab small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* 路由组内联编辑器 */
.rt-gedit {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px 16px;
  align-items: start;
  padding: 16px 18px;
  background: var(--card);
  border-top: 1px solid var(--line-2);
  box-sizing: border-box;
  max-width: 100%;
}
.rt-gedit .ehead {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 4px;
}
.rt-gedit label {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  padding-top: 6px;
  white-space: nowrap;
}
.rt-gedit .bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.rt-gedit input[type="text"] {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--fg);
  font-size: 12.5px;
  outline: none;
}
.rt-gedit input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.2);
}

@media (max-width: 768px) {
  .rt-gedit {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 14px;
  }
  .rt-gedit label {
    text-align: left;
    padding-top: 4px;
  }
  .rt-pool .ctl {
    width: 100%;
    justify-content: flex-start;
  }
  .rt-group .mem {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* 统一打码保护：全站账号、邮箱与供应商 API 密钥胶囊 */
.masking .pii,
body.is-static .pii,
.masking .is-masked,
body.is-static .is-masked,
.masking .mp-pv-status-pill.mono,
body.is-static .mp-pv-status-pill.mono,
.masking .mp-pv-status-pill.mono span:not(.mp-pv-status-dot),
body.is-static .mp-pv-status-pill.mono span:not(.mp-pv-status-dot) {
  filter: blur(4px) !important;
  opacity: .55 !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.rt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
.rt-modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}
.rt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
}
.rt-modal-head b { font-size: 14px; font-weight: 600; }
.rt-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rt-modal-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.rt-modal-close-btn:hover { background: var(--pill); color: var(--fg); }
.rt-tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.rt-tool-item .t-name { font-weight: 600; color: var(--fg); font-family: monospace; }
.rt-tool-item .t-tokens { margin-left: auto; font-size: 11px; color: var(--muted); }
.rt-policy-grid {
  display: grid;
  gap: 10px;
}
.rt-policy-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 12px;
}
.rt-policy-item.active {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.08);
}
.rt-policy-item b { display: block; margin-bottom: 4px; font-size: 12.5px; }
.rt-policy-item p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 11.5px; }








/* ===== TaskHub: 活动页内的 任务 / 日志 ===== */
.th-list { display: flex; flex-direction: column; gap: 8px; }
.th-card { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.th-card.th-run { cursor: pointer; }
.th-card:hover { background: var(--bg-hover); }
.th-card-main { min-width: 0; flex: 1 1 auto; }
.th-title { font-weight: 650; font-size: 13.5px; color: var(--text-title); word-break: break-word; }
.th-excerpt { margin-top: 4px; color: var(--text-soft); font-size: 11.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.th-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; color: var(--text-dim, var(--text-soft));
  font-size: 11px; }
.th-chip { font-size: 10.5px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; }
.th-chip.primary { border-color: color-mix(in srgb, var(--c-ok) 45%, var(--border)); color: var(--c-ok); }
.th-on { color: var(--c-ok); }
.th-off { color: var(--c-warn); }
.th-st.th-running, .th-st.th-starting { color: var(--c-ok); }
.th-st.th-waiting_user, .th-st.th-queued { color: var(--c-warn); }
.th-st.th-failed, .th-st.th-lost { color: var(--c-bad, #e5534b); }
.th-log-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.th-log { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  max-height: 58vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
  color: var(--text-soft); font: 11.5px/1.55 var(--font-mono, ui-monospace, monospace); margin: 0; }
@media (max-width: 640px) {
  .th-card { flex-direction: column; gap: 7px; }
  .th-log { max-height: 52vh; }
}

/* TaskHub 卡片可读性 */
.th-card { padding: 12px 14px; gap: 14px; }
.th-title { font-size: 14px; line-height: 1.35; }
.th-excerpt { color: var(--text); opacity: .82; font-size: 12px; line-height: 1.55; margin-top: 5px; -webkit-line-clamp: 3; }
.th-meta { color: var(--text-soft); opacity: .95; margin-top: 6px; font-size: 11px; }
.th-chip.primary { background: color-mix(in srgb, var(--c-ok) 16%, transparent); font-weight: 650; }
.th-list { gap: 10px; }

/* ================= 统一页面外壳（page shell）=================
   所有页面共用：页头(page-head) + 分段子标签(page-subnav) + 工具行(page-tools) + 卡片(page-card)
   规则集中在文件末尾，便于一次性调整整体观感。 */
:root {
  --page-pad-x: 18px;
  --page-gap: 14px;
  --card-radius: 14px;
  --card-pad-y: 12px;
  --card-pad-x: 14px;
  --ctl-h: 32px;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 2px 0 var(--page-gap);
}
.page-head-main { min-width: 0; }
.page-head h2 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  color: var(--text-title); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.page-hint {
  display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.5;
  color: var(--text-soft); font-weight: 400; max-width: 68ch;
}
.page-head .ghint { font-size: 11.5px; font-weight: 400; color: var(--text-soft); }
.page-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 分段子标签：与 Agent 页一致，一页只放 3-5 个，等宽不换行 */
.page-subnav {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 var(--page-gap);
  background: var(--bg-hover, rgba(128,128,128,.08));
  border: 1px solid var(--border-faint); border-radius: 10px;
  width: fit-content; max-width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.page-subnav::-webkit-scrollbar { display: none; }
.page-subnav-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  font-size: 13px; font-weight: 500; color: var(--text-soft);
  background: transparent; border: 0; border-radius: 7px; cursor: pointer;
  white-space: nowrap; flex: none; transition: background .15s ease, color .15s ease;
}
.page-subnav-btn:hover { color: var(--text-title); }
.page-subnav-btn.active {
  color: var(--chip-on-tx, #111); background: var(--chip-on-bg, #f2f2f2);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* 工具行：筛选 chip + 搜索，高度统一 */
.page-tools, .filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 12px; min-height: var(--ctl-h);
}
.filters .chip, .page-tools .chip { height: 28px; display: inline-flex; align-items: center; }

/* 卡片统一：活动 / 网络 / 任务 / 会话 */
.act-card, .ts-card, .th-card, .mcard, .gcard, .tmux-session-card {
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  background: var(--bg-panel);
}
.th-card { padding: var(--card-pad-y) var(--card-pad-x); }

/* 页面留白与移动端底部安全区 */
#activity-page, #network-page, #usage-page, #agents-page, #svc-panel, #cron-panel { padding: var(--page-pad-x); }
@media (max-width: 700px) {
  :root { --page-pad-x: 13px; --page-gap: 12px; --card-radius: 12px; }
  #activity-page, #network-page, #usage-page, #agents-page, #svc-panel, #cron-panel {
    padding: var(--page-pad-x) var(--page-pad-x) calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .page-head h2 { font-size: 16px; }
  .page-hint { font-size: 11px; }
  .page-subnav { width: 100%; }
  .page-subnav-btn { flex: 1 1 auto; justify-content: center; padding: 7px 8px; font-size: 12px; }
}

/* ---- 统一外壳 v2：更安静的分段控件、更紧的纵向节奏 ---- */
.agent-subnav-btn.active, .page-subnav-btn.active {
  color: var(--text-title);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 600;
}
.agent-subnav-btn, .page-subnav-btn { padding: 5px 11px; font-size: 12.5px; }
.agent-subnav, .page-subnav { padding: 3px; gap: 2px; border-radius: 10px; }

/* 全局工具入口（Magpie / VNC …）：窄屏单行横向滚动，不再换行挤占首屏 */
@media (max-width: 700px) {
  .toolchips, .tool-chips, #toolchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolchips::-webkit-scrollbar, .tool-chips::-webkit-scrollbar, #toolchips::-webkit-scrollbar { display: none; }
  .page-head { margin-bottom: 10px; }
  .page-hint { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .filters .chip, .page-tools .chip { height: 26px; font-size: 11.5px; padding: 0 10px; }
  #activity-page, #network-page, #usage-page, #agents-page { padding-top: 12px; }
}

/* 加载态：骨架行，避免大片空白看起来像没加载 */
.th-skeleton { display: grid; gap: 10px; }
.th-skeleton i {
  display: block; height: 74px; border-radius: var(--card-radius);
  background: linear-gradient(100deg, var(--bg-panel) 30%, var(--bg-hover) 50%, var(--bg-panel) 70%);
  background-size: 220% 100%; animation: thShimmer 1.2s ease-in-out infinite;
}
@keyframes thShimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* ===== 服务 / 定时任务：与 活动·任务 同一套行卡片 ===== */
.svc-panel { background: transparent; border: 0; box-shadow: none; padding: 0; }
#svc, #cron { border-collapse: separate; border-spacing: 0 8px; width: 100%; }
#svc thead th, #cron thead th {
  background: transparent; border: 0; padding: 2px 12px 4px; text-align: left;
  font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-soft);
}
#svc tbody tr, #cron tbody tr { background: var(--bg-panel); }
#svc tbody td, #cron tbody td {
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 11px 12px; vertical-align: middle; font-size: 12.5px;
}
#svc tbody td:first-child, #cron tbody td:first-child {
  border-left: 1px solid var(--border); border-radius: var(--card-radius) 0 0 var(--card-radius);
}
#svc tbody td:last-child, #cron tbody td:last-child {
  border-right: 1px solid var(--border); border-radius: 0 var(--card-radius) var(--card-radius) 0;
}
#svc tbody tr:hover td, #cron tbody tr:hover td { background: var(--bg-hover); }
#svc .name .svc { font-weight: 650; font-size: 13.5px; color: var(--text-title); }
#svc .badge { border-radius: 999px; padding: 2px 8px; font-size: 10.5px; font-weight: 600; }
#svc .port a { font-variant-numeric: tabular-nums; font-weight: 600; }
#svc .svc-detail, #svc .ctl-btn { border-radius: 999px; padding: 3px 9px; font-size: 11px; }
#svc tbody tr:has(> td.empty) td { background: none; border: 0; }

@media (max-width: 700px) {
  #svc tbody tr, #cron tbody tr {
    border: 1px solid var(--border); border-radius: var(--card-radius);
    padding: 10px 12px; margin-bottom: 8px; display: block;
  }
  #svc tbody td, #cron tbody td { border: 0; padding: 3px 0; }
  #svc tbody td::before, #cron tbody td::before {
    content: attr(data-label); display: block; font-size: 10px; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-soft); margin-bottom: 1px;
  }
}

/* ===== 任务：分组列表 + 详情 ===== */
.th-group { margin-bottom: 16px; }
.th-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 2px 2px 8px; cursor: pointer; color: var(--text-soft);
}
.th-group-title { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
.th-group-n { font-size: 11px; color: var(--text-ghost, var(--text-soft)); }
.th-group-caret { margin-left: auto; font-size: 11px; color: var(--text-ghost, var(--text-soft)); }
.th-cards { display: flex; flex-direction: column; gap: 8px; }
.th-card { cursor: pointer; align-items: center; }
.th-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-ghost, var(--text-soft)); display: inline-block; opacity: .6; }
.th-progress { height: 3px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; margin: 8px 0 5px; }
.th-progress i { display: block; height: 100%; background: var(--c-ok, #58b368); border-radius: 999px; transition: width .3s; }
.th-now { font-size: 11px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-act { font-size: 11px; }
.th-act.danger { color: var(--c-warn, #d98b3a); }
.th-st.th-pending { color: var(--text-soft); }
.th-st.th-succeeded { color: var(--c-ok, #58b368); }
.th-st.th-cancelled { color: var(--text-soft); }
.th-run-row .th-run-log-link { color: var(--c-ok, #58b368); text-decoration: underline; }

/* 详情 */
.th-stages { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 2px; }
.th-stage { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--bg-hover); color: var(--text-soft); }
.th-stage.done { color: var(--c-ok, #58b368); }
.th-stage.now { background: color-mix(in srgb, var(--c-ok, #58b368) 20%, transparent); color: var(--text-title); font-weight: 650; }
.th-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.th-ev { display: grid; grid-template-columns: 42px 68px 1fr; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.th-ev:last-child { border-bottom: 0; }
.th-ev-time { color: var(--text-ghost, var(--text-soft)); font-variant-numeric: tabular-nums; font-size: 11px; }
.th-ev-kind { color: var(--text-soft); font-size: 11px; }
.th-ev-msg { color: var(--text); overflow-wrap: anywhere; }
.th-ev-empty { color: var(--text-soft); grid-template-columns: 1fr; }
.th-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); font-size: 12px; line-height: 1.6; max-height: 260px; overflow: auto; }
.th-runs { display: flex; flex-direction: column; gap: 4px; }
.th-run-row { display: grid; grid-template-columns: 70px 70px 70px 1fr auto; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 11.5px; color: var(--text-soft); cursor: pointer; }
.th-run-row:hover { background: var(--bg-hover); }
.th-runlog { margin-top: 10px; }
.th-runlog-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-soft); margin-bottom: 6px; }
@media (max-width: 700px) {
  .th-ev { grid-template-columns: 38px 58px 1fr; font-size: 11.5px; }
  .th-run-row { grid-template-columns: 1fr 1fr auto; }
  .th-run-row span:nth-child(3) { display: none; }
}

.th-progress.stopped i { background: var(--text-soft); opacity: .5; }
.th-ev-more { grid-template-columns: 1fr; }
.th-ev-more .chip { height: 26px; font-size: 11px; }
@media (max-width: 700px) {
  #tmux-panel { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ===== 任务：左列表 + 右详情（整页滚动，无内部滚动） ===== */
.th-split { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.th-col-list { min-width: 0; }
.th-col-detail { min-width: 0; }
.th-col-detail > .th-pane { position: relative; }

/* 左侧行卡片 */
.th-row { flex-direction: column; align-items: stretch; gap: 4px; padding: 11px 12px; cursor: pointer; border-left: 2px solid transparent; }
.th-row.selected { border-left-color: var(--c-ok, #58b368); background: var(--bg-hover); }
.th-row-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.th-row-time { font-size: 10.5px; color: var(--text-ghost, var(--text-soft)); }
.th-row .th-title { font-size: 13px; line-height: 1.35; }
.th-row .th-excerpt { font-size: 11px; line-height: 1.45; -webkit-line-clamp: 2; margin-top: 2px; }
.th-row .th-meta { margin-top: 3px; font-size: 10.5px; }
.th-row-actions { display: flex; gap: 6px; margin-top: 6px; }
.th-row .th-st { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--bg-hover); }
.th-row .th-progress { margin: 6px 0 2px; }

.th-back { display: none; }

/* 详情正文不再内部滚动 */
.th-detail-body .th-body, .th-detail-body { max-height: none; overflow: visible; }
.th-detail-body .th-log { max-height: 260px; }

@media (max-width: 700px) {
  .th-split { grid-template-columns: 1fr; }
  .th-col-detail:empty { display: none; }
  .th-back { display: inline-flex; }
  /* 手机上是单栏：详情占满，列表隐藏 */
  .th-split.mobile-detail .th-col-list { display: none; }
  .th-split.mobile-detail .th-col-detail { display: block; }
}
.th-split { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
@media (max-width: 700px) {
  #tmux-view-tasks, .th-col-detail, #th-detail { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ============================================================
   任务页精修（token 化）：间距 4/8/12/16/20，字号 11/11.5/12.5/13.5/15
   作用域限定 #tmux-panel，覆盖前面所有临时规则
   ============================================================ */
#tmux-panel {
  --th-gap: 12px;
  --th-pad-x: 13px;
  --th-pad-y: 12px;
  --th-radius: 12px;
  --th-line: color-mix(in srgb, var(--border) 88%, transparent);
  /* 面板表面色：sticky 页头必须用它，才能和 .gpanel 无缝衔接 */
  --th-surface: var(--bg-elev);
  /* 页头下方的投影：深色里只是压住滚上来的内容，浅色里必须更淡，否则像一条粗线 */
  --th-head-shadow: 0 16px 18px -18px rgba(0, 0, 0, .6);
}
:root[data-theme="light"] #tmux-panel { --th-head-shadow: 0 10px 14px -14px rgba(16, 24, 40, .16); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #tmux-panel { --th-head-shadow: 0 10px 14px -14px rgba(16, 24, 40, .16); }
}

/* ---- 左列 ---- */
#tmux-panel .th-group { margin-bottom: 18px; }
#tmux-panel .th-group-head { padding: 0 2px 8px; gap: 8px; }
#tmux-panel .th-group-title { font-size: 11px; letter-spacing: .08em; }
#tmux-panel .th-group-n {
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg-hover); color: var(--text-soft); font-variant-numeric: tabular-nums;
}
#tmux-panel .th-group-caret { font-size: 10.5px; letter-spacing: .02em; opacity: .8; }
#tmux-panel .th-cards { gap: 6px; }

#tmux-panel .th-row {
  padding: var(--th-pad-y) var(--th-pad-x);
  border-radius: var(--th-radius);
  border: 1px solid var(--th-line);
  border-left: 2px solid transparent;
  gap: 3px;
  transition: background .12s ease, border-color .12s ease;
}
#tmux-panel .th-row:hover { background: var(--bg-hover); border-color: var(--border); }
#tmux-panel .th-row.selected {
  background: color-mix(in srgb, var(--c-ok, #58b368) 7%, var(--bg-panel));
  border-left-color: var(--c-ok, #58b368);
  border-color: color-mix(in srgb, var(--c-ok, #58b368) 26%, var(--border));
}
#tmux-panel .th-row-head { align-items: center; }
#tmux-panel .th-row .th-st {
  font-size: 10px; font-weight: 650; letter-spacing: .02em;
  padding: 1.5px 7px; border-radius: 999px; background: var(--bg-hover);
}
#tmux-panel .th-row .th-st.th-running,
#tmux-panel .th-row .th-st.th-starting { background: color-mix(in srgb, var(--c-ok, #58b368) 16%, transparent); color: var(--c-ok, #58b368); }
#tmux-panel .th-row .th-st.th-failed,
#tmux-panel .th-row .th-st.th-lost { background: color-mix(in srgb, var(--c-warn, #d98b3a) 16%, transparent); color: var(--c-warn, #d98b3a); }
#tmux-panel .th-row-time { font-size: 10.5px; color: var(--text-ghost, var(--text-soft)); font-variant-numeric: tabular-nums; }
#tmux-panel .th-row .th-title { font-size: 13.5px; font-weight: 650; line-height: 1.4; letter-spacing: -.005em; margin-top: 1px; }
#tmux-panel .th-row .th-excerpt { font-size: 11.5px; line-height: 1.5; color: var(--text-soft); margin-top: 1px; }
#tmux-panel .th-row .th-meta { font-size: 10.5px; color: var(--text-ghost, var(--text-soft)); margin-top: 4px; gap: 6px; }
#tmux-panel .th-row .th-progress { height: 2px; margin: 7px 0 2px; }
#tmux-panel .th-row-actions { gap: 6px; margin-top: 7px; }
#tmux-panel .th-row-actions .th-btn { height: 24px; font-size: 10.5px; padding: 0 9px; border-radius: 6px; }


/* ---- 右列：正文排版 ---- */
#tmux-panel .th-detail-body { max-width: 940px; }
#tmux-panel .th-stages { gap: 5px; margin: 14px 0 6px; }
#tmux-panel .th-stage { font-size: 10px; padding: 2.5px 8px; border-radius: 999px; }
#tmux-panel .th-progress { height: 3px; margin: 6px 0 6px; }
#tmux-panel .th-now { font-size: 11.5px; color: var(--text-soft); line-height: 1.5; }


#tmux-panel .th-timeline { gap: 0; }
#tmux-panel .th-ev {
  grid-template-columns: 46px 66px minmax(0, 1fr);
  gap: 10px; padding: 7px 0; font-size: 12px; border-bottom: 1px solid var(--th-line);
}
#tmux-panel .th-ev-time { font-size: 10.5px; text-align: right; color: var(--text-ghost, var(--text-soft)); }
#tmux-panel .th-ev-kind { font-size: 10.5px; color: var(--text-soft); }
#tmux-panel .th-ev-msg { font-size: 12.5px; line-height: 1.5; color: var(--text); }
#tmux-panel .th-ev-more { border-bottom: 0; padding-top: 10px; }

#tmux-panel .th-body {
  font-size: 12.5px; line-height: 1.7; color: var(--text-soft);
  max-width: 74ch; max-height: none; overflow: visible;
}
#tmux-panel .th-runs { gap: 5px; }
#tmux-panel .th-run-row {
  grid-template-columns: 62px 62px 66px minmax(0,1fr) auto; align-items: center;
  padding: 8px 11px; border-radius: 10px; font-size: 11.5px; gap: 10px;
}
#tmux-panel .th-run-row:hover { background: var(--bg-hover); }
#tmux-panel .th-log {
  font-size: 11.5px; line-height: 1.6; border-radius: 10px;
  border: 1px solid var(--th-line); background: var(--bg-deep);
}

@media (max-width: 700px) {
  #tmux-panel { --th-gap: 10px; --th-pad-x: 12px; --th-pad-y: 11px; }
  #tmux-panel .th-row .th-title { font-size: 13px; }
  #tmux-panel .th-detail-body { max-width: none; }
  #tmux-panel .th-ev { grid-template-columns: 40px 56px minmax(0, 1fr); gap: 8px; }
}

/* 行内状态：小灯 + 文字（比药丸更安静），仅异常态保留底色 */
#tmux-panel .th-row-head .th-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: var(--text-soft);
}
#tmux-panel .th-led { width: 5px; height: 5px; border-radius: 50%; background: var(--text-ghost, var(--text-soft)); opacity: .7; }
#tmux-panel .th-led-running, #tmux-panel .th-led-starting { background: var(--c-ok, #58b368); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-ok, #58b368) 18%, transparent); }
#tmux-panel .th-led-failed, #tmux-panel .th-led-lost { background: var(--c-warn, #d98b3a); opacity: 1; }
#tmux-panel .th-led-waiting_user { background: var(--c-info, #4a9eda); opacity: 1; }
#tmux-panel .th-row .th-title { margin-top: 5px; }
#tmux-panel .th-row .th-excerpt { line-height: 1.45; }
#tmux-panel .th-row .th-meta { margin-top: 5px; }
#tmux-panel .th-row { padding: 11px 13px 12px; }
#tmux-panel .th-row .th-dot { width: 2.5px; height: 2.5px; }
#tmux-panel .th-row-head { gap: 8px; }
#tmux-panel .th-row-id {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 10.5px; color: var(--text-ghost, var(--text-soft));
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1 1 auto;
}
#tmux-panel .th-row-id b { font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
#tmux-panel .th-row .th-excerpt { -webkit-line-clamp: 2; }
#tmux-panel .th-row { padding: 10px 13px 11px; gap: 2px; }
#tmux-panel .th-row .th-title { margin-top: 4px; font-size: 13.5px; }

/* 精修第二轮：空状态、区块标题、主按钮语义、左卡片呼吸 */
#tmux-panel .th-ev-empty { grid-template-columns: minmax(0, 1fr); padding: 14px 0; }
#tmux-panel .th-ev-empty {
  display: block; color: var(--text-ghost, var(--text-soft)); font-size: 12px;
}
#tmux-panel .th-ev-kind { text-transform: lowercase; }
#tmux-panel .th-row .th-title { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
#tmux-panel .th-row .th-excerpt { color: color-mix(in srgb, var(--text-soft) 92%, var(--text)); opacity: 1; }
#tmux-panel .th-row .th-row-time { opacity: .85; }
#tmux-panel .th-row.selected .th-title { color: var(--text-title); }

/* 精修第三轮：底部留白、时间戳不折行、终端可读性、按钮主次 */
#tmux-panel { padding-bottom: 28px; }
#tmux-panel .th-ev-time { white-space: nowrap; }
#tmux-panel .th-ev-kind { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tmux-panel .th-log, #tmux-panel .th-log * {
  font-size: 11.5px; line-height: 1.65;
  color: color-mix(in srgb, var(--text) 86%, var(--text-soft));
}
#tmux-panel .th-log { padding: 10px 12px; }
@media (max-width: 700px) { #tmux-panel { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

/* ===== 静态快照里的任务页：只有标题+摘要，详情打码，无任何操作 ===== */
body.is-static #btn-tmux-new-open { display: none !important; }
#tmux-panel .th-static-row { cursor: pointer; }
#tmux-panel .th-static-row .th-title { font-size: 13.5px; font-weight: 600; }
#tmux-panel .th-static-row .th-excerpt {
  filter: blur(3.2px); opacity: .5; user-select: none; pointer-events: none;
}
#tmux-panel .th-static-row:hover .th-excerpt { filter: blur(3.2px); opacity: .5; }
#tmux-panel .th-static-tag {
  font-size: 11px; line-height: 1.6; color: var(--text-ghost, var(--text-soft));
  padding: 8px 10px; border: 1px dashed var(--th-line); border-radius: 9px; margin: 4px 0 14px;
}
#tmux-panel .th-mask-line {
  height: 11px; border-radius: 3px; margin: 10px 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--text) 26%, transparent),
    color-mix(in srgb, var(--text) 14%, transparent) 60%,
    color-mix(in srgb, var(--text) 22%, transparent));
  filter: blur(3px); opacity: .45;
}
body.is-static #tmux-panel .th-detail-body { padding-top: 2px; }
#tmux-panel .th-static-row .th-excerpt { filter: none; opacity: .92; user-select: text; pointer-events: auto; }
#tmux-panel .th-static-row:hover .th-excerpt { filter: none; opacity: .92; }

/* ===== 新建任务弹层：左执行者 / 右正文 ===== */
.ui-dialog.nt-dialog { width: min(920px, 96vw); max-height: 88vh; display: flex; flex-direction: column; }
.nt-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; padding: 16px 20px 18px; overflow: hidden; min-height: 0; }
.nt-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.nt-side-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
.nt-agents { display: flex; flex-direction: column; gap: 6px; }
.nt-agent {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-hover); transition: border-color .12s, background .12s;
}
.nt-agent:hover { border-color: var(--text-soft); }
.nt-agent.active { border-color: var(--accent-blue-bd); background: var(--accent-blue-bg); }
.nt-agent-name { font-size: 13px; font-weight: 650; color: var(--text-title); }
.nt-agent-desc { font-size: 10.5px; color: var(--text-soft); }
.nt-hosts { display: flex; flex-wrap: wrap; gap: 5px; }
.nt-hosts .chip { height: 24px; font-size: 11px; }
.nt-hosts .chip.active { border-color: var(--accent-blue-bd); background: var(--accent-blue-bg); color: var(--accent-blue-tx); }
.nt-note { margin-top: auto; font-size: 10.5px; line-height: 1.55; color: var(--text-ghost, var(--text-soft)); }
.nt-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.nt-title-input { height: 38px; font-size: 14px; font-weight: 600; }
.nt-body-input {
  flex: 1 1 auto; min-height: 300px; resize: vertical;
  font-size: 12.5px; line-height: 1.65; padding: 12px 13px;
}
@media (max-width: 700px) {
  .ui-dialog.nt-dialog { width: 96vw; max-height: 92vh; }
  .nt-body { grid-template-columns: 1fr; gap: 12px; }
  .nt-agents { flex-direction: row; }
  .nt-agent { flex: 1 1 0; }
  .nt-note { margin-top: 4px; }
  .nt-body-input { min-height: 210px; }
}
.ui-dialog.tmux-new-dialog.nt-dialog { width: min(920px, 96vw) !important; max-width: none; }
.ui-dialog.tmux-new-dialog.nt-dialog .tmux-new-body { display: none; }

/* ============================================================
   任务页 v2：详情页头 + 区块卡片 + 派遣弹窗
   - 详情：状态/编号/标题/元信息/操作 = 顶部一屏可读的页头；正文按区块分卡
   - 派遣：从列表或详情点击后弹出（挂 body，手机为底部滑层），不再内联插在列表顶部
   间距走 4/8/12/16，字号 10.5/11/12/12.5/13/17，全部复用主题 token。
   ============================================================ */

/* ---- 按钮（任务页与弹窗共用；弹窗不在 #tmux-panel 作用域内 ---- */
.th-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box;
  height: 30px; padding: 0 11px; border-radius: 8px;
  font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: .01em;
  color: var(--text-soft); background: transparent; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.th-btn:hover { background: var(--bg-hover); color: var(--text-title); }
.th-btn:active { background: var(--bg-active); }
.th-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.th-btn[disabled] { opacity: .55; cursor: default; box-shadow: none; }
/* 唯一主操作：实心胶囊；其余动作一律无边框幽灵按钮，避免一排描边方块 */
.th-btn-primary {
  height: 32px; padding: 0 18px; border-radius: 999px;
  background: var(--accent); border-color: transparent; color: #fff; font-weight: 650; letter-spacing: .015em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .16), 0 6px 16px color-mix(in srgb, var(--accent) 22%, transparent);
}
.th-btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); color: #fff; }
.th-btn-primary:active { background: color-mix(in srgb, var(--accent) 88%, #000); }
/* 运行中任务的主操作（唤醒推进）：淡蓝底 + 蓝字，比实心胶囊安静，但仍是唯一的强调色 */
.th-btn-accent { color: var(--accent-blue-tx); background: var(--accent-blue-bg); border-color: var(--accent-blue-bd); }
.th-btn-accent:hover { background: var(--accent-blue-hover); border-color: var(--accent-blue-bd); color: var(--accent-blue-tx); }
.th-btn-accent:active { background: var(--accent-blue-bd); }
.th-btn-danger { color: var(--c-red); }
.th-btn-danger:hover { background: color-mix(in srgb, var(--c-red) 12%, transparent); color: var(--c-red); }
.th-btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.th-btn-sm.th-btn-primary { height: 26px; padding: 0 13px; border-radius: 999px; box-shadow: none; }

/* ---- 详情页头 ----
   元信息一行（状态徽标 + #编号 + 仓库/机器/分支 … GitHub），标题独占一行，操作行在下方。
   桌面下整块 sticky 在右列里，所以底色必须和面板表面同色（--th-surface = --bg-elev）；
   用页面底色会糊出一块比面板更黑的硬边矩形，背景又没填充，滚动时最扎眼。 */
#tmux-panel .th-head {
  position: relative;
  padding: 0 0 13px; margin: 0 0 4px;
  border-bottom: 1px solid var(--th-line);
}
#tmux-panel .th-head-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0;
  font-size: 11.5px; line-height: 1.4; color: color-mix(in srgb, var(--text) 88%, transparent);
}
#tmux-panel .th-head-num { flex: 0 0 auto; font-weight: 650; color: var(--text-ghost); font-variant-numeric: tabular-nums; }
#tmux-panel .th-head-meta { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
#tmux-panel .th-head-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tmux-panel .th-head-sep { flex: 0 0 auto; width: 2.5px; height: 2.5px; border-radius: 50%; background: var(--text-ghost); opacity: .55; }
#tmux-panel .th-head-title {
  margin: 8px 0 0; max-width: 46ch;
  font-size: 20px; font-weight: 700; line-height: 1.32;
  letter-spacing: -.012em; color: var(--text-title); overflow-wrap: anywhere;
}
#tmux-panel .th-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

#tmux-panel .th-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border-radius: 8px; box-sizing: border-box;
  border: 1px solid transparent; background: transparent;
  color: var(--text-soft); font-family: inherit; font-size: 14px; line-height: 1; text-decoration: none;
  cursor: pointer; transition: background .12s, color .12s;
}
#tmux-panel .th-icon-btn:hover { background: var(--bg-hover); color: var(--text-title); }
#tmux-panel .th-icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
#tmux-panel .th-head-link {
  flex: 0 0 auto; margin-left: auto;
  border-color: var(--th-line); color: var(--text-soft);
}
#tmux-panel .th-head-link:hover { border-color: var(--border); color: var(--text-title); }
#tmux-panel .th-back { display: none; }

/* 状态徽标：小圆点 + 文案，异常态才染色 */
#tmux-panel .th-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px;
  border-radius: 999px; border: 1px solid var(--th-line); background: var(--bg-hover);
  font-size: 10.5px; font-weight: 650; letter-spacing: .01em; color: var(--text-soft);
}
#tmux-panel .th-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
#tmux-panel .th-badge.is-running,
#tmux-panel .th-badge.is-succeeded {
  color: var(--c-green); background: color-mix(in srgb, var(--c-green) 12%, transparent);
  border-color: color-mix(in srgb, var(--c-green) 26%, transparent);
}
#tmux-panel .th-badge.is-starting,
#tmux-panel .th-badge.is-queued { color: var(--c-blue); background: color-mix(in srgb, var(--c-blue) 12%, transparent); border-color: color-mix(in srgb, var(--c-blue) 26%, transparent); }
#tmux-panel .th-badge.is-waiting_user { color: var(--c-warn); background: color-mix(in srgb, var(--c-warn) 13%, transparent); border-color: color-mix(in srgb, var(--c-warn) 30%, transparent); }
#tmux-panel .th-badge.is-failed,
#tmux-panel .th-badge.is-lost { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 12%, transparent); border-color: color-mix(in srgb, var(--c-red) 26%, transparent); }
#tmux-panel .th-badge.is-closed,
#tmux-panel .th-badge.is-cancelled,
#tmux-panel .th-badge.is-pending { color: var(--text-soft); }

/* ---- 正文：文档式分节（不套卡片边框，靠留白与细线分节） ---- */
#tmux-panel .th-detail-body { padding-top: 12px; }
#tmux-panel .th-detail-body > *:first-child { margin-top: 0; }
#tmux-panel .th-sec { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--th-line); }
#tmux-panel .th-sec:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
#tmux-panel .th-sec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#tmux-panel .th-sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 62%, transparent);
}
#tmux-panel .th-sec-note { font-size: 10.5px; color: var(--text-ghost); font-variant-numeric: tabular-nums; }
#tmux-panel .th-sec-head .th-btn { margin-left: auto; }
#tmux-panel .th-note { margin: 0; font-size: 12.5px; line-height: 1.62; color: var(--text-soft); }
#tmux-panel .th-prose {
  max-width: 74ch; font-size: 13px; line-height: 1.78; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}
#tmux-panel .th-sess {
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; line-height: 1.4;
  color: var(--text-soft); background: var(--bg-deep); border: 1px solid var(--th-line);
  border-radius: 6px; padding: 2.5px 7px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#tmux-panel .th-sec .th-log { max-height: 42vh; }

/* 阶段轨：点 + 连线，替代一排药丸 */
#tmux-panel .th-rail { display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 0 0 12px; padding: 0; }
#tmux-panel .th-rail-i {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 9.5px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-ghost); text-align: center;
}
#tmux-panel .th-rail-i::before {
  content: ""; position: absolute; top: 4px; left: -50%; width: 100%; height: 1px;
  background: var(--th-line);
}
#tmux-panel .th-rail-i:first-child::before { display: none; }
#tmux-panel .th-rail-dot {
  position: relative; z-index: 1; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box;
  background: var(--bg-panel); border: 1.5px solid color-mix(in srgb, var(--text) 24%, transparent);
}
#tmux-panel .th-rail-i.done .th-rail-dot { background: var(--c-green); border-color: var(--c-green); }
#tmux-panel .th-rail-i.done::before { background: color-mix(in srgb, var(--c-green) 45%, transparent); }
#tmux-panel .th-rail-i.done span { color: var(--text-soft); }
#tmux-panel .th-rail-i.now .th-rail-dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
#tmux-panel .th-rail-i.now span { color: var(--text-title); font-weight: 650; }

/* 历史执行：行列表，无边框方块 */
#tmux-panel .th-runs { display: flex; flex-direction: column; }
#tmux-panel .th-run-row {
  display: grid; grid-template-columns: 76px 88px 64px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 9px 2px; border: 0; border-bottom: 1px solid var(--th-line); border-radius: 0;
  font-size: 11.5px; color: var(--text-soft); cursor: pointer;
}
#tmux-panel .th-run-row:last-child { border-bottom: 0; }
#tmux-panel .th-run-row:hover { background: color-mix(in srgb, var(--bg-hover) 55%, transparent); }
#tmux-panel .th-run-state { color: var(--text); }
#tmux-panel .th-run-stage { color: var(--text-ghost); }
#tmux-panel .th-run-time { color: var(--text-ghost); font-variant-numeric: tabular-nums; }

/* 桌面：左右两列各自独立滚动 */
@media (min-width: 701px) {
  #tmux-panel .th-back { display: none; }
  #tmux-panel .th-split { align-items: stretch; height: var(--th-split-h, calc(100vh - 220px)); min-height: 360px; }
  #tmux-panel .th-col-list,
  #tmux-panel .th-col-detail {
    height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-gutter: stable; padding-right: 6px; padding-bottom: 10px;
  }
  #tmux-panel .th-head {
    position: sticky; top: 0; z-index: 3;
    padding-top: 12px;
    /* 与面板同色 + 下方一道极浅的投影：内容从页头底下滚过时才看得出来 */
    background: var(--th-surface);
    box-shadow: var(--th-head-shadow);
  }
  #tmux-panel .th-detail-body { max-width: 900px; }
}

@media (max-width: 700px) {
  #tmux-panel .th-back { display: inline-flex; }
  #tmux-panel .th-head { padding: 2px 0 12px; }
  /* 手机一行放不下：元信息独占第二行，不再把仓库/机器/分支挤成省略号 */
  #tmux-panel .th-head-line { flex-wrap: wrap; row-gap: 6px; }
  #tmux-panel .th-head-link { order: 1; }
  #tmux-panel .th-head-meta { order: 2; flex: 1 0 100%; margin-top: -1px; }
  #tmux-panel .th-head-meta > .th-head-sep:first-child { display: none; }
  #tmux-panel .th-head-meta > span:first-child { flex: 0 0 auto; }
  #tmux-panel .th-head-title { font-size: 18px; margin-top: 7px; }
  #tmux-panel .th-head-actions { width: 100%; gap: 6px; margin-top: 11px; }
  /* 等宽三段，三颗动作按钮才像一排控件而不是散落的文字 */
  #tmux-panel .th-head-actions .th-btn {
    flex: 1 1 0; height: 34px; font-size: 12.5px; border-radius: 9px;
    background: var(--bg-hover); border-color: transparent; color: var(--text);
  }
  #tmux-panel .th-head-actions .th-btn-primary { flex: 1.6 1 118px; border-radius: 999px; background: var(--accent); color: #fff; }
  #tmux-panel .th-head-actions .th-btn-accent { background: var(--accent-blue-bg); border-color: var(--accent-blue-bd); color: var(--accent-blue-tx); }
  #tmux-panel .th-head-actions .th-btn-danger { color: var(--c-red); }
  #tmux-panel .th-run-row { grid-template-columns: 1fr 1fr auto; }
  #tmux-panel .th-run-stage { display: none; }
}
/* ---- 派遣弹窗 ---- */
.th-dispatch-modal { z-index: 1000; }
.th-dispatch-modal .th-dlg {
  display: flex; flex-direction: column; box-sizing: border-box;
  width: min(430px, 100%); max-height: min(86vh, 620px);
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .42);
  overflow: hidden; outline: none;
  animation: thDlgIn .16s ease-out;
}
.th-dispatch-modal .th-dlg:focus, .th-dispatch-modal .th-dlg:focus-visible { outline: none; }
@keyframes thDlgIn { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.th-dispatch-modal .th-dlg-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 12px; }
.th-dispatch-modal .th-dlg-head-main { min-width: 0; }
.th-dispatch-modal .th-dlg-kicker { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-ghost); }
.th-dispatch-modal .th-dlg-title {
  display: flex; align-items: baseline; gap: 7px; margin: 5px 0 0;
  font-size: 15px; font-weight: 680; line-height: 1.35; color: var(--text-title); overflow-wrap: anywhere;
}
.th-dispatch-modal .th-dlg-num { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--text-ghost); font-variant-numeric: tabular-nums; }
.th-dispatch-modal .th-dlg-x {
  flex: 0 0 auto; margin-left: auto; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-ghost);
  font-family: inherit; font-size: 14px; line-height: 1; cursor: pointer;
}
.th-dispatch-modal .th-dlg-x:hover { background: var(--bg-hover); color: var(--text-title); }
.th-dispatch-modal .th-dlg-body { display: flex; flex-direction: column; gap: 14px; padding: 0 16px 18px; overflow: auto; }
.th-dispatch-modal .th-field { display: flex; flex-direction: column; gap: 7px; }
.th-dispatch-modal .th-field-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
.th-dispatch-modal .th-field-none { font-size: 12px; color: var(--text-ghost); }
.th-dispatch-modal .th-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.th-dispatch-modal .th-opt {
  display: inline-flex; align-items: center; gap: 7px; box-sizing: border-box;
  height: 34px; padding: 0 12px 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-soft);
  font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.th-dispatch-modal .th-opt:hover { border-color: var(--btn-soft-hover-bd); color: var(--text-title); }
.th-dispatch-modal .th-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.th-dispatch-modal .th-opt-dot {
  width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid var(--text-ghost); transition: background .12s, border-color .12s, box-shadow .12s;
}
.th-dispatch-modal .th-opt.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text-title); }
.th-dispatch-modal .th-opt.is-on .th-opt-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.th-dispatch-modal .th-dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-soft); background: var(--bg-elev); }
.th-dispatch-modal .th-dlg-foot .th-btn { height: 34px; padding: 0 16px; font-size: 12.5px; border-radius: 9px; }
@media (max-width: 700px) {
  .th-dispatch-modal { place-items: end stretch; padding: 0; }
  .th-dispatch-modal .th-dlg {
    width: 100%; max-width: none; max-height: 88vh;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: thSheetUp .22s cubic-bezier(.2, .8, .2, 1);
  }
  .th-dispatch-modal .th-dlg-foot .th-btn { flex: 1 1 0; height: 40px; font-size: 13px; }
  .th-dispatch-modal .th-opt { height: 36px; }
}
@keyframes thSheetUp { from { transform: translateY(26px); opacity: .65; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .th-dispatch-modal .th-dlg { animation: none; }
}
@media (max-width: 700px) {
  /* 手机上左列表与右详情是互斥单栏；桌面双栏规则会在这里兜底覆盖 */
  #tmux-panel .th-split { grid-template-columns: minmax(0, 1fr); }
  #tmux-panel .th-col-list, #tmux-panel .th-col-detail { min-width: 0; }
}

#tmux-panel .th-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
#tmux-panel .th-toolbar .th-btn { color: var(--text-ghost); }
#tmux-panel .th-toolbar .th-btn:hover { color: var(--text-title); }

/* ---- 任务调度与终端重构增强 ---- */
#tmux-panel .th-tab-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; margin-left: 5px;
  background: var(--bg-hover); color: var(--text-soft); vertical-align: middle;
}
#tmux-panel .page-subnav-btn.active .th-tab-badge {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text-title);
}

/* 顶部快速筛选条 */
#tmux-panel .th-filter-bar {
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
  overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
}
#tmux-panel .th-filter-bar::-webkit-scrollbar { display: none; }
#tmux-panel .th-filter-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border-radius: 8px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--border-soft); color: var(--text-soft);
  white-space: nowrap; transition: all .14s ease;
}
#tmux-panel .th-filter-chip:hover { border-color: var(--border); color: var(--text-title); }
#tmux-panel .th-filter-chip.active {
  background: var(--bg-elev); border-color: var(--accent); color: var(--text-title);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
#tmux-panel .th-filter-count {
  font-size: 10px; opacity: .75; font-variant-numeric: tabular-nums;
}

/* 精简瘦身卡片 */
#tmux-panel .th-row {
  position: relative; padding: 10px 12px; gap: 4px; border-radius: 10px;
}
#tmux-panel .th-row .th-title {
  font-size: 13px; font-weight: 620; line-height: 1.35; color: var(--text-title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tmux-panel .th-row .th-excerpt {
  font-size: 11px; line-height: 1.4; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
#tmux-panel .th-row-actions { margin-top: 5px; }

/* 运行中小微动效 */
.th-led-running, .th-led-starting {
  animation: thPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes thPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(1.18); }
}

/* 现代化紧凑阶段指示流水线 */
#tmux-panel .th-stepper {
  display: flex; align-items: center; gap: 6px;
  margin: 10px 0 16px; padding: 0;
  overflow-x: auto; scrollbar-width: none;
}
#tmux-panel .th-stepper::-webkit-scrollbar { display: none; }
#tmux-panel .th-step-item {
  flex: 1 1 0; min-width: 80px; display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; background: var(--bg-elev);
  border: 1px solid var(--border-soft); transition: all .16s ease;
}
#tmux-panel .th-step-dot {
  width: 18px; height: 18px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text-ghost); flex-shrink: 0;
}
#tmux-panel .th-step-item.is-done {
  border-color: color-mix(in srgb, var(--c-ok, #58b368) 35%, transparent);
  background: color-mix(in srgb, var(--c-ok, #58b368) 8%, var(--bg-elev));
}
#tmux-panel .th-step-item.is-done .th-step-dot {
  background: var(--c-ok, #58b368); border-color: var(--c-ok, #58b368); color: #fff;
}
#tmux-panel .th-step-item.is-current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-elev));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
#tmux-panel .th-step-item.is-current .th-step-dot {
  background: var(--accent); border-color: var(--accent); color: #fff;
  animation: thPulse 2s infinite;
}
#tmux-panel .th-step-label {
  font-size: 11px; font-weight: 600; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tmux-panel .th-step-item.is-current .th-step-label { color: var(--text-title); font-weight: 700; }

/* 智能体当下一句话状态卡片 */
#tmux-panel .th-status-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
#tmux-panel .th-status-banner.is-warn {
  border-left-color: var(--c-warn, #d98b3a);
  background: color-mix(in srgb, var(--c-warn, #d98b3a) 8%, var(--bg-elev));
}
#tmux-panel .th-status-msg {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: var(--text-title); line-height: 1.4;
}
#tmux-panel .th-status-meta {
  font-size: 11px; color: var(--text-soft); font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* 待派发专属：内置快速启动卡片 */
#tmux-panel .th-quick-dispatch {
  display: flex; flex-direction: column; gap: 12px; padding: 14px 16px;
  border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--border);
  margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
#tmux-panel .th-qd-head {
  display: flex; align-items: center; justify-content: space-between;
}
#tmux-panel .th-qd-title {
  font-size: 12.5px; font-weight: 700; color: var(--text-title); letter-spacing: -.01em;
}
#tmux-panel .th-qd-hint {
  font-size: 11px; color: var(--text-soft);
}
#tmux-panel .th-qd-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
#tmux-panel .th-qd-label {
  font-size: 11px; font-weight: 650; color: var(--text-soft); min-width: 44px;
}
#tmux-panel .th-qd-opts {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1;
}
#tmux-panel .th-qd-opt {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text-soft); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .12s ease;
}
#tmux-panel .th-qd-opt:hover { border-color: var(--border-hover); color: var(--text-title); }
#tmux-panel .th-qd-opt.is-on {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-panel));
  color: var(--text-title);
}
#tmux-panel .th-qd-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  padding-top: 8px; border-top: 1px solid var(--border-soft); margin-top: 2px;
}
#tmux-panel .th-qd-launch {
  height: 34px; padding: 0 18px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
}

/* 内联人机协同指令回复卡片 */
#tmux-panel .th-inline-reply {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border); margin-bottom: 14px;
}
#tmux-panel .th-inline-reply-head {
  display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 650;
  color: var(--text-title);
}
#tmux-panel .th-inline-reply-box {
  display: flex; gap: 8px; align-items: center;
}
#tmux-panel .th-reply-input {
  flex: 1; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-panel); color: var(--text); padding: 0 10px; font-size: 12.5px;
  outline: none; transition: border-color .14s;
}
#tmux-panel .th-reply-input:focus { border-color: var(--accent); }

/* 详情页多 Tab 控制 */
#tmux-panel .th-detail-tabs {
  display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px; padding-bottom: 8px;
}
#tmux-panel .th-dtab-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text-soft);
  transition: all .12s ease;
}
#tmux-panel .th-dtab-btn:hover { color: var(--text-title); background: var(--bg-hover); }
#tmux-panel .th-dtab-btn.active {
  background: var(--bg-elev); border-color: var(--border-soft); color: var(--text-title);
}

/* 终端控制台容器（融入系统面板风格） */
#tmux-panel .th-term-window {
  display: flex; flex-direction: column; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-panel); overflow: hidden;
}
#tmux-panel .th-term-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg-elev); border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--text-soft);
}
#tmux-panel .th-term-actions {
  display: flex; align-items: center; gap: 6px;
}
#tmux-panel .th-term-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px;
  border-radius: 5px; font-size: 11px; font-weight: 600; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-soft);
  transition: all .12s;
}
#tmux-panel .th-term-btn:hover { border-color: var(--border-hover); color: var(--text-title); }
#tmux-panel .th-term-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
#tmux-panel .th-term-content {
  margin: 0; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: var(--text); background: transparent;
  max-height: 48vh; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}

/* 新建任务专属模态框 */
.th-new-modal .th-dlg {
  width: min(560px, 100%);
}
.th-new-modal .th-tags-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.th-new-modal .th-tag-btn {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--border-soft); color: var(--text-soft);
  transition: all .12s;
}
.th-new-modal .th-tag-btn:hover { border-color: var(--accent); color: var(--text-title); }
.th-new-modal .th-input-text {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); font-size: 13.5px; font-weight: 600; outline: none;
}
.th-new-modal .th-input-text:focus { border-color: var(--accent); }
.th-new-modal .th-textarea {
  width: 100%; box-sizing: border-box; min-height: 110px; padding: 10px 12px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); font-size: 13px; line-height: 1.6; outline: none; resize: vertical;
  font-family: inherit;
}
.th-new-modal .th-textarea:focus { border-color: var(--accent); }
.th-new-modal .th-agent-card {
  flex: 1 1 120px; display: flex; flex-direction: column; gap: 3px;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-panel); cursor: pointer; transition: all .12s;
}
.th-new-modal .th-agent-card:hover { border-color: var(--border-hover); }
.th-new-modal .th-agent-card.is-on {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-panel));
}
.th-new-modal .th-agent-card-title {
  display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--text-title);
}
.th-new-modal .th-agent-card-desc {
  font-size: 11px; color: var(--text-soft); line-height: 1.35;
}


/* Activity / authored upstream pull requests */
#pr-panel { min-width:0; }
.pr-tools { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.pr-tools input,.pr-tools select { min-width:0; max-width:100%; height:30px; border:1px solid var(--border); border-radius:8px; background:var(--bg-panel); color:var(--text); padding:0 8px; }
.pr-tools input { flex:1 1 180px; }
.pr-tools select { flex:1 1 150px; }
#pr-filters { display:flex; flex-wrap:wrap; gap:6px; }
.pr-group { margin-top:18px; }
.pr-group h3 { font-size:13px; margin-bottom:10px; }
.pr-group h3 span { color:var(--text-dim); font-weight:400; }
.pr-card { padding:14px; margin-bottom:8px; min-width:0; }
.pr-meta { display:flex; justify-content:space-between; gap:12px; color:var(--text-dim); font-size:11px; }
.pr-meta span { overflow-wrap:anywhere; }
.pr-meta time { flex-shrink:0; }
.pr-title { display:block; margin:8px 0; font-size:14px; font-weight:600; color:var(--text-title); overflow-wrap:anywhere; text-decoration:none; }
.pr-signals { display:flex; flex-wrap:wrap; gap:6px 12px; font-size:11px; color:var(--text-dim); }

/* Service workspace: one view, one purpose. */
#svc-subnav { margin-bottom:16px; }
#svc-subnav .page-subnav-btn { flex:1 0 auto; justify-content:center; }
#filters.svc-toolbar { display:block; margin-bottom:8px; }
.svc-search-row { display:flex; gap:8px; margin-bottom:12px; }
#svc-search { flex:1; min-width:0; height:36px; padding:0 12px; border:1px solid var(--border); border-radius:var(--card-radius,10px); background:var(--bg-panel); color:var(--text-title); font:inherit; font-size:13px; }
#svc-search:focus { outline:2px solid var(--accent); outline-offset:1px; }
.svc-search-row .btn { display:inline-flex; gap:6px; align-items:center; flex-shrink:0; }
#filters .svc-types { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
#filters .svc-types .chip { font:inherit; font-size:11px; cursor:pointer; }
.svc-list-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--text-dim); font-size:11px; }
.svc-sort { display:flex; gap:4px; }
.svc-sort button { border:0; border-radius:6px; padding:5px 8px; background:transparent; color:var(--text-dim); font:inherit; cursor:pointer; }
.svc-sort button.active { background:var(--bg-elev); color:var(--text-title); }
#svc .svc-row-meta { display:block; margin:5px 0 0 16px; font-size:10.5px; font-weight:400; color:var(--text-dim); }
#svc .svc { overflow-wrap:anywhere; }
#svc .svc-actions { white-space:nowrap; }
#svc .svc-actions .svc-detail { margin-right:8px; }
#svc tbody td { vertical-align:middle; }
#svc-manage-tools[hidden] { display:none; }
@media(min-width:701px) {
  #svc { table-layout:fixed; }
  #svc th:first-child { width:42%; }
  #svc th:nth-child(2) { width:10%; }
  #svc th:nth-child(3) { width:26%; }
  #svc th:nth-child(4) { width:22%; }
  #svc td.name { white-space:normal; }
}
@media(max-width:700px) {
  #svc-subnav { gap:2px; padding:3px; overflow-x:auto; }
  #svc-subnav .page-subnav-btn { padding:7px 5px; font-size:11px; }
  #svc tbody tr { padding:12px; margin-bottom:8px; }
  #svc .td-head { padding:0; gap:6px; flex-wrap:nowrap; }
  #svc .td-head .svc { flex:1; min-width:0; font-size:13.5px; }
  #svc .td-head .badge { flex-shrink:0; font-size:9px; padding:2px 5px; }
  #svc .td-head .svc-act { display:none; }
  #svc .svc-row-meta { margin:6px 0 0 16px; }
  #svc .svc-summary { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px 0 0; }
  #svc .svc-summary-res { flex:1; min-width:0; font-size:11px; }
  #svc .svc-summary-detail { display:flex; align-items:center; gap:8px; margin-left:auto; }
  #svc .svc-summary-detail .svc-detail { padding:5px 3px; }
  #svc .svc-summary-detail .ctl-btn, #svc .svc-summary-detail .svctl-btn { padding:5px 8px; min-height:30px; }
}
@media(max-width:700px) {
  #svc tbody td:first-child, #svc tbody td:last-child { border:0; border-radius:0; }
}
#logpage { padding:var(--page-pad-x); }
.syslog-list { display:flex; flex-direction:column; }
.syslog-row { padding:11px 0; border-bottom:1px solid var(--border); min-width:0; }
.syslog-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; color:var(--text-dim); font-size:11px; }
.syslog-meta time { font-variant-numeric:tabular-nums; }
.syslog-priority { padding:2px 7px; border-radius:999px; background:var(--bg-elev); color:var(--text-dim); font-size:10px; }
.syslog-priority.p0,.syslog-priority.p1,.syslog-priority.p2,.syslog-priority.p3 { background:color-mix(in srgb,var(--c-red) 14%,transparent); color:var(--c-red); }
.syslog-priority.p4 { background:color-mix(in srgb,var(--c-warn) 14%,transparent); color:var(--c-warn); }
.syslog-unit { overflow-wrap:anywhere; }
.syslog-row pre { margin:6px 0 0; color:var(--text); font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
#syslog-priority { min-height:32px; padding:5px 10px; font:inherit; }
@media(max-width:700px) { #logpage .page-head-actions { width:100%; justify-content:space-between; } #syslog-priority { flex:1; } }
@media(max-width:700px) {
  #svc .svc-open { width:32px; height:32px; min-height:32px; }
  #svc tbody tr { padding:10px 12px; }
  #svc .svc-summary { padding-top:6px; }
  #svc .svc-summary-detail .ctl-btn, #svc .svc-summary-detail .svctl-btn { min-height:28px; }
}

/* chezmoi Issues: repository state and discussion, without dispatch controls. */
#tmux-panel.ci-mode .ci-toolbar { padding:var(--th-s3,12px) 0; }
#tmux-panel.ci-mode .ci-toolbar .filters { display:flex; flex-wrap:wrap; gap:6px; }
#tmux-panel.ci-mode .ci-toolbar .page-hint { margin:8px 0 0; }
#tmux-panel.ci-mode .ci-row { display:block; width:100%; text-align:left; cursor:pointer; color:inherit; font:inherit; }
#tmux-panel.ci-mode .ci-row .th-title { margin:7px 0; font-size:var(--th-f-body,13.5px); }
#tmux-panel.ci-mode .ci-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-size:var(--th-f-small,11px); color:var(--text-dim); }
#tmux-panel.ci-mode .ci-meta time { margin-left:auto; }
#tmux-panel.ci-mode .ci-status { display:inline-flex; align-items:center; gap:4px; color:var(--c-green); }
#tmux-panel.ci-mode .ci-status.closed { color:var(--c-violet); }
#tmux-panel.ci-mode .ci-row-foot { display:flex; justify-content:space-between; gap:8px; color:var(--text-dim); font-size:11px; }
#tmux-panel.ci-mode .ci-row-foot span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
#tmux-panel.ci-mode .ci-row-foot span:last-child { flex-shrink:0; }
#tmux-panel.ci-mode .ci-label-filter { margin-top:8px; font-size:12px; }
#tmux-panel.ci-mode .ci-label-filter summary { cursor:pointer; padding:4px 0; color:var(--text-dim); }
#tmux-panel.ci-mode .ci-label-filter .filters { margin-top:8px; }
#tmux-panel.ci-mode .ci-tags { display:flex; flex-wrap:wrap; gap:5px; margin:8px 0; }
#tmux-panel.ci-mode .ci-comment { margin:12px 0 20px; padding:12px 0; border-top:1px solid var(--border); }
#tmux-panel.ci-mode .ci-prose { overflow-wrap:anywhere; }
#tmux-panel.ci-mode .ci-line { min-height:1.3em; white-space:pre-wrap; }
#tmux-panel.ci-mode .ci-prose pre { max-width:100%; overflow-x:auto; padding:12px; background:var(--bg-elev); border-radius:8px; white-space:pre; }
#tmux-panel.ci-mode .ci-check { display:flex; align-items:baseline; gap:8px; margin:5px 0; }
#tmux-panel.ci-mode .ci-back { display:none; }
@media(max-width:700px) {
  #tmux-panel.ci-mode .ci-back { display:inline-flex; margin-bottom:12px; }
  #tmux-panel.ci-mode .th-col-list:has(#th-tasks[hidden]), #tmux-panel.ci-mode .th-col-detail:has(#th-detail[hidden]) { display:none; }
  #tmux-panel.ci-mode .ci-row { min-height:80px; }
}
#tmux-panel.ci-mode .th-head { display:block; }
#tmux-panel.ci-mode .th-head h2 { display:block; margin:10px 0; font-size:21px; line-height:1.4; white-space:normal; overflow-wrap:anywhere; }
#tmux-panel.ci-mode .ci-detail-nav { display:flex; gap:8px; margin-top:8px; }
#tmux-panel.ci-mode #ci-body, #tmux-panel.ci-mode #ci-comments { scroll-margin-top:200px; }
#tmux-panel.ci-mode .ci-detail-nav .active { background:var(--bg-elev); color:var(--text-title); }

/* Agent / Magpie uses the same type scale and surfaces as the dashboard. */
:is(#agents-page,#usage-page,#hp-usage) {
  --agent-font-meta:11.5px;
  --agent-font-body:13px;
  --agent-font-title:14px;
  --agent-font-stat:24px;
  font-size:var(--agent-font-body);
  line-height:1.5;
}
:is(#agents-page,#usage-page,#hp-usage) :is(button,input,select) { font-family:inherit; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-tool-btn,.rt-mask,.agent-subnav-btn,.mp-period-filters .chip) { font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-card-header h4,.mp-section-header h3,.mp-pv-name,.mp-prov-name,.mp-item-name,.mp-account-name) { font-size:var(--agent-font-title); font-weight:650; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-kpi-lbl,.mp-kpi-sub,.mp-pv-sub,.mp-pv-status-pill,.mp-chart-sub,.mp-account-meta,.mp-item-stats,.mp-item-header,.mp-fresh-time) { font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-kpi-val) { font-size:var(--agent-font-stat); line-height:1.25; font-weight:700; font-variant-numeric:tabular-nums; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-chart-card,.mp-column-card,.mp-account-card,.mp-prov-card,.mp-pv-card-panel,.mp-kpi-card) { border-radius:var(--card-radius); border-color:var(--border); background:var(--bg-panel); }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-card-header,.mp-section-header) { margin-bottom:12px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-period-bar { gap:12px; margin-bottom:16px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-pv-row { padding:12px 14px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-pv-icon-wrap { width:36px; height:36px; border-radius:10px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-view,:is(#agents-page,#usage-page,#hp-usage) .mp-routing-config { min-width:0; }
:is(#agents-page,#usage-page,#hp-usage) .mp-observer-note { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; font-size:var(--agent-font-meta); color:var(--text-dim); margin:8px 0 16px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-route-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-stat { display:flex; flex-direction:column; gap:4px; padding:14px; border:1px solid var(--border); border-radius:var(--card-radius); background:var(--bg-panel); }
:is(#agents-page,#usage-page,#hp-usage) .mp-stat strong { font-size:var(--agent-font-stat); font-weight:700; line-height:1.25; font-variant-numeric:tabular-nums; }
:is(#agents-page,#usage-page,#hp-usage) .mp-stat>span { color:var(--text-dim); font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) .mp-route-columns { display:grid; grid-template-columns:minmax(240px,1fr) minmax(0,2fr); gap:16px; align-items:start; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-route-list,.mp-route-detail) { min-width:0; padding:14px; border:1px solid var(--border); border-radius:var(--card-radius); background:var(--bg-panel); }
:is(#agents-page,#usage-page,#hp-usage) .mp-section-title { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-section-title h3,.mp-request-head h3,.mp-config-grid h3) { margin:0; font-size:var(--agent-font-title); font-weight:650; }
:is(#agents-page,#usage-page,#hp-usage) .mp-section-title .filters { display:flex; gap:5px; margin:0; }
:is(#agents-page,#usage-page,#hp-usage) .mp-section-title .chip { font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) .mp-route-rows { max-height:600px; overflow-y:auto; overscroll-behavior:contain; }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-row { display:block; width:100%; min-width:0; border:0; border-bottom:1px solid var(--border); border-radius:8px; padding:10px; text-align:left; color:var(--text-title); background:transparent; font:inherit; cursor:pointer; }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-row:hover,:is(#agents-page,#usage-page,#hp-usage) .mp-request-row.active { background:var(--bg-hover); }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-row b { display:block; margin:6px 0; font-size:var(--agent-font-body); overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-meta { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:var(--agent-font-meta); color:var(--text-dim); }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-head h3 { margin:8px 0; overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-head p { margin:0; font-size:var(--agent-font-meta); color:var(--text-dim); }
:is(#agents-page,#usage-page,#hp-usage) .mp-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:16px 0; padding:12px 0; border-block:1px solid var(--border); }
:is(#agents-page,#usage-page,#hp-usage) .mp-metrics dt { font-size:var(--agent-font-meta); color:var(--text-dim); }
:is(#agents-page,#usage-page,#hp-usage) .mp-metrics dd { margin:5px 0 0; font-size:var(--agent-font-title); font-weight:600; font-variant-numeric:tabular-nums; }
:is(#agents-page,#usage-page,#hp-usage) .mp-detail-section { padding:12px 0; border-bottom:1px solid var(--border); }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-detail-section summary,.mp-config-item summary) { cursor:pointer; font-size:var(--agent-font-body); overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-attempts { padding-left:20px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-attempts li { margin:12px 0; overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-attempts li>div { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; }
:is(#agents-page,#usage-page,#hp-usage) .mp-attempts :is(small,span) { font-size:var(--agent-font-meta); color:var(--text-dim); }
:is(#agents-page,#usage-page,#hp-usage) .mp-context-parts { margin:12px 0; padding:0; list-style:none; }
:is(#agents-page,#usage-page,#hp-usage) .mp-context-parts li { display:flex; justify-content:space-between; gap:12px; margin:8px 0; overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:20px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-item { margin-top:8px; padding:12px 14px; border:1px solid var(--border); border-radius:var(--card-radius); background:var(--bg-panel); }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-item summary span { margin-left:10px; color:var(--text-dim); font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-body { margin-top:12px; overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-body ul { padding-left:18px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-config-body li { margin:6px 0; }
@media(max-width:700px) {
  :is(#agents-page,#usage-page,#hp-usage) .mp-route-columns,:is(#agents-page,#usage-page,#hp-usage) .mp-config-grid { grid-template-columns:minmax(0,1fr); }
  :is(#agents-page,#usage-page,#hp-usage) .mp-route-rows { max-height:240px; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-route-stats { gap:8px; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-stat { padding:12px; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-route-stats strong { font-size:22px; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-metrics { gap:12px 8px; }
}
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-section-header h4) { font-size:var(--agent-font-title); font-weight:650; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-period-fresh,.mp-account-badge,.mp-account-meta) { font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-item-stats) { font-family:inherit; font-variant-numeric:tabular-nums; }
:is(#agents-page,#usage-page,#hp-usage) :is(.mp-chart-card,.mp-column-card,.mp-account-card) { padding:14px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-grid-columns { gap:12px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-request-head { display:block; position:static; padding:0; background:transparent; border:0; box-shadow:none; }
:is(#agents-page,#usage-page,#hp-usage) .mp-loading { grid-column:1/-1; }
:is(#agents-page,#usage-page,#hp-usage) { --agent-mono-filter:none; }
:root[data-theme="light"] :is(#agents-page,#usage-page,#hp-usage) { --agent-mono-filter:invert(.8); }
@media(prefers-color-scheme:light) {
  :root:not([data-theme="dark"]) :is(#agents-page,#usage-page,#hp-usage) { --agent-mono-filter:invert(.8); }
}
:is(#agents-page,#usage-page,#hp-usage) img:is([src$="/anthropic.svg"],[src$="/cline.svg"],[src$="/commandcode.svg"],[src$="/cursor.svg"],[src$="/devin.svg"],[src$="/fx.svg"],[src$="/githubcopilot.svg"],[src$="/goose.svg"],[src$="/groq.svg"],[src$="/hermes.svg"],[src$="/kimi.svg"],[src$="/lmstudio.svg"],[src$="/mimocode.svg"],[src$="/moonshot.svg"],[src$="/ollama.svg"],[src$="/omp.svg"],[src$="/openai.svg"],[src$="/opencode.svg"],[src$="/openrouter.svg"],[src$="/pi.svg"],[src$="/qoder.svg"],[src$="/vercel.svg"],[src$="/xai.svg"],[src$="/zai.svg"]) { filter:var(--agent-mono-filter); }

/* Restore the source → Magpie → account routing graph, without configuration actions. */
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph { margin:0 0 16px; padding:14px; border:1px solid var(--border); border-radius:var(--card-radius); background:var(--bg-panel); min-width:0; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-top { margin:0 0 14px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-what { font-size:var(--agent-font-title); }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-mode { font-size:var(--agent-font-meta); color:var(--text-dim); line-height:1.6; }
:is(#agents-page,#usage-page,#hp-usage) .mp-graph-scroll { overflow:auto; max-height:620px; overscroll-behavior:contain; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-stage { display:grid; grid-template-columns:130px 150px minmax(420px,1fr); gap:36px; min-width:780px; padding:12px 4px; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-srcs { align-self:center; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-node { border-radius:var(--card-radius); }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-node b { font-size:var(--agent-font-title); }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-node small { font-size:var(--agent-font-meta); overflow-wrap:anywhere; }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts li { font-size:var(--agent-font-body); }
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts :is(em,small,code) { font-size:var(--agent-font-meta); }
:is(#agents-page,#usage-page,#hp-usage) .mp-policy-label { display:inline-block; padding:3px 10px; border-radius:999px; background:var(--bg-elev); font-size:var(--agent-font-meta); }
@media(max-width:700px) {
  :is(#agents-page,#usage-page,#hp-usage) .mp-graph-scroll { max-height:480px; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-wires { display:block; }
}
:is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts li { cursor:default; }
@media(max-width:768px) {
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-srcs { display:grid !important; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-hub { display:flex !important; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-wires { display:block !important; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts { grid-column:3; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts li { grid-template-columns:8px minmax(0,1fr) auto; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts em { grid-column:3; white-space:nowrap; }
  :is(#agents-page,#usage-page,#hp-usage) .mp-routing-graph .rt-accts .bar { grid-column:2 / -1; }
}

#activity-tasks > #tmux-panel { border:0; padding:0; background:transparent; box-shadow:none; }
.magpie-native-view { display:block; min-width:0; min-height:240px; color:var(--text-title); }
#agent-view-routing,#agent-view-magpie-usage { min-width:0; }

#usage-page { min-width:0; }
#hp-usage .mp-kpis { margin:0; }
#hp-usage .page-head,#hp-github .page-head { margin-bottom:12px; }
#hp-usage .mp-kpi-card { min-width:0; }
@media(max-width:700px){#hp-usage .mp-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}#hp-usage .mp-kpi-card:last-child{grid-column:1/-1;}}

#hp-github-chart { min-width:0; }
.gh-summary { font-size:13px; margin-bottom:12px; color:var(--text-title); }
.gh-scroll { overflow-x:auto; padding-bottom:8px; }
.gh-calendar { min-width:640px; }
.gh-months,.gh-weeks { display:grid; grid-template-columns:repeat(var(--gh-weeks),minmax(0,1fr)); gap:3px; }
.gh-months { margin-bottom:5px; height:18px; font-size:10.5px; color:var(--text-dim); }
.gh-months span { white-space:nowrap; }
.gh-week { display:grid; grid-template-rows:repeat(7,1fr); gap:3px; }
.gh-day { display:block; aspect-ratio:1; border-radius:2px; background:var(--bg-hover); }
.gh-gap { visibility:hidden; }
.gh-level-1 { background:#0e4429; }.gh-level-2 { background:#006d32; }.gh-level-3 { background:#26a641; }.gh-level-4 { background:#39d353; }
:root[data-theme="light"] .gh-level-1 { background:#9be9a8; }:root[data-theme="light"] .gh-level-2 { background:#40c463; }:root[data-theme="light"] .gh-level-3 { background:#30a14e; }:root[data-theme="light"] .gh-level-4 { background:#216e39; }
.gh-foot { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; font-size:10.5px; color:var(--text-dim); margin-top:8px; }
.gh-legend { display:flex; align-items:center; gap:4px; }.gh-legend .gh-day { width:11px; }

/* GitHub 贡献日历：按周从左向右点亮；只动 transform/opacity，尊重减少动态效果。 */
.gh-calendar .gh-day { transform-origin:center; }
.gh-calendar:not(.gh-ready) .gh-day:not(.gh-gap) { opacity:0; transform:scale(.55); }
.gh-calendar.gh-ready .gh-day:not(.gh-gap) {
  animation:gh-cell-in .42s cubic-bezier(.22,.8,.3,1) both;
  animation-delay:var(--gh-delay, 0ms);
}
.gh-calendar.gh-ready .gh-day.gh-level-3,
.gh-calendar.gh-ready .gh-day.gh-level-4 { animation-name:gh-cell-bloom; }
.gh-calendar.gh-static .gh-day:not(.gh-gap) { animation:none; opacity:1; transform:none; }
/* 收尾后：年度贡献前 10 天 + 最近 7 个活跃日轻微呼吸。 */
.gh-day { position:relative; }
.gh-day.gh-hot::after,
.gh-day.gh-recent::after {
  content:"";
  position:absolute;
  inset:-3px;
  border-radius:4px;
  pointer-events:none;
  opacity:0;
  animation:gh-day-glow 4.8s ease-in-out infinite;
  animation-delay:var(--pulse-delay, 2s);
}
.gh-day.gh-recent::after { animation-duration:6.4s; }
@keyframes gh-day-glow {
  0%, 100% { opacity:0; background:transparent; box-shadow:none; }
  42%, 58% {
    opacity:1;
    background:color-mix(in srgb, var(--c-green) 16%, transparent);
    box-shadow:0 0 0 1.5px color-mix(in srgb, var(--c-green) 80%, transparent),
               0 0 11px 2px color-mix(in srgb, var(--c-green) 55%, transparent);
  }
}
@keyframes gh-cell-in {
  from { opacity:0; transform:scale(.55); }
  to { opacity:1; transform:none; }
}
@keyframes gh-cell-bloom {
  0% { opacity:0; transform:scale(.5); }
  58% { opacity:1; transform:scale(1.22); }
  100% { opacity:1; transform:none; }
}
@media(prefers-reduced-motion:reduce) {
  .gh-calendar:not(.gh-ready) .gh-day:not(.gh-gap) { opacity:1; transform:none; }
  .gh-calendar.gh-ready .gh-day:not(.gh-gap) { animation:none; opacity:1; transform:none; }
  .gh-day.gh-hot::after, .gh-day.gh-recent::after { animation:none; opacity:0; }
}

#hp-usage .mp-kpi-card { border:0; background:transparent; box-shadow:none; border-radius:0; }

/* 视觉收口：沿用 svc token；Magpie ShadowRoot 内部对应覆盖见 magpie-view.js。
   只调整表面、控件和文字，不改变布局、图表系列色或状态含义。 */
:is(.btn-agent-top,.mp-tool-btn,.mp-portal-link) {
  border-color:var(--border);
  border-radius:8px;
  background:var(--bg-elev);
  color:var(--text-soft);
  font-weight:500;
  box-shadow:none;
}
:is(.btn-agent-top,.mp-tool-btn,.mp-portal-link):hover {
  border-color:var(--btn-soft-hover-bd);
  background:var(--bg-hover);
  color:var(--text-title);
}
.btn-magpie-portal,.mp-portal-link { color:var(--link-blue); }
.mp-tool-btn.active {
  border-color:var(--border);
  background:var(--bg-active);
  color:var(--text-title);
}
:is(.btn-agent-top,.mp-tool-btn,.mp-portal-link):focus-visible {
  outline:2px solid var(--focus);
  outline-offset:2px;
}

/* 新增 PR / 系统日志工具行与页面外壳共用同一控件尺度。 */
.pr-tools { gap:8px; margin:0 0 var(--page-gap); }
.pr-tools :is(input,select),#syslog-priority {
  height:var(--ctl-h);
  min-height:var(--ctl-h);
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--bg-input);
  color:var(--text);
  font:inherit;
  font-size:12px;
}
.pr-tools :is(input,select):focus-visible,#syslog-priority:focus-visible {
  outline:2px solid var(--focus);
  outline-offset:2px;
}
.pr-group { margin-top:var(--page-gap); }
.pr-group h3 { color:var(--text-title); font-size:13px; font-weight:600; }
.pr-card { padding:var(--card-pad-y) var(--card-pad-x); }
.pr-title { line-height:1.5; }
.pr-title:hover { color:var(--link-blue); }
.pr-meta,.pr-signals,.syslog-meta,.gh-foot { font-size:11.5px; line-height:1.5; }
.syslog-row { border-bottom-color:var(--border-soft); }
.syslog-priority { background:var(--chip-bg); }

/* 首页五项用量仍为无内框统计，避免再次套卡片。 */
#hp-usage .mp-kpi-card { padding:8px 0; }
#hp-usage .mp-kpi-lbl { color:var(--text-dim); }
#hp-usage .mp-kpi-val { color:var(--text-title); }
@media(max-width:700px) {
  .pr-card { margin-bottom:var(--card-pad-y); }
}

/* ================= svc 控件层：无系统原生外观 ================= */
:root {
  --ctl-h: 32px;
  --ctl-radius: 9px;
  --ctl-bg: color-mix(in srgb, var(--bg-elev) 88%, var(--text-title) 2%);
  --ctl-bg-hover: color-mix(in srgb, var(--bg-elev) 76%, var(--bg) 24%);
  --ctl-border: color-mix(in srgb, var(--btn-soft-border) 82%, transparent);
  --ctl-border-hi: color-mix(in srgb, var(--focus) 50%, var(--ctl-border));
  --ctl-fg: var(--text-soft);
  --ctl-fg-hi: var(--text-title);
  --ctl-thumb: color-mix(in srgb, var(--text-dim) 42%, transparent);
  --ctl-ring: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
  --ctl-menu-bg: color-mix(in srgb, var(--bg-elev) 93%, var(--bg) 7%);
  --ctl-menu-shadow: 0 18px 46px color-mix(in srgb, #000 30%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
}

/* 全局滚动条：透明轨道 + 细圆滑块，去掉系统箭头与凹槽 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ctl-thumb);
  border: 2px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ctl-border-hi); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
@supports (-moz-appearance:none) {
  html { scrollbar-width: thin; scrollbar-color: var(--ctl-thumb) transparent; }
}

/* 输入框 / 文本域：统一表面、边框、焦点环；不保留原生搜索清除钮和数字微调器 */
main :is(input[type="search"],input[type="text"],input[type="password"],input[type="number"],textarea) {
  appearance: none;
  -webkit-appearance: none;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  padding: 0 11px;
  border: 1px solid var(--ctl-border);
  border-radius: var(--ctl-radius);
  background: var(--ctl-bg);
  color: var(--ctl-fg-hi);
  font: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
main :is(input[type="search"],input[type="text"],input[type="password"],input[type="number"],textarea):hover { border-color: var(--ctl-border-hi); }
main :is(input[type="search"],input[type="text"],input[type="password"],input[type="number"],textarea):focus-visible {
  outline: none;
  border-color: var(--ctl-border-hi);
  box-shadow: var(--ctl-ring);
}
main :is(input[type="search"],input[type="text"],input[type="password"],input[type="number"],textarea)::placeholder {
  color: var(--text-ghost);
}
main input[type="search"] {
  padding-left: 31px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none' stroke='%238a8a8a' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.4'/%3E%3Cpath d='m10.4 10.4 3.3 3.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
main input[type="search"]::-webkit-search-cancel-button,
main input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
main input[type="number"]::-webkit-outer-spin-button,
main input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
main textarea {
  height: auto;
  min-height: 68px;
  padding: 8px 11px;
  line-height: 1.55;
  resize: none;
}
#tmux-term-input {
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: color-mix(in srgb, var(--bg-deep) 82%, #000 18%);
  color: var(--text-hi);
}

/* 复选框 / 单选框：自绘，保留键盘焦点环 */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  vertical-align: -4px;
  border: 1px solid var(--ctl-border);
  border-radius: 5px;
  background: var(--ctl-bg);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
input[type="checkbox"]:hover { border-color: var(--ctl-border-hi); }
input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent); }
input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 2px 0 0 5px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ctl-ring); }
input[type="checkbox"]:disabled { opacity: .5; cursor: default; }
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  vertical-align: -4px;
  border: 1px solid var(--ctl-border);
  border-radius: 50%;
  background: var(--ctl-bg);
  cursor: pointer;
}
input[type="radio"]:checked { border-color: var(--accent); }
input[type="radio"]:checked::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px;
  border-radius: 50%;
  background: var(--accent);
}
input[type="radio"]:focus-visible { outline: none; box-shadow: var(--ctl-ring); }

/* 服务搜索框：覆盖旧规则的 36px 高度，并恢复自绘放大镜 */
#svc-search {
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  padding: 0 11px 0 31px;
  border-color: var(--ctl-border);
  border-radius: var(--ctl-radius);
  background: var(--ctl-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none' stroke='%238a8a8a' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.4'/%3E%3Cpath d='m10.4 10.4 3.3 3.3'/%3E%3C/svg%3E") no-repeat 10px center;
  color: var(--ctl-fg-hi);
  font-size: 12.5px;
}
#svc-search:focus, #svc-search:focus-visible {
  outline: none;
  border-color: var(--ctl-border-hi);
  box-shadow: var(--ctl-ring);
}
/* 自绘下拉：原生 select 只作数据源，永远不显示系统弹层 */
.svc-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
}
.svc-select {
  position: relative;
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.svc-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  padding: 0 9px 0 12px;
  border: 1px solid var(--ctl-border);
  border-radius: var(--ctl-radius);
  background: var(--ctl-bg);
  color: var(--ctl-fg);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent);
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.svc-select-trigger:hover { border-color: var(--ctl-border-hi); background: var(--ctl-bg-hover); color: var(--ctl-fg-hi); }
.svc-select-trigger:focus-visible,
.svc-select.is-open .svc-select-trigger {
  outline: none;
  border-color: var(--ctl-border-hi);
  color: var(--ctl-fg-hi);
  box-shadow: var(--ctl-ring);
}
.svc-select-trigger:disabled { opacity: .5; cursor: default; }
.svc-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.svc-select-chevron {
  display: inline-flex;
  flex: none;
  color: var(--text-dim);
  transition: transform .18s ease, color .18s ease;
}
.svc-select.is-open .svc-select-chevron { color: var(--accent); transform: rotate(180deg); }
.svc-select-compact { min-width: 0; }
.svc-select-compact .svc-select-trigger {
  height: 24px;
  min-height: 24px;
  padding: 0 7px 0 9px;
  border-radius: 7px;
  font-size: 11px;
}
/* PR 仓库筛选保持紧凑，搜索框占据剩余宽度 */
.pr-tools .svc-select { flex: 0 1 220px; }
.svc-select-btn { min-width: 136px; }
.page-head-actions .svc-select { flex: 0 1 auto; }

.svc-select-menu {
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  min-width: 160px;
  max-height: min(280px, 60vh);
  padding: 5px;
  overflow: auto;
  border: 1px solid var(--ctl-border);
  border-radius: 12px;
  background: var(--ctl-menu-bg);
  color: var(--text);
  box-shadow: var(--ctl-menu-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  animation: svc-menu-in .14s ease-out;
}
.svc-select-menu[hidden] { display: none !important; }
@keyframes svc-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
.svc-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
}
.svc-option:hover,
.svc-option.is-active { background: var(--bg-hover); color: var(--text-title); }
.svc-option.is-selected { color: var(--text-title); font-weight: 600; }
.svc-option.is-disabled { opacity: .45; cursor: default; }
.svc-option-check {
  display: inline-flex;
  flex: none;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.svc-option-check.is-empty { visibility: hidden; }
.svc-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 按钮统一几何与焦点；颜色/语义变体仍由各自类控制 */
:is(.btn,.ui-action,.btn-ts-action,.btn-agent-top,.btn-tmux-sheet-act,.svctl-btn,.ctl-btn,.mbtn,.aglog-refresh) {
  border-radius: var(--ctl-radius);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s;
}
.btn { min-height: var(--ctl-h); height: var(--ctl-h); padding: 0 13px; border-radius: var(--ctl-radius); }
:is(.btn,.ui-action,.btn-ts-action,.btn-agent-top,.btn-tmux-sheet-act,.svctl-btn,.ctl-btn,.mbtn,.aglog-refresh):focus-visible {
  outline: none;
  box-shadow: var(--ctl-ring);
}
@media (max-width: 700px) {
  .pr-tools .svc-select { flex: 1 1 100%; }
}
@media (max-width: 700px) {
  #logpage .page-head-actions .svc-select { flex: 1 1 auto; }
}
/* 折叠标题也使用自绘指示符，不显示浏览器默认三角 */
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
:is(.mp-config-item,.mp-detail-section,.ci-label-filter) summary { position: relative; padding-left: 14px; }
:is(.mp-config-item,.mp-detail-section,.ci-label-filter) summary::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: translateY(-65%) rotate(-45deg);
  transition: transform .15s ease, border-color .15s ease;
}
:is(.mp-config-item,.mp-detail-section,.ci-label-filter)[open] > summary::before {
  border-color: var(--accent);
  transform: translateY(-50%) rotate(45deg);
}
@media (prefers-reduced-motion: reduce) {
  .svc-select-menu { animation: none; }
  .svc-select-trigger, .svc-select-chevron, :is(.btn,.ui-action,.btn-ts-action,.btn-agent-top,.btn-tmux-sheet-act,.svctl-btn,.ctl-btn,.mbtn,.aglog-refresh) { transition: none; }
}

/* ==================== WORKOUT.LOG Personal Workspace Styling ==================== */

/* 1. 宽屏桌面居中个人工作台架构 (WORKOUT.LOG 风格定宽居中) */
@media (min-width: 1025px) {
  header {
    max-width: 1540px;
    margin: 0 auto;
    width: 100%;
    padding: 18px 32px 12px;
  }
  main {
    max-width: 1540px;
    margin: 0 auto;
    width: 100%;
    padding: 0 32px 48px;
  }
}

/* 2. 顶栏 Login 胶囊按钮 (WORKOUT.LOG 风格) */
.h-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
  font: 650 12.5px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
  transition: all .15s ease;
  flex: none;
}
.h-login-btn:hover {
  background: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.55);
  transform: translateY(-1px);
}
.h-login-btn:active {
  transform: scale(0.96);
}
.h-login-btn.is-logged {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}
.h-login-ico {
  flex: none;
}
@media (max-width: 640px) {
  .h-login-btn span { display: none; }
  .h-login-btn { padding: 8px; border-radius: 50%; }
}

/* 3. 系统规格条: WORKOUT.LOG 风格 KPI 指标卡片 */
.sysbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: var(--gap-panel);
}
@media (max-width: 1024px) {
  .sysbar {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
  }
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.stat:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.stat .label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .lb-ico {
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
}
.stat .value {
  font-size: 17px;
  font-weight: 750;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.stat .value.bad { color: var(--c-red); }
.stat .value.warn { color: var(--c-warn); }
.stat::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.6;
}
.stat[data-k="load"]::after { background: linear-gradient(90deg, #10b981, #06b6d4); }
.stat[data-k="cpu"]::after { background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.stat[data-k="mem"]::after { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.stat[data-k="disk"]::after { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.stat[data-k="up"]::after { background: linear-gradient(90deg, #64748b, #94a3b8); }

/* 4. 今日用量 KPI: WORKOUT.LOG 风格大字指标卡 */
#hp-usage {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
#hp-usage .page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
#hp-usage .page-head h2 {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-title);
  margin: 0;
}
.agent-kpi-grid.mp-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1024px) {
  .agent-kpi-grid.mp-kpis {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}
.mp-kpi-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.mp-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.mp-kpi-card .mp-kpi-val {
  font-size: 24px;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-kpi-card .agent-kpi-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.mp-kpi-card .mp-kpi-sub {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 5. GitHub 贡献日历: WORKOUT.LOG 热力图质感 */
#hp-github {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
#hp-github .page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
#hp-github .page-head h2 {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-title);
  margin: 0;
}
.gh-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.gh-scroll {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-faint);
}
.gh-day {
  border-radius: 3.5px !important;
  transition: transform .12s ease, filter .12s ease;
}
.gh-day:hover {
  transform: scale(1.3);
  z-index: 5;
  filter: brightness(1.2);
}
.gh-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-faint);
}
.gh-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 6. 趋势采样图: WORKOUT.LOG 仪表盘图表质感 */
#chart-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
#chart-wrap h2 {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-title);
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
#chart-wrap h2 .ghint {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-faint);
}
#chart-wrap canvas {
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

/* 7. 首页四大中枢卡片: WORKOUT.LOG 风格 */
.hp-portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 860px) {
  .hp-portal-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.hp-portal-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: border-color .15s ease, transform .15s ease;
}
.hp-portal-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.hp-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.hp-portal-title h3 {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-title);
}
.hp-portal-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}
.hp-portal-jump {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--link-blue);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: opacity .15s;
}
.hp-portal-jump:hover {
  opacity: .8;
}

/* === WORKBENCH 7:3 WORKSTATION LAYOUT (WORKOUT.LOG INSPIRED) === */
.hp-workbench {
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 1025px) {
  .hp-workbench {
    display: grid;
    grid-template-columns: minmax(0, 7.2fr) minmax(320px, 2.8fr);
    gap: 16px;
    align-items: start;
    max-width: 1540px;
  }
}

@media (max-width: 1024px) {
  .hp-workbench {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
}

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

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

/* GitHub Heatmap - WORKOUT.LOG Dot Matrix & Year Pills */
.hp-gh-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hp-gh-years {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hp-gh-year-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}

.hp-gh-year-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-title);
}

.hp-gh-year-pill.active {
  background: #8b5cf6;
  color: #fff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.45);
}

/* Dot style */
.gh-day {
  border-radius: 50% !important;
  width: 10px !important;
  height: 10px !important;
  margin: 1.5px !important;
  transition: transform .12s ease, filter .12s ease;
}

.gh-day:hover {
  transform: scale(1.4) !important;
  z-index: 2;
  filter: brightness(1.2);
}

.gh-day.gh-level-0 {
  background: rgba(255, 255, 255, 0.05) !important;
}

.gh-day.gh-level-1 {
  background: #10b981 !important;
}

.gh-day.gh-level-2 {
  background: #22c55e !important;
}

.gh-day.gh-level-3 {
  background: #38bdf8 !important;
}

.gh-day.gh-level-4 {
  background: #a855f7 !important;
}

.gh-day.gh-hot {
  box-shadow: 0 0 8px #f59e0b !important;
}

.gh-day.gh-recent {
  box-shadow: 0 0 8px #06b6d4 !important;
}

/* Right Sidebar: Server Summary Card */
.hp-side-card {
  margin: 0 !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--card-radius) !important;
  padding: 14px 16px !important;
  box-shadow: var(--shadow-sm) !important;
}

.hp-side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.hp-server-total-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hp-server-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.hp-server-total-val {
  font-size: 18px;
  font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-title);
  letter-spacing: -0.3px;
}

.hp-server-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.hp-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: hpPulseGlow 2s infinite ease-in-out;
}

@keyframes hpPulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(0.85); }
}

.hp-server-sub-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border-faint);
  padding-top: 10px;
}

.hp-server-sub-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.hp-server-sub-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
  font-family: ui-monospace, Menlo, monospace;
}

.hp-server-sub-lbl {
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sysbar inside Right Sidebar */
.hp-side-col .sysbar {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin: 0 !important;
}

.hp-side-col .sysbar .stat {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 14px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 10px !important;
}

.hp-side-col .sysbar .stat .label {
  font-size: 11.5px !important;
  color: var(--text-dim) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.hp-side-col .sysbar .stat .value {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  font-family: ui-monospace, Menlo, monospace !important;
  color: var(--text-title) !important;
}

/* Monthly Calendar Widget */
.hp-month-cal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hp-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.hp-cal-title {
  font-size: 13.5px;
  color: var(--text-title);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hp-cal-title strong {
  font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
}

.hp-cal-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.hp-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.hp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.hp-cal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-soft);
  position: relative;
  cursor: default;
  transition: background .12s ease;
  user-select: none;
}

.hp-cal-cell:hover:not(.empty) {
  background: rgba(255, 255, 255, 0.06);
}

.hp-cal-cell.today {
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
  font-weight: 700;
  border: 1px solid rgba(139, 92, 246, 0.45);
}

.hp-cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin-top: 1px;
}

.hp-cal-cell.active .hp-cal-dot {
  background: #f97316;
  box-shadow: 0 0 5px #f97316;
}

.hp-cal-cell.today .hp-cal-dot {
  background: #38bdf8;
  box-shadow: 0 0 5px #38bdf8;
}

/* Two VM Cards: WORKOUT.LOG card aesthetic polish */
.hp-vms-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  margin-top: 0 !important;
}

@media (max-width: 860px) {
  .hp-vms-grid {
    grid-template-columns: 1fr !important;
  }
}

.hp-vm-card {
  border-radius: var(--card-radius) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: all .15s ease !important;
}

.hp-vm-card:hover {
  border-color: rgba(139, 92, 246, 0.35) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
}

.hp-vm-name {
  font-weight: 700 !important;
  letter-spacing: -0.2px !important;
}

.hp-vm-status-badge.running {
  background: rgba(34, 197, 94, 0.12) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
}

.hp-vm-bar-track {
  height: 5px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.hp-vm-bar-fill {
  border-radius: 999px !important;
}

.hp-vm-bar-fill.cpu {
  background: linear-gradient(90deg, #38bdf8, #818cf8) !important;
}

.hp-vm-bar-fill.mem {
  background: linear-gradient(90deg, #34d399, #10b981) !important;
}

.hp-vm-link {
  border-radius: 999px !important;
  background: rgba(56, 189, 248, 0.1) !important;
  color: #38bdf8 !important;
  padding: 3px 10px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
}

.hp-vm-link:hover {
  background: rgba(56, 189, 248, 0.22) !important;
}

/* === UNIFIED UI SPECIFICATION & BOX-NESTING ELIMINATION (所有标签页统一规范) === */

/* 1. 统一所有标签页外层卡片 (Unified Page Outer Shell) */
.app-page,
#activity-page,
#tmux-panel,
#agents-page,
#usage-page,
#svc-page {
  max-width: 1540px !important;
  margin: 0 auto 24px !important;
  width: 100% !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--card-radius) !important;
  padding: 22px 24px !important;
  box-shadow: var(--shadow-sm) !important;
  box-sizing: border-box !important;
}

@media (max-width: 860px) {
  .app-page,
  #activity-page,
  #tmux-panel,
  #agents-page,
  #usage-page,
  #svc-page {
    padding: 14px 14px !important;
    border-radius: 12px !important;
  }
}

/* 2. 统一页头 (Unified Page Head) */
.page-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 16px !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

.page-head h2 {
  font-size: 17px !important;
  font-weight: 700 !important;
  letter-spacing: -0.3px !important;
  color: var(--text-title) !important;
  margin: 0 !important;
}

.page-hint {
  font-size: 11.5px !important;
  color: var(--text-dim) !important;
  display: block !important;
  margin-top: 3px !important;
}

/* 3. 统一分段子标签 (Unified Page Subnav Pills) */
.page-subnav {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  margin-bottom: 16px !important;
  width: fit-content !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
}
.page-subnav::-webkit-scrollbar { display: none; }

.page-subnav-btn,
.page-subnav button {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--text-dim) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 7px !important;
  padding: 6px 14px !important;
  cursor: pointer !important;
  transition: all .15s ease !important;
  white-space: nowrap !important;
}

.page-subnav-btn:hover,
.page-subnav button:hover {
  color: var(--text-title) !important;
}

.page-subnav-btn.active,
.page-subnav button.active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
}

/* 4. 去除大框套小框 (Eliminate Nested Boxes inside Pages) */
#svc-page .svc-panel,
#svc-page #network-page,
#svc-page #logpage,
#activity-page .gpanel,
#agents-page .gpanel,
#usage-page .gpanel {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* 服务表格与任务表格：现代扁平数据表格 (Flat Clean Table) */
#svc-panel table,
#cron-panel table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: none !important;
  margin-top: 6px !important;
}

#svc-panel th,
#cron-panel th {
  padding: 10px 14px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--text-dim) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
  text-align: left !important;
}

#svc-panel td,
#cron-panel td {
  padding: 12px 14px !important;
  font-size: 13px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: var(--text-title) !important;
  transition: background .12s ease !important;
}

#svc-panel tr:hover td,
#cron-panel tr:hover td {
  background: rgba(255, 255, 255, 0.025) !important;
}

/* 扁平化活动列表 (Flat Activity Feed Stream) */
#activity-body .act-card {
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 14px 6px !important;
  transition: background .12s ease !important;
}

#activity-body .act-card:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

/* 服务工具栏与过滤行扁平化 */
.svc-toolbar {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
  padding-bottom: 14px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: transparent !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}

/* 扁平化 Chips 过滤胶囊 */
.filters .chip,
.svc-types .chip,
.act-filters .chip {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  padding: 3px 11px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.035) !important;
  color: var(--text-dim) !important;
  cursor: pointer !important;
  transition: all .15s ease !important;
}

.filters .chip:hover,
.svc-types .chip:hover,
.act-filters .chip:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-title) !important;
}

.filters .chip.active,
.svc-types .chip.active,
.act-filters .chip.active {
  background: #8b5cf6 !important;
  color: #fff !important;
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.35) !important;
}

/* === WORKOUT.LOG ACTIVITY LOG TABLE === */
.hp-activity-log-section {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--card-radius) !important;
  padding: 18px 20px !important;
  box-shadow: var(--shadow-sm) !important;
}

.hp-act-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 14px !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

.hp-act-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.hp-act-count-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: ui-monospace, Menlo, monospace;
}

.hp-act-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hp-act-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s ease;
}

.hp-act-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-title);
}

.hp-act-pill.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.hp-act-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}

.hp-act-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: none;
}

.hp-act-table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  text-align: left;
  white-space: nowrap;
}

.hp-act-table td {
  padding: 11px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-title);
  vertical-align: middle;
  transition: background .12s ease;
}

.hp-act-table-row {
  cursor: pointer;
}

.hp-act-table-row:hover td {
  background: rgba(255, 255, 255, 0.035);
}

.hp-col-date {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px !important;
  color: var(--text-dim) !important;
  white-space: nowrap;
  width: 125px;
}

.hp-col-type {
  width: 100px;
  white-space: nowrap;
}

.hp-act-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hp-act-type-tag.commit {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.hp-act-type-tag.goal {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.hp-act-type-tag.sync {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.hp-col-name {
  width: 140px;
  white-space: nowrap;
}

.hp-act-repo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--rc-bg, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--rc-bd, rgba(255, 255, 255, 0.1));
  color: var(--rc-col, var(--text-title));
  font-weight: 600;
  font-size: 11.5px;
  font-family: ui-monospace, Menlo, monospace;
}

.hp-col-detail {
  min-width: 220px;
  max-width: 380px;
}

.hp-act-detail-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-title);
  font-size: 12.5px;
}

.hp-col-time {
  width: 90px;
  font-size: 11.5px !important;
  color: var(--text-muted) !important;
  white-space: nowrap;
}

.hp-col-status {
  width: 95px;
  white-space: nowrap;
  text-align: right;
}

.hp-act-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}

.hp-act-status-badge.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.hp-act-status-badge.running {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.hp-act-status-badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* ==================== Mikata unified operations UI ====================
   Quiet surfaces, clear hierarchy, restrained amber action. */
:root {
  --gap-panel: 16px;
  --bg: #0b0d12; --bg-elev: #11151c; --bg-panel: #141922; --bg-deep: #090b10;
  --bg-input: #11151c; --bg-hover: #1b222c; --bg-active: #232d39;
  --border: rgba(180,195,210,.14); --border-soft: rgba(180,195,210,.11); --border-faint: rgba(180,195,210,.075);
  --btn-bg: #1b222c; --btn-hover: #252e39; --btn-press: #303b48; --btn-border: rgba(180,195,210,.18);
  --btn-soft-bg: #141922; --btn-soft-border: rgba(180,195,210,.14); --btn-soft-hover-bd: rgba(180,195,210,.3);
  --chip-bg: #141922; --chip-border: rgba(180,195,210,.16); --chip-on-bg: #ff9900; --chip-on-tx: #17120a;
  --text-title: #f2f5f8; --text-hi: #e8edf2; --text: #c8d0d9; --text-mid: #aab5c0;
  --text-soft: #9aa6b2; --text-dim: #9aa6b2; --text-faint: #7d8996; --text-ghost: #687482; --text-dead: #59636f;
  --header-bg: rgba(11,13,18,.96); --tabbar-bg: rgba(17,21,28,.97);
  --accent: #ff9900; --c-orange: #ff9900; --focus: #ffb84d; --link-blue: #7db8e8; --c-blue: #7db8e8;
  --card-radius: 8px;
  --glass-bg: rgba(17,21,28,.96); --glass-bd: rgba(180,195,210,.16); --glass-shadow: 0 8px 24px rgba(0,0,0,.28);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg:#f3f5f7; --bg-elev:#fff; --bg-panel:#fff; --bg-deep:#e9edf1;
    --bg-input:#fff; --bg-hover:#f1f4f6; --bg-active:#e7edf2; --border:#d5dce3; --border-soft:#dfe4e9; --border-faint:#e8ecf0;
    --btn-bg:#eef1f4; --btn-hover:#e3e8ed; --btn-press:#d9e0e7; --btn-border:#d3dbe2; --btn-soft-bg:#fff;
    --btn-soft-border:#d5dce3; --btn-soft-hover-bd:#aeb9c4; --chip-bg:#fff; --chip-border:#d5dce3;
    --chip-on-bg:#ff9900; --chip-on-tx:#17120a; --accent:#b76500; --c-orange:#b76500;
    --text-title:#17212b; --text-hi:#202b36; --text:#34414d; --text-mid:#4d5b68; --text-soft:#566472;
    --text-dim:#566472; --text-faint:#667482; --text-ghost:#7a8793; --text-dead:#87939e;
    --header-bg:rgba(243,245,247,.97); --tabbar-bg:rgba(255,255,255,.97); --glass-bg:rgba(255,255,255,.97);
    --glass-bd:rgba(23,33,43,.12); --glass-shadow:0 8px 24px rgba(20,35,50,.12); --link-blue:#1769aa; --c-blue:#1769aa; }
}
:root[data-theme="light"] { --bg:#f3f5f7; --bg-elev:#fff; --bg-panel:#fff; --bg-deep:#e9edf1; --bg-input:#fff;
  --bg-hover:#f1f4f6; --bg-active:#e7edf2; --border:#d5dce3; --border-soft:#dfe4e9; --border-faint:#e8ecf0;
  --btn-bg:#eef1f4; --btn-hover:#e3e8ed; --btn-press:#d9e0e7; --btn-border:#d3dbe2; --btn-soft-bg:#fff;
  --btn-soft-border:#d5dce3; --btn-soft-hover-bd:#aeb9c4; --chip-bg:#fff; --chip-border:#d5dce3;
  --chip-on-bg:#ff9900; --chip-on-tx:#17120a; --accent:#b76500; --c-orange:#b76500;
  --text-title:#17212b; --text-hi:#202b36; --text:#34414d; --text-mid:#4d5b68; --text-soft:#566472;
  --text-dim:#566472; --text-faint:#667482; --text-ghost:#7a8793; --text-dead:#87939e;
  --header-bg:rgba(243,245,247,.97); --tabbar-bg:rgba(255,255,255,.97); --glass-bg:rgba(255,255,255,.97);
  --glass-bd:rgba(23,33,43,.12); --glass-shadow:0 8px 24px rgba(20,35,50,.12); --link-blue:#1769aa; --c-blue:#1769aa; }
:root[data-theme="dark"] { --bg:#0b0d12; --bg-elev:#11151c; --bg-panel:#141922; --bg-deep:#090b10;
  --bg-input:#11151c; --bg-hover:#1b222c; --bg-active:#232d39; --border:rgba(180,195,210,.14);
  --border-soft:rgba(180,195,210,.11); --border-faint:rgba(180,195,210,.075); --btn-bg:#1b222c;
  --btn-hover:#252e39; --btn-press:#303b48; --btn-border:rgba(180,195,210,.18); --btn-soft-bg:#141922;
  --btn-soft-border:rgba(180,195,210,.14); --btn-soft-hover-bd:rgba(180,195,210,.3); --chip-bg:#141922;
  --chip-border:rgba(180,195,210,.16); --chip-on-bg:#ff9900; --chip-on-tx:#17120a;
  --text-title:#f2f5f8; --text-hi:#e8edf2; --text:#c8d0d9; --text-mid:#aab5c0; --text-soft:#9aa6b2;
  --text-dim:#9aa6b2; --text-faint:#7d8996; --text-ghost:#687482; --text-dead:#59636f;
  --header-bg:rgba(11,13,18,.96); --tabbar-bg:rgba(17,21,28,.97); --accent:#ff9900; --c-orange:#ff9900;
  --focus:#ffb84d; --link-blue:#7db8e8; --c-blue:#7db8e8; --card-radius:8px;
  --glass-bg:rgba(17,21,28,.96); --glass-bd:rgba(180,195,210,.16); --glass-shadow:0 8px 24px rgba(0,0,0,.28); }

/* One surface and geometry language across dashboard pages. */
.gpanel, .gcard, .stat, .hp-vm-card, .hp-side-card, .hp-activity-log-section,
.ts-card, .th-card, .mcard, .agent-card, .mp-card, .usage-card {
  border-radius: var(--card-radius, 8px) !important; box-shadow: none !important;
}
.gpanel, .hp-vm-card, .hp-side-card, .hp-activity-log-section {
  background: var(--bg-elev) !important; border: 1px solid var(--border) !important;
}
.btn, .chip, .page-subnav-btn, .svc-sort button, .hp-act-pill, .hp-gh-year-pill {
  border-radius: 6px;
}
.stat { transition: border-color .15s ease; }
.stat:hover { transform: none; box-shadow: none !important; }
.stat::after { height: 1px; opacity: 1; background: var(--border) !important; }
.hp-side-col .sysbar .stat::after { background: var(--border) !important; }
.hp-workbench, .hp-main-col, .hp-side-col { gap: 16px; }
.hp-side-col .sysbar { display:flex !important; flex-direction:column !important; gap:0 !important; margin:0 !important;
  border:1px solid var(--border); border-radius:8px; overflow:hidden; background:var(--bg-elev); }
.hp-side-col .sysbar .stat { display:flex !important; flex-direction:row !important; align-items:center !important;
  justify-content:space-between !important; gap:12px; padding:10px 12px !important; border:0 !important;
  border-bottom:1px solid var(--border-faint) !important; border-radius:0 !important; background:transparent !important; }
.hp-side-col .sysbar .stat:last-child { border-bottom:0 !important; }
.hp-side-col .sysbar .stat .label { margin:0 !important; font-weight:500 !important; letter-spacing:0 !important; text-transform:none !important; }
.hp-side-col .sysbar .stat .value { font-size:12px !important; }
#catbar .cat { border:0 !important; border-bottom:2px solid transparent !important; border-radius:0 !important;
  background:transparent !important; padding:10px 5px 8px !important; }
#catbar .cat.active { border-bottom-color:var(--accent) !important; color:var(--text-title) !important; background:transparent !important; }
#catbar .cat:hover { color:var(--accent) !important; }
#hp-github .gh-scroll { background:var(--bg-panel); border:1px solid var(--border-faint); border-radius:6px; }
.hp-act-table th { border-bottom-color: var(--border); }
.hp-act-table td { border-bottom-color: var(--border-faint); }
.hp-act-table-row:hover td { background: var(--bg-hover); }
.hp-gh-year-pill, .hp-act-pill { border: 1px solid var(--chip-border); border-radius: 5px; background: var(--chip-bg); color: var(--text-dim); box-shadow: none; }
.hp-gh-year-pill.active, .hp-act-pill.active, .filters .chip.active, .svc-types .chip.active, .act-filters .chip.active {
  background: var(--chip-on-bg) !important; border-color: var(--chip-on-bg) !important; color: var(--chip-on-tx) !important; box-shadow: none !important;
}
.h-login-btn, .h-login-btn.is-logged { background: var(--btn-bg); color: var(--text-hi); border: 1px solid var(--btn-border); border-radius: 6px; box-shadow: none; }
.h-login-btn:hover { background: var(--btn-hover); border-color: var(--btn-soft-hover-bd); box-shadow: none; transform: none; }
.theme-toggle { flex:none; width:38px; height:38px; display:inline-flex; align-items:center; justify-content:center;
  padding:0; border:1px solid var(--btn-border); border-radius:6px; background:var(--btn-bg); color:var(--text-mid);
  cursor:pointer; }
.theme-toggle:hover { color:var(--accent); background:var(--btn-hover); }
.theme-toggle svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.theme-toggle[data-effective="dark"] .theme-icon-moon, .theme-toggle[data-effective="light"] .theme-icon-sun { display:none; }
.hp-act-table-wrap { width:100%; min-width:0; overflow-x:hidden; }
.hp-act-table { width:100%; table-layout:fixed; }
.hp-col-date { width:112px; }
.hp-col-type { width:88px; }
.hp-col-name { width:122px; }
.hp-col-detail { width:auto; min-width:0; max-width:none; }
.hp-col-time { width:76px; }
.hp-col-status { width:86px; }
.hp-act-table th, .hp-act-table td { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.hp-server-ico { background: var(--bg-hover); color: var(--text-mid); border-radius: 6px; }
.hp-server-online-badge { background: transparent; border-color: var(--border); color: var(--c-green); border-radius: 5px; }
.hp-pulse-dot { box-shadow: none; animation: none; }
.hp-day, .gh-day, .gh-day.gh-hot, .gh-day.gh-recent { box-shadow: none !important; }
.gh-day.gh-hot::after, .gh-day.gh-recent::after { animation:none !important; opacity:0 !important; box-shadow:none !important; }
.hp-cal-cell.today { background:color-mix(in srgb, var(--accent) 16%, transparent); color:var(--text-title);
  border:1px solid var(--accent); }
.hp-cal-cell.today .hp-cal-dot { background:var(--accent); box-shadow:none; }
.hp-act-type-tag, .hp-act-status-badge { border-radius: 4px; }
.hp-act-type-tag.goal { background: var(--bg-hover); border-color: var(--border); color: var(--text-mid); }
.hp-act-type-tag.commit { background: var(--c-green-bg); border-color: var(--border-soft); color: var(--c-green); }
.hp-act-type-tag.sync { background: var(--accent-blue-bg); border-color: var(--accent-blue-bd); color: var(--link-blue); }
.hp-act-repo-pill { border-radius: 4px; }
@media (max-width: 700px) {
  .hp-workbench, .hp-main-col, .hp-side-col { gap: 12px; }
  .hp-side-card, .hp-activity-log-section { padding: 12px !important; }
  .hp-act-table th, .hp-act-table td { padding: 9px 8px; }
  .h-login-btn { width:38px !important; min-width:38px !important; max-width:38px !important; height:38px;
    flex:0 0 38px !important; justify-content:center; border-radius:50% !important; padding:0 !important; overflow:hidden; }
  .hp-act-table .hp-col-type, .hp-act-table .hp-col-time, .hp-act-table .hp-col-status { display:none; }
  .hp-col-date { width:78px; }
  .hp-col-name { width:86px; }
  .hp-act-table th, .hp-act-table td { padding:8px 5px; }
  .hp-act-detail-text { min-width:0; }
}

/* Shared page language: consistent surfaces and readable controls and rows. */
:root {
  --bg-card: var(--bg-panel);
  --bg2: var(--bg-hover);
  --fg: var(--text-title);
  --fg-dim: var(--text-dim);
  --border-subtle: var(--border-soft);
}
#activity-page, #agents-page, #usage-page, #svc-page {
  background:var(--bg-elev) !important; border:1px solid var(--border) !important;
  border-radius:var(--card-radius) !important; box-shadow:none !important;
  padding:18px 20px !important;
}
.page-subnav, .agent-subnav {
  background:transparent !important; border:0 !important; border-bottom:1px solid var(--border) !important;
  border-radius:0 !important; padding:0 !important; gap:12px !important; box-shadow:none !important;
}
.page-subnav-btn, .page-subnav button, .agent-subnav-btn {
  background:transparent !important; color:var(--text-dim) !important; border:0 !important;
  border-bottom:2px solid transparent !important; border-radius:0 !important; box-shadow:none !important;
  padding:9px 5px !important;
}
.page-subnav-btn.active, .page-subnav button.active, .agent-subnav-btn.active {
  background:transparent !important; color:var(--text-title) !important;
  border-bottom-color:var(--accent) !important; box-shadow:none !important;
}
.page-subnav-btn:hover, .agent-subnav-btn:hover { color:var(--text-title) !important; }
#agent-view-providers .mp-pv-card-panel {
  background:transparent !important; border:0 !important; border-radius:0 !important; box-shadow:none !important;
}
#agent-view-providers .mp-pv-row { padding:12px 0; border-bottom:1px solid var(--border-soft); }
#agent-view-providers .mp-pv-row:last-child { border-bottom:0; }
#agent-view-providers .mp-pv-row:hover { background:var(--bg-hover); }
header :is(.lang-trigger,.theme-toggle,#refresh,.h-login-btn) {
  height:38px; min-height:38px; border:0; border-radius:0;
  background:transparent; color:var(--text-mid); box-shadow:none; vertical-align:middle;
}
header :is(.theme-toggle,#refresh) { width:38px; min-width:38px; padding:0; }
header :is(.lang-trigger,.h-login-btn) { display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:0 11px; }
header :is(.lang-globe,.theme-toggle svg,#refresh > svg,.h-login-ico) { width:16px; height:16px; flex:none; }
header :is(.lang-trigger,.theme-toggle,#refresh,.h-login-btn):hover,
header .lang-trigger[aria-expanded="true"] { background:transparent; color:var(--text-title); }
header :is(.lang-trigger,.theme-toggle,#refresh,.h-login-btn):focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.filters .chip, .svc-types .chip, .act-filters .chip {
  border-radius:5px !important; border-color:var(--chip-border) !important; background:transparent !important;
  color:var(--text-dim) !important; box-shadow:none !important;
}
.filters .chip.active, .svc-types .chip.active, .act-filters .chip.active {
  background:var(--chip-on-bg) !important; border-color:var(--chip-on-bg) !important; color:var(--chip-on-tx) !important;
}
#activity-body .act-group-card { background:transparent; border:0; border-radius:0; box-shadow:none; }
#activity-body .act-card { border-bottom:1px solid var(--border-soft) !important; }
#activity-body .act-card:hover { background:var(--bg-hover) !important; }
#svc tbody tr, #cron tbody tr { background:transparent; }
#svc tbody td, #cron tbody td { background:transparent !important; border:0 !important; border-bottom:1px solid var(--border-soft) !important; border-radius:0 !important; }
#svc tbody tr:hover td, #cron tbody tr:hover td { background:var(--bg-hover) !important; }
#svc-panel th, #cron-panel th { border-bottom-color:var(--border) !important; }
#usage-page :is(.mp-kpi-card,.mp-chart-card,.mp-column-card,.mp-account-card,.mp-prov-card) {
  background:transparent !important; border:0 !important; border-radius:0 !important; box-shadow:none !important;
}
#usage-page .mp-kpi-card { padding-left:0; padding-right:0; }
#usage-page :is(.mp-chart-card,.mp-column-card) { border-top:1px solid var(--border) !important; padding-left:0; padding-right:0; }
#usage-page :is(.mp-pv-row,.mp-agent-row,.mp-model-row) { border-radius:0; box-shadow:none; }
.ts-card, .ts-serve-card, .ts-peer-card, .ts-netcheck-panel, .manage-card {
  color:var(--text); background:transparent !important; border:0 !important;
  border-bottom:1px solid var(--border-soft) !important; border-radius:0 !important; box-shadow:none !important;
  backdrop-filter:none; -webkit-backdrop-filter:none;
}
.ts-serve-grid { gap:0 20px; }
.ts-peers-list { gap:0; }
.ts-sec-title, .ts-peer-name { color:var(--text-title); }
.ts-serve-path { color:var(--link-blue); }
.ts-dns-text, .ts-serve-proxy, .ts-peer-ip, .ts-peer-traffic, .ts-diag-label, .ts-os-badge { color:var(--text-dim); }
.ts-ip-chip, .ts-diag-item { background:var(--bg-hover); border-color:var(--border); color:var(--text); }
.btn-ts-action, .btn-ts-mini { background:var(--btn-bg); border-color:var(--btn-border); color:var(--text-hi); }
.ts-badge.running, .ts-conn-pill.direct, .ts-ping-res, .ts-diag-val.ok { color:var(--c-green); }
.ts-conn-pill.relay, .ts-diag-val.warn { color:var(--c-warn); }
.ts-conn-pill.offline { color:var(--text-dim); }
.ts-ping-res.err { color:var(--c-red); }
@media (max-width:700px) {
  header { grid-template-columns:minmax(0,1fr) auto auto auto auto; }
  header h1 { overflow:hidden; }
  header .lang-switch { grid-column:2; }
  header .theme-toggle { grid-row:1; grid-column:3; }
  header #refresh { grid-row:1; grid-column:4; }
  header .h-login-btn { grid-row:1; grid-column:5; border-radius:6px !important; }
  #activity-page, #agents-page, #usage-page, #svc-page { padding:12px !important; }
  #svc tbody tr, #cron tbody tr { background:transparent !important; border:0 !important; border-bottom:1px solid var(--border-soft) !important; border-radius:0 !important; margin:0 !important; }
  #svc tbody td, #cron tbody td { border:0 !important; }
  .page-subnav, .agent-subnav { gap:8px !important; }
}

/* Home uses the same single surface as the other pages. */
#hp-workbench {
  background:var(--bg-elev); border:1px solid var(--border); border-radius:var(--card-radius);
  padding:18px 20px; box-shadow:none;
}
#hp-workbench :is(#hp-usage,#chart-wrap,#hp-github,#hp-activity-log,#hp-server-summary,#hp-month-cal,.hp-vm-card) {
  min-width:0; margin:0 !important; padding:0 !important; background:transparent !important;
  border:0 !important; border-radius:0 !important; box-shadow:none !important;
}
#hp-workbench .hp-main-col, #hp-workbench .hp-side-col { gap:20px; }
#hp-workbench .hp-main-col > :not(:first-child),
#hp-workbench .hp-side-col > :not(:first-child) { border-top:1px solid var(--border-soft) !important; padding-top:18px !important; }
#hp-workbench :is(#chart-wrap,#hp-github,#hp-activity-log,#hp-month-cal) { border-top:1px solid var(--border-soft) !important; padding-top:18px !important; }
#hp-workbench .hp-vms-grid { margin:0; gap:16px; }
#hp-workbench .hp-vm-card + .hp-vm-card { border-left:1px solid var(--border-soft) !important; padding-left:16px !important; }
#hp-workbench .hp-side-col .sysbar { border:0; border-radius:0; background:transparent; }
#hp-workbench .hp-side-col .sysbar .stat { padding:10px 0 !important; }
#hp-workbench :is(.gh-scroll,#chart-wrap canvas) { background:transparent; border:0; border-radius:0; }
#hp-workbench .gh-scroll { padding:4px 0 8px; }
@media (min-width:1025px) {
  #hp-workbench { gap:20px; }
  #hp-workbench .hp-side-col { border-left:1px solid var(--border-soft); padding-left:20px; }
}
@media (max-width:1024px) {
  #hp-workbench .hp-side-col { border-top:1px solid var(--border-soft); padding-top:18px; }
}
@media (max-width:860px) {
  #hp-workbench .hp-vm-card + .hp-vm-card { border-left:0 !important; border-top:1px solid var(--border-soft) !important; padding:16px 0 0 !important; }
}
@media (max-width:700px) {
  #hp-workbench { padding:12px; }
  #hp-workbench .hp-main-col, #hp-workbench .hp-side-col { gap:16px; }
  #hp-workbench .hp-main-col > :not(:first-child),
  #hp-workbench .hp-side-col > :not(:first-child) { padding-top:16px !important; }
}

/* Fit the contribution calendar to the available width without an inner scroll. */
#hp-github .gh-scroll { overflow:visible; min-width:0; }
#hp-github .gh-calendar { min-width:0; width:100%; }
#hp-github :is(.gh-months,.gh-weeks) { grid-template-columns:repeat(var(--gh-weeks),minmax(0,1fr)); gap:2px; }
#hp-github .gh-week { min-width:0; grid-template-rows:repeat(7,auto); gap:2px; }
#hp-github .gh-week .gh-day { width:min(100%,10px) !important; height:auto !important; aspect-ratio:1; margin:0 !important; justify-self:center; }
#hp-github .gh-months span { font-size:10px; }
#hp-github .hp-gh-year-pill { font:inherit; font-size:11px; cursor:pointer; }
.hp-cal-cell.empty { padding:0; }
@media (min-width:1025px) {
  #hp-workbench .hp-side-col { align-self:stretch; }
}
@media (min-width:769px) {
  header { column-gap:8px; }
  #catbar { gap:8px; }
  header :is(.lang-trigger,.h-login-btn) { padding:0 5px; }
  header :is(.theme-toggle,#refresh) { width:32px; min-width:32px; }
}
@media (max-width:700px) {
  #hp-github .gh-months span { font-size:9px; }
  #hp-github .gh-calendar { overflow:hidden; }
}
