/* 闲鱼接单流水管理 · 设计系统 v10（Slate + Indigo，基准见 drafts/design-principles.md） */

/* ============================================================
   一、设计 token：全站颜色、圆角、阴影、字体的单一事实源
   ============================================================ */
:root {

    /* 页面画布：冷中性灰，衬托白色卡片 */
    --background: #f1f2f4;

    /* 主文字：近黑锌色，正文对比度达标 */
    --foreground: #18181b;

    /* 卡片表面与卡片前景：白底黑字成对出现 */
    --card: #ffffff;

    --card-foreground: #18181b;

    /* 次表面与次文字：筛选区、表头、输入框底色 */
    --muted: #f4f4f5;

    --muted-foreground: #71717a;

    /* 主强调色：Indigo-600，仅用于主操作与激活态 */
    --primary: #4f46e5;

    --primary-foreground: #ffffff;

    /* 主强调悬浮态：Indigo-700 */
    --primary-hover: #4338ca;

    /* 强调浅表面：激活标签底、选中反馈 */
    --accent: #eef2ff;

    --accent-dark: #4338ca;

    /* 危险色：清空、删除、退款语义 */
    --destructive: #dc2626;

    --destructive-soft: #fee2e2;

    /* 语义状态色：成功、等待、信息、投入四类徽章 */
    --success: #16a34a;

    --success-soft: #dcfce7;

    --warning: #d97706;

    --warning-soft: #fef3c7;

    --info: #0284c7;

    --info-soft: #e0f2fe;

    --invest: #7c3aed;

    --invest-soft: #ede9fe;

    /* 边框两档：常规分隔与强调描边 */
    --border: #e4e4e7;

    --border-strong: #d4d4d8;

    /* 表单控件边框：独立 token 便于全局调权 */
    --input: #d4d4d8;

    /* 焦点环：主色 35% 透明度，键盘导航可见 */
    --ring: rgba(99, 102, 241, 0.35);

    /* 深色顶栏锚点：全页唯一的深色大面块 */
    --header: #18181b;

    --header-foreground: #fafafa;

    --header-muted: #a1a1aa;

    /* 圆角基准与派生：改一个值全局联动 */
    --radius: 12px;

    --radius-sm: calc(var(--radius) * 0.66);

    /* 阴影两档：极浅黑白，只做层次提示不做重投影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);

    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07);

    /* 全站字体栈：等线首选，非 Windows 降级可读 */
    --font: "DengXian", "等线", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;

}

/* ============================================================
   二、重置与基础：盒模型、字体继承、页面底色
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;

    margin: 0;

    padding: 0;

}

/* 表单控件统一继承页面字体栈，等线全站无遗漏 */
button,
input,
select,
textarea {
    font-family: inherit;

}

/* 应用根容器：画布底色、主文字色、抗锯齿 */
body.xy-app {
    font-family: var(--font);

    background: var(--background);

    color: var(--foreground);

    line-height: 1.6;

    -webkit-font-smoothing: antialiased;

}

/* WebKit 系滚动条统一细化：6px 圆角滑轨，弱存在感 */
::-webkit-scrollbar {
    width: 8px;

    height: 8px;

}

::-webkit-scrollbar-thumb {
    background: #c4c4cc;

    border-radius: 999px;

}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;

}

::-webkit-scrollbar-track {
    background: transparent;

}

/* 键盘可达性：所有可交互元素统一焦点环 */
.xy-btn:focus-visible,
.btn:focus-visible,
.btn-primary:focus-visible,
.icon-btn:focus-visible,
.detail-tab:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.searchbox input:focus-visible,
.filters select:focus-visible {
    outline: none;

    box-shadow: 0 0 0 3px var(--ring);

}

/* ============================================================
   三、深色顶栏：品牌锚点与全局操作
   ============================================================ */
.xy-topbar {
    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 14px 28px;

    background: var(--header);

    color: var(--header-foreground);

    border-bottom: 1px solid rgba(250, 250, 250, 0.08);

}

/* 品牌区：徽标 + 标题 + 副标题基线对齐 */
.xy-topbar-left {
    display: flex;

    align-items: baseline;

    gap: 12px;

}

.xy-brand {
    font-size: 19px;

    font-weight: 700;

    color: var(--header-foreground);

    letter-spacing: 0.01em;

}

.xy-brand-sub {
    font-size: 12px;

    color: var(--header-muted);

}

/* 顶栏按钮：深色幽灵样式，悬停提亮不抢主操作 */
.xy-topbar .xy-btn {
    color: var(--header-muted);

    background: rgba(250, 250, 250, 0.06);

    border-color: rgba(250, 250, 250, 0.14);

}

.xy-topbar .xy-btn:hover {
    color: var(--header-foreground);

    background: rgba(250, 250, 250, 0.12);

    border-color: rgba(250, 250, 250, 0.24);

}

