/* 全局以柔白、石墨和中性灰建立层级；彩色仅用于明确的业务状态。 */
:root {
    color-scheme: light;
    --canvas: #f7f7f5;
    --fill-primary: #fdfdfc;
    --fill-secondary: #f0f0ee;
    --fill-tertiary: #e7e7e4;
    --fill-quaternary: #dcdcd9;
    --glyph-primary: #242426;
    --glyph-secondary: #68686b;
    --glyph-tertiary: #68686b;
    --action-text: #303032;
    --action-fill: #29292b;
    --action-on-fill: #fafaf8;
    --border-primary: #cececb;
    --border-subtle: #e2e2df;
    --semantic-green: #008009;
    --semantic-red: #c90000;
    --semantic-orange: #c45b00;
    --sidebar-bg: #202022;
    --sidebar-border: #343436;
    --sidebar-text: #f2f2ef;
    --sidebar-text-muted: #b0b0ad;
    --sidebar-active-bg: #38383a;
    --sidebar-active-border: #e6e6e3;
    --brand-accent: var(--action-text);
    --brand-accent-soft: #e7e7e4;
    --brand-accent-strong: #242426;
    --success-soft: #e8f4eb;
    --success-strong: #24713b;
    --overlay-scrim: rgba(20, 20, 24, 0.32);
    --info-soft: #ededeb;
    --info-strong: #505053;
    --danger-soft: #fff0f2;
    --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-tab: 0 1px 4px rgba(31, 41, 55, 0.12);
    --focus-ring: #68686b;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2368686b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7.5 5 5 5-5'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --canvas: #1b1b1c;
        --fill-primary: #242426;
        --fill-secondary: #2d2d2f;
        --fill-tertiary: #38383a;
        --fill-quaternary: #454547;
        --glyph-primary: #f2f2ef;
        --glyph-secondary: #b0b0ad;
        --glyph-tertiary: #a1a19f;
        --action-text: #e6e6e3;
        --action-fill: #e6e6e3;
        --action-on-fill: #242426;
        --border-primary: #4c4c4e;
        --border-subtle: #3b3b3d;
        --semantic-green: #30d158;
        --semantic-red: #ff453a;
        --semantic-orange: #ff9f0a;
        --sidebar-bg: #202022;
        --sidebar-border: #343436;
        --sidebar-text: #f2f2ef;
        --sidebar-text-muted: #b0b0ad;
        --sidebar-active-bg: #38383a;
        --sidebar-active-border: #e6e6e3;
        --brand-accent: #e6e6e3;
        --brand-accent-soft: #38383a;
        --brand-accent-strong: #f2f2ef;
        --success-soft: #213c2a;
        --success-strong: #82d49a;
        --overlay-scrim: rgba(0, 0, 0, 0.52);
        --info-soft: #303032;
        --info-strong: #d3d3d0;
        --danger-soft: #4a2228;
        --shadow-panel: none;
        --shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.4);
        --shadow-tab: none;
        --focus-ring: #a1a19f;
        --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23b0b0ad' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7.5 5 5 5-5'/%3E%3C/svg%3E");
    }
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: clip;
    background: var(--canvas);
    color: var(--glyph-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

button,
select,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.template-download-button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

/* 地址片段不会传给服务端；首屏恢复完成前不绘制默认首页，避免刷新业务页时闪屏。 */
html[data-workspace-restoring] .app-shell {
    visibility: hidden;
}

.app-shell {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 100vh;
}

/* 工作台是独立入口，不为侧栏或手机顶栏预留空位。 */
.app-shell[data-active-view="home"] {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 0;
}

.app-shell[data-active-view="home"] .app-main {
    grid-column: 1;
}

/* 业务页窄栏占 64px；展开的菜单覆盖内容，不改变表格宽度和滚动位置。 */
.app-sidebar {
    --focus-ring: var(--sidebar-text);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 64px 256px;
    width: 64px;
    height: 100vh;
    height: 100dvh;
    /* 外层只负责命中区域，背景随面板滑动，避免展开宽度改变时先闪出整块深色。 */
    background: transparent;
    color: var(--sidebar-text);
    color-scheme: dark;
}

.app-shell[data-sidebar-expanded="true"] .app-sidebar {
    width: 320px;
}

.sidebar-rail {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 0;
    padding: 20px 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-rail-button {
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sidebar-text);
    cursor: pointer;
    text-decoration: none;
}

.sidebar-rail-button:hover,
.sidebar-rail-button[aria-expanded="true"] {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
}

.sidebar-rail-button:focus-visible {
    outline: 2px solid var(--sidebar-text);
    outline-offset: 2px;
}

/* 首页标志与导航齿轮共享尺寸和中心线，保留 44px 点击区域。 */
.sidebar-rail-icon {
    display: block;
    width: 28px;
    height: 28px;
    fill: currentColor;
    stroke: none;
}

.sidebar-gear-spokes {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    opacity: 0.7;
}

.sidebar-account-toggle {
    margin-top: auto;
}

.sidebar-panel {
    position: absolute;
    inset: 0 auto 0 64px;
    display: flex;
    flex-direction: column;
    width: 256px;
    min-height: 0;
    padding: 24px 16px 16px;
    overflow: hidden;
    background: var(--sidebar-bg);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.16);
    scrollbar-color: var(--sidebar-active-bg) var(--sidebar-bg);
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 160ms ease-out, visibility 0s linear 240ms;
}

/* 面板常驻以便动画中途反向；不可见时由 inert 隔离交互，收起结束后才隐藏绘制。 */
.app-shell[data-sidebar-expanded="true"] .sidebar-panel {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-duration: 360ms, 200ms, 0s;
    transition-delay: 0s;
}

.sidebar-brand {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    min-height: 48px;
    padding: 0 12px;
}

.brand-name,
.brand-caption {
    display: block;
}

.brand-name {
    font-size: 20px;
    font-weight: 600;
    line-height: 24px;
}

.brand-caption {
    margin-top: 4px;
    color: var(--sidebar-text-muted);
    font-size: 12px;
    line-height: 16px;
}

.sidebar-nav {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    /* 菜单单独滚动，四周留出焦点轮廓，账号与环境信息始终保留在底部。 */
    margin: 20px -6px;
    padding: 4px 6px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
}

.sidebar-menu-group {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    gap: 2px;
}

.sidebar-group-title {
    margin: 0 0 6px;
    padding: 0 12px;
    color: var(--sidebar-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background-color 160ms ease, color 160ms ease;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.is-active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
}

.sidebar-nav-item.is-active {
    font-weight: 600;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    border: 0;
    background: transparent;
    cursor: default;
}

/* 窄屏改为 56px 顶栏，菜单在其下展开；背景焦点与滚动由 sidebar.js 管理。 */
@media (max-width: 900px) {
    .app-shell {
        display: block;
        padding-top: 56px;
    }
    .app-sidebar,
    .app-shell[data-sidebar-expanded="true"] .app-sidebar {
        display: block;
        width: 100%;
        height: 56px;
        box-shadow: none;
    }
    .sidebar-rail {
        flex-direction: row;
        gap: 8px;
        height: 56px;
        padding: 6px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--sidebar-border);
    }
    .sidebar-account-toggle {
        margin-top: 0;
        margin-left: auto;
    }
    .sidebar-panel {
        inset: 56px auto auto 0;
        width: min(320px, calc(100vw - 24px));
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        background: var(--sidebar-bg);
        box-shadow: 8px 8px 28px rgba(0, 0, 0, 0.16);
    }
    .sidebar-backdrop {
        top: 56px;
        background: var(--overlay-scrim);
    }
    .sidebar-scroll-locked {
        overflow: hidden;
    }
}

/* 横屏或低矮窗口收紧留白，为菜单保留可滚动空间，不缩小账号操作按钮。 */
@media (max-height: 500px) {
    .sidebar-panel {
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .sidebar-nav {
        margin-top: 4px;
        margin-bottom: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-panel {
        transform: none;
        transition: opacity 100ms ease-out, visibility 0s linear 100ms;
        transition-duration: 100ms, 0s !important;
    }
    .app-shell[data-sidebar-expanded="true"] .sidebar-panel {
        transition-duration: 100ms, 0s !important;
        transition-delay: 0s;
    }
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
}

.sidebar-footer {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-top: auto;
    padding: 0 12px;
    border-top: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-muted);
    font-size: 11px;
}

.environment-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sidebar-text-muted);
}

.app-main {
    grid-column: 2;
    min-width: 0;
    background: var(--canvas);
}

.workspace-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 88px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--fill-primary) 92%, transparent);
    backdrop-filter: blur(18px);
}

.workspace-breadcrumb,
.workspace-title,
.section-kicker,
.page-intro h2,
.page-intro p,
.product-summary h3,
.product-summary p,
.panel-heading h3,
.panel-heading h4,
.panel-eyebrow,
.empty-workspace h5,
.empty-workspace p {
    margin: 0;
}

.workspace-breadcrumb {
    color: var(--glyph-secondary);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
}

.workspace-title {
    margin-top: 3px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 29px;
}

.workspace-context {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    font-size: 12px;
}

.context-label {
    color: var(--glyph-secondary);
}

.workspace-context strong {
    color: var(--semantic-green);
    font-weight: 600;
}

.workspace-content {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 28px 36px 48px;
}

.workspace-view {
    animation: view-enter 180ms ease-out;
}

@keyframes view-enter {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.page-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.page-intro > div,
.product-summary-copy,
.workspace-panel {
    min-width: 0;
}

.section-kicker,
.panel-eyebrow {
    color: var(--glyph-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    line-height: 16px;
    text-transform: uppercase;
}

.page-intro h2 {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 34px;
}

.page-intro p:last-child {
    max-width: 660px;
    margin-top: 6px;
    color: var(--glyph-secondary);
    font-size: 14px;
    line-height: 20px;
}

.view-status,
.product-badge,
.row-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.view-status {
    gap: 7px;
    border: 1px solid color-mix(in srgb, var(--semantic-green) 24%, transparent);
    background: var(--success-soft);
    color: var(--success-strong);
}

.view-status > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--semantic-green);
}

.product-tabs {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 32px;
    padding: 3px;
    border-radius: 10px;
    background: var(--fill-tertiary);
}

.product-tab {
    min-width: 112px;
    min-height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--glyph-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.product-tab:hover {
    color: var(--glyph-primary);
}

.product-tab.is-active {
    background: var(--fill-primary);
    box-shadow: var(--shadow-tab);
    color: var(--glyph-primary);
    font-weight: 600;
}

.product-panel {
    animation: view-enter 180ms ease-out;
}

.product-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 0;
    padding: 0 0 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
}

.product-summary-iphone {
    background: transparent;
}

.product-symbol {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.4px;
}

.product-summary-copy h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.product-summary-copy > p:last-child {
    margin-top: 4px;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.sales-input-window-status,
.sales-input-window-countdown {
    color: var(--glyph-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.sales-input-window-status.is-open,
.sales-input-window-countdown.is-open {
    color: var(--semantic-green);
}

.sales-input-window-status.is-closed,
.sales-input-window-countdown.is-closed {
    color: var(--semantic-red);
}

.product-badge {
    border: 1px solid color-mix(in srgb, var(--action-text) 18%, transparent);
    background: var(--fill-primary);
    color: var(--action-text);
}

.product-summary-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.friday-input-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.sales-input-admin-actions {
    display: grid;
    gap: 8px;
    padding: 0 20px;
}

.sales-input-admin-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.sales-input-admin-actions p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.sales-input-admin-actions p:empty {
    display: none;
}

.template-download-button,
.compliance-upload-open-button,
.manual-entry-open-button,
.current-download-button,
.friday-sync-button,
.upload-result-open-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    color: var(--action-text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease;
}

.template-download-button:hover,
.compliance-upload-open-button:hover,
.manual-entry-open-button:hover,
.current-download-button:hover,
.friday-sync-button:hover,
.upload-result-open-button:hover {
    border-color: var(--action-fill);
    background: color-mix(in srgb, var(--action-fill) 7%, var(--fill-primary));
}

.compliance-upload-open-button:disabled,
.manual-entry-open-button:disabled,
.current-download-button:disabled,
.friday-sync-button:disabled,
.upload-result-open-button:disabled {
    cursor: not-allowed;
    filter: saturate(0.45);
    opacity: 0.58;
}

.template-download-button svg,
.compliance-upload-open-button svg,
.manual-entry-open-button svg,
.current-download-button svg,
.friday-sync-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.75;
}

.selection-refresh-button {
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--action-text);
    border-radius: 0.75rem;
    background: var(--fill-primary);
    color: var(--action-text);
    font-weight: 700;
}

.selection-refresh-button:hover {
    background: var(--fill-secondary);
}

.selection-refresh-button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.selection-refresh-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.selection-dashboard {
    margin-top: 1.5rem;
}

.selection-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.selection-kpi-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.5rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
}

.selection-kpi-grid strong {
    color: var(--glyph-primary);
    font-size: 1.6rem;
    font-variant-numeric: tabular-nums;
}

.selection-table-wrap {
    max-height: 34rem;
}

.selection-table th,
.selection-table td {
    min-width: 8rem;
    vertical-align: middle;
}

.selection-table .selection-checkbox-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 3.75rem;
    width: 3.75rem;
    background: var(--fill-primary);
    text-align: center;
}

.selection-table thead .selection-checkbox-cell {
    z-index: 4;
    background: var(--fill-secondary);
}

.selection-table tr.is-invalid-row .selection-checkbox-cell {
    background: var(--danger-soft);
}

.selection-checkbox-cell input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--action-text);
}

.selection-cell-input {
    width: 100%;
    min-width: 8.5rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-primary);
    border-radius: 0.55rem;
    background: var(--fill-primary);
    color: var(--glyph-primary);
}

.selection-cell-input:focus {
    border-color: var(--action-text);
    outline: 3px solid var(--focus-ring);
}

.selection-cell-input.is-invalid {
    border-color: var(--semantic-red);
    background: var(--danger-soft);
}

.selection-order-select {
    min-width: 10rem;
}

.selection-submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--fill-primary) 96%, transparent);
    backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
    .selection-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.upload-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--action-fill);
    color: var(--action-on-fill);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    transition: filter 160ms ease;
}

.upload-control:hover {
    filter: brightness(0.94);
}

.upload-control.is-uploading {
    cursor: wait;
    filter: saturate(0.72);
    opacity: 0.78;
}

.upload-control.is-disabled {
    cursor: not-allowed;
    filter: saturate(0.45);
    opacity: 0.58;
}

