/* ============================================================================
   Panlox 配色资源层 —— 云枢（YunShu）
   ----------------------------------------------------------------------------
   本文件只放颜色，不放任何布局、字号、圆角与动效。base / layout / components / pages
   不出现色值字面量，一律引用这里的变量。这样换配色只需替换本文件，结构样式一行不动。

   企业版白标：在本文件末尾追加一组
       html[data-palette="企业标识"] { --brand: …; --brand-hover: …; … }
   覆盖同名变量即可，优先级高于 :root，无需改动结构样式。

   亮色挂 :root（同时兼容显式 data-palette="yuntu"），暗色挂 [data-theme="dark"]。
   两套都必须把同一批变量全部给全，漏一个就会出现「亮色有、暗色没有」的裂缝。
   ============================================================================ */

:root,
html[data-palette="yuntu"] {
  /* —— 品牌色：只出现在主按钮、激活态、数据强调 —— */
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff4ff;
  --brand-border: #c7d7fe;
  /* 品牌渐变：品牌标、AI 头像这类需要一点体积感的地方 */
  --brand-grad-from: #3b82f6;
  --brand-grad-to: #2563eb;
  /* 品牌实底上的前景色（文字、图标）。换深色品牌时改成深色即可 */
  --on-brand: #ffffff;

  /* —— 中性色阶 —— */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #f0f2f5;
  --border: #e8eaed;
  --border-strong: #d8dce2;
  /* 分段控件的轨道：比页面底色更深一档，白色滑块才立得住 */
  --seg-track: #dfe3ea;

  --text: #17191c;
  --text-2: #55595f;
  --text-3: #656b73;

  /* —— 语义色 —— */
  --success: #0f7352;
  --success-soft: #e8f5f0;
  --warning: #b45309;
  --warning-soft: #fdf3e3;
  --danger: #c53030;
  --danger-soft: #fdecec;
  /* 危险色的按下态：实心按钮 hover 时再压深一点 */
  --danger-active: #ad2a2a;
  --idle: #626870;
  --idle-soft: #f1f2f4;
  /* 提示条描边：比语义浅底再深一点，否则浅底落在浅页上没边界 */
  --success-border: #c9e7db;
  --warning-border: #f0dcbc;
  --danger-border: #f6cccc;

  /* —— 数据可视化色：环形图 / 趋势线 / 流量 —— */
  --c-blue: #2563eb;
  --c-violet: #7c5cff;
  --c-amber: #e08b1f;
  --c-teal: #0d9488;
  /* Logo 中心圆点的青绿：注册入口/弹窗与官方公告共用这套强调色 */
  --brand-dot: #2dd4bf;
  --brand-dot-ink: #0f766e;
  --on-brand-dot: #0b2f2b;
  --brand-dot-btn: #68e0d1;
  --brand-dot-btn-hover: #2dd4bf;
  /* 更新提示红点：比 danger 更亮，小面积在深色侧栏上也醒目 */
  --c-red: #e5484d;

  /* —— 纯白侧栏：与卡片同面，靠发丝描边与投影和内容区分开 —— */
  --side-bg: #ffffff;
  --side-bg-2: #f6f7f9;
  --side-border: #e8eaed;
  --side-text: #1a1d21;
  --side-text-2: #5b6472;
  --side-text-3: #656b73;
  --side-hover: #f0f2f5;
  /* 头像、副标这类实底块：白面上要略深一档才沉得住 */
  --side-active: #eaf2ff;
  /* 侧栏内的品牌色：浅底上要够深，badge 文字与描边才立得住 */
  --side-brand: #2f6fed;
  --side-brand-hover: #1f5bd8;

  /* —— 阴影 ——
     阴影色单独抽成 RGB 三元组，配合 rgb(var(--shadow-rgb) / 透明度) 使用。
     亮色主题阴影带一点蓝灰（16 24 40），暗色主题是纯黑，这样同一处阴影
     在两套主题下都不发灰。 */
  --shadow-rgb: 16 24 40;
  --shadow-xs: 0 1px 2px rgb(var(--shadow-rgb) / 0.04);
  --shadow-sm: 0 1px 3px rgb(var(--shadow-rgb) / 0.06), 0 1px 2px rgb(var(--shadow-rgb) / 0.04);
  --shadow-md: 0 8px 24px -6px rgb(var(--shadow-rgb) / 0.12), 0 2px 6px rgb(var(--shadow-rgb) / 0.05);
  --shadow-lg: 0 24px 48px -12px rgb(var(--shadow-rgb) / 0.22);
  /* 居中外壳的侧向投影：两侧亮度接近，等量投影；亮度只压一档，边缘靠描边立住 */
  --shell-shadow: -16px 0 36px -14px rgb(var(--shadow-rgb) / 0.10), 16px 0 36px -14px rgb(var(--shadow-rgb) / 0.10);

  /* —— 浮层与遮罩 —— */
  --mask: rgb(var(--shadow-rgb) / 0.4);
  /* 头像实底：浅灰底上要够沉，白字才立得住 */
  --avatar-bg: #2b3038;
  /* 顶栏用户胶囊：默认沿用白面，hover 才点亮成浅蓝渐变并扫过一道高光 */
  --user-pill-bg: var(--surface);
  --user-pill-bg-hover: #dbe8fd;
  --user-pill-grad-from: #f2f7ff;
  --user-pill-grad-to: #d3e3fd;
  --user-pill-sheen: rgb(255 255 255 / 0.55);
  /* hover 时描边随底色一起转蓝，默认则用中性浅灰 */
  --user-pill-border-hover: #7fa8f0;
  /* 开关滑钮：浅色下是白色实体块，暗色下跟卡片面同色 */
  --knob: #ffffff;

  /* —— 终端：模拟真实终端，固定深色，不跟随主题 —— */
  --term-bg: #0e1013;
  --term-head: #15181c;
  --term-input: #15181d;
  --term-field: #0b0d10;
  --term-field-focus: #090b0e;
  --term-border: #23272e;
  --term-border-2: #2b3038;
  --term-text: #d5dae1;
  --term-text-2: #e6eaf0;
  --term-placeholder: #5b636e;
  --term-prompt: #4ade80;
  --term-path: #60a5fa;
  --term-dim: #6b7280;
  --term-warn: #fbbf24;
  --term-accent: #3b82f6;
  /* 终端窗口红绿灯 */
  --term-dot-close: #ff5f57;
  --term-dot-min: #febc2e;
  --term-dot-max: #28c840;
}

[data-theme="dark"],
html[data-palette="yuntu"][data-theme="dark"] {
  --brand: #4d84f5;
  --brand-hover: #6d9bf7;
  --brand-soft: #16233c;
  --brand-border: #2b4270;
  --brand-grad-from: #4d84f5;
  --brand-grad-to: #2563eb;
  --on-brand: #ffffff;

  --bg: #0c0d0f;
  --surface: #141619;
  --surface-2: #1a1d21;
  --surface-3: #22262b;
  --border: #262a30;
  --border-strong: #33383f;
  --seg-track: #0f1114;

  --text: #eceef1;
  --text-2: #a8aeb6;
  --text-3: #8a919a;

  --success: #35c08a;
  --success-soft: #142a23;
  --warning: #e5a13a;
  --warning-soft: #2b2114;
  --danger: #f0736d;
  --danger-soft: #2e1a1a;
  --danger-active: #d36560;
  --idle: #8b929b;
  --idle-soft: #22262b;
  --success-border: #24483a;
  --warning-border: #4a3a20;
  --danger-border: #4d2b2b;

  --c-blue: #4d84f5;
  --c-violet: #9b83ff;
  --c-amber: #e5a13a;
  --c-teal: #2dd4bf;
  --brand-dot: #2dd4bf;
  --brand-dot-ink: #2dd4bf;
  --on-brand-dot: #0b2f2b;
  --brand-dot-btn: #2dd4bf;
  --brand-dot-btn-hover: #5eead4;
  --c-red: #f2555a;

  /* 暗色下侧栏抬到卡片面一档，比页面底亮，不再压成近黑 */
  --side-bg: #141619;
  --side-bg-2: #1c1f24;
  --side-border: #262a30;
  --side-text: #eceef1;
  --side-text-2: #a8aeb6;
  --side-text-3: #8a919a;
  --side-hover: #1c2026;
  --side-active: #242a33;
  --side-brand: #6d9bf7;
  --side-brand-hover: #7cb0fb;

  --shadow-rgb: 0 0 0;
  --shadow-xs: 0 1px 2px rgb(var(--shadow-rgb) / 0.3);
  --shadow-sm: 0 1px 3px rgb(var(--shadow-rgb) / 0.4);
  --shadow-md: 0 8px 24px -6px rgb(var(--shadow-rgb) / 0.5);
  --shadow-lg: 0 24px 48px -12px rgb(var(--shadow-rgb) / 0.7);
  --shell-shadow: -16px 0 36px -14px rgb(var(--shadow-rgb) / 0.5), 16px 0 36px -14px rgb(var(--shadow-rgb) / 0.5);

  --mask: rgb(var(--shadow-rgb) / 0.62);
  --avatar-bg: #33383f;
  /* 暗色下默认回到高一档的灰面，hover 才提亮成蓝墨 */
  --user-pill-bg: var(--surface-2);
  --user-pill-bg-hover: #1e2c47;
  --user-pill-grad-from: #203152;
  --user-pill-grad-to: #131e32;
  --user-pill-sheen: rgb(124 176 251 / 0.16);
  --user-pill-border-hover: #4d6fac;
  --knob: #ffffff;

  /* 终端本身已是深色，暗色主题下只把外框压暗一点，避免与页面糊在一起 */
  --term-bg: #0a0c0e;
  --term-head: #101317;
  --term-input: #101318;
  --term-field: #08090b;
  --term-field-focus: #060708;
  --term-border: #1e2228;
  --term-border-2: #262b32;
}

/* Panlox —— 浅色极简·专业面板设计系统
   约定：底色分层（页面 / 卡片 / 内嵌），发丝线分隔，蓝色只用于关键动作。 */

/* 色值全部在 palette.css，本文件不写任何颜色字面量。
   这里只留与配色无关的结构令牌：圆角、尺寸、层级、动效、字号、字体。 */
:root {
  --radius-3xs: 2px;
  --radius-2xs: 4px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius: 14px;
  --radius-xl: 18px;
  --radius-circle: 50%;
  --radius-pill: 999px;

  --sidebar-w: 248px;
  /* 全站外壳最大宽度（含侧栏）：1440 − 248 − 左右各 28 内边距 = 可见内容 1136 */
  --shell-w: 1440px;

  /* 层级：按语义取值，新增浮层一律引用变量，不再写裸数字。
     同一浮层内部做局部堆叠（如图标压在底色上）仍可用 0/1/2 这类小数字，
     那些属于层叠上下文内部，与这里无关。 */
  --z-sticky: 20;    /* 顶栏、粘性表头 */
  --z-dropdown: 40;  /* 下拉菜单、选择器面板 */
  --z-modal: 100;    /* 弹窗遮罩与弹窗本体 */
  --z-popover: 1200; /* 挂到 body 上、必须盖过弹窗的浮层（选择器菜单、会话菜单） */
  --z-toast: 1300;   /* 轻提示，永远在最上层 */

  /* 动效：时长收成三档，缓动收成两档。
     fast 用于悬停、按下这类即时反馈；dur 用于展开收起；slow 用于位置移动。
     另有三档专用：enter 是元素入场（卡片、导航项、错峰列表），
     grow 是数据增长（进度条、环形图、数字滚动），
     loop / pulse 是无限循环（呼吸点、任务脉冲、光标闪烁）的周期。 */
  --dur-fast: 0.14s;
  --dur: 0.18s;
  --dur-slow: 0.3s;
  --dur-enter: 0.42s;
  --dur-grow: 0.9s;
  --dur-loop: 2.4s;
  --dur-pulse: 1.1s;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);      /* 出场：快起慢收，绝大多数过渡用它 */
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1); /* 回弹：位移、缩放，带一点过冲 */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);  /* 对称缓入缓出：呼吸、脉冲这类循环动画 */

  /* 焦点环：键盘可见焦点统一一种表现，避免各控件各写一套光晕 */
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --ring-danger: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);

  /* 字号阶梯：八档，相邻档至少差 1px，不再出现 12 / 12.5 这种肉眼分不出的半像素差。
     正文 15 是基准，向下三档（13.5 / 12.5 / 11）承担按钮、表头与元信息，
     向上三档（16.5 / 21 / 24 / 27）承担标题与数字。所有 font-size 一律引用这里。 */
  --fs-2xs: 11px;     /* 版本号、侧栏分组标题、极小元信息 */
  --fs-xs: 12.5px;    /* 表头、徽标、脚注、辅助说明 */
  --fs-sm: 13.5px;    /* 按钮、卡片头、次要文字 */
  --fs-body: 15px;    /* 正文、表格、输入框 */
  --fs-title: 16.5px; /* 页面小标题、品牌名 */
  --fs-lg: 21px;      /* 页面主标题、环形图数值 */
  --fs-xl: 24px;      /* 面板内次级大数字 */
  --fs-display: 27px; /* 统计卡大数字、登录页主标题 */

  /* 行高与字重：只收敛高频值，组件内的局部特例仍需在 DESIGN.md 登记。
     字重 550 是按钮与标签的基准：中文在 500 上没有对应字重，会显得偏细。 */
  --lh-body: 1.6;
  --lh-display: 1.15;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-label: 550;
  --fw-semibold: 600;
  --fw-bold: 650;
  --fw-strong: 700;

  /* 西文/数字优先使用系统内置的现代无衬线（Inter / SF / Segoe UI Variable），
     中文回落到苹方与微软雅黑；全部为系统字体，不额外下载任何字体文件。 */
  --font: "Inter", "Inter var", -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Text", "Segoe UI", system-ui, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --font-num: "Inter", "SF Pro Display", -apple-system, "Segoe UI Variable Display",
    "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  /* 等宽字体栈只含拉丁字形，中文必须显式回落到与正文一致的字体，
     否则会掉到浏览器默认中文字体（Windows 上是宋体），字形与正文不一致。 */
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans SC", monospace;
  /* 数值字体：由「等宽数字」开关切换。等宽模式用 --mono，比例模式回到无衬线数字字体。 */
  --num-font: var(--font-num);

  /* 间距刻度：七档，4 的倍数。区块留白与栅格 gap 只引用这里。
     组件内衬另有密度令牌，允许 11 / 13 / 15 这类中间值——
     强行压到 4 的栅格上会让视觉节奏变硬，反而不好看。 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;

  /* 密度令牌：组件内衬与控件高度只引用这里。
     紧凑模式在文件末尾整组换值，不再逐组件重写选择器；
     新加组件只要引用 --dense-*，自动获得紧凑行为。 */
  --dense-page-y: 28px;
  --dense-page-x: 28px;
  --dense-section-gap: 22px;
  --dense-topbar-h: 58px;
  --dense-topbar-x: 28px;

  --dense-brand-top: 22px;
  --dense-brand-bot: 18px;
  --dense-nav-y: 8px;
  --dense-nav-x: 12px;
  --dense-group-top: 20px;
  --dense-group-bot: 8px;
  --dense-group-first: 6px;
  --dense-divider-y: 10px;
  --dense-navitem-y: 10px;
  --dense-navitem-gap: 3px;
  --dense-sidefoot: 12px;
  --dense-sidebrand-y: 8px;
  --dense-sidebrand-x: 10px;

  --dense-card-y: 18px;
  --dense-card-x: 18px;
  /* 运行环境卡片比通用卡片紧一档：四列排布下卡片只有 230px 宽，
     18px 内衬会把名字和右上角状态挤到换行 */
  --dense-app-card-y: 15px;
  --dense-app-card-x: 15px;
  --dense-card-head-y: 15px;
  --dense-card-foot-y: 13px;
  --dense-stat-y: 16px;
  --dense-stat-x: 18px;
  --dense-stat-label-gap: 9px;
  --dense-stat-foot-gap: 7px;
  --dense-stat-fs: var(--fs-display);
  --dense-row-y: 13px;
  --dense-th-y: 10px;
  --dense-list-y: 12px;
  --dense-list-x: 16px;
  --dense-setting-y: 15px;
  --dense-kv-y: 8px;
  --dense-kv-x: 12px;
  --dense-grid-gap: 16px;

  --dense-control-h: 36px;
  --dense-btn-sm-h: 30px;
  --dense-badge-h: 22px;
  --dense-picker-h: 30px;
  --dense-seg-h: 28px;
  --dense-seg-pad: 3px;
  --dense-menu-pad: 5px;

  --dense-modal-head: 18px 20px 14px;
  --dense-modal-body: 0 20px 4px;
  --dense-modal-foot-y: 16px;
  --dense-mask-pad: 24px;
  --dense-pill-pad: 7px 3px 5px;
  --dense-pill-h: 34px;
  --dense-pill-mb: 14px;

  /* 日志框按 20 行定高（单行 34px + 2px 边框），不足 20 行不出现内部滚动条 */
  --dense-log-max: 682px;
  --dense-log-y: 6px;
  --dense-log-x: 12px;
  --dense-drop-pad: 26px 18px;
  --dense-timeline-x: 20px;
  --dense-tl-gap: 16px;
  --dense-tl-dot: -18px;
  --dense-task-steps: 2px 20px 0;
  --dense-task-step-y: 7px;
  --dense-empty-pad: 48px 20px;
  --dense-code-pad-y: 14px;
  --dense-code-pad-x: 16px;
  --dense-code-pad: var(--dense-code-pad-y) var(--dense-code-pad-x);
  --dense-tip-pad: 11px 13px;
}

/* 暗色主题的色值同样在 palette.css */

/* ============ 裸 px 的判定规则 ============ */
/* 本文件仍有大量 px，但只有一类算「该管的」：
     间距类属性（padding / margin / gap）里，凡是完整落在 4 栅格上的值，
     一律走 --sp-*；组件内衬另走 --dense-*。
   下面这些刻意保持裸值，不再令牌化，改的时候不用纠结：
     1px / 1.5px / 2px  —— 边框与描边。发丝线是设备像素级概念，令牌化只会绕远路
     999px               —— 胶囊圆角，语义就是「足够大」
     图标 width/height    —— 15px / 14px / 16px 是图标自身尺寸，与间距无关
     grid-template-columns 的固定列宽 —— 表格首列、时间列这类按内容定宽
     transform 的位移量   —— 与动画幅度绑定，归动效令牌管
     含 9/10/11/13/14/18 的组件内衬 —— 如 padding: 12px 14px。
       强行压到 4 栅格会让视觉节奏变硬（见文件顶部间距刻度注释），
       这类值归组件自己的密度令牌管，不属于「漏网」。
   判定方法：看属性。padding / margin / gap 出现「纯 4 的倍数」属漏网，应改；
   其余属性出现裸 px 属于设计决定，保持原样。 */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* 预留滚动条位置：局部换页时内容高度变化，页面不会因滚动条出现/消失而横向抖动 */
html { scrollbar-gutter: stable; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  /* 灰度平滑在 macOS 上让字更干净，但在 Windows 上会关掉 ClearType 次像素渲染，
     13px 的中文会明显发虚发细。所以只在 macOS 启用，Windows 交回系统渲染。 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

html[data-os="win"] body {
  -webkit-font-smoothing: auto;
}

/* ============ 键盘焦点 ============ */
/* 只对键盘焦点画环（:focus-visible），鼠标点击不画，避免满屏蓝框。
   用 outline 而不是 box-shadow：outline 不参与布局、跟随 border-radius，
   对任意控件都成立，且不会被相邻元素覆盖。
   用 :where() 把权重压到 0，任何组件自有样式都能覆盖它。 */
:where(a, button, summary, [tabindex], [role="switch"], [role="tab"], [role="button"]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* 被滚动容器裁切的控件（侧栏导航、分段控件）改用内缩环，
   否则 outline-offset 正向外扩会被 overflow 直接切掉，看起来像没有焦点 */
.nav-item:focus-visible,
.segmented button:focus-visible,
.pill-tabs button:focus-visible {
  outline-offset: -2px;
}
/* 暗色侧栏上的焦点环换成亮色，蓝色在深底上对比度不足；亮色侧栏用默认品牌环即可 */
[data-theme="dark"] .sidebar :where(a, button):focus-visible {
  outline-color: color-mix(in srgb, var(--brand) 55%, #fff);
}
/* 表单控件的 :focus 里已有贴边的 box-shadow 环（比 outline 更贴合圆角），
   这里排除掉，避免键盘聚焦时同时出现外框与光晕两套高亮 */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: var(--fw-semibold); letter-spacing: -0.01em; }

/* ============ 工具类 ============ */
.mono {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-variant-numeric: var(--num-variant, tabular-nums);
  letter-spacing: -0.01em;
}
/* 仅供屏幕阅读器：视觉上隐藏，但仍进入无障碍树 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
/* 说明性小字：卡片头计数、区块头统计、字段旁注共用。原先只写了 .card-header .hint，
   放到区块头（.dk-sec-head）时样式落空，整句退化成正文字号与正文色 */
.hint { font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
/* 数字统一跟随「等宽数字」开关：等宽模式用等宽字体，比例模式用无衬线数字字体。 */
/* .mono 元素跳过数值字体：td.mono / dd.mono 的元素选择器权重更高，
   否则显式写的等宽类会被 .table td / .kv dd 覆盖成 Inter。 */
.stat-value:not(.mono), .donut-value:not(.mono), .net-stat .ns-value:not(.mono), .load-item .l-value:not(.mono),
.metric-row .v:not(.mono), .bar-value:not(.mono), .log-time:not(.mono), .kv dd:not(.mono) {
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
/* 表格里只有显式标记 .num / .mono.num 的数值才切字体，避免整张表的中文也变成等宽 */
.table td { font-variant-numeric: var(--num-variant, tabular-nums); }
/* .mono 保留等宽字体；纯数值元素再叠 .num，比例模式才会切回无衬线字体 */
.mono { font-variant-numeric: var(--num-variant, tabular-nums); }
.num { font-family: var(--num-font); font-variant-numeric: var(--num-variant, tabular-nums); }
.mono.num { font-family: var(--num-font); }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
/* 常用固定宽度，避免在模板里散落内联 style */
.w-110 { width: 110px; }
.w-130 { width: 130px; }
.w-150 { width: 150px; }
.w-180 { width: 180px; }
.w-200 { width: 200px; }
.w-220 { width: 220px; }
.w-44 { width: 44px; }
.w-190 { width: 190px; }
.mw-240 { max-width: 240px; }
.mw-260 { max-width: 260px; }
.mw-340 { max-width: 340px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ============ 加载态 ============ */
/* htmx 局部替换：默认指示器是行内文字（「加载中…」），
   加 .spinner / .skeleton 时按各自的盒模型显示，互不干扰。 */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.htmx-indicator.spinner { display: none; }
.htmx-request .htmx-indicator.spinner,
.htmx-request.htmx-indicator.spinner { display: inline-block; }
.htmx-indicator.skeleton { display: none; }
.htmx-request .htmx-indicator.skeleton,
.htmx-request.htmx-indicator.skeleton { display: block; }

/* 骨架屏：占位块 + 一道横向扫光。
   比灰块整体闪烁更轻，也不会因为高度变化触发页面跳动 —— 占位尺寸由调用方给。
   用法：<div class="skeleton" style="height:14px"></div>
        多行用 .skeleton-stack 包一层，自动 10px 间距。 */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg,
    transparent,
    color-mix(in srgb, var(--surface) 72%, transparent),
    transparent);
  animation: skeletonSweep var(--dur-pulse) var(--ease-soft) infinite;
}
@keyframes skeletonSweep {
  to { transform: translateX(100%); }
}
.skeleton-text { height: 12px; margin: 6px 0; }
.skeleton-text.w-60 { width: 60%; }
.skeleton-text.w-40 { width: 40%; }
.skeleton-circle { border-radius: var(--radius-pill); }
.skeleton-stack > * + * { margin-top: 10px; }
/* 骨架屏只在「真没内容」时用。已有内容刷新时用 .is-loading：内容降透明度 + 顶部细线，
   旧内容仍然在，不会出现一块白 —— 这是 htmx 局部替换闪白的根因。 */
.is-loading {
  position: relative;
  pointer-events: none;
}
.is-loading > * { opacity: 0.45; transition: opacity var(--dur) var(--ease); }
.is-loading::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: loadingBar var(--dur-pulse) var(--ease-soft) infinite;
}
@keyframes loadingBar {
  0% { transform: translateX(-40%) scaleX(0.4); opacity: 0.3; }
  50% { transform: translateX(0) scaleX(1); opacity: 1; }
  100% { transform: translateX(40%) scaleX(0.4); opacity: 0.3; }
}

/* 转圈：用于按钮内、卡片角这类小面积等待。尺寸走 em，跟随字号。 */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -0.15em;
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent);
  border-top-color: currentColor;
  border-radius: var(--radius-pill);
  animation: spinnerSpin var(--dur-grow) linear infinite;
}
@keyframes spinnerSpin {
  to { transform: rotate(360deg); }
}


