/* ===========================
   Design System — Vercel-inspired
   =========================== */

/* --- CSS Custom Properties --- */
:root {
    /* Primary text */
    --text-primary: #171717;
    /* Secondary text */
    --text-secondary: #4d4d4d;
    /* Tertiary / muted */
    --text-muted: #666666;

    /* Surfaces */
    --bg-white: #ffffff;
    --bg-subtle: #fafafa;
    --bg-hover: #f5f5f5;

    /* Interactive accent (Develop Blue) */
    --accent-blue: #0a72ef;
    --accent-blue-soft: rgba(10, 114, 239, 0.08);
    --accent-blue-hover: #0962d2;

    /* Destructive accent (Ship Red) */
    --accent-red: #ff5b4f;
    --accent-red-soft: rgba(255, 91, 79, 0.08);
    --accent-red-hover: #e54d41;

    /* Semantic colors */
    --accent-green: #28a745;
    --accent-green-soft: rgba(40, 167, 69, 0.08);
    --accent-green-hover: #1e7e34;
    --accent-yellow: #d45a00;
    --accent-yellow-soft: rgba(254, 107, 1, 0.08);
    --accent-purple: #ae3ec9;
    --accent-purple-soft: rgba(174, 62, 201, 0.08);
    --accent-gray: #6c757d;
    --accent-gray-soft: rgba(108, 117, 125, 0.06);

    /* Neutral scale（补齐设计系统灰阶，避免散落硬编码） */
    --gray-400: #aaaaaa;
    --gray-700: #333333;
    --gray-900: #000000;

    /* Chart palette（图表序列色板，--chart-1 ~ --chart-9 为完整序列：1 主色 / 2 蓝 / 3-6 蓝紫冷色 / 7、9 中性灰 / 8 红；
       消费方用 varColor('--chart-N', fallback) 读取） */
    --chart-1: #171717;
    --chart-2: #0a72ef;
    --chart-3: #7928ca;
    --chart-4: #00b4d8;
    --chart-5: #ae3ec9;
    --chart-6: #de1d8d;
    --chart-7: #808080;
    --chart-8: #ff5b4f;
    --chart-9: #b0b0b0;

    /* Z-index 层级（浮层堆叠顺序集中管理，避免散落魔数） */
    --z-navbar: 1020;
    --z-toast: 1080;

    /* Borders & dividers */
    --border-light: #ebebeb;
    --border-hover: #d5d5d5;

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(10, 114, 239, 0.15);

    /* Shadows — shadow-as-border philosophy */
    --shadow-border: 0 0 0 1px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 2px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.1);

    /* Font stacks */
    --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
}

/* ===========================
   Base
   =========================== */

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-white);
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   SVG Icons（sprite 引用，替代原字体图标）
   =========================== */

.icon {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    flex-shrink: 0;
}

/* ===========================
   Navbar
   =========================== */

.navbar {
    background: var(--bg-white) !important;
    box-shadow: var(--shadow-border);
    position: sticky;
    top: 0;
    z-index: var(--z-navbar);
    transition: box-shadow 0.2s ease;
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    border-radius: 6px;
    margin: 0 2px;
    transition: all 0.15s ease;
    padding: 0.5rem 0.75rem !important;
    font-weight: 500;
    font-size: 0.875rem;
    min-height: 36px;
    cursor: pointer;
}

.navbar .nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-hover);
}

.navbar .nav-item.active .nav-link {
    color: var(--text-primary) !important;
    background: var(--bg-hover);
    font-weight: 600;
    position: relative;
}

.navbar .nav-item.active .nav-link::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
}

.navbar .nav-link-title {
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.navbar .navbar-collapse .navbar-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
}

.navbar .navbar-collapse .navbar-nav::-webkit-scrollbar {
    display: none;
}

/* 确保下拉菜单不被裁切 */
.navbar .navbar-collapse {
    overflow: visible !important;
}

.navbar .navbar-toggler {
    border-color: var(--border-light);
    padding: 0.5rem;
}

.navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23171717' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar .avatar {
    border: 1px solid var(--border-light);
    box-shadow: none;
    transition: all 0.15s ease;
    background: var(--bg-subtle) !important;
    color: var(--text-primary);
}