.upload-control:focus-within {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.upload-control svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.75;
}

.upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.sales-upload-dashboard {
    margin-top: 24px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--fill-primary);
}

.upload-dashboard-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 68px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--fill-secondary) 60%, var(--fill-primary));
}

.upload-dashboard-heading h3,
.upload-dashboard-heading h4 {
    margin: 2px 0 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.upload-result-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.upload-result-status.is-success {
    background: var(--success-soft);
    color: var(--success-strong);
}

.upload-result-status.is-error {
    background: var(--danger-soft);
    color: var(--semantic-red);
}

.upload-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.upload-kpi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--fill-secondary);
    color: var(--glyph-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.upload-kpi:hover {
    background: color-mix(in srgb, var(--action-fill) 5%, var(--fill-secondary));
}

.upload-kpi.is-active {
    border-color: color-mix(in srgb, var(--action-fill) 42%, transparent);
    background: color-mix(in srgb, var(--action-fill) 8%, var(--fill-secondary));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--action-fill) 8%, transparent);
}

.upload-kpi:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.upload-kpi span {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.upload-kpi strong {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.upload-kpi-success strong {
    color: var(--semantic-green);
}

.upload-kpi-error strong {
    color: var(--semantic-red);
}

.upload-result-message {
    margin: 0;
    padding: 0 16px 16px;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.upload-result-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 0 16px 16px;
}

.upload-result-toolbar .upload-result-message {
    flex: 1 1 320px;
    padding: 0;
}

.upload-batch-delete-button {
    min-width: 96px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid color-mix(in srgb, var(--semantic-red) 42%, transparent);
    border-radius: 9px;
    background: var(--danger-soft);
    color: var(--semantic-red);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: filter 150ms ease, border-color 150ms ease;
}

.upload-batch-delete-button:hover {
    border-color: var(--semantic-red);
    filter: brightness(0.96);
}

.upload-batch-delete-button:disabled {
    cursor: default;
    opacity: 0.5;
}

.upload-filter-panel {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: color-mix(in srgb, var(--fill-secondary) 56%, var(--fill-primary));
}

.upload-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.upload-filter-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.upload-filter-field > span {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.upload-filter-field input,
.upload-filter-field select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font-size: 16px;
    line-height: 20px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.upload-filter-field input::placeholder {
    color: var(--glyph-tertiary);
}

.upload-filter-field input:focus,
.upload-filter-field select:focus {
    border-color: var(--action-text);
}

.upload-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.upload-filter-footer p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.upload-filter-reset-button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 150ms ease, border-color 150ms ease;
}

.upload-filter-reset-button:hover {
    border-color: var(--action-text);
    background: var(--fill-secondary);
}

/* 消息列表与详情沿用工作台令牌；长表仅在自身滚动，正文允许完整换行。 */
.message-notice-view .page-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.message-notice-view button { min-height: 44px; }
.message-notice-view .message-notice-panel { box-shadow: none; }
.message-notice-status { margin: 0; padding: 16px 20px; color: var(--glyph-secondary); font-size: 13px; }
.message-notice-status:empty { display: none; }
.message-notice-status.is-error { color: var(--semantic-red); }
.message-notice-empty { padding: 64px 24px; text-align: center; }
.message-notice-empty h3 { margin: 0 0 12px; font-size: 20px; }
.message-notice-empty p { margin: 0; color: var(--glyph-secondary); font-size: 14px; }
.message-notice-table { min-width: 760px; }
.message-notice-table th:first-child { width: 42%; }
.message-notice-view .message-notice-table td:first-child { min-width: 240px; white-space: normal; }
.message-notice-view .message-notice-table td { vertical-align: middle; font-variant-numeric: tabular-nums; }
.message-notice-title-button {
    display: block; width: 100%; padding: 4px 0; border: 0; background: transparent;
    color: var(--action-text); font: inherit; font-size: 14px; font-weight: 600;
    line-height: 1.5; text-align: left; overflow-wrap: anywhere; cursor: pointer;
    text-decoration: underline; text-decoration-color: var(--border-primary); text-underline-offset: 4px;
}
.message-notice-title-button:hover { text-decoration-color: currentColor; }
.message-notice-view .message-notice-pagination { padding: 12px 20px; flex-wrap: wrap; gap: 12px; }
.message-notice-dialog.upload-result-dialog { width: min(calc(100% - 32px), 880px); color: var(--glyph-primary); }
.message-notice-dialog button { min-height: 44px; }
.message-notice-dialog .dialog-close-button { flex: 0 0 44px; }
.message-notice-detail-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.message-notice-dialog .upload-result-dialog-body { max-height: 70dvh; overflow-y: auto; overscroll-behavior: contain; }
.message-notice-dialog .upload-result-dialog-heading > div { min-width: 0; }
.message-notice-dialog h2, .message-notice-dialog p { overflow-wrap: anywhere; }
.message-notice-dialog .message-notice-status { padding: 0 0 16px; }
.message-notice-dialog [data-notice-read-retry] { margin-bottom: 16px; }
.message-notice-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.7; }
.message-notice-dialog iframe { display: block; width: 100%; height: min(60vh, 560px); border: 0; }
/* 提醒固定在业务界面上方，叠页只表示消息数量，实际切换使用可聚焦的分页按钮。 */
.message-notice-stack {
    position: fixed; z-index: 20; right: 24px; bottom: 32px; width: min(360px, calc(100vw - 32px));
    color: var(--glyph-primary); isolation: isolate; font-size: 14px;
}
/* 只在由隐藏变为显示时缓缓浮入；轮询更新正文和翻页不重播整张卡片的入场。 */
.message-notice-stack:not([hidden]) {
    animation: notice-stack-enter 1000ms cubic-bezier(0.22, 0.75, 0.25, 1);
}
@keyframes notice-stack-enter {
    from { opacity: 0; transform: translateY(calc(100% + max(40px, env(safe-area-inset-bottom)))); }
    to { opacity: 1; transform: translateY(0); }
}
.message-notice-stack::before, .message-notice-stack::after {
    content: ""; position: absolute; inset: 0; z-index: -1; border: 1px solid var(--border-primary);
    border-radius: 12px; background: var(--fill-secondary); opacity: 0; pointer-events: none;
}
.message-notice-stack.has-many::before { transform: translateY(7px) scaleX(0.96); opacity: 1; }
.message-notice-stack.has-more::after { z-index: -2; transform: translateY(14px) scaleX(0.92); opacity: 1; }
.message-notice-stack-card {
    border: 1px solid var(--border-primary); border-radius: 12px; background: var(--fill-primary);
    box-shadow: 0 8px 30px color-mix(in srgb, var(--glyph-primary) 14%, transparent); overflow: hidden;
}
.message-notice-stack-heading {
    display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 0;
    color: var(--glyph-secondary); font-size: 12px;
}
.message-notice-stack-open {
    display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 12px 18px 16px;
    border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.message-notice-stack-open:hover { background: var(--fill-secondary); }
.message-notice-stack-open:focus-visible { outline-offset: -4px; }
.message-notice-stack-title, .message-notice-stack-preview {
    display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.message-notice-stack-title { -webkit-line-clamp: 2; font-size: 17px; line-height: 24px; font-weight: 600; }
.message-notice-stack-preview { -webkit-line-clamp: 3; color: var(--glyph-secondary); line-height: 1.5; }
.message-notice-stack-meta { color: var(--glyph-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.message-notice-stack-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--action-text); }
.message-notice-stack svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.message-notice-stack-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border-subtle); }
.message-notice-stack-pager .secondary-button { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; }
.message-notice-stack-pager > span { font-size: 12px; color: var(--glyph-secondary); font-variant-numeric: tabular-nums; }
.message-notice-stack-status { margin: 0; padding: 0 18px 12px; color: var(--glyph-secondary); font-size: 12px; }
.message-notice-stack-open.is-turning { animation: notice-page-turn 160ms ease-out; }
@keyframes notice-page-turn { from { opacity: 0.65; transform: translateX(6px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
    .message-notice-stack:not([hidden]), .message-notice-stack-open.is-turning { animation: none; }
}
@media (max-width: 640px) {
    .message-notice-view .page-intro { align-items: flex-start; flex-direction: column; }
    .message-notice-status { padding: 16px; }
    .message-notice-view .message-notice-pagination { padding: 12px 16px; }
    .message-notice-stack { right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); }
    .message-notice-stack-preview { -webkit-line-clamp: 2; }
    .message-notice-stack-open { padding-block: 10px 12px; gap: 8px; }
}

/* 消息编写复用工作台表格与原生弹窗，编辑配置与收件人预览保持清晰分区。 */
.message-management-view .page-intro { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.message-management-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.message-management-view button { min-height: 44px; }
.message-management-panel { box-shadow: none; }
.message-management-panel .sales-upload-table-wrap { overflow-x: auto; }
.message-management-table { min-width: 1100px; }
.message-management-table th:first-child,
.message-management-table td:first-child { width: 220px; min-width: 220px; max-width: 220px; white-space: normal; }
.message-management-table .message-management-reseller { min-width: 220px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.message-management-view .message-management-read-badge {
    display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px;
    border: 1px solid var(--border-subtle); border-radius: 8px;
    background: var(--fill-secondary); color: var(--glyph-secondary); white-space: nowrap;
}
.message-management-read-badge[data-read-state="unread"] { background: var(--fill-tertiary); color: var(--glyph-primary); }
.message-management-view [data-management-detail-meta] { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.message-management-panel .message-notice-pagination { padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.message-management-feedback { padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--fill-secondary); font-size: 14px; }
.message-management-dialog.upload-result-dialog { width: min(calc(100% - 32px), 1120px); color: var(--glyph-primary); }
.message-management-dialog .dialog-close-button { flex: 0 0 44px; }
.message-management-dialog .upload-result-dialog-heading > div { min-width: 0; }
.message-management-dialog p { overflow-wrap: anywhere; }
.message-management-compose { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 28px; }
.message-management-editor, .message-management-preview { min-width: 0; }
.message-management-fields, .message-management-columns { min-width: 0; border: 0; padding: 0; margin: 0; }
.message-management-fields { display: grid; gap: 16px; }
.message-management-fields > legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.message-management-fields label, .message-management-recipient { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; color: var(--glyph-primary); }
.message-management-fields input, .message-management-fields select, .message-management-fields textarea,
.message-management-columns input[type="text"], .message-management-recipient select {
    width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-primary);
    border-radius: 9px; background: var(--fill-primary); color: var(--glyph-primary); font: inherit; font-size: 16px;
}
.message-management-fields input[type="file"] { font-size: 13px; padding: 10px; }
.message-management-fields input::file-selector-button { color: var(--action-text); background: var(--fill-secondary); border: 1px solid var(--border-primary); border-radius: 7px; padding: 4px 8px; margin-right: 8px; }
.message-management-fields textarea { resize: vertical; line-height: 1.5; }
.message-management-fields textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.message-management-fields ::placeholder { color: var(--glyph-tertiary); opacity: 1; }
.message-management-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.message-management-help { margin: 0; color: var(--glyph-secondary); font-size: 12px; line-height: 1.6; }
.message-management-help:empty { display: none; }
.message-management-help.is-error { color: var(--semantic-red); }
.message-management-upload { display: grid; gap: 12px; border-top: 1px solid var(--border-subtle); padding-top: 20px; }
.message-management-upload > button { justify-self: start; }
.message-management-upload-summary { font-size: 13px; margin: 16px 0; color: var(--glyph-secondary); }
.message-management-upload-summary:empty { display: none; }
.message-management-columns { margin-top: 24px; }
.message-management-columns legend { margin-bottom: 8px; padding: 0; font-size: 17px; font-weight: 600; }
.message-management-columns > .message-management-actions { margin: 12px 0; }
.message-management-column-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.message-management-column { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 6px 2px; }
.message-management-column label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; overflow-wrap: anywhere; }
.message-management-column input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--action-fill); }
.message-management-column input[type="text"]:disabled { color: var(--glyph-secondary); background: var(--fill-secondary); }
.message-management-dealer-list { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.message-management-dealer-list label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 0; font-size: 13px; line-height: 1.5; cursor: pointer; }
.message-management-dealer-list span { min-width: 0; overflow-wrap: anywhere; }
.message-management-dealer-list input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--action-fill); }
.message-management-preview { position: sticky; top: 0; align-self: start; border-left: 1px solid var(--border-subtle); padding-left: 28px; }
.message-management-preview h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.message-management-preview-hint { margin: 16px 0; color: var(--glyph-secondary); font-size: 13px; line-height: 1.6; }
.message-management-preview-content { margin-top: 20px; max-height: min(500px, calc(92vh - 325px)); overflow: auto; overscroll-behavior: contain; }
.message-management-preview-content iframe { display: block; width: 100%; height: 440px; border: 0; }
.message-management-footer { padding: 16px; display: flex; justify-content: space-between; gap: 16px; align-items: center; border-top: 1px solid var(--border-subtle); }
.message-management-compose-feedback { min-width: 0; flex: 1; }
.message-management-compose-feedback > p { margin: 0; font-size: 13px; color: var(--glyph-secondary); }
.message-management-compose-feedback > p.is-error { color: var(--semantic-red); }
.message-management-compose-feedback > button { margin-top: 8px; }
.message-management-errors { margin: 16px 0; padding: 16px; border-radius: 12px; border: 1px solid var(--semantic-red); background: var(--danger-soft); color: var(--glyph-primary); font-size: 13px; line-height: 1.6; scroll-margin-block: 16px; }
.message-management-errors:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.message-management-errors h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--glyph-primary); }
.message-management-errors p { margin: 0 0 12px; }
.message-management-errors ul { padding: 0; margin: 0; list-style: none; }
.message-management-errors li { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-primary); }
.message-management-errors li strong { font-variant-numeric: tabular-nums; }
.message-management-errors li span { overflow-wrap: anywhere; }
.message-management-errors > button { margin-top: 12px; white-space: normal; }
@media (max-width: 760px) {
    .message-management-view .page-intro { flex-direction: column; align-items: flex-start; }
    .message-management-compose { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .message-management-preview { position: static; border-left: 0; padding-left: 0; border-top: 1px solid var(--border-subtle); padding-top: 20px; }
    .message-management-preview-content { max-height: 500px; }
    .message-management-preview-content iframe { height: 360px; }
    .message-management-footer { align-items: stretch; flex-direction: column; gap: 12px; }
    .message-management-footer .message-management-actions { justify-content: flex-end; }
}

.sales-upload-table-wrap {
    max-height: 520px;
    overflow: auto;
    border-top: 1px solid var(--border-subtle);
    scrollbar-color: var(--glyph-tertiary) transparent;
}

.sales-upload-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--glyph-primary);
    font-size: 12px;
}