/* 危险按钮在深色底上悬停转红，警示语义不变 */
.xy-topbar .xy-btn-danger:hover {
    color: #fca5a5;

    border-color: rgba(220, 38, 38, 0.55);

    background: rgba(220, 38, 38, 0.16);

}

/* ============================================================
   四、按钮体系：通用白底、主操作实心、危险警示
   ============================================================ */
.xy-btn {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 7px 14px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--muted-foreground);

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    cursor: pointer;

    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;

    white-space: nowrap;

}

/* 按钮图标定尺寸不参与收缩，杜绝文字被挤压竖排 */
.xy-btn .icon,
.xy-btn svg {
    flex-shrink: 0;

}

.xy-btn:hover {
    background: var(--muted);

    border-color: var(--border-strong);

    color: var(--foreground);

}

.xy-btn-danger:hover {
    color: var(--destructive);

    border-color: var(--destructive);

    background: var(--destructive-soft);

}

/* 主操作按钮：实心 Indigo，白字单行横排 */
.btn-primary {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    padding: 9px 18px;

    font-size: 13px;

    font-weight: 600;

    color: var(--primary-foreground);

    background: var(--primary);

    border: none;

    border-radius: var(--radius-sm);

    cursor: pointer;

    transition: background 0.15s ease;

    white-space: nowrap;

}

/* 主按钮图标定尺寸描边渲染，防止黑色填充块 */
.btn-primary .icon {
    width: 15px;

    height: 15px;

    flex-shrink: 0;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

.btn-primary:hover {
    background: var(--primary-hover);

}

/* 次级按钮：白底描边，与主按钮同排版规则 */
.btn {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    padding: 9px 14px;

    font-size: 13px;

    color: var(--muted-foreground);

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    cursor: pointer;

    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;

    white-space: nowrap;

}

.btn:hover {
    background: var(--muted);

    color: var(--foreground);

}

/* 表单行内次按钮图标：定尺寸描边 */
.form-actions .btn .icon {
    width: 15px;

    height: 15px;

    flex-shrink: 0;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

/* ============================================================
   五、KPI 指标条：图标色片 + 大数字，六卡等宽栅格
   ============================================================ */
.xy-kpi-strip {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));

    gap: 16px;

    padding: 24px 28px 0;

    max-width: 1440px;

    margin: 0 auto;

}

.xy-kpi {
    position: relative;

    display: flex;

    flex-direction: column;

    gap: 2px;

    padding: 16px 18px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-sm);

    transition: transform 0.18s ease, box-shadow 0.18s ease;

}

/* 指标卡悬停轻抬升，反馈可交互质感 */
.xy-kpi:hover {
    transform: translateY(-2px);

    box-shadow: var(--shadow-md);

}

/* 焦点指标卡：顶部主色窄条标记核心指标 */
.xy-kpi-accent::before {
    content: "";

    position: absolute;

    top: -1px;

    left: 16px;

    right: 16px;

    height: 3px;

    border-radius: 0 0 3px 3px;

    background: var(--primary);

}

/* 指标卡头行：标签与图标色片两端分布 */
.xy-kpi-head {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 8px;

    margin-bottom: 6px;

}

.xy-kpi-label {
    font-size: 12px;

    color: var(--muted-foreground);

    font-weight: 500;

    letter-spacing: 0.02em;

}

/* 图标色片：24px 圆角方块，浅 Indigo 底 */
.xy-kpi-icon {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 26px;

    height: 26px;

    border-radius: 8px;

    background: var(--accent);

    color: var(--primary);

    flex-shrink: 0;

}

.xy-kpi-icon svg {
    width: 15px;

    height: 15px;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

/* 指标大数字：等宽数字对齐，负值场景不跳动 */
.xy-kpi-value {
    font-size: 26px;

    font-weight: 700;

    color: var(--card-foreground);

    letter-spacing: -0.5px;

    font-variant-numeric: tabular-nums;

    line-height: 1.25;

}

.xy-kpi-sub {
    font-size: 11px;

    color: var(--muted-foreground);

}

/* ============================================================
   六、图表区：白卡面板，趋势通栏 + 三分栏
   ============================================================ */
.xy-charts {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 16px;

    padding: 16px 28px 24px;

    max-width: 1440px;

    margin: 0 auto;

}

.xy-chart-panel {
    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    padding: 18px 20px;

    box-shadow: var(--shadow-sm);

}

.xy-chart-wide {
    grid-column: 1 / -1;

}

.xy-chart-title {
    font-size: 13px;

    font-weight: 600;

    color: var(--muted-foreground);

    margin-bottom: 12px;

    letter-spacing: 0.02em;

}

.xy-chart-body {
    min-height: 200px;

}

/* ============================================================
   七、工作区：表单栏定行高，明细面板等高钳制
   ============================================================ */
/* 左右分栏：行高由左侧表单栏内容决定，明细不拉长整页 */
.workspace {
    max-width: 1440px;

    margin: 0 auto;

    padding: 0 28px 24px;

    display: grid;

    grid-template-columns: 440px minmax(0, 1fr);

    gap: 20px;

    align-items: stretch;

}

/* 通用面板：白卡、描边、浅投影 */
.panel {
    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-sm);

}

