* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4e73df;
    --primary-light: #6f8fff;
    --primary-dark: #3a56b0;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --success-light: #e8f8f2;
    --danger-color: #e74a3b;
    --danger-light: #fde8e7;
    --warning-color: #f6c23e;
    --warning-light: #fef9e7;
    --info-color: #36b9cc;
    --light-bg: #f8f9fc;
    --white: #ffffff;
    --gray-100: #f8f9fc;
    --gray-200: #eaecf4;
    --gray-300: #dddfeb;
    --gray-400: #d1d3e2;
    --gray-500: #b7b9cc;
    --gray-600: #858796;
    --gray-700: #6e707e;
    --gray-800: #5a5c69;
    --gray-900: #3a3b45;
    --sidebar-width: 250px;
    --header-height: 70px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 15px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--light-bg);
    color: var(--gray-800);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}

.sidebar .logo {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0,0,0,0.1);
}

.sidebar .logo h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.sidebar nav ul {
    list-style: none;
    padding: 15px 0;
}

.sidebar nav ul li {
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 5px 10px;
    border-radius: var(--radius-sm);
}

.sidebar nav ul li:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.sidebar nav ul li.active {
    background: rgba(255, 255, 255, 0.25);
    border-left: 4px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar nav ul li .icon {
    font-size: 22px;
    width: 32px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar nav ul li .text {
    font-size: 15px;
    font-weight: 500;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    min-width: 0;
}

/* 顶部栏 */
.top-bar {
    background: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 35px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--gray-200);
}

.menu-toggle {
    display: none;
    font-size: 26px;
    cursor: pointer;
    margin-right: 20px;
    color: var(--gray-700);
    transition: color 0.3s ease;
}

.menu-toggle:hover {
    color: var(--primary-color);
}

.top-bar h1 {
    flex: 1;
    min-width: 0;
    font-size: 26px;
    color: var(--gray-900);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.user-info {
    font-weight: 600;
    color: var(--gray-700);
    padding: 6px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(78, 115, 223, 0.12);
    color: var(--primary-color);
    font-size: 12px;
}

.logout-btn {
    padding: 6px 10px !important;
    background: var(--gray-200) !important;
    color: var(--gray-700) !important;
    box-shadow: none !important;
}

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f6ff 0%, #eef8f3 100%);
    padding: 24px;
}

.login-screen.active {
    display: flex;
}

.login-panel {
    width: min(420px, 100%);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 34px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 12px;
}

.login-panel h1 {
    font-size: 26px;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.login-error {
    min-height: 20px;
    color: var(--danger-color);
    font-size: 13px;
    margin: -8px 0 12px;
}

.readonly-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

/* 页面内容 */
.page-content {
    padding: 35px;
    max-width: 1400px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 16px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 5px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 50%, rgba(78, 115, 223, 0.05) 50%);
    border-radius: 0 0 0 100%;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(1) {
    border-left-color: var(--primary-color);
}

.stat-card:nth-child(2) {
    border-left-color: var(--success-color);
}

.stat-card:nth-child(3) {
    border-left-color: var(--danger-color);
}

.stat-card:nth-child(4) {
    border-left-color: var(--warning-color);
}

.stat-card:nth-child(5) {
    border-left-color: #c0392b;
}

.stat-icon {
    font-size: 36px;
    opacity: 0.9;
    filter: grayscale(20%);
}

.stat-info h3 {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 26px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

/* 图表容器 */
.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.chart-box {
    background: var(--white);
    padding: 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
}

.chart-box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.chart-box h3 {
    margin-bottom: 22px;
    color: var(--gray-900);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-box h3::before {
    content: '📊';
    font-size: 20px;
}

.chart-box:nth-child(2) h3::before {
    content: '📈';
}

/* 库存看板 */
.inventory-kanban {
    background: var(--white);
    padding: 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: 25px;
    border: 1px solid var(--gray-200);
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 15px;
}

.inventory-kanban h3 {
    color: var(--gray-900);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.inventory-kanban h3::before {
    content: '📦';
    font-size: 20px;
}

.kanban-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-box,
.sort-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-box label,
.sort-box label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.filter-box select,
.sort-box select {
    padding: 8px 30px 8px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--gray-800);
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path fill="%23858796" d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-box select:hover,
.sort-box select:hover {
    border-color: var(--gray-400);
}

.filter-box select:focus,
.sort-box select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
}

/* 到期日看板卡片状态样式 */
.expiry-kanban-card {
    border-left-width: 5px !important;
    border-left-style: solid !important;
}

.expiry-normal {
    border-left-color: var(--success-color) !important;
}

.expiry-soon {
    border-left-color: var(--warning-color) !important;
    background: linear-gradient(135deg, #fffdf0 0%, #fff9e0 100%) !important;
}

.expiry-expired {
    border-left-color: var(--danger-color) !important;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%) !important;
}

.expiry-date-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-bottom: 10px;
    display: inline-block;
}

.expiry-date-tag.expiry-normal {
    background: var(--success-light);
    color: var(--success-color);
    border: 1px solid rgba(28,200,138,0.25);
    border-left: none !important;
}

.expiry-date-tag.expiry-soon {
    background: var(--warning-light);
    color: #d4890a;
    border: 1px solid rgba(246,194,62,0.35);
    border-left: none !important;
}

.expiry-date-tag.expiry-expired {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid rgba(231,74,59,0.25);
    border-left: none !important;
}

/* 条形图容器 */
.chart-box h3::before {
    content: '📊';
    font-size: 20px;
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
}

.kanban-card {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    padding: 18px;
    border-radius: var(--radius-sm);
    border-left: 5px solid var(--primary-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.kanban-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-light);
}

.kanban-card h4 {
    font-size: 15px;
    color: var(--gray-900);
    margin-bottom: 12px;
    font-weight: 700;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.kanban-card .stock-info {
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-card .stock-info strong {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 14px;
}

.kanban-card .stock-qty {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 2px dashed var(--gray-200);
    text-align: center;
}

/* 仪表盘优化 */
.dashboard-page {
    --dashboard-border: #e4e7ec;
    --dashboard-text: #202939;
    --dashboard-muted: #667085;
}

.dashboard-brief {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding: 22px 24px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f9ff 100%);
    border: 1px solid var(--dashboard-border);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.dashboard-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
}

.dashboard-brief h2 {
    color: var(--dashboard-text);
    font-size: 24px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.dashboard-brief p {
    max-width: 680px;
    color: var(--dashboard-muted);
    font-size: 14px;
    line-height: 1.7;
}

.dashboard-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.dashboard-meta span {
    padding: 7px 10px;
    border: 1px solid var(--dashboard-border);
    border-radius: 6px;
    background: #ffffff;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-page .dashboard-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-stats .stat-card {
    min-height: 112px;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--dashboard-border);
    border-top: 4px solid var(--primary-color);
    border-left: 1px solid var(--dashboard-border);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
    background: #ffffff;
}

.dashboard-stats .stat-card::before {
    content: none;
}

.dashboard-stats .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.1);
}

.dashboard-stats .stat-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 800;
    opacity: 1;
    filter: none;
}

.dashboard-stats .stat-info {
    min-width: 0;
}

.dashboard-stats .stat-info h3 {
    margin-bottom: 5px;
    color: var(--dashboard-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.dashboard-stats .stat-info p {
    color: var(--dashboard-text);
    font-size: 29px;
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-stats .stat-info small {
    display: block;
    margin-top: 6px;
    color: #98a2b3;
    font-size: 12px;
    line-height: 1.3;
}

.dashboard-stats .stat-stock {
    border-top-color: var(--primary-color);
}

.dashboard-stats .stat-inbound {
    border-top-color: var(--success-color);
}

.dashboard-stats .stat-outbound {
    border-top-color: var(--danger-color);
}

.dashboard-stats .stat-transfer {
    border-top-color: var(--warning-color);
}

.dashboard-stats .stat-loss {
    border-top-color: #c0392b;
}

.dashboard-stats .stat-stock .stat-icon {
    background: #eef2ff;
    color: var(--primary-color);
}

.dashboard-stats .stat-inbound .stat-icon {
    background: #e8f8f2;
    color: var(--success-color);
}

.dashboard-stats .stat-outbound .stat-icon {
    background: #fde8e7;
    color: var(--danger-color);
}

.dashboard-stats .stat-transfer .stat-icon {
    background: #fff7df;
    color: #d4890a;
}

.dashboard-stats .stat-loss .stat-icon {
    background: #fff1f0;
    color: #c0392b;
}

.dashboard-stats .stat-stock .stat-icon::before {
    content: "▦";
}

.dashboard-stats .stat-inbound .stat-icon::before {
    content: "↓";
}

.dashboard-stats .stat-outbound .stat-icon::before {
    content: "↑";
}

.dashboard-stats .stat-transfer .stat-icon::before {
    content: "⇄";
}

.dashboard-stats .stat-loss .stat-icon::before {
    content: "!";
}

.dashboard-panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 24px;
}

.dashboard-page .dashboard-panel {
    margin-top: 0;
    padding: 22px;
    border: 1px solid var(--dashboard-border);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
    background: #ffffff;
}

.dashboard-page .dashboard-panel:hover {
    transform: none;
    box-shadow: 0 10px 26px rgba(16, 24, 40, 0.08);
}

.dashboard-page .kanban-header {
    align-items: flex-start;
    margin-bottom: 18px;
}

.dashboard-page .inventory-kanban h3,
.dashboard-page .chart-box h3 {
    color: var(--dashboard-text);
    font-size: 16px;
    font-weight: 800;
    gap: 9px;
    margin-bottom: 0;
}

.dashboard-page .inventory-kanban h3::before,
.dashboard-page .chart-box h3::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 18px;
    border-radius: 3px;
    background: var(--primary-color);
    font-size: 0;
}

.dashboard-page .kanban-controls {
    gap: 10px;
}

.dashboard-page .filter-box label,
.dashboard-page .sort-box label {
    color: var(--dashboard-muted);
    font-size: 12px;
}

.dashboard-page .filter-box select,
.dashboard-page .sort-box select {
    min-height: 36px;
    padding: 7px 30px 7px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #344054;
    background-color: #ffffff;
}

.dashboard-page .kanban-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

#expiryKanbanSection .kanban-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

#kanbanGrid.is-sparse {
    grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
}

.dashboard-page .kanban-card {
    min-height: 184px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--dashboard-border);
    border-top: 4px solid var(--primary-color);
    border-left: 1px solid var(--dashboard-border);
    border-radius: 8px;
    background: #fbfcfe;
    box-shadow: none;
}

