/**
 * 史锦泽设计系统 · UI 组件层(xiliu-ui.css)
 * ------------------------------------------------------------------
 * 依赖 xiliu-tokens.css(变量)。包含 reset/body/滚动条/组件类。
 * ⚠ 引入本文件会接管 body 背景与基础排版 —— 高危页(ssh/video)
 *   不要引入;常规页收编时需删除页内重复的组件样式。
 * 引入顺序:[element-plus.css] → tokens → ui → [xiliu-el.css] → 页面自身 <style>
 *
 * 2026-11 重做:去掉方格纸底纹 / 流动渐变线 / 十字角 / 呼吸灯等重特效,
 * 全部类名保留(旧页面不改一个字),只重写样式;新增 x-page-header / x-toolbar /
 * x-tabs / x-modal / x-skeleton / x-side / x-cmdk 等组件。
 * 速查文档:docs/界面设计规范.md
 */

/* Element Plus 统一覆盖层(主题变量映射 + 组件细节),与本文件一起生效;不用 Element Plus 的页面无副作用 */
@import url('/css/xiliu-el.css');

/* ================= reset(轻量) ================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: var(--fs-md);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: var(--accent3); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* ================= 滚动条 ================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text3); }
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* ================= 顶栏(XiliuShell 渲染) ================= */
.x-topbar {
    position: sticky; top: 0; z-index: var(--z-topbar); /* < back-btn 9998 < theme 9999 < chat 99999 */
    display: flex; align-items: center; gap: 14px;
    height: var(--topbar-h); padding: 0 20px;
    background: color-mix(in srgb, var(--bg2) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
}
.x-topbar .x-brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; cursor: pointer; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: var(--radius-md); transition: background var(--dur); }
.x-topbar .x-brand:hover { background: var(--hover-bg); }
.x-topbar .x-brand .x-logo {
    width: 24px; height: 24px; border-radius: 7px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: var(--on-accent);
}
.x-topbar .x-brand .x-logo svg { width: 15px; height: 15px; }
.x-topbar .x-brand b { font-size: var(--fs-lg); font-weight: 650; letter-spacing: .2px; color: var(--text); }
.x-topbar .x-brand .x-tag { display: none; } /* 旧的英文大写小标签,新设计不再显示 */
.x-topbar .x-title {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: var(--fs-md); color: var(--text2);
    padding-left: 14px; border-left: 1px solid var(--border);
}
.x-topbar .x-title .x-tag { margin-left: 8px; font-size: var(--fs-xs); color: var(--text3); }
.x-topbar .x-actions { display: flex; align-items: center; gap: 6px; }
.x-topbar .x-actions .x-muted { font-size: var(--fs-xs); padding: 0 6px; }
.x-topbar .x-icon-btn { width: 30px; height: 30px; padding: 0; }
.x-topbar .x-icon-btn svg { width: 16px; height: 16px; }
.x-topbar .x-kbd-hint { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text3); font-size: var(--fs-xs); cursor: pointer; transition: border-color var(--dur), color var(--dur); }
.x-topbar .x-kbd-hint:hover { border-color: var(--border2); color: var(--text2); }
.x-topbar .x-kbd-hint svg { width: 14px; height: 14px; }

/* 旧「签名流线」:改成 1px 细分隔线,左端带一点主色,不再流动。
 * 仍是 .x-topbar 后面紧跟的 div,保持 sticky 位置不变,布局零影响。 */
.x-stream {
    height: 1px; flex: none;
    background: linear-gradient(90deg, var(--accent-dim) 0, var(--border) 180px, var(--border) 100%);
    animation: none;
}
.x-topbar + .x-stream { position: sticky; top: var(--topbar-h); z-index: calc(var(--z-topbar) - 1); }

/* 顶栏导航下拉(三层:分组 → 子分组 → 页面) */
.x-nav-menu {
    position: absolute; top: calc(var(--topbar-h) - 4px); left: 12px; z-index: var(--z-nav);
    width: 280px; max-height: 72vh; overflow: auto;
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 6px;
}
.x-nav-menu .x-nav-group { font-size: var(--fs-xs); font-weight: 600; color: var(--text3); padding: 10px 10px 4px; }
.x-nav-menu .x-nav-group.x-nav-sub { padding-left: 18px; font-weight: 500; }
.x-nav-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-sm); }
.x-nav-menu a.x-nav-l3 { padding-left: 22px; }
.x-nav-menu a:hover { background: var(--hover-bg); text-decoration: none; }
.x-nav-menu a.is-current { background: var(--accent-soft); color: var(--accent); }
.x-nav-menu a svg { width: 15px; height: 15px; color: var(--text3); flex: none; }

