/**
 * 巡影织网 XunYing —— 交互模式层（XY_IX）样式
 * Copyright (c) 2026 抚顺市裕宸信息软件开发有限公司. All rights reserved.
 * 文件：monitor_site/public/css/xy-interact.css
 * ============================================================================
 * 【这一层是什么】
 * 2026-10-27 把四个参考视频（高级侧边栏 / 图表交互动画 / 弹层组件 / 六种菜单交互）
 * 拆成可复用的"交互模式"，与已有的 craft.css（观感基座）、xy-layer.js（弹层内核）
 * 互补：**craft 管"长什么样"，layer 管"弹层怎么开合"，本文件管"动起来的那一下"**。
 *
 * 【本文件覆盖的 20 个模式】
 *   1. .xy-nmark        侧栏滑动高亮块（菜单视频 01）
 *   2. .xy-nhead / .xy-ngroup   就地展开子菜单（菜单视频 02）
 *   3. .xy-odg          状态点 + 数字滚动切换（菜单视频 06）
 *   4. .xy-dp           顶部下落面板（菜单视频 03）
 *   5. .xy-ix-xhair     图表十字线跟随（图表视频 4/7）
 *   6. .xy-ix-brush     图表范围框选（图表视频 3）
 *   7. .xy-dk           底部悬浮停靠栏（菜单视频 04）
 *   8. .xy-bs           底部动作层（弹层视频 Bottom Sheet）
 *   —— 第二批（2026-10-28）——
 *   9. .xy-ix-legend    图表图例筛选（图表视频 1）
 *  10. .xy-ix-crumbs    下钻面包屑（图表视频 3 的回程）
 *  11. .xy-ix-pinchip   数据点锁定（图表视频 4/7）
 *  12. .xy-nsearch      侧栏菜单搜索 + 最近访问（侧栏视频 4）
 *  13. .xy-railfly      图标轨飞面（侧栏视频 2）
 *  14. .xy-pop          自由内容气泡（弹层视频角色 2）
 *  15. .xy-cd           情境抽屉（侧栏视频 5）
 *   —— 第三批（2026-10-28）新增 5 个 ——
 *  16. .xy-cmd          命令面板（菜单视频 05）
 *  17. [data-xy-dropdown]  下拉选择（弹层视频 角色 3）
 *  18. .xy-tip          通用悬浮提示（弹层视频 角色 1）
 *  19. 数据点高亮        Chart.js 全局插件（图表视频 2，画布内绘制，无 DOM/CSS）
 *  20. .xy-empty        四态空态（反模式清单 #9）
 *
 * 【三条硬纪律】
 *   ① 只动 transform / opacity / clip-path。宽度、高度、filter 一律不进 transition
 *      —— 前两类走合成层，后者每帧重排重绘，1080p 全屏图表上会掉到 30fps。
 *   ② 不写 `text-shadow: 0 0 Npx`。零偏移阴影等于主动糊字（craft-floor 禁令）。
 *   ③ 所有颜色吃 CSS 变量，五套皮肤（neon/light/aurora/sunset/scenery）零改动继承；
 *      唯一的皮肤特判放在文件末尾，且只用变量覆写，不复制整块样式。
 *
 * 【降级】
 * @media (prefers-reduced-motion: reduce) 里所有位移归零、时长归零，但**保留状态**
 * —— 用户关掉的是动画，不是功能。
 * ========================================================================== */

/* ==========================================================================
 * 〇、本层私有变量
 * -------------------------------------------------------------------------- */
:root {
    --ix-t-fast: 140ms;
    --ix-t-mid: 260ms;
    --ix-t-slow: 420ms;
    --ix-ease: var(--xy-ease, cubic-bezier(0.16, 1, 0.3, 1));
    /* 高亮块／面板／停靠栏三件套共用的"玻璃面"：比卡片浅一档、比底色亮一档 */
    --ix-glass: var(--surface-2, rgba(20, 22, 38, 0.82));
    --ix-glass-2: var(--surface-1, rgba(14, 16, 28, 0.9));
    --ix-line: var(--border-subtle, rgba(130, 150, 190, 0.16));
    --ix-line-lit: var(--border-glow, rgba(0, 255, 157, 0.42));
    --ix-ink: var(--text-primary, #fff);
    --ix-ink-dim: var(--text-muted, rgba(255, 255, 255, 0.52));
    --ix-tint: var(--neon-cyan, #00f5ff);
    --ix-danger: var(--neon-red, #ff3366);
    --ix-warn: var(--neon-orange, #ff9900);
    --ix-ok: var(--neon-green, #00ff9d);
}

/* ==========================================================================
 * 一、侧栏滑动高亮块（.xy-nmark）
 * --------------------------------------------------------------------------
 * 视频原话：「点击后高亮块顺着菜单滑动到当前项」。
 * 关键在于**块是一个元素**、位置靠 transform 变化 —— 而不是给每一项换背景色。
 * 换背景色是"跳"，滑过去才是"移动"，人眼能追踪到"我从哪去了哪"。
 *
 * 层级安排：高亮块 z-index:0，链接文字 z-index:1（.sidebar-link 已 position:relative
 * 时才有层叠上下文，这里显式给 z-index 更稳）。
 * ========================================================================== */
.sidebar-nav {
    position: relative;
}

.xy-nmark {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 0;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--ix-tint) 16%, transparent),
        color-mix(in srgb, var(--ix-tint) 4%, transparent) 78%,
        transparent);
    border: 1px solid color-mix(in srgb, var(--ix-tint) 26%, transparent);
    border-left: 2px solid var(--ix-tint);
    box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--ix-tint) 60%, transparent);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transform: translateY(0);
    transition: transform var(--ix-t-mid) var(--ix-ease),
                height var(--ix-t-mid) var(--ix-ease),
                opacity var(--ix-t-fast) linear;
    will-change: transform;
}

/* 悬停跟随：块变成"预告"，比静止高亮淡一档 —— 否则两个块同时亮，分不清哪个是当前页 */
.xy-nmark.is-hover {
    opacity: 1;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--ix-tint) 9%, transparent),
        transparent 82%);
    border-color: color-mix(in srgb, var(--ix-tint) 18%, transparent);
    border-left-color: color-mix(in srgb, var(--ix-tint) 55%, transparent);
    box-shadow: none;
}

/* 当前页：实的 */
.xy-nmark.is-active {
    opacity: 1;
}

.sidebar-nav > .xy-ngroup,
.sidebar-nav > .sidebar-link,
.sidebar-footer > .sidebar-link {
    position: relative;
    z-index: 1;
}

/* 收起态（.sidebar 宽 64px）：块只留一条 3px 的竖条，不跟着缩成圆点 */
.sidebar.is-collapsed .xy-nmark {
    left: 0;
    right: auto;
    width: 3px;
    border-radius: 0 3px 3px 0;
    border-left-width: 0;
    background: var(--ix-tint);
    box-shadow: 0 0 14px -2px var(--ix-tint);
}

/* 窄屏抽屉式侧栏：不做滑动块（一屏放不下，滑过去也看不见） */
@media (max-width: 900px) {
    .xy-nmark { display: none; }
}

/* ==========================================================================
 * 二、就地展开子菜单（.xy-ngroup / .xy-nhead）
 * --------------------------------------------------------------------------
 * 视频原话：「在菜单内展开、定位后 → 右侧内容跟着动」「高度和左侧高度、
 * 右侧栏位置一起变化」。
 *
 * 实现要点：
 *   · 用 grid-template-rows 0fr → 1fr 做高度动画。这是目前唯一**不需要知道
 *     内容高度**、又不会在 transition 里触发每帧重排的写法（max-height 要么
 *     跳、要么留一段空白延迟）。
 *   · 组头是 <button aria-expanded>，不是 <div> —— 键盘能 Tab 到、读屏能播报。
 *   · 组头**不是链接**：分组本身不导航，只负责收纳。
 * ========================================================================== */
.xy-ngroup {
    margin: 2px 0;
}

.xy-nhead {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px 7px 14px;
    background: none;
    border: 0;
    cursor: pointer;
    /* P0-4（2026-11-09）：原来组头 11.5px/600 反而比子项 13.5px 更小更弱，
       层级靠缩进硬撑。改成「更小但更重更亮」的结构标签：11px / 700 /
       --text-primary，字阶与字重同时跳级，六套皮肤下对比度都够。 */
    color: var(--text-primary, #fff);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: left;
    border-radius: 8px;
    transition: color var(--ix-t-fast) linear;
}

.xy-nhead:hover,
.xy-nhead:focus-visible {
    color: var(--ix-ink);
}

.xy-nhead:focus-visible {
    outline: 2px solid var(--ix-line-lit);
    outline-offset: -2px;
}

.xy-nhead__caret {
    flex: none;
    width: 11px;
    height: 11px;
    margin-left: auto;
    opacity: 0.85;
    transition: transform var(--ix-t-mid) var(--ix-ease);
}

.xy-ngroup.is-open .xy-nhead__caret {
    transform: rotate(90deg);
}

/* 组内有一项是当前页时，组标题留一个实心小点，让"折叠着的组里有我"看得见 */
.xy-nhead__dot {
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ix-tint);
    box-shadow: 0 0 8px -1px var(--ix-tint);
    opacity: 0;
    transition: opacity var(--ix-t-fast) linear;
}

.xy-ngroup.has-active:not(.is-open) .xy-nhead__dot {
    opacity: 1;
}

/* P0-3：组头项数 + 「只剩 1 项」的解释性说明。
   数字用 tabular-nums，避免 8/9 切换时组头轻微抖动。 */
