/* ============================================================
   Staff 统一订单查询 + 订单详情 - 现代 SaaS 风格
   合并自 V51.3（列表页）+ V52.3（详情页）+ V53 修复版
   ============================================================ */

/* ============================================================
   1. 设计令牌（Design Tokens）
   ============================================================ */
:root {
    /* 主色 - 靛蓝 */
    --c-primary:        #4f46e5;
    --c-primary-hover:  #4338ca;
    --c-primary-light:  #eef2ff;
    --c-primary-soft:   #e0e7ff;
    --c-primary-glow:   rgba(79, 70, 229, 0.25);

    /* 蓝色系 */
    --sf-blue-900: #1e1b4b;
    --sf-blue-800: #312e81;
    --sf-blue-700: #4338ca;
    --sf-blue-600: #4f46e5;
    --sf-blue-500: #6366f1;
    --sf-blue-400: #818cf8;
    --sf-blue-300: #a5b4fc;
    --sf-blue-200: #c7d2fe;
    --sf-blue-100: #e0e7ff;
    --sf-blue-50:  #eef2ff;
    --sf-blue-25:  #f5f7ff;

    /* 背景 */
    --c-bg:             #f6f7fb;
    --c-surface:        #ffffff;
    --c-surface-soft:   #fafbfe;

    /* 边框 */
    --c-border:         #e5e7eb;
    --c-border-soft:    #f1f2f6;

    /* 文本 */
    --c-text:           #0f172a;
    --c-text-soft:      #475569;
    --c-text-muted:     #94a3b8;
    --c-text-light:     #cbd5e1;

    /* 语义色 */
    --c-success:        #10b981;
    --c-success-bg:     #ecfdf5;
    --c-success-fg:     #047857;
    --c-warning:        #f59e0b;
    --c-warning-bg:     #fffbeb;
    --c-warning-fg:     #b45309;
    --c-danger:         #ef4444;
    --c-danger-bg:      #fef2f2;
    --c-danger-fg:      #b91c1c;
    --c-info:           #0ea5e9;
    --c-info-bg:        #f0f9ff;
    --c-info-fg:        #0369a1;

    /* 圆角 */
    --r-sm:  8px;
    --r-md:  12px;
    --r-lg:  16px;
    --r-xl:  20px;
    --r-full: 999px;

    /* 阴影 */
    --sh-sm:  0 1px 2px rgba(15, 23, 42, 0.04);
    --sh-md:  0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --sh-lg:  0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
    --sh-primary: 0 8px 24px rgba(79, 70, 229, 0.28);

    /* 过渡 */
    --t-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* 兼容原有列表页变量命名 */
    --sf-text: var(--c-text);
    --sf-text-soft: var(--c-text-soft);
    --sf-text-muted: var(--c-text-muted);
    --sf-text-light: var(--c-text-light);
    --sf-border: var(--c-border);
    --sf-border-light: var(--c-border-soft);
    --sf-bg-card: var(--c-surface);
    --sf-bg-toolbar: var(--sf-blue-25);
    --sf-bg-summary: var(--sf-blue-50);
    --sf-bg-zebra-odd: #ffffff;
    --sf-bg-zebra-even: #fafbff;
    --sf-radius: var(--r-sm);
    --sf-radius-lg: var(--r-lg);
    --sf-shadow-sm: var(--sh-sm);
    --sf-shadow: var(--sh-md);
    --sf-shadow-lg: var(--sh-lg);
    --sf-shadow-card: var(--sh-md);
    --sf-shadow-focus: 0 0 0 3px var(--c-primary-glow);
    --sf-transition: all var(--t-base);

    /* ★ 表头吸顶偏移量（有固定导航栏时改这里，如 60px） */
    --sf-sticky-top: 0px;
}

/* ============================================================
   2. 通用重置
   ============================================================ */
html, body {
    /* ★ 用 clip，不用 hidden —— hidden 会破坏 sticky */
    overflow-x: clip;
}

.staff-container *,
.staff-container *::before,
.staff-container *::after,
.sd-container *,
.sd-container *::before,
.sd-container *::after {
    box-sizing: border-box;
}

.staff-hidden { display: none !important; }
.staff-inline-flex { display: inline-flex; }

/* ============================================================
   3. 列表页 - 页面容器
   ============================================================ */
.staff-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--c-text);
    font-size: 13px;
    background: transparent;
    overflow: visible;                    /* ★ sticky 前提 */
}

/* ============================================================
   4. 列表页 - 统计卡片
   ============================================================ */
.staff-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 1200px) { .staff-stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .staff-stats-grid { grid-template-columns: repeat(2, 1fr); } }

.staff-stat-card {
    position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    cursor: pointer;
    transition: var(--sf-transition);
    overflow: hidden;
    box-shadow: var(--sh-md);
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: inherit;
    display: block;
}
.staff-stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--c-primary) 0%, #6366f1 100%);
    border-radius: 4px 0 0 4px;
}
.staff-stat-card:hover {
    border-color: var(--c-primary-soft);
    box-shadow: var(--sh-lg);
    transform: translateY(-2px);
}
.staff-stat-card:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