/* 表单栏自然伸展：内容高度即工作区行高基准 */
.form-panel {
    padding: 20px;

    overflow-x: hidden;

}

/* 明细面板等高钳制：height:0 使内容不参与行高计算 */
.table-panel {
    height: 0;

    min-height: 100%;

    display: flex;

    flex-direction: column;

    overflow: hidden;

}

/* 未激活明细视图整体隐藏，同一时刻仅呈现当前标签 */
.table-view {
    display: none;

}

/* 激活视图为纵向弹性滚动承载层，承接内部双向滚动 */
.table-view.is-active {
    display: flex;

    flex-direction: column;

    flex: 1 1 0;

    min-height: 0;

    overflow: hidden;

}

/* 表格容器在面板内双向滚动：纵向长列表、横向宽表并存 */
.table-wrap {
    flex: 1 1 0;

    min-height: 0;

    overflow: auto;

}

/* ============================================================
   八、表单栏：字段栅格、开关、编辑态
   ============================================================ */
.panel-header {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-bottom: 16px;

}

.panel-header h2 {
    font-size: 16px;

    font-weight: 600;

    color: var(--card-foreground);

}

/* 编辑中药丸：默认隐藏，进入编辑态随 .editing 显形 */
.editing-pill {
    display: none;

    font-size: 11px;

    padding: 2px 10px;

    border-radius: 999px;

    background: var(--accent);

    color: var(--accent-dark);

    font-weight: 600;

    letter-spacing: 0.04em;

}

/* 编辑态联动：JS 在表单面板挂 .editing 时药丸显形 */
.form-panel.editing .editing-pill {
    display: inline-block;

}

.form-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

}

/* 字段组：标签 + 控件纵向排列 */
.field {
    display: flex;

    flex-direction: column;

    gap: 5px;

    min-width: 0;

}

.field label {
    font-size: 12px;

    font-weight: 500;

    color: var(--muted-foreground);

}

/* 输入控件：次表面底、聚焦主色描边 */
.field input,
.field select,
.field textarea {
    width: 100%;

    min-width: 0;

    padding: 8px 10px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--foreground);

    background: var(--muted);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    outline: none;

    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;

}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: var(--border-strong);

}

.field input:focus,
.field select:focus,
.field textarea:focus {
    background: var(--card);

    border-color: var(--primary);

    box-shadow: 0 0 0 3px var(--ring);

}

.field textarea {
    resize: vertical;

    min-height: 56px;

}

/* 行内双字段并排：横跨表单双列，组内再分两栏，字段获得全宽空间 */
.form-grid .field-row {
    grid-column: 1 / -1;

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 12px;

}

.field-full {
    grid-column: 1 / -1;

}

.form-actions {
    grid-column: 1 / -1;

    display: flex;

    gap: 10px;

    margin-top: 10px;

    padding-top: 14px;

    border-top: 1px solid var(--border);

}

/* 页脚主按钮：占据主位并加大点击区 */
.form-actions .btn-primary {
    flex: 1;

    padding: 11px 18px;

    font-size: 14px;

}

/* 页脚次按钮：同高衬托主按钮 */
.form-actions .btn {
    padding: 11px 18px;

}

/* 条件子面板：开关展开信息的从属容器，主色左肋条宣示归属 */
.subpanel {
    grid-column: 1 / -1;

    display: grid;

    gap: 10px;

    padding: 12px 14px;

    background: var(--muted);

    border: 1px solid var(--border);

    border-left: 3px solid var(--primary);

    border-radius: var(--radius-sm);

}

/* 子面板组标题：主色小字，与开关文案呼应 */
.subpanel-title {
    font-size: 12px;

    font-weight: 600;

    color: var(--accent-dark);

    letter-spacing: .04em;

}

/* 复选芯片栅格：横向流式排布 */
.check-grid {
    display: flex;

    gap: 10px;

    flex-wrap: wrap;

}

/* 复选芯片：整块可点，选中态主色描边填充 */
.check-option {
    display: inline-flex;

    align-items: center;

    gap: 8px;

    padding: 8px 14px;

    background: var(--card);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    cursor: pointer;

    font-size: 13px;

    color: var(--foreground);

    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;

}

.check-option:hover {
    border-color: var(--primary);

}

.check-option:has(input:checked) {
    background: var(--accent);

    border-color: var(--primary);

    color: var(--accent-dark);

    font-weight: 600;

}

/* 芯片内复选框：定尺寸主色着色，不吃文本框样式 */
.check-option input[type="checkbox"] {
    width: 15px;

    height: 15px;

    margin: 0;

    padding: 0;

    background: none;

    border: none;

    accent-color: var(--primary);

    cursor: pointer;

    flex-shrink: 0;

}