.sales-upload-table th,
.sales-upload-table td {
    max-width: 260px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--fill-primary);
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    vertical-align: top;
    white-space: nowrap;
}

.sales-upload-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 11px;
    font-weight: 600;
}

.sales-upload-table tbody tr:hover td {
    background: var(--fill-secondary);
}

.sales-upload-table tbody tr.allocation-po-gap-row td {
    background: color-mix(in srgb, var(--semantic-red) 9%, var(--fill-primary));
    color: var(--semantic-red);
    font-weight: 500;
}

.sales-upload-table tbody tr.allocation-po-gap-row:hover td {
    background: color-mix(in srgb, var(--semantic-red) 14%, var(--fill-primary));
}

.sales-upload-table tbody tr.allocation-po-gap-row td:first-child {
    box-shadow: inset 3px 0 0 var(--semantic-red);
}

.sales-upload-table .allocation-po-gap-cell {
    font-weight: 600;
}

/* PO Gap 左侧身份列与右侧操作栏固定；复用行背景保留红色提示和悬停状态。 */
[data-allocation-template] .sales-upload-table th {
    z-index: 3;
}

[data-allocation-template] .sales-upload-table .po-gap-frozen-column {
    position: sticky;
    left: var(--po-gap-frozen-left);
    z-index: 2;
}

[data-allocation-template] .sales-upload-table th.po-gap-frozen-column,
[data-allocation-template] .sales-upload-table th.po-gap-frozen-action {
    z-index: 4;
}

[data-allocation-template] .sales-upload-table .po-gap-frozen-last {
    box-shadow: 1px 0 0 var(--border-subtle), 4px 0 6px rgb(0 0 0 / 6%);
}

[data-allocation-template] .sales-upload-table .po-gap-frozen-action {
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -1px 0 0 var(--border-subtle), -4px 0 6px rgb(0 0 0 / 6%);
}

.allocation-gap-action-button,
.po-gap-customer-remove-button,
.po-gap-customer-save-button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--semantic-red) 42%, transparent);
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--semantic-red);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
}

.allocation-gap-action-button:hover,
.po-gap-customer-remove-button:hover,
.po-gap-customer-save-button:hover {
    border-color: var(--semantic-red);
    filter: brightness(0.96);
}

.allocation-gap-action-button:disabled,
.po-gap-customer-remove-button:disabled,
.po-gap-customer-save-button:disabled {
    cursor: default;
    opacity: 0.5;
}

.data-entry-panel,
.data-entry-record-panel {
    overflow: hidden;
}

.data-entry-record-panel {
    margin-top: 16px;
}

.data-entry-table-wrap,
.data-entry-record-table-wrap {
    max-height: 520px;
}

.data-entry-table td,
.data-entry-record-table td {
    vertical-align: middle;
}

.data-entry-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 176px;
}