.staff-number {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    font-family: 'Consolas', 'Monaco', monospace;
}
.staff-number.primary { color: var(--c-primary); }
.staff-number.warning { color: var(--c-warning); }
.staff-number.info    { color: var(--c-info); }
.staff-number.danger  { color: var(--c-danger); }
.staff-number.success { color: var(--c-success); }

.staff-label {
    font-size: 13px;
    color: var(--c-text);
    font-weight: 700;
    margin-bottom: 2px;
}
.staff-sub { font-size: 12px; color: var(--c-text-muted); }

/* ============================================================
   5. 列表页 - 数据范围切换（保留样式，兼容旧视图）
   ============================================================ */
.staff-scope-switcher {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 12px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: var(--sh-md);
}
.staff-scope-label {
    font-size: 13px;
    color: var(--c-text);
    font-weight: 700;
}
.staff-scope-buttons { display: flex; gap: 6px; }
.staff-scope-btn {
    padding: 6px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-surface);
    text-decoration: none;
    transition: var(--sf-transition);
    border: 1px solid var(--c-border);
}
.staff-scope-btn:hover {
    background: var(--c-primary-light);
    color: var(--c-primary-hover);
    border-color: var(--c-primary-soft);
}
.staff-scope-btn.active {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--sh-primary);
}
.staff-scope-hint {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-left: auto;
}

/* ============================================================
   6. 列表页 - 筛选卡片
   ============================================================ */
.staff-filter-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--sh-md);
    position: relative;
    z-index: 100;
    overflow: visible;
}
.staff-filter-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
    scroll-margin-top: 90px;
    position: relative;
    z-index: 30;
}
.staff-filter-row:last-child { margin-bottom: 0; }
.staff-filter-row.date-open { z-index: 950; }

/* 搜索框 */
.staff-filter-search {
    flex: 1;
    min-width: 280px;
    height: 46px;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    transition: var(--sf-transition);
}
.staff-filter-search:hover { border-color: var(--c-primary-soft); }
.staff-filter-search:focus-within {
    border-color: var(--c-primary);
    box-shadow: var(--sf-shadow-focus);
}
.staff-filter-search input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 16px;
    font-size: 14px;
    color: var(--c-text);
    outline: none;
    min-width: 0;
    height: 100%;
    width: 100%;
    font-family: inherit;
}
.staff-filter-search input::placeholder { color: var(--c-text-light); }

.staff-search-clear {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    border: none;
    background: none;
    padding: 0 14px;
    color: var(--c-text-light);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: var(--sf-transition);
    display: none;
    align-items: center;
    justify-content: center;
}
.staff-search-clear.visible { display: flex; }
.staff-search-clear:hover { color: var(--c-danger); }

/* 日期组 */
.staff-filter-date-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 46px;
    padding: 0 16px;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    transition: var(--sf-transition);
    min-width: 340px;
    user-select: none;
    z-index: 50;
}
.staff-filter-date-group:hover { border-color: var(--c-primary-soft); }
.staff-filter-date-group.open {
    border-color: var(--c-primary);
    box-shadow: var(--sf-shadow-focus);
    z-index: 900;
}
.staff-filter-date-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: var(--c-primary);
    flex-shrink: 0;
    transition: color 0.2s;
    margin-right: 8px;
}
.staff-filter-date-group:hover .staff-filter-date-icon,
.staff-filter-date-group.open .staff-filter-date-icon { color: var(--c-primary-hover); }

.staff-date-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
    z-index: 2;
}
.staff-date-half:hover { background: var(--c-primary-light); }
.staff-date-half.is-active {
    background: var(--c-primary-soft);
    color: var(--c-primary-hover);
    font-weight: 600;
}
.staff-date-display {
    font-size: 13.5px;
    color: var(--c-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 60px;
    text-align: center;
    width: 100%;
}
.staff-date-display.is-placeholder { color: var(--c-text-light); font-weight: 400; }
.staff-date-display.is-active { color: var(--c-primary); font-weight: 600; }
.staff-filter-date-sep {
    color: var(--c-text-light);
    font-size: 13px;
    user-select: none;
    padding: 0 6px;
    font-weight: 600;
    flex-shrink: 0;
    z-index: 2;
}

/* 日期面板 */
.staff-date-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    padding: 12px;
    width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    cursor: default;
}
.staff-filter-date-group.open .staff-date-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.staff-date-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 10px;
}
.staff-date-title {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--c-text);
}
.staff-date-nav {
    width: 28px;
    height: 28px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: 6px;
    cursor: pointer;
    color: var(--c-primary);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.staff-date-nav:hover {
    color: #fff;
    border-color: var(--c-primary);
    background: var(--c-primary);
}
.staff-date-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}
.staff-date-weekdays span {
    text-align: center;
    font-size: 11.5px;
    color: var(--c-primary);
    font-weight: 700;
    padding: 4px 0;
}
.staff-date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 10px;
}
.staff-date-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--c-text-soft);
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
    border: 1px solid transparent;
}
.staff-date-cell:hover { background: var(--c-primary-light); color: var(--c-primary-hover); }
.staff-date-cell.other-month { color: var(--c-text-light); }
.staff-date-cell.today { color: var(--c-primary); font-weight: 700; border-color: var(--c-primary-soft); }
.staff-date-cell.in-range { background: var(--c-primary-soft); color: var(--c-primary-hover); border-radius: 0; }
.staff-date-cell.range-start,
.staff-date-cell.range-end,
.staff-date-cell.selected {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    font-weight: 700;
    border-radius: 6px;
    box-shadow: 0 2px 6px var(--c-primary-glow);
}
.staff-date-panel-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--c-border-soft);
}
.staff-date-btn {
    flex: 1;
    height: 32px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-primary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.staff-date-btn:hover {
    background: var(--c-primary-light);
    border-color: var(--c-primary-soft);
    color: var(--c-primary-hover);
}
.staff-date-btn-primary {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
}
.staff-date-btn-primary:hover {
    background: linear-gradient(135deg, var(--c-primary-hover) 0%, var(--c-primary) 100%);
    color: #fff;
}
.staff-date-active-label {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--c-primary);
    text-align: center;
    font-weight: 600;
}