.xy-nhead__count {
    flex: none;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.xy-nhead__why {
    margin: 2px 0 4px;
    padding: 0 14px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
}

.xy-nbody {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--ix-t-mid) var(--ix-ease);
}

.xy-ngroup.is-open > .xy-nbody {
    grid-template-rows: 1fr;
}

.xy-nbody > .xy-nbody__in {
    overflow: hidden;
    min-height: 0;
}

/* 子项比一级项窄一档、左内边距多一档，形成"树"的视觉从属 */
.xy-nbody .sidebar-link {
    padding-left: 18px;
}

.xy-nbody .nav-label {
    font-size: 13.5px;
}

/* 收起态：64px 图标轨放不下分组标题的文字。组头退化成一条分隔线 ——
   保留"这里分组了"的结构信息，不塞一排被裁掉的字。
   两套选择器都要写：xy-ui.js 打的是 html[data-nav-collapsed]，
   layout.php 的内联脚本另外给 aside 加 .is-collapsed，两者历史上都出现过。 */
.sidebar.is-collapsed .xy-nhead,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead {
    justify-content: center;
    padding: 0;
    margin: 8px 6px 2px;
    height: 1px;
    overflow: hidden;
    background: var(--ix-line);
    border-radius: 0;
    pointer-events: none;
}

.sidebar.is-collapsed .xy-nhead__label,
.sidebar.is-collapsed .xy-nhead__caret,
.sidebar.is-collapsed .xy-nhead__dot,
.sidebar.is-collapsed .xy-nhead__count,
.sidebar.is-collapsed .xy-nhead__why,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead__label,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead__caret,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead__dot,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead__count,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nhead__why {
    display: none;
}

/* 收起态的图标轨只放一级入口，子项照旧全展开（每个只剩一个图标，仍然认得出） */
.sidebar.is-collapsed .xy-nbody,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nbody {
    grid-template-rows: 1fr;
}

/* ==========================================================================
 * 三、状态点 + 数字滚动切换（.xy-odg / .xy-nbadge）
 * --------------------------------------------------------------------------
 * 视频原话：「数字变化时滚动切换」——不是数字淡入淡出，是每一位**竖向滚一格**。
 * 这就是老式里程表（odometer）的做法：每个数位是一条 0-9 的竖条，
 * 变化时整条往上/下移一格。改一个数字，只有那一位在动，其余静止。
 *
 * 为什么值得这么做：淡入淡出会让人看不出"是变大了还是变小了"；
 * 滚动方向本身就是信息（往上=增加）。
 * ========================================================================== */
.xy-odg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.xy-nbadge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--ix-danger) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--ix-danger) 42%, transparent);
    color: var(--ix-ink);
    font-family: var(--font-num);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
    transition: background-color var(--ix-t-fast) linear,
                border-color var(--ix-t-fast) linear;
}

/* 0 条时不显示红点：常驻的"0"是噪音，用户会当装饰忽略（然后就再也注意不到 1） */
.xy-nbadge[data-count="0"] {
    display: none;
}

/* 计数从 0 变非 0 的那一下：边框闪一圈，之后不再闪 */
.xy-nbadge.is-bump {
    animation: xyIxBump var(--ix-t-slow) var(--ix-ease) 1;
}

@keyframes xyIxBump {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ix-danger) 70%, transparent); }
    55%  { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* 数位竖条 */
.xy-od {
    display: inline-flex;
    height: 1em;
    overflow: hidden;
    line-height: 1;
    vertical-align: bottom;
}

/* 侧栏里：徽标靠右推，和 label 拉开 */
.sidebar-link .xy-nbadge {
    margin-left: auto;
}

/* 侧栏收起态（64px 图标轨）：数字挤不下，退化成一个小红点 ——
   要的是"这里有东西"，不是"有 3 个"。点了展开就看得到确切数字。 */
.sidebar.is-collapsed .sidebar-link .xy-nbadge,
html[data-nav-collapsed] .sidebar-link .xy-nbadge {
    position: absolute;
    top: 7px;
    right: 10px;
    min-width: 0;
    width: 7px;
    height: 7px;
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
}

.sidebar.is-collapsed .sidebar-link .xy-nbadge .xy-odg,
html[data-nav-collapsed] .sidebar-link .xy-nbadge .xy-odg {
    display: none;
}

/* 顶栏铃铛：徽标压在图标右上角 */
.xy-notify {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--ix-line);
    border-radius: 10px;
    background: transparent;
    color: var(--ix-ink);
    cursor: pointer;
    transition: border-color var(--ix-t-fast) linear,
                background-color var(--ix-t-fast) linear;
}

.xy-notify:hover {
    border-color: var(--ix-line-lit);
    background: color-mix(in srgb, var(--ix-tint) 8%, transparent);
}

.xy-notify:focus-visible {
    outline: 2px solid var(--ix-line-lit);
    outline-offset: 2px;
}

.xy-notify svg {
    width: 17px;
    height: 17px;
}

.xy-notify .xy-nbadge {
    position: absolute;
    top: -6px;
    right: -7px;
    height: 16px;
    min-width: 16px;
    padding: 0 4px;
    font-size: 10px;
    border-radius: 8px;
    box-shadow: 0 0 0 2px var(--ix-glass-2);
}

.xy-od__col {
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: transform var(--ix-t-slow) var(--ix-ease);
    will-change: transform;
}

.xy-od__col > i {
    display: block;
    height: 1em;
    font-style: normal;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
 * 四、顶部下落面板（.xy-dp）
 * --------------------------------------------------------------------------
 * 视频原话：「点击展开 / 头部下移 / 内容带下移」「外边的宽板保留」。
 *
 * 为什么用 clip-path 而不是 scaleY：scaleY(0→1) 会把面板里的文字一起压扁再拉长，
 * 一眼假。clip-path: inset(0 0 100% 0 → 0) 是"从上往下揭开"，文字始终是正的。
 * 再叠一个 -8px 的 translateY 收尾，让"落下来"有重量感。
 *
 * 面板本身 position: fixed，跟着锚点算 left/top —— 顶栏是 sticky，
 * absolute 定位在滚动后会跑掉。
 * ========================================================================== */
.xy-dp {
    position: fixed;
    z-index: 1500;                    /* 高于侧栏、低于 modal(1600) */
    width: 372px;
    max-width: calc(100vw - 24px);
    background: var(--ix-glass);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.7));
    backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.7));
    border: 1px solid var(--ix-line);
    border-radius: 14px;
    box-shadow: var(--shadow-card, 0 18px 44px rgba(0, 0, 0, 0.42));
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    clip-path: inset(0 0 100% 0 round 14px);
    pointer-events: none;
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-mid) var(--ix-ease),
                clip-path var(--ix-t-mid) var(--ix-ease);
}

.xy-dp.is-open {
    opacity: 1;
    transform: none;
    clip-path: inset(0 0 0 0 round 14px);
    pointer-events: auto;
}

/* 尖角：从"哪个按钮掉下来的"直接看出来，省掉一次视线寻找 */
.xy-dp__beak {
    position: absolute;
    top: -1px;
    width: 10px;
    height: 10px;
    background: var(--ix-glass);
    border-left: 1px solid var(--ix-line);
    border-top: 1px solid var(--ix-line);
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 2px;
}

.xy-dp__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 13px 14px 10px;
    border-bottom: 1px solid var(--ix-line);
}

.xy-dp__title {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ix-ink);
}

.xy-dp__sub {
    font-size: 11px;
    color: var(--ix-ink-dim);
}

.xy-dp__all {
    margin-left: auto;
    /* 20px 高 → 28px：它是个独立操作入口（不是正文里的内联链接，
       不享受 WCAG 2.5.8 的 inline 豁免），鼠标/触控都得点得中。
       上下各 4px 透明内边距，视觉位置不动。 */
    padding: 4px 2px;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--ix-tint);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.xy-dp__all:hover {
    border-bottom-color: currentColor;
}

.xy-dp__list {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;      /* 列表滚到底不带动整页 */
    padding: 6px;
}

.xy-dp__item {
    display: grid;
    grid-template-columns: 3px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color var(--ix-t-fast) linear;
}

/* 🔴 2026-10-29：grid 的 1fr 实为 minmax(auto, 1fr)，中间列会拒绝缩到
 * 正文 min-content 以下；而 .xy-dp__t / .xy-dp__m 是白空格不换行的，
 * min-content 就等于整句话宽度 → 列被撑开，列表出现横向滚动条、正文被切。
 * 实测 420px 下面板列表 scrollWidth 425 vs clientWidth 370（溢出 55px）。
 * 给子项补 min-width:0，让 ellipsis 真正生效（正文标题本来就写了省略号）。 */
.xy-dp__item > * { min-width: 0; }

.xy-dp__item:hover,
.xy-dp__item:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 8%, transparent);
    outline: none;
}

.xy-dp__item:focus-visible {
    box-shadow: inset 0 0 0 1px var(--ix-line-lit);
}

.xy-dp__sev {
    width: 3px;
    height: 100%;
    min-height: 26px;
    border-radius: 2px;
    background: var(--ix-ink-dim);
}

.xy-dp__item[data-sev="high"] .xy-dp__sev { background: var(--ix-danger); }
.xy-dp__item[data-sev="mid"]  .xy-dp__sev { background: var(--ix-warn); }
.xy-dp__item[data-sev="low"]  .xy-dp__sev { background: var(--ix-ok); }