.data-entry-upload-button {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: var(--action-fill);
    color: var(--action-on-fill);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.data-entry-upload-button:hover:not(:disabled) {
    filter: brightness(0.96);
}

.data-entry-upload-button:disabled,
.data-entry-actions .secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.data-entry-file-input {
    display: none;
}

.data-entry-panel .dashboard-mon-summary p.is-success {
    color: var(--semantic-green);
}

.data-entry-panel .dashboard-mon-summary p.is-error {
    color: var(--semantic-red);
}

.data-entry-record-status {
    font-weight: 600;
}

.data-entry-record-status.is-ready {
    color: var(--semantic-green);
}

.data-entry-record-status.is-failed {
    color: var(--semantic-red);
}

.special-sales-input-summary [data-special-context-status].is-success {
    color: var(--semantic-green);
}

.special-sales-input-summary [data-special-context-status].is-error {
    color: var(--semantic-red);
}

.special-manual-dialog .manual-entry-form-grid {
    align-items: start;
}

.special-input-rules {
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.special-input-rules p {
    margin: 0;
}

.special-manual-dialog .manual-entry-message.is-success,
.special-dashboard-summary p.is-success {
    color: var(--semantic-green);
}

.special-manual-dialog .manual-entry-message.is-error,
.special-dashboard-summary p.is-error {
    color: var(--semantic-red);
}

.special-dashboard-summary {
    display: grid;
    grid-template-columns: minmax(150px, 0.35fr) minmax(120px, 0.25fr) minmax(280px, 1fr);
    gap: 12px;
    align-items: stretch;
    padding: 16px;
}

.special-dashboard-summary > div,
.special-dashboard-summary > p {
    min-height: 64px;
    margin: 0;
    padding: 12px;
    border-radius: 9px;
    background: var(--fill-secondary);
}

.special-dashboard-summary > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.special-dashboard-summary span {
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.special-dashboard-summary strong {
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.special-dashboard-summary > p {
    display: flex;
    align-items: center;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.special-dashboard-table-wrap {
    max-height: 560px;
}

.special-dashboard-table td {
    max-width: 280px;
}

.special-dashboard-empty {
    margin: 0;
    padding: 24px 16px;
    border-top: 1px solid var(--border-subtle);
    color: var(--glyph-secondary);
    text-align: center;
}

.special-upload-dialog .upload-result-message.is-success {
    color: var(--semantic-green);
}

.special-upload-dialog .upload-result-message.is-error {
    color: var(--semantic-red);
}

@media (max-width: 900px) {
    .special-dashboard-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .special-dashboard-summary > p {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .special-dashboard-summary {
        grid-template-columns: 1fr;
    }

    .special-dashboard-summary > p {
        grid-column: auto;
    }
}

.sales-upload-table .validation-error-cell {
    min-width: 240px;
    color: var(--semantic-red);
    white-space: normal;
}

.sales-upload-table .validation-success-cell {
    color: var(--semantic-green);
}

.sales-upload-table tr.is-invalid-row td {
    background: color-mix(in srgb, var(--danger-soft) 48%, var(--fill-primary));
}

.row-delete-button {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--semantic-red) 28%, transparent);
    border-radius: 7px;
    background: var(--danger-soft);
    color: var(--semantic-red);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.row-delete-button:hover:not(:disabled) {
    filter: brightness(0.96);
}

/* 禁用时使用中性灰，并取消可点击光标和悬停反馈。 */
.row-delete-button:disabled {
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    border-color: var(--border-subtle);
    cursor: not-allowed;
}

.sales-upload-table th.current-row-action-cell,
.sales-upload-table td.current-row-action-cell {
    position: sticky;
    right: 0;
    min-width: 84px;
    text-align: center;
}

.sales-upload-table th.current-row-action-cell {
    z-index: 2;
}

.sales-upload-table td.current-row-action-cell {
    box-shadow: -1px 0 0 var(--border-subtle);
}

.upload-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-height: 68px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
}

.upload-confirm-bar p {
    flex: 1;
    margin: 0;
    color: var(--semantic-red);
    font-size: 13px;
}

.upload-confirm-button {
    min-width: 96px;
    min-height: 40px;
    padding: 0 20px;
    border: 0;
    border-radius: 9px;
    background: var(--action-fill);
    color: var(--action-on-fill);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.upload-confirm-button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.sales-workspace-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.55fr);
    gap: 16px;
}

.workspace-panel {
    overflow: hidden;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: var(--fill-primary);
    box-shadow: var(--shadow-panel);
}

.panel-heading {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--fill-primary);
}

.panel-heading h3,
.panel-heading h4 {
    margin-top: 2px;
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.panel-heading-action,
.allocation-heading {
    justify-content: space-between;
    gap: 16px;
}

.allocation-result-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.panel-body {
    padding: 16px;
}

.friday-input-summary {
    margin-bottom: 16px;
}

.friday-sync-message {
    max-width: 440px;
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
    text-align: right;
}

.friday-sync-message.is-success {
    color: var(--semantic-green);
}

.friday-sync-message.is-error {
    color: var(--semantic-red);
}

.friday-import-result {
    margin-bottom: 16px;
}

.friday-import-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.friday-import-metrics > div {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    background: var(--fill-secondary);
}

.friday-import-metrics span {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.friday-import-metrics strong {
    color: var(--glyph-primary);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.friday-import-message {
    margin: 16px 0 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.friday-import-message.is-error {
    color: var(--semantic-red);
}

.friday-data-dashboard {
    margin-bottom: 16px;
}

.friday-dashboard-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.friday-dashboard-latest-week {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.friday-dashboard-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.friday-dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.friday-dashboard-metrics > div {
    display: grid;
    min-height: 76px;
    align-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: 10px;
    background: var(--fill-secondary);
}

.friday-dashboard-metrics span {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.friday-dashboard-metrics strong {
    color: var(--glyph-primary);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.friday-dashboard-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.friday-dashboard-meta p {
    margin: 0;
}

.friday-filter-panel {
    margin-top: 16px;
}

.friday-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.friday-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.friday-filter-submit-button {
    min-width: 96px;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid var(--action-fill);
    border-radius: 10px;
    background: var(--action-fill);
    color: var(--action-on-fill);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.friday-filter-submit-button:hover {
    filter: brightness(0.96);
}

.friday-filter-submit-button:disabled {
    cursor: wait;
    filter: saturate(0.45);
}

.friday-dashboard-table-wrap {
    border-top: 1px solid var(--border-subtle);
    border-radius: 0;
}

.friday-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
}

.friday-pagination p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
}

.friday-pagination > div {
    display: flex;
    gap: 8px;
}

.friday-pagination button {
    min-width: 88px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.friday-pagination button:hover:not(:disabled) {
    background: var(--fill-secondary);
}

.friday-pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.friday-import-notice ul {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    padding-left: 20px;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-group > span {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.field-group select {
    --select-control-height: 48px;
    width: 100%;
    min-height: 48px;
    padding: 0 40px 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background-color: var(--fill-primary);
    color: var(--glyph-primary);
    font-size: 16px;
    cursor: pointer;
}

.context-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.context-note svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: var(--action-text);
    stroke-linecap: round;
    stroke-width: 1.6;
}

.row-count {
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
}

.allocation-panel {
    min-height: 388px;
}

.empty-workspace {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 315px;
    padding: 32px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
}

.empty-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.55;
}

.empty-workspace h5 {
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.empty-workspace p {
    max-width: 420px;
    margin-top: 7px;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.dashboard-source-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-tabs {
    margin-bottom: 16px;
    width: min(100%, 1280px);
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.dashboard-tab-panel[hidden] {
    display: none;
}

.dashboard-mon-panel {
    overflow: hidden;
}

.dashboard-mon-heading {
    align-items: flex-end;
    gap: 24px;
}

.dashboard-mon-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

/* 数据看板：标题和操作在上方，六个筛选独立成行，避免按钮挤占输入空间。 */
[data-data-dashboard] .dashboard-mon-heading {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

[data-data-dashboard] .dashboard-mon-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    width: auto;
}

[data-data-dashboard] .dashboard-mon-actions .secondary-button {
    min-height: 44px;
    padding: 8px 16px;
    width: auto;
    white-space: nowrap;
}

.data-dashboard-filters {
    display: grid;
    grid-template-columns: minmax(144px, .8fr) minmax(120px, .7fr) minmax(120px, .8fr) minmax(160px, 1.2fr) minmax(140px, 1fr) minmax(184px, 1.3fr);
    gap: 12px;
    padding: 16px;
}

/* Aging 模式突出查询说明与整个滚动列表，退出后恢复普通看板样式。 */
[data-data-dashboard].is-aging [data-dd-aging] {
    /* 深红底在明暗主题下均保持白字对比度。 */
    background: #c90000;
    border-color: #c90000;
    color: #ffffff;
}

[data-data-dashboard].is-aging [data-dd-aging]:hover {
    background: #b00000;
    border-color: #b00000;
}

[data-data-dashboard].is-aging [data-dd-message] {
    color: var(--semantic-red);
    font-weight: 600;
}

[data-data-dashboard].is-aging [data-dd-table-wrap] {
    border: 2px solid var(--semantic-red);
}

/* 经销商仅显示四项筛选，填满当前行，避免隐藏字段后留下空列。 */
.data-dashboard-filters--reseller {
    grid-template-columns: minmax(144px, .8fr) minmax(120px, .7fr) minmax(140px, 1fr) minmax(184px, 1.3fr);
}

/* Watch 急单只提供两项筛选，随容器宽度自动换行。 */
.data-dashboard-filters.watch-demand-filters {
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

.data-dashboard-filters .dashboard-week-field {
    min-width: 0;
    width: 100%;
}

.data-dashboard-filters input,
.data-dashboard-filters select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
    font-size: 16px;
}

.data-dashboard-filters select {
    padding-right: 28px;
}

@media (max-width: 1200px) {
    .data-dashboard-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .data-dashboard-filters--reseller {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .data-dashboard-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .data-dashboard-filters {
        grid-template-columns: minmax(0, 1fr);
    }
}

.dashboard-data-updated {
    margin: 8px 0 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

.dashboard-week-field {
    display: grid;
    gap: 6px;
    min-width: 180px;
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.dashboard-week-field select {
    min-height: 44px;
    padding: 0 38px 0 13px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.dashboard-week-field select:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.dashboard-mon-download {
    min-height: 44px;
    white-space: nowrap;
}

.dashboard-mon-summary {
    display: grid;
    gap: 5px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
}

.dashboard-mon-summary p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.dashboard-mon-summary .dashboard-mon-warning {
    color: var(--semantic-red);
    font-weight: 600;
}

.dashboard-mon-table-wrap {
    max-height: 600px;
}

.dashboard-overview-sections {
    display: grid;
    gap: 18px;
    padding: 0 16px 16px;
}

.dashboard-overview-section {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--fill-primary);
}

.dashboard-overview-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.dashboard-overview-section-heading h4,
.dashboard-overview-section-heading span {
    margin: 0;
}

.dashboard-overview-section-heading h4 {
    color: var(--glyph-primary);
    font-size: 15px;
}

.dashboard-overview-section-heading span {
    color: var(--glyph-secondary);
    font-size: 12px;
}

.dashboard-overview-table-wrap {
    max-height: 460px;
}

.dashboard-overview-summary-row td {
    background: var(--info-soft);
    color: var(--glyph-primary);
    font-weight: 700;
}

.scheduler-control-panel {
    overflow: hidden;
}

.scheduler-control-heading {
    align-items: flex-start;
}

.scheduler-control-description {
    margin: 6px 0 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.scheduler-control-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.scheduler-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 76px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--fill-secondary);
}

.scheduler-summary-card span {
    color: var(--glyph-secondary);
    font-size: 13px;
}

.scheduler-summary-card strong {
    color: var(--glyph-primary);
    font-size: 26px;
    line-height: 32px;
}

.scheduler-summary-card .scheduler-summary-failed {
    color: var(--semantic-red);
}

.scheduler-control-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px 16px;
}

.scheduler-control-status p,
.scheduler-control-note p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.scheduler-runtime-badge,
.scheduler-job-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.scheduler-runtime-badge.is-running,
.scheduler-job-status.is-success {
    background: var(--success-soft);
    color: var(--semantic-green);
}

.scheduler-job-status.is-running {
    background: var(--info-soft);
    color: var(--info-strong);
}

.scheduler-job-status.is-failed,
.scheduler-job-status.is-missed {
    background: var(--danger-soft);
    color: var(--semantic-red);
}

.scheduler-job-status.is-skipped {
    color: var(--semantic-orange);
}

.scheduler-control-table-wrap {
    max-height: 600px;
}

.scheduler-control-table {
    min-width: 1320px;
}

.scheduler-task-cell {
    display: grid;
    gap: 3px;
    min-width: 220px;
    white-space: normal;
}

.scheduler-task-cell strong {
    color: var(--glyph-primary);
    font-size: 13px;
}

.scheduler-task-cell span,
.scheduler-task-cell small,
.scheduler-data-time-cell small,
.scheduler-status-detail {
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.scheduler-data-time-cell {
    display: grid;
    gap: 3px;
    min-width: 156px;
    white-space: normal;
}

.scheduler-data-time-cell strong {
    color: var(--glyph-primary);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.scheduler-status-cell {
    display: grid;
    gap: 5px;
    min-width: 150px;
    white-space: normal;
}

.scheduler-run-button {
    min-width: 82px;
}

.scheduler-control-note {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--fill-secondary);
}

.dashboard-source-grid .workspace-panel {
    min-height: 174px;
}

.source-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--info-soft);
    color: var(--info-strong);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}

.source-pill-reporting {
    background: var(--success-soft);
    color: var(--success-strong);
}

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.metric-label {
    color: var(--glyph-secondary);
    font-size: 13px;
}

.metric-row strong {
    font-size: 17px;
    font-weight: 600;
}

.status-badge {
    color: var(--glyph-primary);
    font-size: 13px;
    font-weight: 600;
}

.status-connected {
    color: var(--semantic-green);
}

.status-missing_config,
.status-missing_dependency,
.status-missing_helper,
.status-connection_failed {
    color: var(--semantic-red);
}

.status-note {
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.status-note-warning {
    color: var(--semantic-red);
}

.source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--glyph-secondary);
    font-size: 11px;
}

.secondary-button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--fill-primary);
    color: var(--action-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.secondary-button:hover {
    background: var(--fill-secondary);
}

.fiscal-table-panel {
    margin-top: 16px;
}

.table-responsive {
    scrollbar-color: var(--glyph-tertiary) transparent;
}

.fiscal-table-panel .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--glyph-primary);
    --bs-table-hover-bg: var(--fill-secondary);
    --bs-table-hover-color: var(--glyph-primary);
    margin-bottom: 0;
    color: var(--glyph-primary);
    font-size: 12px;
}

.fiscal-table-panel .table > :not(caption) > * > * {
    padding: 12px 16px;
    border-bottom-color: var(--border-subtle);
    background: transparent;
    color: inherit;
    white-space: nowrap;
}

.fiscal-table-panel thead th {
    background: var(--fill-secondary) !important;
    color: var(--glyph-secondary) !important;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.htmx-request.secondary-button,
.htmx-request .secondary-button {
    cursor: wait;
    opacity: 0.65;
}

.noscript-message {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 100;
    max-width: 360px;
    padding: 12px 16px;
    border: 1px solid var(--semantic-red);
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--semantic-red);
    font-size: 13px;
}


/* 工作台遵循 DESIGN.md；操作采用灰阶，状态使用独立语义色。 */
::selection {
    background: var(--brand-accent-soft);
    color: var(--glyph-primary);
}
html {
    scrollbar-color: var(--fill-quaternary) var(--fill-secondary);
}
input, textarea {
    caret-color: var(--action-text);
}
a {
    text-underline-offset: 3px;
}
table {
    font-variant-numeric: tabular-nums;
}
.sidebar-nav-item .nav-icon {
    color: inherit;
}
.product-summary-copy {
    min-width: 0;
}
.product-summary-copy h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.025em;
}
.workspace-heading-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
}
.fiscal-week {
    color: var(--glyph-secondary);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.sales-window-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px !important;
    font-size: 13px;
}
.sales-window-line .sales-input-window-status::before {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 7px 2px 0;
    border-radius: 50%;
    background: currentColor;
    content: "";
}
.workflow-note {
    margin-top: 12px;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 1.6;
}
.workflow-note summary {
    width: fit-content;
    padding: 4px 0;
    cursor: pointer;
}
.workflow-note summary:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 4px;
}
.workflow-note p {
    max-width: 78ch;
    margin-top: 4px;
}
.dashboard-heading-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.upload-dashboard-heading h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 24px;
}
.sales-input-admin-actions p:not(:empty) {
    padding: 12px 0;
}
.current-empty-state {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 56px 24px 72px;
    text-align: center;
}
.current-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    fill: none;
    stroke: var(--glyph-secondary);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.current-empty-state h3 {
    margin: 0;
    font-size: 20px;
    line-height: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.current-empty-state p {
    max-width: 40ch;
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 1.7;
}
[data-current-dashboard][aria-busy="true"] .current-empty-state {
    display: none;
}
[data-current-dashboard]:not([aria-busy="true"]):has(.current-empty-state:not([hidden])) .upload-result-toolbar {
    display: none;
}

@media (max-width: 1100px) {
    .dashboard-source-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-source-grid > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {







    .workspace-topbar {
        position: static;
    }

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

@media (max-width: 640px) {




    .workspace-topbar {
        align-items: flex-start;
        min-height: 80px;
        padding: 14px 16px;
    }

    .workspace-context {
        min-height: 36px;
    }

    .context-label {
        display: none;
    }

    .workspace-content {
        padding: 16px 16px 40px;
    }

    .page-intro {
        display: block;
    }

    .page-intro p:last-child,
    .product-summary-copy > p:last-child {
        overflow-wrap: anywhere;
    }

    .view-status {
        margin-top: 16px;
    }

    .product-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .dashboard-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .scheduler-control-summary {
        grid-template-columns: 1fr;
    }

    .scheduler-control-heading,
    .scheduler-control-status {
        align-items: stretch;
        flex-direction: column;
    }

    .product-tab {
        min-width: 0;
        padding: 0 12px;
    }

    .dashboard-mon-heading,
    .dashboard-mon-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-mon-actions,
    .dashboard-week-field,
    .dashboard-mon-download,
    .dashboard-mon-refresh {
        width: 100%;
    }

    .product-summary {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 0 20px;
    }

    .product-summary-copy h3 {
        font-size: 24px;
        line-height: 30px;
    }

    .upload-control {
        width: 100%;
    }

    .product-summary-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        width: 100%;
    }

    .friday-input-actions {
        grid-column: 1 / -1;
        justify-items: stretch;
        width: 100%;
    }

    .friday-sync-message {
        max-width: none;
        text-align: left;
    }

    .template-download-button,
    .manual-entry-open-button,
    .current-download-button,
    .friday-sync-button,
    .upload-result-open-button {
        width: 100%;
    }

    .upload-kpi-grid {
        grid-template-columns: 1fr;
    }

    .friday-import-metrics {
        grid-template-columns: 1fr;
    }

    .friday-dashboard-metrics,
    .friday-filter-grid {
        grid-template-columns: 1fr;
    }

    .friday-dashboard-meta,
    .friday-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .friday-data-dashboard > .panel-heading-action,
    .allocation-result-panel > .panel-heading-action,
    .friday-dashboard-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .friday-dashboard-heading-actions {
        width: 100%;
    }

    .allocation-result-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .friday-filter-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .friday-pagination > div,
    .friday-pagination button {
        width: 100%;
    }

    .product-badge {
        display: none;
    }

    .dashboard-source-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-source-grid > :last-child {
        grid-column: auto;
    }
}

.sidebar-user-card {
    display: grid;
    flex-shrink: 0;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    margin-top: auto;
    padding: 14px 10px;
    border-top: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
}

.sidebar-user-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
}

.sidebar-user-details {
    min-width: 0;
}

.sidebar-user-details strong,
.sidebar-user-details span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-details strong {
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
}

.sidebar-user-details span {
    color: var(--sidebar-text-muted);
    font-size: 11px;
    line-height: 16px;
}

.sidebar-user-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sidebar-user-actions button {
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.sidebar-user-actions button:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
}

.sidebar-footer {
    margin-top: 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-field > span {
    color: var(--glyph-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font-size: 16px;
    line-height: 20px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-field input:focus {
    border-color: var(--action-text);
}

.auth-primary-button,
.auth-secondary-button {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.auth-primary-button {
    border: 0;
    background: var(--action-fill);
    color: var(--action-on-fill);
}

.auth-secondary-button {
    border: 1px solid var(--border-primary);
    background: var(--fill-primary);
    color: var(--glyph-primary);
}

.auth-primary-button:disabled,
.auth-secondary-button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.auth-form-message,
.auth-helper-text {
    min-height: 18px;
    margin: 0;
    font-size: 12px;
    line-height: 18px;
}

.auth-form-message {
    color: var(--semantic-red);
}

.auth-form-message.is-success {
    color: var(--semantic-green);
}

.auth-helper-text {
    color: var(--glyph-secondary);
}

.login-page {
    min-height: 100vh;
    background: var(--fill-secondary);
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: min(100%, 420px);
    padding: 32px;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--fill-primary);
    box-shadow: var(--shadow-panel);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    font-size: 17px;
    font-weight: 600;
}

.login-brand p,
.login-brand span,
.login-heading h1,
.login-heading p,
.login-footnote {
    margin: 0;
}

.login-brand p {
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.login-brand span {
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.login-heading {
    margin-top: 32px;
}

.login-heading h1 {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 34px;
}

.login-heading > p:last-child {
    margin-top: 8px;
    color: var(--glyph-secondary);
    font-size: 14px;
    line-height: 20px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 28px;
}

.login-footnote {
    margin-top: 20px;
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
    text-align: center;
}

.upload-result-dialog,
.compliance-upload-dialog,
.manual-entry-dialog,
.error-dialog,
.password-dialog {
    width: min(calc(100% - 32px), 480px);
    max-width: none;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    box-shadow: var(--shadow-dialog);
}

.po-gap-customer-dialog {
    width: min(calc(100% - 32px), 880px);
    max-width: none;
    max-height: 88vh;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    box-shadow: var(--shadow-dialog);
}

.po-gap-customer-dialog::backdrop {
    background: var(--overlay-scrim);
    backdrop-filter: blur(4px);
}

.po-gap-customer-dialog-card {
    display: flex;
    max-height: 88vh;
    flex-direction: column;
}

.po-gap-customer-dialog-heading,
.po-gap-customer-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
}

.po-gap-customer-dialog-heading {
    align-items: flex-start;
    border-bottom: 1px solid var(--border-subtle);
}

.po-gap-customer-dialog-heading h2 {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 24px;
}

.po-gap-customer-dialog-heading > div > p:last-child {
    margin: 6px 0 0;
    color: var(--glyph-secondary);
    font-size: 13px;
}

.po-gap-customer-dialog-body {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    overflow: auto;
}

.po-gap-customer-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.po-gap-customer-summary > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--fill-secondary);
}

.po-gap-customer-summary span {
    color: var(--glyph-secondary);
    font-size: 12px;
}

.po-gap-customer-summary strong {
    font-size: 24px;
    font-weight: 600;
}

.po-gap-customer-toolbar {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.po-gap-remove-all-button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid color-mix(in srgb, var(--semantic-red) 42%, transparent);
    border-radius: 9px;
    background: var(--danger-soft);
    color: var(--semantic-red);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.po-gap-remove-all-button:hover:not(:disabled) {
    border-color: var(--semantic-red);
    filter: brightness(0.96);
}

.po-gap-remove-all-button:disabled {
    cursor: default;
    opacity: 0.5;
}

.po-gap-customer-table-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}

.po-gap-customer-table td:last-child,
.po-gap-customer-table th:last-child {
    width: 148px;
    text-align: center;
}

.po-gap-quantity-input {
    width: 100px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
}

.po-gap-quantity-input:focus {
    border-color: var(--action-fill);
    outline: 2px solid var(--focus-ring);
}

.po-gap-customer-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.po-gap-customer-save-button {
    border-color: color-mix(in srgb, var(--action-fill) 42%, transparent);
    background: var(--info-soft);
    color: var(--action-text);
}

.po-gap-customer-message {
    min-height: 18px;
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.po-gap-customer-dialog-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border-subtle);
}

.upload-result-dialog {
    width: min(calc(100% - 32px), 1200px);
    max-height: 92vh;
}

.manual-entry-dialog {
    width: min(calc(100% - 32px), 880px);
    max-height: min(92vh, 920px);
}

.compliance-upload-dialog {
    --compliance-dialog-max-height: min(92vh, 820px);
    width: min(calc(100% - 32px), 720px);
    max-height: var(--compliance-dialog-max-height);
}

@supports (height: 100dvh) {
    .compliance-upload-dialog {
        --compliance-dialog-max-height: min(92dvh, 820px);
    }
}

.upload-result-dialog::backdrop,
.compliance-upload-dialog::backdrop,
.manual-entry-dialog::backdrop,
.error-dialog::backdrop,
.password-dialog::backdrop {
    background: var(--overlay-scrim);
    backdrop-filter: blur(4px);
}

.upload-result-dialog-card,
.compliance-upload-dialog-card,
.manual-entry-dialog-card {
    display: flex;
    max-height: min(92vh, 920px);
    flex-direction: column;
    margin: 0;
}

.upload-result-dialog-card {
    max-height: 92vh;
}

/* 内外层共用高度上限并扣除边框，避免 Safari 将操作栏裁在弹窗外。 */
.compliance-upload-dialog-card {
    min-height: 0;
    max-height: calc(var(--compliance-dialog-max-height) - 2px);
    overflow: hidden;
}

.compliance-upload-dialog-heading,
.compliance-upload-dialog-actions {
    flex: 0 0 auto;
}

.error-dialog-card,
.password-dialog-card {
    margin: 0;
}

.upload-result-dialog-heading,
.compliance-upload-dialog-heading,
.manual-entry-dialog-heading,
.compliance-upload-dialog-actions,
.manual-entry-dialog-actions,
.error-dialog-heading,
.error-dialog-actions,
.password-dialog-heading,
.password-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
}

.upload-result-dialog-heading,
.compliance-upload-dialog-heading,
.manual-entry-dialog-heading,
.error-dialog-heading,
.password-dialog-heading {
    border-bottom: 1px solid var(--border-subtle);
}

.error-dialog-heading {
    justify-content: flex-start;
}

.upload-result-dialog-heading,
.compliance-upload-dialog-heading,
.manual-entry-dialog-heading {
    align-items: flex-start;
}

.upload-result-dialog-heading h2,
.compliance-upload-dialog-heading h2,
.manual-entry-dialog-heading h2,
.error-dialog-heading h2,
.password-dialog-heading h2 {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 24px;
}

.error-dialog-icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--semantic-red) 12%, var(--fill-primary));
    color: var(--semantic-red);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.upload-result-dialog-heading > div > p:last-child,
.compliance-upload-dialog-heading > div > p:last-child,
.manual-entry-dialog-heading > div > p:last-child {
    max-width: 620px;
    margin: 6px 0 0;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
}

.upload-result-dialog-body {
    min-height: 0;
    padding: 16px;
    overflow: auto;
}

.compliance-upload-dialog-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    overflow: auto;
    overscroll-behavior-y: contain;
}

/* 仅正文容器缩小并滚动，字段、文件列表和结果区保留自然高度。 */
.compliance-upload-dialog-body > * {
    flex-shrink: 0;
}

.compliance-period-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.compliance-period-summary > div,
.compliance-destination {
    padding: 14px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--fill-secondary);
}

.compliance-period-summary span,
.compliance-destination span {
    display: block;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.compliance-period-summary strong,
.compliance-destination strong {
    display: block;
    margin-top: 2px;
    color: var(--glyph-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 22px;
    overflow-wrap: anywhere;
}

.compliance-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--glyph-secondary);
    font-size: 13px;
    font-weight: 500;
}

.compliance-field b {
    color: var(--semantic-red);
}

.compliance-field select,
.compliance-field input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
    font-size: 16px;
}

.compliance-field select {
    --select-control-height: 46px;
}

.compliance-field input {
    padding: 0 13px;
}

.compliance-field input::placeholder {
    color: var(--glyph-tertiary);
}

.compliance-customer-search {
    position: relative;
}

.compliance-customer-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 220px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--fill-primary);
    box-shadow: 0 12px 28px rgb(0 0 0 / 14%);
}