/* ============================================================
   7. 列表页 - 自定义下拉框
   ============================================================ */
.custom-select {
    position: relative;
    display: inline-block;
    user-select: none;
    font-family: inherit;
    z-index: 20;
    min-width: 0;
    width: 100%;
}
.custom-select.open { z-index: 800; }
.custom-select-trigger {
    display: flex;
    align-items: center;
    height: 46px;
    padding: 0 12px;
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: var(--sf-transition);
    gap: 6px;
    width: 100%;
}
.custom-select-trigger:hover { border-color: var(--c-primary-soft); }
.custom-select.open .custom-select-trigger,
.custom-select-trigger.has-value {
    border-color: var(--c-primary);
    background: var(--sf-blue-25);
    box-shadow: var(--sf-shadow-focus);
}
.custom-select-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--c-primary);
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    transition: color 0.2s;
}
.custom-select-trigger:hover .custom-select-icon,
.custom-select-trigger.has-value .custom-select-icon,
.custom-select.open .custom-select-trigger .custom-select-icon { color: var(--c-primary-hover); }
.custom-select-label {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}
.custom-select-trigger.has-value .custom-select-label { color: var(--c-primary-hover); font-weight: 700; }
.custom-select-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}
.custom-select.open .custom-select-arrow { transform: rotate(180deg); color: var(--c-primary-hover); }
.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 100%;
    max-height: 320px;
    overflow-y: auto;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    padding: 6px;
    margin: 0;
    list-style: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.custom-select.open .custom-select-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.custom-select-menu::-webkit-scrollbar { width: 6px; }
.custom-select-menu::-webkit-scrollbar-thumb { background: var(--c-text-light); border-radius: 3px; }
.custom-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--c-text-soft);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.custom-select-option-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.custom-select-option-count {
    font-size: 11.5px;
    color: var(--c-primary);
    background: var(--c-primary-light);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 8px;
    flex-shrink: 0;
    border: 1px solid var(--c-primary-soft);
    font-weight: 700;
}
.custom-select-option-check { color: #fff; font-size: 12px; margin-left: 8px; display: none; }
.custom-select-option.selected .custom-select-option-check { display: inline-block; }
.custom-select-option:hover,
.custom-select-option.is-focused {
    background: var(--c-primary-light);
    color: var(--c-primary-hover);
}
.custom-select-option:hover .custom-select-option-count,
.custom-select-option.is-focused .custom-select-option-count {
    background: var(--c-surface);
    color: var(--c-primary-hover);
    border-color: var(--c-primary-soft);
}
.custom-select-option.selected {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    font-weight: 700;
}
.custom-select-option.selected .custom-select-option-count {
    background: rgba(255, 255, 255, .3);
    color: #fff;
    border-color: transparent;
}

/* ============================================================
   下拉框行布局：按内容自适应宽度，一行排完，左对齐
   ============================================================ */
.staff-dropdown-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 18px;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    z-index: 20;
    scrollbar-width: thin;
}
.staff-dropdown-row::-webkit-scrollbar { height: 4px; }
.staff-dropdown-row::-webkit-scrollbar-thumb {
    background: var(--c-text-light);
    border-radius: 2px;
}

.staff-dropdown-row > .custom-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 200px;
    max-width: 320px;
}

.staff-dropdown-row .custom-select-trigger { width: 100%; }
.staff-dropdown-row .custom-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staff-dropdown-row.dept-mode,
.staff-dropdown-row.dept-mode-6 {
    display: flex;
    grid-template-columns: none;
}

@media (max-width: 768px) {
    .staff-dropdown-row,
    .staff-dropdown-row.dept-mode,
    .staff-dropdown-row.dept-mode-6 {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 8px;
    }
    .staff-dropdown-row > .custom-select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        max-width: none;
    }
}
@media (max-width: 480px) {
    .staff-dropdown-row > .custom-select {
        flex: 1 1 100%;
    }
}

/* ============================================================
   8. 列表页 - 按钮
   ============================================================ */