.xy-dp__t {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ix-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xy-dp__m {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--ix-ink-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xy-dp__when {
    font-family: var(--font-num);
    font-size: 10.5px;
    color: var(--ix-ink-dim);
    white-space: nowrap;
}

/* 空态：四种里只做"没有未处理告警"这一种，且**必须说清是"没有"而不是"失败"**
   —— 把故障说成平安是本项目最忌讳的事（见 empty-state 四态口径） */
.xy-dp__empty {
    padding: 26px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--ix-ink-dim);
}

.xy-dp__empty b {
    display: block;
    margin-bottom: 6px;
    color: var(--ix-ok);
    font-size: 13px;
    font-weight: 600;
}

.xy-dp__foot {
    display: flex;
    gap: 8px;
    padding: 9px 12px;
    border-top: 1px solid var(--ix-line);
    background: color-mix(in srgb, #000 12%, transparent);
}

.xy-dp__foot a {
    /* 19px 高 → 25px：面板底部的两个入口是独立操作，不是正文内联链接，
       不享受 WCAG 2.5.8 的 inline 豁免。上下各 3px 透明内边距，视觉不动。 */
    padding: 3px 0;
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--ix-ink-dim);
    text-decoration: none;
}

.xy-dp__foot a:hover { color: var(--ix-tint); }

/* ==========================================================================
 * 五、图表十字线跟随 + 六、范围框选
 * --------------------------------------------------------------------------
 * 视频把它们拆成两件不同的事：
 *   「十字线会跟随鼠标移动」——回答"这一个点，什么时候、多少"
 *   「在图表上拖出一个范围」——回答"这一段，整体什么水平"
 * 两者共用一层覆盖画布，但状态互斥：按下拖动时收起十字线，避免两套参考线打架。
 * ========================================================================== */
.xy-ix-plot {
    position: relative;               /* 由 JS 打在 canvas 的父容器上 */
}

.xy-ix-plot > canvas {
    display: block;
}

.xy-ix-xhair {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--ix-t-fast) linear;
    z-index: 3;
}

.xy-ix-plot.is-xhair .xy-ix-xhair {
    opacity: 1;
}

.xy-ix-xhair__v,
.xy-ix-xhair__h {
    position: absolute;
    background: color-mix(in srgb, var(--ix-tint) 55%, transparent);
}

.xy-ix-xhair__v {
    top: 0;
    bottom: 0;
    width: 1px;
    left: 0;
}

.xy-ix-xhair__h {
    left: 0;
    right: 0;
    height: 1px;
    top: 0;
    /* 横线只画到鼠标右侧一点点，避免横贯整张图喧宾夺主 */
    mask-image: linear-gradient(90deg, #000 0, #000 var(--ix-hx, 50%), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 var(--ix-hx, 50%), transparent 100%);
}

/* 吸附点：十字线交叉处的实心点，比虚线更能说明"锁在了这个数据点上" */
.xy-ix-xhair__dot {
    position: absolute;
    width: 9px;
    height: 9px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--ix-tint);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ix-tint) 22%, transparent);
    left: 0;
    top: 0;
}

/* 跟随标签：贴着鼠标，出右边界自动翻到左侧（自动翻转，不做遮挡） */
.xy-ix-xhair__tag {
    position: absolute;
    left: 0;
    top: 0;
    padding: 5px 8px;
    border-radius: 7px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    color: var(--ix-ink);
    font-family: var(--font-num);
    font-size: 11px;
    line-height: 1.45;
    white-space: nowrap;
    transform: translate(12px, -50%);
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.9);
}

.xy-ix-xhair__tag.is-flip {
    transform: translate(-100%, -50%) translateX(-12px);
}

.xy-ix-xhair__tag em {
    display: block;
    font-style: normal;
    color: var(--ix-ink-dim);
    font-size: 10px;
}

/* 框选层 */
.xy-ix-brush {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.xy-ix-brush__rect {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    background: color-mix(in srgb, var(--ix-tint) 12%, transparent);
    border-left: 1px solid var(--ix-tint);
    border-right: 1px solid var(--ix-tint);
    display: none;
}

.xy-ix-brush__rect.is-live {
    display: block;
}

.xy-ix-brush__cap {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--ix-tint);
    color: #06121a;
    font-family: var(--font-num);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

/* 有已生效区间时（.is-picked）：图外框亮起 + 右上角出现"复位"小按钮 */
.xy-ix-plot.is-picked::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid color-mix(in srgb, var(--ix-tint) 40%, transparent);
    border-radius: inherit;
    pointer-events: none;
}

.xy-ix-reset {
    position: absolute;
    right: 6px;
    top: 6px;
    z-index: 5;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--ix-ink);
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    cursor: pointer;
}

.xy-ix-plot.is-picked .xy-ix-reset {
    display: inline-flex;
}

/* 提示条：告诉用户"可以拖" —— 一次性，不常驻 */
.xy-ix-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line);
    color: var(--ix-ink-dim);
    font-size: 11.5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--ix-t-mid) linear;
    z-index: 5;
}

.xy-ix-plot.is-hinting .xy-ix-hint {
    opacity: 1;
}

/* ==========================================================================
 * 七、底部悬浮停靠栏（.xy-dk）
 * --------------------------------------------------------------------------
 * 视频原话：「按鼠标距离回弹缩放图标大小」。
 *
 * 距离由 JS 每帧写进每个图标的 --dk-s（0.72 ~ 1.28），这里只负责把它乘进
 * transform。**不做 width/height 动画**：图标缩放走 transform 才不会推挤布局。
 * 底部留 safe-area，iPhone 上不被小黑条盖住。
 * ========================================================================== */
.xy-dk {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1180;                    /* 低于 .xy-top(1100)? 见下：高于它但不遮它 */
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 7px 9px;
    border-radius: 16px;
    background: var(--ix-glass);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.8));
    backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.8));
    border: 1px solid var(--ix-line);
    box-shadow: var(--shadow-card, 0 18px 40px rgba(0, 0, 0, 0.4));
    /* 0.62 太淡：停靠栏是"常驻入口"，不是"想起来了才用"——
       太低调等于没有，用户根本不知道有这排东西 */
    opacity: 0.78;
    transition: opacity var(--ix-t-mid) var(--ix-ease);
}

.xy-dk:hover,
.xy-dk:focus-within {
    opacity: 1;
}

.xy-dk__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ix-tint) 7%, transparent);
    color: var(--ix-ink);
    cursor: pointer;
    transform: scale(var(--dk-s, 1)) translateY(var(--dk-y, 0px));
    transform-origin: bottom center;
    transition: transform 120ms var(--ix-ease),
                background-color var(--ix-t-fast) linear;
    will-change: transform;
}

.xy-dk__btn:hover {
    background: color-mix(in srgb, var(--ix-tint) 16%, transparent);
}

.xy-dk__btn:focus-visible {
    outline: 2px solid var(--ix-line-lit);
    outline-offset: 2px;
}

.xy-dk__btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* 图标下方的名字：只在鼠标进入停靠栏时显示（dock 平时不该有一排文字） */
.xy-dk__btn::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line);
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-fast) var(--ix-ease);
}

/* 🔴 2026-10-28 修：原来是 `.xy-dk:hover .xy-dk__btn::after` ——
   鼠标只要进到停靠栏，**五个按钮的名字会同时全部亮出来**，像一排标签墙。
   名字是"这个图标是什么"的补充信息，只在指着的那一个上出现就够了。
   改成按按钮自身的 hover / 键盘焦点触发（:focus-visible 保证 Tab 也能看到）。 */
.xy-dk__btn:hover::after,
.xy-dk__btn:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.xy-dk__sep {
    width: 1px;
    height: 20px;
    margin: 0 2px;
    background: var(--ix-line);
    align-self: center;
}

/* 窄屏：停靠栏压到只留三个，且不吃满底部（会和移动端的批量操作栏抢位置） */
@media (max-width: 720px) {
    .xy-dk {
        display: none;
    }
}

/* 窄屏替代品：左下角"更多"按钮 —— 拇指最容易够到的位置。
   右下角已经有 .xy-top（回到顶部，bottom:78px），放同一侧会叠成一摞。 */
.xy-dk-fab {
    position: fixed;
    left: 14px;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 1170;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--ix-line);
    background: var(--ix-glass);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.7));
    backdrop-filter: blur(calc(var(--glass-blur, 20px) * 0.7));
    color: var(--ix-ink);
    box-shadow: var(--shadow-card, 0 12px 30px rgba(0, 0, 0, 0.4));
    cursor: pointer;
}

.xy-dk-fab svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 720px) {
    .xy-dk-fab {
        display: flex;
    }
}

/* 表格勾选后 craft 会升起批量操作栏（.xy-batchbar，底部居中）——
   两者同一位置，停靠栏必须让位。:has() 不支持的老浏览器只是叠在一起，
   不致命；能用 :has() 的浏览器就完全不打架。 */
body:has(.xy-batchbar) .xy-dk {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
}

/* ==========================================================================
 * 八、底部动作层（.xy-bs）
 * --------------------------------------------------------------------------
 * 视频把它归为弹层第 6 种：「适合手机端的底部动作层 —— 分享、切换账户、
 * 选择下一步」。它和 Drawer 的差别不是长相，是**语义**：Drawer 是"我进去干一件事"，
 * Bottom Sheet 是"我在这里挑一件"。
 *
 * 差异化能力：抓手（grabber）+ 下拉关闭。下拉距离超过 92px 或甩速够快即关闭，
 * 期间遮罩随位移线性变淡 —— 让"松手会关"这件事在松手之前就看得见。
 * ========================================================================== */