/* ================= 卡片 ================= */
.x-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
}
.x-card > h3, .x-card > .x-card-title {
    margin: 0 0 var(--space-3); font-size: var(--fs-md); font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.x-card-title .x-tag, .x-card > h3 .x-tag { font-family: var(--sans); font-size: var(--fs-xs); font-weight: 400; color: var(--text3); letter-spacing: 0; text-transform: none; }
.x-card--flat { box-shadow: none; }
.x-card--hover { transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur); }
.x-card--hover:hover { border-color: var(--border2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* 无内边距卡片:里面放表格 */
.x-card--table { padding: 0; overflow: hidden; }
.x-card--table > .x-card-hd { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.x-card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-3); font-weight: 600; }
/* 旧签名「十字角」:类名保留,不再画角,只是普通卡片 */
.x-card--tick { position: relative; }

/* ================= 页头 / 工具条 ================= */
.x-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: var(--space-5); }
.x-page-title { margin: 0; font-size: var(--fs-xl); font-weight: 650; line-height: 1.3; color: var(--text); }
.x-page-desc { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text2); }
.x-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.x-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text3); margin-bottom: 6px; }
.x-breadcrumb a { color: var(--text3); }
.x-breadcrumb a:hover { color: var(--text); text-decoration: none; }
.x-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.x-toolbar .x-grow { flex: 1; }
.x-toolbar .x-input, .x-toolbar .x-select { width: auto; min-width: 160px; }

/* ================= 指标卡 ================= */
.x-stat { display: flex; flex-direction: column; gap: 4px; }
.x-stat .x-stat-label { font-family: var(--sans); font-size: var(--fs-sm); letter-spacing: 0; text-transform: none; color: var(--text2); }
.x-stat .x-stat-value { font-family: var(--sans); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; font-size: var(--fs-2xl); font-weight: 650; line-height: 1.2; letter-spacing: -.3px; color: var(--text); }
.x-stat .x-stat-value small { font-size: var(--fs-sm); color: var(--text3); font-weight: 400; letter-spacing: 0; margin-left: 2px; }
.x-stat .x-stat-sub { font-size: var(--fs-xs); color: var(--text3); }
.x-stat .x-stat-delta--up { color: var(--success); }
.x-stat .x-stat-delta--down { color: var(--danger); }
.x-stat--accent .x-stat-value { color: var(--accent); }
.x-stat--danger .x-stat-value { color: var(--danger); }

/* ================= 状态灯 ================= */
.x-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; background: var(--text3); flex: none; }
.x-dot--on   { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); animation: none; }
.x-dot--off  { background: var(--text3); }
.x-dot--warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.x-dot--err  { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ================= 徽标 ================= */
.x-badge {
    display: inline-flex; align-items: center; gap: 5px; line-height: 1.5;
    font-family: var(--sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0;
    padding: 1px 8px; border-radius: var(--radius-pill);
    border: 1px solid transparent; background: var(--hover-bg); color: var(--text2); white-space: nowrap;
}
.x-badge--accent  { color: var(--accent);  background: var(--accent-soft); }
.x-badge--success { color: var(--success); background: var(--success-soft); }
.x-badge--warn    { color: var(--warn);    background: var(--warn-soft); }
.x-badge--danger  { color: var(--danger);  background: var(--danger-soft); }
.x-badge--info    { color: var(--info);    background: var(--info-soft); }
.x-badge--outline { background: transparent; border-color: var(--border2); }

/* ================= 按钮 ================= */
.x-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--control-h); padding: 0 14px; border-radius: var(--radius-md);
    font-size: var(--fs-sm); font-weight: 500; font-family: var(--sans); line-height: 1; white-space: nowrap;
    border: 1px solid var(--border2); background: var(--surface2); color: var(--text);
    cursor: pointer; transition: border-color var(--dur), background var(--dur), color var(--dur), box-shadow var(--dur);
    user-select: none;
}
.x-btn:hover { background: var(--surface3); border-color: var(--text3); }
.x-btn:active { transform: translateY(.5px); }
.x-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.x-btn:disabled, .x-btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.x-btn svg { width: 14px; height: 14px; flex: none; }
.x-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.x-btn--primary:hover { background: var(--accent2); border-color: var(--accent2); color: var(--on-accent); }
.x-btn--ghost { background: transparent; border-color: transparent; color: var(--text2); }
.x-btn--ghost:hover { background: var(--hover-bg); border-color: transparent; color: var(--text); }
.x-btn--danger { border-color: var(--danger-dim); color: var(--danger); background: transparent; }
.x-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.x-btn--sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.x-btn--lg { height: var(--control-h-lg); padding: 0 18px; font-size: var(--fs-md); }
.x-btn--icon { width: var(--control-h); padding: 0; }
.x-btn--icon.x-btn--sm { width: var(--control-h-sm); }
.x-btn-group { display: inline-flex; gap: 8px; align-items: center; }