/* 全局兜底：字段区复选框永不继承文本框的宽高与衬底 */
.field input[type="checkbox"] {
    width: 15px;

    height: 15px;

    padding: 0;

    background: none;

    border: none;

    accent-color: var(--primary);

}

/* 开关行：文案左、开关右；表单栅格内通栏呈现并以虚线分隔 */
.switch-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    padding: 6px 0;

    font-size: 13px;

    color: var(--foreground);

}

/* 表单栅格内的开关行：通栏 + 虚线上界，宣示下方子面板的从属关系 */
.form-grid > .switch-row {
    grid-column: 1 / -1;

    margin-top: 4px;

    padding: 10px 2px 8px;

    border-top: 1px dashed var(--border);

}

/* 滑动开关：原生 checkbox 隐形，滑轨替身呈现状态 */
.switch {
    position: relative;

    display: inline-block;

    width: 36px;

    height: 20px;

    flex-shrink: 0;

    cursor: pointer;

}

.switch input {
    opacity: 0;

    width: 0;

    height: 0;

    position: absolute;

}

/* 滑轨：关闭灰、开启主色 */
.switch .slider {
    position: absolute;

    inset: 0;

    background: var(--border-strong);

    border-radius: 999px;

    transition: background 0.18s ease;

}

/* 滑块：白色圆点，开启时右移 */
.switch .slider::before {
    content: "";

    position: absolute;

    top: 2px;

    left: 2px;

    width: 16px;

    height: 16px;

    border-radius: 50%;

    background: #ffffff;

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

    transition: transform 0.18s ease;

}

.switch input:checked + .slider {
    background: var(--primary);

}

.switch input:checked + .slider::before {
    transform: translateX(16px);

}

/* 键盘聚焦开关时给滑轨焦点环 */
.switch input:focus-visible + .slider {
    box-shadow: 0 0 0 3px var(--ring);

}

/* ============================================================
   九、明细面板：分段式标签、筛选行
   ============================================================ */
/* 标签条：次表面胶囊容器，激活项白底浮起 */
.detail-tabs {
    display: flex;

    gap: 4px;

    padding: 10px 14px 0;

    border-bottom: 1px solid var(--border);

}

.detail-tab {
    padding: 8px 18px;

    font-size: 13px;

    font-weight: 500;

    color: var(--muted-foreground);

    background: none;

    border: none;

    border-radius: var(--radius-sm) var(--radius-sm) 0 0;

    border-bottom: 2px solid transparent;

    cursor: pointer;

    transition: color 0.15s ease, background 0.15s ease;

    white-space: nowrap;

}

.detail-tab:hover {
    color: var(--foreground);

    background: var(--muted);

}

.detail-tab.is-active {
    color: var(--accent-dark);

    font-weight: 600;

    background: var(--accent);

    border-bottom-color: var(--primary);

}

/* 筛选行：搜索框弹性伸展，下拉定宽 */
.filters {
    padding: 12px 16px;

    display: flex;

    gap: 10px;

    align-items: center;

    flex-wrap: wrap;

    border-bottom: 1px solid var(--border);

    background: var(--card);

}

.searchbox {
    display: flex;

    align-items: center;

    gap: 6px;

    flex: 1;

    min-width: 200px;

    max-width: 320px;

    padding: 0 10px;

    background: var(--muted);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;

}

.searchbox:focus-within {
    background: var(--card);

    border-color: var(--primary);

    box-shadow: 0 0 0 3px var(--ring);

}

.searchbox input {
    flex: 1;

    min-width: 0;

    padding: 7px 0;

    font-size: 13px;

    font-family: var(--font);

    color: var(--foreground);

    background: transparent;

    border: none;

    outline: none;

}

/* 放大镜图标随容器着色，定尺寸不参与弹性 */
.searchbox .icon {
    width: 15px;

    height: 15px;

    flex-shrink: 0;

    fill: none;

    stroke: var(--muted-foreground);

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

.filters select {
    padding: 7px 10px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--foreground);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    background: var(--card);

    cursor: pointer;

    transition: border-color 0.15s ease;

}

.filters select:hover {
    border-color: var(--border-strong);

}

/* ============================================================
   十、数据表格：sticky 表头、金额右对齐、行悬停
   ============================================================ */
/* 表格按内容自然取宽（min-width 保底撑满），横向滚动由容器承接 */
table {
    width: max-content;

    min-width: 100%;

    border-collapse: separate;

    border-spacing: 0;

    font-size: 13px;

}

/* 表头吸顶：纵向滚动时列名常驻 */
th {
    position: sticky;

    top: 0;

    z-index: 2;

    padding: 9px 12px;

    text-align: left;

    font-weight: 600;

    font-size: 12px;

    color: var(--muted-foreground);

    background: var(--muted);

    border-bottom: 1px solid var(--border);

    white-space: nowrap;

}