.xy-bs-scrim {
    position: fixed;
    inset: 0;
    z-index: 1540;
    background: rgba(4, 6, 12, 0.52);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--ix-t-mid) linear;
}

.xy-bs-scrim.is-open {
    opacity: 1;
}

.xy-bs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1545;
    margin: 0 auto;
    max-width: 560px;
    padding: 0 0 max(12px, env(safe-area-inset-bottom, 0px));
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.7);
    transform: translateY(101%);
    transition: transform var(--ix-t-mid) var(--ix-ease);
    will-change: transform;
    touch-action: none;                /* 拖拽由手势接管，禁掉浏览器滚动 */
}

.xy-bs.is-open {
    transform: none;
}

.xy-bs.is-drag {
    transition: none;
}

.xy-bs__grip {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    cursor: grab;
}

.xy-bs__grip::before {
    content: "";
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--ix-ink) 26%, transparent);
}

.xy-bs__head {
    padding: 2px 18px 10px;
}

.xy-bs__title {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: var(--ix-ink);
}

.xy-bs__sub {
    margin: 3px 0 0;
    font-size: 11.5px;
    color: var(--ix-ink-dim);
}

.xy-bs__list {
    padding: 0 10px 6px;
    max-height: 54vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.xy-bs__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 10px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear;
}

.xy-bs__item:hover,
.xy-bs__item:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 9%, transparent);
    outline: none;
}

.xy-bs__item:focus-visible {
    box-shadow: inset 0 0 0 1px var(--ix-line-lit);
}

.xy-bs__item svg {
    flex: none;
    width: 17px;
    height: 17px;
    color: var(--ix-ink-dim);
}

.xy-bs__item.is-danger {
    color: var(--ix-danger);
}

.xy-bs__item.is-danger svg {
    color: var(--ix-danger);
}

.xy-bs__item small {
    margin-left: auto;
    font-size: 11px;
    color: var(--ix-ink-dim);
}

.xy-bs__cancel {
    display: block;
    width: calc(100% - 20px);
    margin: 6px 10px 0;
    padding: 12px;
    border: 1px solid var(--ix-line);
    border-radius: 12px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.xy-bs__cancel:hover {
    background: color-mix(in srgb, var(--ix-ink) 6%, transparent);
}

/* ==========================================================================
 * 九、图表图例筛选（.xy-ix-legend / .xy-ix-lg / .xy-ix-lg-all）
 * --------------------------------------------------------------------------
 * Chart.js 自带的图例是**死的**：只能看，不能点。视频里那段"点一下图例，
 * 那条线淡出、Y 轴重新标定"才是真正有用的部分 —— 看告警趋势时，人们想知道
 * 的是"去掉那条噪声大的线之后，剩下几条是什么形状"。
 *
 * 两个细节决定这东西好不好用：
 *   · 关到只剩一条时**不许再关**（JS 拦），否则图变空白，用户以为坏了；
 *   · 关掉的那一条要**留痕**（划掉 + 色块变空心），不能直接消失 ——
 *     否则用户找不到"怎么加回来"。
 * ========================================================================== */
.xy-ix-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0 2px;
}

.xy-ix-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px 4px 7px;
    border: 1px solid var(--ix-line);
    border-radius: 999px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 11.5px;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color var(--ix-t-fast) linear,
                background-color var(--ix-t-fast) linear,
                opacity var(--ix-t-fast) linear;
}

.xy-ix-lg > i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.xy-ix-lg:hover {
    border-color: color-mix(in srgb, var(--ix-tint) 45%, transparent);
    background: color-mix(in srgb, var(--ix-tint) 7%, transparent);
}

.xy-ix-lg:focus-visible {
    outline: 2px solid var(--ix-tint);
    outline-offset: 1px;
}

/* 关掉态：文字划掉、色块掏空 —— "被关掉"必须一眼可辨，而不是变成另一个普通按钮 */
.xy-ix-lg[aria-pressed="false"] {
    color: var(--ix-ink-dim);
    border-color: transparent;
    background: color-mix(in srgb, var(--ix-ink) 5%, transparent);
}

.xy-ix-lg[aria-pressed="false"] > span {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.xy-ix-lg[aria-pressed="false"] > i {
    background: transparent !important;
    box-shadow: inset 0 0 0 1.5px currentColor;
    opacity: 0.55;
}

.xy-ix-lg-all {
    margin-left: auto;
    padding: 3px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ix-tint);
    font-family: var(--font-ui);
    font-size: 11px;
    cursor: pointer;
}

.xy-ix-lg-all:hover {
    background: color-mix(in srgb, var(--ix-tint) 12%, transparent);
}

.xy-ix-lg-all[hidden] {
    display: none;
}

/* ==========================================================================
 * 十、下钻面包屑（.xy-ix-crumbs）
 * --------------------------------------------------------------------------
 * 框选放大最烦的地方不是"放不大"，是"放大了回不去"。视频里的处理是给一条
 * 路径条：全部 › 08-13 › 08-13 14:00 —— 每一层都能点回去，且当前层不可回。
 * 只有一层时整条隐藏（JS 控），因为"全部"孤零零一条只是噪音。
 * ========================================================================== */
.xy-ix-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin: 0 0 6px;
    padding: 0 2px;
    font-family: var(--font-ui);
    font-size: 11px;
    line-height: 1.5;
}

.xy-ix-crumbs[hidden] {
    display: none;
}

.xy-ix-crumbs__lv {
    padding: 2px 6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--ix-tint);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear;
}

.xy-ix-crumbs__lv:hover {
    background: color-mix(in srgb, var(--ix-tint) 12%, transparent);
}

.xy-ix-crumbs__lv.is-now {
    color: var(--ix-ink);
    font-weight: 600;
    cursor: default;
}

.xy-ix-crumbs__lv.is-now:hover {
    background: none;
}

.xy-ix-crumbs__sep {
    color: var(--ix-ink-dim);
    font-size: 11px;
    user-select: none;
}

/* ==========================================================================
 * 十一、数据点锁定（.xy-ix-pinchip）
 * --------------------------------------------------------------------------
 * 十字线在鼠标移开时就没了 —— 想抄一个数值到工单里，手一动数字就消失。
 * 点一下锁定，数值牌钉在图上，按 × 或 Esc 解锁。
 * 位置放左上角而不是跟着鼠标：钉住之后它就不该再动。
 * ========================================================================== */
.xy-ix-pinchip {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 3px 3px 9px;
    border-radius: 7px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    color: var(--ix-ink);
    font-family: var(--font-num);
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
    box-shadow: 0 8px 20px -14px rgba(0, 0, 0, 0.9);
}

.xy-ix-pinchip[hidden] {
    display: none;
}

.xy-ix-pinchip > button {
    width: 17px;
    height: 17px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--ix-ink-dim);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.xy-ix-pinchip > button:hover {
    background: color-mix(in srgb, var(--ix-danger) 20%, transparent);
    color: var(--ix-ink);
}

/* 锁定期间图框亮起：告诉用户"这张图现在是冻结状态" */
.xy-ix-plot.is-pinned::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px dashed color-mix(in srgb, var(--ix-tint) 55%, transparent);
    border-radius: inherit;
    pointer-events: none;
}

/* ==========================================================================
 * 十二、侧栏菜单搜索（.xy-nsearch）
 * --------------------------------------------------------------------------
 * 侧栏 22 项分 5 组之后，"找一个页面"变成了"先想它在哪一组"。
 * 搜索框解决的就是这件事：输入即过滤，命中项高亮、未命中项压暗、
 * 整组没有命中就整组收掉（三组全空时框子变红提示"没有匹配"）。
 *
 * 四个必须做对的点：
 *   ① 搜索时**所有分组强制展开** —— 否则命中的项藏在折叠组里，等于没搜到；
 *   ② 空输入时给「最近访问」而不是空着 —— 侧栏搜索 80% 的使用是回到刚看过的页；
 *   ③ 输入框 sticky 在顶部 —— 侧栏一滚就找不到搜索框是最常见的失败；
 *   ④ 清空后必须把 is-hit / is-dim / is-empty 全部摘干净，不能留残影。
 * ========================================================================== */
.xy-nsearch {
    /* 显式 relative：图标/清空键是绝对定位，定位基准必须是这里。
       原来只靠 position:sticky 隐式充当包含块 —— 能用，但一旦有人在祖先上加
       transform/filter，包含块就会换人，图标会突然跑到别处。 */
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    margin: 0 0 6px;
    padding: 6px 8px;
    background: var(--ix-glass-2);
    border-bottom: 1px solid var(--ix-line);
}

.xy-nsearch__ico {
    position: absolute;
    /* 🔴 别写死 left。这里跟 .xy-nsearch__in 的左右内距是一套数：
       容器 padding 8 → input 左边界 8；input 内距 32 → 文字起点 41；
       图标 18 起、宽 13 到 31，中间留 10px 呼吸。
       两边任何一处改动都必须同步，否则又回到"图标压字"。 */
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    color: var(--ix-ink-dim);
    pointer-events: none;
}

.xy-nsearch__ico svg {
    width: 13px;
    height: 13px;
}