/* ============ 布局骨架 ============ */
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: var(--shell-w);
  margin: 0 auto;
  /* 左右各一条发丝线与等量侧影，把外壳从同色的页面底上分出来 */
  border-left: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
  box-shadow: var(--shell-shadow);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  color: var(--side-text-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--dense-brand-top) 20px var(--dense-brand-bot);
  font-size: var(--fs-title);
  font-weight: var(--fw-strong);
  letter-spacing: -0.015em;
  color: var(--side-text);
}
.brand-lockup {
  display: flex;
  align-items: center;
  transition: opacity var(--dur) var(--ease);
}
.brand-lockup .lockup-img { display: block; height: 24px; width: auto; }
.brand-lockup .lockup-img-dark { display: none; }
[data-theme="dark"] .brand-lockup .lockup-img { display: none; }
[data-theme="dark"] .brand-lockup .lockup-img-dark { display: block; }
.brand:hover .brand-lockup { opacity: 0.86; }
.brand-mark-only { display: none; }
.brand-mark-only img { display: block; width: 26px; height: 26px; }
.login-wrap .login-brand .lockup-img { height: 34px; }

.nav { flex: 1; padding: var(--dense-nav-y) var(--dense-nav-x) 4px; overflow-y: auto; overflow-x: hidden; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: var(--side-border); border-radius: var(--radius-pill); }
.nav-group {
  font-size: var(--fs-2xs);
  font-weight: 650;
  color: var(--side-text-3);
  letter-spacing: 0.08em;
  padding: var(--dense-group-top) 10px var(--dense-group-bot);
  text-transform: uppercase;
}
.nav-group:first-child { padding-top: var(--dense-group-first); }
/* 无标题分组（如置顶的 Panlox AI）后加淡分隔线，与下方分组区分 */
.nav-divider {
  height: 1px;
  margin: var(--dense-divider-y) 10px 2px;
  background: var(--side-border);
}
/* Panlox AI 关闭时，入口与其后的分隔线一起隐藏 */
html[data-ai="off"] .nav-ai,
html[data-ai="off"] .nav-divider { display: none !important; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: var(--dense-navitem-y) 12px;
  border-radius: var(--radius-sm);
  color: var(--side-text-2);
  font-size: var(--fs-sm);
  /* 500 在中文字体上只有 Regular 可用（雅黑 / 苹方都没有 Medium 档映射给 500），
     而西文在 500 已是 Medium，中文会显得偏细；600 才让中文落到 Bold 与西文持平 */
  font-weight: 600;
  margin-bottom: var(--dense-navitem-gap);
  /* 颜色不做过渡：激活态是蓝底白字，若让颜色慢 180ms 追上来，点击瞬间会出现
     蓝底配深字的脏帧，移开旧项时又会反过来白字落在浅底上 */
  transition: background-color var(--dur) var(--ease),
    padding-left var(--dur) var(--ease-spring);
  animation: navIn var(--dur-enter) var(--ease) backwards;
}
@keyframes navIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text); padding-left: 15px; }
.nav-item.active {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--brand) 92%, transparent),
    color-mix(in srgb, var(--brand-grad-from) 72%, transparent));
  color: var(--on-brand);
  font-weight: 600;
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--brand) 55%, transparent);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  border-radius: 0 var(--radius-3xs) var(--radius-3xs) 0;
  background: color-mix(in srgb, var(--on-brand) 90%, transparent);
  animation: navBar var(--dur-slow) var(--ease-spring);
}
@keyframes navBar {
  from { height: 0; opacity: 0; }
  to { height: 16px; opacity: 1; }
}
.nav-item.active .nav-icon { color: var(--on-brand); }
.nav-icon {
  position: relative;
  display: flex;
  color: var(--side-text-3);
  /* 颜色与文字同步直切，避免激活瞬间图标还停在深色 */
  transition: transform var(--dur-slow) var(--ease-spring);
}
/* 更新圆点骑在行内的右侧背景上：与文字左缩进对称，收窄成图标栏后仍留在行内 */
.nav-dot {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-circle);
  background: var(--c-red);
  transform: translateY(-50%);
}
.nav-icon svg { width: 17px; height: 17px; }
.nav-item:hover .nav-icon { transform: scale(1.12) rotate(-6deg); color: var(--side-text); }
.nav-item.active:hover .nav-icon { color: var(--on-brand); }
.nav-badge {
  margin-left: auto;
  font-size: var(--fs-2xs);
  font-weight: 650;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--side-brand) 16%, transparent);
  color: var(--side-brand);
  transition: transform var(--dur) var(--ease);
}
.nav-item:hover .nav-badge { transform: scale(1.08); }

/* 侧栏底部：Panlox 品牌信息 */
.sidebar-footer {
  padding: var(--dense-sidefoot);
  border-top: 1px solid var(--side-border);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--dense-sidebrand-y) var(--dense-sidebrand-x);
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) var(--ease);
}
.side-brand:hover { background: var(--side-hover); }
.side-brand-logo {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.side-brand-logo img { display: block; width: 24px; height: 24px; }
.side-brand-meta { min-width: 0; }
.sbm-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--side-text);
  line-height: 1.3;
}
.sbm-ver {
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--side-text-3);
  background: var(--side-bg-2);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  transition: background-color var(--dur-fast) var(--ease);
}
/* 悬停时整块底变灰，版本号要抬回白面才不至于和底色糊在一起 */
.side-brand:hover .sbm-ver { background: var(--surface); }
.sbm-desc {
  font-size: var(--fs-2xs);
  color: var(--side-text-3);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-pill);
  background: var(--side-active);
  color: var(--side-text);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 600;
  flex-shrink: 0;
}
.avatar svg { width: 15px; height: 15px; }

/* 顶栏右上角的当前管理员 + 下拉菜单 */
.dropdown { position: relative; }
.topbar-user {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: var(--sp-1) 10px var(--sp-1) var(--sp-1);
  border: 1px solid var(--border-strong);
  background: var(--user-pill-bg);
  font-family: inherit;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
/* 渐变叠加层：hover 淡入，让胶囊从平涂变成有体积的浅蓝面 */
.topbar-user::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, var(--user-pill-grad-from), var(--user-pill-grad-to));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease);
}
.topbar-user:hover::before { opacity: 1; }
/* 流光：hover 时一道高光斜扫过一次，扫完即停，不做循环 */
.topbar-user::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  z-index: 2;
  width: 36%;
  background: linear-gradient(100deg, transparent, var(--user-pill-sheen), transparent);
  transform: translateX(-140%) skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}
.topbar-user:hover::after {
  opacity: 1;
  transform: translateX(360%) skewX(-18deg);
  transition: transform 0.7s var(--ease), opacity 0.3s var(--ease);
}
/* 关闭动效时不扫光，只保留渐变与描边 */
[data-motion="off"] .topbar-user::after { display: none; }
/* 内容抬到渐变层之上；流光层仍从内容上方扫过 */
.topbar-user > * { position: relative; z-index: 1; }
.topbar-user:hover {
  border-color: var(--user-pill-border-hover);
  background: var(--user-pill-bg-hover);
}
/* 头像用深墨实底 + 白字，避免浅蓝底浅蓝字在灰背景上发糊 */
.topbar-user .avatar {
  background: var(--avatar-bg);
  color: var(--on-brand);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.topbar-user .u-meta { text-align: left; }
.topbar-user .u-name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; color: var(--text); }
.topbar-user .u-role { font-size: var(--fs-2xs); color: var(--text-3); line-height: 1.25; }
.u-caret {
  display: flex;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease-spring);
}
.u-caret svg { width: 14px; height: 14px; }
.dropdown.open .u-caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 216px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur) var(--ease),
    visibility var(--dur-fast) var(--ease);
  z-index: var(--z-dropdown);
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.dropdown-head .dh-name { font-size: var(--fs-sm); font-weight: 600; }
.dropdown-head .dh-mail { font-size: var(--fs-2xs); color: var(--text-3); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: var(--sp-2) 11px;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), padding-left var(--dur-fast) var(--ease);
}
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-3); transition: color var(--dur-fast) var(--ease); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); padding-left: 14px; }
.dropdown-item:hover svg { color: var(--text-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* 自绘下拉选择：原生 select 的弹层由系统绘制，样式无法控制 */
.picker { position: relative; display: inline-flex; }
.picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--dense-picker-h);
  padding: 0 9px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.picker-btn:hover { border-color: var(--text-3); }
.picker-btn > svg { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur) var(--ease-spring); }
.picker.open .picker-btn { border-color: var(--brand); box-shadow: var(--ring); }
.picker.open .picker-btn > svg { transform: rotate(180deg); }
.picker-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  /* 宽度跟触发按钮一致：面板比按钮宽出一截，看着像浮在别处。
     内容确实放不下时由 positionPickerMenu 按实际文字宽撑开。 */
  width: 100%;
  min-width: 100%;
  max-width: 260px;
  padding: var(--dense-menu-pad);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur) var(--ease), visibility var(--dur-fast) var(--ease);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-dropdown);
}
.picker.open .picker-menu,
.picker-menu.open { opacity: 1; visibility: visible; transform: none; }
/* 挂到 body 上的浮层必须默认 fixed：absolute 会以 body 为参照算出真实坐标，
   即使 opacity/visibility 隐藏，也照样把文档滚动高度撑高，页面底部会多出一片空白。 */
body > .picker-menu { position: fixed; top: 0; left: 0; }
/* 菜单挂在 body 上用 fixed 定位，必须高过弹窗遮罩（z-index 100），
   否则在弹窗里展开时会被遮罩压在下面，看起来像跑到了页面别处。 */
.picker-menu-block { z-index: var(--z-popover); }
.picker-opt {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  width: 100%;
  /* 与按钮同宽后横向空间很紧，勾选位和内边距都收一档，保证最长的版本号不被截断 */
  padding: 6px 3px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-xs);
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.picker-opt:hover { background: var(--surface-2); color: var(--text); }
/* 同宽浮层里文字靠省略号收口，不撑宽、不出现横滚动条 */
.picker-opt > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 勾选位：固定方形并保留占位，未选中时隐藏，避免文字左右跳动 */
.picker-opt > svg {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  color: var(--brand);
  opacity: 0;
}
.picker-opt.selected { color: var(--brand); font-weight: 600; }
.picker-opt.selected > svg { opacity: 1; }

/* 整宽下拉：接管原生 select 后的表单样式，宽度与高度跟原控件一致 */
.picker-block { display: block; width: 100%; }
.picker-btn-block {
  width: 100%;
  height: var(--dense-control-h);
  padding: 0 11px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 400;
  justify-content: space-between;
}
.picker-btn-block .picker-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-btn-block > svg { flex: 0 0 15px; width: 15px; height: 15px; }
.picker.open .picker-btn-block { border-color: var(--brand); box-shadow: var(--ring); }
/* 原生 select 只作为取值载体，不参与视觉布局。
   .picker 包裹后即使某个版本的脚本漏加 .select-hidden，也不允许原生控件露出来。 */
.picker > select.select,
.select-hidden {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
/* fixed 定位时菜单不受父级裁切，最大高度内滚动；
   纵向滚动条会占掉几个像素，横向必须裁掉，否则浮层底部会多一条横滚动条 */
.picker-menu-block {
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
}
/* 原生 select 的 optgroup 标题：只做分隔，不可点 */
.picker-group {
  padding: 7px 3px 3px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.picker-group:first-child { padding-top: 1px; }

/* 目录选择：输入框右侧「浏览」，展开的浮层是个精简版资源管理器。
   选目录不另开弹窗——弹窗套弹窗会打断填写节奏，这里就地逐级点进去。 */
.dirpick-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  flex-shrink: 0;
  padding: 0 var(--sp-3);
  white-space: nowrap;
}
.dirpick-open > svg { width: 15px; height: 15px; color: var(--text-3); }
.dirpick-open[aria-expanded='true'] { border-color: var(--brand); box-shadow: var(--ring); }
.dirpick-open[aria-expanded='true'] > svg { color: var(--brand); }

.dir-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-popover);
  /* 宽度由 js 按输入框组的实际宽度写入，保证与输入框同宽、右边缘齐平 */
  width: 430px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur) var(--ease), visibility var(--dur-fast) var(--ease);
}
.dir-menu.open { opacity: 1; visibility: visible; transform: none; }

.dir-menu-head {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 7px var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.dir-menu-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.dir-menu-nav:hover { background: var(--surface-2); color: var(--text); }
.dir-menu-nav > svg { width: 15px; height: 15px; }
.dir-crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.dir-crumbs::-webkit-scrollbar { display: none; }
.dir-crumb {
  border: 0;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-xs);
  color: var(--text-2);
  cursor: pointer;
}
.dir-crumb:hover { background: var(--surface-2); color: var(--text); }
.dir-crumb.cur { color: var(--text); font-weight: 600; }
.dir-crumb-sep { color: var(--border-strong); font-size: var(--fs-xs); }

.dir-list { max-height: 224px; overflow-y: auto; padding: 6px; }
.dir-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.dir-item:hover { background: var(--surface-2); color: var(--text); }
.dir-item > svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--text-3); }
.dir-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-empty {
  padding: 22px 10px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.dir-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.dir-foot-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.dir-foot .btn { flex-shrink: 0; height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--dense-topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--dense-topbar-x);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.page-title { font-size: var(--fs-title); font-weight: 600; }
.crumb { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); }
.crumb-root { color: var(--text-3); }
.crumb-sep { color: var(--border-strong); }
.crumb-cur { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* 顶栏注册入口：取 Logo 中心圆点的青绿，和中性工具按钮区分开；关闭注册时靠 html 属性整体隐藏 */
.topbar-signup {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--sp-3);
  border: 1px solid color-mix(in srgb, var(--brand-dot) 32%, var(--border));
  background: color-mix(in srgb, var(--brand-dot) 9%, var(--surface));
  border-radius: var(--radius-pill);
  color: var(--brand-dot-ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.topbar-signup svg { width: 15px; height: 15px; transition: transform var(--dur-slow) var(--ease-spring); }
.topbar-signup-logo {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--dur-slow) var(--ease-spring);
}
.topbar-signup:hover {
  background: color-mix(in srgb, var(--brand-dot) 17%, var(--surface));
  border-color: color-mix(in srgb, var(--brand-dot) 52%, var(--border));
  box-shadow: 0 5px 14px -5px color-mix(in srgb, var(--brand-dot) 55%, transparent);
  transform: translateY(-1px);
}
.topbar-signup:hover svg,
.topbar-signup:hover .topbar-signup-logo { transform: scale(1.14) rotate(-8deg); }
.topbar-signup:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 3px -1px color-mix(in srgb, var(--brand-dot) 40%, transparent);
}
.topbar-signup:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-dot) 28%, transparent);
}
html[data-signup="off"] .topbar-signup { display: none; }

/* 已绑定官方账号：与注册入口同一套青绿色系，用圆形对勾代替文字入口 */
.topbar-account {
  height: 32px;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 0 11px 0 var(--sp-1);
  border: 1px solid color-mix(in srgb, var(--brand-dot) 32%, var(--border));
  background: color-mix(in srgb, var(--brand-dot) 9%, var(--surface));
  border-radius: var(--radius-pill);
  color: var(--brand-dot-ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.topbar-account .acc-badge {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--brand-dot) 86%, var(--surface));
  color: var(--on-brand-dot);
}
.topbar-account .acc-badge svg { width: 13px; height: 13px; }
.topbar-account .acc-phone { letter-spacing: 0.02em; }
.topbar-account:hover {
  background: color-mix(in srgb, var(--brand-dot) 17%, var(--surface));
  border-color: color-mix(in srgb, var(--brand-dot) 52%, var(--border));
  box-shadow: 0 5px 14px -5px color-mix(in srgb, var(--brand-dot) 55%, transparent);
  transform: translateY(-1px);
}
.topbar-account:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 3px -1px color-mix(in srgb, var(--brand-dot) 40%, transparent);
}
.topbar-account:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-dot) 28%, transparent);
}
html[data-account="on"] .topbar-account { display: inline-flex; }
html[data-account="on"] .topbar-signup { display: none; }

.content { padding: var(--dense-page-y) var(--dense-page-x); max-width: 1320px; width: 100%; margin-inline: auto; }

/* 页头：标题 + 说明 + 操作 */
/* 无页头标题的页面：状态与操作单独一行，左右对齐 */
.page-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--dense-section-gap);
}
.page-tools .btn { height: var(--dense-control-h); padding: 0 13px; font-size: var(--fs-sm); }
.page-tools .btn.btn-sm { height: calc(var(--dense-control-h) - 4px); font-size: var(--fs-sm); }
.page-tools .btn.btn-icon,
.page-tools .btn.btn-icon.btn-sm { width: var(--dense-control-h); padding: 0; }
.page-tools .btn-icon svg { width: 15px; height: 15px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--dense-section-gap);
}
.page-head h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin-bottom: var(--sp-1); letter-spacing: -0.02em; }
.page-head p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.page-head > * { min-width: 0; }
/* 页头右侧动作区：状态胶囊与按钮统一高度，视觉上齐平；
   动作区不参与收缩，宽度不够时让左侧说明先换行，避免按钮被挤成两排 */
.page-head > .flex { flex-wrap: wrap; flex-shrink: 0; }
.page-head .btn { height: var(--dense-control-h); padding: 0 13px; font-size: var(--fs-sm); }
.page-head .btn.btn-sm { height: calc(var(--dense-control-h) - 4px); font-size: var(--fs-sm); }
/* 图标按钮：必须清掉左右内边距，否则内容宽度被压没，图标会缩成一小点 */
.page-head .btn.btn-icon,
.page-head .btn.btn-icon.btn-sm { width: var(--dense-control-h); padding: 0; }
.page-head .btn-icon svg { width: 15px; height: 15px; }
.page-head .badge {
  height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  gap: 7px;
}
.page-head .badge .badge-dot { width: 7px; height: 7px; }


/* 侧栏图标模式：与窄屏自动收起共用一套表现，宽屏由用户偏好控制 */
html[data-sidebar="icons"] { --sidebar-w: 64px; }
html[data-sidebar="icons"] .brand > span,
html[data-sidebar="icons"] .nav-group,
html[data-sidebar="icons"] .nav-badge,
html[data-sidebar="icons"] .side-brand-meta { display: none; }
html[data-sidebar="icons"] .nav-item > span:not(.nav-icon) { display: none; }
html[data-sidebar="icons"] .brand { justify-content: center; padding: var(--sp-4) 0 var(--sp-3); }
html[data-sidebar="icons"] .sidebar .brand-lockup { display: none; }
html[data-sidebar="icons"] .sidebar .brand-mark-only { display: block; }
html[data-sidebar="icons"] .nav { padding: var(--sp-2) var(--sp-2) var(--sp-1); }
html[data-sidebar="icons"] .nav-item { justify-content: center; padding: 10px 0; }
html[data-sidebar="icons"] .nav-item:hover { padding-left: 0; }
html[data-sidebar="icons"] .nav-dot { right: 5px; }
html[data-sidebar="icons"] .side-brand { justify-content: center; padding: var(--sp-2) 0; }
/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--dense-control-h);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-label);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.btn svg {
  width: 15px; height: 15px;
  transition: transform var(--dur-slow) var(--ease-spring);
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn:hover svg { transform: scale(1.12); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 25%, transparent);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 50%, transparent);
}

/* 幽灵按钮：不画盒子，做成品牌色文字按钮——三级动作里最轻的一档。
   原先半透明白底落在灰页上完全没有边界，读者分不清是按钮还是普通文字；
   改成纯文字 + 品牌色后，它靠颜色表明「可点」，而不是靠一层几乎看不出的底色 */
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding-left: var(--sp-2);
  padding-right: var(--sp-2);
}
.btn-ghost:hover {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-hover);
  box-shadow: none;
  transform: none;
}

.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
/* 确认弹窗里的主操作：实心危险色，避免误点 */
.modal-foot .btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-brand);
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--danger) 45%, transparent);
}
.modal-foot .btn-danger:hover {
  background: var(--danger-active);
  border-color: var(--danger-active);
}
.confirm-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--warning-soft);
  color: var(--warning);
}
.confirm-icon svg { width: 17px; height: 17px; }
/* 普通操作（启动、保存、切换等）走品牌色，与删除类高风险操作区分 */
.confirm-icon.tone-primary { background: var(--brand-soft); color: var(--brand); }

.btn-sm { height: var(--dense-btn-sm-h); padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--radius-xs); }
.btn-sm svg { width: 14px; height: 14px; }
/* 纯图标按钮：定宽不收缩，保证始终是正方形 */
.btn-icon { width: var(--dense-control-h); flex-shrink: 0; padding: 0; }
.btn-icon.btn-sm { width: var(--dense-btn-sm-h); }
/* 纯图标按钮：hover 时图标轻微旋转，提示「可刷新 / 可操作」 */
.btn-icon:hover svg { transform: rotate(90deg); }
/* 动效跟着语义走：旋转只适合 refresh/rotate 这类「转一圈」的图标；
   play / power 是开关语义，转了会变成别的形状（→ ↑），改成轻微下沉表示「按下去」 */
.btn-icon[data-icon-motion="press"]:hover svg { transform: scale(0.84); }
/* 有新清单时在按钮右上角点一颗红点：略出边框，用页面底色描一圈，
   避免和按钮描边糊在一起；位置与侧栏更新圆点同规格（7px / --c-red）。 */
.btn-dot-host { position: relative; }
.btn-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--c-red);
  box-shadow: 0 0 0 2px var(--bg);
}

.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur) var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle:hover svg { transform: rotate(24deg); }
.theme-toggle svg { width: 17px; height: 17px; transition: transform var(--dur-slow) var(--ease-spring); }

/* ============ 渲染隔离 ============ */
/* 长列表页（日志、进程表、审计记录）滚动时，浏览器默认会把整页纳入重排范围。
   下面几条把「内容多、更新频繁」的容器声明为独立渲染边界：
   - contain: layout paint 让容器内部的布局与绘制不外溢，父级尺寸变化时不必重算内部
   - content-visibility: auto 让视口外的行跳过渲染，长列表首屏只算可见部分
   - contain-intrinsic-size 给出估算高度，滚动条长度不会因为跳过渲染而剧烈跳动
   不用 contain: size —— 那会让容器高度塌成 0，卡片与表格会直接不可见。 */
.log-view,
.table-wrap,
.timeline {
  contain: layout paint style;
}
.log-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 40px;
}
/* 表格行不参与 content-visibility：display:table-row 不支持布局隔离，
   写了也不生效，反而让「为什么没效果」变成一个坑。表格的隔离靠 .table-wrap 承担。 */
html[data-compact="on"] .log-row {
  contain-intrinsic-size: auto 30px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
  animation: cardIn var(--dur-enter) var(--ease) backwards;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: var(--dense-card-head-y) var(--dense-card-x);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.card-body { padding: var(--dense-card-y); }
.card-footer {
  padding: var(--dense-card-foot-y) var(--dense-card-x);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 统计卡 */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--dense-stat-y) var(--dense-stat-x);
  box-shadow: var(--shadow-sm);
  animation: cardIn var(--dur-enter) var(--ease) backwards;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-label {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-medium);
  margin-bottom: var(--dense-stat-label-gap);
}
.stat-label svg { width: 15px; height: 15px; color: var(--text-3); }
.stat-value {
  font-size: var(--dense-stat-fs);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: var(--lh-display);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.stat-value .unit { font-size: var(--fs-body); font-weight: var(--fw-medium); color: var(--text-3); margin-left: 3px; }
.stat-foot { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--dense-stat-foot-gap); }
.stat-foot svg { width: 13px; height: 13px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ============ 网格 ============ */
.grid { display: grid; gap: var(--dense-grid-gap); }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }

/* ============ 徽标 ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--dense-badge-h);
  padding: 0 var(--sp-2);
  border-radius: var(--radius-xs);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: var(--radius-pill);
  background: currentColor;
  flex-shrink: 0;
}
/* 运行中状态点：呼吸灯（纯 CSS 关键帧，不占用 JS 主线程） */
.badge-success .badge-dot {
  animation: breathe var(--dur-loop) var(--ease-soft) infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.65; box-shadow: 0 0 0 3px transparent; }
}
/* 五种 tone 统一带同色系描边：只加底色时徽标在浅色底上几乎看不出边界，
   描边取各自主色的 28% 透明度，保证与底色、与页面底色都有清晰轮廓 */
.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.badge-idle {
  background: var(--idle-soft);
  color: var(--idle);
  border: 1px solid color-mix(in srgb, var(--idle) 26%, transparent);
}
.badge-brand {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
/* 表头：用比卡片面深一档的实底与下方强分隔线划出表头区，
   原先的 --surface-2 与卡片白、页面灰都太接近，表头几乎浮不起来 */
.table thead th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: var(--dense-th-y) 16px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-3);
  white-space: nowrap;
}
/* @Table 的 Align 参数输出的是 .ta-r / .ta-c（特异性 0,1,0），压不过上面
   .table thead th 的 (0,2,1)：于是「操作」这类右对齐列的标题一直留在左边，
   跟下方靠 .row-actions 右对齐的按钮组错开一整列。这里按同样的前缀提权，
   让 Align 真正生效——改一处，全站 15 个用了 Align 的表格都跟着对齐。 */
.table thead th.ta-r { text-align: right; }
.table thead th.ta-c { text-align: center; }
.table tbody td {
  padding: var(--dense-row-y) 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.table tbody td.wrap { white-space: normal; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.table .row-sep { width: 1px; height: 16px; background: var(--border); margin: 0 1px; flex-shrink: 0; }
.btn-icon-danger { color: var(--text-3); }
.btn-icon-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}
.table .cell-main { font-weight: 550; }
/* 进程名可能是整条命令行：允许换行，固定布局把剩余宽度全留给名称列 */
#proc-table .table { table-layout: fixed; }
#proc-table td.wrap { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
/* 进程表是高频扫读列表：行高比普通表格再紧一档，操作按钮同步缩到 26px */
#proc-table .table tbody td { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
#proc-table .row-actions .btn { width: 26px; height: 26px; }
.table .cell-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
/* 表格内的主名称可点击进入详情：默认继承文字色，hover 变品牌色 */
.table .cell-link { color: inherit; text-decoration: none; transition: color var(--dur-fast) var(--ease); }
.table .cell-link:hover { color: var(--brand); }
/* 表格内的图标需要显式尺寸：Icon 模板只带 viewBox，否则会被撑满或塌成 0 */
.table td svg { width: 14px; height: 14px; flex-shrink: 0; vertical-align: -2px; }

/* 列表项（非表格的紧凑列表） */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--dense-list-y) var(--dense-list-x);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }

/* ============ 表单 ============ */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
/* 分段面板（本地部署 / 远程接入）后面再接独立字段时补一段间距：
   面板内的 .field 有自己的下间距，出了面板就没有了，grid gap 也传不出来，
   间距只能在样式层补，模板不该为这一处去记类名。 */
.modal-body [data-seg-panel] + .field { margin-top: 15px; }
/* 只认直接子级 label：字段标题是「标题 + 右侧帮助」两端对齐，
   但字段内部的单选行 / 复选行也是 label，用后代选择器会把它们
   一起拉成两端对齐（选项在左、文字甩到最右）。 */
.field > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field label a { font-size: var(--fs-xs); color: var(--brand); font-weight: 500; }
.field .help { font-size: var(--fs-xs); color: var(--text-3); margin-top: 5px; }
/* 标题右侧的行内提示（如「按 Enter 添加多个域名」）：跟标签同一行，不再占输入框上方一行 */
.field label .help { margin-top: 0; font-weight: 400; }
/* 表单校验：出错字段红边 + 下方就地提示，配一次轻微抖动把视线拉过去 */
.field .field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: 5px;
}
.field .field-error::before {
  content: "";
  width: 12px; height: 12px;
  flex-shrink: 0;
  border-radius: var(--radius-circle);
  background: var(--danger);
  mask: radial-gradient(circle at 50% 30%, #000 1.5px, transparent 1.6px),
        linear-gradient(#000, #000) 50% 72% / 2px 6px no-repeat;
  -webkit-mask: radial-gradient(circle at 50% 30%, #000 1.5px, transparent 1.6px),
                linear-gradient(#000, #000) 50% 72% / 2px 6px no-repeat;
}
.field .input.invalid,
.field .select.invalid {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 4%, var(--surface));
}
.field .input.invalid:focus,
.field .select.invalid:focus {
  box-shadow: var(--ring-danger);
}
.field.shake { animation: fieldShake var(--dur-slow) var(--ease); }
@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-4px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}
.input, .select, textarea.input {
  width: 100%;
  height: var(--dense-control-h);
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.input::placeholder { color: var(--text-3); }
/* 文件选择：原生「选择文件」按钮跟面板按钮不同源，单独把按钮和文件名排进同一条控件里 */
.input[type="file"] {
  padding: 3px 6px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.3;
}
.input[type="file"]::file-selector-button {
  height: calc(var(--dense-control-h) - 10px);
  margin-right: 10px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.input[type="file"]::file-selector-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.input[type="file"]:focus { border-color: var(--brand); box-shadow: var(--ring); }
/* 只读回显：与可编辑输入框同尺寸，用底色和默认光标表明改不了，
   用于「由系统决定、用户不能改」的值（如分类），避免做成下拉让人误以为可选 */
.input[readonly] {
  background: var(--surface-2);
  cursor: default;
}
.input[readonly]:focus { border-color: var(--border-strong); box-shadow: none; }

.input-group { display: flex; gap: var(--sp-2); align-items: center; }

/* 手机号输入：+86 前缀与号码共用一层边框，聚焦态由容器统一给出 */
.phone-field {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.phone-field:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.phone-field:has(.input.invalid) { border-color: var(--danger); }
.phone-prefix {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0 var(--sp-3);
  border-right: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-body);
}
.phone-field .input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  box-shadow: none;
  /* 比占位符略大但不脱离基线：字号差太大会让 15px 占位符看起来偏低 */
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.phone-field .input::placeholder {
  font-size: var(--fs-body);
  font-weight: 400;
  letter-spacing: 0;
}
.phone-field .input:focus { border: 0; box-shadow: none; }

/* 访问地址：协议用两段按钮选，域名只填主机部分，整组共用一层边框 */
.url-field {
  display: flex;
  align-items: center;
  height: var(--dense-control-h);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.url-field:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.url-scheme {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 2px;
  padding: 0 3px 0 4px;
  border-right: 1px solid var(--border);
}
.url-scheme button {
  height: calc(100% - 8px);
  padding: 0 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.url-scheme button:hover { color: var(--text); }
.url-scheme button.active { background: var(--brand-soft); color: var(--brand); }
.url-field .url-host {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 11px 0 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.url-field .url-host:focus { border: 0; box-shadow: none; }
.url-field .url-host:not(:placeholder-shown) { color: var(--brand); font-weight: 600; }

/* 短信验证码：6 个单格输入，等宽等距，输入时只保留数字 */
.otp-hint { margin-bottom: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.otp-hint b { color: var(--text); font-weight: 600; }
.otp-edit {
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.otp-edit:hover { color: var(--brand-hover); }
.otp-boxes { display: flex; gap: var(--sp-2); }
.otp-box {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0;
  text-align: center;
  font-family: var(--font-num);
  font-size: var(--fs-lg);
  font-weight: 600;
}
.otp-box.invalid { border-color: var(--danger); }
.otp-box.invalid:focus { box-shadow: var(--ring-danger); }
.otp-resend-row { margin-top: 10px; font-size: var(--fs-sm); color: var(--text-3); }
.otp-resend {
  margin-left: var(--sp-1);
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.otp-resend:disabled { color: var(--text-3); cursor: default; }

/* 注册弹窗：入口取 Logo 圆点的青绿，弹窗内的输入聚焦与主按钮同色系。
   只在 #modal-register 内覆盖，全站主操作仍是 --brand 蓝；
   无效态仍用 danger，必须排在聚焦规则之后。 */
#modal-register .input:focus,
#modal-register .select:focus,
#modal-register textarea.input:focus,
#modal-register .phone-field:focus-within {
  border-color: var(--brand-dot-ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-dot) 30%, transparent);
}
#modal-register .phone-field .input:focus { border: 0; box-shadow: none; }
#modal-register .input.invalid:focus,
#modal-register .otp-box.invalid:focus,
#modal-register .phone-field:has(.input.invalid):focus-within {
  border-color: var(--danger);
  box-shadow: var(--ring-danger);
}
#modal-register .btn-primary {
  background: var(--brand-dot-btn);
  border-color: var(--brand-dot-btn);
  color: var(--on-brand-dot);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--brand-dot) 25%, transparent);
}
#modal-register .btn-primary:hover {
  background: var(--brand-dot-btn-hover);
  border-color: var(--brand-dot-btn-hover);
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand-dot) 45%, transparent);
}
#modal-register .btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-dot) 35%, transparent);
}
#modal-register .otp-edit,
#modal-register .otp-resend { color: var(--brand-dot-ink); }
#modal-register .otp-edit:hover {
  color: color-mix(in srgb, var(--brand-dot-ink) 80%, var(--text));
  text-decoration: underline;
  text-underline-offset: 2px;
}
#modal-register .otp-resend:disabled { color: var(--text-3); }

/* 已绑定：注册成功后同弹窗展示账号摘要，不再重复走表单 */
.register-done { padding: 6px 0 2px; text-align: center; }
.register-done-ico {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
}
.register-done-ico svg { width: 23px; height: 23px; }
.register-done-title { font-size: var(--fs-title); font-weight: 600; }
.register-done-phone {
  margin-top: 6px;
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.register-done .help { margin-top: var(--sp-2); }
.register-done-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
  font-size: var(--fs-sm);
  color: var(--text-3);
}

/* 胶囊输入：回车把输入框里的值变成一枚可删胶囊，值用逗号回写隐藏字段。
   用于域名、标签这类「一个字段装多个值」的场景：比逗号分隔看得见边界，
   删错其中一个不用重打整串。外观与 .input 同高同边，可直接放进 .field。 */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: var(--dense-control-h);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.tag-input:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.tag-input .tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  max-width: 100%;
  /* 浅品牌底 + 品牌字：一眼区分「这是一枚可删的输入值」与正文里的普通 .tag */
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  color: var(--brand);
  font-weight: 550;
}
.tag-input .tag > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-input input {
  flex: 1 1 120px;
  min-width: 100px;
  height: 26px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
}
.tag-input input::placeholder { color: var(--text-3); }
/* 胶囊里的删除按钮：默认弱化，hover 才显红，一排 × 不抢注意力 */
.tag-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-circle);
  background: transparent;
  color: color-mix(in srgb, var(--brand) 72%, transparent);
  font-size: var(--fs-sm);
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.tag-x:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* 键帽：把要按的物理键画成一枚凸起小键，用在操作提示里指代 Enter / Esc / Backspace。
   底边比另外三边厚 1px，是唯一的立体手段，不额外加渐变或阴影。 */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  vertical-align: 1px;
}

/* 搜索框 */
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 250px;
}
.search svg {
  position: absolute;
  left: 11px;
  width: 15px; height: 15px;
  color: var(--text-3);
  pointer-events: none;
  transition: color var(--dur-fast) var(--ease);
}
.search input {
  width: 100%;
  height: var(--dense-control-h);
  padding: 0 11px 0 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.search:focus-within svg { color: var(--brand); }

/* 分段控件 / 筛选 */
.segmented {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: var(--dense-seg-pad);
  background: var(--seg-track);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  max-width: 100%;
  overflow-x: auto;
  /* 滑块用弹簧曲线滑动，会先冲过头约 10px；一旦溢出到可滚动区域，
     classic 滚动条出现会把整行撑高，同一行的搜索框就跟着上下跳。
     隐藏滚动条（仍可滚），高度就只由按钮决定 */
  overflow-y: hidden;
  scrollbar-width: none;
  box-shadow: inset 0 0 0 1px var(--border);
}
.segmented::-webkit-scrollbar { display: none; }
/* 滑块：一枚白色实体块在轨道上平滑滑动，选中项只是文字变色 */
.segmented .seg-thumb {
  position: absolute;
  left: 0;
  top: var(--dense-seg-pad);
  height: var(--dense-seg-h);
  border-radius: var(--radius-xs);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.1), 0 2px 8px -2px rgb(var(--shadow-rgb) / 0.16);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: transform var(--dur-slow) var(--ease-spring), width var(--dur-slow) var(--ease-spring),
    opacity var(--dur) var(--ease);
}
.segmented button {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  height: var(--dense-seg-h);
  padding: 0 var(--sp-3);
  white-space: nowrap;
  border: 0;
  background: transparent;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button:active { transform: scale(0.96); }
/* 选中态只改颜色：不改字重，否则按钮变宽会把同一行的搜索框顶走 */
.segmented button.active {
  background: transparent;
  color: var(--brand);
  box-shadow: none;
}
/* 暗色下白色滑块换成高一档的灰面，靠亮度差区分，不刺眼 */
[data-theme="dark"] .segmented { box-shadow: inset 0 0 0 1px var(--border); }
[data-theme="dark"] .segmented .seg-thumb {
  background: var(--surface-3);
  box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.5), inset 0 0 0 1px var(--border-strong);
}

/* 开关 */
/* hidden 必须永远生效：组件里的 display:flex / grid 会盖掉浏览器默认的 display:none，
   开关联动的整块字段一旦 hidden 却仍占位，弹窗里就会留下一片空白。 */
[hidden] { display: none !important; }
.switch {
  position: relative;
  width: 40px; height: 23px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--dur) var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 19px; height: 19px;
  border-radius: var(--radius-pill);
  background: var(--knob);
  box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.2);
  transition: transform var(--dur) var(--ease-spring);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(17px); }

.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--dense-setting-y) 0;
  border-bottom: 1px solid var(--border);
}
.setting-row > * { min-width: 0; }
.setting-row > :first-child { flex: 1 1 auto; }
.setting-row > :last-child { flex-shrink: 0; }
.setting-row .segmented { flex-shrink: 0; max-width: none; }
.setting-row .segmented button { white-space: nowrap; }
.setting-row:first-child { padding-top: 0; }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-row .s-title { font-size: var(--fs-sm); font-weight: 550; margin-bottom: 2px; }
.setting-row .s-desc { font-size: var(--fs-xs); color: var(--text-3); max-width: 460px; }
/* 版本更新说明紧跟来源说明，颜色抬一档，避免两行灰字糊成一段 */
.setting-row .s-desc + .s-desc { margin-top: var(--sp-1); color: var(--text-2); }
/* 区块型设置项：标题在上、控件在下，用于密度选择这类不能用左右排布的内容 */
.setting-block { padding: var(--dense-setting-y) 0; border-bottom: 1px solid var(--border); }
.setting-block .s-title { font-size: var(--fs-sm); font-weight: 550; margin-bottom: 2px; }
.setting-block .s-desc { font-size: var(--fs-xs); color: var(--text-3); max-width: 620px; }
/* 账号行右侧是「状态 + 操作」胶囊组；栏宽不足时整组换行，避免标题被挤成竖排 */
.setting-row.account-row { flex-wrap: wrap; }
.setting-row.account-row > :first-child { flex: 1 1 220px; }
.setting-row.account-row > :last-child { white-space: nowrap; }
/* 端口这类短输入框：桌面定宽，窄屏整行占满，避免说明被挤成一字一行 */
.setting-row .port-input { width: 110px; flex-shrink: 0; }
/* 设置页的端口行曾误用端口编辑器的 .port-row，被 92px 栅格压成窄条；
   改用独立类，并在卡片被两列栅格压窄时让输入框换到下一行 */
.setting-row.setting-port-row { flex-wrap: wrap; row-gap: var(--sp-2); }
.setting-row.setting-port-row > :first-child { flex: 1 1 240px; }
/* 版本行的「可升级 / 已是最新」胶囊与旁边按钮同高、同圆角，放一排才齐平 */
.setting-row.update-row .badge {
  height: var(--dense-btn-sm-h);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  gap: 6px;
}

/* 两个同权重的小开关并排：各占一行会显得表单很散 */
.setting-row.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6);
}
.setting-row.duo > .setting-cell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  min-width: 0;
}
.setting-row.duo .s-desc { max-width: none; }
@media (max-width: 620px) {
  .setting-row.duo { grid-template-columns: 1fr; gap: var(--sp-4); }
  /* 带分段控件的设置项改为上下排列：分段本身不收缩，
     与标题并排会把标题和说明挤成一字一行 */
  .setting-row:has(.segmented) { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row.setting-port-row { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .setting-row.setting-port-row > :first-child { flex: 0 0 auto; }
  .setting-row .port-input { width: 100%; }
  /* 版本行右侧是「徽标 + 按钮」，窄屏并排会把左侧说明挤成一字一行 */
  .setting-row.update-row { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .setting-row.update-row > .flex { flex-wrap: wrap; }
}

/* ============ 进度条 ============ */
.progress {
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  /* 打开页面时从 0 生长到目标宽度，纯 CSS 实现 */
  animation: barGrow var(--dur-grow) var(--ease) backwards;
  transition: width var(--dur-slow) var(--ease);
}
/* 用裁剪揭示代替 scaleX：横向缩放会把 999px 的圆角压成尖角，62% 这类中间值尤其明显 */
@keyframes barGrow {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* 迷你条形图（占比可视化） */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
/* label 可能是模型名这类长文本：最短 66px，超出按内容撑宽（不超过半行）并单行省略，不折行 */
.bar-row .bar-label {
  flex: 0 0 auto;
  min-width: 66px;
  max-width: 45%;
  font-size: var(--fs-sm);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-row .bar-track { flex: 1; height: 7px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.bar-row .bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  animation: barGrow var(--dur-grow) var(--ease) backwards;
}
.bar-row .bar-fill.success { background: var(--success); }
.bar-row .bar-fill.warning { background: var(--warning); }
.bar-row .bar-fill.danger { background: var(--danger); }
.bar-row .bar-value { width: 52px; text-align: right; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: var(--num-variant, tabular-nums); }

/* ============ 空状态 ============ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--dense-empty-pad);
  text-align: center;
}
.empty .empty-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}
.empty .empty-icon svg { width: 20px; height: 20px; }
.empty .empty-icon .spinner { width: 20px; height: 20px; }
.empty .empty-title { font-size: var(--fs-body); font-weight: 600; }
.empty .empty-desc { font-size: var(--fs-sm); color: var(--text-3); max-width: 320px; }
/* 表格空态行：去掉单元格自身的边框与内边距，让 Empty 的留白接管 */
.empty-row > td { padding: 0; border-bottom: 0; }
.empty-row .empty { padding: 40px var(--sp-5); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--dense-mask-pad);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.modal-mask.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}
.modal-mask.open .modal { transform: none; opacity: 1; }
/* 尺寸档位必须写在 .modal 之后：同权重，靠后者生效 */
.modal-sm { max-width: 430px; }
.modal-lg { max-width: 620px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--dense-modal-head);
}
.modal-head h3 { font-size: var(--fs-title); font-weight: var(--fw-bold); }
.modal-head p { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--text-3); }
.modal-body { padding: var(--dense-modal-body); overflow-y: auto; overflow-x: hidden; }
/* 连接信息：长 DSN 与操作按钮各自可换行，不能把弹窗撑出横向滚动 */
.db-dsn-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.db-dsn-row > .mono, .db-dsn-row [data-db-dsn] { min-width: 0; overflow-wrap: anywhere; word-break: break-all; }
.db-dsn-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.db-account-row { flex-wrap: wrap; }
.db-account-row > :first-child { flex: 1 1 220px; min-width: 0; }
.db-account-row > :last-child { flex-shrink: 0; }
/* 弹窗里的页签面板互斥显示，一屏只看得到一块：
   区块间距（.dk-sec 的 margin-bottom）在这里没人接，只会在底部堆出一段空白 */
.modal-body [data-tab-panel-group] > .dk-sec { margin-bottom: 0; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--dense-modal-foot-y) 20px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.modal-close {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: var(--radius-xs);
  color: var(--text-3); cursor: pointer; flex-shrink: 0;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }

/* ============ 任务进度弹窗 ============ */
.task-modal { max-width: 452px; }
.task-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--dense-modal-head);
}
.task-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.task-icon svg { width: 17px; height: 17px; }
/* 执行中图标持续旋转，给出「正在跑」的即时感知 */
.task-modal.running .task-icon svg { animation: taskSpin var(--dur-grow) linear infinite; }
@keyframes taskSpin { to { transform: rotate(360deg); } }
.task-modal.done .task-icon { background: var(--success-soft); color: var(--success); }
.task-modal.failed .task-icon { background: var(--danger-soft); color: var(--danger); }
.task-head-text { flex: 1; min-width: 0; }
.task-head-text h3 { font-size: var(--fs-body); font-weight: 650; }
.task-head-text p { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--text-3); }

.task-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5) 14px;
}
.task-bar {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.task-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--brand);
  transition: width var(--dur-enter) var(--ease), background-color var(--dur-slow) var(--ease);
}
.task-modal.done .task-bar span { background: var(--success); }
.task-modal.failed .task-bar span { background: var(--danger); }
.task-pct {
  width: 40px;
  text-align: right;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.task-steps {
  padding: var(--dense-task-steps);
  max-height: 268px;
  overflow-y: auto;
}
.task-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: var(--dense-task-step-y) 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.task-step-ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.task-step-ico svg { width: 15px; height: 15px; }
.task-step-text { flex: 1; min-width: 0; line-height: 1.5; }
.task-step-meta {
  flex-shrink: 0;
  font-size: var(--fs-2xs);
  color: var(--text-3);
  font-variant-numeric: var(--num-variant, tabular-nums);
  padding-top: 2px;
}
/* 待执行：灰点 */
.task-step[data-state="pending"] .task-step-ico::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: var(--radius-circle);
  background: var(--border-strong);
}
/* 执行中：旋转环 + 高亮文字 */
.task-step[data-state="running"] { color: var(--text); }
.task-step[data-state="running"] .task-step-ico { color: var(--brand); }
.task-step[data-state="running"] .task-step-ico svg { animation: taskSpin var(--dur-grow) linear infinite; }
.task-step[data-state="running"] .task-step-text::after {
  content: "…";
  display: inline-block;
  margin-left: 1px;
  animation: taskPulse var(--dur-pulse) var(--ease-soft) infinite;
}
@keyframes taskPulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
/* 完成：绿色对勾，文字回到次级色 */
.task-step[data-state="done"] .task-step-ico { color: var(--success); }
.task-step[data-state="done"] .task-step-meta { color: var(--success); }
/* 失败：红色，文字加粗提示 */
.task-step[data-state="failed"] { color: var(--danger); font-weight: 500; }
.task-step[data-state="failed"] .task-step-ico { color: var(--danger); }
/* 跳过：整体淡化 */
.task-step[data-state="skip"] { color: var(--text-3); }
.task-step[data-state="skip"] .task-step-ico { color: var(--text-3); }
.task-step[data-state="skip"] .task-step-text { text-decoration: line-through; }