.dashboard-page .kanban-card:hover {
    transform: translateY(-2px);
    border-left-color: var(--dashboard-border);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.09);
}

.dashboard-page .kanban-card h4 {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--dashboard-border);
    color: var(--dashboard-text);
    font-size: 15px;
}

.dashboard-page .kanban-card .stock-info {
    gap: 10px;
    margin-bottom: 7px;
    color: #475467;
    font-size: 13px;
}

.dashboard-page .kanban-card .stock-info strong {
    color: var(--primary-color);
    font-size: 14px;
}

.dashboard-page .kanban-card .stock-qty {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed #d0d5dd;
    color: var(--primary-color);
    font-size: 24px;
}

.dashboard-page .expiry-kanban-card {
    border-left: 1px solid var(--dashboard-border) !important;
}

.dashboard-page .expiry-kanban-card.expiry-normal {
    border-top-color: var(--success-color);
    background: #f9fffc !important;
}

.dashboard-page .expiry-kanban-card.expiry-soon {
    border-top-color: var(--warning-color);
    background: #fffcf0 !important;
}

.dashboard-page .expiry-kanban-card.expiry-expired {
    border-top-color: var(--danger-color);
    background: #fff7f6 !important;
}

.dashboard-page .expiry-date-tag {
    margin-bottom: 12px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
}

