/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* 防止橫向滾動 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 頭部樣式 */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 15px;
}

.logo {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-right: 30px;
}

.main-nav {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.main-nav > a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.main-nav > a:hover,
.main-nav > a.active {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

/* 下拉菜單 */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.nav-dropdown-toggle:hover {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.nav-dropdown-toggle .arrow {
    font-size: 10px;
    transition: transform 0.3s;
}

.nav-dropdown.active .nav-dropdown-toggle .arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1001;
    padding: 8px 0;
    border: 1px solid rgba(0,0,0,0.05);
}

.nav-dropdown.active .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    color: #333;
    text-decoration: none;
    padding: 10px 20px;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-weight: 400;
}

.nav-dropdown-menu a:hover {
    background-color: #f8f9fa;
    border-left-color: #667eea;
    color: #667eea;
    padding-left: 17px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
    white-space: nowrap;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    background-color: rgba(255,255,255,0.15);
    border-radius: 6px;
}

.btn-logout {
    padding: 6px 14px;
    font-size: 13px;
    background-color: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-logout:hover {
    background-color: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

/* 底部樣式 */
.main-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* 登錄頁面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.login-hint {
    margin-top: 20px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.stock-form {
    max-width: 800px;
}

/* 按鈕樣式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.btn-info {
    background-color: #3498db;
    color: white;
}

.btn-info:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 消息提示 */
.message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* 統計卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card.warning {
    border-left: 4px solid #f39c12;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.stat-card.warning .stat-number {
    color: #f39c12;
}

/* 快速操作 */
.quick-actions {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* 記錄區域 */
.records-section,
.recent-records {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.record-section {
    margin-bottom: 30px;
}

.record-section:last-child {
    margin-bottom: 0;
}

/* 表格樣式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table thead {
    background-color: #667eea;
    color: white;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table tbody tr:hover {
    background-color: #f5f5f5;
}

.data-table tbody tr.low-stock-row {
    background-color: #fff3cd;
}

.data-table tbody tr.difference-row {
    background-color: #f8f9fa;
}

.text-center {
    text-align: center;
}

.positive {
    color: #27ae60;
    font-weight: bold;
}

.negative {
    color: #e74c3c;
    font-weight: bold;
}

/* 標籤 */
.badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* 分頁 */
.pagination {
    display: flex;
    gap: 5px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #667eea;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: #667eea;
    color: white;
}

.pagination a.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 報表樣式 */
.report-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.report-tabs a {
    padding: 10px 20px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.report-tabs a:hover {
    background-color: #f5f5f5;
}

.report-tabs a.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 標籤頁樣式 */
.tabs-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    background-color: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    gap: 0;
}

.tab-button {
    padding: 15px 30px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    position: relative;
}

.tab-button:hover {
    background-color: #e9ecef;
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: white;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.date-filter {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.date-filter form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.date-filter label {
    font-weight: bold;
}

.date-filter input[type="date"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.report-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.summary-box {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.summary-box p {
    margin: 0;
    font-size: 16px;
}

/* 歡迎信息 */
.welcome {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

/* 導入導出樣式 */
.import-export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.export-section,
.import-section {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.export-section h3,
.import-section h3 {
    margin-top: 0;
    color: #667eea;
}

.import-form {
    margin-top: 15px;
}

.import-hint {
    margin-top: 15px;
    padding: 15px;
    background-color: #e7f3ff;
    border-left: 4px solid #3498db;
    border-radius: 5px;
    font-size: 14px;
}

.import-hint p {
    margin: 5px 0;
}

.import-hint strong {
    color: #2980b9;
}

/* 篩選區域樣式 */
.filter-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.filter-section form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-section label {
    font-weight: bold;
    margin-right: 5px;
}

.filter-section select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 手機選單按鈕 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

.mobile-menu-toggle:hover {
    background-color: rgba(255,255,255,0.2);
    border-radius: 5px;
}

/* 表格容器（用於手機滾動） */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
}

.table-wrapper table {
    min-width: 600px;
}

/* 卡片式表格（手機替代方案） */
.table-card {
    display: none;
}

.table-card-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.table-card-item .card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.table-card-item .card-row:last-child {
    border-bottom: none;
}

.table-card-item .card-label {
    font-weight: bold;
    color: #666;
    min-width: 80px;
}

.table-card-item .card-value {
    text-align: right;
    flex: 1;
}

/* 標籤頁按鈕手機優化 */
.tabs-header {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    white-space: nowrap;
    min-width: 100px;
}

/* 容器內邊距優化 */
.container {
    padding: 15px;
}

/* 表單區域優化 */
.form-section {
    padding: 20px;
}

/* 按鈕觸控優化 */
.btn {
    min-height: 44px;
    touch-action: manipulation;
}

/* 輸入框觸控優化 */
.form-group input,
.form-group select,
.form-group textarea {
    min-height: 44px;
    font-size: 16px; /* 防止iOS自動縮放 */
    -webkit-appearance: none;
    border-radius: 5px;
}

/* 選擇框樣式優化 */
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 35px;
}

/* 改善觸控目標大小 */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* 禁用文字選擇（對按鈕） */
.btn, button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 改善連結觸控反饋 */
a {
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

/* 處理常見內聯樣式的手機適配 */
@media (max-width: 768px) {
    /* 確保所有 flex 容器在手機上可以換行 */
    [style*="display: flex"][style*="flex-wrap: nowrap"] {
        flex-wrap: wrap !important;
    }
    
    /* 優化按鈕組的顯示 */
    [style*="display: flex"] .btn,
    [style*="display: inline-flex"] .btn {
        flex: 1 1 auto;
    }
    
    /* 確保所有固定寬度的容器可以響應式 */
    [style*="width"]:not([style*="width: 100%"]):not([style*="width: auto"]) {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* 優化 gap 和 margin */
    [style*="gap: 10px"] {
        gap: 12px !important;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        font-size: 16px; /* 防止iOS自動縮放 */
        -webkit-font-smoothing: antialiased;
    }
    
    .container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    /* 手機選單 */
    .mobile-menu-toggle {
        display: block;
        min-width: 44px;
        min-height: 44px;
    }
    
    .main-header {
        position: relative;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        padding: 15px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        z-index: 1000;
        gap: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .main-nav > a,
    .nav-dropdown {
        width: 100%;
    }
    
    .main-nav > a {
        padding: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        text-align: left;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .nav-dropdown-toggle {
        width: 100%;
        padding: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        justify-content: space-between;
        min-height: 44px;
    }
    
    .nav-dropdown.active .nav-dropdown-menu {
        display: block;
    }
    
    .nav-dropdown-menu {
        display: none;
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0,0,0,0.1);
        margin: 0;
        padding: 0;
        border-radius: 0;
        min-width: auto;
    }
    
    .nav-dropdown-menu a {
        padding: 12px 30px;
        color: rgba(255,255,255,0.9);
        border-left: none;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .nav-dropdown-menu a:hover,
    .nav-dropdown-menu a:active {
        background-color: rgba(255,255,255,0.15);
        border-left: none;
        padding-left: 30px;
        color: white;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
        flex-wrap: wrap;
    }
    
    .logo {
        font-size: 18px;
        margin-right: 10px;
        flex: 1;
        min-width: 0;
    }
    
    .user-info {
        flex-direction: row;
        gap: 8px;
        margin-left: 10px;
        flex-shrink: 0;
    }
    
    .user-name {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    
    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* 導入導出按鈕 */
    .import-export-buttons {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* 篩選區域 */
    .filter-section {
        padding: 12px;
    }
    
    .filter-section form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .filter-section form > * {
        width: 100%;
        margin-bottom: 0;
    }
    
    .filter-section label {
        margin-bottom: 5px;
        display: block;
    }
    
    /* 表單行 */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 統計卡片 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    /* 操作按鈕 */
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-buttons .btn {
        width: 100%;
        min-height: 48px;
    }
    
    /* 表格優化 - 使用卡片式顯示 */
    .data-table {
        font-size: 14px;
        display: none; /* 在小屏幕上隱藏表格 */
    }
    
    .table-wrapper {
        display: block;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 使用卡片式表格顯示 */
    .table-wrapper::after {
        content: '';
        display: block;
        clear: both;
    }
    
    /* 表格轉換為卡片 */
    .data-table.mobile-hidden {
        display: none;
    }
    
    .table-card {
        display: block;
    }
    
    .table-card-item {
        margin-bottom: 15px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    /* 日期篩選 */
    .date-filter {
        padding: 15px;
    }
    
    .date-filter form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .date-filter form > * {
        width: 100%;
        margin-bottom: 0;
    }
    
    .date-filter label {
        margin-bottom: 5px;
        display: block;
    }
    
    /* 報表標籤 */
    .report-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .report-tabs a {
        width: 100%;
        text-align: center;
        padding: 14px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 標籤頁 */
    .tabs-header {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .tab-button {
        padding: 14px 20px;
        font-size: 14px;
        min-width: auto;
        white-space: nowrap;
        min-height: 48px;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .tab-content h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* 摘要框 */
    .summary-box {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }
    
    .summary-box p {
        font-size: 14px;
    }
    
    /* 歡迎信息 */
    .welcome {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    /* 登錄頁面 */
    .login-container {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .login-box h1 {
        font-size: 24px;
        margin-bottom: 25px;
    }
    
    /* 快速操作 */
    .quick-actions {
        padding: 20px 15px;
    }
    
    .quick-actions h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* 記錄區域 */
    .records-section,
    .recent-records {
        padding: 20px 15px;
    }
    
    .records-section h2,
    .recent-records h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    /* 分頁 */
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .pagination a {
        padding: 12px 16px;
        font-size: 14px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 表單區域 */
    .form-section {
        padding: 20px 15px;
    }
    
    .form-section h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    /* 按鈕組 */
    [style*="display: flex"] {
        flex-wrap: wrap;
        gap: 10px !important;
    }
    
    [style*="display: flex"] .btn,
    [style*="display: flex"] a.btn {
        flex: 1 1 auto;
        min-width: calc(50% - 5px);
    }
    
    /* 標題優化 */
    h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }
}

/* 超小屏幕優化 */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .logo {
        font-size: 16px;
        margin-right: 5px;
    }
    
    .user-name {
        max-width: 60px;
        font-size: 11px;
        padding: 5px 8px;
    }
    
    .btn-logout {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .stat-card h3 {
        font-size: 13px;
    }
    
    .tab-content h2 {
        font-size: 18px;
    }
    
    .form-section {
        padding: 15px 12px;
    }
    
    .table-card-item {
        padding: 12px;
    }
    
    .card-label {
        font-size: 13px;
        min-width: 70px;
    }
    
    .card-value {
        font-size: 13px;
    }
    
    .card-row {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .card-value {
        width: 100%;
        text-align: left;
        margin-top: 4px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    h3 {
        font-size: 16px;
    }
    
    .welcome {
        font-size: 14px;
    }
    
    .pagination a {
        padding: 10px 12px;
        font-size: 13px;
        min-width: 40px;
    }
    
    .main-nav > a,
    .nav-dropdown-toggle {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .nav-dropdown-menu a {
        padding: 10px 25px;
        font-size: 13px;
    }
}