.navbar .nav-link .avatar:hover {
    background: var(--bg-hover) !important;
}

/* Brand pill */
.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--text-primary);
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border-radius: 8px;
    background: var(--bg-white);
    box-shadow: var(--shadow-border);
    transition: all 0.15s ease;
}

.brand-pill:hover {
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    font-size: 0.875rem;
    color: #fff;
}

.brand-text {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ===========================
   Nav tabs — unified style
   =========================== */

.nav-tabs {
    border-bottom: 1px solid var(--border-light);
}

.nav-tabs .nav-item .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.nav-tabs .nav-item .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border: none;
}

.nav-tabs .nav-item .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-hover);
    font-weight: 600;
    border: none;
}

/* ===========================
   Cards
   =========================== */

.card {
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease;
    background: var(--bg-white);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.row-deck > .col-sm-6 > .card:hover,
.row-deck > .col-lg-3 > .card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
}

.card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    color: var(--text-secondary);
    font-size: 1rem;
}

.card-body {
    padding: 1.25rem;
}

/* ===========================
   Stat cards (Dashboard)
   =========================== */

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
}

.stat-card .subheader {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.stat-card .h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 0.375rem;
    letter-spacing: -0.04em;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-card .stat-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.stat-card .stat-icon-badge.bg-green-soft {
    background: var(--accent-green-soft);
    color: var(--accent-green);
}

.stat-card .stat-icon-badge.bg-purple-soft {
    background: var(--accent-purple-soft);
    color: var(--accent-purple);
}

.stat-card .stat-icon-badge.bg-blue-soft {
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
}

.stat-card .stat-icon-badge.bg-red-soft {
    background: var(--accent-red-soft);
    color: var(--accent-red);
}

.stat-card .stat-icon-badge.bg-yellow-soft {
    background: var(--accent-yellow-soft);
    color: var(--accent-yellow);
}

.stat-card .stat-icon-badge.bg-gray-soft {
    background: var(--accent-gray-soft);
    color: var(--accent-gray);
}

/* ===========================
   Buttons
   =========================== */

.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--text-primary);
    border: none;
    box-shadow: none;
    color: #fff;
}

.btn-primary:hover {
    background: var(--gray-700);
    color: #fff;
}

.btn-primary:active {
    background: var(--gray-900);
    color: #fff;
}

/* Outline primary — dark outline */
.btn-outline-primary {
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-white);
}

.btn-outline-primary:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: #fff;
    box-shadow: none;
}

.btn-outline-secondary {
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    background: var(--bg-white);
}

.btn-outline-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--text-primary);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-sm {
    border-radius: 5px;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

/* ===========================
   Tables
   =========================== */

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    transition: background 0.1s ease;
    color: var(--text-primary);
}

.table tbody tr:hover td {
    background: var(--bg-subtle);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-responsive {
    border-radius: 0 0 8px 8px;
}

.container-xxl {
    max-width: 1920px;
}

/* ===========================
   Forms
   =========================== */

.form-control {
    border-radius: 6px;
    border: 1px solid var(--border-light);
    transition: all 0.15s ease;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white);
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--focus-ring);
}

.form-control:hover:not(:focus) {
    border-color: var(--border-hover);
}

.form-control-sm {
    border-radius: 5px;
}

.form-select {
    border-radius: 6px;
    border: 1px solid var(--border-light);
    transition: all 0.15s ease;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white);
}

.form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--focus-ring);
}

.form-select:hover:not(:focus) {
    border-color: var(--border-hover);
}

.form-select-sm {
    border-radius: 5px;
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

/* ===========================
   Pagination
   =========================== */

.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: var(--bg-white);
}

.pagination .page-link:hover {
    background: var(--bg-subtle);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--text-primary);
    border-color: var(--text-primary);
    box-shadow: none;
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--bg-white);
}

/* ===========================
   Badges
   =========================== */

.badge {
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.6875rem;
    padding: 0.25em 0.625em;
    letter-spacing: 0.02em;
}

.bg-success-lt {
    background: var(--accent-green-soft) !important;
    color: var(--accent-green) !important;
    border: none;
}