/* 🔴 为什么前面挂 #xyNavSearch：
   style.css 里有一条针对所有文本类 input 的通用规则，选择器是
   `input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):
    not([type="range"]):not([type="file"]):not([type="submit"]):
    not([type="button"]):not([type="reset"]):not([type="image"])`
   —— 9 个 :not() 让它拿到 0,10,1 的特异性，把 .xy-nsearch__in（0,1,0）
   的 padding-left:26px / height:30px / line-height:30px 全部压成
   padding-left:14px / line-height:1.5，再叠加 content-box，
   输入框实测被撑到 40px 高，文字从 35px 起 —— 正好被 18~31 的图标压住 6px。
   提权到 (1,1,0) 是这里最干净的办法，不需要 !important，
   也不会波及页面上其他输入框。 */
#xyNavSearch .xy-nsearch__in {
    box-sizing: border-box;
    width: 100%;
    height: 30px;
    /* 🔴 必须显式写 min-height。
       style.css 的通用输入框规则带 `min-height: var(--control-h)`（=40px），
       而 min-height 在级联里**永远压过 height** —— 只提权改 height 是没用的，
       实测加了 #id 之后 height 仍然算出 40，就是这个原因。 */
    min-height: 0;
    padding: 0 32px;
    border: 1px solid var(--ix-line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--ix-ink) 4%, transparent);
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 28px;
    outline: none;
    /* 抹掉 Chromium 给 type=search 的默认内阴影/圆角，否则和 8px 圆角打架 */
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--ix-t-fast) linear,
                background-color var(--ix-t-fast) linear;
}

#xyNavSearch .xy-nsearch__in::placeholder {
    color: var(--ix-ink-dim);
}

#xyNavSearch .xy-nsearch__in:focus {
    border-color: color-mix(in srgb, var(--ix-tint) 55%, transparent);
    background: color-mix(in srgb, var(--ix-tint) 6%, transparent);
}

/* 去掉 Safari 自带的搜索叉，否则和我们的清空键叠成两个 */
.xy-nsearch__in::-webkit-search-cancel-button {
    display: none;
}

.xy-nsearch__x {
    position: absolute;
    /* right 与 input 的右内距 32px 联动：容器 padding 8 → input 右边界 = 宽-8，
       文字右界 = 宽-8-1-32 = 宽-41；按钮占 宽-30 ~ 宽-6，中间留 11px。
       原来 right:15px + 18px 宽，按钮左边界在 宽-33，而文字右界在 宽-41 之前就被
       padding 限住了 —— 加上 padding-right 被压成 14px，长文本会直接钻到 × 底下。 */
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    /* 18 → 24：WCAG 2.2 AA 的指针目标下限（2.5.8）。视觉圆点仍是 18px，
       多出来的 6px 靠 flex 居中 + 透明外圈吃掉，不改变观感。 */
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 背景只画内圈 18px：命中区 24 是为了好点，但视觉上不该跟着变胖。
       box-sizing 全局是 border-box，所以 24 - 3*2 = 18，content-box 裁切后正好。 */
    box-sizing: border-box;
    padding: 3px;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ix-ink) 12%, transparent);
    background-clip: content-box;
    color: var(--ix-ink);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.xy-nsearch__x[hidden] {
    display: none;
}

.xy-nsearch__x:hover {
    background: color-mix(in srgb, var(--ix-ink) 22%, transparent);
}

/* 最近访问：空输入时才出现，一行小胶囊 */
.xy-nsearch__recent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 0 10px 8px;
}

.xy-nsearch__recent[hidden] {
    display: none;
}

.xy-nsearch__rl {
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-family: var(--font-ui);
    font-size: 10.5px;
    letter-spacing: 0.06em;
}

.xy-nsearch__chip {
    max-width: 100%;
    overflow: hidden;
    padding: 2px 8px;
    border: 1px solid var(--ix-line);
    border-radius: 999px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 11px;
    line-height: 1.6;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}

.xy-nsearch__chip:hover {
    border-color: color-mix(in srgb, var(--ix-tint) 50%, transparent);
    color: var(--ix-tint);
}

/* —— 搜索态：全部展开 —— */
.sidebar-nav.is-searching .xy-ngroup > .xy-nbody {
    grid-template-rows: 1fr;
}

.sidebar-nav.is-searching .xy-nhead__caret {
    opacity: 0.4;
}

/* 命中：实心亮；未命中：用**次级文字色**压暗，而不是整体 opacity
   🔴 这里走过一次弯路，记下来：
   最初用 `opacity: 0.26`，后来提到 0.46 —— 在 neon 皮肤上量出来 4.58:1 刚好过，
   就以为修好了。切到另外四套皮肤一测：light 只有 **2.09:1**、aurora 4.22、
   sunset 4.41、scenery 4.29，全部低于 WCAG AA 的 4.5:1。
   原因很直接：opacity 是把前景色往背景色上混，**背景越浅、混完越接近背景**，
   所以同一份透明度在浅底上的可读性损失远大于深底。
   换成本项目的次级文字 token（--ix-ink-dim）就好 —— 它是每套皮肤各自调过的，
   深浅底都保证可读，层级差异靠"比正文暗一档"而不是"整块发虚"来体现。 */
.sidebar-nav.is-searching .sidebar-link.is-dim {
    opacity: 1;
    color: var(--ix-ink-dim);
}

/* 键盘游标落在被压暗的项上时必须回满 —— 否则"回车会去哪"看不出来 */
.sidebar-nav.is-searching .sidebar-link.is-dim.is-cursor {
    color: var(--ix-ink);
}

.sidebar-nav.is-searching .sidebar-link.is-hit {
    color: var(--ix-tint);
}

.sidebar-nav.is-searching .sidebar-link.is-hit .nav-label {
    font-weight: 600;
}

/* 键盘游标：与"鼠标悬停"区分开 —— 悬停是跟随，游标是"回车就会去这里" */
.sidebar-nav .sidebar-link.is-cursor {
    background: color-mix(in srgb, var(--ix-tint) 14%, transparent);
    border-radius: 8px;
    outline: 1px solid color-mix(in srgb, var(--ix-tint) 45%, transparent);
    outline-offset: -1px;
}

/* 整组零命中：收掉，不留一条空标题 */
.sidebar-nav.is-searching .xy-ngroup.is-empty {
    display: none;
}

/* 全空：框子变红 + 一行提示（提示走 ::after，不额外插 DOM，清空即消失） */
.xy-nsearch.is-none .xy-nsearch__in {
    border-color: color-mix(in srgb, var(--ix-danger) 60%, transparent);
}

.xy-nsearch.is-none::after {
    content: "没有匹配的菜单";
    position: absolute;
    left: 16px;
    top: 100%;
    margin-top: 4px;
    color: var(--ix-danger);
    font-family: var(--font-ui);
    font-size: 10.5px;
    pointer-events: none;
}

/* P0-1（2026-11-09）：收起态 64px 图标轨放不下输入框 —— 原来整块隐藏，
   用户在这个状态下完全没法搜索。现在换成一枚图标按钮，点了展开侧栏再聚焦。
   展开态这枚按钮不占位（display:none）。 */
.xy-nsearch__rail {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    margin: 0 auto 6px;
    padding: 0;
    border: 1px solid var(--ix-line);
    border-radius: 10px;
    background: none;
    color: var(--ix-ink);
    cursor: pointer;
}

.xy-nsearch__rail svg {
    width: 16px;
    height: 16px;
}

.xy-nsearch__rail:hover,
.xy-nsearch__rail:focus-visible {
    border-color: var(--ix-line-lit);
    color: var(--ix-tint);
}

.xy-nsearch__rail:focus-visible {
    outline: 2px solid var(--ix-line-lit);
    outline-offset: 2px;
}

.sidebar.is-collapsed .xy-nsearch,
.sidebar.is-collapsed .xy-nsearch__recent,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nsearch,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nsearch__recent {
    display: none;
}

.sidebar.is-collapsed .xy-nsearch__rail,
html[data-nav-collapsed="1"] .sidebar-nav .xy-nsearch__rail {
    display: flex;
}

/* ==========================================================================
 * 十三、图标轨飞面（.xy-railfly）
 * --------------------------------------------------------------------------
 * 侧栏收起成 64px 图标轨后，二级菜单就没地方去了 —— 视频里的做法是
 * "悬停图标 → 面版从右侧飞出来"，这样收起态依然能用全套导航。
 *
 * 位置由 JS 算好写进 style（left/top/width），CSS 只管进出的那一下：
 * 位移 6px + 透明度，不做缩放 —— 缩放会让面版里的文字重排发虚。
 * ========================================================================== */
.xy-railfly {
    position: fixed;
    z-index: 1450;                 /* 高于侧栏(1100)，低于停靠栏与弹层 */
    min-width: 180px;
    max-width: 260px;
    padding: 4px;
    border-radius: 12px;
    background: var(--ix-glass);
    border: 1px solid var(--ix-line);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.95);
    opacity: 0;
    transform: translateX(-6px);
    pointer-events: none;
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-fast) var(--ix-ease);
}