/* 新步骤入场：轻微上移淡入，形成逐条滚动的节奏感 */
.task-step.enter { animation: stepIn var(--dur-slow) var(--ease) backwards; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.task-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  padding: 14px var(--sp-5) var(--sp-4);
  margin-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.task-foot > .btn { align-self: flex-end; }
.task-foot:empty { display: none; }
.task-summary {
  flex: none;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.5;
}
.task-summary b { color: var(--text); font-weight: 600; }
.task-modal.done .task-summary b { color: var(--success); }
.task-modal.failed .task-summary b { color: var(--danger); }
/* 启停完成后的资源账：单独一块，比摘要更醒目一点 */
.task-res {
  margin-top: var(--sp-2);
  padding: var(--sp-2) 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.6;
}
.task-res b { color: var(--text); font-weight: 600; font-family: var(--num-font); font-variant-numeric: var(--num-variant, tabular-nums); }
/* 一次性密码：结果里直接给出可复制的内容，避免「已重置」却拿不到密码 */
.task-secret { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-secret code {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-secret .btn { height: 32px; padding: 0 10px; font-size: var(--fs-xs); }
.task-secret-note { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); }

/* ============ 登录页 ============ */
/* 单卡片居中：品牌在卡上方，页面底只留一层静态品牌光晕，不做动效 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-7) var(--sp-5);
  background:
    radial-gradient(720px 420px at 50% -8%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 72%),
    var(--bg);
}
.login-shell {
  width: 100%;
  max-width: 368px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-wrap .login-brand {
  display: flex;
  align-items: center;
  padding: 0;
  margin-bottom: 28px;
  color: var(--text);
}
.login-card {
  width: 100%;
  padding: 30px 30px var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; margin-bottom: 6px; }
.login-card .login-sub { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--sp-6); }
.login-card .btn-primary { width: 100%; height: 40px; font-size: var(--fs-sm); }
.login-tip {
  display: flex; gap: var(--sp-2);
  margin-top: 18px;
  padding: 10px var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.login-tip svg { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; margin-top: 1px; }
.login-foot { margin-top: var(--sp-5); font-size: var(--fs-xs); color: var(--text-3); }

/* ============ 图表 ============ */
.chart-wrap { position: relative; padding: var(--sp-1) 0 0; }
.chart-svg { width: 100%; height: 150px; display: block; overflow: visible; }
.chart-legend { display: flex; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--text-2); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: var(--radius-3xs); display: inline-block; }

/* 图表悬停：圆点吸附到最近的采样点，落在曲线上，不画竖线干扰图形。
   外圈用卡片底色描边，两条曲线挨得近时也能分清各自的点。 */
.chart-dot {
  position: absolute;
  z-index: 2;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: var(--radius-circle);
  background: var(--dot);
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.chart-dot.show { opacity: 1; }
.chart-tip {
  position: absolute;
  z-index: var(--z-popover);
  min-width: 124px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-size: var(--fs-2xs);
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.chart-tip.show { visibility: visible; opacity: 1; }
.chart-tip-time {
  margin-bottom: 3px;
  color: color-mix(in srgb, var(--surface) 62%, transparent);
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.chart-tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  white-space: nowrap;
}
.chart-tip-row > span { display: flex; align-items: center; gap: 5px; }
.chart-tip-row i {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-3xs);
  display: inline-block;
}
.chart-tip-row b { font-weight: 600; font-family: var(--num-font); font-variant-numeric: var(--num-variant, tabular-nums); }
.chart-tip-unit { font-weight: 400; opacity: 0.6; }

/* 日志查看器（行样式见文件末尾「日志」区块） */
.log-line { display: flex; gap: 10px; white-space: pre-wrap; }
.log-line .log-time { color: var(--text-3); flex-shrink: 0; }
.log-line .log-tag { flex-shrink: 0; font-weight: 600; }
.log-line .log-tag.info { color: var(--brand); }
.log-line .log-tag.warn { color: var(--warning); }
.log-line .log-tag.err { color: var(--danger); }
.log-line .log-tag.ok { color: var(--success); }

/* 时间轴 */
.timeline { position: relative; padding-left: var(--dense-timeline-x); }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.tl-item { position: relative; padding-bottom: var(--dense-tl-gap); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: var(--dense-tl-dot); top: 5px;
  width: 7px; height: 7px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
}
.tl-item.active::before { border-color: var(--brand); background: var(--brand); }
.tl-item .tl-title { font-size: var(--fs-sm); font-weight: 550; }
.tl-item .tl-desc { font-size: var(--fs-xs); color: var(--text-3); }

/* 键值对展示 */
.kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--dense-kv-y) var(--dense-kv-x); font-size: var(--fs-sm); }
/* 标签用 --text-3 时 13px 中文在白底上偏虚，提到 --text-2 后笔画更实 */
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; color: var(--text); min-width: 0; }

/* 复制按钮 */
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: 0; background: transparent; border-radius: var(--radius-2xs);
  color: var(--text-3); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn svg { width: 13px; height: 13px; }

/* 密码显隐：闭眼 / 睁眼两个图标都在 DOM 里，只切显示，避免 JS 去拼 svg */
.ico-masked, .ico-plain { display: flex; align-items: center; }
.ico-plain { display: none; }
[data-secret][data-shown="1"] .ico-masked { display: none; }
[data-secret][data-shown="1"] .ico-plain { display: flex; }

/* 提示气泡 */
.tip {
  display: flex;
  gap: 9px;
  padding: var(--dense-tip-pad);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  line-height: 1.6;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.tip svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.tip-info { background: var(--brand-soft); border-color: var(--brand-border); color: var(--text-2); }
.tip-info svg { color: var(--brand); }
.tip-success { background: var(--success-soft); border-color: var(--success-border); color: var(--text-2); }
.tip-success svg { color: var(--success); }
.tip-warn { background: var(--warning-soft); border-color: var(--warning-border); color: var(--text-2); }
.tip-warn svg { color: var(--warning); }
.tip-danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--text-2); }
.tip-danger svg { color: var(--danger); }
/* 面板里的纵向节奏统一放到样式层，模板不再逐处手写 mb-*：
   1) 两张卡片相邻（多数是「grid 包一组卡片」后面再跟一张）留 20px；
   2) 提示条前面只要有内容（键值行、表单、help 文案、按钮）就留 12px。
   以前靠每个面板记得加类，漏一处就贴在一起——这类回归已经出现过四次。 */
.dk-sec > .card + .card,
.dk-sec > .card + .grid,
.dk-sec > .grid + .card { margin-top: var(--sp-5); }

.dk-sec .tip:not(:first-child) { margin-top: var(--sp-3); }

/* 页面级提示条不在 .dk-sec 里，模板也没有逐处补类：
   后面接网格 / 卡片 / 页签时在这里统一留 16px，否则会直接贴边。 */
.content > .tip:not(:last-child) { margin-bottom: var(--sp-4); }

/* 弹窗正文沿用同一套节奏。上面那条只写在 .dk-sec 作用域里，
   弹窗中的「提示 + 表格」就一直贴在一起——间距交回样式层管，模板不逐处补类。 */
.modal-body .tip { margin-bottom: var(--sp-3); }
.modal-body .tip:not(:first-child) { margin-top: var(--sp-3); }
.modal-body .tip:last-child { margin-bottom: 0; }

/* 图标提示气泡：悬停 / 键盘聚焦时浮在图标上方，深底亮字，替代原生 title。
   原生 title 有约 1 秒延迟、样式不可控、暗色下被系统渲染成浅灰底，与设计系统脱节。
   JS 只负责定位与显隐，外观全部在这里；配色同 .toast（--text 深底 + --surface 亮字），
   暗色主题下自动反过来，不会出现一块突兀的黑条。 */
.tip-pop {
  position: fixed;
  z-index: var(--z-popover);
  max-width: 240px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-family: var(--font);
  font-size: var(--fs-2xs);
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.tip-pop.show { opacity: 1; transform: translateY(0); }

/* ============ 服务器状态：环形图 / 指标 / 网络 ============ */
.metric { display: flex; align-items: center; gap: var(--sp-4); }
/* 外壳固定 1440 后四列卡只有约 270px，环形图收一档，右侧三行数值才不挤出卡片 */
.metric .donut { width: 96px; height: 96px; }
.metric-rows { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-sm);
  padding-bottom: var(--sp-2);
  border-bottom: 1px dashed var(--border);
}
.metric-row:last-child { padding-bottom: 0; border-bottom: 0; }
.metric-row .k { color: var(--text-3); white-space: nowrap; }
/* 路径、入口地址和动作说明会比卡片宽：允许在值里换行，不再整行溢出后被卡边裁掉。 */
.metric-row .v {
  min-width: 0;
  font-weight: 600;
  font-variant-numeric: var(--num-variant, tabular-nums);
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
}
/* 概览资源卡：右侧三行指标收紧到最小档，与圆环高度对齐，不再被行距撑高 */
.metric .metric-rows { gap: var(--sp-1); }
.metric .metric-row { padding-bottom: var(--sp-1); }
/* 资源卡内的可选行：点一下把同一张卡的环形图切到这一项（多块盘 / 多张卡），再点回到合计 */
.metric-row.metric-pick {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.metric-row.metric-pick:hover .k,
.metric-row.metric-pick.active .k { color: var(--text); }
.metric-row.metric-pick.active .v { color: var(--brand); }

.donut { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-track {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 9;
}
.donut-ring {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dasharray var(--dur-enter) var(--ease);
  /* 打开页面时环从起点生长，纯 CSS 关键帧，无 JS 开销 */
  animation: donutDraw var(--dur-grow) var(--ease) backwards;
}
@keyframes donutDraw {
  from { stroke-dashoffset: 264; }
  to { stroke-dashoffset: 0; }
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}
.donut-value {
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.donut-unit { font-size: var(--fs-2xs); color: var(--text-3); }

.net-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.net-stat .ns-label {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 3px;
}
.net-stat .ns-label svg { width: 14px; height: 14px; }
.net-stat .ns-value {
  font-size: var(--fs-lg); font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.net-stat .ns-unit { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); margin-left: 3px; }

/* 网络卡下半部分：连接数是独立维度，与流量共用 24h 口径。
   用细分隔线分段，紧凑图不再画坐标，避免和上面的流量图抢视线。 */
.conn-block {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.conn-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin-bottom: var(--sp-1);
}
.conn-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.conn-title svg { width: 14px; height: 14px; color: var(--text-3); }
.conn-meta {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.conn-meta b { font-size: var(--fs-sm); color: var(--text); }
.conn-svg { width: 100%; height: 56px; display: block; overflow: visible; }

/* 负载：三格数值 + 每条负载的横向进度图示 */
.load-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.load-item {
  text-align: center;
  padding: 11px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.load-item:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.load-item .l-value {
  font-size: var(--fs-lg); font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.load-item .l-label { font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
.load-item .l-track {
  height: 7px;
  margin-top: var(--sp-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.load-item .l-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--c-blue);
  animation: barGrow var(--dur-grow) var(--ease) backwards;
}
.load-item .l-fill.warn { background: var(--c-amber); }
.load-item .l-fill.danger { background: var(--danger); }

/* 负载说明条：数值 + 文字结论 */
.load-note {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: 14px;
  padding: 9px var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.load-note svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }
.load-note.warn { background: var(--warning-soft); border-color: var(--warning-border); }
.load-note.warn svg { color: var(--warning); }
.load-note.danger { background: var(--danger-soft); border-color: var(--danger-border); }
.load-note.danger svg { color: var(--danger); }


/* 数据库页：窄屏表格横向滚动时固定库名与操作列，
   滚动提示只在需要横向滚动的宽度出现，不与桌面端的完整表格重复。 */
.table-scroll-hint { display: none; }
.link { color: var(--brand); text-decoration: none; }
.link:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .table-scroll-hint { display: block; padding: 0 0 var(--sp-2); }
  #db-table .col-check { display: none; }
  #db-table th:nth-child(2),
  #db-table td:nth-child(2),
  #db-inst-table th:nth-child(1),
  #db-inst-table td:nth-child(1),
  #backup-table th:nth-child(1),
  #backup-table td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--border);
  }
  #db-table th:last-child,
  #db-table td:last-child,
  #db-inst-table th:last-child,
  #db-inst-table td:last-child,
  #backup-table th:last-child,
  #backup-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: -1px 0 0 var(--border);
  }
  #db-table tbody tr:hover td:nth-child(2),
  #db-table tbody tr:hover td:last-child,
  #db-inst-table tbody tr:hover td:first-child,
  #db-inst-table tbody tr:hover td:last-child,
  #backup-table tbody tr:hover td:first-child,
  #backup-table tbody tr:hover td:last-child {
    background: var(--surface-2);
  }
}

@media (max-width: 900px) {
  .db-sec-actions { flex: 1 0 100%; flex-wrap: wrap; width: 100%; min-width: 100%; }
  .db-sec-actions .segmented { width: 100%; }
  .db-sec-actions .segmented button { flex: 1 1 0; min-width: 0; padding: 0 var(--sp-1); font-size: var(--fs-2xs); overflow: hidden; text-overflow: ellipsis; }
  .db-backup-actions { flex-wrap: wrap; }
  #db-table th:nth-child(2), #db-table td:nth-child(2) { min-width: 180px; max-width: 210px; }
  #db-table td:nth-child(2) .cell-sub { white-space: normal; line-height: 1.45; }
}

.db-mobile-meta { display: none; }
@media (max-width: 900px) {
  /* 窄屏不再依赖横向滚动：只留「名称 + 操作」两列，
     被隐藏的实例、大小、状态补到名称下方的一行小字里。 */
  .table-scroll-hint { display: none; }
  #db-table th:nth-child(n+3):not(:last-child),
  #db-table td:nth-child(n+3):not(:last-child),
  #db-inst-table th:nth-child(n+2):not(:last-child),
  #db-inst-table td:nth-child(n+2):not(:last-child),
  #backup-table th:nth-child(n+2):not(:last-child),
  #backup-table td:nth-child(n+2):not(:last-child) { display: none; }
  #db-table th:nth-child(2), #db-table td:nth-child(2) { min-width: 0; max-width: none; }
  .db-mobile-meta { display: block; margin-top: 3px; }
}

@media (max-width: 900px) {
  .grid.db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .db-stats .stat { padding: 14px; }
  .db-stats .stat-value { font-size: var(--fs-xl); }
  .db-stats .stat-foot { font-size: var(--fs-2xs); line-height: 1.4; }
  .table .row-actions { gap: 3px; }
  .table .row-actions .btn-icon.btn-sm { width: 24px; height: 24px; }
  #db-table table, #db-inst-table table, #backup-table table { table-layout: fixed; }
  #db-table th:first-child, #db-table td:first-child,
  #db-inst-table th:first-child, #db-inst-table td:first-child,
  #backup-table th:first-child, #backup-table td:first-child { white-space: normal; }
  #db-table th:last-child, #db-table td:last-child { width: 120px; }
  #db-inst-table th:last-child, #db-inst-table td:last-child { width: 140px; }
  [data-db-row-restart] { display: none; }
  #backup-table th:last-child, #backup-table td:last-child { width: 110px; }
  #backup-table td:first-child { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
  #db-inst-table td:first-child .cell-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .db-inst-icon { display: none; }
}

/* 库名列的长备注与风险标签不再把表格撑出卡片；
   窄屏下这一列改为两行小字，桌面端则限制宽度并允许副标题换行。 */
@media (min-width: 901px) {
  #db-table th:nth-child(2), #db-table td:nth-child(2) { width: 240px; max-width: 240px; }
  #db-table td:nth-child(2) .cell-sub { white-space: normal; }
}

/* 窄屏弹窗里的键值对改为上下排列：长连接串能拿到整行宽度，标签也不会被挤成两行。 */
@media (max-width: 620px) {
  .modal .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .modal .kv dt { margin-top: 10px; font-size: var(--fs-xs); }
  .modal .kv dt:first-child { margin-top: 0; }
  .modal .kv dd + dt { margin-top: 10px; }
}

/* 实例配置在窄屏改成参数卡片：三列放进 330px 会逼出横向滚动，
   说明文字也会被推到屏幕外。 */
@media (max-width: 620px) {
  #modal-inst-config .table-wrap { overflow: visible; }
  #modal-inst-config .table { min-width: 0; }
  #modal-inst-config .table,
  #modal-inst-config .table tbody,
  #modal-inst-config .table tr,
  #modal-inst-config .table td { display: block; width: 100%; }
  #modal-inst-config .table thead { display: none; }
  #modal-inst-config .table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  #modal-inst-config .table tr:last-child { border-bottom: 0; }
  #modal-inst-config .table td { padding: 0; border: 0; }
  #modal-inst-config .table td:first-child { font-size: var(--fs-sm); }
  #modal-inst-config .table td:nth-child(2) { margin-top: 2px; }
  #modal-inst-config .table td:nth-child(3) { margin-top: var(--sp-1); color: var(--text-3); font-size: var(--fs-xs); }
}

/* ============ 工具条（搜索 + 筛选） ============ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.toolbar .search { width: 250px; }
@media (max-width: 620px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search { width: 100%; }
}

/* ============ 运行环境 ============ */
.app-card { display: flex; flex-direction: column; }
.app-card .card-body { padding: var(--dense-app-card-y) var(--dense-app-card-x); flex: 1; }
.app-card .card-footer { padding: var(--dense-card-foot-y) var(--dense-app-card-x); background: transparent; border-top: 1px solid var(--border); }
.app-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: var(--sp-3); }
/* 卡片头部只有图标与名字，垂直居中最平衡。
   右上角最多叠两枚徽标（运行中 + 可升级），头部按两枚的高度预留，
   没升级的卡片也占住这段，否则同一行卡片的描述会错开 12px */
.app-card .app-head {
  align-items: center;
  margin-bottom: 10px;
  min-height: calc(var(--dense-badge-h) * 2 + 2px);
}
/* 版本·分类现在跟在描述后面，作为卡片底部的小字元信息 */
.app-card .app-desc { margin-bottom: 6px; }
.app-card .app-meta { margin-top: 0; }
.app-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--dur-slow) var(--ease-spring);
}
.app-icon svg { width: 20px; height: 20px; }
/* 四列排布下卡片只有 230px 左右，图标收一档，
   把宽度让给名字和右上角状态，PostgreSQL、Open WebUI 才不至于断行 */
.app-card .app-icon { width: 34px; height: 34px; border-radius: var(--radius-md); }
.app-card .app-icon svg { width: 18px; height: 18px; }
/* 表格行内的紧凑尺寸，用于项目类型等列表场景 */
.app-icon-sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.app-icon-sm svg { width: 15px; height: 15px; }
.app-card:hover .app-icon { transform: scale(1.08) rotate(-4deg); }
.app-icon.tone-blue { background: var(--brand-soft); color: var(--brand); }
.app-icon.tone-violet { background: color-mix(in srgb, var(--c-violet) 12%, transparent); color: var(--c-violet); }
.app-icon.tone-amber { background: color-mix(in srgb, var(--c-amber) 12%, transparent); color: var(--c-amber); }
.app-icon.tone-teal { background: color-mix(in srgb, var(--c-teal) 12%, transparent); color: var(--c-teal); }
.app-name {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-body); font-weight: 650; letter-spacing: -0.01em;
}
.app-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
/* meta 行里的版本下拉：.picker-block 默认块级整宽，会把「· 分类」顶到下一行，
   卡片因此比同排高 20px。这里收回行内宽度，让版本和分类同一行 */
.app-card .app-meta .picker.picker-block { display: inline-block; width: auto; vertical-align: middle; }
.app-card .app-meta .picker-btn-block {
  width: auto;
  height: 22px;
  padding: 0 6px 0 var(--sp-2);
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 550;
}
.app-desc {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.6;
  min-height: 43px;
}
/* 状态钉在卡片右上角：竖排右对齐，不参与名称压缩。
   两枚徽标（运行中 + 可升级）叠起来正好 46px，与左侧名称块等高，
   所以同一行卡片的描述文字仍然齐平 */
.app-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.grid-empty { grid-column: 1 / -1; }

/* 安装任务：每个任务一段，用间距而非分隔线区分 */
.install-task { padding: 14px 0; border-bottom: 1px solid var(--border); }
.install-task:first-child { padding-top: 0; }
.install-task:last-of-type { border-bottom: 0; padding-bottom: 0; }
.install-task .progress { margin-top: 10px; }

/* 描述槽：描述+版本、安装进度、装完结论三态共用同一格。
   槽高按两行描述 + 一行版本定死，切换时高度不变——
   网格里同排卡片会被最高的一张拉高，撑高一张等于整排跳动 */
.app-slot { position: relative; min-height: 72px; }
/* 描述封顶两行：槽高才有确定值，整排都在安装时行高也不会塌 */
.app-slot .app-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.app-brief[hidden],
.app-install-progress[hidden],
.app-install-done[hidden],
.app-install-actions[hidden] { display: none; }
/* 卡片内联安装进度：占住描述位，不再把页脚撑高 */
.app-install-progress { display: flex; flex-direction: column; gap: 6px; }
.app-install-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.app-install-step {
  font-size: var(--fs-sm); font-weight: 550; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-install-pct { font-size: var(--fs-xs); font-weight: 600; color: var(--brand); }
.app-install-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-install-done { display: flex; flex-direction: column; gap: var(--sp-1); }
.app-install-ok {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--success);
}
.app-install-ok svg { width: 15px; height: 15px; }
.app-card.installing { border-color: var(--brand); }
.app-card.installed { border-color: var(--brand-dot); }
/* 安装完成后的资源占用说明：两行封顶，超出省略，保证不越出描述槽 */
.app-install-res {
  font-size: var(--fs-2xs);
  line-height: 1.5;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.app-install-res[hidden] { display: none; }
.app-install-res b { color: var(--text-2); font-weight: 600; font-family: var(--num-font); font-variant-numeric: var(--num-variant, tabular-nums); }



/* 概览三张资源卡的 24h 迷你趋势：做成卡片底部的整条图带，
   浅灰底 + 顶部发丝线，折线下方带同色面积，悬停复用圆点与浮层 */
.page-tools.dash-tools { justify-content: flex-end; }
/* 去掉页头状态胶囊后只剩操作组：窄屏允许换行，避免三个按钮向左顶出内容区 */
.page-tools.dash-tools > .flex { flex-wrap: wrap; justify-content: flex-end; row-gap: var(--sp-2); }
.dash-stat-card { display: flex; flex-direction: column; }
.dash-stat-card > .card-body { flex: 1; }
.card-body.dash-spark-body { display: flex; flex-direction: column; }
.card-body.dash-spark-body > .metric { margin-bottom: 12px; }
.dash-spark {
  position: relative;
  margin: auto calc(var(--dense-card-x) * -1) calc(var(--dense-card-y) * -1);
  padding: 7px var(--dense-card-x) 9px;
  background: linear-gradient(to bottom, var(--surface) 0%, var(--surface-2) 100%);
}
.spark-grid { stroke: var(--border); stroke-opacity: 0.9; }
.spark-grid line { vector-effect: non-scaling-stroke; }
.spark-grid .spark-baseline { stroke: var(--border-strong); stroke-opacity: 0.8; }
.dash-spark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 4px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.dash-spark .chart-svg { height: 34px; }
.dash-spark-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-left: var(--sp-1);
  white-space: nowrap;
}
.dash-spark-key i { display: inline-block; width: 10px; height: 2px; border-radius: var(--radius-3xs); }
.dash-spark-key .k-avg { background: var(--spark, var(--text-2)); }
.dash-spark-key .k-peak { background: repeating-linear-gradient(90deg, var(--text-3) 0 3px, transparent 3px 5px); }
/* 四卡并排时图例与历史范围文案会挤压出卡片，隐藏图例；悬浮提示仍区分平均/峰值。 */
.dash-stats.grid-4 .dash-spark-key { display: none; }
.dash-spark-label, .dash-spark-range { white-space: nowrap; }
.dash-spark .chart-dot { box-shadow: 0 0 0 2px var(--surface-2); }
.dash-spark .chart-tip { top: auto !important; bottom: calc(100% + 6px); }

/* 重启面板进度：真实健康检查驱动，不伪造步骤 */
.restart-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 0 2px;
  text-align: center;
}
.restart-progress-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-circle);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.restart-progress-icon svg {
  width: 21px; height: 21px;
  animation: taskSpin var(--dur-grow) linear infinite;
}
.restart-progress.is-done .restart-progress-icon { color: var(--success); }
.restart-progress.is-done .restart-progress-icon svg { animation: none; }
.restart-progress-state { font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.restart-progress .progress { width: 100%; margin-top: 2px; }
.progress.is-indeterminate .progress-bar {
  width: 36% !important;
  animation: restartSlide 1.1s var(--ease-soft) infinite;
  transition: none;
}
@keyframes restartSlide {
  0% { margin-left: -36%; }
  100% { margin-left: 100%; }
}
html[data-motion="off"] .restart-progress-icon svg,
html[data-motion="off"] .progress.is-indeterminate .progress-bar { animation: none; }

/* ============ 文件管理 ============ */
/* 页签行右侧留出「正在上传」入口，只在有上传任务时出现 */
.page-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--dense-pill-mb);
}
.page-tabs-row .pill-tabs { margin-bottom: 0; }
.upload-live[hidden] { display: none; }
.upload-live { flex: 0 0 auto; }
.upload-live-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* 磁盘与回收站信息放进文件表头，跟随表格一起刷新 */
.files-table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px var(--sp-5);
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.file-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.file-summary-item svg { width: 15px; height: 15px; color: var(--text-3); flex-shrink: 0; }
.file-summary-item b { color: var(--text); font-weight: 600; font-family: var(--num-font); font-variant-numeric: var(--num-variant, tabular-nums); }

/* 上传队列：折叠在文件表格上方，有任务时才出现；展开时也不离开当前目录 */
.upload-queue { border-bottom: 1px solid var(--border); }
.upload-queue > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.upload-queue > summary::-webkit-details-marker { display: none; }
.upload-queue-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--text);
}
.upload-queue-title svg { width: 15px; height: 15px; color: var(--text-3); }
.upload-queue-caret {
  margin-left: auto;
  display: inline-flex;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}