.compliance-customer-suggestions[hidden] {
    display: none;
}

.compliance-customer-suggestions li {
    margin: 0;
}

.compliance-customer-suggestions button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--glyph-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.compliance-customer-suggestions button:hover,
.compliance-customer-suggestions button.is-active {
    background: color-mix(in srgb, var(--action-fill) 10%, var(--fill-primary));
    color: var(--action-fill);
}

.compliance-file-picker {
    display: flex;
    min-height: 142px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
    border: 1px dashed color-mix(in srgb, var(--action-fill) 48%, var(--border-primary));
    border-radius: 12px;
    background: color-mix(in srgb, var(--action-fill) 4%, var(--fill-primary));
    color: var(--glyph-primary);
    cursor: pointer;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease;
}

.compliance-file-picker:hover {
    border-color: var(--action-fill);
    background: color-mix(in srgb, var(--action-fill) 8%, var(--fill-primary));
}

.compliance-file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.compliance-file-picker-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--action-fill) 12%, var(--fill-primary));
    color: var(--action-text);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.compliance-file-picker strong {
    color: var(--action-text);
    font-size: 15px;
}

.compliance-file-picker small {
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.compliance-file-list,
.compliance-stored-files ul,
.compliance-upload-result ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.compliance-file-list:empty {
    display: none;
}

.compliance-file-list li,
.compliance-stored-files li,
.compliance-upload-result li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 11px;
    border-radius: 8px;
    background: var(--fill-secondary);
    color: var(--glyph-primary);
    font-size: 12px;
    line-height: 18px;
}

.compliance-file-list li span:first-child,
.compliance-stored-files li span:first-child,
.compliance-upload-result li span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compliance-file-list li span:last-child,
.compliance-stored-files li span:last-child {
    flex: 0 0 auto;
    color: var(--glyph-secondary);
}

.compliance-document-info {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.compliance-document-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.compliance-document-actions button,
.compliance-stored-files-heading button {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--border-primary);
    border-radius: 7px;
    background: var(--fill-primary);
    color: var(--action-text);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.compliance-document-actions button.is-danger {
    color: var(--semantic-red);
}

.compliance-document-actions button:disabled,
.compliance-stored-files-heading button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.compliance-stored-files {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--fill-primary);
}

.compliance-stored-files-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.compliance-stored-files-heading strong {
    color: var(--glyph-primary);
    font-size: 13px;
}

.compliance-stored-files > p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.compliance-upload-result {
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--semantic-green) 30%, var(--border-subtle));
    border-radius: 10px;
    background: color-mix(in srgb, var(--semantic-green) 7%, var(--fill-primary));
}

.compliance-upload-result > strong {
    display: block;
    margin-bottom: 10px;
    color: var(--semantic-green);
    font-size: 13px;
}

.compliance-upload-result li {
    overflow-wrap: anywhere;
}

.compliance-upload-result.is-error {
    border-color: color-mix(in srgb, var(--semantic-red) 32%, var(--border-subtle));
    background: color-mix(in srgb, var(--semantic-red) 7%, var(--fill-primary));
}

.compliance-upload-result.is-error > strong {
    color: var(--semantic-red);
}

.upload-result-dashboard {
    margin-top: 0;
}

.dialog-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--glyph-secondary);
    cursor: pointer;
    line-height: 1;
    transition: background-color 150ms ease, color 150ms ease;
}

/* 保留完整点击区域；静止时仅显示居中叉号，交互时再显现轻量底色。 */
.dialog-close-button:hover,
.dialog-close-button:focus-visible {
    background: var(--fill-secondary);
    color: var(--glyph-primary);
}

.dialog-close-button:active {
    background: var(--fill-tertiary);
}

.dialog-close-button svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.password-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
}

.error-dialog-body {
    padding: 20px 16px;
}

.error-dialog-body p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 14px;
    line-height: 20px;
    overflow-wrap: anywhere;
}

.po-gap-delete-confirm-dialog {
    width: min(calc(100% - 32px), 560px);
}

.po-gap-delete-confirm-dialog .error-dialog-card {
    display: flex;
    max-height: 88vh;
    flex-direction: column;
}

.po-gap-delete-confirm-dialog .error-dialog-body {
    min-height: 0;
    overflow: auto;
}

.po-gap-delete-confirm-list {
    display: grid;
    gap: 8px;
    margin: 14px 0;
    padding: 0;
    list-style: none;
}

.po-gap-delete-confirm-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--fill-secondary);
}

.po-gap-delete-confirm-list span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.po-gap-delete-confirm-list strong {
    color: var(--glyph-primary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.error-dialog-body .po-gap-delete-confirm-warning {
    color: var(--semantic-red);
}

.current-delete-details {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
}

.current-delete-details > div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--fill-secondary);
}

.current-delete-details dt {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.current-delete-details dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--glyph-primary);
    font-size: 13px;
    font-weight: 600;
}

.current-delete-confirm-button {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 9px;
    background: var(--semantic-red);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.current-delete-confirm-button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.manual-entry-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
}

.manual-entry-section {
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--fill-primary);
}

.manual-entry-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.manual-entry-section-heading h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.manual-entry-section-heading > span {
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.manual-entry-section-heading b,
.manual-entry-field b {
    color: var(--semantic-red);
    font-weight: 600;
}

.manual-opportunity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.manual-entry-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.manual-entry-field > span,
.program-picker > label {
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.manual-entry-field input,
.manual-entry-field select,
.manual-entry-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font-size: 16px;
    line-height: 20px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.manual-entry-field textarea {
    min-height: 84px;
    resize: vertical;
}

.manual-entry-field input:focus,
.manual-entry-field select:focus,
.manual-entry-field textarea:focus {
    border-color: var(--action-text);
}

.manual-entry-field input[readonly] {
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    cursor: default;
}

.program-picker-control {
    display: flex;
    gap: 8px;
}

.program-picker-control input {
    min-width: 0;
    flex: 1;
}

.program-picker-toggle {
    min-width: 64px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--fill-primary);
    color: var(--action-text);
    font-size: 14px;
    font-weight: 500;
}

.program-picker-toggle[aria-expanded="true"] {
    background: var(--info-soft);
}

.program-picker-panel {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--fill-primary);
}

.program-picker-option {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 12px;
    padding: 8px;
    border-radius: 4px;
    color: var(--glyph-primary);
    font-size: 14px;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.program-picker-option:hover {
    background: var(--fill-secondary);
}

.program-picker-option input[type="checkbox"] {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    accent-color: var(--action-fill);
}

.program-picker > small,
.program-picker-panel p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.program-picker-panel p {
    padding: 8px;
}

.manual-order-picker small {
    min-height: 16px;
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.manual-order-combobox {
    position: relative;
}

.manual-order-combobox-trigger {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    line-height: 20px;
    text-align: left;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.manual-order-combobox-trigger:hover,
.manual-order-combobox-trigger[aria-expanded="true"] {
    border-color: var(--action-text);
}

.manual-order-combobox-trigger:focus-visible {
    border-color: var(--action-text);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--action-text) 16%, transparent);
}

.manual-order-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 150ms ease;
}

.manual-order-combobox-trigger[aria-expanded="true"] .manual-order-chevron {
    transform: translateY(2px) rotate(225deg);
}

.manual-order-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    padding: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: var(--fill-primary);
    box-shadow: var(--shadow-panel);
}

.manual-order-search {
    position: relative;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.manual-order-search > span {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--glyph-secondary);
    border-radius: 50%;
    pointer-events: none;
}

.manual-order-search > span::after {
    position: absolute;
    width: 6px;
    height: 1.5px;
    right: -5px;
    bottom: -3px;
    border-radius: 1px;
    background: var(--glyph-secondary);
    content: "";
    transform: rotate(45deg);
    transform-origin: left center;
}

.manual-order-search input {
    min-height: 44px;
    padding-left: 36px;
    background: var(--fill-secondary);
}

.manual-order-options {
    max-height: 248px;
    padding-top: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.manual-order-option {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--glyph-primary);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
}

.manual-order-option::before {
    width: 16px;
    flex: 0 0 16px;
    color: var(--action-text);
    content: "";
    font-size: 16px;
    font-weight: 600;
    line-height: 16px;
}

.manual-order-option[aria-selected="true"] {
    background: color-mix(in srgb, var(--action-text) 10%, var(--fill-primary));
    color: var(--action-text);
    font-weight: 600;
}

.manual-order-option[aria-selected="true"]::before {
    content: "✓";
}

.manual-order-option:hover,
.manual-order-option:focus-visible {
    background: var(--fill-secondary);
    outline: 0;
}

.manual-order-empty {
    margin: 0;
    padding: 16px 12px;
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 18px;
    text-align: center;
}

.manual-order-combobox-trigger:disabled,
.manual-order-search input:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.manual-entry-field input.is-invalid,
.manual-entry-field input.is-invalid:focus {
    border-color: var(--semantic-red);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--semantic-red) 12%, transparent);
}

.manual-entry-field-error {
    color: var(--semantic-red);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
}

.manual-lookup-button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-secondary);
    color: var(--glyph-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.manual-lookup-button:hover {
    border-color: var(--action-text);
}

.manual-lookup-button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.manual-entry-message {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 18px;
}

.manual-entry-message.is-success {
    color: var(--semantic-green);
}

.manual-entry-message.is-error,
[data-iphone-input] [role="status"].is-error {
    color: var(--semantic-red);
}

.manual-entry-message.is-warning {
    color: var(--semantic-orange);
}

.manual-candidate-grid,
.manual-entry-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.manual-candidate-grid > div {
    min-width: 0;
    padding: 12px;
    border-radius: 9px;
    background: var(--fill-secondary);
}

.manual-candidate-grid span,
.manual-candidate-grid label,
.manual-candidate-grid strong {
    display: block;
}

.manual-candidate-grid span,
.manual-candidate-grid label {
    color: var(--glyph-secondary);
    font-size: 11px;
    line-height: 16px;
}

.manual-candidate-grid strong {
    margin-top: 4px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
}

.manual-candidate-grid .manual-probability-card.is-invalid,
.manual-candidate-grid .manual-reseller-po-card.is-invalid {
    background: color-mix(in srgb, var(--semantic-red) 8%, var(--fill-secondary));
    box-shadow: inset 0 0 0 2px var(--semantic-red);
}

.manual-probability-card.is-invalid strong,
.manual-probability-card small,
.manual-reseller-po-card.is-invalid strong,
.manual-reseller-po-card small {
    color: var(--semantic-red);
}

.manual-probability-card small,
.manual-reseller-po-card small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 16px;
}

.manual-candidate-selector select {
    width: 100%;
    margin-top: 4px;
    padding: 0 28px 0 0;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    color: var(--glyph-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
}

.manual-candidate-selector select:hover,
.manual-candidate-selector select:focus {
    color: var(--action-text);
}

.manual-candidate-selector select:focus-visible {
    outline-offset: 4px;
}

.manual-candidate-selector select:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.manual-candidate-wide,
.manual-entry-field-wide {
    grid-column: span 2;
}

.compliance-upload-dialog-actions,
.manual-entry-dialog-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border-subtle);
    background: var(--fill-primary);
}

/* 未选择文件时只是不可提交，不应显示成仍在处理。 */
.compliance-upload-dialog-actions .auth-primary-button:disabled {
    cursor: not-allowed;
}

.compliance-upload-dialog-actions .auth-primary-button[aria-busy="true"] {
    cursor: wait;
}

.password-dialog-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border-subtle);
}

.error-dialog-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border-subtle);
}

/* 分货看板 */
.allocation-intro {
    align-items: center;
}