/* 单元格默认不换行，任何列不出现单字竖排 */
td {
    padding: 9px 12px;

    border-bottom: 1px solid var(--border);

    color: var(--foreground);

    vertical-align: top;

    white-space: nowrap;

}

/* 需求说明与备注两列属长文本，允许两行内换行并限宽 */
td.col-detail,
td.col-note {
    white-space: normal;

    min-width: 180px;

    max-width: 280px;

}

/* 金额与数值列右对齐 + 等宽数字，方便纵向扫读比对 */
th.col-money,
td.col-money,
td.money,
th.col-copies,
td.col-copies {
    text-align: right;

    font-variant-numeric: tabular-nums;

}

/* 日期列弱化呈现，视觉让位给编号与金额 */
td.col-date,
td.col-countdown {
    color: var(--muted-foreground);

    font-variant-numeric: tabular-nums;

}

tbody tr {
    transition: background 0.12s ease;

}

tbody tr:hover td {
    background: var(--muted);

}

/* 可复制单元格给指针反馈，与点击复制行为呼应 */
.copyable-cell {
    cursor: pointer;

}

/* 长文本单元格内层 span 承接省略 */
.cell-text {
    display: inline-block;

    max-width: 200px;

    overflow: hidden;

    text-overflow: ellipsis;

    vertical-align: bottom;

}

td.col-detail .cell-text,
td.col-note .cell-text {
    max-width: none;

    white-space: normal;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

}

/* 订单状态实底徽章：四态高对比，白字强分色 */
.tag.status-making {
    background: var(--info);

    color: #ffffff;

}

.tag.status-waiting {
    background: var(--warning);

    color: #ffffff;

}

.tag.status-done {
    background: var(--success);

    color: #ffffff;

}

.tag.status-refund {
    background: var(--destructive);

    color: #ffffff;

}

/* 状态与来源徽章：轻量 pill，前置色点强化扫读 */
.tag {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    max-width: 100%;

    padding: 2px 10px;

    border-radius: 999px;

    font-size: 12px;

    font-weight: 500;

    line-height: 1.7;

    white-space: nowrap;

}

.tag::before {
    content: "";

    width: 6px;

    height: 6px;

    border-radius: 50%;

    background: currentColor;

    flex-shrink: 0;

}

/* 已结单 / 闲鱼来源：绿 */
.tag-done {
    background: var(--success-soft);

    color: var(--success);

}

/* 等待收货 / 微信来源：琥珀 */
.tag-waiting {
    background: var(--warning-soft);

    color: var(--warning);

}

/* 运营投入来源：紫 */
.tag-investment {
    background: var(--invest-soft);

    color: var(--invest);

}

/* AI 投入来源：深紫罗兰 */
.tag-ai-investment {
    background: var(--invest-soft);

    color: #6d28d9;

}

/* 正在制作：蓝 */
.tag-making {
    background: var(--info-soft);

    color: var(--info);

}

/* 退款/取消：红 */
.tag-refund {
    background: var(--destructive-soft);

    color: var(--destructive);

}

/* 行内操作列：图标按钮横排，行高保持单行 */
.row-actions {
    display: flex;

    gap: 6px;

    align-items: center;

}

.icon-btn {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 28px;

    height: 28px;

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    background: var(--card);

    color: var(--muted-foreground);

    cursor: pointer;

    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;

}

.icon-btn:hover {
    border-color: var(--primary);

    color: var(--primary);

    background: var(--accent);

}

/* 危险图标按钮：悬停转红警示 */
.icon-btn.danger:hover {
    border-color: var(--destructive);

    color: var(--destructive);

    background: var(--destructive-soft);

}