.upload-queue-caret svg { width: 15px; height: 15px; }
.upload-queue[open] .upload-queue-caret { transform: rotate(180deg); }
.upload-queue-body { border-top: 1px solid var(--border); }
/* 队列是展开时才有内容的实时状态，再播一遍生长动画会让人误以为上传重新开始了 */
.upload-queue .progress-bar { animation: none; }

/* 文件页工具栏：面包屑占一列、操作组占一列；长目录名只省略自己，不挤压按钮。
   窄屏改为上下两行，操作组允许换行。 */
.dk-toolbar.files-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.files-path-row { min-width: 0; }
.files-actions { flex: 0 0 auto; flex-wrap: wrap; min-width: 0; }
/* 搜索框保底 180px：操作组变窄时换行，而不是把输入框挤成只剩放大镜 */
.files-actions .search { flex: 0 1 250px; width: 250px; min-width: 180px; }
.files-actions .picker { flex: 0 0 156px; width: 156px; min-width: 0; }
.files-toolbar .file-path {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}
.file-path a,
.file-path strong {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 祖先目录保持完整，只有当前目录名让出空间；单个祖先过长时自己也省略。 */
.file-path > a { flex: 0 0 auto; max-width: 220px; }
.file-path > strong { flex: 1 1 auto; }
.file-path a > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-path a svg { flex: 0 0 auto; }
.file-path .sep { flex: 0 0 auto; }
@media (max-width: 900px) {
  .dk-toolbar.files-toolbar { grid-template-columns: minmax(0, 1fr); }
  .files-toolbar > :last-child { flex-wrap: wrap; }
}

.file-path {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.file-path a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 550;
}
.file-path a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* 目录名称与图标是链接：单击进入，悬停名称加下划线；文件保持中性色 */
.file-name-link { color: var(--brand); }
.file-name-link .file-icon { color: var(--brand); }
.file-name-link:hover .cell-main { text-decoration: underline; text-underline-offset: 3px; }
.file-path .sep { color: var(--border-strong); margin: 0 2px; }

.files-sort { width: 156px; flex: 0 0 auto; }
.search.has-clear input { padding-right: 30px; }
.search-clear {
  position: absolute;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-xs);
  color: var(--text-3);
}
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--text); background: var(--surface-2); }
.search-clear svg { position: static; width: 13px; height: 13px; pointer-events: auto; }

/* 文件操作弹窗的目标提示：让用户确认自己在改哪一个文件 */
.file-target {
  font-size: var(--fs-xs);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  margin-bottom: 14px;
  word-break: break-all;
}
.file-target:empty { display: none; }
.file-more-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.file-more-list .btn { justify-content: flex-start; }

/* 窄屏把移动 / 重命名 / 权限收进「更多」，行内只留进入、编辑、下载、删除 */
.file-row-more { display: none; }
@media (max-width: 1180px) {
  .row-actions .row-secondary { display: none; }
  .file-row-more { display: inline-flex; }
  /* 所有者仍可在「权限」弹窗里查看，窄屏优先保证操作列完整可见 */
  #files-table thead th:nth-child(5),
  #files-table tbody td:nth-child(5) { display: none; }
}

.file-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 0;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease), transform var(--dur) var(--ease-spring);
}
.file-icon svg { width: 15px; height: 15px; }
.table tbody tr:hover .file-icon { color: var(--brand); transform: scale(1.08); }
.file-name { display: flex; align-items: center; gap: 10px; }
/* 只有目录能双击进入：名称与图标常驻链接色，文件和目录一眼可分 */
#files-table tbody tr[data-file-kind=dir] .file-name { cursor: pointer; }
#files-table tbody tr[data-file-kind=dir] .cell-main {
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
}
#files-table tbody tr[data-file-kind=dir] .cell-main:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
#files-table tbody tr[data-file-kind=dir] .file-icon { color: var(--brand); }

/* 文件表比通用表格更紧凑：行高收到操作按钮 30px + 上下 7px */
#files-table tbody td { padding-top: 7px; padding-bottom: 7px; }
.perm-chip {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
}

/* 批量选择 */
.col-check { width: 38px; padding-right: 0 !important; }

/* 勾选框与单选框：统一自绘。
   浏览器原生的 accent-color 在 15px 下圆环粗细与内点比例各平台不一致，
   自绘后尺寸、描边、选中态、焦点环完全可控，与其余控件保持同一套视觉语言。 */
.chk,
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  position: relative;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  vertical-align: middle;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.chk { border-radius: var(--radius-2xs); }
input[type="radio"] { border-radius: var(--radius-pill); }

.chk:hover,
input[type="radio"]:hover { border-color: var(--brand); }

/* 勾选框选中：品牌色实底 + 白色对勾 */
.chk:checked {
  background: var(--brand);
  border-color: var(--brand);
}
.chk:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 7.5px;
  border: solid var(--on-brand);
  border-width: 0 2px 2px 0;
  /* 描边只有右 + 下两条边，墨迹重量全落在盒子右下，几何居中会让勾贴着底边，
     所以旋转后再向上补偿 1.4px，让勾的上下留白一致 */
  transform: translate(-50%, -50%) translateY(-1.4px) rotate(43deg);
}

/* 单选框选中：保留浅底与品牌色描边，中间点一颗实心圆点，比整块填色更易与勾选框区分 */
input[type="radio"]:checked {
  border-color: var(--brand);
  background: var(--surface);
}
input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  border-radius: var(--radius-pill);
  background: var(--brand);
}

.chk:focus-visible,
input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.chk:disabled,
input[type="radio"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border-strong);
}
/* 禁用时文字同步变淡，避免「控件淡、文字不淡」的割裂感 */
.radio-row:has(input:disabled) {
  color: var(--text-3);
  cursor: not-allowed;
}

/* 上传拖拽区 */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--dense-drop-pad);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.drop-zone:hover, .drop-zone.is-dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop-zone.is-dragover { border-style: solid; box-shadow: var(--ring); }
/* 已选文件是当前选择态：保留虚线但用品牌色描边和浅底，和普通空态区分 */
.drop-zone.has-selection { border-color: var(--brand); background: var(--brand-soft); }
.upload-folder-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.upload-folder-row .help { font-size: var(--fs-xs); color: var(--text-3); }

.preview-image {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.preview-frame {
  width: 100%;
  height: 68vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.preview-hint { padding: 36px 0; text-align: center; }
.drop-zone > svg { width: 22px; height: 22px; color: var(--text-3); }
.drop-zone:hover > svg { color: var(--brand); }
.drop-zone .dz-title { font-size: var(--fs-sm); font-weight: 600; }
.drop-zone .dz-desc { font-size: var(--fs-xs); color: var(--text-3); }
.drop-zone .dz-desc b { color: var(--brand); font-weight: 600; }

/* 单选行 */
.radio-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
}
.radio-row input { cursor: pointer; margin: 0; }

/* ============ 终端 ============ */
/* 终端页：整页锁定视口高度，终端吃掉全部剩余空间，只有输出区与右栏各自滚动 */
.term-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 58px - 56px);
  min-height: 480px;
}
.term-grid {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.term-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.term-shell {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
/* 终端下方的一行元信息：不占主区域，仅作轻量补充 */
.term-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 22px;
  margin-top: var(--sp-3);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  overflow: hidden;
}
.term-meta-item { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.term-meta-item:last-child { flex: 1; }
.term-meta-item .tm-label {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: var(--radius-2xs);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.term-meta-item .tm-value {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-meta-item .tm-value b { font-weight: 600; color: var(--text); }
/* 右栏两张卡各自内部滚动，避免整栏滚动把上方卡片推出视口 */
.term-side { min-height: 0; overflow: hidden; }
.term-side > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.term-side > .card:last-child { flex: 1; }
.term-side > .card .table-wrap { flex: 1; overflow-y: auto; }
.term-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) 10px;
  padding: 10px 14px;
  background: var(--term-head);
  border-bottom: 1px solid var(--term-border);
  color: var(--term-dim);
  font-size: var(--fs-sm);
}
.term-target {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--term-text-2);
}
.term-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 2px; }
.term-actions .btn {
  height: 26px;
  padding: 0 9px;
  background: transparent;
  border-color: var(--term-border-2);
  color: var(--term-text-2);
  opacity: .68;
  font-size: var(--fs-xs);
}
.term-actions .btn:hover,
.term-actions .btn:focus-visible {
  background: var(--term-field);
  border-color: var(--term-dim);
  color: var(--term-text-2);
  opacity: 1;
}
.term-actions .btn svg { width: 14px; height: 14px; }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: var(--radius-pill); display: block; }
.term-dots i:nth-child(1) { background: var(--term-dot-close); }
.term-dots i:nth-child(2) { background: var(--term-dot-min); }
.term-dots i:nth-child(3) { background: var(--term-dot-max); }
.term-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.75;
  color: var(--term-text);
}
.term-line { white-space: pre-wrap; word-break: break-all; }
.term-line .t-prompt { color: var(--term-prompt); }
.term-line .t-path { color: var(--term-path); }
.term-line .t-dim { color: var(--term-dim); }
.term-line .t-ok { color: var(--term-prompt); }
.term-line .t-warn { color: var(--term-warn); }
.term-input-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--term-border);
  background: var(--term-input);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--term-prompt);
}
/* 多行输入：随内容长高，最多约 8 行；提示符与第一行对齐 */
.term-input-row > [data-term-prompt] { line-height: 34px; }
.term-input-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  max-height: 160px;
  padding: 6px var(--sp-3);
  background: var(--term-field);
  border: 1px solid var(--term-border-2);
  border-radius: var(--radius-sm);
  outline: none;
  resize: none;
  overflow-y: hidden;
  color: var(--term-text-2);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.term-input-row textarea::placeholder { color: var(--term-placeholder); }
.term-input-row textarea:focus {
  background: var(--term-field-focus);
  border-color: var(--term-accent);
  box-shadow: var(--ring);
}
.term-history-link { color: var(--brand); }
.term-history-link:hover { text-decoration: underline; }

/* ============ 代码 / 日志块 ============ */
.code-block {
  margin: 0;
  padding: var(--dense-code-pad);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.75;
  color: var(--text-2);
  overflow-x: auto;
}
.code-block .log-line { white-space: pre-wrap; word-break: break-word; }
.code-block .lvl-info { color: var(--brand); }
.code-block .lvl-warn { color: var(--warning); }
.code-block .lvl-error { color: var(--danger); }

/* 代码块上方的说明条：左侧文件名，右侧复制按钮 */
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 7px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.code-head .mono { font-size: var(--fs-xs); }

/* 可编辑代码区：与只读代码块同一套外观（二级表面底、等宽 12.5px、行高 1.75），
   左侧多一列行号。textarea 关闭软换行（wrap="off"），长行横向滚动——
   软换行会把一行折成多行显示，行号立刻对不上，这是这类控件的通病。
   行号列由 app.js 按行数生成，滚动时与文本同步。 */
.code-edit {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* 行高与上下内衬必须和 textarea 用同一份值：差 0.05 的行高，
     滚十几行就会错开一整行，行号就白加了 */
  --code-lh: 1.75;
  /* 行号列宽：容纳 3-4 位数字 + 与文本的分隔间距 */
  --code-num-w: calc(2.6em + var(--dense-code-pad-x) / 2);
}
.code-edit:focus-within { border-color: var(--border-strong); }
/* 行号列用绝对定位而不是 flex：绝对定位的高度由容器（textarea）决定，
   flex 子项会被行号内容反过来撑高整块，容器高度就不受 textarea 控制了 */
.code-edit .code-num {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--code-num-w);
  margin: 0;
  padding: var(--dense-code-pad-y) calc(var(--dense-code-pad-x) / 2) var(--dense-code-pad-y) 0;
  border-right: 1px solid var(--border);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--code-lh);
  color: var(--text-3);
  text-align: right;
  white-space: pre;
  overflow: hidden;
  user-select: none;
}
.code-edit textarea.code-area {
  display: block;
  width: 100%;
  padding: var(--dense-code-pad-y) var(--dense-code-pad-x) var(--dense-code-pad-y) var(--code-num-w);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--code-lh);
  /* 软折行：长行（fastcgi_param 这类）不再横向拖动，改由浏览器折行；
     行号只标在逻辑行首，续行留空，排版见 app.js 的 gutterText */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow-x: hidden;
  overflow-y: auto;
  resize: vertical;
}
.code-edit textarea.code-area:focus { border: 0; box-shadow: none; }

/* 折行探针：只用来量每行折成几行，挪出视口且不可见 */
.code-probe {
  position: absolute;
  top: 0;
  left: -9999px;
  visibility: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 4;
}

/* ============ 项目配置页 ============ */
/* 顶部事实条：一行展示项目的关键属性，点击标签页前先给全貌 */
.proj-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}
.proj-fact {
  background: var(--surface);
  padding: 14px 18px;
  min-width: 0;
}
.proj-fact .pf-k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-bottom: 5px;
}
.proj-fact .pf-k svg { width: 13px; height: 13px; }
.proj-fact .pf-v {
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 访问域名可能有多个：主域名整颗展示，其余收成一枚 +N，
   鼠标悬停用 title 看全量，不让一条长域名把事实条撑破。 */
.proj-fact .pf-domains {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.proj-fact .pf-domains .tag {
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-fact .pf-domains .tag:first-child { min-width: 0; }

/* 配置文件所有权说明：哪些由面板托管、哪些是手写覆盖，分开写清楚 */
.config-owner {
  display: grid;
  gap: 14px;
}
.config-owner-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.config-owner-row + .config-owner-row {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.config-owner .co-k {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  line-height: 22px;
}
.config-owner .co-v { min-width: 0; }
.config-owner .help {
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 20px;
  margin-top: 6px;
}
.config-owner [data-config-manual-state] {
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 22px;
}
.config-owner .co-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.config-owner .co-tags .tag { flex: 0 0 auto; }
.config-owner .co-tags .tag.is-taken {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}
.config-owner .tip { margin-top: var(--sp-2); }
.config-owner [hidden] { display: none !important; }
@media (max-width: 620px) {
  .config-owner-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .config-owner .co-k { line-height: 1.4; }
}

/* 标签页：底部指示条，横向可滚动，窄屏不换行 */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 var(--sp-1);
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.tabs button svg { width: 15px; height: 15px; opacity: 0.75; transition: opacity var(--dur-fast) var(--ease); }
.tabs button:hover { color: var(--text); }
.tabs button:hover svg { opacity: 1; }
.tabs button.active { color: var(--brand); }
.tabs button.active svg { opacity: 1; }
.tabs button::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  border-radius: var(--radius-3xs) var(--radius-3xs) 0 0;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}
.tabs button.active::after { transform: scaleX(1); }
/* 页签上的数量角标 */
.tabs .count {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-strong);
  line-height: 17px;
  text-align: center;
}

/* 页内分区胶囊：滑动指示器（shared element）+ 图标描边绘制 + 点击涟漪 */
/* 胶囊宽度随文字自适应；放不下时自动换行，窄屏不会溢出到页面外 */
.pill-tabs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--dense-pill-mb);
  /* 上方留出骑缝角标、下方留出边框的空间 */
  padding: var(--dense-pill-pad);
  /* 防止在 flex 父容器里被内容撑宽 */
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 620px) {
  .pill-tabs { gap: 5px; }
  .pill-tabs button { padding: 0 10px; font-size: var(--fs-sm); gap: 5px; }
  .pill-tabs button svg { width: 14px; height: 14px; }
}
/* 选中指示器：随选中项滑动的一枚蓝色描边胶囊，滑到哪选中到哪 */
.pill-tabs .pill-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: var(--dense-pill-h);
  border-radius: var(--radius-pill);
  /* 只画 1px 描边：曾同时叠 border 与 inset 阴影，视觉变 2px 双圈，
     与 design/index.html#ds-nav「1px 品牌色描边 + 5.5% 底色」不符 */
  border: 1px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 5.5%, transparent);
  box-shadow: 0 2px 10px -3px color-mix(in srgb, var(--brand) 45%, transparent);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: transform;
  /* 只过渡 transform：位移全程合成器处理 */
  transition: transform var(--dur-enter) var(--ease-spring), width var(--dur-enter) var(--ease-spring),
    opacity var(--dur) var(--ease);
}
.pill-tabs button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--dense-pill-h);
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.pill-tabs button > * { position: relative; z-index: 1; }
/* 胶囊外壳：让骑缝角标能脱离按钮的裁剪与层叠上下文，浮到指示器之上 */
.pill-tabs .pill-item {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.pill-tabs button svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
  transform-origin: center;
  transition: opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease-spring);
}
.pill-tabs button:hover { color: var(--text); border-color: var(--border-strong); }
/* hover：图标抬起放大，文字与图标同步上浮 */
.pill-tabs button:hover svg { opacity: 1; transform: translateY(-2px) scale(1.16); }
.pill-tabs button:hover > span { transform: translateY(-1px); }
.pill-tabs button:active { transform: scale(0.96); }
/* 选中：文字变蓝、边框交给滑动指示器，避免双层描边。
   不改字重——加粗会让按钮变宽，整排页签随点击左右抖动 */
.pill-tabs button.active { color: var(--brand); border-color: transparent; }
.pill-tabs button.active svg { opacity: 1; }
/* 点击涟漪：从指针位置向外扩散 */
.pill-tabs .ripple {
  position: absolute;
  z-index: 0;
  border-radius: var(--radius-circle);
  background: color-mix(in srgb, var(--brand) 22%, transparent);
  transform: scale(0);
  opacity: 1;
  pointer-events: none;
  animation: pillRipple var(--dur-enter) var(--ease) forwards;
}
@keyframes pillRipple {
  to { transform: scale(2.6); opacity: 0; }
}
/* 图标描边绘制：切换时线条像被重新画一遍 */
.pill-tabs button.active svg { animation: pillIconDraw var(--dur-enter) var(--ease); }
@keyframes pillIconDraw {
  0% { opacity: 0.35; transform: scale(0.86); }
  55% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
/* 告警骑缝角标：浮在胶囊右上方，不占文字宽度，切换时胶囊宽度不跳动 */
.pill-tabs .count {
  position: absolute;
  top: -5px;
  right: -4px;
  z-index: 3;
  min-width: 17px;
  height: 17px;
  padding: 0 var(--sp-1);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--surface);
  background: var(--danger);
  color: var(--on-brand);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-strong);
  line-height: 14px;
  text-align: center;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--danger) 45%, transparent);
  animation: countPop var(--dur-enter) var(--ease-spring) var(--dur-fast) both;
}
@keyframes countPop {
  from { opacity: 0; transform: scale(0.2); }
  to { opacity: 1; transform: scale(1); }
}

/* 面板：默认只显示激活的那个，切换时从行进方向轻推入场 */
[data-tab-panel] { display: none; }
[data-tab-panel].active { display: block; animation: tabIn var(--dur-slow) var(--ease); }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

/* 侧栏局部换页：只有右侧内容淡入，侧栏与顶栏原地不动 */
.content.page-enter > * { animation: pageIn var(--dur-slow) var(--ease) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 错峰入场：同屏多个区块按顺序淡入上浮，靠 --d 控制各自延迟 */
.stagger-in {
  animation: staggerUp var(--dur-enter) var(--ease) both;
  animation-delay: var(--d, 0ms);
}
@keyframes staggerUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* 表单两列栅格：短字段并排，长字段跨列 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--dense-card-x);
}
/* .span-2 的语义是「跨两列」，不是「跨满行」：两列栅格里二者等价，
   到 cols-4 里才分得开——库名这类值比旁边的类型/字符集长一倍，跨两格正好，
   写死 1 / -1 会把四列栅格整行撑满，一行就只能塞一个字段。 */
.form-grid .span-2 { grid-column: span 2; }
.form-grid .field { min-width: 0; }

/* 三列栅格：连接凭据（库 / 账号 / 密码）是同一个句子的三个词，
   拆成「两列 + 甩到下一行」会让人以为密码不属于这组。
   容器变窄时先退两列，再退单列，避免三列挤到 label 折行。 */
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/* 四列栅格：连接凭据拆成地址 / 端口 / 用户名 / 密码四项时用。
   与 cols-3 同理——窄了就退两列，再窄退单列，不让 label 折行。 */
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
}

/* 输入框 + 右侧按钮 */
.input-group { display: flex; gap: var(--sp-2); }
.input-group .input { flex: 1; min-width: 0; }
/* 下拉框和输入框一样要能收缩：库名选项很长时，默认 min-width:auto 会把整行撑出卡片。 */
.input-group .select { flex: 1; min-width: 0; }
/* 原生 select 会被 picker 包一层；picker-block 默认整宽，和右侧按钮并排时会多占一份宽度。 */
.input-group .picker { flex: 1; width: auto; min-width: 0; }
.input-group .picker-btn { min-width: 0; }
.input-group .btn { flex-shrink: 0; height: 36px; }
/* 密码显隐按钮的按住态：颜色反过来表示「当前是明文」，
   不换图标，避免再看一个 eye-off 才知道自己点了什么 */
.input-group .btn[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  color: var(--brand);
}

/* 输入框 + 框内后缀按钮：眼睛这类「只作用于这一个值」的动作嵌在框里，
   不再并排占一格 —— 三列栅格里并排按钮会把输入框挤成半截，
   而且看着像两个独立控件。input 右侧让出 34px，按钮透明无框浮在上面。 */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 34px; }
.input-affix .btn-icon {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--text-3);
}
.input-affix .btn-icon:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text-2);
}
.input-affix .btn-icon svg { width: 15px; height: 15px; }
/* 明文态沿用 .input-group 的语义：反色成品牌色表示「现在看得见」 */
.input-affix .btn-icon[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}

/* 代码编辑区：等宽字体，纵向可拖拽 */
textarea.code-area {
  height: 240px;
  padding: var(--sp-3) 14px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.7;
  resize: vertical;
  tab-size: 4;
}