.allocation-week-badge {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid color-mix(in srgb, var(--semantic-green) 45%, var(--border-primary));
    border-radius: 999px;
    color: var(--semantic-green);
    font-weight: 600;
    white-space: nowrap;
}

.allocation-lob-tabs {
    margin-bottom: 20px;
}

.allocation-control-panel,
.allocation-result-panel,
.allocation-rules-panel {
    margin-bottom: 20px;
}

.allocation-supply-help {
    margin: 16px 24px 24px;
}

.allocation-result-actions {
    flex-wrap: wrap;
}

[data-allocation-publish],
[data-allocation-reallocate],
[data-allocation-rollback],
[data-allocation-remaining-supply] {
    min-height: 44px;
}

.allocation-rollback-button {
    padding: 0 16px;
    border: 1px solid var(--semantic-red);
    border-radius: 9px;
    background: var(--semantic-red);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.allocation-rollback-button:hover {
    filter: brightness(0.92);
}

.allocation-rollback-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.allocation-control-description {
    margin: 6px 0 0;
    color: var(--glyph-secondary);
    font-size: 13px;
}

.allocation-run-button {
    min-width: 128px;
    min-height: 44px;
}

.allocation-publish-button {
    min-width: 112px;
    min-height: 44px;
}

.allocation-rules-heading {
    align-items: center;
}

.allocation-rules-lob-field {
    display: grid;
    gap: 8px;
    min-width: 180px;
    color: var(--glyph-secondary);
    font-size: 12px;
    font-weight: 500;
}

.allocation-rules-lob-field select,
.allocation-rule-table input,
.allocation-rule-table select {
    min-height: 44px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font-family: inherit;
    font-size: 16px;
}

.allocation-rules-lob-field select {
    min-width: 180px;
    padding: 0 12px;
}

.allocation-rules-message {
    margin: 20px 24px 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    font-size: 13px;
    line-height: 20px;
}

.allocation-rules-message.is-success {
    background: var(--success-soft);
    color: var(--success-strong);
}

.allocation-rules-message.is-error {
    background: var(--danger-soft);
    color: var(--semantic-red);
}

.allocation-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 20px 24px 24px;
}

.allocation-rule-editor {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--fill-primary);
}

.allocation-rule-editor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 76px;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.allocation-rule-editor-heading h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.allocation-rule-editor-heading p {
    margin: 4px 0 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.allocation-rule-editor-heading .secondary-button,
.allocation-rule-remove {
    min-height: 44px;
    white-space: nowrap;
}

.allocation-rule-table-wrap {
    max-height: 440px;
    border: 0;
    border-radius: 0;
}

.allocation-rule-table th,
.allocation-rule-table td {
    min-width: 112px;
    padding: 8px;
    vertical-align: middle;
}

.allocation-rule-table th:first-child,
.allocation-rule-table td:first-child {
    min-width: 180px;
}

.allocation-rule-table input,
.allocation-rule-table select {
    width: 100%;
    padding: 0 10px;
}

.allocation-rule-table input[readonly] {
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
}

.allocation-rule-remove:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.allocation-rules-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 12px 24px;
    border-top: 1px solid var(--border-subtle);
}

.allocation-rules-actions p {
    margin: 0;
    color: var(--glyph-secondary);
    font-size: 12px;
    line-height: 16px;
}

.allocation-rules-actions .auth-primary-button {
    min-height: 44px;
}

.allocation-source-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding: 24px 24px 16px;
    border-top: 1px solid var(--border-subtle);
}

.allocation-source-card {
    display: flex;
    min-height: 126px;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--fill-secondary);
}

.allocation-source-card.is-ready {
    border-color: color-mix(in srgb, var(--semantic-green) 35%, var(--border-subtle));
    background: color-mix(in srgb, var(--success-soft) 58%, var(--fill-primary));
}

.allocation-source-card.is-blocked {
    border-color: color-mix(in srgb, var(--semantic-red) 32%, var(--border-subtle));
    background: color-mix(in srgb, var(--danger-soft) 62%, var(--fill-primary));
}

.allocation-source-name,
.allocation-source-card small {
    color: var(--glyph-secondary);
}

.allocation-source-card small {
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.5;
}

.allocation-selection-help {
    margin: 0 24px 16px;
    font-size: 13px;
    color: var(--glyph-secondary);
    line-height: 1.5;
}

.allocation-source-card strong {
    font-size: 18px;
}

.allocation-source-card.is-ready strong {
    color: var(--semantic-green);
}

.allocation-source-card.is-blocked strong {
    color: var(--semantic-red);
}

/* CPU/iPad 使用三张紧凑选版卡；Watch 保留原来的四项摘要布局。 */
[data-allocation-dashboard] .allocation-source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-allocation-dashboard] .allocation-source-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    align-items: center;
    background: var(--fill-primary);
}
[data-allocation-dashboard] .allocation-source-card.is-ready {
    border-color: var(--border-subtle);
    background: var(--fill-primary);
}
[data-allocation-dashboard] .allocation-source-card small {
    grid-column: 1 / -1;
    min-height: 36px;
}
[data-allocation-dashboard] .allocation-source-card strong {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    background: var(--fill-secondary);
}
[data-allocation-dashboard] .allocation-source-card.is-ready strong { background: var(--success-soft); }
[data-allocation-dashboard] [data-allocation-source="rules"] {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    min-height: 0;
    gap: 8px 16px;
    padding: 12px 16px;
    background: var(--fill-secondary);
}
[data-allocation-dashboard] [data-allocation-source="rules"] small { min-height: 0; }
.allocation-control-panel > .allocation-supply-help { margin: 0; padding: 0 24px 20px; }

.allocation-message,
.allocation-run-status {
    margin: 0 24px 20px;
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
}

.allocation-message.is-ready,
.allocation-run-status.is-ready {
    background: var(--success-soft);
    color: var(--success-strong);
}

.allocation-message.is-warning {
    background: var(--fill-secondary);
    color: var(--semantic-orange);
}

.allocation-message.is-blocked,
.allocation-run-status.is-failed {
    background: var(--danger-soft);
    color: var(--semantic-red);
}

.allocation-run-status.is-running {
    background: var(--info-soft);
    color: var(--info-strong);
}

.allocation-run-status.is-draft {
    background: var(--info-soft);
    color: var(--info-strong);
}

.allocation-result-tabs {
    margin: 20px 24px 16px;
}

.allocation-result-tabs .upload-kpi {
    min-height: 56px;
}

.allocation-table-wrap {
    max-height: 620px;
}

/* 筛选位于表格滚动区域外，查看和调整共用，窄屏时自然换行。 */
.allocation-result-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; padding: 0 24px 16px; }
.allocation-result-filters label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; max-width: 100%; }
.allocation-result-filters input { width: 220px; max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--fill-primary); color: var(--glyph-primary); font-size: 14px; }
.allocation-result-filters button { min-height: 44px; }
.allocation-result-filters p { margin: 0; padding-bottom: 10px; color: var(--glyph-secondary); font-size: 13px; }
.allocation-result-filters .allocation-filter-help { flex-basis: 100%; padding-bottom: 0; font-size: 12px; }

.allocation-table th,
.allocation-table td {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.allocation-table .allocation-long-cell {
    min-width: 260px;
    max-width: 420px;
}

/* 左侧业务键与顶部表头分别固定，交叉位置使用更高层级，避免滚动时被其他单元格遮住。 */
.allocation-table .allocation-frozen-mpn,
.allocation-table .allocation-frozen-sold-to {
    position: sticky;
    z-index: 2;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    background: var(--fill-primary);
}
.allocation-table .allocation-frozen-mpn { left: 0; }
.allocation-table .allocation-frozen-sold-to { left: 120px; box-shadow: 1px 0 var(--border-subtle); }
.allocation-table th.allocation-frozen-mpn,
.allocation-table th.allocation-frozen-sold-to { z-index: 3; background: var(--fill-secondary); }
.allocation-table .allocation-week-cell { width: 88px; min-width: 88px; max-width: 88px; padding-left: 8px; padding-right: 8px; }
.allocation-week-cell .allocation-batch-input { width: 72px; padding-left: 8px; padding-right: 8px; }

/* 全局调整的合计、差额和异常位置始终位于结果表上方。 */
.allocation-batch-overview {
    padding: 20px 24px;
    border-top: 1px solid var(--border-subtle);
}

.allocation-batch-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.allocation-batch-totals > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--fill-tertiary, rgba(128, 128, 128, .08));
    border-radius: 12px;
}

.allocation-batch-totals span,
.allocation-batch-overview p {
    color: var(--glyph-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.allocation-batch-totals strong {
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.allocation-batch-reason {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}

.allocation-batch-reason input,
.allocation-batch-input {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font-size: 16px;
}

.allocation-batch-reason input { flex: 1; min-width: 0; }
.allocation-batch-input { width: 112px; }
/* 客户与数量在同一汇总行内编辑，长名称换行，变更数量同时显示原值提示。 */
.allocation-table .allocation-customer-cell { min-width: 360px; max-width: none; }
.allocation-customer-editor { min-width: 360px; max-width: 560px; display: grid; gap: 10px; white-space: normal; }
.allocation-customer-week { display: flex; align-items: center; gap: 8px; color: var(--glyph-secondary); font-size: 12px; }
.allocation-customer-week select { min-height: 36px; padding: 4px 8px; background: var(--fill-primary); color: var(--glyph-primary); border: 1px solid var(--border-primary); border-radius: 6px; }
.allocation-customer-item { display: grid; grid-template-columns: minmax(0, 1fr) 80px 12ch; align-items: center; gap: 8px; }
.allocation-customer-item span { min-width: 0; overflow-wrap: anywhere; }
.allocation-customer-item .allocation-customer-demand { white-space: nowrap; font-variant-numeric: tabular-nums; }
.allocation-customer-item .allocation-batch-input { width: 80px; min-width: 0; }
.allocation-batch-input.is-changed { color: var(--status-error, #c00); font-weight: 600; }
.allocation-batch-checks summary { cursor: pointer; padding: 12px 0; }
.allocation-batch-checks > div { max-height: 220px; overflow: auto; }
.allocation-batch-overview .is-mismatch { color: var(--status-error, #c00); }

@media (max-width: 768px) {
    .allocation-batch-overview { padding: 16px; }
    .allocation-batch-totals { gap: 8px; }
    .allocation-batch-totals > div { padding: 12px; }
    .allocation-batch-reason { align-items: stretch; flex-direction: column; gap: 8px; }
}

.allocation-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 18px 24px;
    border-top: 1px solid var(--border-subtle);
}

.allocation-pagination button {
    min-height: 44px;
}

@media (max-width: 1180px) {
    .allocation-source-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .allocation-rules-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    [data-allocation-dashboard] .allocation-source-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .allocation-lob-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .allocation-control-panel > .panel-heading-action {
        align-items: stretch;
        flex-direction: column;
    }
    .allocation-control-panel .allocation-result-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
    .allocation-control-panel .allocation-result-actions button {
        width: 100%;
        min-width: 0;
    }

    .allocation-source-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .allocation-message,
    .allocation-run-status {
        margin-right: 16px;
        margin-left: 16px;
    }

    .allocation-rules-heading,
    .allocation-rule-editor-heading,
    .allocation-rules-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .allocation-rules-lob-field,
    .allocation-rules-lob-field select {
        width: 100%;
    }

    .allocation-rules-message {
        margin-right: 16px;
        margin-left: 16px;
    }

    .allocation-rules-grid {
        padding: 16px;
    }
}


@media (max-width: 640px) {


    .login-shell {
        padding: 16px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .manual-entry-dialog-body {
        padding: 16px;
    }

    .compliance-upload-dialog-body {
        padding: 16px;
    }

    .compliance-period-summary {
        grid-template-columns: 1fr;
    }

    .upload-result-dialog-body {
        padding: 10px;
    }

    .manual-opportunity-row,
    .manual-candidate-grid,
    .manual-entry-form-grid {
        grid-template-columns: 1fr;
    }

    .manual-candidate-wide,
    .manual-entry-field-wide {
        grid-column: auto;
    }

    .manual-lookup-button {
        width: 100%;
    }
}
.accy-entry-details {
    display: grid;
    gap: 16px;
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.iphone-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.iphone-candidate-field { margin-top: 16px; }
.iphone-preview-dialog { width: min(1440px, calc(100vw - 48px)); }
.iphone-preview-dialog .upload-confirm-bar p { color: var(--glyph-secondary); }
[data-iphone-input] .sales-upload-table { min-width: 1900px; }

@media (max-width: 760px) {
    .iphone-entry-grid { grid-template-columns: 1fr; }
}

/* 手工分货调整窗口：长客户名称可换行，数量输入保留清晰标签。 */
.allocation-adjustment-dialog { width: min(760px, 94vw); }
.allocation-adjustment-dialog form { padding: 24px; }
.allocation-adjustment-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 14px 0; }
.allocation-adjustment-field input { width: 120px; padding: 8px; }
.allocation-adjustment-field textarea { width: 65%; min-height: 72px; padding: 8px; }

/* 分货模板：常用操作集中显示，上传和版本详情按需展开，表格独立滚动。 */
#thursday-template-view .page-intro { margin-bottom: 16px; }
.thursday-template-controls,
.thursday-template-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    padding: 16px;
}
.thursday-template-upload { padding: 12px 0 4px; }
.thursday-template-controls label,
.thursday-template-upload label {
    display: grid; gap: 4px; min-width: 0; max-width: 100%;
    color: var(--glyph-secondary); font-size: 13px;
}
.thursday-template-controls input,
.thursday-template-controls select,
.thursday-template-upload input { min-height: 44px; max-width: 100%; }
.thursday-template-controls input,
.thursday-template-controls select {
    border: 1px solid var(--border-primary); border-radius: 8px; padding: 8px 12px;
    background: var(--fill-primary); color: var(--glyph-primary); font: inherit; font-size: 16px;
}
#thursday-template-view [data-template-week] { width: 160px; }
.thursday-template-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#thursday-template-view button { min-height: 44px; padding-inline: 12px; font-size: 14px; }
#thursday-template-view [data-template-status].is-error { color: var(--semantic-red); }
#thursday-template-view [data-template-meta] { overflow-wrap: anywhere; }
.thursday-template-summary {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px;
    padding: 0 16px 8px; border-bottom: 1px solid var(--border-subtle);
    color: var(--glyph-secondary); font-size: 13px;
}
.thursday-template-summary > p { flex: 1 1 280px; margin: 0; }
.thursday-template-toggles { display: flex; gap: 16px; flex-shrink: 0; }
/* 展开区独占下方一行，触发按钮始终留在状态栏中，避免展开时重新排位。 */
.thursday-template-details { min-width: 0; flex-basis: 100%; }
#thursday-template-view .thursday-template-toggle {
    display: inline-flex; align-items: center; gap: 4px; padding: 0;
    border: 0; background: transparent; color: var(--action-text);
    font: inherit; cursor: pointer; white-space: nowrap;
}
.thursday-template-toggle::before { content: "▸"; width: 8px; }
.thursday-template-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.thursday-template-details p { margin: 4px 0 8px; line-height: 1.5; }
.thursday-template-toggle:focus-visible {
    outline: 2px solid var(--action-text); outline-offset: 2px; border-radius: 4px;
}

#thursday-template-view button:disabled { opacity: 0.45; cursor: default; }
.thursday-template-upload input::file-selector-button {
    min-height: 44px; margin-right: 12px; padding: 0 14px;
    border: 1px solid var(--border-primary); border-radius: 8px;
    background: var(--fill-primary); color: var(--action-text); font: inherit; cursor: pointer;
}

#thursday-template-view .thursday-template-version-field { flex: 1 1 240px; max-width: 360px; }
#thursday-template-view [data-template-version] { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 760px) {
    #thursday-template-view .thursday-template-version-field { flex-basis: 100%; max-width: none; }
    .thursday-template-actions { width: 100%; }
    .thursday-template-actions button { flex: 1 1 auto; }
}

/* 分货模板选择使用完整宽度展示版本来源，避免挤压就绪卡片。 */
.allocation-source-selection {
    display: grid;
    grid-column: 1 / -1;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}
.allocation-source-selection label { font-size: 13px; font-weight: 600; }
.allocation-source-selection select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--fill-primary);
    color: var(--glyph-primary);
    font: inherit;
    font-size: 16px;
    text-overflow: ellipsis;
}
.allocation-source-selection p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--glyph-secondary); }
.allocation-template-link { color: var(--action-text); font-size: 13px; min-height: 24px; text-decoration: underline; text-underline-offset: 3px; }