.bg-danger-lt {
    background: var(--accent-red-soft) !important;
    color: var(--accent-red-hover) !important;
    border: none;
}

.bg-info-lt {
    background: var(--accent-blue-soft) !important;
    color: var(--accent-blue) !important;
    border: none;
}

.bg-warning-lt {
    background: var(--accent-yellow-soft) !important;
    color: var(--accent-yellow) !important;
    border: none;
}

.bg-secondary-lt {
    background: var(--accent-gray-soft) !important;
    color: var(--accent-gray) !important;
    border: none;
}

.bg-purple-lt {
    background: var(--accent-purple-soft) !important;
    color: var(--accent-purple) !important;
    border: none;
}

.bg-blue-lt {
    background: var(--accent-blue-soft) !important;
    color: var(--accent-blue) !important;
    border: none;
}

/* ===========================
   Alerts
   =========================== */

.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    animation: alertSlideIn 0.25s ease;
    font-weight: 500;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: var(--accent-red-soft);
    color: var(--accent-red-hover);
    box-shadow: none;
    border-left: 3px solid var(--accent-red);
}

.alert-success {
    background: var(--accent-green-soft);
    color: var(--accent-green-hover);
    box-shadow: none;
    border-left: 3px solid var(--accent-green);
}

.alert-info {
    background: var(--accent-blue-soft);
    color: var(--accent-blue-hover);
    box-shadow: none;
    border-left: 3px solid var(--accent-blue);
}

.alert-warning {
    background: var(--accent-yellow-soft);
    color: var(--accent-yellow);
    box-shadow: none;
    border-left: 3px solid var(--accent-yellow);
}

.alert-icon {
    width: 1.25rem;
    display: inline-flex;
    justify-content: center;
}

/* ===========================
   Footer
   =========================== */

.footer {
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
    margin-top: auto;
    padding: 1.25rem 0;
}

