
    /* 基礎樣式重置與優化 */
    * {
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }
    
    body {
        margin: 0;
        padding: 0;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        background-color: #f5f7fa;
        color: #333;
        line-height: 1.6;
    }
    
    /* 容器佈局 */
    .container {
        display: flex;
        min-height: 100vh;
    }
    
    /* 側邊欄優化 */
    .sidebar {
        width: 280px;
        background: #2c3e50;
        color: white;
        position: fixed;
        height: 100vh;
        overflow-y: auto;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    
    .sidebar-header {
        padding: 20px;
        background: #1a2530;
        position: relative;
        display: flex;
        flex-direction: column;
    }
    
    .sidebar-header h2 {
        margin: 0 0 5px 0;
        font-size: 1.5rem;
    }
    
    .sidebar-header p {
        margin: 0;
        font-size: 0.9rem;
        opacity: 0.8;
    }
    
    .sidebar-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
        display: none;
    }
    
    .sidebar-menu {
        padding: 10px 0;
    }
    
    .menu-item-container {
        position: relative;
    }
    
    .menu-item {
        display: flex;
        align-items: center;
        padding: 12px 20px;
        color: #ecf0f1;
        text-decoration: none;
        transition: background 0.3s;
        cursor: pointer;
    }
    
    .menu-item:hover, .menu-item.active {
        background: #34495e;
    }
    
    .menu-item i {
        margin-right: 15px;
        width: 20px;
        text-align: center;
    }
    
    .has-submenu {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .submenu-toggle {
        font-size: 0.8rem;
        transition: transform 0.3s;
    }
    
    .submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        background: #1a2530;
    }
    
    .submenu.active {
        max-height: 500px;
    }
    
    .submenu-item {
        display: block;
        padding: 12px 20px 12px 55px;
        color: #bdc3c7;
        text-decoration: none;
        transition: background 0.3s;
    }
    
    .submenu-item:hover {
        background: #34495e;
        color: white;
    }
    
    /* 移動設備遮罩層 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    /* 主內容區域 */
    .main-content {
        flex: 1;
        margin-left: 280px;
        padding: 20px;
        transition: margin-left 0.3s ease;
    }
    
    /* 頁首優化 */
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 30px;
        padding-bottom: 15px;
        border-bottom: 1px solid #e1e5eb;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .header h1 {
        margin: 0;
        font-size: 1.8rem;
        color: #2c3e50;
    }
    
    .user-info {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .user-info img {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        object-fit: cover;
    }
    
    .user-info div {
        display: flex;
        flex-direction: column;
    }
    
    .user-info small {
        color: #7a7a7a;
        font-size: 0.85rem;
    }
    
    /* 卡片區域優化 */
    .dashboard-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .card {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        padding: 20px;
        display: flex;
        transition: transform 0.3s, box-shadow 0.3s;
    }
    
    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    }
    
    .card-header {
        margin-right: 15px;
    }
    
    .card-icon {
        width: 60px;
        height: 60px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        color: white;
    }
    
    .bg-primary { background: #3498db; }
    .bg-success { background: #2ecc71; }
    .bg-warning { background: #f39c12; }
    .bg-danger { background: #e74c3c; }
    
    .card-body {
        flex: 1;
    }
    
    .card-title {
        font-size: 0.9rem;
        color: #7a7a7a;
        margin-bottom: 5px;
    }
    
    .card-value {
        font-size: 1.8rem;
        font-weight: bold;
        color: #2c3e50;
        margin-bottom: 5px;
    }
    
    .card-change {
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .positive { color: #2ecc71; }
    .negative { color: #e74c3c; }
    
    /* 圖表區域優化 */
    .charts {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .chart-container {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        padding: 20px;
    }
    
    .chart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .chart-title {
        font-size: 1.2rem;
        font-weight: 600;
        color: #2c3e50;
    }
    
    /* 表格容器優化 */
    .table-container {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        padding: 20px;
        margin-bottom: 30px;
        overflow: hidden;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    table {
        width: 100%;
        border-collapse: collapse;
        min-width: 600px;
    }
    
    th, td {
        padding: 12px 15px;
        text-align: left;
        border-bottom: 1px solid #e1e5eb;
    }
    
    th {
        background: #f8f9fa;
        font-weight: 600;
        color: #2c3e50;
        position: sticky;
        top: 0;
    }
    
    tr:hover {
        background: #f8f9fa;
    }
    
    .status {
        padding: 5px 10px;
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 500;
    }
    
    .status-confirmed { background: #e7f7ef; color: #2ecc71; }
    .status-warning { background: #fef5e7; color: #f39c12; }
    .status-processing { background: #e7f4fd; color: #3498db; }
    
    /* 按鈕樣式 */
    .btn {
        padding: 10px 15px;
        border: none;
        border-radius: 6px;
        background: #3498db;
        color: white;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.3s;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }
    
    .btn:hover {
        background: #2980b9;
    }
    
    .btn-secondary {
        background: #95a5a6;
    }
    
    .btn-secondary:hover {
        background: #7f8c8d;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    /* 移動設備菜單按鈕 */
    .mobile-menu-toggle {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: #3498db;
        color: white;
        border: none;
        border-radius: 6px;
        width: 45px;
        height: 45px;
        display: none;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
    
    /* 頁面內容 */
    .page-content {
        display: none;
    }
    
    .page-content.active {
        display: block;
    }
    
    /* 登入頁面樣式 */
    .login-container {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        background: #f5f7fa;
        padding: 20px;
    }
    
    .login-form {
        background: white;
        padding: 30px;
        border-radius: 10px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 400px;
    }
    
    .login-header {
        text-align: center;
        margin-bottom: 25px;
    }
    
    .login-header h2 {
        margin: 0 0 10px 0;
        color: #2c3e50;
    }
    
    .login-header p {
        margin: 0;
        color: #7a7a7a;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        color: #2c3e50;
    }
    
    .form-control {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #dce1e6;
        border-radius: 6px;
        font-size: 1rem;
        transition: border-color 0.3s;
    }
    
    .form-control:focus {
        outline: none;
        border-color: #3498db;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    .btn-block {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }
    
    .login-error {
        background: #fde8e8;
        color: #e53e3e;
        padding: 12px;
        border-radius: 6px;
        margin-bottom: 20px;
        display: none;
    }
    
    /* 觸控反饋 */
    .menu-item:active, .submenu-item:active,
    .btn:active, .mobile-menu-toggle:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* 響應式設計 */
    @media (max-width: 1024px) {
        .sidebar {
            width: 240px;
        }
        
        .main-content {
            margin-left: 240px;
        }
        
        .dashboard-cards {
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        }
    }
    
    @media (max-width: 768px) {
        .sidebar {
            transform: translateX(-100%);
            width: 280px;
        }
        
        .sidebar.active {
            transform: translateX(0);
        }
        
        .sidebar-close {
            display: block;
        }
        
        .main-content {
            margin-left: 0;
            padding: 15px;
        }
        
        .mobile-menu-toggle {
            display: flex;
        }
        
        .sidebar-overlay.active {
            display: block;
        }
        
        .header {
            flex-direction: column;
            align-items: flex-start;
            margin-top: 60px;
        }
        
        .user-info {
            order: 2;
            width: 100%;
            padding-top: 15px;
            border-top: 1px solid #eee;
        }
        
        #page-title {
            order: 1;
        }
        
        .dashboard-cards {
            grid-template-columns: 1fr;
            gap: 15px;
        }
        
        .card {
            padding: 15px;
        }
        
        .card-value {
            font-size: 1.6rem;
        }
        
        .card-change {
            display: none !important;
        }
        
        .charts {
            grid-template-columns: 1fr;
        }
        
        .chart-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }
        
        .chart-header select {
            width: 100%;
        }
        
        .table-container {
            padding: 15px;
        }
        
        th:nth-child(1), td:nth-child(1) { min-width: 120px; }
        th:nth-child(2), td:nth-child(2) { min-width: 150px; }
        th:nth-child(3), td:nth-child(3) { min-width: 100px; }
        th:nth-child(4), td:nth-child(4) { min-width: 100px; }
        th:nth-child(5), td:nth-child(5) { min-width: 100px; }
    }
    
    @media (max-width: 480px) {
        .main-content {
            padding: 10px;
        }
        
        .header h1 {
            font-size: 1.5rem;
        }
        
        .card {
            flex-direction: column;
            text-align: center;
        }
        
        .card-header {
            margin-right: 0;
            margin-bottom: 15px;
        }
        
        .card-icon {
            margin: 0 auto;
        }
        
        .login-form {
            padding: 20px;
        }
    }
    
    /* 防止iOS縮放 */
    @media (max-width: 768px) {
        input, select, textarea {
            font-size: 16px !important; /* 防止iOS縮放 */
        }
    }