.staff-filter-actions { display: flex; gap: 10px; }
.staff-btn-filter {
    height: 46px;
    padding: 0 26px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: var(--sf-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.3px;
    font-family: inherit;
    text-decoration: none;
}
.staff-btn-filter-primary {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    box-shadow: var(--sh-primary);
}
.staff-btn-filter-primary:hover {
    background: linear-gradient(135deg, var(--c-primary-hover) 0%, var(--c-primary) 100%);
    box-shadow: 0 4px 16px var(--c-primary-glow);
    transform: translateY(-1px);
}
.staff-btn-filter-ghost {
    background: var(--c-surface);
    color: var(--c-primary);
    border: 1.5px solid var(--c-border);
}
.staff-btn-filter-ghost:hover {
    background: var(--c-primary-light);
    border-color: var(--c-primary-soft);
    color: var(--c-primary-hover);
}

/* ============================================================
   9. 列表页 - 导出下拉（★ 提升层级，防表头遮挡）
   ============================================================ */
.staff-export-dropdown {
    position: relative;
    display: inline-block;
    z-index: 200;                    /* ★ 高于表头 */
}
.staff-export-arrow { font-size: 10px; margin-left: 2px; }
.staff-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    z-index: 500;                    /* ★ 高于表头 */
    padding: 8px;
    animation: sfMenuFade 0.15s ease;
    display: none;
}
@keyframes sfMenuFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.staff-export-menu.show { display: block; }
.staff-export-menu a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--c-text);
    transition: var(--sf-transition);
    cursor: pointer;
}
.staff-export-menu a:hover { background: var(--c-primary-light); }
.staff-export-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.staff-export-title { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; color: var(--c-primary-hover); }
.staff-export-desc { font-size: 11.5px; color: var(--c-text-muted); }
.staff-export-menu a.is-ready .staff-export-desc { color: var(--c-primary); font-weight: 700; }
.staff-export-menu a.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.staff-export-btn-fancy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 34px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: var(--sf-transition);
    font-family: inherit;
    line-height: 1;
    box-shadow: var(--sh-primary);
}
.staff-export-btn-fancy:hover {
    background: linear-gradient(135deg, var(--c-primary-hover) 0%, var(--c-primary) 100%);
    box-shadow: 0 4px 14px var(--c-primary-glow);
    transform: translateY(-1px);
}
.staff-export-btn-fancy .staff-export-arrow { font-size: 10px; opacity: 0.8; }

/* ============================================================
   10. 列表页 - 年份/月份
   ============================================================ */
.staff-date-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.staff-year-dropdown { width: 160px; flex-shrink: 0; }
.staff-year-dropdown .custom-select-trigger { background: var(--c-surface); }
.staff-months-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.staff-month-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    min-width: 58px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    text-decoration: none;
    transition: var(--sf-transition);
    line-height: 1;
}
.staff-month-tag:hover {
    border-color: var(--c-primary-soft);
    color: var(--c-primary-hover);
    background: var(--c-primary-light);
    transform: translateY(-1px);
}
.staff-month-tag.is-active {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: var(--sh-primary);
}
.staff-year-month-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.staff-year-month-row.hidden { display: none; }

/* ============================================================
   11. 列表页 - 表格
   ★ 关键修复：去掉 overflow-y: clip，让 sticky 相对视口生效
   ============================================================ */
.staff-table-wrapper {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    /* ★ 不再设 overflow —— 让页面整体滚动，sticky 参照视口 */
    overflow: visible;
    position: relative;
    z-index: 1;
}

.staff-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--sf-blue-25) 0%, var(--sf-blue-50) 100%);
    border-bottom: 1px solid var(--c-border-soft);
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
    z-index: 150;                    /* ★ 高于表头 */
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    min-width: 1200px;
}
.staff-toolbar-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.staff-toolbar-title { font-size: 16px; font-weight: 700; color: var(--c-text); letter-spacing: -0.2px; }

.staff-selected-count {
    font-size: 12px;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    padding: 3px 10px;
    border-radius: 10px;
    display: none;
}
.staff-selected-count.visible { display: inline-block; }

.staff-list-body { display: block; width: 100%; }

/* ★ 默认列模板（部门数据：含员工列，14 列） */
.staff-list-grid {
    display: grid;
    grid-template-columns: 40px minmax(120px, 1.5fr) minmax(180px, 2fr) 60px 100px 110px
                           minmax(80px, 1fr) minmax(80px, 1fr) 80px 80px 100px 100px 100px 80px;
    align-items: center;
    min-width: 1200px;
    width: 100%;
}

/* ★ 本人数据（无员工列，13 列）：商品名列更宽 */
.staff-list-grid.is-self-scope {
    grid-template-columns: 40px minmax(120px, 1.5fr) minmax(260px, 2.6fr) 60px 100px 110px
                           minmax(80px, 1fr) minmax(80px, 1fr) 80px
                           100px 100px 100px 80px;
}