/* ================= 表格 x-table ================= */
.x-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.x-table th {
    text-align: left; padding: 10px 14px;
    font-family: var(--sans); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; text-transform: none;
    color: var(--text2); background: var(--bg2);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.x-table th:first-child { border-top-left-radius: var(--radius-md); }
.x-table th:last-child { border-top-right-radius: var(--radius-md); }
.x-table td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); color: var(--text); font-variant-numeric: tabular-nums; vertical-align: middle; }
.x-table tbody tr:last-child td { border-bottom: none; }
.x-table tbody tr { transition: background var(--dur); }
.x-table tbody tr:hover { background: var(--hover-bg); }
.x-table tbody tr.is-selected { background: var(--accent-soft); }
.x-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.x-table .muted { color: var(--text3); }
.x-table .act { white-space: nowrap; text-align: right; }
.x-table .act .x-btn { margin-left: 4px; }
.x-table--zebra tbody tr:nth-child(even) { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.x-table--zebra tbody tr:hover { background: var(--hover-bg); }
.x-table--compact td { height: 34px; }
.x-table--compact th { padding: 8px 12px; }
/* 表头吸顶:放在可滚动容器(.x-table-wrap)里用,容器需限制高度 */
.x-table--sticky th { position: sticky; top: 0; z-index: 2; }
.x-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.x-card--table .x-table th:first-child, .x-card--table .x-table th:last-child { border-radius: 0; }

/* ================= 分页 =================
   统一分页组件见 js/x-pager.js + css/x-pager.css（<x-pager>），这里不再放分页样式。 */

/* ================= 表单 ================= */
.x-form-item { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.x-form-item > label { font-size: var(--fs-xs); font-weight: 500; color: var(--text2); }
.x-form-item .x-hint { font-size: var(--fs-xs); color: var(--text3); }
.x-form-row { display: flex; gap: var(--space-3); align-items: flex-start; }
.x-form-row > * { flex: 1; min-width: 0; }
.x-input, .x-select, .x-textarea {
    width: 100%; height: var(--control-h); padding: 0 12px; border-radius: var(--radius-md); font-size: var(--fs-sm); font-family: var(--sans);
    background: var(--surface2); border: 1px solid var(--border2); color: var(--text);
    outline: none; transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.x-input:hover, .x-select:hover, .x-textarea:hover { border-color: var(--text3); }
.x-input:focus, .x-select:focus, .x-textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); background: var(--surface); }
.x-input::placeholder, .x-textarea::placeholder { color: var(--text3); }
.x-input:disabled, .x-select:disabled, .x-textarea:disabled { opacity: .55; cursor: not-allowed; }
.x-input--sm { height: var(--control-h-sm); font-size: var(--fs-xs); padding: 0 8px; }
.x-textarea { font-family: var(--mono); height: auto; padding: 8px 12px; line-height: 1.55; resize: vertical; min-height: 80px; }

/* 开关 */
.x-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.x-switch input { opacity: 0; width: 0; height: 0; }
.x-switch .x-slider {
    position: absolute; inset: 0; border-radius: var(--radius-pill); cursor: pointer;
    background: var(--surface3); border: 1px solid var(--border2); transition: background var(--dur), border-color var(--dur);
}
.x-switch .x-slider::before {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--text2); transition: transform var(--dur) var(--ease-out), background var(--dur);
}
.x-switch input:checked + .x-slider { background: var(--accent); border-color: var(--accent); }
.x-switch input:checked + .x-slider::before { transform: translateX(16px); background: var(--on-accent); }
.x-switch input:focus-visible + .x-slider { box-shadow: var(--focus-ring); }