.icon-btn .icon {
    width: 14px;

    height: 14px;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

/* ============================================================
   十一、空状态、提示与工具类
   ============================================================ */
/* 明细区空状态：主副文案两级层级 */
.empty {
    padding: 48px 20px;

    display: flex;

    flex-direction: column;

    gap: 6px;

    text-align: center;

    color: var(--muted-foreground);

    font-size: 14px;

}

.empty strong {
    color: var(--foreground);

    font-size: 15px;

}

/* 轻提示：深色浮层反衬页面，短暂现身 */
.toast {
    position: fixed;

    bottom: 24px;

    left: 50%;

    transform: translateX(-50%) translateY(4px);

    padding: 10px 20px;

    font-size: 13px;

    color: var(--header-foreground);

    background: var(--header);

    border: 1px solid rgba(250, 250, 250, 0.12);

    border-radius: var(--radius-sm);

    box-shadow: var(--shadow-md);

    opacity: 0;

    transition: opacity 0.25s ease, transform 0.25s ease;

    pointer-events: none;

    z-index: 100;

}

.toast.is-visible,
.toast.show {
    opacity: 1;

    transform: translateX(-50%) translateY(0);

}

/* 隐藏文件输入与通用隐藏工具类 */
.file-input {
    display: none;

}

.hidden {
    display: none !important;

}

/* ============================================================
   十二、图表内部元件：趋势折线、环形图、横向条
   ============================================================ */
.xy-trend-svg {
    width: 100%;

    height: auto;

    display: block;

}

.xy-donut-wrap {
    display: flex;

    align-items: center;

    gap: 20px;

}

.xy-donut-svg {
    width: 140px;

    height: 140px;

    flex-shrink: 0;

}

.xy-donut-center {
    font-size: 13px;

    font-weight: 600;

    fill: var(--foreground);

    text-anchor: middle;

}

.xy-donut-legend {
    flex: 1;

    display: flex;

    flex-direction: column;

    gap: 6px;

}

.xy-legend-row {
    display: flex;

    align-items: center;

    gap: 8px;

    font-size: 13px;

}

.xy-legend-dot {
    width: 10px;

    height: 10px;

    border-radius: 50%;

    flex-shrink: 0;

}

.xy-legend-label {
    flex: 1;

    color: var(--muted-foreground);

}

.xy-legend-value {
    font-weight: 600;

    color: var(--foreground);

    font-variant-numeric: tabular-nums;

}

.xy-hbar-row {
    display: flex;

    align-items: center;

    gap: 10px;

    margin-bottom: 10px;

}

.xy-hbar-label {
    width: 80px;

    font-size: 13px;

    color: var(--muted-foreground);

    text-align: right;

    flex-shrink: 0;

}

.xy-hbar-track {
    flex: 1;

    height: 20px;

    background: var(--muted);

    border-radius: 4px;

    overflow: hidden;

}

/* 条形填充块级渲染：行内 span 会忽略宽高导致彩条不可见 */
.xy-hbar-fill {
    display: block;

    height: 100%;

    border-radius: 4px;

    transition: width 0.6s ease;

}

.xy-hbar-value {
    width: 80px;

    font-size: 13px;

    font-weight: 600;

    color: var(--foreground);

    text-align: right;

    flex-shrink: 0;

    font-variant-numeric: tabular-nums;

}

/* ============================================================
   十三、自定义下拉组件：隐藏原生 select，叠加设计化触发器与弹层
   ============================================================ */
/* 包裹层承接原 select 的布局位置 */
.xy-select {
    position: relative;

    display: inline-flex;

    width: auto;

    min-width: 0;

}

/* 表单字段内的下拉占满字段宽度 */
.field .xy-select {
    width: 100%;

}

/* 筛选行内的下拉保持紧凑自动宽度，与搜索框同行排布 */
.filters .xy-select {
    flex: none;

}

.filters .xy-select-trigger {
    width: auto;

}

/* 原生 select 视觉隐藏但保留在文档流，业务读写不受影响 */
.xy-select .xy-select-native {
    position: absolute;

    width: 1px;

    height: 1px;

    opacity: 0;

    pointer-events: none;

}

/* 触发器：与输入控件同视觉语言，开合时箭头旋转 */
.xy-select-trigger {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 8px;

    width: 100%;

    min-width: 0;

    padding: 8px 10px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--foreground);

    background: var(--muted);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    cursor: pointer;

    text-align: left;

    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;

}

.xy-select-trigger:hover {
    border-color: var(--border-strong);

}

.xy-select-trigger.is-focus,
.xy-select-trigger:focus-visible {
    outline: none;

    background: var(--card);

    border-color: var(--primary);

    box-shadow: 0 0 0 3px var(--ring);

}

.xy-select-trigger.is-open {
    background: var(--card);

    border-color: var(--primary);

}

/* 当前选中项文案：超长省略不换行 */
.xy-select-label {
    flex: 1;

    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}

/* 箭头图标：描边风格，展开时上翻 */
.xy-select-trigger svg {
    flex-shrink: 0;

    fill: none;

    stroke: var(--muted-foreground);

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

    transition: transform 0.18s ease;

}

.xy-select-trigger.is-open svg {
    transform: rotate(180deg);

}

/* 弹层：fixed 定位挂 body，白卡投影，超长内部滚动 */
.xy-select-popup {
    position: fixed;

    z-index: 200;

    display: none;

    flex-direction: column;

    max-height: 220px;

    overflow-y: auto;

    padding: 4px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    box-shadow: var(--shadow-md);

}

.xy-select-popup.is-open {
    display: flex;

}

/* 选项：默认透明底，悬停次表面，选中主色高亮 */
.xy-select-option {
    display: block;

    width: 100%;

    padding: 7px 10px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--foreground);

    text-align: left;

    background: transparent;

    border: none;

    border-radius: 7px;

    cursor: pointer;

    white-space: nowrap;

    transition: background 0.12s ease, color 0.12s ease;

}

.xy-select-option:hover {
    background: var(--muted);

}

.xy-select-option:focus-visible {
    outline: none;

    background: var(--muted);

}

.xy-select-option.is-selected {
    background: var(--accent);

    color: var(--accent-dark);

    font-weight: 600;

}