/* 域名列表 */
.domain-list { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.domain-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease);
}
.domain-row:last-child { border-bottom: 0; }
.domain-row:hover { background: var(--surface-2); }
.domain-row .dr-name { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 550; }
.domain-row .dr-actions { margin-left: auto; display: flex; gap: 6px; }
.domain-add { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.domain-add .input { flex: 1; }
.domain-add .btn { flex-shrink: 0; height: 36px; }

/* 证书信息块 */
.cert-box {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: var(--sp-1) 0 var(--sp-4);
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.cert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.cert-row > .dim { width: 78px; flex-shrink: 0; }
.cert-row .tag { margin-left: auto; }

@media (max-width: 1180px) {
  .proj-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .proj-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  /* 单列时跨列字段必须归位：保留 span 2 会让浏览器补出隐式第二列，
     第一个字段被压成 0px，标签一字一行。 */
  .form-grid .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .proj-facts { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .domain-row { flex-wrap: wrap; }
  .domain-row .dr-actions { margin-left: 0; }
  .domain-add { flex-direction: column; }
  .domain-add .btn { width: 100%; }
}

/* ============ AI 模型页 ============ */
/* 显存分配按显卡分组：两块 24 GB 不是一块 48 GB，整机百分比会掩盖单卡爆满 */
.vram-group + .vram-group {
  margin-top: var(--sp-4);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.vram-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 10px;
}
.vram-group-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.vram-cpu-note {
  margin-top: 14px;
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.7;
}

/* ============ Docker 页 ============ */
/* 定位：容器化项目的运维台。容器按应用/编排/独立分组，镜像、卷、网络是支撑资源。 */
.dk-sec { margin-bottom: var(--sp-7); }
.dk-sec:last-of-type { margin-bottom: 0; }
/* 面板组后面紧跟页面级尾注时，面板之间的 32px 让位给提示条节奏（12px）：
   尾注是一句注解、不是「下一块内容」，否则两行提示条中间会空出一大块 */
[data-tab-panel-group]:has(~ .tip) > .dk-sec { margin-bottom: var(--sp-3); }
.dk-sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.dk-sec-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.dk-sec-title svg { width: 17px; height: 17px; color: var(--text-3); }
.dk-sec-desc { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; max-width: 640px; }

/* 卡片内工具条：与卡体同底色，用发丝线与表格分开 */
.dk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-3) 18px;
  border-bottom: 1px solid var(--border);
}

/* 资源占用：CPU 与内存上下两行，避免横向挤压 */
.dk-res { display: flex; flex-direction: column; line-height: 1.35; }

/* 摘要条：四个对象一行，切页签时常驻，替代四张占首屏的大卡 */
.docker-summary {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.docker-summary-item {
  flex: 1 1 0;
  min-width: 180px;
  padding: var(--sp-3) 18px;
  border-left: 1px solid var(--border);
}
.docker-summary-item:first-child { border-left: 0; }
.ds-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.ds-label svg { width: 13px; height: 13px; }
.ds-value {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.ds-total { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
.ds-note { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }

/* 容器分组行：把「应用 / 编排 / 独立」的来源直接写在表体里，
   不额外拆三张表，筛选与搜索仍共用一套表格引擎 */
.table tr.row-group > td {
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.table tr.row-group:hover > td { background: var(--surface-2); }
.rg-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.rg-label > svg { width: 13px; height: 13px; color: var(--text-3); flex-shrink: 0; }
.rg-label > a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand);
  font-weight: 500;
}
.rg-label > a svg { width: 11px; height: 11px; }
.rg-label > a:hover { text-decoration: underline; }
.rg-hint { margin-left: auto; font-weight: 400; color: var(--text-3); white-space: nowrap; }

/* 归属链接：普通文本大小，避免整列被徽标撑宽 */
.owner-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  color: var(--brand);
  white-space: nowrap;
}
.owner-link svg { width: 11px; height: 11px; }
.owner-link:hover { text-decoration: underline; }

/* 容器详情里的归属卡：图标 + 名称 + 一句责任说明 */
.docker-owner-card { display: flex; align-items: flex-start; gap: 10px; }
.do-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}
.do-icon svg { width: 16px; height: 16px; }
.do-name { font-weight: 600; }
.do-desc { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }

/* 弹窗内的代码框矮一些，避免撑高弹窗 */
.modal .code-area { height: 180px; }
/* 文件编辑要放下整段配置，单独给更高的编辑区；窄屏仍受视口高度约束 */
#modal-edit-file .code-area { height: min(52vh, 420px); }

/* 证书表六列放在 1.62fr 的主栏里，16px 单元格内边距会把操作列挤出卡片；
   缩到 12px 后 1440 下整表刚好落在卡片内，不再需要横向滚动。 */
#ssl-table .table th,
#ssl-table .table td { padding-left: var(--sp-3); padding-right: var(--sp-3); }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  /* 终端页在窄屏改为自然高度：终端固定可视高度，右栏跟随内容 */
  .term-page { height: auto; min-height: 0; }
  .term-grid { display: flex; flex-direction: column; }
  .term-main { display: block; }
  .term-shell { height: calc(100vh - 300px); min-height: 380px; }
  .term-side { overflow: visible; }
  /* 单栏后底栏按可用宽度换行，值不再被省略号裁掉 */
  .term-meta { flex-wrap: wrap; gap: 8px 22px; overflow: visible; }
  .term-meta-item { flex: 1 1 260px; align-items: flex-start; }
  .term-meta-item:last-child { flex: 1 1 260px; }
  .term-meta-item .tm-value { white-space: normal; overflow: visible; text-overflow: clip; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 表格单元格 nowrap，列多时由 .table-wrap 横向滚动兜底 */
  .table thead th, .table tbody td { padding-left: var(--sp-3); padding-right: var(--sp-3); }
}
/* 概览四卡带环形图与三行数值，四列在 1440 以下会撑出卡内溢出，提前降到两列 */
@media (max-width: 1439px) {
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* 侧栏收窄为图标栏，把宽度让给内容区 */
  :root { --sidebar-w: 64px; }
  .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 三列卡片在窄屏直接单列，避免奇数个卡片留下半行空白 */
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .brand > span, .nav-group, .nav-badge, .side-brand-meta,
  .topbar-user .u-meta, .topbar-user .u-caret { display: none; }
  .nav-item > span:not(.nav-icon) { display: none; }
  .brand { justify-content: center; padding: var(--sp-4) 0 var(--sp-3); }
  /* 组合标识放不进 64px 图标栏，只留标记 */
  .sidebar .brand-lockup { display: none; }
  .sidebar .brand-mark-only { display: block; }
  .nav { padding: var(--sp-2) var(--sp-2) var(--sp-1); }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item:hover { padding-left: 0; }
  /* 图标栏里行宽只有 48px，圆点收进右侧空隙，避免压住图标 */
  .nav-dot { right: 5px; }
  .side-brand { justify-content: center; padding: var(--sp-2) 0; }
  .topbar-user { padding: var(--sp-1); }
  .content { padding: 18px; }
  .topbar { padding: 0 18px; }
  .page-head { flex-wrap: wrap; }
}
@media (max-width: 1180px) {
  /* 平板宽度下四格放不下：排成 2×2，别留一个孤格在第二行右边 */
  .docker-summary-item { flex: 1 1 50%; }
  .docker-summary-item:nth-child(3) { border-left: 0; }
  .docker-summary-item:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  /* 摘要条在手机上排成 2×2，避免四行纵向把首个容器挤到第二屏 */
  .docker-summary-item { flex: 1 1 50%; min-width: 0; border-top: 1px solid var(--border); }
  .docker-summary-item:nth-child(1),
  .docker-summary-item:nth-child(2) { border-top: 0; }
  .docker-summary-item:nth-child(odd) { border-left: 0; }
  .rg-hint { display: none; }
  /* 容器表在手机上先让出「状态」：归属上方分组行已经写清楚了 */
  #docker-table th:nth-child(2),
  #docker-table td:nth-child(2) { display: none; }
  .metric { gap: 14px; }
  .donut { width: 92px; height: 92px; }
  .net-stats { gap: 18px; }
  .kv { grid-template-columns: 76px minmax(0, 1fr); }
  .page-head { flex-direction: column; gap: var(--sp-3); }
  .login-wrap { padding: var(--sp-6) var(--sp-4); }
  .login-card { padding: 26px 22px var(--sp-5); }
  /* 搜索 + 分段筛选在窄屏各占一行：两者都是固定宽度，并排会把页面撑出横向滚动 */
  .dk-sec-head > .flex { width: 100%; flex-wrap: wrap; }
  .dk-sec-head .search { width: 100%; flex: 1 1 100%; }
  .dk-sec-head .segmented { max-width: 100%; }
  /* 表格脚注的「已选 N 项 + 批量按钮」在窄屏换行，否则标签被挤成一字一行；
     只锁批量组里的「已选」标签，脚注里的长说明仍要能换行，否则会被裁掉 */
  .card-footer .flex.items-center.gap-8 { flex-wrap: wrap; }
  .card-footer .flex.items-center.gap-8 > .small.dim { white-space: nowrap; }
  /* 顶栏只留当前页名，避免「面板 / 长标题」在图标栏旁折成两行 */
  .crumb-root, .crumb-sep { display: none; }
  .crumb { min-width: 0; white-space: nowrap; }
  .crumb-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 窄屏顶栏空间有限，注册入口收成图标，文案交给 aria-label */
  .topbar-signup { padding: 0 10px; }
  .topbar-signup span { display: none; }
  /* 已绑定账号同理：只留圆形对勾，手机号在弹窗里看 */
  .topbar-account { padding: 0 6px 0 var(--sp-1); }
  .topbar-account .acc-phone { display: none; }
  /* 终端头部在窄屏优先让位给主机与会话操作，装饰圆点不再占宽 */
  .term-dots { display: none; }
  /* 终端下方元信息在窄屏改为逐行展开：值区允许换行，不再省略成「Ctrl…」 */
  .term-meta { flex-wrap: wrap; gap: 10px; overflow: visible; }
  .term-meta-item { flex: 1 1 100%; align-items: flex-start; }
  .term-meta-item .tm-value { white-space: normal; overflow: visible; text-overflow: clip; }
}

/* ============ 滚动条 ============ */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-fast) var(--ease);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ============ 下拉框 ============ */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--sp-7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px 15px;
  cursor: pointer;
}
.select:hover { border-color: var(--text-3); }

/* ============ 弹窗关闭按钮 ============ */
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    transform var(--dur) var(--ease-spring);
}
.modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
  transform: rotate(90deg) scale(1.06);
}
.modal-close:active { transform: rotate(90deg) scale(0.94); }

/* ============ 侧栏品牌：可交互但不可点击 ============ */
.side-brand { cursor: default; }
.side-brand .sbm-name { transition: color var(--dur) var(--ease); }
.side-brand .sbm-desc { transition: color var(--dur) var(--ease); }
.side-brand:hover .sbm-name { color: var(--side-brand-hover); }
.side-brand:hover .sbm-desc { color: var(--side-text); }
.side-brand:hover .side-brand-logo { color: var(--side-brand-hover); border-color: color-mix(in srgb, var(--side-brand-hover) 45%, transparent); }

/* 下拉菜单里的选中项 */
.dropdown-menu-sm { width: 178px; }
.dropdown-menu .dropdown-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* ============ 磁盘 ============ */
.disk-item + .disk-item { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.disk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); }
.disk-name { display: flex; align-items: center; gap: 7px; font-weight: 550; }
.disk-name svg { width: 15px; height: 15px; color: var(--text-3); }
.disk-meta { font-size: var(--fs-xs); color: var(--text-3); margin: 3px 0 var(--sp-2); }
.disk-bar { display: flex; align-items: center; gap: 10px; }
.disk-bar .progress { flex: 1; }

/* 监控 → 磁盘占用：每块盘独立整行，数值列按内容加宽，
   否则 "14.3 GB / 29 GB" 会被 BarRow 固定的 52px 数值列折成多行。 */
.disk-usage .bar-row { margin-bottom: 12px; }
.disk-usage .bar-row:last-child { margin-bottom: 0; }
.disk-usage .bar-label { min-width: 88px; }
.disk-usage .bar-value { width: auto; min-width: 96px; white-space: nowrap; }

@media (max-width: 620px) {
  /* 手机上标签、长数值和条形挤不进一行：标签与数值同排，条形单独铺满下一行 */
  .disk-usage .bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label value" "track track";
    gap: var(--sp-1) var(--sp-2);
  }
  .disk-usage .bar-label { grid-area: label; min-width: 0; max-width: none; }
  .disk-usage .bar-value { grid-area: value; min-width: 0; }
  .disk-usage .bar-track { grid-area: track; }
}
.disk-pct { font-size: var(--fs-xs); width: 34px; text-align: right; }

/* 首页磁盘卡底部：一行 IO 摘要，避免再开一张图 */
.disk-io {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
  margin-top: 14px; padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
  font-size: var(--fs-xs); color: var(--text-2);
}

/* ============ 数据库类型 ============ */
.db-type { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.db-type-logo {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease-spring);
}
.db-type-logo svg { width: 13px; height: 13px; }
.table tbody tr:hover .db-type-logo { transform: scale(1.1); }

/* ============ 日志 ============ */
.log-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 14px 0;
}
.log-tools { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; flex-wrap: wrap; }
/* select 会被 picker 引擎包一层 div，宽度要落在包装层上，否则包装层按 100% 撑满、
   工具栏被挤成两行，右侧开关组会悬浮在两行中间。 */
.log-file-select { width: 230px; }
.picker-block:has(> .log-file-select) { width: 230px; }
.log-search { width: 200px; flex: 0 1 200px; }
/* 开关组对齐控件行：工具区换行时，开关仍停在第一行右侧而不是跑到两行中间 */
.log-switches { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; min-height: var(--dense-control-h); }
.log-follow { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.log-stream-wrap { position: relative; }
.log-view {
  max-height: var(--dense-log-max);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
}
.log-row {
  display: grid;
  grid-template-columns: 62px 48px 66px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: var(--dense-log-y) var(--dense-log-x);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease);
}
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: var(--surface); }
.log-time { color: var(--text-3); font-variant-numeric: var(--num-variant, tabular-nums); }
.log-lvl { font-size: var(--fs-2xs); font-weight: var(--fw-strong); letter-spacing: 0.03em; }
.log-lvl.lvl-info { color: var(--brand); }
.log-lvl.lvl-warning { color: var(--warning); }
.log-lvl.lvl-danger { color: var(--danger); }
.log-src { color: var(--text-2); }
.log-msg {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-view.is-wrap .log-msg { white-space: normal; overflow: visible; text-overflow: clip; }
.log-hit {
  background: color-mix(in srgb, var(--warning) 30%, transparent);
  color: inherit;
  border-radius: var(--radius-3xs);
}
.log-latest {
  position: absolute;
  right: 14px;
  bottom: 14px;
  box-shadow: var(--shadow-md);
}
.log-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
}
/* 日志流的空状态：跟随容器而不是卡片网格 */
.log-view .grid-empty { padding: 40px 0; }
.log-row[data-level="warning"] .log-msg { color: var(--text); }
.log-row[data-level="danger"] { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.log-row[data-level="danger"]:hover { background: var(--danger-soft); }
.log-file-row { cursor: pointer; }
.log-file-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.log-file-meta .badge { font-size: var(--fs-2xs); }
@media (max-width: 620px) {
  /* 两列统计卡：四张纵向排会把日志内容挤到两屏之后 */
  .log-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-tools { width: 100%; }
  .log-file-select,
  .log-search { width: 100%; flex: 1 1 100%; }
  .picker-block:has(> .log-file-select) { width: 100%; }
  .log-switches { width: 100%; margin-left: 0; min-height: 0; justify-content: space-between; }
  /* 手机一行日志占两行文字，框高按 10 行算（10×53+2 边框），再高会把整页拉得过长 */
  .log-view { max-height: 532px; }
  /* 窄屏正文独占一行，否则固定列宽会把消息挤到 0 */
  .log-row {
    grid-template-columns: 62px 48px minmax(0, 1fr);
    grid-template-areas: "time lvl src" "msg msg msg";
    row-gap: 2px;
  }
  .log-time { grid-area: time; }
  .log-lvl { grid-area: lvl; }
  .log-src { grid-area: src; }
  .log-msg { grid-area: msg; white-space: normal; overflow: visible; text-overflow: clip; }
}

/* ============ WEB 站点 ============ */
.web-stat-path { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.web-path {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.web-domain { overflow-wrap: anywhere; }
.web-root-hint { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-2); }
.web-log-pre {
  max-height: 58vh;
  margin: 0;
  padding: var(--sp-4);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#web-table .table thead th,
#web-table .table tbody td { padding-left: var(--sp-3); padding-right: var(--sp-3); }

@media (max-width: 620px) {
  /* WEB 卡：开关 + 名称 + 状态一行，域名 / 类型与时间 / 目录 / 操作依次向下 */
  #web-table { overflow-x: visible; }
  #web-table .table,
  #web-table tbody { display: block; width: 100%; }
  #web-table thead { display: none; }
  #web-table tbody tr[data-web-row] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 10px;
    padding: 14px var(--sp-4);
    border-bottom: 1px solid var(--border);
  }
  #web-table tbody tr[data-web-row]:last-child { border-bottom: 0; }
  #web-table tbody td { display: block; padding: 0; border: 0; }
  /* 名称单元格拆成内容盒：名称留在首行，目录 / 上游地址跨满整行，避免长路径一字一行 */
  #web-table td:nth-child(2) { display: contents; }
  #web-table td:nth-child(2) > a { grid-column: 2; grid-row: 1; min-width: 0; }
  #web-table td:nth-child(2) .web-path { grid-column: 1 / -1; grid-row: 2; }
  #web-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #web-table td:nth-child(5) { grid-column: 3; grid-row: 1; justify-self: end; }
  #web-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  #web-table td:nth-child(4) { grid-column: 1; grid-row: 4; }
  #web-table td:nth-child(6) { grid-column: 2 / -1; grid-row: 4; justify-self: end; }
  #web-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; }
  #web-table td:nth-child(7) .row-actions { justify-content: flex-end; }
  .web-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #web-table .web-path { max-width: none; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  #web-table tbody tr.empty-row,
  #web-table tbody tr.no-result-row { display: block; }
  #web-table tbody tr.empty-row > td,
  #web-table tbody tr.no-result-row > td { display: block; }
}

/* ============ 计划任务 ============ */
/* 任务表有 8 列，沿用 16px 单元格内边距会在 1440 下多出几十像素；
   这张表单独收紧到 12px，命令列不必为了塞下所有列而被压得过窄 */
#cron-table .table thead th,
#cron-table .table tbody td { padding-left: var(--sp-3); padding-right: var(--sp-3); }
/* 命令列：单行省略，复制按钮跟在文字后面；整行悬浮时才提亮，
   避免每一行都摆一个高对比图标抢视线 */
.cmd-cell { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 300px; }
.cmd-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-cell .btn-icon { flex: none; opacity: 0.6; transition: opacity var(--dur-fast) var(--ease); }
.table tbody tr:hover .cmd-cell .btn-icon { opacity: 1; }
/* 记录里的输出摘要同理：完整报错留给弹窗，列表里只保留一行线索 */
.run-output { max-width: 360px; }
/* 执行记录工具条：状态、时间范围、搜索、清理排一行，空间不足时整体换行 */
.cron-run-tools { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.cron-range { width: 120px; }
.picker-block:has(> .cron-range) { width: 120px; }
.cron-run-search { width: 180px; flex: 0 1 180px; }
/* 表达式预览：同一条输入的下一次提示，格式错误时只变文字颜色，不新增错误行 */
.cron-next { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-2); line-height: 1.6; }
/* 常用频率：点一下填满五格，当前周期与某个预设完全一致时保持高亮 */
.cron-presets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.cron-preset {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  line-height: 1;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cron-preset:hover { background: var(--surface-2); color: var(--text); }
.cron-preset.active { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
/* 五格输入：把「分 时 日 月 周」可视化，格内仍允许 * / 区间 / 列表 */
.cron-parts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cron-part { display: grid; gap: var(--sp-1); min-width: 0; }
.cron-part > span { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
.cron-part .input { text-align: center; padding-left: var(--sp-1); padding-right: var(--sp-1); }
.cron-parts.invalid .input { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 4%, var(--surface)); }
.cron-parts.invalid .input:focus { box-shadow: var(--ring-danger); }
/* Tip 外面多包一层做显隐时，弹窗的间距规则只认直接子级，这里补回 12px */
.cron-log-tip { margin-top: var(--sp-3); }
.cron-next-bad { color: var(--danger); }
.cron-cmd { margin-top: 4px; }
/* 执行输出弹窗：保留换行与缩进，长行折行，超长输出在弹窗内滚动 */
.cron-log-meta { margin-bottom: var(--sp-2); }
.cron-output-pre {
  max-height: 48vh;
  margin: 0;
  padding: var(--sp-4);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.cron-log-tip[hidden] { display: none; }

@media (max-width: 620px) {
  /* 四张统计卡纵向排会占掉一整屏，改成 2×2 */
  .cron-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cron-run-tools { width: 100%; justify-content: flex-start; }
  .cron-run-tools .segmented { max-width: 100%; }
  .cron-range,
  .picker-block:has(> .cron-range) { width: 100%; }
  .cron-run-search { width: 100%; flex: 1 1 100%; }
  .cron-run-tools > .btn { flex: 1 1 auto; justify-content: center; }
  /* 左右两段文案在窄屏挤成互相穿插的断行，改为纵向堆叠 */
  .cron-foot { flex-direction: column; align-items: flex-start; gap: var(--sp-1); }

  /* 任务表在手机上改成卡片：列多且命令长，横向滚动既看不全也容易误触 */
  #cron-table,
  #cron-run-table { overflow-x: visible; }
  #cron-table .table,
  #cron-table tbody,
  #cron-run-table .table,
  #cron-run-table tbody { display: block; width: 100%; }
  #cron-table thead,
  #cron-run-table thead { display: none; }
  #cron-table tbody tr[data-cron-row],
  #cron-run-table tbody tr[data-cron-run-row] {
    display: grid;
    gap: 7px 10px;
    padding: 14px var(--sp-4);
    border-bottom: 1px solid var(--border);
  }
  #cron-table tbody tr[data-cron-row]:last-child,
  #cron-run-table tbody tr[data-cron-run-row]:last-child { border-bottom: 0; }
  #cron-table tbody td,
  #cron-run-table tbody td { display: block; padding: 0; border: 0; }

  /* 任务卡：首行开关 + 名称 + 结果，周期一行，命令独占一行（长命令不再挤成竖排），
     上次 / 下次各一行，操作在最后。名称单元格拆成内容盒，命令才能跨满整行。 */
  #cron-table tbody tr[data-cron-row] { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  #cron-table td:nth-child(2) { display: contents; }
  #cron-table td:nth-child(2) > div:first-child { grid-column: 2; grid-row: 1; min-width: 0; }
  #cron-table td:nth-child(2) .cron-cmd { grid-column: 1 / -1; grid-row: 3; margin-top: 0; }
  #cron-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #cron-table td:nth-child(4) { grid-column: 3; grid-row: 1; justify-self: end; text-align: right; }
  #cron-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  #cron-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
  #cron-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 5; }
  #cron-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 6; }
  #cron-table td:nth-child(5)::before { content: "上次 "; color: var(--text-3); }
  #cron-table td:nth-child(6)::before { content: "下次 "; color: var(--text-3); }
  #cron-table td:nth-child(7) .row-actions { justify-content: flex-end; }
  #cron-table .cmd-cell { max-width: none; }
  #cron-table .cmd-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  /* 记录卡：任务与结果一行，开始与耗时一行，输出摘要两行封顶 */
  #cron-run-table tbody tr[data-cron-run-row] { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  #cron-run-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #cron-run-table td:nth-child(4) { grid-column: 2; grid-row: 1; justify-self: end; }
  #cron-run-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #cron-run-table td:nth-child(3) { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; white-space: nowrap; }
  #cron-run-table td:nth-child(2)::before { content: "开始 "; color: var(--text-3); }
  #cron-run-table td:nth-child(3)::before { content: "耗时 "; color: var(--text-3); }
  #cron-run-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
  #cron-run-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 4; }
  #cron-run-table td:nth-child(6) .row-actions { justify-content: flex-end; }
  #cron-run-table .run-output {
    display: -webkit-box;
    max-width: none;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* 表体改成 block 后，空态行与「没有匹配」行不能继续按表格单元格布局 */
  #cron-table tbody tr.empty-row,
  #cron-table tbody tr.no-result-row,
  #cron-run-table tbody tr.empty-row,
  #cron-run-table tbody tr.no-result-row { display: block; }
  #cron-table tbody tr.empty-row > td,
  #cron-table tbody tr.no-result-row > td,
  #cron-run-table tbody tr.empty-row > td,
  #cron-run-table tbody tr.no-result-row > td { display: block; }
}

/* ============ Panlox AI ============ */
/* 对话页是全高工作区：去掉内容区留白，但沿用全站 PC 端最大宽度 1320px */
#main:has(.ai-app) { padding: 0; }
.ai-app {
  display: flex;
  height: calc(100vh - 58px);
  min-height: 0;
  background: var(--surface);
}

/* 左：会话列表 */
.ai-side {
  width: 268px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}
.ai-side-top { padding: 14px var(--sp-3) 10px; }
.ai-new-btn { width: 100%; justify-content: center; height: 36px; font-size: var(--fs-sm); }
.ai-search { position: relative; margin: 0 var(--sp-3) 6px; }
.ai-search svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-3);
  pointer-events: none;
}
.ai-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ai-search input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.ai-conv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 2px var(--sp-2) var(--sp-3); }
.ai-conv-group {
  padding: var(--sp-3) var(--sp-2) 6px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.ai-conv {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ai-conv:hover { background: var(--surface-3); color: var(--text); }
.ai-conv.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 0 0 1px var(--border);
}
.ai-conv > svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-3); }
.ai-conv.active > svg { color: var(--brand); }
.ai-conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conv-time { font-size: var(--fs-2xs); color: var(--text-3); flex-shrink: 0; }

/* 会话行尾的「更多」按钮：默认隐藏，悬停或当前会话时出现，避免列表显得嘈杂 */
.ai-conv-more {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: -3px;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  flex-shrink: 0;
  cursor: pointer;
}
.ai-conv-more svg { width: 15px; height: 15px; }
.ai-conv:hover .ai-conv-more,
.ai-conv.active .ai-conv-more,
.ai-conv-more.open { display: inline-flex; }
.ai-conv-more:hover { background: var(--border); color: var(--text); }
/* 悬停时时间让位给更多按钮，避免两处挤压标题 */
.ai-conv:hover .ai-conv-time { display: none; }

/* 置顶会话：图钉代替气泡图标，颜色跟随品牌色 */
.ai-conv-pin { display: inline-flex; flex-shrink: 0; color: var(--text-3); }
.ai-conv-pin svg { width: 15px; height: 15px; }
.ai-conv.pinned .ai-conv-pin { color: var(--brand); }
/* 置顶组标题稍作区分，说明这组不是按时间排的 */
.ai-conv-group.is-pinned { color: var(--text-2); }