/* ================= Tab(页内) ================= */
.x-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); overflow-x: auto; }
.x-tab {
    position: relative; padding: 9px 14px; font-size: var(--fs-sm); font-weight: 500; color: var(--text2);
    background: none; border: none; cursor: pointer; white-space: nowrap; transition: color var(--dur);
}
.x-tab:hover { color: var(--text); }
.x-tab.is-active { color: var(--accent); }
.x-tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
/* 胶囊式分段(筛选/切换) */
.x-segment { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius-md); background: var(--bg2); border: 1px solid var(--border); }
.x-segment button { height: 26px; padding: 0 12px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text2); font-size: var(--fs-xs); font-weight: 500; cursor: pointer; }
.x-segment button:hover { color: var(--text); }
.x-segment button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ================= 弹窗(非 Element Plus 页面用) ================= */
.x-modal-mask { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.x-modal { width: 480px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.x-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: var(--fs-lg); font-weight: 600; }
.x-modal-bd { padding: 20px; overflow: auto; }
.x-modal-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ================= 提示条 / 通知 ================= */
.x-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-md); font-size: var(--fs-sm); background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.x-alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.x-alert--warn    { background: var(--warn-soft);    border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.x-alert--danger  { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.x-notice { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 10001; padding: 9px 16px; border-radius: var(--radius-md); font-size: var(--fs-sm); background: var(--surface); color: var(--text); border: 1px solid var(--border2); box-shadow: var(--shadow-lg); pointer-events: none; }
.x-notice--error { color: var(--danger); border-color: var(--danger-dim); }

/* ================= 空态 / 骨架屏 ================= */
.x-empty { padding: 48px 16px; text-align: center; color: var(--text3); }
.x-empty .x-empty-icon { font-size: 28px; line-height: 1; opacity: .7; margin-bottom: 10px; color: var(--text3); }
.x-empty .x-empty-icon svg { width: 32px; height: 32px; }
.x-empty .x-empty-title { font-size: var(--fs-md); color: var(--text2); margin-bottom: 4px; }
.x-empty .x-empty-hint { font-size: var(--fs-xs); }
.x-skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 37%, var(--surface2) 63%); background-size: 400% 100%; animation: x-shimmer 1.4s ease infinite; min-height: 14px; }
.x-skeleton--line { height: 14px; margin: 8px 0; }
.x-skeleton--block { height: 88px; border-radius: var(--radius-lg); }
@keyframes x-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ================= 侧栏导航(后台壳用) ================= */
.x-side { width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; background: var(--bg2); border-right: 1px solid var(--border); overflow: hidden; transition: width .2s var(--ease-out); }
.x-side-head { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: var(--fs-lg); white-space: nowrap; }
.x-side-body { flex: 1; overflow-y: auto; padding: 8px; }
.x-side-group { padding: 14px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: .3px; white-space: nowrap; }
.x-side-item {
    display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; margin: 1px 0;
    border-radius: var(--radius-md); color: var(--text2); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
    transition: background var(--dur), color var(--dur); text-decoration: none; user-select: none;
}
.x-side-item:hover { background: var(--hover-bg); color: var(--text); text-decoration: none; }
.x-side-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.x-side-item .x-side-icon { width: 16px; height: 16px; flex: none; opacity: .9; display: inline-flex; align-items: center; justify-content: center; }
.x-side-item .x-side-icon svg { width: 16px; height: 16px; }
.x-side-item .x-side-arrow { margin-left: auto; width: 12px; height: 12px; transition: transform var(--dur); opacity: .6; }
.x-side-item.is-open .x-side-arrow { transform: rotate(90deg); }
.x-side-sub { margin-left: 18px; padding-left: 8px; border-left: 1px solid var(--border); }
.x-side-sub .x-side-item { height: 30px; font-size: var(--fs-sm); }
.x-side-foot { padding: 10px; border-top: 1px solid var(--border); }
.x-side--collapsed { width: var(--sidebar-w-min); }
.x-side--collapsed .x-side-item > span:not(.x-side-icon), .x-side--collapsed .x-side-group, .x-side--collapsed .x-side-arrow, .x-side--collapsed .x-side-sub { display: none; }
.x-side--collapsed .x-side-item { justify-content: center; padding: 0; }