.staff-list-head-wrapper {
    border-bottom: 2px solid var(--c-primary);
    background: var(--c-surface);
    position: relative;
    z-index: 10;
}
.staff-list-head {
    background: linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary-hover) 100%);
    font-weight: 700;
    color: #ffffff !important;
    font-size: 12.5px;
    min-height: 46px;
    position: -webkit-sticky;
    position: sticky;
    top: var(--sf-sticky-top);         /* ★ 吸顶到视口顶部 */
    z-index: 10;                       /* ★ 低于工具栏/导出菜单 */
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.staff-list-head .staff-list-cell {
    padding: 13px 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    color: #ffffff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.staff-list-head .staff-list-cell:last-child { border-right: none; }
.staff-list-head .staff-list-cell:hover { background: rgba(255, 255, 255, 0.12); color: #ffffff !important; }
.staff-list-head .staff-list-cell.staff-col-check { cursor: default; justify-content: center; }
.staff-list-head .staff-list-cell.staff-col-check:hover { background: transparent; }
.staff-list-head .staff-sort-icon { color: rgba(255,255,255,0.55); }
.staff-list-head .staff-sort-icon.active { color: #ffffff; opacity: 1; }
.staff-list-head .staff-list-cell.is-sorting { background: rgba(255, 255, 255, 0.18); }

.staff-list-row {
    border-bottom: 1px solid var(--c-border-soft);
    min-height: 54px;
    transition: background-color 0.15s ease;
}
.staff-list-row:nth-child(odd) { background: var(--sf-bg-zebra-odd); }
.staff-list-row:nth-child(even) { background: var(--sf-bg-zebra-even); }
.staff-list-row:hover { background: var(--c-primary-light); }

.staff-list-cell {
    padding: 12px 10px;
    font-size: 13px;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    min-width: 0;
}
.staff-col-check    { justify-content: center; }
.staff-col-order-no { font-weight: 700; font-family: 'Consolas', monospace; font-size: 12.5px; }
.staff-col-product  {
    white-space: normal;
    line-height: 1.4;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    align-items: center;
}
.staff-col-qty      { justify-content: center; }
.staff-col-price    { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.staff-col-amount   { justify-content: flex-end; font-weight: 700; color: var(--c-primary); font-variant-numeric: tabular-nums; }
.staff-col-date     { font-size: 12.5px; color: var(--c-text-muted); font-variant-numeric: tabular-nums; }
.staff-col-status   { justify-content: center; }
.staff-col-action   { justify-content: center; }

.staff-list-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--c-primary);
}
.staff-sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
}
.staff-sort-icon.active { opacity: 1; color: var(--c-primary); }

/* 合计行（★ 吸底） */
.staff-list-summary {
    background: linear-gradient(135deg, var(--sf-blue-50) 0%, var(--sf-blue-100) 100%);
    border-top: 2px solid var(--c-primary);
    font-weight: 700;
    color: var(--c-text);
    min-height: 46px;
    display: grid;
    align-items: center;
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;                         /* ★ 吸底到视口底部 */
    z-index: 9;
}
.staff-list-summary .staff-list-cell {
    padding: 12px 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.staff-list-summary .staff-col-qty { justify-content: center; color: var(--c-text); }
.staff-list-summary .staff-col-price { color: var(--c-text); }
.staff-list-summary .staff-col-amount { color: var(--c-primary); font-size: 14px; font-weight: 700; }
.staff-list-summary .staff-summary-label { justify-content: flex-start; color: var(--c-text); font-weight: 700; }
.staff-list-summary .staff-summary-note { font-size: 11px; color: var(--c-text-muted); font-weight: 600; margin-left: 4px; }
.staff-list-summary .staff-summary-note-right { justify-content: flex-end; color: var(--c-text-soft); font-weight: 600; font-size: 12px; }
.staff-summary-span-2 { grid-column: span 2; }
.staff-summary-span-8 { grid-column: span 8; }
.staff-summary-span-7 { grid-column: span 7; }

/* ============================================================
   12. 列表页 - 状态标签
   ============================================================ */
.staff-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1;
}
.staff-status-tag::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.staff-status-pending {
    background: #f1f5f9;
    color: var(--c-text-soft);
    border-color: #e2e8f0;
}
.staff-status-pending::before { background: var(--c-text-soft); }
.staff-status-warning {
    background: var(--c-warning-bg);
    color: var(--c-warning-fg);
    border-color: #fde68a;
}
.staff-status-warning::before { background: var(--c-warning); }
.staff-status-danger {
    background: var(--c-danger-bg);
    color: var(--c-danger-fg);
    border-color: #fecaca;
}
.staff-status-danger::before { background: var(--c-danger); }
.staff-status-settled {
    background: var(--c-success-bg);
    color: var(--c-success-fg);
    border-color: #a7f3d0;
}
.staff-status-settled::before { background: var(--c-success); }
.staff-status-info {
    background: var(--c-info-bg);
    color: var(--c-info-fg);
    border-color: #bae6fd;
}
.staff-status-info::before { background: var(--c-info); }

/* ============================================================
   13. 列表页 - 其他元素
   ============================================================ */
.staff-order-link {
    color: var(--c-primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
}
.staff-order-link:hover { text-decoration: underline; color: var(--c-primary-hover); }

.staff-btn-detail {
    display: inline-block;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border: 1px solid var(--c-primary-soft);
    border-radius: 6px;
    text-decoration: none;
    transition: var(--sf-transition);
}
.staff-btn-detail:hover {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
}
.staff-btn-disabled {
    background: #f3f4f6 !important;
    color: var(--c-text-light) !important;
    border-color: #e5e7eb !important;
    cursor: not-allowed;
}

.staff-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-muted);
}
.staff-empty-state .empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}
.staff-empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 8px;
}
.staff-empty-state p {
    font-size: 13px;
    color: var(--c-text-light);
    margin-bottom: 16px;
}