.chart-canvas-wrap {
    position: relative;
    height: 315px;
    margin-top: 16px;
}

.dashboard-empty {
    grid-column: 1 / -1;
    padding: 42px 20px;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
    background: #f9fafb;
    color: var(--dashboard-muted);
    text-align: center;
    font-size: 14px;
}

@media (max-width: 1280px) {
    .dashboard-page .dashboard-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #expiryKanbanSection .kanban-grid,
    #expiryKanbanSection .kanban-grid.is-sparse {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    #expiryKanbanSection .kanban-grid,
    #expiryKanbanSection .kanban-grid.is-sparse {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-brief {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .dashboard-meta {
        justify-content: flex-start;
    }

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

    #expiryKanbanSection .kanban-grid,
    #expiryKanbanSection .kanban-grid.is-sparse {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .dashboard-page .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-page .kanban-controls {
        width: 100%;
    }

    .dashboard-page .filter-box,
    .dashboard-page .sort-box,
    .dashboard-page .filter-box select,
    .dashboard-page .sort-box select {
        width: 100%;
    }

    #expiryKanbanSection .kanban-grid,
    #expiryKanbanSection .kanban-grid.is-sparse {
        grid-template-columns: 1fr;
    }
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--gray-200);
}

.page-header h2 {
    font-size: 26px;
    color: var(--gray-900);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h2::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 28px;
    background: var(--primary-color);
    border-radius: 3px;
}