/* ============================================================
   十四、密码门浮层：xy-sync 动态创建，壳层为 ID 无类名
   ============================================================ */
/* 浮层壳：fixed 全屏遮罩居中卡片，hidden 属性优先级最高不显示 */
#xy-login-overlay {
    position: fixed;

    inset: 0;

    z-index: 999;

    display: flex;

    align-items: center;

    justify-content: center;

    background: rgba(24, 24, 27, 0.78);

    backdrop-filter: blur(4px);

}

#xy-login-overlay[hidden] {
    display: none;

}

/* 密码卡：白卡、基准圆角、中投影 */
.xy-login-card {
    width: min(360px, 90vw);

    padding: 32px 28px 26px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-md);

}

.xy-login-title {
    margin: 0 0 6px;

    font-size: 18px;

    font-weight: 600;

    color: var(--card-foreground);

}

.xy-login-sub {
    margin: 0 0 18px;

    font-size: 13px;

    color: var(--muted-foreground);

}

/* 密码输入框：与表单控件同语，聚焦主色描边 */
.xy-login-input {
    width: 100%;

    box-sizing: border-box;

    padding: 10px 14px;

    font-size: 15px;

    font-family: var(--font);

    color: var(--foreground);

    background: var(--muted);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    outline: none;

    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;

}

.xy-login-input:focus {
    background: var(--card);

    border-color: var(--primary);

    box-shadow: 0 0 0 3px var(--ring);

}

/* 错误提示：常驻一行高度防跳动 */
.xy-login-error {
    margin: 8px 0 0;

    font-size: 12px;

    color: var(--destructive);

    min-height: 16px;

}

/* 解锁按钮：主操作实心样式通栏 */
.xy-login-btn {
    width: 100%;

    margin-top: 14px;

    padding: 10px 0;

    font-size: 14px;

    font-weight: 600;

    color: var(--primary-foreground);

    background: var(--primary);

    border: none;

    border-radius: var(--radius-sm);

    cursor: pointer;

    transition: background 0.15s ease;

}

.xy-login-btn:hover {
    background: var(--primary-hover);

}

/* ============================================================
   十五、响应式：窄屏单列堆叠，明细恢复文档流
   ============================================================ */
@media (max-width: 900px) {

    /* 窄屏图表单列，工作区上下堆叠 */
    .xy-charts {
        grid-template-columns: 1fr;

    }

    .workspace {
        grid-template-columns: 1fr;

    }

    /* 堆叠后等高钳制失去意义，明细恢复自然高度 */
    .table-panel {
        height: auto;

        min-height: 0;

    }

    .table-wrap {
        max-height: 70vh;

    }

    /* 指标条加密排布，顶栏纵向堆叠 */
    .xy-kpi-strip {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));

        padding: 16px 16px 0;

    }

    .xy-charts,
    .workspace {
        padding-left: 16px;

        padding-right: 16px;

    }

    .xy-topbar {
        flex-direction: column;

        align-items: flex-start;

        gap: 10px;

    }

}


/* ============================================================
   十六、行悬浮操作工具条：悬停明细行时锚定浮现
   ============================================================ */
/* 工具条壳：白卡浅边投影，与浅色设计语言一致 */
.row-floating-actions {
    position: fixed;

    display: flex;

    gap: 6px;

    padding: 5px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    box-shadow: var(--shadow-md);

    z-index: 70;

}

.row-floating-actions[hidden] {
    display: none;

}

/* 工具条按钮：沿用全局图标按钮语言，尺寸略大便于点击 */
.row-floating-actions .icon-btn {
    width: 30px;

    height: 30px;

}

/* ============================================================
   明细表列交互层：三击排序指示与 Excel 式列筛选面板
   ============================================================ */

/* 可排序表头：指针与文本禁选语义 */
th.xy-col-head {

    cursor: pointer;

    user-select: none;

}

/* 降序方向指示符 */
th.xy-col-head.xy-sorted-desc::before {

    content: "▼";

    margin-right: 4px;

    font-size: 9px;

    color: var(--primary);

}

/* 升序方向指示符 */
th.xy-col-head.xy-sorted-asc::before {

    content: "▲";

    margin-right: 4px;

    font-size: 9px;

    color: var(--primary);

}

/* 筛选箭头按钮：默认低透明度，悬停表头或激活筛选时显形 */
/* 表格上方合计条：表格外浮层，不占表头高度（与表格同容器同滚，横向列位同步） */
.xy-sum-strip {
  position: relative;
  height: 14px;
  margin: 0 0 2px;
}
.xy-col-sum {
  position: absolute;
  top: 0;
  transform: translateX(-100%);
  font-family: "等线", "DengXian", "Microsoft YaHei", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 14px;
  color: var(--destructive);
  white-space: nowrap;
  letter-spacing: .2px;
  pointer-events: none;
}