/* ============================================================
   14. 列表页 - 分页
   ============================================================ */
.staff-pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-top: 1px solid var(--c-border-soft);
    background: linear-gradient(135deg, var(--sf-blue-25) 0%, var(--sf-blue-50) 100%);
    gap: 12px;
    flex-wrap: wrap;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    min-width: 1200px;
}
.staff-pagination-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.staff-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.staff-pagination li a,
.staff-pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    text-decoration: none;
    transition: var(--sf-transition);
}
.staff-pagination li a:hover {
    background: var(--c-primary-light);
    color: var(--c-primary-hover);
    border-color: var(--c-primary-soft);
}
.staff-pagination li.active span {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: var(--sh-primary);
}
.staff-pagination li.disabled span {
    color: var(--c-text-light);
    background: #f8fafc;
    cursor: not-allowed;
    border-color: var(--c-border-soft);
}
.staff-pagination li.ellipsis span {
    border: none;
    background: transparent;
    color: var(--c-primary);
}
.staff-page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--c-text-soft);
    font-weight: 600;
}
.staff-page-jump input {
    width: 56px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    outline: none;
    text-align: center;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface);
    font-weight: 700;
}
.staff-page-jump input:focus {
    border-color: var(--c-primary);
    box-shadow: var(--sf-shadow-focus);
}
.staff-btn-go {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--sf-transition);
    font-family: inherit;
}
.staff-btn-go:hover {
    background: linear-gradient(135deg, var(--c-primary-hover) 0%, var(--c-primary) 100%);
    box-shadow: var(--sh-primary);
}
.staff-pagination-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: var(--c-text-soft);
    font-weight: 600;
}
.staff-per-page { display: flex; align-items: center; gap: 6px; }
.staff-per-page select {
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.staff-per-page select:focus {
    border-color: var(--c-primary);
    box-shadow: var(--sf-shadow-focus);
}

@media (max-width: 768px) {
    .staff-filter-card { padding: 16px; }
    .staff-filter-date-group { width: 100%; min-width: 0; }
}

/* ============================================================
   15. 详情页 - 页面容器
   ============================================================ */
.sd-container {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   16. 详情页 - 顶部操作条
   ============================================================ */
.sd-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.sd-action-left, .sd-action-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.sd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text-soft);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--t-base);
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--sh-sm);
}
.sd-btn:hover {
    color: var(--c-primary);
    border-color: var(--c-primary-soft);
    background: var(--c-primary-light);
    transform: translateY(-1px);
    box-shadow: var(--sh-md);
}
.sd-btn:active { transform: translateY(0); }
.sd-btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.sd-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    border-color: transparent;
    box-shadow: var(--sh-primary);
}
.sd-btn-primary:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary-hover) 0%, var(--c-primary) 100%);
    border-color: transparent;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.36);
    transform: translateY(-2px);
}

/* ============================================================
   17. 详情页 - 统计卡片行
   ============================================================ */
.sd-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
    align-items: stretch;
}
.sd-stat-box {
    position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--sh-md);
    overflow: hidden;
    transition: all var(--t-base);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 96px;
}
.sd-stat-box::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--c-primary) 0%, #6366f1 100%);
    border-radius: 4px 0 0 4px;
}
.sd-stat-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh-lg);
    border-color: var(--c-primary-soft);
}
.sd-stat-box.is-success::before { background: linear-gradient(180deg, var(--c-success) 0%, #34d399 100%); }
.sd-stat-box.is-warning::before { background: linear-gradient(180deg, var(--c-warning) 0%, #fbbf24 100%); }
.sd-stat-box.is-info::before    { background: linear-gradient(180deg, var(--c-info) 0%, #38bdf8 100%); }

.sd-stat-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-text-soft);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}
.sd-stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    color: var(--c-text);
    word-break: break-word;
}
.sd-stat-value.is-primary { color: var(--c-primary); }
.sd-stat-value.is-success { color: var(--c-success); }
.sd-stat-value.is-warning { color: var(--c-warning); }
.sd-stat-value.is-info    { color: var(--c-info); }
.sd-stat-value.is-placeholder { font-size: 15px; font-weight: 500; color: var(--c-text-muted); }
.sd-stat-value.is-text { font-size: 16px; font-weight: 600; letter-spacing: 0; }

/* ============================================================
   18. 详情页 - 主卡片
   ============================================================ */
.sd-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    margin-bottom: 24px;
    overflow: hidden;
}
.sd-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 20px 28px;
    background: linear-gradient(135deg, var(--sf-blue-25) 0%, var(--sf-blue-50) 100%);
    border-bottom: 1px solid var(--c-border-soft);
    position: relative;
}
.sd-card-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-primary-soft), transparent);
}
.sd-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.01em;
}
.sd-card-body { padding: 28px; }

/* ============================================================
   19. 详情页 - 分区标题
   ============================================================ */
.sd-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 20px;
    letter-spacing: -0.005em;
}
.sd-section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--c-primary) 0%, #6366f1 100%);
    border-radius: 2px;
}
.sd-section-title .sd-section-count {
    margin-left: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border-radius: var(--r-full);
}
.sd-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-border-soft) 20%, var(--c-border-soft) 80%, transparent);
    margin: 32px 0;
    border: none;
}