.xy-railfly.is-on {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.xy-railfly__head {
    padding: 7px 9px 6px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xy-railfly__item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

.xy-railfly__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    opacity: 0.85;
    font-size: 13px;   /* 字体图标兜底；svg 不吃这个字号 */
}

.xy-railfly__ico svg {
    width: 15px;
    height: 15px;
}

.xy-railfly__item > svg,
.xy-railfly__item > i {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    opacity: 0.85;
}

.xy-railfly__item > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.xy-railfly__item:hover {
    background: color-mix(in srgb, var(--ix-tint) 12%, transparent);
}

.xy-railfly__item.is-on {
    color: var(--ix-tint);
    background: color-mix(in srgb, var(--ix-tint) 16%, transparent);
    font-weight: 600;
}

/* ==========================================================================
 * 十四、自由内容气泡（.xy-pop）
 * --------------------------------------------------------------------------
 * 弹层六角色里的第 2 种：**锁定触发点之后才展开的补充说明**。
 * 与 Tooltip 的分界很清楚：Tooltip 不接收点击、移开就走；Popover 能放按钮、
 * 能选文字、点外面才关。
 *
 * 定位走 fixed + JS 算四向翻转（下方不够翻上方、右边不够往左推），
 * CSS 不参与定位 —— 参与就会和 JS 抢 left/top。
 * ========================================================================== */
.xy-pop {
    position: fixed;
    z-index: 1650;                 /* 高于 modal(1600)：表格可能在弹窗里 */
    min-width: 160px;
    max-width: min(340px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.65;
    box-shadow: 0 20px 44px -24px rgba(0, 0, 0, 0.95);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-fast) var(--ix-ease);
}

.xy-pop.is-on {
    opacity: 1;
    transform: none;
}

/* 被截断单元格的全文：保留换行、允许任何位置断词（长 URL / 长哈希都不会撑破） */
.xy-pop__full {
    max-height: 40vh;
    overflow: auto;
    overscroll-behavior: contain;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

/* ==========================================================================
 * 十五、情境抽屉（.xy-cd）
 * --------------------------------------------------------------------------
 * 侧栏视频第 5 式：「不跳页。上下文一直在，做完一件事，回到原地。」
 *
 * 它不是"详情页"：关掉之后表格的滚动位置、筛选条件、勾选状态全都在。
 * 所以取舍是**半打断** —— 有遮罩（点遮罩关闭）、Esc 关闭、焦点归还，
 * 但不做成必须先处理的模态对话。
 *
 * 动效只做右侧推入（transform），不做模糊背景 —— 遮罩一模糊，
 * 底下表格就看不清了，而"能看见底下是什么"正是这个设计的价值。
 * ========================================================================== */
.xy-cd-scrim {
    position: fixed;
    inset: 0;
    z-index: 1700;
    background: rgba(4, 8, 14, 0.46);
    opacity: 0;
    transition: opacity var(--ix-t-mid) linear;
}

.xy-cd-scrim.is-on {
    opacity: 1;
}

.xy-cd {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1710;
    display: flex;
    flex-direction: column;
    width: min(430px, 94vw);
    background: var(--ix-glass-2);
    border-left: 1px solid var(--ix-line-lit);
    box-shadow: -24px 0 60px -30px rgba(0, 0, 0, 0.95);
    transform: translateX(102%);
    transition: transform var(--ix-t-mid) var(--ix-ease);
    /* 刻意不写 will-change:transform：抽屉里有整屏的键值文字，永久提升合成层
       会让文字先光栅化进纹理再合成，整块发虚（2026-10-27 字体发虚复盘第 1 条）。 */
}

.xy-cd.is-on {
    transform: none;
}

.xy-cd__head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--ix-line);
}

.xy-cd__head > div {
    min-width: 0;
    flex: 1;
}

.xy-cd__t {
    margin: 0;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.xy-cd__s {
    margin: 4px 0 0;
    /* 11.5px 用 --ix-ink-dim(muted) 在 neon 深底只有 3.1:1，读不清 → 升一档 */
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-family: var(--font-ui);
    font-size: 11.5px;
    line-height: 1.6;
    word-break: break-word;
}

.xy-cd__s[hidden] {
    display: none;
}

.xy-cd__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--ix-line);
    border-radius: 7px;
    background: none;
    color: var(--ix-ink-dim);
    cursor: pointer;
    transition: color var(--ix-t-fast) linear,
                border-color var(--ix-t-fast) linear;
}

.xy-cd__x:hover {
    color: var(--ix-ink);
    border-color: color-mix(in srgb, var(--ix-danger) 55%, transparent);
}

.xy-cd__body {
    flex: 1;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 18px;
}

/* 键值对：两列网格，值列更宽 —— 值是给人读的，键只是标签 */
.xy-cd__dl {
    display: grid;
    grid-template-columns: minmax(72px, 32%) 1fr;
    margin: 0;
}

.xy-cd__dl > dt,
.xy-cd__dl > dd {
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--ix-line);
}

.xy-cd__dl > dt {
    padding-right: 10px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    word-break: break-word;
}

.xy-cd__dl > dd {
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 12.5px;
    line-height: 1.65;
    word-break: break-word;
}

.xy-cd__dl > dd a {
    color: var(--ix-tint);
}

.xy-cd__empty {
    margin: 0;
    padding: 26px 0;
    color: var(--ix-ink-dim);
    font-family: var(--font-ui);
    font-size: 12.5px;
    text-align: center;
}

.xy-cd__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--ix-line);
}

.xy-cd__nav {
    padding: 5px 10px;
    border: 1px solid var(--ix-line);
    border-radius: 7px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 11.5px;
    cursor: pointer;
    transition: border-color var(--ix-t-fast) linear,
                background-color var(--ix-t-fast) linear;
}

.xy-cd__nav:hover {
    border-color: color-mix(in srgb, var(--ix-tint) 50%, transparent);
    background: color-mix(in srgb, var(--ix-tint) 8%, transparent);
}

.xy-cd__nav[hidden] {
    display: none;
}

.xy-cd__pos {
    color: var(--text-secondary, rgba(255, 255, 255, 0.86));
    font-family: var(--font-num);
    font-size: 11px;
    white-space: nowrap;
}

/* ==========================================================================
 * 十六、命令面板（.xy-cmd）—— 菜单视频 05「命令面板」
 * --------------------------------------------------------------------------
 * ⌘K / Ctrl+K 唤起的全局浮层：模糊匹配从 .sidebar-link 自动发现的命令 + 几条全局动作。
 * 键盘优先（↑↓ 移动 / Enter 执行 / Esc 关闭 / 点浮层外关闭）。
 *
 * 纪律：只动 transform/opacity；z-index 2200（与 craft.css 的 .xy-cmdk 同段，见二十三层级表）；
 *   整块浮层靠 scrim 的 opacity 控制显隐，box 只做 -12px 下落 + 微缩放的入场，
 *   不写 will-change（盒子是文字清单，永久合成层会让字发虚，见情境抽屉复盘）。
 * ========================================================================== */
.xy-cmd__scrim {
    position: fixed;
    inset: 0;
    /* 🔴 2026-10-28 修：原来是 1720 —— 比 Toast(1900) 还低，在面板里执行
       动作弹 toast，toast 会盖在面板上。且与 craft.css 的 .xy-cmdk(2200)、
       xy-layer.js 的 Z.cmdk(2200) 不是同一个值。现统一到 2200。 */
    z-index: 2200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 14vh;
    background: rgba(4, 8, 14, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ix-t-mid) linear;
}

.xy-cmd__scrim.is-open {
    opacity: 1;
    pointer-events: auto;
}

.xy-cmd {
    width: min(560px, calc(100vw - 24px));
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    border-radius: 14px;
    box-shadow: 0 30px 70px -34px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    transform: translateY(-12px) scale(0.985);
    transition: transform var(--ix-t-mid) var(--ix-ease);
}

.xy-cmd__scrim.is-open .xy-cmd {
    transform: none;
}

.xy-cmd__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ix-line);
}

.xy-cmd__ico {
    display: inline-flex;
    flex: none;
    color: var(--ix-ink-dim);
}

.xy-cmd__ico svg {
    width: 16px;
    height: 16px;
}

.xy-cmd__in {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.4;
}

.xy-cmd__in::placeholder {
    color: var(--ix-ink-dim);
}

.xy-cmd__kbd {
    flex: none;
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid var(--ix-line);
    color: var(--ix-ink-dim);
    font-family: var(--font-ui);
    font-size: 10px;
    line-height: 1.6;
}

.xy-cmd__list {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
}

.xy-cmd__row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear;
}

.xy-cmd__row:hover,
.xy-cmd__row:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 9%, transparent);
    outline: none;
}

.xy-cmd__row:focus-visible {
    box-shadow: inset 0 0 0 1px var(--ix-line-lit);
}

.xy-cmd__row.is-cursor {
    background: color-mix(in srgb, var(--ix-tint) 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ix-tint) 45%, transparent);
}

.xy-cmd__rl {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xy-cmd__rh {
    flex: none;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--ix-line);
    color: var(--ix-ink-dim);
    font-family: var(--font-ui);
    font-size: 10.5px;
    line-height: 1.5;
}

.xy-cmd__none {
    padding: 22px 16px;
    text-align: center;
    color: var(--ix-ink-dim);
    font-family: var(--font-ui);
    font-size: 12px;
}

/* 命令面板打开时锁住背景滚动 */
body.is-cmd-open {
    overflow: hidden;
}

/* ==========================================================================
 * 十七、下拉选择（[data-xy-dropdown]）—— 弹层视频 角色 3「Dropdown」
 * --------------------------------------------------------------------------
 * 与 Popover 的界线：Dropdown 是"从一组里挑一个"（明确单选），Popover 是"看着办"。
 * 结构由页面提供（触发器 + 菜单 + 选项），JS 只接管开合/键盘/选择；本文件只负责
 * 进出的那一下（6px 下落 + 透明度）。
 *
 * menu 的显隐走 [hidden] 属性（JS 切换），所以默认 display:none，打开瞬间再过渡；
 * 菜单默认左对齐触发器，加 data-align="right" 可改为右对齐（顶栏右侧的菜单常用）。
 * ========================================================================== */