/* 按钮样式 */
.btn {
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(78, 115, 223, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #2ecc71 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(28, 200, 138, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f39c12 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(246, 194, 62, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 74, 59, 0.3);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

/* 表格容器 */
.table-container {
    background: var(--white);
    padding: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.data-table th {
    padding: 16px 18px;
    text-align: left;
    font-weight: 700;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-300);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--primary-color);
}

.sort-icon {
    font-size: 11px;
    color: var(--primary-color);
}

.data-table tfoot tr {
    border-top: 2px solid var(--gray-400);
}

.data-table tfoot td {
    padding: 14px 18px;
    font-size: 14px;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-700);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
    transform: scale(1.002);
}

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

/* 搜索框 */
.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    padding: 11px 18px 11px 45px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--white) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18"><path fill="%23858796" d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') no-repeat 15px center;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(78, 115, 223, 0.1);
    background-color: var(--white);
}

.search-box input::placeholder {
    color: var(--gray-500);
}

/* 导出选项 */
.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.export-card {
    background: var(--white);
    padding: 35px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.export-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.export-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.export-card:hover::before {
    transform: translateY(0);
}

.export-icon {
    font-size: 52px;
    margin-bottom: 18px;
    display: block;
    filter: grayscale(20%);
    transition: filter 0.3s ease;
}

.export-card:hover .export-icon {
    filter: grayscale(0%);
}

.export-card h3 {
    font-size: 18px;
    color: var(--gray-900);
    margin-bottom: 10px;
    font-weight: 700;
}

.export-card p {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.5;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 24px 32px;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
    font-size: 22px;
    color: var(--gray-900);
    font-weight: 700;
}

.modal-close {
    font-size: 32px;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--danger-color);
    background: var(--danger-light);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
}

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 180px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--white);
    color: var(--gray-900);
    border-left: 4px solid var(--success-color);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    animation: toastIn 0.2s ease-out;
}

.toast-success {
    background: var(--success-light);
    border-left-color: var(--success-color);
}

.toast-hide {
    animation: toastOut 0.2s ease-in forwards;
}

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

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

/* 自定义提示弹窗 */
.app-dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 24, 36, 0.48);
    backdrop-filter: blur(4px);
}

