/* Park3 主樣式 */

/* 重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
}

/* 頂部導航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.logo {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.datetime {
    font-size: 14px;
    opacity: 0.9;
}

.btn-logout {
    padding: 6px 12px;
    font-size: 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #dc2626;
}

.btn-refresh {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(180deg);
}

/* 側邊欄 */
.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 165px;
    height: calc(100vh - 70px);
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 900;
}

.sidebar.collapsed {
    transform: translateX(-165px);
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
}

.nav-group {
    padding: 15px 20px 8px;
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.nav-item.active {
    background: #eff6ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}
.nav-item.active .icon {
    filter: saturate(1.2);
}
.nav-item.active .text {
    position: relative;
}

.nav-item .icon {
    margin-right: 10px;
    font-size: 18px;
}

.nav-item .text {
    font-size: 14px;
    white-space: nowrap;
}

/* 主內容區 */
.main-content {
    margin-left: 165px;
    margin-top: 70px;
    padding: 20px;
    min-height: calc(100vh - 70px);
    transition: margin-left 0.3s;
}

.main-content.expanded {
    margin-left: 0;
}

/* 儀表板 */
.dashboard h2 {
    margin-bottom: 20px;
    color: #1f2937;
}

.stats-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-card[data-accent="car"] { border-top: 4px solid #3498db; }
.stat-card[data-accent="charge"] { border-top: 4px solid #9b59b6; }
.stat-card[data-accent="payment"] { border-top: 4px solid #27ae60; }
.stat-card[data-accent="alert"] { border-top: 4px solid #f39c12; }
.stat-card[data-accent="danger"] { border-top: 4px solid #e74c3c; }

.stat-icon {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
}

/* 載入遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 模態框 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay:not(.active) {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding: 24px;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.3);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    background: #ffffff;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 按鈕樣式 */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e5e7eb;
    color: #4b5563;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-info {
    background: #3b82f6;
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== 系統設置頁面 ===== */
.settings-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.settings-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.settings-toolbar select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    min-width: 120px;
}

.settings-toolbar select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 10px 14px;
    font-size: 13px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .cell-actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.data-table .cell-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.data-table .cell-actions button:hover {
    transform: translateY(-1px);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 120px;
}

.form-row .form-group.small {
    flex: 0 0 auto;
    min-width: 80px;
}

.form-row .form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.form-row .form-group input,
.form-row .form-group select {
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.15s;
}

.form-row .form-group input:focus,
.form-row .form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.form-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

/* 狀態標籤 */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.status-lost {
    background: #e0e7ff;
    color: #3730a3;
}

.status-damaged {
    background: #fce7f3;
    color: #9d174d;
}

.status-inpark {
    background: #dcfce7;
    color: #166534;
}

.status-outpark {
    background: #f3f4f6;
    color: #6b7280;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 4px;
    font-size: 12px;
}

/* 車牌標籤 */
.plate-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 200px;
}

.plate-tag {
    display: inline-block;
    padding: 3px 8px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* 車牌輸入組 */
.plate-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.plate-input {
    width: 100px;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-transform: uppercase;
}

.plate-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 分頁 */
.datagrid-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.datagrid-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.datagrid-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 中屏：側邊欄圖標模式 (寬度 769~1499px) */
@media (max-width: 1499px) {
    .sidebar {
        width: 55px;
        overflow: hidden;
        white-space: nowrap;
        transition: width 0.25s ease, transform 0.3s;
        border-left: none;
    }

    /* hover 展開 */
    .sidebar:hover {
        width: 165px;
        overflow-y: auto;
    }

    /* 收起狀態：不移出屏幕，保持 55px hover 可展開 */
    .sidebar.collapsed {
        transform: none;
    }

    /* 摺疊狀態：只顯示圖標，文字全部隱藏 */
    .nav-group {
        display: none;
    }
    .sidebar:not(:hover) .nav-item .text {
        display: none;
    }

    .main-content {
        margin-left: 55px;
    }
}

/* 小屏幕/平板：強制重置為完整寬度側邊欄 */
@media (max-width: 768px) {
    .sidebar {
        width: 165px;
        overflow-y: auto;
        white-space: normal;
        transform: translateX(-165px);
    }

    /* 重置中屏側邊欄摺疊樣式 - 用 !important 覆蓋 1499px 的 :not(:hover) 特異性 */
    .sidebar .nav-group {
        display: block;
    }
    .sidebar .nav-item .text {
        display: inline;
    }
    .sidebar .nav-item {
        justify-content: flex-start;
        padding: 12px 20px;
    }
    .sidebar .nav-item .icon {
        margin-right: 10px;
        font-size: 18px;
    }
    .sidebar .nav-item.active {
        border-left-color: #667eea;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* 確保 .show 狀態下 :not(:hover) 也不會隱藏文字 */
    .sidebar:not(:hover) .nav-group {
        display: block;
    }
    .sidebar:not(:hover) .nav-item .text {
        display: inline;
    }
    .sidebar:not(:hover) .nav-item {
        justify-content: flex-start;
        padding: 12px 20px;
    }
    .sidebar:not(:hover) .nav-item .icon {
        margin-right: 10px;
        font-size: 18px;
    }
    .sidebar:not(:hover) .nav-item.active {
        border-left-color: #667eea;
    }

    .main-content {
        margin-left: 0;
    }

    .logo {
        font-size: 16px;
    }

    /* 移動端表格優化 */
    .datagrid-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .datagrid th, .datagrid td {
        white-space: nowrap;
        min-width: 80px;
    }

    /* 移動端按鈕優化 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* 移動端表單優化 */
    input, select, textarea {
        font-size: 16px !important; /* 防止iOS縮放 */
    }

    /* 移動端彈窗優化 */
    .modal-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding: 24px;
}

.modal-content {
        width: 95% !important;
        max-height: 85vh !important;
        margin: 10px !important;
    }

    /* 移動端頭部優化 */
    .header-right {
        gap: 8px;
    }

    .header-right select {
        font-size: 11px !important;
        padding: 4px 6px !important;
    }

    .datetime {
        display: none;
    }

    /* 移動端搜索欄優化 */
    .search-bar {
        flex-direction: column;
        gap: 8px;
    }

    .search-bar input,
    .search-bar select {
        width: 100%;
    }
}

/* 小屏幕手機 */
@media (max-width: 480px) {
    .header {
        padding: 0 10px;
    }

    .logo {
        font-size: 14px;
    }

    .menu-toggle {
        font-size: 20px;
    }

    .btn-refresh {
        padding: 6px 8px;
        font-size: 14px;
    }

    .page-header h2 {
        font-size: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .datagrid th, .datagrid td {
        font-size: 12px;
        padding: 8px 6px;
    }

    /* 隱藏部分表格列 */
    .datagrid .hide-mobile {
        display: none;
    }
}

/* 觸摸設備優化 */
@media (hover: none) and (pointer: coarse) {
    .nav-item, .btn {
        min-height: 44px; /* iOS人機界面指南最小觸摸目標 */
    }

    .datagrid tr {
        min-height: 44px;
    }
}

/* ===== Deferred 同步提示條 ===== */
.deferred-banner {
    background: #fffbeb;
    border-bottom: 2px solid #f59e0b;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #92400e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1001;
}

.deferred-banner-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.deferred-banner .btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.deferred-banner .btn-default {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.deferred-banner .btn-default:hover {
    background: #e5e7eb;
}
/* === ���M�� === */
#weatherWidget {
    padding: 8px 20px;
    background: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
    min-height: 0;
}
.weather-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}
.weather-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.weather-temp-val {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
}
.weather-humidity {
    color: #6b7280;
    font-size: 13px;
}
.weather-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
}
.weather-warn-label {
    font-weight: 600;
    color: #92400e;
}
@media (max-width: 768px) {
    #weatherWidget { padding: 6px 10px; }
    .weather-bar { gap: 8px; font-size: 12px; }
    .weather-item { padding: 3px 8px; }
    .weather-temp-val { font-size: 15px; }
}


/* === ȫ��푑�ʽ���� (2026-06-17) === */

/* �֙Cֱ�� */
@media (max-width: 480px) {
    .header { flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
    .header-right { gap: 4px; flex-wrap: wrap; }
    .header-right select { 
        max-width: 80px; font-size: 10px !important; padding: 3px 4px !important;
    }
    .header-right button, .header-right span { font-size: 11px !important; }
    
    .logo { font-size: 13px; white-space: nowrap; }
    
    .page-header { padding: 10px 12px; }
    .log-tabs { flex-wrap: wrap; gap: 2px; }
    .log-tab { flex: 1; min-width: 0; font-size: 12px !important; text-align: center; padding: 8px 6px !important; white-space: nowrap; }
    .page-header h2 { font-size: 16px; }
    
    .stats-grid, .dashboard-grid.dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px;
    }
    .stat-card { padding: 12px; }
    .stat-icon { font-size: 24px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 11px; }
    
    .search-bar { flex-direction: column; gap: 6px; }
    .search-bar input, .search-bar select { width: 100%; font-size: 16px !important; }
    
    /* ALL modals ����ȫ�� */
    .modal, [class*=modal] {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 100vw !important; height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    .modal-content, [class*=modal-content], [class*=modal-body] {
        width: 100% !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    /* °Ñ modal×ÓÔªËØ·Å»ØÕý³£²¼¾ÖÁ÷ */
    [class*=modal-header], [class*=modal-body], [class*=modal-footer] {
        position: static !important;
        width: auto !important;
        height: auto !important;
        top: auto !important;
        left: auto !important;
    }
    /* .modal-close Ò²±» [class*=modal] ÎóÉèÎª position:fixed */
    .modal-close {
        position: absolute !important;
        width: 36px !important;
        height: 36px !important;
        top: 50% !important;
        right: 15px !important;
        transform: translateY(-50%) !important;
    }
    /* ÈÃ header ³ÉÎª .modal-close µÄ¶¨Î»×æÏÈ */
    .modal-header {
        position: relative !important;
    }
    
    /* dbAlertBar 픲���ȫ�^ */
    .db-alert-bar, #dbAlertBar { font-size: 11px; padding: 4px 0; }
    
    /* �������б���֧�֙M��L�� */
    .table-wrapper, [class*=table-], table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
    
    /* ���o�M�Q�� */
    .btn-group, [class*=btn-group] {
        flex-wrap: wrap;
        gap: 4px;
    }
    .btn { padding: 8px 12px; font-size: 13px; min-height: 36px; }
    
    /* �����ˆ�/�x���� */
    select, .form-control { font-size: 16px !important; }
    
    /* deferred �M�� */
    .deferred-banner { padding: 6px 10px; font-size: 12px; }
    .deferred-banner button { font-size: 11px; padding: 3px 8px; }
    
    /* ��Ƭ�W���Ԅ��m�� */
    [class*=grid] { 
        grid-template-columns: 1fr !important;
    }
    [class*=grid2], [class*=two-col] {
        grid-template-columns: 1fr !important;
    }
    
    /* �������ײ����N�հ� */
    .main-content { padding-bottom: 10px; }
    
    /* �^�L�����ֽؔ� */
    td, th { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
    /* 操作欄按鈕不被截斷 */
    .datagrid-table td:last-child,
    .datagrid-table th:last-child,
    .data-table td:last-child,
    .data-table th:last-child {
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
}

/* Сƽ�� */
@media (min-width: 481px) and (max-width: 768px) {
    .dashboard-grid.dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
.weather-ico { height: 36px; vertical-align: middle; }
.weather-warn-ico { height: 26px; vertical-align: middle; }
.weather-feels { color: #6b7280; font-size: 12px; }
.weather-smglink { background: transparent; box-shadow: none; padding: 4px 6px; }

/* === ���M�� v3 === */
#weatherWidget { padding: 6px 16px; background: #f0f9ff; border-bottom: 1px solid #bae6fd; }
.wb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.wi { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.07); white-space: nowrap; }
.wi-temp { font-size: 14px; background: #e0f2fe; }
.w-ico { height: 30px; width: 30px; object-fit: contain; }
.w-ico-sm { height: 22px; width: 22px; object-fit: contain; }

/* ����ɫ */
.warn-typhoon { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.warn-rain { background: #dbeafe; color: #1e40af; border: 1px solid #60a5fa; }
.warn-wind { background: #f0fdf4; color: #166534; border: 1px solid #4ade80; }
.warn-storm { background: #fce7f3; color: #9d174d; border: 1px solid #f472b6; }
.warn-surge { background: #fef2f2; color: #991b1b; border: 1px solid #f87171; }
.warn-special { background: #fdf4ff; color: #6b21a8; border: 1px solid #c084fc; }
.warn-temp { background: #fff7ed; color: #9a3412; border: 1px solid #fb923c; }
.warn-earthquake { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }
.warn-default { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

.wi-smglink { background: transparent; box-shadow: none; color: #2563eb; font-size: 11px; text-decoration: none; padding: 3px 6px; }

@media (max-width: 768px) {
    #weatherWidget { padding: 4px 8px; }
    .wb { gap: 5px; font-size: 12px; }
    .wi { padding: 2px 7px; font-size: 11px; }
    .wi-temp { font-size: 12px; }
    .w-ico { height: 24px; width: 24px; }
    .w-ico-sm { height: 18px; width: 18px; }
}

/* ���� Ԕ�������� v4 ���� */
.wd { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 12px; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.wd-item { background: #fff; border-radius: 10px; padding: 12px 16px; border-left: 4px solid #d1d5db; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.wd-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wd-title { font-size: 16px; font-weight: 700; }
.wd-time { font-size: 12px; color: #6b7280; }
.wd-body { font-size: 14px; line-height: 1.7; color: #1f2937; }
.wd-footer { margin-top: 8px; }
.wd-link { color: #2563eb; font-size: 13px; text-decoration: none; }
.wd-link:hover { text-decoration: underline; }
.wd-img { margin-top: 8px; }

.wd-item.warn-typhoon { border-left-color: #f59e0b; }
.wd-item.warn-rain { border-left-color: #60a5fa; }
.wd-item.warn-wind { border-left-color: #4ade80; }
.wd-item.warn-storm { border-left-color: #f472b6; }
.wd-item.warn-surge { border-left-color: #f87171; }
.wd-item.warn-special { border-left-color: #c084fc; }
.wd-item.warn-temp { border-left-color: #fb923c; }
.wd-item.warn-earthquake { border-left-color: #ef4444; }

.w-ico-desc { color: #6b7280; font-size: 11px; margin-left: 2px; }

@media (max-width: 768px) {
    .wd { padding: 6px 8px 10px; gap: 6px; }
    .wd-item { padding: 10px 12px; }
    .wd-title { font-size: 14px; }
    .wd-body { font-size: 13px; }
}

/* ���wͨ�õ�.modal-contentҎ�t�����M�����Ǐ��� */
#weatherWidget .modal-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding: 24px;
}

.modal-content { width: auto; max-height: none; margin: 0; border-radius: 10px; }

/* ���� ���Ԕ�鿨Ƭ ���� */
.weather-detail-card .card-body { padding: 16px; }
.wd { display: flex; flex-direction: column; gap: 10px; }
.wd-item { background: #fff; border-radius: 10px; padding: 14px 18px; border-left: 5px solid #d1d5db; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.wd-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wd-title { font-size: 16px; font-weight: 700; }
.wd-time { font-size: 12px; color: #6b7280; }
.wd-body { font-size: 14px; line-height: 1.7; color: #1f2937; white-space: pre-wrap; }
.wd-footer { margin-top: 10px; }
.wd-link { color: #2563eb; font-size: 13px; text-decoration: none; }
.wd-link:hover { text-decoration: underline; }

.wd-item.warn-typhoon { border-left-color: #f59e0b; }
.wd-item.warn-rain { border-left-color: #60a5fa; }
.wd-item.warn-wind { border-left-color: #4ade80; }
.wd-item.warn-storm { border-left-color: #f472b6; }
.wd-item.warn-surge { border-left-color: #f87171; }
.wd-item.warn-special { border-left-color: #c084fc; }
.wd-item.warn-temp { border-left-color: #fb923c; }
.wd-item.warn-earthquake { border-left-color: #ef4444; }

@media (max-width: 768px) {
    .weather-detail-card .card-body { padding: 10px; }
    .wd-item { padding: 10px 12px; }
    .wd-title { font-size: 14px; }
    .wd-body { font-size: 13px; }
}

/* ���� ͨ�ÿ�Ƭ��.card ���� app.js ��ʹ�õ��o CSS�� ���� */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; }
.mt-4 { margin-top: 20px; }
.card-header { padding: 14px 20px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.card-title { margin: 0; font-size: 15px; font-weight: 600; color: #374151; }
.card-body { padding: 20px; }

@media (max-width: 768px) {
    .card-header { padding: 10px 14px; }
    .card-title { font-size: 14px; }
    .card-body { padding: 14px; }
}

/* 手機端：資料表橫向滾動 */
.datagrid-container, .datagrid-footer { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 手機端：修正側邊欄隱藏時左側空白（側邊欄 fixed 疊加，不推內容） */
@media (max-width: 768px) {
    .main-content { margin-left: 0; }
}

/* 手機端：頂欄緊湊 */
@media (max-width: 600px) {
    .header { height: 50px; padding: 0 10px; }
    .header .logo { font-size: 14px; }
    .header .datetime { font-size: 11px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .menu-toggle { font-size: 18px; padding: 4px 6px; min-height: 36px; }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body { background: #1a1b2e; color: #e5e7eb; }
    .sidebar { background: #232440; border-right-color: #2d2e4a; }
    .nav-item { color: #9ca3af; }
    .nav-item:hover { background: #2d2e4a; color: #a5b4fc; }
    .nav-item.active { background: #2d2e4a; color: #a5b4fc; border-left-color: #818cf8; }
    .card { background: #232440; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
    .card-header { background: #2d2e4a; border-bottom-color: #374151; }
    .card-title { color: #e5e7eb; }
    .datagrid-header { background: #2d2e4a; border-bottom-color: #374151; }
    .datagrid-footer { background: #2d2e4a; border-top-color: #374151; }
    .table, .data-table, .datagrid-table { color: #e5e7eb; }
    .data-table { background: #232440; }
    input, .form-control, .form-group select, .form-group textarea { background: #1a1b2e; border-color: #374151; color: #e5e7eb; }
    input:focus, .form-control:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.15); }
    .btn-secondary { background: #374151; color: #e5e7eb; }
    .btn-secondary:hover { background: #4b5563; }
    .btn-default { background: #374151; border-color: #4b5563; color: #e5e7eb; }
    .btn-default:hover { background: #4b5563; }
    .modal-body { background: #232440; color: #e5e7eb; }
    .modal-footer { background: #2d2e4a; border-top-color: #374151; }
    .modal-box { background: #232440; }
    .modal-content { background: #232440; }
    .checkbox-wrapper { background: #2d2e4a; }
    .vehicle-type-btn { background: #232440; border-color: #374151; }
    .vehicle-type-btn.active { background: #2d2e4a; border-color: #818cf8; }
    .vehicle-type-btn strong { color: #e5e7eb; }
    .header .datetime { color: rgba(255,255,255,0.7); }
}

/* ============================================================ */
/* ģ̬���ƶ����´��� body ǿ�� 100vh ��ǰ footer */
/* ============================================================ */
@media (max-width: 768px) {
    .modal-content {
        max-height: 100vh !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .modal-content .modal-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
    }
}