[data-xy-dropdown] {
    position: relative;
    display: inline-block;
}

[data-xy-dd-trigger] {
    cursor: pointer;
}

[data-xy-dd-menu] {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1400;                 /* 高于顶栏(1000/1100)，低于弹层浮层 */
    min-width: 184px;
    padding: 6px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    border-radius: 12px;
    box-shadow: 0 20px 44px -26px rgba(0, 0, 0, 0.92);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-fast) var(--ix-ease);
}

[data-xy-dropdown].is-open [data-xy-dd-menu] {
    opacity: 1;
    transform: none;
}

[data-xy-dd-menu][hidden] {
    display: none;
}

[data-xy-dd-menu][data-align="right"] {
    left: auto;
    right: 0;
}

[data-xy-dd-item] {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear;
}

[data-xy-dd-item]:hover,
[data-xy-dd-item]:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 9%, transparent);
    outline: none;
}

[data-xy-dd-item]:focus-visible {
    box-shadow: inset 0 0 0 1px var(--ix-line-lit);
}

[data-xy-dd-item].is-selected {
    background: color-mix(in srgb, var(--ix-tint) 14%, transparent);
    color: var(--ix-tint);
    font-weight: 600;
}

/* ==========================================================================
 * 十八、通用悬浮提示（.xy-tip）—— 弹层视频 角色 1「Tooltip」
 * --------------------------------------------------------------------------
 * 只补一句短说明：延迟 220ms 出现（JS 计时）、移开/失焦即隐、绝不接收点击
 * （pointer-events:none，所以永远不挡操作）。位置由 JS 算（上方优先，空间不够翻下方）。
 *
 * 显隐走 [hidden] 属性而非 opacity —— 省一次过渡，也让"提示"和"气泡"在 z-index 上
 * 拉开（提示 1760 高于气泡 1650）：提示是瞬时辅助，不该被任何浮层压住看不见。
 * ========================================================================== */
.xy-tip {
    position: fixed;
    /* 提示是跟随鼠标的小气泡，可能在抽屉(1710)、命令面板(2200) 内部触发，
       所以必须比它们都高；原 1760 会被 2200 的命令面板压住。 */
    z-index: 2300;
    max-width: min(260px, calc(100vw - 16px));
    padding: 6px 10px;
    border-radius: 7px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line);
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 11.5px;
    line-height: 1.55;
    box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.xy-tip[hidden] {
    display: none;
}

.xy-tip.is-below {
    /* 位置已由 JS 重算到锚点下方，这里无需额外位移；保留钩子以便将来加翻转动画 */
    transform: none;
}

/* ==========================================================================
 * 十九、数据点悬浮高亮（画布内绘制，无 CSS）
 * --------------------------------------------------------------------------
 * 实现为 Chart.js 全局插件 xyPointHi：在 afterDatasetsDraw 里给 tooltip 命中的点
 * 画「外光晕 + 描边」，完全不改系列色。因为是 canvas 绘制，没有 DOM、没有 class，
 * 全部样式（颜色取自系列色、透明度硬编码）都在 xy-interact.js 的 pointHover() 里。
 * 这里不写任何规则 —— 写出来也是无效的。
 * ========================================================================== */

/* ==========================================================================
 * 二十、四态空态（.xy-empty）—— 反模式清单 #9
 * --------------------------------------------------------------------------
 * 空态必须四态区分，否则"加载失败"会被误读成"暂无数据"（本项目最忌讳的事）。
 *   none    未接入   —— idle 调
 *   idle    无数据   —— idle 调
 *   fail    请求失败 —— danger 调（红）
 *   timeout 超时     —— warn 调（橙）
 * 颜色全吃 CSS 变量；图标与标题随 tone 变色，让"严重度"一眼可辨。
 * ========================================================================== */
.xy-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
}

.xy-empty__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 320px;
    text-align: center;
}

.xy-empty__icon {
    color: var(--ix-ink-dim);
}

.xy-empty__icon svg {
    width: 40px;
    height: 40px;
    display: block;
}

.xy-empty__title {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--ix-ink);
    line-height: 1.4;
}

.xy-empty__desc {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--ix-ink-dim);
    line-height: 1.65;
}

.xy-empty__btn {
    margin-top: 6px;
    padding: 8px 16px;
    border: 1px solid var(--ix-line-lit);
    border-radius: 9px;
    background: none;
    color: var(--ix-ink);
    font-family: var(--font-ui);
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear,
                border-color var(--ix-t-fast) linear;
}

.xy-empty__btn:hover,
.xy-empty__btn:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 10%, transparent);
    border-color: color-mix(in srgb, var(--ix-tint) 55%, transparent);
    outline: none;
}

.xy-empty__btn:focus-visible {
    box-shadow: inset 0 0 0 1px var(--ix-line-lit);
}

.xy-empty--idle .xy-empty__icon { color: var(--ix-ink-dim); }

.xy-empty--danger .xy-empty__icon { color: var(--ix-danger); }
.xy-empty--danger .xy-empty__title { color: var(--ix-danger); }

.xy-empty--warn .xy-empty__icon { color: var(--ix-warn); }
.xy-empty--warn .xy-empty__title { color: var(--ix-warn); }

/* ==========================================================================
 * 二十一、被截断的单元格（td.is-trunc）
 * --------------------------------------------------------------------------
 * 表格里最长的那列（告警详情、URL、指纹）永远被裁掉尾部。JS 只在**真的被裁**
 * （scrollWidth > clientWidth）时挂这个类，所以虚线下划线的出现本身
 * 就是"这里有更多内容"的信号，不需要额外加图标。
 * 用 zoom-in 而不是 pointer：语义是"放大看"，不是"点进去"。
 * ========================================================================== */
table.xy-table td.is-trunc {
    cursor: zoom-in;
    text-decoration: underline dotted color-mix(in srgb, var(--ix-ink) 34%, transparent);
    text-underline-offset: 3px;
}

table.xy-table td.is-trunc:hover {
    text-decoration-color: var(--ix-tint);
}

table.xy-table td.is-trunc:focus-visible {
    outline: 2px solid var(--ix-tint);
    outline-offset: -2px;
}

/* 已接上"点行开抽屉"的表格：光标给手型。
   刻意不覆写 hover 背景 —— 那是 craft.css 的地盘，叠一层会打出第三种灰。 */
table.xy-table.is-wired tbody tr {
    cursor: pointer;
}

/* ==========================================================================
 * 二十二、通知中心（.xy-note）—— 站内弹窗（浏览器浮窗由 JS 侧 Notification 负责）
 * --------------------------------------------------------------------------
 * 与 craft 的 toast 分工：toast 是"一句话飘走"，notice 是"事件卡片"——
 * 可堆叠、带标题/图标/严重度、可手动关闭、可点击跳转、可推桌面浮窗、可语音播报。
 *
 * 纪律：只动 transform/opacity；z-index 1800（全站最高，压过命令面板 1720 / 提示 1760）；
 *   不写 will-change（卡片含文字，永久合成层会让字发虚，见情境抽屉复盘）。
 *   严重度只染左缘 + 图标，标题保持 ink —— 整卡染色会看不清字。
 * ========================================================================== */
.xy-note-stack {
    position: fixed;
    /* 🔴 2026-10-28 修：原为 top:16px —— 直接压在 .topbar（min-height:60px）
       右上角的用户菜单/铃铛上；首屏自动推两条告警时顶条右半边被糊住。
       改成让出顶条高度（60 + 12 呼吸），小屏再降。 */
    top: calc(var(--xy-topbar-h, 60px) + 12px);
    right: 16px;
    /* 🔴 2026-10-28 修：原 1800 低于 .xy-toasts(1900) —— 常驻通知卡会被
       4 秒的瞬时 toast 盖住，顺序反了。通知卡是"要留着看"的，必须更高。 */
    z-index: 1950;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 24px));
    pointer-events: none;
}

.xy-note {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--ix-glass-2);
    border: 1px solid var(--ix-line-lit);
    border-left: 3px solid var(--ix-line-lit);
    box-shadow: 0 20px 44px -26px rgba(0, 0, 0, 0.92);
    opacity: 0;
    transform: translateX(18px);
    transition: opacity var(--ix-t-fast) linear,
                transform var(--ix-t-mid) var(--ix-ease);
}

.xy-note.is-in {
    opacity: 1;
    transform: none;
}

.xy-note.is-out {
    opacity: 0;
    transform: translateX(18px);
}

.xy-note__ico {
    flex: none;
    display: inline-flex;
    margin-top: 1px;
    color: var(--ix-ink-dim);
}

.xy-note__ico svg {
    width: 17px;
    height: 17px;
}

.xy-note__body {
    flex: 1;
    min-width: 0;
}

.xy-note__title {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ix-ink);
    line-height: 1.45;
}

.xy-note__msg {
    margin-top: 2px;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--ix-ink-dim);
    line-height: 1.55;
    word-break: break-word;
}

.xy-note__x {
    flex: none;
    width: 22px;
    height: 22px;
    margin: -2px -2px 0 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ix-ink-dim);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--ix-t-fast) linear, color var(--ix-t-fast) linear;
}

.xy-note__x:hover,
.xy-note__x:focus-visible {
    background: color-mix(in srgb, var(--ix-tint) 12%, transparent);
    color: var(--ix-ink);
    outline: none;
}

/* 严重度：左缘 + 图标着色 */
.xy-note--info { border-left-color: var(--ix-tint); }
.xy-note--info .xy-note__ico { color: var(--ix-tint); }