.app-dialog-overlay.active {
    display: flex;
}

.app-dialog {
    width: min(460px, 100%);
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(26, 32, 44, 0.24);
    overflow: hidden;
    animation: dialogIn 0.18s ease-out;
}

.app-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 24px 10px;
}

.app-dialog-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f0fe;
    color: var(--primary-color);
    font-weight: 800;
}

.app-dialog-danger .app-dialog-icon {
    background: var(--danger-light);
    color: var(--danger-color);
}

.app-dialog-header h3 {
    font-size: 18px;
    color: var(--gray-900);
    font-weight: 700;
}

.app-dialog-body {
    padding: 8px 24px 4px;
    color: var(--gray-700);
    font-size: 14px;
    line-height: 1.7;
}

.app-dialog-body p {
    margin: 0;
}

.app-dialog-detail-list {
    margin: 14px 0 0;
    padding: 12px 14px 12px 30px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    color: var(--gray-800);
}

.app-dialog-detail-list li + li {
    margin-top: 6px;
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px 24px;
}

.app-dialog-actions .btn {
    min-width: 86px;
}

@keyframes dialogIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--gray-800);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--gray-400);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(78, 115, 223, 0.1);
    background: var(--white);
}

.form-group input::placeholder {
    color: var(--gray-500);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="%23858796" d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.switch-field {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    margin: 0 !important;
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-800);
    background: var(--white);
}

.switch-field:hover {
    border-color: var(--gray-400);
}

.form-group .switch-field input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
}

.switch-control {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--gray-300);
    transition: background 0.2s ease;
}

.switch-control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 2px 5px rgba(16, 24, 40, 0.18);
    transition: transform 0.2s ease;
}

.switch-field input:checked + .switch-control {
    background: var(--primary-color);
}

.switch-field input:checked + .switch-control::after {
    transform: translateX(20px);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 2px solid var(--gray-200);
}

/* 徽章样式 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.badge-primary {
    background: linear-gradient(135deg, rgba(78, 115, 223, 0.15) 0%, rgba(78, 115, 223, 0.08) 100%);
    color: var(--primary-color);
    border: 1px solid rgba(78, 115, 223, 0.2);
}

.badge-secondary {
    background: linear-gradient(135deg, rgba(133, 135, 150, 0.15) 0%, rgba(133, 135, 150, 0.08) 100%);
    color: var(--gray-600);
    border: 1px solid rgba(133, 135, 150, 0.2);
}

.badge-success {
    background: linear-gradient(135deg, rgba(28, 200, 138, 0.15) 0%, rgba(28, 200, 138, 0.08) 100%);
    color: var(--success-color);
    border: 1px solid rgba(28, 200, 138, 0.2);
}

.badge-danger {
    background: linear-gradient(135deg, rgba(231, 74, 59, 0.15) 0%, rgba(231, 74, 59, 0.08) 100%);
    color: var(--danger-color);
    border: 1px solid rgba(231, 74, 59, 0.2);
}

.badge-warning {
    background: linear-gradient(135deg, rgba(246, 194, 62, 0.15) 0%, rgba(246, 194, 62, 0.08) 100%);
    color: #f39c12;
    border: 1px solid rgba(246, 194, 62, 0.2);
}

.badge-info {
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.15) 0%, rgba(108, 117, 125, 0.08) 100%);
    color: #5b8def;
    border: 1px solid rgba(91, 141, 239, 0.2);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .kanban-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .kanban-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 20px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
    
    .top-bar {
        padding: 0 20px;
    }
    
    .top-bar h1 {
        font-size: 20px;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
    }

    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        width: 100%;
        max-width: none;
    }

    .app-dialog-overlay {
        padding: 16px;
    }

    .app-dialog-actions {
        flex-direction: column-reverse;
    }

    .app-dialog-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kanban-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .search-box {
        max-width: 100%;
        width: 100%;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}