/* ============================================================
   20. 详情页 - 商品表格
   ============================================================ */
.sd-table-wrapper {
    overflow-x: auto;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border-soft);
    background: var(--c-surface);
}
.sd-table-wrapper::-webkit-scrollbar { height: 8px; }
.sd-table-wrapper::-webkit-scrollbar-thumb { background: var(--c-text-light); border-radius: 4px; }
.sd-table-wrapper::-webkit-scrollbar-thumb:hover { background: var(--c-text-muted); }

.sd-product-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 720px;
    font-size: 13.5px;
}
.sd-product-table thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--c-text-soft);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    white-space: nowrap;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}
.sd-product-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--c-border-soft);
    color: var(--c-text);
    vertical-align: middle;
    transition: background var(--t-fast);
}
.sd-product-table tbody tr:last-child td { border-bottom: none; }
.sd-product-table tbody tr:hover td { background: var(--sf-blue-25); }
.sd-product-table tfoot td {
    padding: 16px;
    font-weight: 700;
    font-size: 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--c-text);
    border-top: 1px solid var(--c-border);
}

.sd-product-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border-radius: 8px;
}
.sd-product-name { font-weight: 600; color: var(--c-text); }
.sd-product-unit {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-soft);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border-soft);
    border-radius: var(--r-full);
}
.sd-product-price {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 500;
    color: var(--c-text-soft);
    font-variant-numeric: tabular-nums;
}
.sd-product-qty {
    display: inline-block;
    font-weight: 700;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
}
.sd-product-amount {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 700;
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}

/* ============================================================
   21. 详情页 - 状态徽章
   ============================================================ */
.sd-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--r-full);
    white-space: nowrap;
    line-height: 1.4;
    border: 1px solid transparent;
}
.sd-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}
.sd-badge.is-pending { color: var(--c-text-soft); background: #f1f5f9; border-color: #e2e8f0; }
.sd-badge.is-warning { color: var(--c-warning-fg); background: var(--c-warning-bg); border-color: #fde68a; }
.sd-badge.is-danger  { color: var(--c-danger-fg);  background: var(--c-danger-bg);  border-color: #fecaca; }
.sd-badge.is-success { color: var(--c-success-fg); background: var(--c-success-bg); border-color: #a7f3d0; }
.sd-badge.is-info    { color: var(--c-info-fg);    background: var(--c-info-bg);    border-color: #bae6fd; }

/* ============================================================
   22. 详情页 - 信息网格
   ============================================================ */
.sd-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    column-gap: 28px;
}
.sd-info-item {
    min-width: 0;
    padding: 18px 0;
    position: relative;
}
.sd-info-item::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--c-border-soft) 8%,
        var(--c-border-soft) 92%,
        transparent 100%);
    pointer-events: none;
}
.sd-info-item.is-last-row::after { display: none; }

@media (max-width: 1200px) { .sd-info-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .sd-info-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .sd-info-grid { grid-template-columns: 1fr; } }

.sd-info-item-full { grid-column: 1 / -1; }

.sd-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.sd-value {
    display: block;
    font-size: 14.5px;
    color: var(--c-text);
    font-weight: 500;
    word-break: break-word;
    line-height: 1.5;
}
.sd-value.is-mono {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.sd-value.is-highlight { color: var(--c-primary); font-weight: 700; }
.sd-value.is-success { color: var(--c-success); font-weight: 700; }
.sd-value-muted {
    color: var(--c-text-light);
    font-weight: 400;
    font-style: italic;
    font-size: 13.5px;
}
.sd-relation-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--c-border);
    font-size: 12.5px;
    color: var(--c-text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}
.sd-relation-info .sd-relation-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border-radius: var(--r-full);
}

/* ============================================================
   23. 详情页 - 状态时间线
   ============================================================ */