/* ================= 命令面板(Ctrl/Cmd+K) ================= */
.x-cmdk-mask { position: fixed; inset: 0; z-index: var(--z-cmdk); display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; background: var(--overlay); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.x-cmdk { width: 560px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.x-cmdk-input { width: 100%; height: 48px; padding: 0 18px; border: none; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font-size: var(--fs-lg); font-family: var(--sans); outline: none; }
.x-cmdk-list { max-height: 50vh; overflow: auto; padding: 6px; }
.x-cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md); font-size: var(--fs-sm); color: var(--text); cursor: pointer; }
.x-cmdk-item small { margin-left: auto; color: var(--text3); font-size: var(--fs-xs); }
.x-cmdk-item.is-active { background: var(--accent-soft); color: var(--accent); }
.x-cmdk-empty { padding: 28px; text-align: center; color: var(--text3); font-size: var(--fs-sm); }
.x-cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text3); }
kbd, .x-kbd { font-family: var(--sans); font-size: 11px; padding: 1px 6px; border-radius: var(--radius-xs); border: 1px solid var(--border2); border-bottom-width: 2px; background: var(--surface2); color: var(--text2); }

/* ================= 登录卡 ================= */
.x-login-mask { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.x-login-card { width: 360px; padding: 32px; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.x-login-card h2 { margin: 0 0 4px; font-size: var(--fs-xl); font-weight: 650; }
.x-login-card .x-tag { font-family: var(--sans); font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; color: var(--text3); }

/* ================= 标签(小字说明) ================= */
.x-tag { font-family: var(--sans); font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; color: var(--text3); }

/* ================= 图表容器 ================= */
.x-chart { width: 100%; height: 260px; }
.x-chart--tall { height: 340px; }

/* ================= 布局工具 ================= */
.x-page { max-width: none; margin: 0; padding: var(--space-5) var(--space-6); }
.x-row { display: flex; gap: var(--space-3); align-items: center; }
.x-row--between { justify-content: space-between; }
.x-grid { display: grid; gap: var(--space-4); }
.x-grid--2 { grid-template-columns: repeat(2, 1fr); }
.x-grid--3 { grid-template-columns: repeat(3, 1fr); }
.x-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .x-grid--4 { grid-template-columns: repeat(2, 1fr); } .x-grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .x-grid--4, .x-grid--3, .x-grid--2 { grid-template-columns: 1fr; } }
.x-gap-lg { gap: var(--space-5); }
.x-mt { margin-top: var(--space-4); }
.x-muted { color: var(--text3); }
.x-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.x-num { font-variant-numeric: tabular-nums; }
.x-divider { height: 1px; background: var(--border); border: 0; margin: var(--space-4) 0; }

/* 媒体元素永不撑破视口（全断点） */
img, svg, video, canvas { max-width: 100%; }

/* ================= 移动端适配（≤640px 手机） ================= */
@media (max-width: 640px) {
    /* 防止任意宽内容把整页顶出横向滚动条（clip 不破坏 sticky 顶栏） */
    html, body { overflow-x: clip; }

    .x-topbar { gap: 8px; padding: 0 12px; height: 48px; }
    .x-topbar .x-brand b { font-size: var(--fs-md); }
    .x-topbar .x-title { padding-left: 10px; }
    .x-topbar + .x-stream { top: 48px; }
    .x-topbar .x-actions { gap: 4px; }
    .x-topbar .x-actions .x-muted, .x-topbar .x-kbd-hint span { display: none; }

    .x-nav-menu { left: 8px; right: 8px; width: auto; }
    .x-card { padding: 13px; }

    /* 表格：容器可横滚；保底给表一个最小宽，溢出即横滚 */
    .x-table-wrap > .x-table { min-width: 480px; }
    .x-table th, .x-table td { padding-left: 10px; padding-right: 10px; }

    /* 按钮：触控友好 */
    .x-btn { height: 40px; padding: 0 15px; }
    .x-btn--sm { height: 36px; padding: 0 12px; }
    .x-btn--icon { width: 40px; }
    .x-row { flex-wrap: wrap; }

    /* 输入：16px 字号，避免 iOS 聚焦时自动放大整页 */
    .x-input, .x-select, .x-textarea { font-size: 16px; height: 40px; }
    .x-textarea { height: auto; }

    .x-login-card { width: min(360px, calc(100vw - 28px)); padding: 24px; }
    .x-page { padding: 14px; }
    .x-page-header { align-items: flex-start; }
    .x-page-title { font-size: var(--fs-lg); }
    .x-stat .x-stat-value { font-size: 24px; }
    .x-chart { height: 220px; }
    .x-modal { width: 100%; }
    .x-cmdk-mask { padding-top: 8vh; }
}

/* ================= 动效克制 ================= */
@media (prefers-reduced-motion: reduce) {
    .x-skeleton { animation: none; }
    * { transition-duration: .01ms !important; }
}