.xy-col-filter {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 16px;

    height: 16px;

    margin-left: 4px;

    padding: 0;

    border: none;

    border-radius: 4px;

    background: transparent;

    color: var(--muted-foreground);

    opacity: 0.55;

    cursor: pointer;

    vertical-align: middle;

}

/* 箭头图标线条风格 */
.xy-col-filter svg {

    width: 12px;

    height: 12px;

    fill: none;

    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;

}

/* 悬停表头时箭头显形 */
th.xy-col-head:hover .xy-col-filter {

    opacity: 1;

}

/* 箭头自身悬停态 */
.xy-col-filter:hover {

    opacity: 1;

    background: var(--accent);

    color: var(--accent-dark);

}

/* 该列筛选生效中的箭头激活态 */
.xy-col-filter.is-active {

    opacity: 1;

    background: var(--accent);

    color: var(--primary);

}

/* 筛选面板浮层：固定定位于触发箭头下方 */
.xy-col-filter-panel {

    position: fixed;

    z-index: 80;

    min-width: 230px;

    max-width: 340px;

    background: var(--card);

    border: 1px solid var(--border-strong);

    border-radius: var(--radius-sm);

    box-shadow: var(--shadow-md);

    font-size: 12px;

    color: var(--foreground);

    overflow: hidden;

}

/* 面板操作行：全选与反选按钮 */
.xy-col-filter-head {

    display: flex;

    gap: 6px;

    padding: 8px 10px;

    border-bottom: 1px solid var(--border);

    background: var(--muted);

}

/* 全选与反选按钮外观 */
.xy-col-filter-head button {

    flex: 1;

    padding: 4px 10px;

    font-size: 12px;

    font-family: var(--font);

    color: var(--foreground);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    background: var(--card);

    cursor: pointer;

}

/* 全选与反选按钮悬停态 */
.xy-col-filter-head button:hover {

    border-color: var(--primary);

    color: var(--primary);

}

/* 日期区间行：起止输入与清空按钮 */
.xy-col-filter-range {

    display: flex;

    align-items: center;

    gap: 6px;

    padding: 8px 10px;

    border-bottom: 1px solid var(--border);

}

/* 日期输入框 */
.xy-col-filter-range input[type="date"] {

    flex: 1;

    min-width: 0;

    padding: 3px 6px;

    font-size: 12px;

    font-family: var(--font);

    color: var(--foreground);

    border: 1px solid var(--input);

    border-radius: var(--radius-sm);

    background: var(--card);

}

/* 区间分隔文案 */
.xy-col-filter-range span {

    flex: none;

    color: var(--muted-foreground);

}

/* 清空区间按钮 */
.xy-col-filter-range button {

    flex: none;

    padding: 3px 8px;

    font-size: 12px;

    color: var(--muted-foreground);

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    background: var(--card);

    cursor: pointer;

}

/* 清空区间按钮悬停态 */
.xy-col-filter-range button:hover {

    color: var(--destructive);

    border-color: var(--destructive);

}

/* 选项列表滚动区 */
.xy-col-filter-options {

    max-height: 260px;

    overflow-y: auto;

    padding: 4px 0;

}

/* 单个选项行：复选框 + 文本 + 悬停浮现的只看它 */
.xy-col-filter-option {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 6px 10px;

    cursor: pointer;

}

/* 选项行悬停底色 */
.xy-col-filter-option:hover {

    background: var(--accent);

}

/* 选项复选框强调色 */
.xy-col-filter-option input[type="checkbox"] {

    margin: 0;

    accent-color: var(--primary);

    flex: none;

}

/* 选项文本：超长省略并悬停补全提示 */
.xy-option-text {

    flex: 1;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}

/* 只看它按钮：默认隐藏，悬停选项行时浮现 */
.xy-only-button {

    display: none;

    flex: none;

    padding: 2px 8px;

    font-size: 11px;

    color: var(--primary);

    border: 1px solid var(--primary);

    border-radius: 999px;

    background: var(--card);

    cursor: pointer;

}

/* 悬停选项行时浮现只看它 */
.xy-col-filter-option:hover .xy-only-button {

    display: inline-block;

}

/* 只看它按钮悬停态 */
.xy-only-button:hover {

    background: var(--primary);

    color: var(--primary-foreground);

}

/* 空选项占位文案 */
.xy-col-filter-empty {

    padding: 14px 10px;

    text-align: center;

    color: var(--muted-foreground);

}

/* 一键清除按钮：与筛选栏控件同高的虚线弱化态 */
.clear-tuning-btn {

    padding: 7px 14px;

    font-size: 13px;

    font-family: var(--font);

    color: var(--muted-foreground);

    border: 1px dashed var(--border-strong);

    border-radius: var(--radius-sm);

    background: var(--card);

    cursor: pointer;

    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;

}

/* 一键清除按钮悬停态：危险色提示 */
.clear-tuning-btn:hover {

    color: var(--destructive);

    border-color: var(--destructive);

    background: var(--destructive-soft);

}