.xy-note--success { border-left-color: var(--ix-ok, #38d39f); }
.xy-note--success .xy-note__ico { color: var(--ix-ok, #38d39f); }

.xy-note--warn { border-left-color: var(--ix-warn); }
.xy-note--warn .xy-note__ico { color: var(--ix-warn); }

.xy-note--danger { border-left-color: var(--ix-danger); }
.xy-note--danger .xy-note__ico { color: var(--ix-danger); }
.xy-note--danger .xy-note__title { color: var(--ix-danger); }

@media (max-width: 560px) {
    .xy-note-stack {
        top: calc(var(--xy-topbar-h, 56px) + 8px);
        left: 12px;
        right: 12px;
        width: auto;
    }
}

/* ==========================================================================
 * 二十三、皮肤特判（只用变量覆写，不复制样式）
 * --------------------------------------------------------------------------
 * 山水（scenery）：底子是实拍照片，玻璃面必须更实、边框必须更柔，
 * 否则面板在明暗交界的照片上会"碎成几块"。
 * 极简白（light）：阴影要更淡，实色描边要更明显。
 * ========================================================================== */
html[data-theme="scenery"] {
    --ix-glass: rgba(12, 22, 26, 0.90);
    --ix-glass-2: rgba(9, 16, 20, 0.94);
    --ix-line: rgba(244, 241, 232, 0.16);
    --ix-tint: var(--neon-green, #7fd0b8);
    --ix-ink-dim: rgba(238, 244, 241, 0.62);
}

/* —— 山水（续）：第三批 + 加载反馈在照片底上的落地 ——
   上面那组变量只覆盖了第一批。实测缺口：照片亮部（雪岭/云海）会把玻璃面
   "照穿"，.xy-beam 的 conic 亮环糊成一片光斑，.xy-skel 的扫光对比不足看不出在动。 */
html[data-theme="scenery"] .xy-note,
html[data-theme="scenery"] .xy-cmd,
html[data-theme="scenery"] [data-xy-dd-menu] {
    border-color: rgba(244, 241, 232, 0.15);
    box-shadow: 0 22px 52px -24px rgba(2, 8, 14, 0.78),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="scenery"] .xy-skel {
    background: rgba(244, 241, 232, 0.09);
}
html[data-theme="scenery"] .xy-skel::after {
    background: linear-gradient(90deg, transparent, rgba(244, 241, 232, 0.20), transparent);
}
html[data-theme="scenery"] .xy-beam::after {
    padding: 1px;                                  /* 亮照片上 1.5px 太宽会糊 */
    background: conic-gradient(from var(--xy-beam-ang), transparent 0deg,
                color-mix(in srgb, var(--neon-orange, #e8b96a) 72%, transparent) 70deg,
                transparent 150deg);
}
html[data-theme="scenery"] .xy-ring__track {
    stroke: rgba(244, 241, 232, 0.18);
}

html[data-theme="light"] {
    --ix-glass: rgba(255, 255, 255, 0.94);
    --ix-glass-2: rgba(250, 251, 253, 0.97);
    --ix-line: rgba(16, 24, 40, 0.12);
    --ix-tint: #1f6feb;
    /* 🔴 0.58 → 0.62：在 0.97 白底上实测只有 4.32:1，低于 WCAG AA 的 4.5:1。
       次级文字是最常被当成"可以浅一点"的一类，但它仍然是正文。
       0.62 实测 4.6~4.9（placeholder 与搜索未命中项都过），
       视觉上仍然是"比正文淡一档"，不抢注意力。 */
    --ix-ink-dim: rgba(16, 24, 40, 0.62);
}

/* 白底皮肤下，深色阴影会脏成一块灰 —— 统一换成浅而散的阴影 */
html[data-theme="light"] .xy-railfly,
html[data-theme="light"] .xy-pop,
html[data-theme="light"] .xy-cd {
    box-shadow: 0 18px 38px -26px rgba(16, 24, 40, 0.55);
}

html[data-theme="light"] .xy-cd-scrim {
    background: rgba(16, 24, 40, 0.28);
}

/* 白底上骨架屏要更深一点，否则"在加载"和"就是空白"分不清 */
html[data-theme="light"] .xy-skel {
    background: rgba(16, 24, 40, 0.07);
}
html[data-theme="light"] .xy-skel::after {
    background: linear-gradient(90deg, transparent, rgba(16, 24, 40, 0.10), transparent);
}

/* ==========================================================================
 * 二十四、降低动效偏好
 * --------------------------------------------------------------------------
 * 保留状态变化（块还是要到位置、面板还是要开），只把**过程**去掉。
 * 特别地：十字线、框选这类"跟手的"反馈如果也去掉过渡，反而更利落。
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .xy-nmark,
    .xy-nbody,
    .xy-nhead__caret,
    .xy-dp,
    .xy-ix-xhair,
    .xy-od__col,
    .xy-dk,
    .xy-dk__btn,
    .xy-bs,
    .xy-bs-scrim,
    .xy-railfly,
    .xy-pop,
    .xy-cd,
    .xy-cd-scrim,
    .xy-ix-lg,
    .xy-cmd__scrim,
    .xy-cmd,
    [data-xy-dd-menu],
    .xy-note,
    .xy-note__x {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }

    /* 位移类一并归零：只留"出现/消失"，不留"从哪来" */
    .xy-railfly,
    .xy-pop,
    .xy-cmd,
    [data-xy-dd-menu] {
        transform: none;
    }

    .xy-dk {
        opacity: 1;
    }
}

/* ==========================================================================
 * 二十五、加载与反馈（骨架屏 / 边框流光 / 进度环 / 不确定进度条 / 三圆点 / 雷达）
 * --------------------------------------------------------------------------
 * 落地 ui-component-kit 技能「加载与进度」一节。全部只动 transform/opacity
 * （进度环用 SVG stroke-dashoffset，属绘制不属重排，可接受）；全部带 reduced-motion。
 * 这些是内容内元素，不涉及浮层层级。
 * ========================================================================== */

/* 1) 骨架屏：::after 扫光，只做 translateX */
.xy-skel {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 7px;
    background: color-mix(in srgb, var(--ix-ink) 8%, transparent);
}
.xy-skel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ix-ink) 14%, transparent), transparent);
    transform: translateX(-100%);
    animation: xy-skel-sheen 1.35s ease-in-out infinite;
}
.xy-skel--text { height: 12px; margin: 7px 0; }
.xy-skel--title { height: 18px; width: 42%; }
.xy-skel--block { height: 120px; border-radius: 10px; }
@keyframes xy-skel-sheen { to { transform: translateX(100%); } }

/* 2) 边框流光：conic-gradient 靠 @property 驱动角度（Chromium/Edge 支持；不支持的浏览器退化为静态描边） */
@property --xy-beam-ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.xy-beam { position: relative; border-radius: inherit; }
.xy-beam::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(from var(--xy-beam-ang), transparent 0deg, var(--ix-tint) 70deg, transparent 150deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    animation: xy-beam-spin 3s linear infinite;
    pointer-events: none;
}
@keyframes xy-beam-spin { to { --xy-beam-ang: 360deg; } }

/* 3) 确定性进度环（JS: XY_IX.progressRing 生成 SVG） */
.xy-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.xy-ring__svg { display: block; transform: rotate(-90deg); }
.xy-ring__track { stroke: color-mix(in srgb, var(--ix-ink) 12%, transparent); }
.xy-ring__bar { stroke: var(--ix-tint); stroke-linecap: round; transition: stroke-dashoffset var(--ix-t-mid) var(--ix-ease); }
.xy-ring__label { position: absolute; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--ix-ink); }

/* 4) 不确定进度条：一条 transform 平移的亮条 */
.xy-indet { position: relative; height: 4px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--ix-ink) 10%, transparent); }
.xy-indet::after {
    content: '';
    position: absolute; top: 0; left: 0; height: 100%; width: 38%;
    border-radius: 2px; background: var(--ix-tint);
    transform: translateX(-120%);
    animation: xy-indet-run 1.15s ease-in-out infinite;
}
@keyframes xy-indet-run { to { transform: translateX(320%); } }

/* 5) 三圆点 typing */
.xy-typing { display: inline-flex; align-items: center; gap: 5px; }
.xy-typing i {
    width: 6px; height: 6px; border-radius: 50%; background: var(--ix-ink-dim);
    animation: xy-typing 1.2s ease-in-out infinite;
}
.xy-typing i:nth-child(2) { animation-delay: .15s; }
.xy-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes xy-typing { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }

/* 6) 雷达扫描：旋转扇区 */
.xy-radar {
    position: relative; width: 64px; height: 64px; border-radius: 50%;
    overflow: hidden; border: 1px solid var(--ix-line-lit);
    background:
        radial-gradient(circle, transparent 56%, color-mix(in srgb, var(--ix-ink) 10%, transparent) 57%, transparent 58%),
        radial-gradient(circle, transparent 32%, color-mix(in srgb, var(--ix-ink) 10%, transparent) 33%, transparent 34%);
}
.xy-radar::before {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg 300deg, color-mix(in srgb, var(--ix-tint) 85%, transparent) 360deg);
    animation: xy-radar-spin 1.8s linear infinite;
}
@keyframes xy-radar-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .xy-skel::after,
    .xy-beam::after,
    .xy-indet::after,
    .xy-typing i,
    .xy-radar::before {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
    }
    .xy-skel::after { transform: none; }
    .xy-indet::after { transform: none; width: 100%; }
    .xy-ring__bar { transition-duration: 1ms !important; }
}