/* 会话操作菜单：挂到 body 上 fixed 定位，避免被左栏滚动区裁切 */
.conv-menu {
  position: fixed;
  z-index: var(--z-popover);
  width: 148px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.97);
  transform-origin: top left;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
    visibility var(--dur-fast) var(--ease);
}
.conv-menu.open { opacity: 1; visibility: visible; transform: none; }
.conv-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.conv-menu-item svg { width: 14px; height: 14px; color: var(--text-3); }
.conv-menu-item:hover { background: var(--surface-2); color: var(--text); }
.conv-menu-item:hover svg { color: var(--text-2); }
.conv-menu-item.danger { color: var(--danger); }
.conv-menu-item.danger svg { color: var(--danger); }
.conv-menu-item.danger:hover { background: var(--danger-soft); }
.conv-menu-sep { height: 1px; margin: var(--sp-1) 0; background: var(--border); }

/* 会话重命名：把标题就地变成输入框，保持行高不跳动 */
.ai-conv-rename {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  outline: none;
}

/* 左栏底部：当前使用的模型与配置入口 */
.ai-side-foot { flex-shrink: 0; padding: var(--sp-3); border-top: 1px solid var(--border); }
.ai-model-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  background: var(--surface-2);
}
.ai-model-top { display: flex; align-items: center; gap: var(--sp-2); }
.ai-model-icon {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}
.ai-model-icon svg { width: 14px; height: 14px; }
.ai-model-name { font-size: var(--fs-sm); font-weight: 650; }
.ai-model-state { margin-top: 2px; font-size: var(--fs-2xs); color: var(--success); }
.ai-model-desc { margin: var(--sp-2) 0 10px; font-size: var(--fs-xs); line-height: 1.6; color: var(--text-3); }
.ai-model-card .btn { width: 100%; justify-content: center; height: 32px; font-size: var(--fs-sm); }

/* 右：对话主区 */
.ai-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.ai-top {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
}
.ai-top-title { font-size: var(--fs-body); font-weight: 650; letter-spacing: -0.01em; }
.ai-top-sub { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.ai-top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ai-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-2);
  white-space: nowrap;
}
.ai-model-pill svg { width: 13px; height: 13px; color: var(--text-3); }

.ai-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 0 10px; }
.ai-thread-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.ai-msg { display: flex; align-items: flex-start; gap: var(--sp-3); }
.ai-msg-user { justify-content: flex-end; }
/* 用户消息：整列收窄并右对齐；排除头像，避免把 flex 列样式套到头像上 */
.ai-msg-user > div:not(.ai-avatar) {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(78%, 620px);
}
.ai-msg-user .ai-bubble { max-width: 100%; }
.ai-avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-circle);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}
.ai-avatar svg { width: 16px; height: 16px; }
/* Panlox 头像：与侧栏品牌标同款渐变 + 圆形 */
.ai-avatar-ai {
  border-radius: var(--radius-circle);
  background: linear-gradient(140deg, var(--brand-grad-from), var(--brand-grad-to));
  color: var(--on-brand);
}
.ai-avatar-ai svg { width: 15px; height: 15px; }
.ai-avatar-user {
  border-radius: var(--radius-circle);
  background: var(--side-active);
  color: var(--side-text);
  font-size: var(--fs-xs);
  font-weight: 600;
}
/* AI 消息：气泡随内容自适应宽度，浅蓝底 */
.ai-body {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(78%, 620px);
  padding: 10px 14px;
  border-radius: var(--radius) var(--radius) var(--radius) var(--radius-2xs);
  background: var(--brand-soft);
  font-size: var(--fs-sm);
  line-height: 1.72;
  color: var(--text);
}
/* 气泡内的操作清单沿用白色卡片，与浅蓝底形成层次 */
.ai-body .ai-plan-card { background: var(--surface); }
.ai-body p { margin: 0; }
.ai-body p + p { margin-top: var(--sp-2); }
/* 流式输出光标 */
.ai-body p.ai-typing::after {
  content: '';
  display: inline-block;
  width: 7px; height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--brand);
  animation: ai-caret var(--dur-pulse) steps(2, start) infinite;
}
@keyframes ai-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.ai-bubble {
  /* 列宽已放到与内容区一致，气泡本身仍限制在易读宽度内 */
  max-width: min(78%, 620px);
  padding: 10px 14px;
  border-radius: var(--radius) var(--radius) var(--radius-2xs) var(--radius);
  background: var(--surface-3);
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--text);
}
.ai-time { margin-top: 6px; font-size: var(--fs-2xs); color: var(--text-3); }
.ai-suggests { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: 14px; }
.ai-suggest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.ai-suggest:hover { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand); }
.ai-suggest svg { width: 13px; height: 13px; }

/* AI 给出的操作清单：贴在消息流里，不再是独立右栏 */
.ai-plan-card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.ai-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.ai-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.ai-step:last-of-type { border-bottom: 0; }
.ai-step-no {
  width: 20px; height: 20px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-strong);
  flex-shrink: 0;
  margin-top: 1px;
}
.ai-step-title { font-size: var(--fs-sm); font-weight: 550; }
.ai-step-detail { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); word-break: break-all; }
.ai-step.risk .ai-step-no { background: var(--danger-soft); color: var(--danger); }
.ai-plan-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.ai-plan-foot .btn { height: 30px; font-size: var(--fs-sm); }
.ai-plan-card.ai-plan-cancelled { opacity: 0.72; }
.ai-plan-card.ai-plan-cancelled .ai-steps,
.ai-plan-card.ai-plan-cancelled .ai-plan-head { opacity: 0.6; }

/* 底部输入区：与消息流共用同一列宽，避免左右错位 */
.ai-composer { flex-shrink: 0; padding: 10px 0 18px; }
.ai-composer-inner { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
.ai-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3) 14px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ai-box:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.ai-box textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text);
}
.ai-box textarea::placeholder { color: var(--text-3); }
.ai-box-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.ai-box-tip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.ai-box-tip svg { width: 13px; height: 13px; }

@media (max-width: 1180px) {
  .ai-side { width: 224px; }
}
@media (max-width: 900px) {
  .ai-side { display: none; }
}
@media (max-width: 620px) {
  /* AI 页标题栏：隐藏次要说明与模型胶囊，标题单行省略，右侧保留模型设置入口 */
  .ai-top { padding: 0 14px; gap: var(--sp-2); }
  .ai-top > div:first-child { min-width: 0; }
  .ai-top-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ai-top-sub, .ai-model-pill { display: none; }
  .ai-thread-inner { padding: 0 var(--sp-4); }
}

/* ============ 设置项即时生效 ============ */
/* 关闭动效：统一停掉过渡与关键帧，保留功能。
   两个入口收敛到同一个属性，行为完全一致：
   1) 用户在设置里关掉「界面动效」→ html[data-motion="off"]
   2) 系统级「减少动效」偏好 → 首屏脚本把它也写成 off（见 layout.templ / app.js）
   不在 CSS 里单独写 @media (prefers-reduced-motion)：那样会压过用户在面板里
   手动打开动效的选择，反而制造第二套优先级。 */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
/* hover / active 时的位移、缩放、旋转不是 animation/transition，上面的规则拦不住，
   关闭动效后要单独抹平，只保留颜色与阴影变化，避免图标仍在动。
   注意只能逐条列出，不能全局 transform:none —— 开关的滑块、下拉箭头等
   依赖 transform 做静态定位，全局清掉会让它们错位。 */
html[data-motion="off"] .nav-item:hover .nav-icon,
html[data-motion="off"] .nav-item:hover .nav-badge,
html[data-motion="off"] .btn:hover,
html[data-motion="off"] .btn:hover svg,
html[data-motion="off"] .btn:active,
html[data-motion="off"] .btn-icon:hover svg,
html[data-motion="off"] .btn-icon[data-icon-motion="press"]:hover svg,
html[data-motion="off"] .theme-toggle:hover svg,
html[data-motion="off"] .topbar-signup:hover,
html[data-motion="off"] .topbar-signup:hover svg,
html[data-motion="off"] .topbar-signup:active,
html[data-motion="off"] .topbar-account:hover,
html[data-motion="off"] .topbar-account:active,
html[data-motion="off"] .stat:hover,
html[data-motion="off"] .load-item:hover,
html[data-motion="off"] .app-card:hover .app-icon,
html[data-motion="off"] .table tbody tr:hover .file-icon,
html[data-motion="off"] .table tbody tr:hover .db-type-logo,
html[data-motion="off"] .pill-tabs button:hover svg,
html[data-motion="off"] .pill-tabs button:hover > span,
html[data-motion="off"] .pill-tabs button:active,
html[data-motion="off"] .segmented button:active,
html[data-motion="off"] .modal-close:hover,
html[data-motion="off"] .modal-close:active,
html[data-motion="off"] .picker.open .picker-btn > svg {
  transform: none !important;
}
/* 等宽数字开关：等宽模式切到等宽字体，比例模式回到无衬线数字字体 */
html[data-mono="on"] { --num-variant: tabular-nums; --num-font: var(--mono); }
html[data-mono="off"] { --num-variant: proportional-nums; --num-font: var(--font-num); }

/* 紧凑模式：不逐组件重写选择器，只把密度令牌换一组值。
   一屏多放 3~4 行，且不会出现「改了这个组件、忘了那个」的漏网。
   字号不动：中文在 Windows 上降一档就发虚，只收紧留白、不缩字。 */
html[data-compact="on"] {
  --dense-page-y: 20px;
  --dense-page-x: 22px;
  --dense-section-gap: var(--sp-4);
  --dense-topbar-h: 50px;
  --dense-topbar-x: 22px;

  --dense-brand-top: 16px;
  --dense-brand-bot: 12px;
  --dense-nav-y: 6px;
  --dense-nav-x: 10px;
  --dense-group-top: 13px;
  --dense-group-bot: 5px;
  --dense-group-first: 4px;
  --dense-divider-y: 7px;
  --dense-navitem-y: 7px;
  --dense-navitem-gap: 1px;
  --dense-sidefoot: 9px;
  --dense-sidebrand-y: 6px;
  --dense-sidebrand-x: 9px;

  --dense-card-y: 14px;
  --dense-card-x: 14px;
  --dense-app-card-y: 12px;
  --dense-app-card-x: 12px;
  --dense-card-head-y: 11px;
  --dense-card-foot-y: 10px;
  --dense-stat-y: 13px;
  --dense-stat-x: 15px;
  --dense-stat-label-gap: 6px;
  --dense-stat-foot-gap: 5px;
  --dense-stat-fs: var(--fs-xl);
  --dense-row-y: 9px;
  --dense-th-y: 9px;
  --dense-list-y: 9px;
  --dense-list-x: 14px;
  --dense-setting-y: 10px;
  --dense-kv-y: 5px;
  --dense-kv-x: 10px;
  --dense-grid-gap: var(--sp-3);

  --dense-control-h: 32px;
  --dense-btn-sm-h: 26px;
  --dense-badge-h: 20px;
  --dense-picker-h: 28px;
  --dense-seg-h: 26px;
  --dense-seg-pad: 2px;
  --dense-menu-pad: 4px;

  --dense-modal-head: 16px 20px 12px;
  --dense-modal-body: 16px 20px;
  --dense-modal-foot-y: 12px;
  --dense-mask-pad: 16px;
  --dense-pill-pad: 3px;
  --dense-pill-h: 30px;
  --dense-pill-mb: 10px;

  --dense-log-max: 602px;
  --dense-log-y: 4px;
  --dense-log-x: 10px;
  --dense-drop-pad: 18px 14px;
  --dense-timeline-x: 16px;
  --dense-tl-gap: var(--sp-3);
  --dense-tl-dot: -14px;
  --dense-task-steps: 0 16px;
  --dense-task-step-y: 5px;
  --dense-empty-pad: 32px 16px;
  --dense-code-pad-y: 10px;
  --dense-code-pad-x: 12px;
  --dense-code-pad: var(--dense-code-pad-y) var(--dense-code-pad-x);
  --dense-tip-pad: 8px 10px;
}

/* ============ 轻提示 ============ */
/* 外观全在这里，JS 只负责加删 .show。
   底色用 surface 而不是写死深色，暗色主题下自动跟随，不会出现一块突兀的黑条。 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  z-index: var(--z-toast);
  max-width: min(420px, calc(100vw - 48px));
  padding: 9px var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-family: var(--font);
  font-size: var(--fs-xs);
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ 业务后端：场景卡片 ============ */
/* 用于新建向导第 1 步（七类场景）与第 2 步（代码来源）。
   卡片本身就是链接，所以整块可点，悬停时抬一点、描边变蓝。 */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--dense-grid-gap);
}
.scene-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-4) 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.scene-card:hover {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.scene-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.scene-card .app-icon { margin-bottom: 6px; }
.scene-name {
  font-size: var(--fs-title);
  font-weight: 650;
  color: var(--text);
}
.scene-tagline {
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--text-2);
}
.scene-fit {
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--text-3);
}
/* 监控口径单独压一条浅底，提示「这类后端最先坏在哪」 */
.scene-watch {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-3);
}
.scene-watch svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }
@media (max-width: 1180px) {
  .scene-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .scene-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ============ 业务后端：新建向导 ============ */
/* 左侧步骤条固定宽度，右侧表单自适应。
   步骤状态只有三档：已过（done）、当前（active）、未到。 */
.wiz {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: var(--dense-grid-gap);
  align-items: start;
}
.wiz-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: var(--sp-4);
}
.wiz-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.wiz-step .wiz-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: var(--fs-2xs);
  font-weight: 650;
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.wiz-step .wiz-num svg { width: 12px; height: 12px; }
.wiz-step .wiz-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 22px;
}
.wiz-step .wiz-desc {
  font-size: var(--fs-2xs);
  line-height: 1.5;
  color: var(--text-3);
}
.wiz-step.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.wiz-step.active .wiz-num {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.wiz-step.active .wiz-desc { color: var(--brand); opacity: 0.75; }
.wiz-step.done { color: var(--text-2); }
.wiz-step.done .wiz-num {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
.wiz-body { min-width: 0; }
@media (max-width: 1180px) {
  .wiz { grid-template-columns: minmax(0, 1fr); }
  .wiz-steps {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .wiz-step { flex: 0 0 auto; }
  .wiz-step .wiz-desc { display: none; }
}

/* ============ 业务后端：指标数值着色 ============ */
/* 只有异常才着色，正常指标保持正文色，避免整页都是红绿噪音。 */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ============ 应用：混合负载列表与连接形态 ============ */
/* 详情头部动作在桌面保持一行；标题区可收缩，不把「重启」挤到第二行 */
.page-head > .flex:has(.app-head-actions) { flex-shrink: 0; }
.app-head-actions { flex-wrap: nowrap; }
@media (max-width: 900px) {
  .page-head > .flex:has(.app-head-actions) { flex-shrink: 1; }
  .app-head-actions { flex-wrap: wrap; }
}
.apps-ident { min-width: 0; }
.apps-meta-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.apps-meta-line .tag { height: 18px; padding: 0 6px; font-size: var(--fs-2xs); }
.apps-meta { font-size: var(--fs-xs); color: var(--text-3); }
.apps-entry { min-width: 180px; }
.tag-warn {
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

/* 待重建提示：只用一条浅色横条，不抢页面主色 */
.app-pending {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: var(--sp-4);
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.app-pending svg { width: 16px; height: 16px; color: var(--warning); flex-shrink: 0; }
.app-pending .btn { margin-left: auto; flex-shrink: 0; }
.app-pending span { min-width: 0; }

/* 最近动作：时间与说明允许换行，不再被 nowrap 截断 */
.app-recent-row { align-items: flex-start; }
.app-recent-row .k { white-space: normal; flex-shrink: 0; }
.app-recent-row .v { white-space: normal; text-align: right; }

/* 端口编辑器：一行一个端口，协议、对外、容器内、用途四列 */
.port-editor { margin-top: var(--sp-2); }
.port-editor-head,
.port-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 34px;
  gap: var(--sp-2);
  align-items: center;
}
.port-editor-head {
  padding: 0 2px 6px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.port-row {
  padding: var(--sp-2) 0;
  border-top: 1px dashed var(--border);
}
.port-row .select,
.port-row .input { height: 34px; }
.port-row .btn-icon { width: 30px; height: 30px; }
.form-grid.is-command .port-inner-col,
.port-editor.is-command .port-inner-col { display: none; }

/* 高级选项默认收起，避免首屏又变成九项大表单 */
.form-adv {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.form-adv > summary {
  cursor: pointer;
  padding: 13px var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--text-2);
  user-select: none;
}
.form-adv > summary:hover { color: var(--text); }
.form-adv > .form-grid { padding: 0 var(--sp-4) var(--sp-4); }

/* 列表在窄屏变卡片：同一批 tr 继续参与搜索/筛选，不复制第二套 DOM */
@media (max-width: 900px) {
  .apps-toolbar { width: 100%; flex-wrap: wrap; }
  .apps-toolbar .search { width: 100%; }
  #apps-table { overflow: visible; }
  #apps-table .table,
  #apps-table tbody,
  #apps-table tr,
  #apps-table td { display: block; width: 100%; }
  #apps-table thead { display: none; }
  #apps-table tbody tr {
    margin-bottom: 10px;
    padding: var(--sp-3) 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }
  #apps-table tbody tr:hover { background: var(--surface); }
  #apps-table tbody td { border: 0; padding: 0; }
  #apps-table tbody td[data-label]:not(:first-child) { margin-top: 10px; }
  #apps-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--text-3);
    font-size: var(--fs-xs);
  }
  #apps-table tbody td:first-child::before { display: none; }
  #apps-table .apps-entry { min-width: 0; }
  #apps-table .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  #apps-table tr.empty-row,
  #apps-table tr.no-result-row { border: 0; padding: 0; background: transparent; }
  #apps-table tr.empty-row td::before,
  #apps-table tr.no-result-row td::before { display: none; }

  /* 端口行在手机上竖排，四列不硬挤；窄屏下每个值都占满一行 */
  .port-editor-head { display: none; }
  .port-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
  .port-row .port-inner-col,
  .port-row [data-port-note] { grid-column: auto; }
  .port-row .btn-icon { justify-self: end; }
  .app-pending { align-items: flex-start; flex-wrap: wrap; }
  .app-pending .btn { margin-left: 26px; }
}

/* 详情页四个指标卡在手机上排 2×2，避免四张卡把页签推到几屏之后 */
@media (max-width: 620px) {
  .app-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .app-metrics .stat { padding: var(--sp-3); }
  .app-metrics .stat-value { font-size: var(--fs-lg); }
  .app-metrics .stat-foot { display: none; }
  /* 时间与说明在窄屏改成上下两行，避免右侧说明被挤成窄条 */
  .app-recent-row { flex-direction: column; gap: 2px; }
  .app-recent-row .v { text-align: left; }
}

/* 接口地址：运行时名称按内容定宽，避免被 kv 的 88px 固定列挤断 */
[data-endpoint-list] { grid-template-columns: max-content minmax(0, 1fr); column-gap: var(--sp-6); }
[data-endpoint-list] dt { white-space: nowrap; }

/* 多卡均分后会出现 2.35 这种值，给显存条的值列留出足够宽度，避免 GB 被挤到下一行 */
[data-gpu-card] .bar-row .bar-value,
[data-vram-shares] .bar-row .bar-value { width: 72px; white-space: nowrap; }

/* 精选模型：适配目标和筛选同一行排不下时换行，不把运行时名称压成只剩箭头 */
.catalog-toolbar { flex-wrap: wrap; row-gap: 10px; }
.catalog-toolbar > div { flex: 0 0 auto; }
.catalog-toolbar > div:last-child { flex: 1 1 auto; min-width: 0; }
.catalog-toolbar [data-catalog-runtime] { min-width: 220px; }
.catalog-toolbar .picker { min-width: 220px; flex: 1; }
.catalog-toolbar .picker-btn { width: 100%; }
.catalog-toolbar .search { width: auto; min-width: 220px; flex: 1 1 220px; max-width: 520px; }
.catalog-meta { padding: 10px 18px; }
.catalog-toolbar ~ .table-scroll-hint { padding: 0 18px var(--sp-2); }
/* 精选目录的列比数据库页多，1024/1280 下内容区仍可能横向滚动，提示不能跟着窄屏规则一起藏掉 */
@media (max-width: 1180px) {
  .catalog-toolbar ~ .table-scroll-hint { display: block; }
}

@media (max-width: 900px) {
  .catalog-toolbar > div { width: 100%; flex-wrap: wrap; }
  .catalog-toolbar [data-catalog-runtime] { min-width: 0; flex: 1; }
  .catalog-toolbar .picker { min-width: 0; width: 100%; flex: 1 1 auto; }
  .catalog-toolbar .search { width: 100%; max-width: none; flex: 1 1 100%; }
  .catalog-meta { padding: 10px var(--sp-4); }
  .catalog-toolbar ~ .table-scroll-hint { padding: 0 var(--sp-4) var(--sp-2); }
}

/* 外部服务接入：模型池勾选区，名称过长时换行而不是撑破弹窗 */
.model-pool-list { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-top: 10px; }
.model-pool-list:empty { display: none; }
.model-pool-list label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); min-width: 0; }
.model-pool-list label span { overflow-wrap: anywhere; }

/* ============ 设置 · 外观三合一 ============ */
/* 密度、动效、等宽数字共用一行；分隔线由列边界承担，不再各占一整行。 */
.setting-row.quad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 0;
  align-items: stretch;
}
/* 描述行数不一致时（侧栏模式多一行），把示例卡压到底部，四格仍然一条线 */
.setting-row.quad > .setting-cell { display: flex; flex-direction: column; min-width: 0; }
.setting-row.quad > .setting-cell .mini-pick { margin-top: auto; padding-top: 10px; }
/* 四列时左右分隔线两侧都要留白，示例卡不能贴住右侧竖线 */
@media (min-width: 1181px) {
  .setting-row.quad > .setting-cell:not(:last-child) { padding-right: var(--sp-6); }
  .setting-row.quad > .setting-cell:first-child .mini-pick { padding-left: var(--sp-6); }
}
.setting-row.quad > .setting-cell + .setting-cell {
  padding-left: var(--sp-6);
  border-left: 1px solid var(--border);
}
.setting-cell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.setting-cell-head > div { min-width: 0; }