/* 当前录入材料状态覆盖斑马纹及右侧固定操作格，文字保留可读对比。 */
[data-current-table-body] tr.material-row-fail > td { background: var(--danger-soft); color: var(--semantic-red); }
[data-current-table-body] tr.material-row-unmatched > td { background: var(--fill-secondary); color: var(--glyph-secondary); }
.current-material-actions { display: flex; gap: 8px; justify-content: center; }
.current-material-actions button { min-height: 44px; white-space: nowrap; }
.material-row-status { display: block; margin-top: 6px; font-size: 12px; text-align: center; }
.material-dialog, .material-confirm-dialog { border: 1px solid var(--border-subtle); border-radius: 16px; padding: 24px; color: var(--glyph-primary); background: var(--fill-primary); max-height: 90vh; overflow: auto; }
.material-dialog { width: min(1080px, calc(100vw - 32px)); }
.material-confirm-dialog { width: min(480px, calc(100vw - 32px)); }
.material-dialog::backdrop, .material-confirm-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.material-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.material-dialog-heading h3, .material-dialog-heading h4 { margin: 0; overflow-wrap: anywhere; }
.material-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }
.material-dialog button, .material-confirm-dialog button { min-height: 44px; }
.material-dialog-message, .material-review-meta { color: var(--glyph-secondary); font-size: 13px; }
.material-review-list { display: grid; gap: 16px; }
.material-review-card { padding: 20px; border: 1px solid var(--border-subtle); border-radius: 12px; }
.material-review-card p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; line-height: 1.5; }
.material-review-customer { font-weight: 600; }
.material-review-status { font-weight: 600; }
.material-review-status.is-fail, .material-error { color: var(--semantic-red); }
.material-review-status.is-pass { color: var(--semantic-green); }
.material-dialog [data-material-approve]:disabled {
    background: var(--fill-secondary);
    color: var(--glyph-secondary);
    cursor: not-allowed;
    opacity: 1;
}
.material-review-card [data-material-approval-hint] { margin: 8px 0 0; }
.material-file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.material-file-list button { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.material-preview { margin-top: 20px; }
.material-preview iframe { width: 100%; height: 65vh; border: 1px solid var(--border-subtle); border-radius: 8px; }
.material-preview img { max-width: 100%; height: auto; }
.material-preview a { color: var(--action-text); white-space: nowrap; }
@media (max-width: 640px) {
    .material-dialog, .material-confirm-dialog { padding: 16px; }
    .material-dialog-heading { align-items: flex-start; flex-direction: column; }
    .material-dialog-actions { width: 100%; }
    .material-review-card { padding: 14px; }
}

/* UD 通知在独立窗口中核对收件人及正文，窄屏保持可滚动。 */
.ud-notice-dialog {
    width: min(1100px, 94vw);
    max-height: 90vh;
    padding: 24px;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    color: #1d1d1f;
    background: #fff;
    overflow: auto;
}
.ud-notice-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.ud-notice-dialog details { margin: 16px 0; border-top: 1px solid #d2d2d7; padding-top: 12px; }
.ud-notice-dialog summary { cursor: pointer; font-weight: 600; }
.ud-notice-dialog p { overflow-wrap: anywhere; }
.ud-notice-dialog iframe { width: 100%; height: 360px; border: 1px solid #d2d2d7; background: #fff; }

/* 急单追溯沿用现有明暗主题；时间线用文字区分事件，不依赖颜色表达状态。 */
.demand-trace-search, .demand-trace-toolbar, .demand-trace-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
    padding: 16px 24px;
}
.demand-trace-search input {
    min-height: 44px;
    font-size: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    color: var(--glyph-primary);
    background: var(--fill-primary);
}
.demand-trace-summary { background: var(--info-soft); color: var(--info-strong); font-weight: 600; }
.demand-trace-toolbar { justify-content: space-between; align-items: center; }
.demand-trace-timeline { list-style: none; margin: 0 24px; padding: 0 0 0 24px; border-left: 2px solid var(--border-primary); }
.demand-trace-timeline > li { position: relative; padding: 16px; margin-bottom: 16px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--fill-secondary); }
.demand-trace-timeline > li::before { content: ''; position: absolute; left: -31px; top: 24px; width: 10px; height: 10px; border-radius: 50%; background: var(--action-text); }
.demand-trace-timeline p { margin: 4px 0; overflow-wrap: anywhere; }
.demand-trace-event-title { font-weight: 600; }
.demand-trace-timeline details { margin-top: 12px; color: var(--glyph-secondary); }
.demand-trace-snapshots { padding: 24px; }
.demand-trace-snapshots td details { max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
[data-demand-trace] summary { cursor: pointer; padding: 8px 0; }
@media (max-width: 768px) {
    .demand-trace-search { padding: 16px; flex-direction: column; align-items: stretch; }
    .demand-trace-timeline { margin: 0 16px; }
    .demand-trace-snapshots { padding: 16px; }
}

/* 邮件看板：各类发送任务独立展示，沿用原有色彩与对话框，窄屏单列。 */
.email-tasks { padding: 24px; margin-bottom: 24px; }
.email-task-editor { border-top: 1px solid var(--border-subtle); margin-top: 24px; padding-top: 24px; }
.email-task-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; border: 0; padding: 0; margin: 20px 0; min-width: 0; }
.email-task-fields legend { font-weight: 600; margin-bottom: 12px; }
.email-task-fields label, .email-task-field-stack { display: grid; gap: 8px; min-width: 0; align-content: start; }
.email-task-fields input:not([type="checkbox"]), .email-task-fields textarea, .email-task-fields select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; color: var(--glyph-primary); background: var(--fill-primary); border: 1px solid var(--border-primary); border-radius: 9px; font: inherit; }
.email-task-fields textarea { resize: vertical; }
.email-task-fields .email-task-check { display: flex; align-items: center; min-height: 44px; }
.email-task-check input { width: 18px; height: 18px; accent-color: var(--action-fill); }
.email-record-heading { margin-top: 32px; }
.email-task-dialog { max-width: min(900px, calc(100vw - 32px)); }
.email-task-preview-message { border-top: 1px solid var(--border-subtle); padding: 16px 0; overflow-wrap: anywhere; }
.email-task-preview-message pre { white-space: pre-wrap; font: inherit; color: var(--glyph-primary); }
.email-tasks [hidden] { display: none !important; }
@media (max-width: 600px) { .email-tasks { padding: 16px; } }
.email-dashboard-context, .email-card-heading, .email-group-labels, .email-card-actions {
    display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
}
.email-dashboard-context { flex-shrink: 0; }
.email-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.email-card { padding: 24px; }
.email-card-heading { justify-content: space-between; }
.email-card-heading h3 { margin: 0; font-size: 20px; font-weight: 600; }
.email-card > p { margin: 16px 0; }
.email-card-note, .email-dashboard-status, .email-card-result { color: var(--glyph-secondary); }
.email-card-note { font-size: 13px; line-height: 1.5; }
.email-group-labels { margin: 20px 0; gap: 8px; }
.email-group-labels label {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
    padding: 8px 12px; border-radius: 8px; background: var(--fill-secondary); cursor: pointer;
}
.email-group-labels input { width: 18px; height: 18px; margin: 0; accent-color: var(--action-fill); }
.email-card-actions { margin-top: 20px; }
.email-ud-fields { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 12px; margin-top: 20px; }
.email-ud-fields label { display: grid; gap: 8px; min-width: 0; font-size: 13px; color: var(--glyph-secondary); }
.email-ud-fields select {
    width: 100%; min-width: 0; min-height: 44px; padding: 8px;
    border: 1px solid var(--border-primary); border-radius: 8px;
    background: var(--fill-primary); color: var(--glyph-primary); font: inherit; font-size: 16px;
}
.email-dashboard-status:empty, .email-card-result:empty { display: none; }
.email-card-result { overflow-wrap: anywhere; line-height: 1.5; font-size: 13px; }
.email-dashboard button { min-height: 44px; }
@media (max-width: 1000px) { .email-dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
    .email-card { padding: 16px; }
    .email-dashboard .page-intro { flex-wrap: wrap; gap: 12px; }
    .email-ud-fields { grid-template-columns: 1fr; }
}


@media (max-width: 640px) {
    .product-tabs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-bottom: 24px;
    }
    .product-tab {
        min-height: 44px;
        padding: 0 6px;
        font-size: 12px;
    }
    .product-summary-copy h1 {
        font-size: 28px;
    }
    .workspace-heading-line {
        gap: 8px;
    }
    .product-summary-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .product-summary-actions > * {
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 13px;
    }
    .upload-dashboard-heading {
        padding: 12px 16px;
    }
    .dashboard-heading-actions {
        gap: 8px;
    }
    .dashboard-heading-actions .template-download-button {
        width: auto;
        padding: 0 12px;
    }
    .product-summary-actions > .upload-control {
        grid-column: 1 / -1;
    }
    .current-empty-state {
        padding: 40px 20px 48px;
    }
}

/* 首页使用 Apple 官网的浅灰白工作面；颜色限定在首页，业务页和侧栏继续沿用原主题。 */
.app-shell[data-active-view="home"] {
    --home-bg: #f5f5f7;
    --home-text: #1d1d1f;
    --home-text-muted: #626267;
    --home-line: #d2d2d7;
    --home-entry-line: #b4b4bb;
    --home-hover: rgba(29, 29, 31, 0.045);
    --home-accent: #424245;
    --home-ribbon: #8f8f97;
    --home-flow: #86868b;
}

.app-shell[data-active-view="home"] .app-main {
    background: var(--home-bg);
    color: var(--home-text);
    color-scheme: light;
}

.app-shell[data-active-view="home"] .workspace-content {
    max-width: none;
    padding: 48px 64px;
}

.home-view {
    --focus-ring: var(--home-text);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    max-width: 1120px;
    min-height: calc(100svh - 96px);
    margin: 0 auto;
    padding: clamp(160px, 30vh, 320px) 0 72px;
    color: var(--home-text);
    animation: none;
}

.home-view ::selection {
    background: var(--home-text);
    color: var(--home-bg);
}

/* 长线保持原有垂直位置，标题从线的上侧显现，不挤动下方菜单。 */
.home-heading {
    position: relative;
}

.home-title-clip {
    position: absolute;
    bottom: 1px;
    left: 0;
    width: 100%;
    padding-bottom: 24px;
    overflow: hidden;
}

.home-heading h1 {
    display: flex;
    align-items: center;
    gap: 22px;
    margin: 0;
    color: var(--home-text);
    font-weight: 600;
}

/* 三道圆角曲线沿用已选定的汇流标识；默认即为完整图形，入场只覆盖动态状态。 */
.home-brand-mark {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    overflow: visible;
}

.home-brand-curve {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    opacity: var(--curve-opacity);
}

.home-brand-curve-first {
    --curve-opacity: 0.45;
    --curve-start-x: 24px;
    --curve-start-y: -16px;
    --curve-delay: 320ms;
}

.home-brand-curve-second {
    --curve-opacity: 0.72;
    --curve-start-x: 14px;
    --curve-start-y: 12px;
    --curve-delay: 460ms;
}

.home-brand-curve-third {
    --curve-opacity: 1;
    --curve-start-x: 4px;
    --curve-start-y: 28px;
    --curve-delay: 600ms;
}

.home-brand-point {
    fill: currentColor;
    transform-box: fill-box;
    transform-origin: center;
}