.sd-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-top: 28px;
    padding: 24px;
    background: linear-gradient(135deg, var(--sf-blue-25) 0%, var(--sf-blue-50) 100%);
    border: 1px solid var(--c-border-soft);
    border-radius: var(--r-lg);
}
.sd-timeline-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    text-align: center;
}
.sd-timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 22px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--c-border);
    z-index: 0;
}
.sd-timeline-step.is-done:not(:last-child)::after {
    background: linear-gradient(90deg, var(--c-success) 0%, var(--c-success) 100%);
}
.sd-timeline-dot {
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-surface);
    border: 2px solid var(--c-border);
    font-size: 14px;
    color: var(--c-text-muted);
    font-weight: 700;
    transition: all var(--t-base);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.sd-timeline-step.is-done .sd-timeline-dot {
    background: linear-gradient(135deg, var(--c-success) 0%, #34d399 100%);
    border-color: var(--c-success);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
}
.sd-timeline-step.is-active .sd-timeline-dot {
    background: linear-gradient(135deg, var(--c-primary) 0%, #6366f1 100%);
    border-color: var(--c-primary);
    color: #fff;
    box-shadow: 0 4px 16px var(--c-primary-glow);
    animation: sdPulse 2s ease-in-out infinite;
}
@keyframes sdPulse {
    0%, 100% { box-shadow: 0 4px 16px var(--c-primary-glow); }
    50%      { box-shadow: 0 4px 24px rgba(79, 70, 229, 0.45); }
}
.sd-timeline-label {
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-soft);
    letter-spacing: -0.005em;
}
.sd-timeline-step.is-done .sd-timeline-label { color: var(--c-success-fg); }
.sd-timeline-step.is-active .sd-timeline-label { color: var(--c-primary); }
.sd-timeline-date {
    margin-top: 4px;
    font-size: 12px;
    color: var(--c-text-muted);
    font-family: 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
    .sd-timeline { flex-direction: column; align-items: stretch; gap: 18px; padding: 18px; }
    .sd-timeline-step:not(:last-child)::after { display: none; }
    .sd-timeline-step { flex-direction: row; align-items: center; gap: 14px; text-align: left; }
    .sd-timeline-label, .sd-timeline-date { margin-top: 0; }
    .sd-timeline-label { flex: 1; }
}

/* ============================================================
   24. 详情页 - 复制按钮
   ============================================================ */
.sd-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 8px;
    margin-left: 8px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    transition: all var(--t-fast);
    vertical-align: middle;
    flex-shrink: 0;
    font-family: inherit;
}
.sd-copy-btn:hover {
    color: var(--c-primary);
    border-color: var(--c-primary-soft);
    background: var(--c-primary-light);
}
.sd-copy-btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.sd-copy-btn.is-copied {
    color: #fff;
    background: var(--c-success);
    border-color: var(--c-success);
}

@keyframes sdToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   25. 打印适配
   ============================================================ */
@page {
    size: A4;
    margin: 10mm;
}

@media print {
    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 11px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .clean-topbar,
    .clean-header,
    .clean-layout > header,
    .clean-layout > nav,
    .clean-layout > footer,
    header.topbar, nav.topbar, .navbar,
    .sidebar, .side-nav, .top-nav,
    #header, #footer, #nav,
    .main-header, .page-header {
        display: none !important;
    }

    .sd-action-bar,
    .sd-copy-btn,
    .sd-no-print,
    .no-print {
        display: none !important;
    }

    .sd-container {
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 11px !important;
        min-height: auto !important;
    }

    .sd-card {
        box-shadow: none !important;
        border: 1px solid #d0d5dd !important;
        border-radius: 6px !important;
        margin-bottom: 8px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .sd-card-header {
        background: #f5f7fd !important;
        padding: 8px 12px !important;
        page-break-after: avoid;
    }
    .sd-card-title { font-size: 12px !important; }
    .sd-card-body { padding: 12px !important; }

    .sd-stats-row {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }
    .sd-stat-box {
        padding: 8px 10px !important;
        min-height: auto !important;
        border-radius: 6px !important;
        page-break-inside: avoid;
    }
    .sd-stat-label { font-size: 10px !important; margin-bottom: 2px !important; }
    .sd-stat-value { font-size: 13px !important; }
    .sd-stat-value.is-text { font-size: 11px !important; }

    .sd-table-wrapper { border: 1px solid #d0d5dd !important; border-radius: 4px !important; }
    .sd-product-table { font-size: 10.5px !important; min-width: 0 !important; }
    .sd-product-table thead th {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        padding: 6px 8px !important;
        font-size: 10px !important;
    }
    .sd-product-table tbody td {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    .sd-product-table tfoot td {
        padding: 6px 8px !important;
        font-size: 11.5px !important;
        background: #f8fafc !important;
    }
    .sd-product-index { width: 20px; height: 20px; font-size: 10px; }
    .sd-product-unit { padding: 1px 6px !important; font-size: 10px !important; }

    .sd-section-title { font-size: 12px !important; margin-bottom: 8px !important; }
    .sd-section-title::before { height: 14px !important; }
    .sd-divider { margin: 12px 0 !important; }

    .sd-info-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        column-gap: 12px !important;
        row-gap: 0 !important;
    }
    .sd-info-item {
        padding: 6px 0 !important;
        page-break-inside: avoid;
    }
    .sd-info-item.is-last-row::after { display: block !important; }
    .sd-info-item::after { background: #e8edf4 !important; }
    .sd-label { font-size: 9.5px !important; margin-bottom: 2px !important; }
    .sd-value { font-size: 11px !important; }
    .sd-relation-info { margin-top: 2px !important; padding-top: 2px !important; font-size: 10px !important; }

    .sd-badge { padding: 2px 8px !important; font-size: 10px !important; }

    .sd-timeline {
        padding: 10px 12px !important;
        margin-top: 12px !important;
        background: #fafbff !important;
        border: 1px solid #e8edf4 !important;
        page-break-inside: avoid;
    }
    .sd-timeline-dot { width: 30px !important; height: 30px !important; font-size: 11px !important; }
    .sd-timeline-label { margin-top: 4px !important; font-size: 10.5px !important; }
    .sd-timeline-date { font-size: 9.5px !important; }
    .sd-timeline-step:not(:last-child)::after { top: 15px !important; }

    .sd-card,
    .sd-timeline,
    .sd-info-grid,
    .sd-table-wrapper {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    a { color: var(--c-primary) !important; text-decoration: none !important; }
}