/* ============ 设置 · 界面密度 ============ */
/* 两个小卡片只示意留白差异，说明留在设置项里，不再占掉半屏。 */
.mini-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  width: 100%;
  max-width: 344px;
}
.setting-cell .mini-pick { margin-top: 10px; }
.mini-opt {
  display: block;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.mini-opt:hover { border-color: var(--border-strong); }
.mini-opt:active { transform: scale(0.995); }
.mini-opt.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand);
}
.density-preview {
  display: flex;
  gap: 5px;
  height: 62px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.mini-opt.active .density-preview {
  border-color: var(--brand-border);
  background: var(--surface);
}
.sk-rail {
  width: 14px;
  flex-shrink: 0;
  border-radius: var(--radius-2xs);
  background: var(--surface-3);
}
.sk-page {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.sk-title {
  width: 38%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.sk-row {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 10px;
  padding: 0 var(--sp-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xs);
  background: var(--surface);
}
.sk-dot {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: var(--radius-3xs);
  background: var(--brand-border);
}
.sk-line {
  flex: 1;
  min-width: 0;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.sk-tag {
  width: 10px;
  height: 3px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--border);
}
.mini-opt[data-density-set="compact"] .sk-page { gap: 2px; }
.mini-opt[data-density-set="compact"] .sk-row { height: 6px; padding: 0 3px; gap: 2px; }
.mini-opt[data-density-set="compact"] .sk-dot { width: 3px; height: 3px; }
.mini-opt[data-density-set="compact"] .sk-line { height: 2px; }
.mini-opt[data-density-set="compact"] .sk-tag { width: 8px; height: 2px; }
.mini-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  padding: 0 1px;
}
.mini-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.mini-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.mini-check svg { width: 10px; height: 10px; }
.mini-opt.active .mini-check { opacity: 1; transform: none; }

/* 动效示例：开启卡有跳动条，关闭卡保持静止；实际动画仍受 data-motion 控制 */
.motion-preview,
.mono-preview {
  position: relative;
  height: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.mini-opt.active .motion-preview,
.mini-opt.active .mono-preview {
  border-color: var(--brand-border);
  background: var(--surface);
}
.motion-preview {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}
.motion-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-1);
  height: 28px;
}
.motion-bars i {
  width: 5px;
  height: 40%;
  border-radius: var(--radius-pill);
  background: var(--brand-border);
  transform-origin: bottom;
}
.motion-bars i:nth-child(2) { height: 80%; }
.motion-bars i:nth-child(3) { height: 55%; }
.motion-bars i:nth-child(4) { height: 95%; }
.motion-static .motion-bars i {
  background: var(--border-strong);
  opacity: 0.8;
}
.mini-glyph {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  color: var(--brand);
  opacity: 0.8;
}
.mini-glyph svg { width: 14px; height: 14px; }
html[data-motion="on"] .mini-opt[data-motion-set="on"] .motion-bars i {
  animation: motion-bar 1.1s var(--ease-soft) infinite;
}
html[data-motion="on"] .mini-opt[data-motion-set="on"] .motion-bars i:nth-child(2) { animation-delay: 0.12s; }
html[data-motion="on"] .mini-opt[data-motion-set="on"] .motion-bars i:nth-child(3) { animation-delay: 0.24s; }
html[data-motion="on"] .mini-opt[data-motion-set="on"] .motion-bars i:nth-child(4) { animation-delay: 0.36s; }
@keyframes motion-bar {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

/* 数字字形示例：同一组数值，左侧等宽、右侧按比例字宽 */
.mono-preview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  line-height: 1.2;
}
.mono-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}
.mono-row b {
  color: var(--text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
}
.mono-tabular { font-variant-numeric: tabular-nums; }
.mono-proportional {
  font-family: var(--font-num);
  font-variant-numeric: proportional-nums;
}

/* 侧栏模式示例：左边栏宽度与标签显隐直接画出来 */
.sidebar-preview {
  display: flex;
  height: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.mini-opt.active .sidebar-preview {
  border-color: var(--brand-border);
  background: var(--surface);
}
.sp-rail {
  display: flex;
  width: 46%;
  flex-shrink: 0;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 6px 5px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sp-item {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.sp-item i {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: var(--radius-3xs);
  background: var(--brand-border);
}
.sp-item b {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.sp-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 7px 6px;
}
.sp-main span {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border);
}
.sp-main span:first-child {
  width: 62%;
  background: var(--border-strong);
}
.sidebar-preview-icons .sp-rail {
  width: 24%;
  align-items: center;
  padding: 6px 3px;
}
.sidebar-preview-icons .sp-item {
  justify-content: center;
  width: 100%;
}
.sidebar-preview-icons .sp-item b { display: none; }
.sidebar-preview-icons .sp-main span:first-child { width: 48%; }

@media (max-width: 1180px) {
  /* 四列放不下时排成 2×2，避免第四项被单独甩到下一行 */
  .setting-row.quad { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--sp-4); }
  .setting-row.quad > .setting-cell + .setting-cell {
    padding-left: var(--sp-6);
    border-left: 1px solid var(--border);
  }
  .setting-row.quad > .setting-cell:nth-child(3) {
    padding-left: 0;
    padding-top: var(--sp-4);
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .setting-row.quad > .setting-cell:nth-child(4) {
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
  }
}
@media (max-width: 900px) {
  .setting-row.quad { grid-template-columns: 1fr; }
  .setting-row.quad > .setting-cell + .setting-cell {
    padding-left: 0;
    border-left: 0;
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 900px) {
  .model-library-actions { width: 100%; flex-wrap: wrap; }
  .model-library-actions [data-downloaded-controls] { width: 100%; flex-wrap: wrap; }
  .model-library-actions [data-downloaded-controls] .segmented { max-width: 100%; }
}

/* ============ 概览 · 官方公告 ============ */
/* 整套沿用注册入口配色：Logo 圆点青绿的 9% 底、32% 描边，图标与标签用悬停档 17%；关闭时由 html 属性统一隐藏。 */
.official-notice {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  border: 1px solid color-mix(in srgb, var(--brand-dot) 32%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand-dot) 9%, var(--surface));
}
.official-notice-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand-dot) 17%, var(--surface));
  color: var(--brand-dot-ink);
}
.official-notice-icon svg { width: 16px; height: 16px; }
.official-notice-icon img { width: 18px; height: 18px; display: block; }
.official-notice-body { flex: 1; min-width: 0; }
.official-notice-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.official-notice-label {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-2xs);
  background: color-mix(in srgb, var(--brand-dot) 17%, var(--surface));
  color: var(--brand-dot-ink);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.official-notice-desc {
  margin-top: 3px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.official-notice-date {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
html[data-official="off"] [data-official-notice] { display: none !important; }

@media (max-width: 620px) {
  .official-notice { align-items: flex-start; }
  .official-notice-date { display: none; }
}

/* ============ 安全设置 ============ */
.security-admin { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.security-avatar {
  width: 44px; height: 44px; border-radius: var(--radius-lg); flex: 0 0 auto;
  display: grid; place-items: center;
  color: var(--brand); background: var(--brand-soft);
}
.security-avatar svg { width: 22px; height: 22px; }
.security-admin-copy { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.security-admin-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.security-admin .row-actions { flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }

.security-firewall-policy {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) 18px;
  border-bottom: 1px solid var(--border);
}
.security-firewall-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) 18px;
  border-bottom: 1px solid var(--border);
}
.security-firewall-tag[data-on="false"] { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

.security-log-head { align-items: flex-start; }
.security-log-filters { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.security-log-filters .search { width: 200px; }
.security-log-filters .select { width: 118px; }

.audit-detail-row td { background: var(--surface-2); padding-top: 10px; padding-bottom: 10px; }
.audit-detail { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); line-height: 1.55; }
.audit-detail svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; color: var(--text-3); }

@media (max-width: 900px) {
  .security-admin { align-items: flex-start; }
  .security-admin .row-actions { width: 100%; justify-content: flex-start; padding-left: 58px; }
  .security-log-filters { width: 100%; }
  .security-log-filters .search { width: 100%; flex: 1 1 100%; }
  .security-log-filters .select { flex: 1 1 30%; width: auto; min-width: 88px; }
  .security-center .table-scroll-hint { display: block; padding: 0 var(--sp-4) var(--sp-2); }
}
.security-center .grid-main-side { align-items: start; }
/* 筛选下拉用的是自绘 picker；只写 .select 宽度会落到隐藏的原生 select 上，浮层仍是整行。 */
.security-log-filters .picker { flex: 0 0 118px; width: 118px; min-width: 0; }
.security-log-filters .picker .picker-btn { width: 100%; }
@media (max-width: 900px) {
  .security-log-filters .picker { flex: 1 1 30%; width: auto; min-width: 88px; }
}
.security-center .grid { align-items: start; }
.security-admin-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--sp-4);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.security-admin-facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 14px;
  border-left: 1px solid var(--border);
}
.security-admin-facts > div:first-child { padding-left: 0; border-left: 0; }
.security-admin-facts > div:last-child { padding-right: 0; }
.security-admin-facts span { font-size: var(--fs-xs); color: var(--text-3); }
.security-admin-facts strong { font-size: var(--fs-sm); font-weight: 600; }
@media (max-width: 900px) {
  .security-admin-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--sp-3); }
  .security-admin-facts > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .security-admin-facts > div:nth-child(3) { grid-column: 1 / -1; padding-top: var(--sp-3); border-top: 1px solid var(--border); }
}
/* 会话与白名单并排时等高，底边与提示对齐 */
.security-center .grid.sec-pair { align-items: stretch; }
/* 在线会话：代理信息与时间列在卡片内换行，窄卡片里不再出现横向滚动条 */
#session-table { overflow-x: hidden; }
#session-table .table { table-layout: fixed; }
#session-table td { white-space: normal; }
#session-table td:nth-child(2) { width: 100px; }
#session-table td:last-child { width: 84px; }
#session-table .cell-sub { overflow-wrap: anywhere; line-height: 1.45; }
#session-table .row-actions { justify-content: flex-end; }
/* 登录与访问里的卡片按行等高，切回熟悉的规整网格；SSH 的公钥卡按内容高度收起。 */
.security-center [data-tab-panel="sec1"] .grid,
.security-center [data-tab-panel="sec1"] .grid-main-side { align-items: stretch; }

/* 文件上传进度：提交后出现，弹窗关闭时保持隐藏 */
.upload-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.upload-progress[hidden] { display: none; }

/* 后台压缩 / 解压任务：进行中显示进度，完成后保留短时间供确认 */
.file-jobs { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.job-item { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.job-title { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.job-title .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-detail { margin-top: var(--sp-2); }
.job-item[data-job-indeterminate="1"] .progress-bar { animation: job-pulse 1.2s ease-in-out infinite; }
@keyframes job-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .job-item[data-job-indeterminate="1"] .progress-bar { animation: none; opacity: .75; }
}

/* 服务页：本机命令没有“容器内端口”列，端口行改成四列；
   命令/目录在卡片里换行，不产生横向滚动。 */
.port-editor.is-command .port-editor-head,
.port-editor.is-command .port-row {
  grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1.2fr) 34px;
}
.svc-cmd { white-space: normal; overflow-wrap: anywhere; word-break: break-all; text-align: right; }
@media (max-width: 900px) {
  .port-editor.is-command .port-row { grid-template-columns: minmax(0, 1fr); }
  .svc-cmd { text-align: left; }
}

/* 进程表：窄屏收起次要列，名称换行，保证不出现横向滚动条 */
@media (max-width: 900px) {
  #proc-table th:nth-child(2), #proc-table td:nth-child(2),
  #proc-table th:nth-child(6), #proc-table td:nth-child(6) { display: none; }
}
@media (max-width: 620px) {
  #proc-table th:nth-child(1), #proc-table td:nth-child(1),
  #proc-table th:nth-child(5), #proc-table td:nth-child(5) { display: none; }
}

/* 新盘初始化向导：步骤指示、磁盘单选卡、审阅表 */
.init-steps {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.init-steps > span { display: inline-flex; align-items: center; gap: 6px; }
.init-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-circle);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-style: normal;
  font-size: var(--fs-xs);
}
.init-steps > .active { color: var(--text); font-weight: var(--fw-semibold); }
.init-steps > .active .init-step-dot { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.init-steps > .done .init-step-dot { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.init-disk-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.init-disk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.init-disk:hover { border-color: var(--brand-border); }
.init-disk:has(input:checked) { border-color: var(--brand); box-shadow: var(--ring); }
.init-disk input { margin-top: 3px; }
.init-disk-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.init-disk-meta { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.init-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.init-review {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.init-review .k { color: var(--text-3); }
.init-review .v { min-width: 0; overflow-wrap: anywhere; }
.init-review + .tip { margin-top: 12px; }
[data-init-step] > .field + .field { margin-top: 12px; }
[data-init-step] > .init-review { margin-top: 12px; }
@media (max-width: 720px) {
  .init-review { grid-template-columns: 72px minmax(0, 1fr); }
}

/* 日志文件表：窄屏先收来源与更新时间，再收大小；文件名与路径始终可见。 */
@media (max-width: 900px) {
  #log-table th:nth-child(2), #log-table td:nth-child(2),
  #log-table th:nth-child(4), #log-table td:nth-child(4) { display: none; }
}
@media (max-width: 620px) {
  #log-table th:nth-child(3), #log-table td:nth-child(3) { display: none; }
}

.format-entry {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* 真实终端：xterm 自己负责滚动，宿主只负责尺寸；内边距放在宿主上，fit 会扣掉。 */
.term-body { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
#term-host { flex: 1 1 auto; min-height: 0; padding: 10px 12px; }
#term-host .xterm { height: 100%; }
.format-progress { display: flex; flex-direction: column; gap: 12px; }
.format-progress[hidden] { display: none; }
.format-progress .task-steps { padding: 0; }
.format-progress .progress { margin-top: 2px; }

/* 终端滚动条：只在内容超出时出现，颜色跟随终端边框，避免浏览器默认的黑底白条 */
#term-host .xterm-viewport {
  overflow-y: auto;
  background-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--term-border-2) transparent;
}
#term-host .xterm-viewport::-webkit-scrollbar { width: 8px; height: 8px; }
#term-host .xterm-viewport::-webkit-scrollbar-track { background: transparent; }
#term-host .xterm-viewport::-webkit-scrollbar-thumb {
  background: var(--term-border-2);
  border-radius: var(--radius-pill);
}
#term-host .xterm-viewport::-webkit-scrollbar-thumb:hover { background: var(--term-dim); }

/* 输入框光标用品牌色，与提示符区分 */
.term-input-row textarea { caret-color: var(--term-accent); }

/* 文件页“系统目录”开关：默认隐藏 lost+found 等，开关状态存浏览器 */
tr.is-system-entry { display: none; }
html[data-files-system=show] tr.is-system-entry { display: table-row; }
.files-hide-sys { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* 连接阶段的遮罩：避免打开页面时先看到一片黑 */
.term-boot {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--term-bg);
  color: var(--term-text-2);
}
.term-boot[hidden] { display: none; }
.term-boot-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--term-prompt);
  animation: term-boot-pulse 1.6s var(--ease-soft) infinite;
}
.term-boot-copy b {
  display: block;
  color: var(--term-text);
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.term-boot-copy span {
  display: block;
  margin-top: 3px;
  color: var(--term-text);
  font-size: var(--fs-xs);
}
@keyframes term-boot-pulse {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 0 0 color-mix(in srgb, var(--term-prompt) 45%, transparent); }
  50% { opacity: 1; box-shadow: 0 0 0 5px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .term-boot-dot { animation: none; opacity: 0.9; }
}

/* 常用命令：紧凑单行列表，点击只回填输入框，不直接执行 */
.term-cmds {
  /* 命令是辅助信息，比正文浅一档；仍保持 4.5:1 以上 */
  --term-cmd-ink: #6c727b;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-1) var(--sp-2) var(--sp-2);
}
[data-theme="dark"] .term-cmds { --term-cmd-ink: #9aa1ab; }
.term-cmd-group + .term-cmd-group { margin-top: var(--sp-1); }
.term-cmd-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px var(--sp-2) 6px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.term-cmd-group-head svg { width: 13px; height: 13px; flex-shrink: 0; }
.term-cmd-group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.term-cmd {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 34px;
  padding: 6px var(--sp-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}
.term-cmd:hover, .term-cmd:focus-visible { background: var(--side-hover); }
.term-cmd:focus-visible { outline: none; box-shadow: var(--ring); }
.term-cmd-label {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.term-cmd-code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--term-cmd-ink);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.term-cmd:hover .term-cmd-code, .term-cmd:focus-visible .term-cmd-code { color: var(--text-2); }
.term-cmd-go {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--brand);
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.term-cmd-go svg { width: 14px; height: 14px; }
.term-cmd:hover .term-cmd-go, .term-cmd:focus-visible .term-cmd-go {
  opacity: 1;
  transform: none;
}

/* 右栏竖向空间紧张：空态收紧凑一档，把高度让给常用命令 */
.term-side .empty-row .empty { padding: var(--sp-5) var(--sp-4); gap: var(--sp-2); }
.term-side .empty-row .empty-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); }
.term-side .empty-row .empty-icon svg { width: 16px; height: 16px; }
.term-side .empty-row .empty-title { font-size: var(--fs-sm); }
.term-side .empty-row .empty-desc { font-size: var(--fs-xs); }

/* 宽屏时底部信息条跨两栏，避免被右栏挤压截断；
   窄屏仍留在终端下方（.term-main 恢复为普通块） */
@media (min-width: 1181px) {
  .term-main { display: contents; }
  .term-shell { grid-column: 1; grid-row: 1; }
  .term-side { grid-column: 2; grid-row: 1; }
  .term-grid { grid-template-rows: minmax(0, 1fr) auto; row-gap: var(--sp-3); }
  .term-meta { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
}

/* 在线会话卡在窄侧栏里：时间只保留时:分，单元格内边距略收，
   IP 行允许折行（IPv6 也不会把表格撑宽），容器不出现横向滚动条。 */
.term-side .table th,
.term-side .table td { padding-left: 12px; padding-right: 12px; }
.term-side .table .cell-sub { white-space: normal; overflow-wrap: anywhere; }
.term-side .table-wrap { overflow-x: hidden; }

/* 概览：需要关注摘要条。白底发丝线，状态只落在图标与数量上，不铺大面积色块。 */
.dash-attention {
  display: flex;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
  padding: 10px var(--dense-card-x);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.dash-attention-lead {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  white-space: nowrap;
}
.dash-attention-lead svg { width: 15px; height: 15px; }
.dash-attention-lead.tone-danger svg,
.dash-attention-lead.tone-danger b { color: var(--danger); }
.dash-attention-lead.tone-warn svg,
.dash-attention-lead.tone-warn b { color: var(--warning); }
.dash-attention-lead.tone-ok svg { color: var(--success); }
.dash-attention-empty { font-size: var(--fs-sm); color: var(--text-3); }
.dash-attention-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.dash-attention-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px var(--sp-3);
  border: 0;
  border-left: 1px solid var(--border);
  background: none;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.dash-attention-item:hover .attn-text { color: var(--brand); }
/* 行内补充说明：普通文本流，长句自然折行；不要复用 .ai-body（助手页同名类带浅蓝底） */
.dash-attention-item .attn-body { display: inline; min-width: 0; }
.dash-attention-item .attn-detail { margin-left: var(--sp-2); font-size: var(--fs-xs); color: var(--text-3); }
.dash-attention-item { max-width: 100%; }
.dash-attention-item svg { width: 14px; height: 14px; flex: none; }
.dash-attention-item svg:first-of-type { color: var(--text-3); }
.dash-attention-item.tone-danger svg:first-of-type { color: var(--danger); }
.dash-attention-item.tone-warn svg:first-of-type { color: var(--warning); }
.dash-attention-item svg:last-of-type { width: 12px; height: 12px; color: var(--text-3); }

/* 概览：近 7 天流量柱。每列一个本地日，下行在下、上行在上，按窗口峰值归一。 */
.daily-traffic {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  height: 156px;
  padding-top: var(--sp-2);
}
.dt-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.dt-value {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
  white-space: nowrap;
}
.dt-track {
  flex: 1;
  width: 100%;
  max-width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--surface-2);
  border-radius: var(--radius-2xs);
  overflow: hidden;
}
.dt-down { width: 100%; background: var(--c-blue); }
.dt-up { width: 100%; background: var(--c-teal); }
.dt-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  white-space: nowrap;
  font-family: var(--num-font);
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.dt-col.is-empty .dt-value { color: var(--text-3); }
/* 未采样的日期不撑一整块灰柱，只在底部留一条短横，数据日更突出 */
.dt-col.is-empty .dt-track { background: transparent; }
.dt-col.is-empty .dt-track::after {
  content: "";
  align-self: center;
  width: 60%;
  height: 2px;
  border-radius: var(--radius-3xs);
  background: var(--border);
}

/* 概览：Top 3 进程。两列并排，条形色与资源卡保持一致（CPU 蓝、内存紫）。 */
/* 卡片头部的次要导航链接：默认跟随 hint 灰字，悬停/键盘聚焦转品牌色并把箭头轻推 2px */
.card-header > a.hint { transition: color var(--dur) var(--ease); }
.card-header > a.hint:hover { color: var(--brand); }
.card-header > a.hint svg { transition: transform var(--dur) var(--ease); }
.card-header > a.hint:hover svg { transform: translateX(2px); }

.proc-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}
.proc-top-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.proc-top-head svg { width: 14px; height: 14px; color: var(--text-3); }
.proc-top-head .tag { margin-left: auto; }
.proc-top .bar-row .bar-value {
  width: 64px;
  white-space: nowrap;
  font-variant-numeric: var(--num-variant, tabular-nums);
}
.proc-top .bar-row .bar-label { flex: 0 0 96px; width: 96px; max-width: 96px; }
.proc-top-group.cpu .bar-fill { background: var(--c-blue); }
.proc-top-group.mem .bar-fill { background: var(--c-violet); }

@media (max-width: 620px) {
  /* 手机上图例与历史说明挤在一行会把标题折成两行，图例让位给文字，浮层里仍能看到两条序列 */
  .dash-spark-key { display: none; }
  .dash-attention { align-items: flex-start; }
  .dash-attention-items { flex-basis: 100%; flex-direction: column; align-items: stretch; }
  .dash-attention-item { border-left: 0; border-top: 1px solid var(--border); padding: 7px 0; }
  .dash-attention-item .attn-detail { display: block; margin-left: 0; margin-top: 2px; font-size: var(--fs-2xs); }
  .proc-top { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
}

/* ============ 设置 · 备份列表 ============ */
.backup-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
}
.backup-checks .radio-row { margin: 0; min-width: 0; }
.backup-list { display: flex; flex-direction: column; }
.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 124px auto;
  align-items: center;
  gap: 10px;
  padding: 9px var(--dense-card-x);
  border-bottom: 1px solid var(--border);
}
.backup-row:last-child { border-bottom: 0; }
.backup-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.backup-when { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--text); }
.backup-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: var(--radius-2xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-2xs);
}
.backup-file {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.backup-size, .backup-time { color: var(--text-2); font-size: var(--fs-xs); text-align: right; white-space: nowrap; }
.backup-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.backup-actions .btn { height: 28px; font-size: var(--fs-xs); padding: 0 10px; }
.backup-actions .btn-icon { width: 28px; padding: 0; }
.backup-empty { padding: 18px 0; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
@media (max-width: 760px) {
  .backup-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backup-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .backup-file { display: none; }
  .backup-size { text-align: left; }
  .backup-time { display: none; }
  .backup-actions { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 460px) {
  .backup-checks { grid-template-columns: minmax(0, 1fr); }
}

/* 官方公告的「只关闭这一条」按钮：沿用弹窗关闭按钮规范（28px 透明底、悬停浅灰） */
.official-notice-close { flex: 0 0 auto; align-self: center; }

/* 访问地址解析预检弹窗 */
.domain-warn-grid {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.domain-warn-grid span { color: var(--text-3); }
.domain-warn-grid b { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--text); font-weight: 600; }
.domain-warn-grid b span { white-space: nowrap; }
#domain-warning-host { display: block; overflow-wrap: anywhere; }
.domain-warn-risk { margin-top: var(--sp-5); }
.domain-warn-risk .tip { font-size: var(--fs-sm); }
.access-https-note.warn { color: var(--warning); }
.access-https-note.danger { color: var(--danger); }
.access-https-note.info { color: var(--text-3); }

/* ============ 磁盘清理 ============ */
.cleanup-name { font-weight: 600; }
.cleanup-desc { margin-top: 2px; }
.cleanup-note { display: inline-block; margin-top: 4px; font-size: var(--fs-xs); color: var(--text-3); }
.cleanup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.cleanup-summary b { color: var(--text); font-weight: 600; }
.cleanup-progress {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.cleanup-progress .progress { margin-top: var(--sp-2); }
.cleanup-status.ok { color: var(--success); }
.cleanup-status.failed { color: var(--danger); }
.cleanup-status.running { color: var(--text-2); }
.cleanup-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.cleanup-confirm-row:last-of-type { border-bottom: 0; }
.cleanup-confirm-total { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }

/* 磁盘清理：窄屏每个项目一张卡，避免 5 列硬挤出现横向滚动 */
@media (max-width: 720px) {
  #cleanup-table thead { display: none; }
  #cleanup-table .table,
  #cleanup-table tbody,
  #cleanup-table tr,
  #cleanup-table td { display: block; width: 100%; }
  #cleanup-table tbody tr {
    position: relative;
    margin-bottom: 10px;
    padding: 12px 14px 12px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }
  #cleanup-table tbody tr:hover { background: var(--surface); }
  #cleanup-table tbody td { border: 0; padding: 0; white-space: normal; }
  #cleanup-table td.col-check {
    position: absolute;
    left: 14px;
    top: 14px;
    width: auto;
    padding: 0;
  }
  #cleanup-table td[data-label] { margin-top: 8px; font-size: var(--fs-sm); }
  #cleanup-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 44px;
    color: var(--text-3);
    font-size: var(--fs-xs);
  }
  #cleanup-table .cleanup-desc { font-size: var(--fs-xs); }
  #cleanup-table .cleanup-summary { margin-top: var(--sp-3); }
}

/* 运行环境页：清单元信息、版本选择与长文本收口 */
.store-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.store-meta-sep { color: var(--text-3); }
.store-meta-source { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-version { width: auto; height: 24px; font-size: var(--fs-xs); padding: 0 22px 0 6px; }
.env-source { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-record-msg { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* WEB 应用型站点：运行时提示 */
.web-runtime-hint { font-size: var(--fs-xs); color: var(--text-2); }
.web-runtime-hint.warn { color: var(--warning); }