.home-brand-name {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.home-brand-latin {
    font-size: 42px;
    line-height: 1;
    letter-spacing: -0.025em;
}

.home-brand-chinese {
    color: var(--home-text-muted);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.08em;
}

.home-entry-line {
    height: 1px;
    background: var(--home-entry-line);
    transform-origin: center;
}

/* 每次从业务页返回时重播入场；默认内容可见，脚本失效也不会藏住入口。 */
.home-view[data-entrance="playing"] .home-entry-line {
    animation: home-line-enter 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.home-view[data-entrance="playing"] .home-heading h1 {
    animation: home-title-enter 760ms cubic-bezier(0.16, 1, 0.3, 1) 240ms both;
}

.home-view[data-entrance="playing"] .home-brand-curve {
    animation: home-brand-converge 1280ms cubic-bezier(0.22, 0.61, 0.36, 1) var(--curve-delay) both;
}

.home-view[data-entrance="playing"] .home-brand-point {
    animation: home-brand-settle 260ms ease-out 1780ms both;
}

.home-view[data-entrance="playing"] .home-entry-menu {
    clip-path: inset(0 -16px -16px);
}

.home-view[data-entrance="playing"] .home-entry-menu > * {
    animation: home-menu-enter 640ms cubic-bezier(0.16, 1, 0.3, 1) 280ms both;
}

@keyframes home-line-enter {
    from { opacity: 0.4; transform: scaleX(0); }
    to { opacity: 1; transform: scaleX(1); }
}

@keyframes home-title-enter {
    from { opacity: 0; transform: translateY(calc(100% + 24px)); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes home-brand-converge {
    from {
        opacity: 0;
        stroke-dashoffset: 100;
        transform: translate(var(--curve-start-x), var(--curve-start-y));
    }
    20% { opacity: var(--curve-opacity); }
    to {
        opacity: var(--curve-opacity);
        stroke-dashoffset: 0;
        transform: translate(0, 0);
    }
}

@keyframes home-brand-settle {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes home-menu-enter {
    from { opacity: 0; transform: translateY(-28px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 曲线只承载首页背景，独立合成并禁止命中，文字始终位于其上。 */
.home-ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: var(--home-bg);
}

.home-ambient::before {
    position: absolute;
    inset: -10%;
    content: "";
    background:
        radial-gradient(ellipse at 82% 8%, rgba(255, 255, 255, 0.8), transparent 58%),
        radial-gradient(ellipse at 12% 90%, rgba(210, 210, 215, 0.22), transparent 52%);
    animation: home-light 16s ease-in-out infinite alternate paused;
}

.home-ambient-ribbon {
    position: absolute;
    inset: -8%;
    width: 116%;
    height: 116%;
    opacity: 0.92;
    /* 保留完整的银色曲线轮廓，菜单高度处仍适度减淡，留白区域承载更清晰的流光。 */
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.5) 45%, #000 78%);
    transform-origin: 75% 35%;
    animation: home-ribbon 10s ease-in-out -3s infinite alternate paused;
}

/* 由样式统一接管渐变颜色，缓存中的旧 SVG 也能跟随浅色工作面。 */
.home-ambient-ribbon stop {
    stop-color: var(--home-ribbon);
}

.home-ambient-ribbon-secondary {
    opacity: 0.58;
    transform-origin: 40% 85%;
    animation-name: home-ribbon-secondary;
    animation-duration: 14s;
    animation-delay: -5s;
}

/* 少量高亮线段沿真实曲线流动，进入页面即处于运动阶段，避免像静态壁纸。 */
.home-ambient-flow {
    stroke: var(--home-flow);
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-dasharray: 160 840;
    opacity: 1;
    animation: home-flow 6s linear -2s infinite paused;
}

.home-ambient-flow-offset {
    stroke-width: 2;
    stroke-dasharray: 110 890;
    opacity: 0.85;
    animation-duration: 8s;
    animation-delay: -5s;
}

.home-ambient-flow-lower {
    animation-duration: 9s;
    animation-delay: -3s;
}

.home-view[data-motion-running="true"] .home-ambient::before,
.home-view[data-motion-running="true"] .home-ambient-ribbon,
.home-view[data-motion-running="true"] .home-ambient-flow {
    animation-play-state: running;
}

@keyframes home-ribbon {
    from { transform: translate3d(2%, -3%, 0) rotate(-10deg) scale(1.04); }
    to { transform: translate3d(-5%, 5%, 0) rotate(9deg) scale(1.1); }
}

@keyframes home-ribbon-secondary {
    from { transform: translate3d(-3%, 4%, 0) rotate(6deg); }
    to { transform: translate3d(4%, -5%, 0) rotate(-7deg) scale(1.06); }
}

@keyframes home-flow {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

@keyframes home-light {
    from { opacity: 0.65; transform: translate3d(-3%, 1%, 0); }
    to { opacity: 1; transform: translate3d(3%, -2%, 0); }
}

.home-groups {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 48px 36px;
}

/* 不为未授权分组占列；少于四组时整行居中，并适当拉开组间距。 */
@media (min-width: 1181px) {
    .home-groups:not(:has(> .home-menu-group:nth-child(4))) {
        column-gap: 64px;
    }
}

/* 按用户参考图保留开放式分组，以细线和留白组织入口，不增加卡片容器。 */
.home-menu-group {
    flex: 0 1 calc((100% - 108px) / 4);
    min-width: 0;
}

.home-menu-group h2,
.home-access-empty h2 {
    margin: 0;
    color: var(--home-text);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.4;
}

.home-menu-group h2 {
    padding: 0;
}

.home-group-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 72px;
    padding: 20px 0 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.home-group-trigger:focus-visible {
    outline: 2px solid var(--home-accent);
    outline-offset: 4px;
    border-radius: 4px;
}

.home-group-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--home-text-muted);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-group-trigger[aria-expanded="true"] .home-group-chevron {
    transform: rotate(180deg);
}

.home-menu-reveal {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
}

/* 仅脚本初始化成功后折叠菜单；关闭时惯性与焦点由控制器同步，脚本失败仍能访问入口。 */
.home-view[data-menu-reveal-ready="true"] .home-menu-reveal {
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: grid-template-rows 220ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 160ms ease-out, transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s linear 220ms;
}

.home-view[data-menu-reveal-ready="true"] .home-menu-group[data-menu-open="true"] .home-menu-reveal {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-duration: 320ms, 240ms, 320ms, 0s;
    transition-delay: 0s;
}

.home-menu-list {
    min-height: 0;
    overflow: hidden;
    /* 为菜单悬停底色保留两侧空间，折叠裁切时仍与组标题对齐。 */
    margin: 0 -12px;
    padding: 0 12px;
    list-style: none;
}

.home-menu-list > li {
    border-bottom: 1px solid var(--home-line);
}

.home-menu-link {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 14px;
    align-items: start;
    gap: 12px;
    min-height: 84px;
    margin: 0 -12px;
    padding: 14px 12px;
    border-radius: 10px;
    color: var(--home-text);
    text-decoration: none;
    transition: background-color 160ms ease;
}

.home-menu-link:hover {
    background: var(--home-hover);
    color: var(--home-text);
}

.home-menu-link:focus-visible {
    outline: 2px solid var(--home-accent);
    outline-offset: -2px;
}

.home-menu-icon {
    display: flex;
    margin-top: 1px;
    color: var(--home-text-muted);
    transition: color 160ms ease;
}

.home-menu-icon .nav-icon {
    width: 24px;
    height: 24px;
}

.home-menu-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.home-menu-name {
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    overflow-wrap: anywhere;
}

.home-menu-description {
    color: var(--home-text-muted);
    font-size: 13px;
    line-height: 1.65;
}

.home-menu-chevron {
    align-self: center;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: var(--home-text-muted);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 180ms ease;
}

.home-menu-link:hover .home-menu-chevron {
    transform: translateX(3px);
}

.home-menu-link:hover .home-menu-icon {
    color: var(--home-accent);
}

.home-access-empty {
    margin-bottom: 64px;
    padding: 32px 0;
}

.home-access-empty p {
    margin: 12px 0 0;
    color: var(--home-text-muted);
    line-height: 1.7;
}

@media (max-width: 1180px) {
    .home-groups {
        column-gap: 48px;
    }
    .home-menu-group {
        flex-basis: calc((100% - 48px) / 2);
    }
}

@media (max-width: 900px) {
    .app-shell[data-active-view="home"] .workspace-content {
        padding: 40px 32px;
    }
}

@media (max-width: 640px) {
    .app-shell[data-active-view="home"] .workspace-content {
        padding: 32px 24px;
    }
    .home-view {
        min-height: calc(100svh - 64px);
        padding-top: 104px;
    }
    .home-groups {
        gap: 36px;
    }
    .home-menu-group {
        flex-basis: 100%;
    }
    .home-menu-group h2 {
        font-size: 20px;
    }
    .home-group-trigger {
        min-height: 64px;
        padding: 16px 0 12px;
    }
    .home-menu-link {
        min-height: 84px;
        padding: 14px 12px;
    }
    .home-ambient-ribbon {
        width: 190%;
        left: -80%;
        opacity: 0.72;
    }
    .home-ambient-ribbon-secondary {
        opacity: 0.46;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-view[data-entrance="playing"] .home-entry-line,
    .home-view[data-entrance="playing"] .home-heading h1,
    .home-view[data-entrance="playing"] .home-brand-curve,
    .home-view[data-entrance="playing"] .home-brand-point,
    .home-view[data-entrance="playing"] .home-entry-menu > * {
        animation: none;
    }
    .home-view[data-entrance="playing"] .home-entry-menu {
        clip-path: none;
    }
    .home-ambient::before,
    .home-ambient-ribbon,
    .home-ambient-flow {
        animation: none;
    }
    .home-ambient-flow {
        display: none;
    }
    .home-menu-chevron {
        transition: none;
    }
    .home-group-chevron {
        transition: none;
    }
    .home-view[data-menu-reveal-ready="true"] .home-menu-reveal,
    .home-view[data-menu-reveal-ready="true"] .home-menu-group[data-menu-open="true"] .home-menu-reveal {
        transform: none;
        transition: opacity 100ms ease-out, visibility 0s;
    }
    .home-menu-link:hover .home-menu-chevron {
        transform: none;
    }
}

/* 游客授权沿用共享工作台令牌；公开布局不预留导航空间。 */
.app-shell.public-workspace { grid-template-columns: minmax(0, 1fr); padding-top: 0; }
.public-workspace .app-main { grid-column: 1; margin-left: 0; }
.access-view { max-width: 1100px; margin-inline: auto; }
.access-load-bar, .access-object-row, .access-save-row, .access-address { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.access-load-bar { justify-content: space-between; margin-block: 20px; }
.access-load-bar p, .access-save-row p { margin: 0; color: var(--glyph-secondary); }
.access-object-row { align-items: end; margin-bottom: 24px; }
.access-object-row > label, .access-address > label { flex: 1; min-width: 200px; }
.access-form { padding: 24px; }
.access-form > fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.access-form-title { float: none; font-size: 20px; font-weight: 600; margin-bottom: 20px; }
.access-account-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.access-view .auth-field { margin: 0; }
.access-view select, .access-view input[type="search"], .guest-reader-controls select { min-height: 44px; width: 100%; border: 1px solid var(--border-primary); border-radius: 9px; background: var(--fill-primary); color: var(--glyph-primary); padding: 8px 12px; font: inherit; }
.access-view input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--action-fill); flex: 0 0 18px; }
.access-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.access-help { color: var(--glyph-secondary); font-size: 13px; line-height: 1.5; margin-block: 8px 16px; }
.access-permission-table caption { caption-side: top; color: var(--glyph-primary); font-weight: 600; padding-block: 12px; text-align: left; }
.access-permission-table td label { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.access-scope { margin-top: 28px; }
.access-dealers { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 12px 16px; margin-top: 16px; min-width: 0; }
.access-dealers legend { float: none; width: auto; font-size: 14px; padding-inline: 6px; }
.access-dealers > div { max-height: 240px; overflow: auto; }
.access-dealers .access-check { border-bottom: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
.access-save-row { border-top: 1px solid var(--border-subtle); padding-top: 20px; margin-top: 24px; }
.access-public-select { margin-bottom: 24px !important; }
.access-address { align-items: end; margin-top: 20px; }
.access-view [data-access-feedback].is-error, .access-view [data-access-status].is-error { color: var(--semantic-red); }
.access-view .access-field-error { color: var(--semantic-red); font-size: 13px; line-height: 1.5; margin: 0; }
.access-view .auth-field .access-help { margin: 0; }
@media (max-width: 640px) {
    .access-form { padding: 16px; }
    .access-account-fields { grid-template-columns: minmax(0, 1fr); }
    .access-save-row { align-items: start; flex-direction: column; }
    .access-object-row, .access-address { gap: 12px; }
}
.guest-reader-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 20px; }
.guest-reader-controls .auth-field { flex: 1 1 200px; min-width: 0; }
.guest-reader-controls select { --select-control-height: 48px; font-size: 16px; }
.guest-reader > .workspace-panel > .access-help { margin: 0; padding: 0 20px 16px; }
.guest-reader-pagination { display: flex; justify-content: flex-end; gap: 16px; align-items: center; padding: 16px 20px; }
.guest-reader-message { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border-primary); border-radius: 12px; color: var(--glyph-primary); background: var(--fill-primary); }
.guest-reader-message .panel-heading { display: flex; justify-content: space-between; gap: 16px; }
.guest-reader-message iframe { display: block; width: 100%; height: min(70dvh, 700px); border: 0; background: white; }
.guest-reader-message::backdrop { background: rgb(0 0 0 / 40%); }
.guest-reader .sales-upload-table caption { padding: 12px 20px; text-align: left; }
@media (max-width: 600px) {
    .guest-reader-controls { gap: 12px; padding: 16px; }
    .guest-reader-controls .auth-field { flex-basis: 100%; }
    .guest-reader-pagination { justify-content: center; gap: 12px; padding: 16px; }
}

/* 共享单选框兼容层：同时覆盖静态与动态控件，明确高度以避开 Safari 的紧凑原生外观。
   放在业务样式之后，防止各页面的 background 简写清除箭头；多选和多行列表保留原生显示。 */
/* 部署期间旧模板可能仍在缓存中，避免旧包装箭头与共享背景箭头同时出现。 */
.compliance-select > svg,
.guest-reader-select > svg {
    display: none;
}

select:not([multiple]):not([size]),
select:not([multiple])[size="0"],
select:not([multiple])[size="1"] {
    -webkit-appearance: none;
    appearance: none;
    max-width: 100%;
    height: var(--select-control-height, 44px);
    min-height: 44px;
    padding-block: 0;
    padding-inline: 12px 40px;
    line-height: 20px;
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px 20px;
    text-overflow: ellipsis;
    cursor: pointer;
}

select:not([multiple]):not([size]):disabled,
select:not([multiple])[size="0"]:disabled,
select:not([multiple])[size="1"]:disabled {
    background-color: var(--fill-secondary);
    color: var(--glyph-secondary);
    cursor: not-allowed;
}

/* 高对比度模式恢复系统箭头，让控件跟随用户的可访问性配色。 */
@media (forced-colors: active) {
    select:not([multiple]):not([size]),
    select:not([multiple])[size="0"],
    select:not([multiple])[size="1"] {
        -webkit-appearance: auto;
        appearance: auto;
        background-image: none;
    }
}