.footer .list-inline-item {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a.link-secondary {
    transition: color 0.15s;
    color: var(--text-secondary);
}

.footer a.link-secondary:hover {
    color: var(--text-primary);
}

/* ===========================
   Login page
   =========================== */

.page-center {
    background: var(--bg-subtle);
    background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(10, 114, 239, 0.05), transparent);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-center .card-md {
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    border: none;
}

.page-center .card-md .card-body {
    padding: 2.5rem;
}

.page-center .h2 {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.page-center .form-control:focus {
    box-shadow: var(--focus-ring);
}

/* ===========================
   Dropdown
   =========================== */

.dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    animation: dropdownSlideIn 0.15s ease;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    transition: all 0.1s ease;
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
}

/* ===========================
   Scrollbar
   =========================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 768px) {
    .stat-card .h1 {
        font-size: 1.75rem;
    }

    .card-header .card-actions {
        margin-top: 0.75rem;
    }

    .navbar .nav-link {
        padding: 0.375rem 0.75rem !important;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ===========================
   Reduced motion（尊重系统"减弱动态效果"设置）
   =========================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================
   Toast notifications
   =========================== */

.toast-container-global {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-custom {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 280px;
    max-width: 420px;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toast-custom:hover {
    transform: scale(1.01);
}

.toast-custom.removing {
    animation: toastSlideOut 0.2s ease forwards;
}

/* 语义色只落在图标上，保持 Vercel 的白底卡片气质 */
.toast-custom.toast-success .icon {
    color: var(--accent-green);
}
.toast-custom.toast-error .icon {
    color: var(--accent-red);
}
.toast-custom.toast-warning .icon {
    color: var(--accent-yellow);
}
.toast-custom.toast-info .icon {
    color: var(--accent-blue);
}

.toast-custom .icon { font-size: 1.1rem; flex-shrink: 0; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(80px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(80px) scale(0.95); }
}

/* ===========================
   Tab transition
   =========================== */

.tab-pane {
    animation: tabFadeIn 0.25s ease;
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Stat number
   =========================== */

.stat-number {
    font-variant-numeric: tabular-nums;
    transition: none;
}

/* ===========================
   Modal — Vercel-inspired
   =========================== */

.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal-header .btn-close {
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.modal-header .btn-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
    background: var(--bg-subtle);
}

/* ===========================
   Table
   =========================== */

/* 勾选框列的固定窄宽（替代废弃的 <th width> 属性） */
.col-check {
    width: 36px;
}

/* ===========================
   Print
   =========================== */

@media print {
    .navbar, .footer, .btn, .card-actions {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid var(--border-light) !important;
    }
}

/* ===========================
   Data calendar (POS summary)
   =========================== */

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-head {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 4px;
}

.cal-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-decoration: none;
}

a.cal-cell:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cal-cell-out {
    visibility: hidden;
}

.cal-cell-btn {
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.cal-cell-has {
    background: var(--accent-green-soft);
    color: var(--accent-green);
    font-weight: 500;
}

.cal-cell-none {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

.cal-cell-today {
    box-shadow: inset 0 0 0 1.5px var(--text-primary);
    font-weight: 600;
}

.cal-month-label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.cal-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: -1px;
}

.cal-swatch-has {
    background: var(--accent-green-soft);
    box-shadow: inset 0 0 0 1px var(--accent-green);
}

.cal-swatch-none {
    background: var(--bg-subtle);
    box-shadow: inset 0 0 0 1px var(--border-hover);
}

/* ===========================
   Filter widths（筛选控件固定宽度，替代内联 width）
   =========================== */

.filter-w-xs {
    width: 7.5rem;
}

.filter-w-sm {
    width: 8.75rem;
}

.filter-w-md {
    width: 10rem;
}

.filter-w-lg {
    width: 11.25rem;
}

/* ===========================
   Table cells（数字列 / 编码列）
   =========================== */

.cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cell-code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.fw-semibold {
    font-weight: 600 !important;
}

/* ===========================
   Empty state（表格空数据占位）
   =========================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: var(--bg-subtle);
    box-shadow: var(--shadow-border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.empty-state-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.empty-state-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===========================
   Page header（整页模板的标题区）
   =========================== */

/* 注意：Tabler 自带 .page-header（flex-direction: column + margin-top），
   同名碰撞需在此显式回正，否则页头会竖排并右对齐 */
.page-header {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 1.25rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}

.page-description {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.page-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===========================
   Stagger（卡片级联入场）
   =========================== */

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.stagger > * {
    animation: riseIn 0.45s cubic-bezier(0.21, 1.02, 0.73, 1) both;
}

.stagger > *:nth-child(1) {
    animation-delay: 0s;
}

.stagger > *:nth-child(2) {
    animation-delay: 0.05s;
}

.stagger > *:nth-child(3) {
    animation-delay: 0.1s;
}

.stagger > *:nth-child(4) {
    animation-delay: 0.15s;
}

.stagger > *:nth-child(5) {
    animation-delay: 0.2s;
}

.stagger > *:nth-child(6) {
    animation-delay: 0.25s;
}

.stagger > *:nth-child(7) {
    animation-delay: 0.3s;
}

.stagger > *:nth-child(8) {
    animation-delay: 0.35s;
}

/* ===========================
   Login page（登录卡片与品牌标识）
   =========================== */

.page-center .card-md {
    animation: riseIn 0.5s cubic-bezier(0.21, 1.02, 0.73, 1) both;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.login-brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--shadow-card);
}

.login-brand-text {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ===========================
   Font-size utilities & compact components
   （替代散落的内联 font-size / max-height / max-width）
   =========================== */

/* 摘要与次级说明文字（13px） */
.fs-meta {
    font-size: 0.8125rem;
}

/* 图例、筛选组标签（12px） */
.fs-micro {
    font-size: 0.75rem;
}

/* 占比等弱一级数字（11px） */
.fs-tiny {
    font-size: 0.6875rem;
}

/* 迷你切换按钮（星期切换等密集控件，替代 btn-sm + 内联样式） */
.btn-xs {
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
    border-radius: 5px;
}

/* 图表容器固定高度（canvas 需要明确的父级高度） */
.chart-box {
    height: 16.25rem;
}

/* 弹窗内长列表滚动区 */
.modal-list-scroll {
    max-height: 21.875rem;
    overflow-y: auto;
}

/* 商品名列截断宽度 */
.cell-truncate {
    max-width: 30rem;
}
