﻿/* ===== 通用工具類別 ===== */
.hidden {
    display: none !important;
}

/* === v2.50.0 設計 Token (Pine 深松綠主題) ===
   來源: Claude Design「禮堂預約系統設計優化」
   風格: Pine 深松綠 + 12px 圓角 + Compact 密度 */
:root {
    --primary-gradient: linear-gradient(135deg, #1F4D3F 0%, #103127 100%);
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(225, 222, 207, 0.55);
    --glass-shadow: 0 8px 28px 0 rgba(20, 40, 30, 0.12);

    --primary-color: #1F4D3F;
    --primary-dark: #163A2F;
    --primary-darker: #0B2820;
    --secondary-color: #7AAD96;
    --accent-color: #C97B3F;
    --success-color: #4F9D6E;
    --warning-color: #C97B3F;
    --danger-color: #B45049;

    --bg-color: #F2F1E8;
    --bg-alt: #F8F7EE;
    --card-bg: #FFFFFF;
    --surface-2: #F8F7EE;
    --border-color: #E1DECF;
    --border-strong: #CCC7B3;

    --text-primary: #162622;
    --text-secondary: #56635C;
    --text-muted: #94998F;

    --accent-soft: #DCE9E2;
    --accent-softer: #EFF5F1;

    --shadow-sm: 0 1px 2px rgba(20, 40, 30, 0.05), 0 1px 3px rgba(20, 40, 30, 0.06);
    --shadow-md: 0 4px 16px -4px rgba(20, 40, 30, 0.10), 0 2px 6px rgba(20, 40, 30, 0.05);
    --shadow-lg: 0 24px 60px -20px rgba(20, 40, 30, 0.20), 0 8px 24px -8px rgba(20, 40, 30, 0.10);

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --font-display: 'Plus Jakarta Sans', 'Noto Sans TC', -apple-system, sans-serif;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* v2.41.3: 統一 z-index 階層 (避免層級衝突) */
    --z-header: 100;
    --z-fab: 500;             /* Floating action buttons */
    --z-modal-secondary: 1000; /* search/history/settings/booking */
    --z-modal-primary: 2000;   /* auth/delete/stats/dashboard */
    --z-modal-critical: 2200;  /* announcement (覆蓋所有) */
    --z-help-overlay: 2500;    /* keyboard help */
    --z-tooltip: 3000;         /* in-modal tooltips (month-day) */
    --z-toast: 4000;           /* Toast 必須高於所有 modal */
    --z-system-banner: 9999;   /* PWA 更新 banner */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* v2.40.0 (C.3): 強化系統字型 fallback，Web Font 載入前不空白 */
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang TC", "Microsoft JhengHei", "Hiragino Sans CNS",
                 system-ui, sans-serif;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* ===== 頂部導航列 ===== */
.header {
    background: var(--primary-gradient);
    background: radial-gradient(circle at top left, rgba(16, 49, 39, 0.8), transparent),
        radial-gradient(circle at bottom right, rgba(31, 77, 63, 0.8), transparent),
        var(--primary-gradient);
    color: white;
    padding: 1.25rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: headerGlow 10s infinite alternate linear;
    pointer-events: none;
    z-index: 0;
}

@keyframes headerGlow {
    from {
        transform: translate(-10%, -10%);
    }

    to {
        transform: translate(10%, 10%);
    }
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    position: relative;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    backdrop-filter: blur(4px);
    text-decoration: none;
    z-index: 2;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}
.header-title {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: titlePulseGlow 4s infinite alternate ease-in-out;
    cursor: pointer;
    user-select: none;
}
@keyframes titlePulseGlow {
    0% {
        transform: translateX(-50%) scale(1);
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    100% {
        transform: translateX(-50%) scale(1.01);
        text-shadow: 0 0 25px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

.header-title:hover {
    transform: translateX(-50%) scale(1.02);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.6),
        0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-title .title-sub {
    opacity: 1;
    font-weight: 600;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-title svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.btn-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.btn-dashboard {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.btn-dashboard:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}


.control-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    /* 讓按鈕群組佔滿剩餘空間，利於對齊 */
    min-width: 200px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.control-group:hover,
.control-group:focus-within {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(31, 77, 63, 0.12);
}

.control-group label {
    font-weight: 600;
    color: var(--primary-dark);
    white-space: nowrap;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.date-input {
    padding: 0.6rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: var(--transition-fast);
    min-width: 150px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 77, 63, 0.2);
}

.date-separator {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.room-select {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: var(--transition-fast);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.room-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 77, 63, 0.2);
}


.btn-search,
.btn-export,
.btn-stats,
.btn-history {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    /* 防止文字換行 */
}

.btn-search {
    background: var(--primary-gradient);
}

.btn-export {
    background: #48bb78;
}

.btn-stats {
    background: #9b4dca;
}

.btn-history {
    background: #6b46c1;
}

.btn-search:hover,
.btn-export:hover,
.btn-stats:hover,
.btn-history:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.1);
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-search:active {
    transform: translateY(0);
}

.date-hint {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== ?望?撠 ===== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    color: var(--primary-color);
    transition: var(--transition-fast);
}

.btn-nav:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.current-week {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 220px;
    text-align: center;
}

/* ===== ?望?蝬脫 ===== */
.calendar-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 2px;
    background: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-width: 980px;
}

/* ?交?甈? */
.calendar-day {
    background: var(--card-bg);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.calendar-day.weekend {
    background: #fafafa;
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(74, 158, 187, 0.08) 0%, rgba(92, 184, 214, 0.05) 100%);
}

.day-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}

.day-date {
    font-weight: 600;
    color: var(--text-primary);
}

.day-date .weekday {
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.day-header.weekend .day-date {
    color: var(--accent-color);
}

/* 預約按鈕 - 優化版 */
.btn-book {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: white;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 8px rgba(31, 77, 63, 0.35);
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-book::before {
    content: '+';
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.btn-book:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(31, 77, 63, 0.5);
}

.btn-book:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(31, 77, 63, 0.3);
}

/* 預約卡片區域 */
.day-bookings {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
    max-height: 300px;
}

.booking-card {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
    cursor: pointer;
}

.booking-card:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    transform: translateX(2px);
}

.booking-period {
    font-weight: 600;
    color: var(--text-primary);
}

.booking-name {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== ??敶? ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    /* v2.41.3: 預約彈窗略高於其他 secondary modal,確保從搜尋/歷史開的預約能蓋過來源 */
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.btn-cancel,
.btn-submit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: #e5e5e5;
}

.btn-submit {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-info {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    gap: 2rem;
}

.info-label {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.info-value {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.form-label.required {
    color: var(--accent-color);
}

.form-value {
    color: var(--text-primary);
    font-weight: 500;
}

.form-input {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    flex: 1;
    max-width: 250px;
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 187, 0.2);
}

.form-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* 驗證錯誤高亮與震動 */
.invalid-shake {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 4px rgba(245, 101, 101, 0.25) !important;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition-fast);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 187, 0.2);
}

/* 蝭甈⊿??*/
.period-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.period-checkbox {
    position: relative;
}

.period-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.period-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.period-checkbox input:checked+label {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.period-checkbox input:disabled+label {
    background: #f0f0f0;
    border-color: #ccc;
    color: #aaa;
    cursor: not-allowed;
    text-decoration: line-through;
}

.period-checkbox.unavailable label {
    background: #f1f5f9;
    color: #94a3b8;
    border-style: dashed;
    opacity: 0.8;
}

.period-checkbox.unavailable .lock-icon {
    font-size: 0.8rem;
    margin-left: 2px;
    filter: grayscale(1);
}

.period-checkbox label:hover:not(:has(input:disabled)) {
    border-color: var(--primary-color);
}

/* ???? */
.repeat-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: #fafafa;
    border-radius: var(--radius-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.repeat-info {
    color: var(--text-secondary);
}

.repeat-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.repeat-end label {
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== Toast ? ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    /* v2.41.3: 提升 z-index 確保 toast 在所有 modal 之上 (4000 > 2200 announcement) */
    z-index: var(--z-toast, 4000);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.toast.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

/* ===== v2.40.0 (V.5): Toast 撤銷按鈕 ===== */
.toast.has-action {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
}

.toast .toast-message {
    font-weight: 500;
}

.toast .toast-action-btn {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.toast .toast-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.04);
}

.toast .toast-action-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.toast .toast-countdown {
    font-size: 0.78rem;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* ===== v2.40.0 (V.3): 月視圖衝突熱度 ===== */
.month-day.heat-light  { background: linear-gradient(180deg, transparent 0%, #ecfdf5 100%); }
.month-day.heat-medium { background: linear-gradient(180deg, transparent 0%, #fef9c3 100%); }
.month-day.heat-busy   { background: linear-gradient(180deg, transparent 0%, #ffedd5 100%); }
.month-day.heat-full   { background: linear-gradient(180deg, transparent 0%, #fee2e2 100%); }

.month-day.heat-light:hover,
.month-day.heat-medium:hover,
.month-day.heat-busy:hover,
.month-day.heat-full:hover {
    filter: brightness(0.97);
}

.month-day::after {
    content: attr(data-booked-count);
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.68rem;
    color: var(--text-muted, #6b7280);
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.month-day.heat-free::after,
.month-day:not([data-booked-count])::after { content: none; }

.month-day { position: relative; }

/* ===== v2.40.0 (V.4): 月視圖 hover Tooltip ===== */
.month-day-tooltip {
    position: absolute;
    z-index: 3000;
    min-width: 220px;
    max-width: 320px;
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
}

.month-day-tooltip.visible {
    opacity: 1;
}

.mdt-header {
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.4rem;
    color: #f0abfc;
}

.mdt-count {
    font-weight: 400;
    font-size: 0.78rem;
    opacity: 0.85;
}

.mdt-body {
    display: grid;
    gap: 0.25rem;
    max-height: 240px;
    overflow-y: auto;
}

.mdt-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.mdt-row:last-child { border-bottom: none; }

.mdt-period {
    color: #93c5fd;
    font-weight: 600;
    flex-shrink: 0;
}

.mdt-booker {
    color: #fde68a;
    text-align: right;
    word-break: break-all;
}

.mdt-hint {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.74rem;
    opacity: 0.7;
    font-style: italic;
}

/* ===== v2.40.0 (V.1): 鍵盤快捷鍵說明彈窗 ===== */
.keyboard-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}

.keyboard-help-overlay.active {
    display: flex;
    animation: fadeIn .2s ease;
}

.keyboard-help-modal {
    background: #fff;
    border-radius: 16px;
    width: min(90vw, 480px);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.keyboard-help-modal .modal-header {
    background: linear-gradient(135deg, #1F4D3F 0%, #103127 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.keyboard-help-modal .modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.keyboard-help-modal .btn-close {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    width: 32px; height: 32px;
    border-radius: 999px;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.keyboard-help-modal .btn-close:hover {
    background: rgba(255, 255, 255, 0.32);
}

.keyboard-help-modal .modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.keyboard-help-table {
    width: 100%;
    border-collapse: collapse;
}

.keyboard-help-table th,
.keyboard-help-table td {
    text-align: left;
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid #e5e7eb;
}

.keyboard-help-table th {
    font-weight: 700;
    color: #475569;
    font-size: 0.85rem;
}

.keyboard-help-table kbd {
    display: inline-block;
    padding: 3px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 1px 0 #d1d5db;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: #1f2937;
}

.keyboard-help-hint {
    margin-top: 0.85rem;
    padding: 0.55rem 0.75rem;
    background: #fef9c3;
    border-left: 3px solid #facc15;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #713f12;
}

/* 手機版：Tooltip 改為置中固定底部 */
@media (max-width: 768px) {
    .month-day-tooltip {
        position: fixed !important;
        top: auto !important;
        bottom: 1rem;
        left: 1rem !important;
        right: 1rem;
        width: auto;
        max-width: none;
    }

    .month-day::after {
        font-size: 0.62rem;
        bottom: 2px;
        right: 4px;
    }
}

/* ===== RWD 響應式設計 ===== */
@media (max-width: 1024px) {
    .control-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-group {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0;
        position: relative;
    }

    .header-title {
        font-size: 1.1rem;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        margin: 0;
    }

    .desktop-text,
    #adminLoginText {
        display: none;
    }

    .btn-back,
    .btn-admin {
        padding: 0.5rem;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .btn-back:hover,
    .btn-admin:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: none;
    }

    .main-content {
        padding: 1rem;
    }

    .calendar-container {
        padding: 1rem;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 1rem;
    }

    .period-checkboxes {
        gap: 0.5rem;
    }

    .period-checkbox label {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    .repeat-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ===== 匯出按鈕 ===== */
.btn-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-export:active {
    transform: translateY(0);
}

/* ===== 密碼驗證彈窗 ===== */
.password-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.password-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.password-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
    text-align: center;
}

.password-modal-overlay.active .password-modal {
    transform: translateY(0) scale(1);
}

.password-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.password-modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.password-modal-desc {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.password-booking-info {
    background: linear-gradient(135deg, #fff5f5 0%, #fee5e5 100%);
    border: 1px solid #ffcccc;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: left;
}

.password-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    text-align: center;
    transition: var(--transition-fast);
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 187, 0.2);
}

.password-error {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

.password-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-password-cancel,
.btn-password-confirm {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-password-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: var(--text-secondary);
}

.btn-password-cancel:hover {
    background: #e5e5e5;
}

.btn-password-confirm {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-password-confirm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== 管理員登入按鈕 ===== */
.btn-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    backdrop-filter: blur(4px);
    margin-left: auto;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-admin.logged-in {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

/* ===== 視圖切換按鈕 ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-color);
}

.view-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.view-btn:hover {
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* ===== 月曆視圖 ===== */
.month-calendar {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.month-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-color);
}

.month-weekday {
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.month-weekday:first-child,
.month-weekday:last-child {
    color: var(--accent-color);
}

.month-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--border-color);
    /* 透過背景色產生統一格線 */
    gap: 1px;
}

.month-day {
    min-height: 100px;
    padding: 0.25rem;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--card-bg);
    /* 單元格色彩 */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    /* v2.47.5: 防止內部 nowrap 文字撐寬 grid cell, 確保 7 欄等寬 */
    min-width: 0;
    overflow: hidden;
}

/* 移除舊有的 nth-child 邊框處理，改用容器 gap 控制 */

.month-day:hover {
    background: var(--accent-softer);
}

.month-day.other-month {
    background: #FAF8EE;
    color: var(--text-muted);
}

.month-day.today {
    background: rgba(31, 77, 63, 0.06);
}

.month-day.weekend {
    background: var(--bg-alt);
}

.month-day-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 0.25rem;
}

.month-day-date {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.month-day.weekend .month-day-date,
.month-day.other-month.weekend .month-day-date {
    color: var(--accent-color);
}

.month-day.other-month .month-day-date {
    color: var(--text-muted);
}

.month-day-bookings {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.month-booking-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(31, 77, 63, 0.1);
    border-left: 2px solid var(--primary-color);
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 0.75rem;
    overflow: hidden;
    /* v2.47.5: 防止內部 nowrap 文字撐寬 booking item */
    min-width: 0;
    max-width: 100%;
}

.mb-period {
    background: var(--primary-color);
    color: white;
    padding: 0 4px;
    border-radius: 2px;
    font-weight: 700;
    font-size: 0.7rem;
    min-width: 16px;
    text-align: center;
}

.mb-booker {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-weight: 500;
    /* v2.47.5: 確保 ellipsis 真的生效 (flex item 需要 min-width: 0) */
    min-width: 0;
    flex: 1;
}

/* v2.47.5: month-calendar-grid 防止總寬度溢出視窗 */
.month-calendar-grid,
.month-calendar-header {
    width: 100%;
    box-sizing: border-box;
}
.month-calendar {
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.month-booking-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2px 0;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 2px;
}

/* ===== 登入彈窗 ===== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.auth-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
    text-align: center;
}

.auth-modal-overlay.active .auth-modal {
    transform: translateY(0) scale(1);
}

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.auth-modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-modal-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 187, 0.2);
}

.auth-error {
    color: var(--accent-color);
    font-size: 0.85rem;
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
}

.auth-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-auth-cancel,
.btn-auth-confirm {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-auth-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: var(--text-secondary);
}

.btn-auth-cancel:hover {
    background: #e5e5e5;
}

.btn-auth-confirm {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-auth-confirm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== 刪除確認彈窗 ===== */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.delete-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.delete-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
    text-align: center;
}

.delete-modal-overlay.active .delete-modal {
    transform: translateY(0) scale(1);
}

.delete-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.delete-modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.delete-booking-info {
    background: linear-gradient(135deg, #fff5f5 0%, #fee5e5 100%);
    border: 1px solid #ffcccc;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: left;
}

.delete-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-delete-cancel,
.btn-delete-confirm {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-delete-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: var(--text-secondary);
}

.btn-delete-cancel:hover {
    background: #e5e5e5;
}

.btn-delete-confirm {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-delete-confirm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== 月曆 RWD ===== */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .month-day {
        min-height: 80px;
        /* 增加手機端高度，確保內容不擠壓 */
        padding: 0.25rem;
    }

    .month-day-date {
        font-size: 0.9rem;
    }

    .month-weekday {
        padding: 0.5rem 0;
        font-size: 0.85rem;
    }

    .booking-dot {
        width: 6px;
        height: 6px;
    }

    .auth-modal,
    .delete-modal {
        padding: 1.5rem;
    }
}

/* ===== 統計按鈕 ===== */
.btn-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-stats:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== 統計彈窗 ===== */
/* ===== 統計彈窗 (Bento Grid + Glassmorphism) ===== */
.stats-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.5rem;
}

.stats-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.stats-modal {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: translateY(30px) scale(0.98);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stats-modal-overlay.active .stats-modal {
    transform: translateY(0) scale(1);
}

.stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.btn-stats-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-stats-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: rotate(90deg);
}

.stats-modal-body {
    padding: 1.5rem 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Bento Grid 佈局 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.stats-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.stats-card.pie-box {
    grid-column: span 5;
    display: flex;
    flex-direction: column;
}

.stats-card.bar-box {
    grid-column: span 7;
}

.stats-card.trend-box {
    grid-column: span 12;
}

.stats-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0.9;
}

/* 圖表樣式優化 */
.pie-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.stats-pie-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stats-pie-chart::after {
    content: '';
    position: absolute;
    inset: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pie-legend {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.pie-legend-item:hover {
    background: #f1f5f9;
}

.pie-legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pie-legend-name {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

.pie-legend-value {
    font-weight: 700;
    color: var(--primary-color);
}

.stats-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bar-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bar-value {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.bar-container {
    height: 12px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    width: 0;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.stats-trend-chart {
    height: 180px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 1rem 0;
}

.trend-bar {
    flex: 1;
    background: var(--primary-gradient);
    border-radius: 4px 4px 0 0;
    transition: height 1s ease, opacity 0.3s ease;
    cursor: help;
    opacity: 0.7;
    min-height: 4px;
}

.trend-bar:hover {
    opacity: 1;
    filter: brightness(1.1);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-4px);
}

.summary-value {
    font-size: 2.25rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}


/* ===== 全局 RWD 手機版優化 (max-width: 600px) ===== */
@media (max-width: 600px) {

    /* ===== Header 優化 ===== */
    .header {
        padding: 1rem 1rem 1.25rem;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .btn-back {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .btn-back svg {
        width: 16px;
        height: 16px;
    }

    .header-title {
        font-size: 1.1rem;
        gap: 0.25rem;
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 0;
        position: relative;
        left: 0;
        transform: none !important;
        /* 強制覆寫桌面端的居中偏置 */
        white-space: normal;
        flex-direction: column;
        text-align: center;
        line-height: 1.2;
        transition: transform 0.3s ease;
        animation: titlePulseGlowMobile 4s infinite alternate ease-in-out;
    }

    @keyframes titlePulseGlowMobile {
        0% {
            transform: scale(1);
            text-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
        }

        100% {
            transform: scale(1.03);
            text-shadow: 0 0 25px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(0, 0, 0, 0.3);
        }
    }

    .header-title:hover {
        transform: scale(1.05) !important;
    }

    .header-title svg {
        margin-bottom: 0.25rem;
        width: 24px;
        height: 24px;
        opacity: 0.9;
    }

    .header-title .title-main {
        display: block;
        font-size: 1.25rem;
        font-weight: 800;
        letter-spacing: 0.5px;
        margin-bottom: 0.25rem;
    }

    .header-title .title-sub {
        display: inline-block;
        font-size: 0.95rem;
        margin-left: 0;
        background: rgba(255, 255, 255, 0.25);
        padding: 4px 18px;
        border-radius: 50px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .header-title svg {
        width: 20px;
        height: 20px;
    }

    .btn-admin {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    /* ===== 控制面板優化 ===== */
    .control-panel {
        padding: 1rem;
    }

    .control-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .control-group label {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }

    .date-input,
    .room-select {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .date-separator {
        text-align: center;
        margin: 0.25rem 0;
    }

    .btn-search,
    .btn-export,
    .btn-stats {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .date-hint {
        font-size: 0.75rem;
        text-align: center;
    }

    /* ===== 日曆區域優化 ===== */
    .calendar-container {
        padding: 1rem;
    }

    .calendar-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .calendar-nav {
        width: 100%;
        justify-content: space-between;
    }

    .current-week {
        font-size: 0.9rem;
    }


    .day-header {
        padding: 0.5rem;
    }

    .day-date {
        font-size: 0.85rem;
    }

    .weekday {
        font-size: 0.75rem;
    }

    .btn-book {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .booking-card {
        padding: 0.4rem;
    }

    .booking-period {
        font-size: 0.7rem;
    }

    .booking-name {
        font-size: 0.75rem;
    }

    /* ===== 月曆視圖優化 ===== */
    .month-weekday {
        padding: 0.5rem 0;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        /* 防止擠壓 */
    }

    .month-calendar-header,
    .month-calendar-grid {
        gap: 1px;
        /* 確保標題與網格間隙一致 */
    }

    .month-day {
        min-height: 70px;
        padding: 0.2rem;
    }

    .month-day-date {
        font-size: 0.85rem;
    }

    .month-booking-item {
        padding: 1px 2px;
        font-size: 0.7rem;
    }

    .mb-period {
        min-width: 14px;
        padding: 0 2px;
        font-size: 0.65rem;
    }

    .booking-count {
        font-size: 0.65rem;
        padding: 0.1rem 0.25rem;
    }

    /* ===== 預約彈窗優化 ===== */
    .modal {
        width: 95%;
        max-height: 90vh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .btn-cancel,
    .btn-submit {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .form-label {
        font-size: 0.85rem;
    }

    .form-input,
    .form-textarea {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .period-checkboxes {
        gap: 0.4rem;
    }

    .period-checkbox {
        padding: 0.5rem;
    }

    .period-checkbox label {
        font-size: 0.8rem;
    }

    /* ===== 登入/刪除/統計彈窗優化 ===== */
    .auth-modal,
    .delete-modal,
    .stats-modal {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
    }

    .auth-modal-header h3,
    .delete-modal-header h3 {
        font-size: 1.1rem;
    }

    .auth-input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .btn-auth-cancel,
    .btn-auth-confirm,
    .btn-delete-cancel,
    .btn-delete-confirm {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* ===== 統計彈窗優化 ===== */
    .stats-modal-header {
        padding: 1rem;
    }

    .stats-modal-header h3 {
        font-size: 1rem;
    }

    .stats-modal-body {
        padding: 1rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-card {
        padding: 1rem;
    }

    /* 週曆改為直向排列，移除最小寬度限制 */
    .calendar-grid {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem;
        overflow-x: visible;
        min-width: auto !important;
        width: 100%;
        border: none;
        background: transparent;
        border-radius: 0;
    }

    .calendar-day {
        min-width: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
        min-height: auto;
    }

    .day-header {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .day-date {
        font-size: 1rem;
    }

    .weekday {
        font-size: 0.85rem;
    }

    .day-bookings {
        padding: 0.75rem;
    }

    .booking-card {
        padding: 0.6rem;
        margin-bottom: 0.5rem;
    }

    .booking-period {
        font-size: 0.8rem;
    }

    .booking-name {
        font-size: 0.9rem;
    }

    /* 確保今天的樣式更明顯 */
    .calendar-day.today {
        border: 2px solid var(--primary-color);
    }

    /* 週末樣式調整 */
    .calendar-day.weekend {
        background: linear-gradient(135deg, #fff8f8 0%, #fff0f0 100%);
    }

    /* 隱藏 header 中的預約按鈕 */
    .day-header .btn-book {
        display: none !important;
    }

    /* 顯示底部預約按鈕 */
    .day-footer {
        display: block;
        padding: 0.75rem;
        border-top: 1px dashed var(--border-color);
    }

    .btn-book-mobile {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        background: var(--primary-gradient);
        border: none;
        border-radius: var(--radius-md);
        color: white;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: var(--transition-fast);
    }

    .btn-book-mobile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .btn-book-mobile:active {
        transform: translateY(0);
    }
}


/* ===== 手機端底部預約按鈕 ===== */
/* 預設隱藏（桌面端） */
.day-footer {
    display: none;
}

/* 手機端顯示預約按鈕 */
@media (max-width: 600px) {
    .day-footer {
        display: block !important;
        padding: 0.5rem 0.75rem 0.75rem;
        border-top: none;
        background: transparent;
    }

    .btn-book-mobile {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.85rem 1rem;
        background: var(--primary-gradient);
        border: none;
        border-radius: var(--radius-md);
        color: white;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: var(--transition-fast);
    }

    .btn-book-mobile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .period-checkbox label {
        font-size: 0.8rem;
    }

    /* ===== 登入/刪除/統計彈窗優化 ===== */
    .auth-modal,
    .delete-modal,
    /* ===== 統計彈窗優化 ===== */
    .stats-modal {
        max-height: 95vh;
        border-radius: 20px;
    }

    .stats-modal-header {
        padding: 1rem 1.25rem;
    }

    .stats-modal-header h3 {
        font-size: 1.25rem;
    }

    .stats-modal-body {
        padding: 1.25rem;
        gap: 1rem;
    }

    .stats-row {
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
    }

    .stats-card.pie-box,
    .stats-card.bar-box,
    .stats-card.trend-box {
        grid-column: span 1;
    }

    .stats-card {
        padding: 1.25rem;
    }

    .stats-pie-chart {
        width: 150px;
        height: 150px;
    }

    .stats-pie-chart::after {
        inset: 35px;
    }

    .stats-trend-chart {
        height: 140px;
        gap: 3px;
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .summary-card {
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .summary-value {
        font-size: 1.5rem;
    }

    /* 週曆改為直向排列，移除最小寬度限制 */
    .calendar-grid {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem;
        overflow-x: visible;
        min-width: auto !important;
        width: 100%;
        border: none;
        background: transparent;
        border-radius: 0;
    }

    .calendar-day {
        min-width: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
        min-height: auto;
    }

    .day-header {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .day-date {
        font-size: 1rem;
    }

    .weekday {
        font-size: 0.85rem;
    }

    .day-bookings {
        padding: 0.75rem;
    }

    .booking-card {
        padding: 0.6rem;
        margin-bottom: 0.5rem;
    }

    .booking-period {
        font-size: 0.8rem;
    }

    .booking-name {
        font-size: 0.9rem;
    }

    /* 確保今天的樣式更明顯 */
    .calendar-day.today {
        border: 2px solid var(--primary-color);
    }

    /* 週末樣式調整 */
    .calendar-day.weekend {
        background: linear-gradient(135deg, #fff8f8 0%, #fff0f0 100%);
    }

    /* 隱藏 header 中的預約按鈕 */
    .day-header .btn-book {
        display: none !important;
    }

    /* 顯示底部預約按鈕 */
    .day-footer {
        display: block;
        padding: 0.75rem;
        border-top: 1px dashed var(--border-color);
    }

    .btn-book-mobile {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        background: var(--primary-gradient);
        border: none;
        border-radius: var(--radius-md);
        color: white;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: var(--transition-fast);
    }

    .btn-book-mobile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .btn-book-mobile:active {
        transform: translateY(0);
    }
}


/* ===== 手機端底部預約按鈕 ===== */
/* 預設隱藏（桌面端） */
.day-footer {
    display: none;
}

/* 手機端顯示預約按鈕 */
@media (max-width: 600px) {
    .day-footer {
        display: block !important;
        padding: 0.5rem 0.75rem 0.75rem;
        border-top: none;
        background: transparent;
    }

    .btn-book-mobile {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.85rem 1rem;
        background: var(--primary-gradient);
        border: none;
        border-radius: var(--radius-md);
        color: white;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: var(--transition-fast);
    }

    .btn-book-mobile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .btn-book-mobile:active {
        transform: translateY(0);
        box-shadow: var(--shadow-sm);
    }

    .btn-book-mobile svg {
        flex-shrink: 0;
    }
}

/* ===== 動畫與微互動 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* 按鈕微互動 */
.btn-search:active,
.btn-export:active,
.btn-stats:active,
.btn-nav:active,
.btn-admin:active,
.btn-back:active,
.view-btn:active {
    transform: scale(0.95);
}

/* 彈窗動畫優化 */
.modal,
.auth-modal,
.stats-modal,
.delete-modal {
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== 骨架屏 (Skeleton Loading) ===== */
.skeleton {
    background: #f0f0f0;
    background-image: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
    width: 80%;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-card {
    height: 80px;
    margin: 0.5rem;
    border-radius: var(--radius-sm);
}

.skeleton-cell {
    height: 100%;
    min-height: 120px;
    padding: 0.5rem;
}

/* ===== 進階搜尋功能 ===== */

/* 搜尋面板 */
.search-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* 搜尋輸入框容器 */
.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 77, 63, 0.2);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* 節次篩選下拉選單 */
.search-filter-select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: var(--transition-fast);
    min-width: 140px;
}

.search-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 77, 63, 0.2);
}

/* 進階搜尋按鈕 */
/* v2.41.2: 場地搜尋範圍切換按鈕 */
.btn-search-scope {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f0f9ff;
    color: #0369a1;
    border: 1.5px solid #7dd3fc;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}

.btn-search-scope:hover {
    background: #e0f2fe;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.btn-search-scope.all-rooms {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #f59e0b;
}

.btn-search-scope.all-rooms:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
}

/* v2.41.2: 搜尋結果範圍 badge (legacy, 保留向下相容) */
.search-scope-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.search-scope-badge.scope-current {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.search-scope-badge.scope-all {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

/* v2.41.7: 完整搜尋條件 chips 與分布提示 */
.search-summary-main {
    margin-bottom: 0.5rem;
}
.search-summary-main .count {
    font-size: 1.4rem;
    font-weight: 700;
    color: #6366f1;
    margin: 0 0.15rem;
}

.search-criteria-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.search-criteria-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

.chip-scope-current {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}
.chip-scope-all {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}
.chip-period {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #c4b5fd;
}
.chip-keyword {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.chip-date {
    background: #f0fdf4;
    color: #15803d;
    border-color: #86efac;
}
.chip-empty {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
    font-weight: 500;
    opacity: 0.85;
}

.search-distribution-hint {
    margin-top: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #713f12;
    line-height: 1.5;
}

.search-distribution-hint strong {
    color: #92400e;
}

@media (max-width: 768px) {
    .btn-search-scope {
        padding: 0.45rem 0.7rem;
        font-size: 0.82rem;
    }
}

.btn-search-advanced {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-search-advanced:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-search-advanced:active {
    transform: scale(0.95);
}

/* 搜尋結果彈窗 */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.search-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal-overlay.active .search-modal {
    transform: translateY(0) scale(1);
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
}

.search-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.btn-search-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: var(--transition-fast);
}

.btn-search-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.search-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* 搜尋結果摘要 */
.search-result-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-summary .count {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.25rem;
}

/* 搜尋結果列表 */
.search-result-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-result-item {
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-result-item .history-item {
    margin-bottom: 0.75rem;
    border-left-color: #10b981;
}

.search-result-item:hover .history-item {
    background: #f0fdf4;
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.search-result-date {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-room-badge {
    background: #22c55e;
    color: white;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.2);
}

.search-result-period {
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.search-result-booker {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

.search-result-reason {
    max-width: 200px;
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-no-result {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.search-no-result svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.search-no-result p {
    font-size: 1.1rem;
}

/* 搜尋結果高亮 */
.search-highlight {
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
}

/* RWD 響應式 - 搜尋面板 */
@media (max-width: 768px) {
    .search-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        max-width: none;
    }

    .search-filter-select {
        width: 100%;
    }

    .btn-search-advanced {
        width: 100%;
        justify-content: center;
    }

    .search-modal {
        width: 95%;
        max-height: 90vh;
    }

    .search-modal-body {
        padding: 1rem;
    }

    .search-result-item {
        flex-wrap: wrap;
    }

    .search-result-reason {
        max-width: none;
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* ===== 不開放時段設定彈窗 ===== */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 1rem;
}

.settings-modal-overlay.active {
    display: flex;
    animation: fadeIn var(--transition-normal);
}

.settings-modal {
    background: var(--card-bg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: scaleIn var(--transition-normal);
    overflow: hidden;
    /* 防止內容溢出圓角 */
}

.settings-modal-header {
    padding: 1.25rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
}

.btn-settings-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition-fast);
}

.btn-settings-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.settings-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    /* 重要：讓主體占滿剩餘空間，確保留下空間給頁尾 */
}

.settings-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.settings-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}

.settings-table th,
.settings-table td {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.settings-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.settings-table td:first-child {
    background: var(--bg-secondary);
    font-weight: 600;
    text-align: left;
}

.unavailable-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.settings-modal-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn-settings-save {
    background: var(--success-color);
    /* 修正變數名 */
    color: white !important;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-settings-save:hover {
    background: var(--success-color);
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-setting {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-setting:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

.header-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    z-index: 2; /* 確保按鈕在絕對定位的 title 之上 */
    position: relative;
}

/* ==========================================================================
   v2.47.4: Header Admin RWD — 防止按鈕擠在一起 / 跟標題重疊
   ========================================================================== */

/* 平板 (768~1200px): 隱藏所有按鈕文字, 統一變 40x40 方形 icon */
@media (min-width: 768px) and (max-width: 1199px) {
    .header-admin {
        gap: 0.4rem;
    }
    .line-bind-label,
    #adminLoginText,
    .line-bind-label-text {
        display: none !important;
    }
    .btn-line-bind,
    .btn-admin {
        padding: 0 0.4rem !important;
        width: 40px !important;
        height: 40px !important;
        justify-content: center !important;
    }
    /* 確保標題不會跟按鈕區重疊 */
    .header-title {
        font-size: 1.5rem !important;
    }
}

/* 手機 (<768px): 標題改自然流, 按鈕在下方排成一行 */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    /* 標題在 mobile 已有自己的 RWD (line 2293), 這邊只確保 z-index 不蓋按鈕 */
    .header-admin {
        position: relative;
        width: 100%;
        gap: 0.4rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    /* 所有按鈕統一變正方形 icon-only */
    .header-admin > button {
        height: 38px !important;
        min-width: 38px !important;
        padding: 0 0.4rem !important;
    }
    .line-bind-label,
    #adminLoginText {
        display: none !important;
    }
    .btn-line-bind,
    .btn-admin {
        width: 38px !important;
        justify-content: center !important;
    }
}

/* 超窄手機 (<480px): 按鈕再小一點 */
@media (max-width: 480px) {
    .header-admin {
        gap: 0.3rem;
    }
    .header-admin > button {
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 0.35rem !important;
    }
    .btn-line-bind,
    .btn-admin {
        width: 36px !important;
    }
    /* SVG 也微縮 */
    .header-admin > button svg {
        width: 18px !important;
        height: 18px !important;
    }
    .btn-line-bind .line-logo {
        width: 26px !important;
        height: 26px !important;
    }
}

/* ===== 日曆不開放狀態 ===== */
.month-day.unavailable,
.day-periods .period-item.unavailable {
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    position: relative;
    opacity: 0.8;
}

.period-item.unavailable {
    border-left: 4px solid #ccc !important;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%) !important;
    pointer-events: none;
}

.unavailable-badge {
    background: #999;
    color: white;
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 4px;
    display: inline-block;
}

/* 手機端寬度適配 */
@media (max-width: 600px) {
    .settings-modal {
        max-height: 95vh;
    }

    .settings-table th,
    .settings-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
}

/* ===== 歷史記錄功能 ===== */

.btn-history {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3D7B65 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-history:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 歷史記錄彈窗 */
.history-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 58, 74, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.history-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.history-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #3D7B65 0%, #7c3aed 100%);
    color: white;
}

.history-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.btn-history-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: var(--transition-fast);
}

.btn-history-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.history-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.history-month-input {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
}

.btn-history-load {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-history-load:hover {
    transform: translateY(-2px);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-left: 5px solid #3D7B65;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-date {
    min-width: 100px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    padding-top: 2px;
}

.history-periods-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 3;
    /* 給予更多空間放標籤 */
    min-width: 180px;
}

.history-period-tag {
    background: #f3f0ff;
    color: #6d28d9;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: normal;
    /* 改為 normal 確保標籤內文字也可換行，或維持 nowrap 但容器必須 wrap */
    border: 1px solid #ddd6fe;
}

.history-room {
    background: #ecfdf5;
    color: #059669;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid #d1fae5;
}

.history-booker {
    min-width: 80px;
    color: var(--dash-text-main);
    font-weight: 600;
    font-size: 1rem;
}

.history-reason {
    flex: 2;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-all;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    align-self: flex-start;
}

.btn-history-delete {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-history-delete:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* ===== 一鍵重複預約按鈕 (v2.39.0) ===== */
.btn-history-rebook {
    background: linear-gradient(135deg, #1F4D3F 0%, #103127 100%);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    box-shadow: 0 2px 8px rgba(31, 77, 63, 0.35);
    white-space: nowrap;
    line-height: 1;
}

.btn-history-rebook:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 4px 14px rgba(31, 77, 63, 0.55);
    filter: brightness(1.06);
}

.btn-history-rebook:active {
    transform: scale(0.96);
}

.btn-history-rebook svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .btn-history-rebook {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
    .btn-history-rebook span {
        display: none; /* 手機版只顯示 icon 節省空間 */
    }
}

/* ===== 批次預約功能 ===== */

.batch-booking-group {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.batch-dates {
    margin-top: 1rem;
}

.batch-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.batch-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 1rem;
}

.batch-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    background: white;
}

.batch-calendar-day:hover {
    background: var(--bg-color);
}

.batch-calendar-day.selected {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
}

.batch-calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.selected-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-date-tag {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.selected-date-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
}

/* RWD 響應式 */
@media (max-width: 768px) {
    .history-modal {
        width: 95%;
        max-height: 90vh;
    }

    .history-filters {
        flex-direction: column;
    }

    .history-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }

    .history-date {
        font-size: 1rem;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
        width: 100%;
    }

    .history-periods-container {
        min-width: 0;
        flex: none;
        padding: 0.25rem 0;
    }

    .history-room {
        align-self: flex-start;
    }

    .history-booker {
        font-size: 0.95rem;
        padding: 0.25rem 0;
    }

    .history-actions {
        width: 100%;
        margin-left: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        justify-content: flex-end;
        align-items: center;
    }

    .history-reason {
        max-width: none;
        width: 100%;
        font-size: 0.9rem;
    }
}

/* ===== 數據儀表板 (UI Optimized) ===== */

/* 新增配色變數 (Educational App Theme) */
:root {
    --dash-primary: #4F46E5;
    /* Indigo */
    --dash-primary-light: #EEF2FF;
    --dash-accent: #F97316;
    /* Orange */
    --dash-accent-light: #FFF7ED;
    --dash-success: #22C55E;
    --dash-success-light: #F0FDF4;
    --dash-danger: #EF4444;
    --dash-danger-light: #FEF2F2;
    --dash-bg: #F8FAFC;
    --dash-card-bg: #FFFFFF;
    --dash-text-main: #1E293B;
    --dash-text-sub: #64748B;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.dashboard-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    /* 降低遮罩透明度，突顯 Modal */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.dashboard-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.dashboard-modal {
    background: var(--dash-bg);
    border-radius: 24px;
    /* 更圓潤的角 */
    width: 95%;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: var(--transition-normal);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.dashboard-modal-overlay.active .dashboard-modal {
    transform: scale(1);
}

.dashboard-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--dash-text-main);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.btn-dashboard-close {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.btn-dashboard-close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    transform: rotate(90deg);
}

.dashboard-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background: var(--dash-bg);
}

/* Bento Grid 佈局 */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 強制三欄 */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }
}

/* 指標卡片 (Glassmorphism + Gradient) */
.metric-card {
    background: var(--dash-card-bg);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--dash-primary);
    opacity: 0.8;
}

.metric-card:nth-child(2)::before {
    background: var(--dash-primary);
}

/* Indigo */
.metric-card:nth-child(3)::before {
    background: var(--dash-accent);
}

/* Orange */

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.metric-icon.blue {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.metric-icon.purple {
    background: #F3E8FF;
    color: #9333EA;
}

.metric-icon.red {
    background: var(--dash-danger-light);
    color: var(--dash-danger);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--dash-text-sub);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dash-text-main);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* 儀表板區塊 */
.dashboard-section {
    background: var(--dash-card-bg);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dash-text-main);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 呼吸燈動畫 */
.status-pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: var(--dash-danger);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* 即時監控網格 (Bento Grid) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 預設四欄 */
    gap: 1rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.room-status-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
    transition: all 0.2s ease;
    border-left: 5px solid #cbd5e1;
    background: white;
    min-height: 110px;
}

.room-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.room-status-card.active {
    border-left-color: var(--dash-danger);
    background: var(--dash-danger-light);
}

.room-status-card.idle {
    border-left-color: var(--dash-success);
    background: var(--dash-success-light);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.room-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--dash-text-main);
    line-height: 1.3;
}

.room-status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
    white-space: nowrap;
}

.room-status-card.active .room-status-badge {
    background: white;
    color: var(--dash-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.room-status-card.idle .room-status-badge {
    background: white;
    color: var(--dash-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.room-user {
    font-size: 0.9rem;
    color: var(--dash-text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* 圖表容器 - 讓圖表更突出 */
.dashboard-chart-container {
    height: 320px;
    width: 100%;
    margin-top: 1rem;
    overflow-x: auto;
    /* RWD 水平捲動 */
    padding-bottom: 0.5rem;
    /* 預留捲軸空間 */
}

/* 隱藏捲軸但保留功能 (Chrome, Safari, Opera) */
.dashboard-chart-container::-webkit-scrollbar {
    height: 6px;
}

.dashboard-chart-container::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-chart-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.bar-chart {
    display: flex;
    /* 改為水平排列 */
    align-items: flex-end;
    /* 底部對齊 */
    height: 100%;
    min-width: 600px;
    /* 確保最小寬度，觸發捲動 */
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.trend-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 0.5rem;
    min-width: 32px;
    /* 防止過度壓縮 */
}

.trend-value {
    font-size: 0.75rem;
    color: var(--dash-text-sub);
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trend-bar-wrapper:hover .trend-value {
    opacity: 1;
    transform: translateY(0);
}

.trend-bar {
    width: 100%;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    min-height: 4px;
    /* 確保數值為 0 時仍有一條線 */
}

.trend-bar:hover {
    filter: brightness(1.1);
    transform: scaleX(1.1);
    z-index: 10;
}

.trend-label {
    font-size: 0.75rem;
    color: var(--dash-text-sub);
    font-family: monospace;
    margin-top: 0.25rem;
}

/* Empty state for trend bar */
.trend-bar.is-empty {
    background: #E1DECF !important;
    box-shadow: none !important;
    opacity: 0.5;
    background-image: none !important;
}

/* Rainbow Spectrum 漸層色系 */
.trend-bar-wrapper:nth-child(15n+1) .trend-bar {
    background: linear-gradient(180deg, #EF4444 0%, #F87171 100%);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.trend-bar-wrapper:nth-child(15n+2) .trend-bar {
    background: linear-gradient(180deg, #F97316 0%, #FB923C 100%);
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

.trend-bar-wrapper:nth-child(15n+3) .trend-bar {
    background: linear-gradient(180deg, #F59E0B 0%, #FBBF24 100%);
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.trend-bar-wrapper:nth-child(15n+4) .trend-bar {
    background: linear-gradient(180deg, #EAB308 0%, #FACC15 100%);
    box-shadow: 0 4px 6px -1px rgba(234, 179, 8, 0.3);
}

.trend-bar-wrapper:nth-child(15n+5) .trend-bar {
    background: linear-gradient(180deg, #84CC16 0%, #A3E635 100%);
    box-shadow: 0 4px 6px -1px rgba(132, 204, 22, 0.3);
}

.trend-bar-wrapper:nth-child(15n+6) .trend-bar {
    background: linear-gradient(180deg, #22C55E 0%, #4ADE80 100%);
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.3);
}

.trend-bar-wrapper:nth-child(15n+7) .trend-bar {
    background: linear-gradient(180deg, #10B981 0%, #34D399 100%);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.trend-bar-wrapper:nth-child(15n+8) .trend-bar {
    background: linear-gradient(180deg, #14B8A6 0%, #2DD4BF 100%);
    box-shadow: 0 4px 6px -1px rgba(20, 184, 166, 0.3);
}

.trend-bar-wrapper:nth-child(15n+9) .trend-bar {
    background: linear-gradient(180deg, #06B6D4 0%, #22D3EE 100%);
    box-shadow: 0 4px 6px -1px rgba(6, 182, 212, 0.3);
}

.trend-bar-wrapper:nth-child(15n+10) .trend-bar {
    background: linear-gradient(180deg, #0EA5E9 0%, #38BDF8 100%);
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.3);
}

.trend-bar-wrapper:nth-child(15n+11) .trend-bar {
    background: linear-gradient(180deg, #3B82F6 0%, #60A5FA 100%);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.trend-bar-wrapper:nth-child(15n+12) .trend-bar {
    background: linear-gradient(180deg, #6366F1 0%, #818CF8 100%);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.trend-bar-wrapper:nth-child(15n+13) .trend-bar {
    background: linear-gradient(180deg, #8B5CF6 0%, #A78BFA 100%);
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.3);
}

.trend-bar-wrapper:nth-child(15n+14) .trend-bar {
    background: linear-gradient(180deg, #A855F7 0%, #C084FC 100%);
    box-shadow: 0 4px 6px -1px rgba(168, 85, 247, 0.3);
}

.trend-bar-wrapper:nth-child(15n+15) .trend-bar {
    background: linear-gradient(180deg, #D946EF 0%, #E879F9 100%);
    box-shadow: 0 4px 6px -1px rgba(217, 70, 239, 0.3);
}

/* 底部列 */
.dashboard-footer {
    padding: 1rem 2rem;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-time {
    color: var(--dash-text-sub);
    font-size: 0.9rem;
    font-family: monospace;
    /* 時間用等寬字型 */
}

.btn-refresh {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: var(--dash-text-main);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-refresh:hover {
    background: var(--dash-bg);
    border-color: var(--dash-primary);
    color: var(--dash-primary);
}

/* ===== AI 智慧建議區域 (UI Enhanced v2) ===== */
.smart-suggestions {
    margin-top: 2rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 1.5rem;
    animation: premiumSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    position: relative;
    border-top: 4px solid transparent;
    /* 為漸層邊框預留空間 */
    background-image: linear-gradient(white, white), linear-gradient(to right, #f59e0b, #3b82f6, #3D7B65);
    background-origin: border-box;
    background-clip: content-box, border-box;
    animation: premiumGlow 3s infinite alternate;
}

@keyframes premiumGlow {
    0% {
        box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.1), 0 8px 10px -6px rgba(59, 130, 246, 0.1);
    }

    100% {
        box-shadow: 0 15px 35px -5px rgba(245, 158, 11, 0.2), 0 10px 15px -6px rgba(139, 92, 246, 0.2);
        border-top-color: rgba(245, 158, 11, 0.5);
    }
}

@keyframes premiumSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smart-suggestions.hidden {
    display: none;
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #1f2937, #4b5563);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.25rem;
}

.suggestions-header svg {
    color: #F59E0B;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid #f3f4f6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.suggestion-card:hover {
    background: white;
    border-color: transparent;
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.suggestion-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(135deg, #f59e0b20, #3b82f620, #3D7B6520);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.suggestion-card:hover::before {
    opacity: 1;
}

.suggestion-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.suggestion-main {
    font-weight: 700;
    color: #111827;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.suggestion-sub {
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-apply-suggestion {
    padding: 0.6rem 1.25rem;
    background: #111827;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.suggestion-card:hover .btn-apply-suggestion {
    background: linear-gradient(135deg, #111827, #374151);
    transform: translateX(3px);
}

/* 找空檔按鈕 v2 */
.btn-find-alt {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px -2px rgba(245, 158, 11, 0.4);
    vertical-align: middle;
}

.btn-find-alt:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px -3px rgba(245, 158, 11, 0.5);
    filter: saturate(1.2);
}

/* 手機端 RWD 優化 v3 */
@media (max-width: 768px) {
    .control-panel {
        padding: 1.25rem;
    }

    .control-row {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
        background: rgba(255, 255, 255, 0.8);
    }

    .date-separator {
        display: none;
        /* 手機端隱藏分隔符，改用陰影排版 */
    }

    .date-input {
        width: 100%;
        text-align: center;
        background: #F2F1E8;
        border: 1px solid #edf2f7;
    }

    .room-select {
        width: 100%;
        background-color: #F2F1E8;
    }

    .btn-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .btn-search {
        grid-column: span 2;
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* RWD v2 */
@media (max-width: 640px) {
    .suggestion-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-apply-suggestion {
        width: 100%;
        padding: 0.8rem;
    }

    .smart-suggestions {
        padding: 1.25rem;
        margin-top: 1.5rem;
        border-radius: 0 0 20px 20px;
        margin-bottom: -1rem;
    }
}

/* ===== ??閰單?敶? (Glassmorphism & Vibrant Design) ===== */

/* 敶??桃蔗嚗?撘瑟芋蝟????*/
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    /* 瘛梯??? */
    backdrop-filter: blur(8px);
    /* ?璅∠? */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    /* 擃?嗡??惜 */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.delete-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 敶??祇?嚗lassmorphism + Claymorphism */
.delete-modal {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    /* 蝔凝?祝 */
    padding: 0;
    /* 蝘駁?扯?嚗摮?蝝??*/
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    /* ?折?? */
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* 敶批???*/
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.delete-modal-overlay.active .delete-modal {
    transform: scale(1) translateY(0);
}

/* 璅????瞍詨惜? */
.delete-modal-header {
    background: linear-gradient(135deg, #1F4D3F 0%, #103127 100%);
    /* ?蜓?脰矽銝??*/
    padding: 1.5rem;
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

/* 璅??鋆ˇ */
.delete-modal-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    opacity: 0.6;
    pointer-events: none;
}

.delete-modal-header svg {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin-bottom: 0.25rem;
}

.delete-modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ?批捆???憭批?擃?皜?? */
.delete-booking-info {
    padding: 2rem 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: left;
    background: linear-gradient(to bottom, #ffffff 0%, #F2F1E8 100%);
}

.delete-booking-info strong {
    color: var(--primary-dark);
    font-weight: 600;
    display: inline-block;
    width: 80px;
    /* ?箏?璅惜撖砍漲 */
    margin-right: 0.5rem;
}

/* ?????*/
.delete-modal-actions {
    padding: 1.25rem 1.5rem;
    background: #f1f5f9;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.btn-delete-cancel,
.btn-delete-confirm {
    flex: 1;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    /* 憓?閫豢???*/
}

/* 餈??? */
.btn-delete-cancel {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-delete-cancel:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 蝣箄?/??????嚗悅鞊?/璈撓撅?*/
.btn-delete-confirm {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5253 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 82, 83, 0.4);
}

.btn-delete-confirm:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(238, 82, 83, 0.5);
    filter: brightness(1.1);
}

.btn-delete-confirm:active {
    transform: translateY(0) scale(0.98);
}

/* ?????*/
@media (max-width: 480px) {
    .delete-modal {
        width: 95%;
        max-width: none;
        border-radius: 20px;
    }

    .delete-booking-info {
        font-size: 1rem;
        padding: 1.5rem;
    }

    .delete-booking-info strong {
        display: block;
        /* ????蝐斗?銵?*/
        width: auto;
        margin-bottom: 0.1rem;
        color: var(--text-muted);
        font-size: 0.9rem;
    }
}

/* .info-item new structure */
.info-item {
    display: flex;
    margin-bottom: 0.8rem;
    align-items: flex-start;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item strong {
    min-width: 80px;
    color: var(--primary-dark);
    font-weight: 600;
}

.info-item span {
    flex: 1;
    word-break: break-all;
    line-height: 1.5;
}


/* ===== PWA Glassmorphism Install Prompt ===== */
.pwa-prompt {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    max-width: 400px;
    transform: translateY(0);
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.pwa-prompt.hidden {
    display: none !important;
}

/* 隱藏狀態 */
.pwa-prompt.dismissed {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.pwa-icon img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pwa-content {
    flex: 1;
}

.pwa-content h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.pwa-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.pwa-actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
    flex-direction: row;
}

.btn-pwa-install {
    background: linear-gradient(135deg, #1F4D3F 0%, #103127 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(31, 77, 63, 0.3);
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-pwa-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(31, 77, 63, 0.4);
}

.btn-pwa-dismiss {
    background: transparent;
    color: #666;
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-pwa-dismiss:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

@keyframes slideUpFade {
    from {
        transform: translateY(40px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .pwa-prompt {
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        max-width: 100%;
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
        background: rgba(255, 255, 255, 0.9);
    }

    .pwa-icon {
        display: block;
        align-self: flex-start;
    }

    .pwa-prompt {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 16px 12px;
    }

    .pwa-icon {
        grid-row: 1;
        grid-column: 1;
    }

    .pwa-content {
        grid-row: 1;
        grid-column: 2;
        text-align: left;
    }

    .pwa-actions {
        grid-row: 2;
        grid-column: 1 / -1;
        display: flex;
        width: 100%;
        flex-direction: row;
    }

    .btn-pwa-install {
        flex: 2;
        justify-content: center;
        padding: 12px;
    }

    .btn-pwa-dismiss {
        flex: 1;
        justify-content: center;
        padding: 12px;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
}

/* History Delete Button */
.btn-history-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-left: auto;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-history-delete:hover {
    color: var(--accent-color);
    background: rgba(245, 101, 101, 0.1);
    transform: scale(1.1);
}

/* =========================================
   Audit Logs & Tabs System (v2.37.2 Hyper-Vibrant)
   ========================================= */

/* Dashboard Modal Header - Vibrant Gradient */
.dashboard-modal-header {
    background: linear-gradient(135deg, #1F4D3F 0%, #103127 100%) !important;
    padding: 1.5rem 2rem !important;
    border-radius: 16px 16px 0 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(16, 49, 39, 0.3) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dashboard-modal-header h3 {
    color: white !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    font-size: 1.5rem !important;
    margin: 0 !important;
}

.dashboard-modal-header svg {
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

/* Dashboard Tabs - Pill Shaped Container */
.dashboard-tabs {
    display: flex !important;
    gap: 0.5rem !important;
    background: rgba(255, 255, 255, 0.2) !important;
    padding: 6px !important;
    border-radius: 50px !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    margin-left: auto !important;
}

/* Tab Buttons */
.tab-btn {
    background: transparent !important;
    border: none !important;
    padding: 0.6rem 1.5rem !important;
    font-size: 0.95rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    cursor: pointer !important;
    border-radius: 30px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: none !important;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: white !important;
    color: #103127 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transform: scale(1.05) !important;
}

/* Dashboard Action Buttons (Export/Report/Close) */
.dashboard-actions {
    display: flex;
    gap: 0.5rem;
}

/* Base style for header icon buttons */
.dashboard-actions button {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 42px !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    cursor: pointer !important;
    backdrop-filter: blur(4px) !important;
}

.dashboard-actions button:hover {
    background: white !important;
    transform: translateY(-2px) rotate(8deg) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.dashboard-actions button svg {
    stroke-width: 2.5px !important;
}

/* Specific button colors on hover */
.dashboard-actions #btnExportCSV:hover {
    color: #10b981 !important;
}

/* Green */
.dashboard-actions #btnExportReport:hover {
    color: #3b82f6 !important;
}

/* Blue */
.dashboard-actions #btnDashboardClose:hover {
    color: #ef4444 !important;
    background: white !important;
    transform: rotate(90deg) !important;
}

/* Dashboard Buttons */

/* Audit Log Container */
.audit-log-container {
    padding: 1rem !important;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9) !important;
    border-radius: 0 0 16px 16px;
}

/* Log Items */
.audit-log-item {
    background: white !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.audit-log-item:hover {
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.1) !important;
    border-color: #cbd5e1 !important;
    z-index: 10 !important;
}

/* Indicators */
.audit-log-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #cbd5e1;
}

.audit-log-item.action-delete::before {
    background: linear-gradient(to bottom, #ef4444, #f87171) !important;
}

.audit-log-item.action-export::before {
    background: linear-gradient(to bottom, #3b82f6, #60a5fa) !important;
}

.audit-log-item.action-login::before {
    background: linear-gradient(to bottom, #10b981, #34d399) !important;
}

.audit-log-item.action-other::before {
    background: #94a3b8 !important;
}

/* v2.43.0: 新增 action class 顏色 */
.audit-log-item.action-create::before {
    background: linear-gradient(to bottom, #10b981, #34d399) !important;
}
.audit-log-item.action-update::before {
    background: linear-gradient(to bottom, #6366f1, #818cf8) !important;
}
.audit-log-item.action-undo::before {
    background: linear-gradient(to bottom, #f59e0b, #fbbf24) !important;
}
.audit-log-item.action-batch::before {
    background: linear-gradient(to bottom, #3D7B65, #7AAD96) !important;
}
.audit-log-item.action-warning::before {
    background: linear-gradient(to bottom, #ef4444, #f59e0b) !important;
}

/* v2.43.0: 篩選工具列 */
.audit-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.85rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.audit-filter-select,
.audit-filter-input,
.audit-filter-date {
    padding: 0.4rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
}
.audit-filter-input { flex: 1; min-width: 160px; }
.audit-filter-select { min-width: 140px; }

/* v2.43.0: 統計列 */
.audit-stats {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
    border-radius: 10px;
}
.audit-stat-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: rgba(255,255,255,0.85);
    color: #6d28d9;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.audit-stat-chip.primary {
    background: linear-gradient(135deg, #6366f1, #3D7B65);
    color: white;
}

/* v2.43.0: 展開原始 JSON */
.meta-expand-btn {
    margin-left: auto;
    padding: 2px 8px;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #6366f1;
    transition: all .15s;
}
.meta-expand-btn:hover {
    background: #6366f1;
    color: white;
    border-color: transparent;
}
.log-raw-json {
    margin-top: 0.5rem;
    padding: 0.65rem;
    background: #1e293b;
    color: #93c5fd;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (max-width: 768px) {
    .audit-filters {
        flex-direction: column;
    }
    .audit-filter-input,
    .audit-filter-select,
    .audit-filter-date {
        width: 100%;
    }
}

.log-action {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: #334155 !important;
}

.log-time {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 12px;
    color: #64748b;
    font-size: 0.75rem !important;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 640px) {
    .dashboard-modal-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1.5rem !important;
        gap: 1rem !important;
    }

    .dashboard-tabs {
        margin: 0 !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    .tab-btn {
        flex: 1 !important;
        padding: 0.8rem !important;
        text-align: center !important;
    }
}

/* ===================================================
   Analytics v2 — 進階分析儀表板 (v2.38.0)
   =================================================== */

/* 控制列 */
.analytics-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(31, 77, 63, 0.08) 0%, rgba(16, 49, 39, 0.06) 100%);
    border: 1px solid rgba(31, 77, 63, 0.2);
    border-radius: 14px;
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.25rem;
}

.analytics-range-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.analytics-date-input {
    padding: 0.45rem 0.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: var(--transition-fast);
}

.analytics-date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 77, 63, 0.15);
}

.btn-run-analytics {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 3px 10px rgba(31, 77, 63, 0.3);
    white-space: nowrap;
}

.btn-run-analytics:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(31, 77, 63, 0.4);
    filter: brightness(1.08);
}

/* KPI 統計卡 */
.analytics-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.analytics-kpi {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(31, 77, 63, 0.07);
    transition: var(--transition-fast);
}

.analytics-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(31, 77, 63, 0.15);
    border-color: rgba(31, 77, 63, 0.3);
}

.kpi-val {
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-weight: 500;
}

/* 各圖表區塊 */
.analytics-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(31, 77, 63, 0.06);
}

.analytics-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.analytics-section-title svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.analytics-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ---- 熱力圖 GitHub Style ---- */
.heatmap-scroll-wrapper {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.heatmap-month-labels {
    display: flex;
    gap: 0;
    margin-left: 28px;
    margin-bottom: 4px;
    min-height: 18px;
}

.heatmap-month-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.heatmap-container {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.heatmap-weekday-labels {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 2px;
}

.heatmap-weekday-labels span {
    font-size: 0.68rem;
    color: var(--text-muted);
    height: 13px;
    line-height: 13px;
    width: 16px;
    text-align: right;
}

.heatmap-grid {
    display: flex;
    flex-direction: row;
    gap: 3px;
    flex-wrap: nowrap;
}

/* 每週一欄 */
.heatmap-week-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-cell {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-block;
}

.heatmap-cell:hover {
    transform: scale(1.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    position: relative;
}

.heatmap-cell.level-0 {
    background: #ebedf0;
}

.heatmap-cell.level-1 {
    background: #c6e4f8;
}

.heatmap-cell.level-2 {
    background: #7db9e8;
}

.heatmap-cell.level-3 {
    background: #4a87d6;
}

.heatmap-cell.level-4 {
    background: #1a4fc4;
}

/* Heatmap 圖例 */
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-label {
    font-weight: 500;
}

/* ---- 水平 Bar 排行榜 (場地 / 使用者 / 取消率) ---- */
.analytics-bar-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.analytics-bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.analytics-bar-rank {
    font-size: 0.78rem;
    font-weight: 800;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.analytics-bar-rank.gold {
    color: #f59e0b;
}

.analytics-bar-rank.silver {
    color: #94a3b8;
}

.analytics-bar-rank.bronze {
    color: #b45309;
}

.analytics-bar-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 120px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-bar-track {
    flex: 1;
    background: #f1f5f9;
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--primary-gradient);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 4px;
}

.analytics-bar-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* 取消率 bar 顏色：紅色漸層 */
.analytics-bar-fill.cancel-fill {
    background: linear-gradient(90deg, #f87171 0%, #dc2626 100%);
}

/* ---- 直方圖（提前天數）---- */
.analytics-histogram {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 100px;
    background: #F2F1E8;
    border-radius: 10px;
    padding: 0.5rem 0.5rem 0;
    margin-bottom: 0.35rem;
}

.histogram-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 4px;
}

.histogram-bar {
    width: 100%;
    background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
    border-radius: 6px 6px 0 0;
    transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    min-height: 4px;
    position: relative;
}

.histogram-bar:hover {
    filter: brightness(1.15);
}

.histogram-bar-val {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.histogram-labels {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.histogram-labels span {
    flex: 1;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

/* 載入中 */
.analytics-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.analytics-loading.hidden {
    display: none !important;
}

/* ---- RWD ---- */
@media (max-width: 768px) {
    .analytics-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-bar-label {
        width: 80px;
        font-size: 0.76rem;
    }

    .analytics-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-val {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .analytics-summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .heatmap-cell {
        width: 11px;
        height: 11px;
    }
}

/* ==========================================================================
   v2.41.0 (M.1): 場地公告系統
   ========================================================================== */

/* 公告管理按鈕 (header) */
.btn-announcement {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 6px rgba(245, 158, 11, .35);
}
.btn-announcement:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(245, 158, 11, .55);
}

/* 公告管理彈窗 */
.announcement-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2200;
}
.announcement-modal-overlay.active {
    display: flex;
    animation: fadeIn .2s ease;
}

.announcement-modal {
    background: #fff;
    border-radius: 16px;
    width: min(94vw, 720px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.announcement-modal-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.announcement-modal-header h3 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1.15rem;
}
.btn-announcement-close {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
}
.btn-announcement-close:hover { background: rgba(255, 255, 255, 0.32); }

.announcement-modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.announcement-desc {
    color: #475569;
    font-size: 0.9rem;
    margin: 0 0 1rem;
    padding: 0.6rem 0.85rem;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
}

/* 公告表單 */
.announcement-form {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #E1DECF;
    display: grid;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.ann-form-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.ann-form-row label {
    flex-shrink: 0;
    min-width: 90px;
    font-weight: 600;
    color: #334155;
    font-size: .9rem;
}
.ann-form-row input,
.ann-form-row select,
.ann-form-row textarea {
    flex: 1;
    padding: .5rem .65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: .92rem;
}
.ann-form-row textarea { resize: vertical; min-height: 60px; }
.ann-form-dates input { flex: 0 1 auto; }

.ann-checkbox-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .92rem;
    color: #b45309;
    font-weight: 600;
    cursor: pointer;
    min-width: auto !important;
}
.ann-checkbox-label input { flex: none; }

.ann-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}
.btn-ann-submit, .btn-ann-cancel {
    padding: .55rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s;
}
.btn-ann-submit {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}
.btn-ann-submit:hover:not(:disabled) { transform: translateY(-1px) scale(1.02); }
.btn-ann-submit:disabled { opacity: .6; cursor: wait; }
.btn-ann-cancel {
    background: #E1DECF;
    color: #334155;
}

/* 公告列表 */
.announcement-list-section h4 {
    margin: 0 0 .75rem;
    color: #334155;
    font-size: 1rem;
}
.ann-empty {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    background: #f1f5f9;
    border-radius: 8px;
}

.announcement-item {
    background: #fff;
    border-left: 4px solid #94a3b8;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: .65rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.announcement-item.ann-imp-info { border-left-color: #3b82f6; }
.announcement-item.ann-imp-warning { border-left-color: #f59e0b; background: #fefce8; }
.announcement-item.ann-imp-critical { border-left-color: #ef4444; background: #fef2f2; }

.ann-item-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}
.ann-item-room {
    font-weight: 700;
    color: #1e293b;
}
.ann-badge {
    font-size: .72rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.ann-badge-active { background: #dcfce7; color: #15803d; }
.ann-badge-expired { background: #f1f5f9; color: #64748b; }
.ann-badge-future { background: #dbeafe; color: #1e40af; }
.ann-lock {
    font-size: .72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
}
.ann-item-dates {
    font-size: .82rem;
    color: #64748b;
    margin-bottom: .35rem;
}
.ann-item-msg {
    color: #1f2937;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: .5rem;
}
.ann-item-actions {
    display: flex;
    gap: .4rem;
    justify-content: flex-end;
}
.btn-ann-edit, .btn-ann-delete {
    padding: 4px 10px;
    border: 1px solid;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: all .15s;
}
.btn-ann-edit { color: #2563eb; border-color: #93c5fd; }
.btn-ann-edit:hover { background: #2563eb; color: #fff; }
.btn-ann-delete { color: #dc2626; border-color: #fca5a5; }
.btn-ann-delete:hover { background: #dc2626; color: #fff; }

/* 預約彈窗內的公告 banner */
.modal-announcement-banner {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1rem;
}
.banner-item {
    display: flex;
    gap: .65rem;
    padding: .65rem .85rem;
    border-radius: 8px;
    border-left: 4px solid;
    background: #f8fafc;
    animation: bannerSlideIn .3s ease;
}
@keyframes bannerSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.banner-info { background: #eff6ff; border-left-color: #3b82f6; color: #1e40af; }
.banner-warning { background: #fefce8; border-left-color: #f59e0b; color: #92400e; }
.banner-critical { background: #fef2f2; border-left-color: #ef4444; color: #991b1b; }
.banner-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.banner-content { flex: 1; }
.banner-msg { font-weight: 600; line-height: 1.4; white-space: pre-wrap; }
.banner-meta {
    margin-top: .25rem;
    font-size: .78rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.banner-lock {
    background: rgba(220, 38, 38, .12);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

/* ==========================================================================
   v2.41.0 (M.2): 批次取消功能
   ========================================================================== */

.btn-history-batch-toggle {
    background: #fff;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    margin-left: auto;
}
.btn-history-batch-toggle:hover {
    border-color: #6366f1;
    color: #4f46e5;
}
.btn-history-batch-toggle.active {
    background: linear-gradient(135deg, #6366f1 0%, #3D7B65 100%);
    color: #fff;
    border-color: transparent;
}

.history-batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .85rem;
    margin-bottom: .65rem;
    background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    animation: fadeIn .2s ease;
}
.batch-count {
    color: #4c1d95;
    font-weight: 600;
}
.batch-count strong {
    font-size: 1.15rem;
    color: #6d28d9;
    margin: 0 .15rem;
}
.batch-toolbar-actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}
.btn-batch-select-all,
.btn-batch-deselect,
.btn-batch-cancel {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid;
    transition: all .15s;
}
.btn-batch-select-all,
.btn-batch-deselect {
    background: #fff;
    color: #6d28d9;
    border-color: #c4b5fd;
}
.btn-batch-select-all:hover,
.btn-batch-deselect:hover {
    background: #6d28d9;
    color: #fff;
    border-color: transparent;
}
.btn-batch-cancel {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border-color: transparent;
}
.btn-batch-cancel:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow: 0 2px 8px rgba(239, 68, 68, .4);
}
.btn-batch-cancel:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* 歷史紀錄項目於批次模式下的樣式 */
.history-item.batch-mode {
    padding-left: 1rem;
    cursor: pointer;
}
.history-item.batch-selected {
    background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
    border-left: 4px solid #6366f1;
}
.history-batch-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #6366f1;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: .35rem;
}

/* v2.41.8: 無批次取消權限的項目 (非本機預約 + 非管理員) */
.history-item.batch-not-allowed {
    opacity: 0.55;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(148, 163, 184, 0.08) 8px,
        rgba(148, 163, 184, 0.08) 16px
    );
}
.history-item.batch-not-allowed .history-batch-checkbox {
    cursor: not-allowed;
    accent-color: #94a3b8;
}
.history-item.batch-not-allowed::before {
    content: '🔒';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.8rem;
    opacity: 0.7;
    pointer-events: none;
}
.history-item {
    position: relative;
}

/* v2.41.8: 工具列權限提示 chip */
.batch-perm-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 3px 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #78350f;
    border: 1px solid #f59e0b;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

@media (max-width: 768px) {
    .history-batch-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-toolbar-actions {
        justify-content: flex-end;
    }
    .ann-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .ann-form-row label {
        min-width: auto;
    }
    .ann-form-dates {
        flex-direction: row !important;
    }
}

/* ==========================================================================
   v2.41.1: PWA 版本更新通知 Banner
   ========================================================================== */

.pwa-update-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    min-width: 320px;
    max-width: calc(100vw - 48px);
    background: linear-gradient(135deg, #6366f1 0%, #3D7B65 50%, #ec4899 100%);
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.45),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(12px);
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(.4, 0, .2, 1),
                opacity 0.3s ease;
    font-family: inherit;
}

.pwa-update-banner.show {
    transform: translateY(0);
    opacity: 1;
    animation: pwaShimmer 3s ease-in-out 0.4s;
}

@keyframes pwaShimmer {
    0%, 100% { box-shadow: 0 12px 40px rgba(99, 102, 241, 0.45),
                            0 0 0 1px rgba(255, 255, 255, 0.1) inset; }
    50%      { box-shadow: 0 16px 50px rgba(139, 92, 246, 0.65),
                            0 0 0 1px rgba(255, 255, 255, 0.25) inset,
                            0 0 24px rgba(236, 72, 153, 0.4); }
}

.pwa-update-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
    animation: pwaWiggle 1.4s ease-in-out infinite;
}

@keyframes pwaWiggle {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-12deg); }
    75%      { transform: rotate(12deg); }
}

.pwa-update-content {
    flex: 1;
    min-width: 0;
}

.pwa-update-title {
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 2px;
    letter-spacing: 0.01em;
}

.pwa-update-desc {
    font-size: 0.82rem;
    opacity: 0.9;
}

.pwa-update-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-pwa-update-now {
    background: rgba(255, 255, 255, 0.95);
    color: #6d28d9;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.btn-pwa-update-now:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.btn-pwa-update-now:active {
    transform: scale(0.96);
}

.btn-pwa-update-later {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-pwa-update-later:hover {
    background: rgba(255, 255, 255, 0.32);
}

.pwa-update-banner.updating {
    pointer-events: none;
}

.pwa-update-banner.updating .pwa-update-icon {
    animation: pwaSpin 0.8s linear infinite;
}

.pwa-update-banner.updating .pwa-update-icon::before {
    content: '⏳';
}

.pwa-update-banner.updating .pwa-update-icon {
    color: transparent;
}

@keyframes pwaSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.pwa-update-banner.updating .btn-pwa-update-now,
.pwa-update-banner.updating .btn-pwa-update-later {
    opacity: 0.5;
}

@media (max-width: 600px) {
    .pwa-update-banner {
        bottom: 12px;
        right: 12px;
        left: 12px;
        min-width: auto;
        padding: 0.75rem 0.9rem;
    }

    .pwa-update-icon {
        font-size: 1.5rem;
    }

    .pwa-update-title {
        font-size: 0.92rem;
    }

    .pwa-update-desc {
        font-size: 0.76rem;
    }

    .btn-pwa-update-now {
        padding: 0.45rem 0.85rem;
        font-size: 0.84rem;
    }
}

/* ==========================================================================
   v2.49.3: 兩個 PWA banner 互斥（修復右下角疊在一起）
   .pwa-prompt（安裝提示）+ .pwa-update-banner（版本更新）原本同樣釘在
   bottom:24px right:24px，會完全疊在一起。當「新版本已就緒」顯示時，
   使用者已經是現有用戶，更新比較急 → 安裝提示先讓位；reload 後若條件
   還滿足會自然再出現。
   ========================================================================== */
body:has(.pwa-update-banner.show) .pwa-prompt {
    display: none !important;
}

/* 退路：舊瀏覽器（Chrome <105 / Safari <15.4）不支援 :has()，
   把安裝提示往上推、不疊在一起。 */
@supports not selector(:has(*)) {
    .pwa-prompt {
        bottom: 96px;
    }
}

/* ==========================================================================
   v2.44.0 (1.1): LINE 綁定 UI
   ========================================================================== */

/* Header LINE 按鈕 (LINE 綠 + 官方風格 logo) */
.btn-line-bind {
    background: linear-gradient(135deg, #06c755 0%, #04a943 100%);
    color: #fff;
    border: none;
    height: 40px;
    padding: 0 0.85rem 0 0.4rem; /* 左側留空間給 logo */
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 6px rgba(6, 199, 85, 0.35);
    font-weight: 700;
    font-size: 0.92rem;
}
.btn-line-bind:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.55);
}

/* v2.45.1: LINE 官方風格 logo — 白底綠字 LINE,圓角矩形 */
.line-logo {
    flex-shrink: 0;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    border-radius: 22%;
}
.btn-line-bind .line-logo {
    width: 28px;
    height: 28px;
}

@media (max-width: 600px) {
    .line-bind-label {
        display: none;
    }
    .btn-line-bind {
        padding: 0 0.4rem;
        width: 40px;
        justify-content: center;
    }
    .btn-line-bind .line-logo {
        width: 30px;
        height: 30px;
    }
}

/* LINE 綁定彈窗 */
.line-bind-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-primary, 2000);
}
.line-bind-overlay.active {
    display: flex;
    animation: fadeIn .2s ease;
}

.line-bind-modal {
    background: white;
    border-radius: 16px;
    width: min(94vw, 480px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.line-bind-header {
    background: linear-gradient(135deg, #06c755 0%, #04a943 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.line-bind-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}
.btn-line-bind-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}
.btn-line-bind-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.line-bind-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.line-bind-step {
    text-align: center;
}

.line-bind-intro {
    background: #f0fdf4;
    border-left: 4px solid #06c755;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    text-align: left;
    line-height: 1.7;
    margin-bottom: 1.25rem;
    color: #14532d;
}

.line-bind-form {
    text-align: left;
    margin-bottom: 1.25rem;
}
.line-bind-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #374151;
}
.line-bind-form input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.line-bind-form input:focus {
    border-color: #06c755;
    outline: none;
}

.btn-line-bind-start,
.btn-line-bind-done {
    width: 100%;
    background: linear-gradient(135deg, #06c755 0%, #04a943 100%);
    color: white;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.btn-line-bind-start:hover:not(:disabled),
.btn-line-bind-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.4);
}
.btn-line-bind-start:disabled {
    opacity: 0.6;
    cursor: wait;
}

.line-bind-cancel {
    background: transparent;
    color: #64748b;
    border: 1px solid #E1DECF;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.85rem;
    width: 100%;
}

/* Step 2: 綁定碼顯示 */
.line-bind-code-display {
    background: linear-gradient(135deg, #06c755 0%, #04a943 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
    text-align: center;
}
.line-bind-code-label {
    font-size: 0.82rem;
    opacity: 0.9;
    margin-bottom: 0.4rem;
}
.line-bind-code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.4rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    margin-bottom: 0.5rem;
    user-select: all;
}
.line-bind-countdown {
    font-size: 0.95rem;
    opacity: 0.95;
    font-variant-numeric: tabular-nums;
}

.line-bind-instructions {
    background: #f8fafc;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    text-align: left;
    margin-bottom: 1.25rem;
}
.line-bind-instructions h4 {
    margin: 0 0 0.5rem;
    color: #1e293b;
}
.line-bind-instructions ol {
    margin: 0;
    padding-left: 1.5rem;
    line-height: 1.7;
    color: #475569;
}

.line-bind-qr-container {
    background: #f0fdf4;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.line-bind-qr-container img {
    width: 200px;
    height: 200px;
    background: white;
    padding: 0.5rem;
    border-radius: 8px;
}
.line-bind-qr-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: #14532d;
}

/* v2.44.3: 手機加好友 CTA 區塊 */
.line-bind-mobile-cta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #86efac;
}
.btn-add-line-friend {
    display: inline-block;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, #06c755 0%, #04a943 100%);
    color: white !important;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 3px 10px rgba(6, 199, 85, 0.35);
}
.btn-add-line-friend:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 5px 14px rgba(6, 199, 85, 0.5);
}
.line-bind-id-hint {
    margin-top: 0.5rem !important;
    font-size: 0.78rem !important;
    color: #64748b !important;
}
.line-bind-id-hint code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    color: #334155;
    font-family: ui-monospace, "SF Mono", monospace;
    user-select: all;
}

.line-bind-status-bar {
    background: #fef3c7;
    color: #78350f;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.85rem;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn-line-bind-cancel {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fca5a5;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
}

/* Step 0/3: 已綁定 / 成功 */
.line-bind-success-icon {
    font-size: 4rem;
    margin: 0.5rem 0;
}
.line-bind-step h4 {
    margin: 0.5rem 0;
    color: #1e293b;
    font-size: 1.3rem;
}
.line-bind-step p {
    color: #475569;
    line-height: 1.6;
    margin: 0.5rem 0;
}
.line-bind-step strong {
    color: #06c755;
    font-size: 1.1rem;
}
.line-bind-hint {
    font-size: 0.9rem;
    color: #64748b !important;
    margin-top: 1rem !important;
}

/* v2.46.0 (Phase 3): 管理員告警訂閱區 */
.admin-alerts-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    text-align: left;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #f59e0b;
}
.admin-alerts-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #d1d5db, transparent);
    margin: 0.5rem 0;
}
.admin-alerts-section h4 {
    margin: 0 0 0.4rem !important;
    color: #92400e !important;
    font-size: 1rem !important;
    text-align: left !important;
}
.admin-alerts-section .line-bind-hint {
    text-align: left;
    color: #78350f !important;
    margin-top: 0.5rem !important;
    line-height: 1.7;
}

.btn-admin-alerts-subscribe,
.btn-admin-alerts-unsubscribe {
    display: block;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.btn-admin-alerts-subscribe {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}
.btn-admin-alerts-subscribe:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 5px 14px rgba(245, 158, 11, 0.5);
}
.btn-admin-alerts-unsubscribe {
    background: white;
    color: #b45309;
    border: 1.5px solid #f59e0b;
}
.btn-admin-alerts-unsubscribe:hover {
    background: #fef3c7;
}
.btn-admin-alerts-subscribe:disabled,
.btn-admin-alerts-unsubscribe:disabled {
    opacity: 0.6;
    cursor: wait;
}

.admin-alerts-status {
    margin-top: 0.75rem !important;
    font-size: 0.85rem !important;
    color: #15803d !important;
    font-weight: 600;
    text-align: center !important;
}

/* ==========================================================================
   v2.49.0: 教室預約通知訂閱 (roomWatchers)
   ========================================================================== */
#roomWatchSection {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #3b82f6;
}
#roomWatchSection h4 {
    color: #1e3a8a !important;
}
#roomWatchSection .line-bind-hint {
    color: #1e40af !important;
}
.room-watch-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 10px;
    flex-wrap: wrap;
}
.room-watch-name {
    flex: 1 1 100%;
    font-weight: 700;
    color: #1e3a8a;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
#roomWatchSection .btn-room-watch-toggle {
    margin-top: 0;
    flex: 1 1 auto;
}
#roomWatchSection .btn-admin-alerts-subscribe {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.35);
}
#roomWatchSection .btn-admin-alerts-subscribe:hover {
    box-shadow: 0 5px 14px rgba(59, 130, 246, 0.5);
}
#roomWatchSection .btn-admin-alerts-unsubscribe {
    color: #1d4ed8;
    border-color: #3b82f6;
}
#roomWatchSection .btn-admin-alerts-unsubscribe:hover {
    background: #dbeafe;
}
#roomWatchSection .admin-alerts-status {
    color: #1e40af !important;
}

/* ==========================================================================
   v2.47.0: 意見回饋系統
   ========================================================================== */

/* 浮動 FAB 按鈕 (右下) */
.btn-feedback-fab {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: var(--z-fab, 500);
    background: linear-gradient(135deg, #6366f1 0%, #3D7B65 100%);
    color: white;
    border: none;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform .15s, box-shadow .15s;
}
.btn-feedback-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}
.btn-feedback-fab:active {
    transform: scale(0.96);
}

@media (max-width: 600px) {
    .feedback-fab-label { display: none; }
    .btn-feedback-fab {
        padding: 0.7rem;
        width: 48px;
        height: 48px;
        justify-content: center;
    }
}

/* Modal */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-primary, 2000);
}
.feedback-overlay.active {
    display: flex;
    animation: fadeIn .2s ease;
}

.feedback-modal {
    background: white;
    border-radius: 16px;
    width: min(94vw, 520px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.feedback-header {
    background: linear-gradient(135deg, #6366f1 0%, #3D7B65 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.feedback-header h3 {
    margin: 0;
    font-size: 1.15rem;
}
.btn-feedback-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}
.btn-feedback-close:hover { background: rgba(255, 255, 255, 0.35); }

.feedback-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.feedback-intro {
    background: #ede9fe;
    border-left: 4px solid #3D7B65;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    line-height: 1.6;
    color: #4c1d95;
    margin-bottom: 1.25rem;
}

.feedback-form {
    display: grid;
    gap: 1rem;
}

.feedback-form-row label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
}

.feedback-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.feedback-type-option {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
    font-weight: 600 !important;
    margin: 0 !important;
    color: #4b5563 !important;
}
.feedback-type-option input[type="radio"] {
    display: none;
}
.feedback-type-option:has(input:checked) {
    border-color: #3D7B65;
    background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
    color: #6d28d9 !important;
}
.feedback-type-option:hover {
    border-color: #7AAD96;
}

.feedback-form-row input[type="text"],
.feedback-form-row textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
}
.feedback-form-row input[type="text"]:focus,
.feedback-form-row textarea:focus {
    outline: none;
    border-color: #3D7B65;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.feedback-form-row textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.feedback-char-count {
    display: block;
    text-align: right;
    color: #94a3b8;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

.feedback-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-feedback-cancel,
.btn-feedback-submit {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    border: none;
}
.btn-feedback-cancel {
    background: #f1f5f9;
    color: #475569;
}
.btn-feedback-cancel:hover { background: #E1DECF; }

.btn-feedback-submit {
    background: linear-gradient(135deg, #6366f1 0%, #3D7B65 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
}
.btn-feedback-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(99, 102, 241, 0.5);
}
.btn-feedback-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==========================================================================
   v2.48.0: AI 學期報告
   ========================================================================== */

.reports-container {
    padding: 1rem 0;
}

.reports-intro {
    background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
}
.reports-intro h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reports-actions {
    text-align: center;
    margin: 1.5rem 0;
}

.btn-generate-report {
    background: linear-gradient(135deg, #6d28d9 0%, #3D7B65 50%, #ec4899 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.4);
    transition: transform .2s, box-shadow .2s;
}
.btn-generate-report:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 10px 30px rgba(109, 40, 217, 0.55);
}
.btn-generate-report:active { transform: scale(0.96); }
.btn-generate-report:disabled {
    opacity: 0.7;
    cursor: wait;
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.report-gen-status {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #6b7280;
    min-height: 1.5em;
}
.report-gen-status.success { color: #15803d; font-weight: 600; }
.report-gen-status.error { color: #dc2626; font-weight: 600; }

.reports-history h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ede9fe;
}

.reports-list {
    display: grid;
    gap: 0.75rem;
}
.reports-loading,
.reports-empty {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 8px;
}

.report-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3D7B65;
    border-radius: 10px;
    transition: all .15s;
}
.report-item:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    border-left-color: #6d28d9;
}

.report-item-info { flex: 1; min-width: 0; }
.report-item-name {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}
.report-item-meta {
    font-size: 0.82rem;
    color: #6b7280;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.report-item-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

.btn-view-report {
    background: linear-gradient(135deg, #6d28d9 0%, #3D7B65 100%);
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s;
    font-size: 0.85rem;
}
.btn-view-report:hover {
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .report-item {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-view-report { text-align: center; }
}

/* ==========================================================================
   v2.50.0 Pine 主題 — 布局與調色 Polish Overrides
   設計來源: Claude Design「禮堂預約系統設計優化」(prototype/index.html)
   策略: 在不動 HTML 結構的前提下, 用高特異度覆蓋掉 v2.49 之前的紫色玻璃擬態,
        改成 Pine 深松綠 + 12px 圓角 + Compact 密度的清爽校園風。
   ========================================================================== */

/* --- 全局: 暖米底色 + 字體 fallback --- */
body {
    background: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Header: 從紫色漸層 + 動畫光暈 改為白底 + 細邊線 (參考原型) --- */
.header {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    padding: 0.875rem 1.5rem !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
}
.header::after { display: none !important; }

/* --- Header 內容: 改為左/中/右三段, 標題不再絕對置中 --- */
.header-content {
    padding: 0;
    gap: 1rem;
}

/* --- 標題: 從 2rem + 跳動發光 改為平靜的 brand mark --- */
.header-title {
    position: static !important;
    transform: none !important;
    animation: none !important;
    text-shadow: none !important;
    font-size: 1.35rem !important;     /* 1.05 → 1.35: 視覺主導 */
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    gap: 0.875rem;
    flex: 1 1 auto;                    /* 允許吃掉中間空間 */
    min-width: 0;                      /* flex item 可被壓縮 */
    display: flex;
    align-items: center;
    justify-content: center;            /* 標題在自身範圍內置中 */
}
.header-title:hover {
    transform: none !important;
    text-shadow: none !important;
}
.header-title svg {
    filter: none !important;
    width: 48px;                       /* 44 → 48 */
    height: 48px;
    padding: 12px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.4);
    flex: none;
}
.header-title .title-main {
    font-size: 1.35rem;                /* 1.05 → 1.35 */
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.015em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.header-title .title-sub {
    background: transparent !important;
    border: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.9rem !important;       /* 0.78 → 0.9 */
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    align-self: flex-end;
    margin-bottom: 4px !important;
    margin-left: 0.6rem !important;
    flex: none;
    white-space: nowrap;
}

/* --- Header 右側按鈕區: 統一改為淺色膠囊樣式 --- */
.header-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header-admin .admin-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.65rem;
    background: var(--accent-softer);
    border-radius: 999px;
    font-weight: 500;
}
.header .btn-setting,
.header .btn-dashboard,
.header .btn-announcement {
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    display: grid !important;
    place-items: center;
    padding: 0 !important;
    box-shadow: none !important;
    transition: var(--transition-fast);
}
.header .btn-setting:hover,
.header .btn-dashboard:hover,
.header .btn-announcement:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: var(--accent-softer) !important;
    transform: none !important;
}
.header .btn-line-bind {
    background: #06C755 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 999px !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px -1px rgba(6, 199, 85, 0.4) !important;
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.header .btn-line-bind:hover {
    background: #05B04C !important;
    transform: none !important;
}
.header .btn-line-bind .line-logo {
    width: 22px;
    height: 22px;
}
.header .btn-admin {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 999px !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    height: 36px;
    box-shadow: none !important;
}
.header .btn-admin:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: var(--accent-softer) !important;
    transform: none !important;
}

/* --- 主內容區: 收緊內距 --- */
.main-content {
    background: transparent;
    padding-top: 1.25rem;
}

/* --- 控制面板: 玻璃感 → 純白卡片 + 細邊框 --- */
.control-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

/* --- 主要按鈕: 用實心 Pine 色取代漸層, 收圓角 --- */
.btn-search,
.btn-export,
.btn-stats,
.btn-history,
.btn-search-advanced {
    border-radius: var(--radius-md) !important;
}
.btn-search {
    background: var(--primary-color) !important;
    box-shadow: 0 2px 8px -2px rgba(31, 77, 63, 0.45) !important;
}
.btn-search:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.55) !important;
}

/* --- 行事曆容器: 卡片化, 與設計一致 --- */
.calendar-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1rem 0.75rem;
}
.calendar-header {
    margin-bottom: 0.875rem;
}
.calendar-header .current-week {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.btn-nav {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
}
.btn-nav:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: var(--accent-softer) !important;
}

/* --- 視圖切換: 收圓角到 12px, 啟用態用實心 Pine --- */
.view-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
}
.view-btn {
    border-radius: 8px !important;
    font-family: var(--font-display);
    font-weight: 600;
}
.view-btn.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px -1px rgba(31, 77, 63, 0.4) !important;
}

/* --- 月曆/週曆格子: 統一邊線色 + 今天用 Pine 高亮 --- */
.calendar-grid,
.month-calendar {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--border-color);
}
.calendar-day-header,
.month-weekday,
.calendar-time-header,
.time-header {
    background: var(--surface-2);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 600;
}
.calendar-day-header.today,
.calendar-day.today .calendar-day-header,
.month-day.today {
    background: var(--accent-softer) !important;
    color: var(--primary-darker) !important;
    border-top: 2px solid var(--primary-color);
}

/* --- Modal: 圓角到 20px, 影子柔和化 --- */
.modal {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border-color);
}
.modal-overlay {
    background: rgba(16, 49, 39, 0.55) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.modal-header {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color);
}
.btn-submit {
    background: var(--primary-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.5) !important;
}
.btn-submit:hover {
    background: var(--primary-dark) !important;
}
.btn-cancel {
    border-radius: var(--radius-md) !important;
}

/* --- 預約卡片: 統一圓角到 6px (compact 設計) --- */
.booking-card,
.booking-cell.booked {
    border-radius: var(--radius-sm);
}

/* --- Toast: 跟隨主色 --- */
.toast {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: 999px !important;
}

/* --- FAB / 浮動按鈕: 主色化 --- */
.fab,
.btn-fab,
.btn-floating {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px -4px rgba(31, 77, 63, 0.5) !important;
}
.fab:hover {
    background: var(--primary-dark) !important;
}

/* --- Compact 密度: 縮減各區段間距 --- */
.search-panel {
    padding: 0.75rem;
    gap: 0.5rem;
}
.search-input,
.search-filter-select,
.btn-search-scope,
.btn-search-advanced {
    height: 40px;
    border-radius: var(--radius-md) !important;
}

/* --- 響應式: header 在窄螢幕收回 sub title (避免擠壓) --- */
@media (max-width: 768px) {
    .header {
        padding: 0.625rem 1rem !important;
    }
    .header-title svg {
        width: 38px;
        height: 38px;
        padding: 9px;
    }
    .header-title .title-sub {
        display: none;
    }
}


/* ==========================================================================
   v2.50.0 — screen-month / screen-mobile / overview 設計微調
   ========================================================================== */

/* --- 月視圖: cell head 改 space-between 容納日期 + count pill --- */
.month-day-header {
    justify-content: space-between !important;
    align-items: center;
}

/* --- 月視圖: 今天的日期數字 = 實心 Pine 圓圈 (參考 .mv-today .mv-cell-num) --- */
.month-day.today .month-day-date {
    background: var(--primary-color);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

/* --- 月視圖: 預約總數 badge (右上角小綠丸) --- */
.month-day-count {
    font-size: 0.66rem;
    background: var(--accent-soft);
    color: var(--primary-darker);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-weight: 700;
    font-family: var(--font-display);
    line-height: 1.4;
}
.month-day.today .month-day-count {
    background: rgba(255, 255, 255, 0.85);
}

/* --- 月視圖: 預約 chip 改用每人 hash 色相 (Pine 設計的 --bk-hue) --- */
.month-booking-item {
    background: oklch(0.95 0.04 var(--bk-hue, 150));
    border-left: 2px solid oklch(0.55 0.12 var(--bk-hue, 150)) !important;
    color: oklch(0.32 0.10 var(--bk-hue, 150));
    padding: 2px 5px !important;
    border-radius: 3px !important;
    font-size: 0.68rem !important;
}
.month-booking-item .mb-period {
    background: oklch(0.55 0.12 var(--bk-hue, 150));
    color: #fff;
    border-radius: 2px;
    padding: 0 4px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.5;
    flex: none;
    text-transform: uppercase;
}
.month-booking-item .mb-booker {
    color: oklch(0.32 0.10 var(--bk-hue, 150)) !important;
    font-weight: 600;
    font-size: 0.68rem;
}

/* 月視圖底部右下角的「N/10」配額顯示 (data-booked-count) — 收暗化, 別搶上方 badge --- */
.month-day::after {
    font-size: 0.62rem !important;
    color: var(--text-muted) !important;
    opacity: 0.55 !important;
    bottom: 2px !important;
    right: 4px !important;
}

/* --- 月視圖: 週末/假日數字色 (取代原 accent-color #f56565 警示紅) --- */
.month-day.weekend .month-day-date,
.month-day.other-month.weekend .month-day-date {
    color: #C97B3F; /* 暖橘 (warn 色) */
}

/* --- 月視圖: 衝突熱度 (heat) 色階改成 Pine palette --- */
.month-day.heat-light  { background: linear-gradient(180deg, transparent 0%, #ECF5EE 100%) !important; }
.month-day.heat-medium { background: linear-gradient(180deg, transparent 0%, #FAF1D8 100%) !important; }
.month-day.heat-busy   { background: linear-gradient(180deg, transparent 0%, #F8E2C9 100%) !important; }
.month-day.heat-full   { background: linear-gradient(180deg, transparent 0%, #F5D6D2 100%) !important; }

/* --- 月視圖 weekday header: 第 1/7 欄不再用警示紅 --- */
.month-weekday:first-child,
.month-weekday:last-child {
    color: #C97B3F !important;
}

/* ==========================================================================
   手機版 polish (參考 screen-mobile.html)
   ========================================================================== */
@media (max-width: 640px) {
    /* Header: 收緊 padding 避免擠壓; 標題 sub 已在前段 hidden */
    .header {
        padding: 0.625rem 0.875rem !important;
    }
    .header-content {
        gap: 0.5rem !important;
    }
    .header-title svg {
        width: 36px;
        height: 36px;
        padding: 8px;
    }
    .header-admin {
        gap: 0.35rem !important;
    }
    .header .btn-line-bind .line-bind-label {
        display: none; /* 手機只顯示 LINE logo, 省空間 */
    }

    /* 主內容區 padding 更緊 */
    .main-content {
        padding: 0.75rem !important;
        padding-top: 1rem !important;
    }

    /* 控制面板手機收緊 */
    .control-panel {
        padding: 0.75rem !important;
        border-radius: var(--radius-md) !important;
    }
    .control-row {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch !important;
    }
    .btn-group {
        display: flex;
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    .btn-group > button {
        flex: 1;
        min-width: 80px;
    }

    /* 行事曆容器 */
    .calendar-container {
        padding: 0.625rem !important;
        border-radius: var(--radius-md) !important;
    }

    /* 月視圖 cell 高度收緊 */
    .month-day {
        min-height: 70px !important;
    }
    .month-day.today .month-day-date {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }
    .month-booking-item {
        font-size: 0.62rem !important;
    }

    /* Modal 全螢幕化 */
    .modal {
        width: 100% !important;
        max-width: calc(100vw - 1rem) !important;
        margin: 0.5rem !important;
        max-height: calc(100vh - 1rem) !important;
        border-radius: var(--radius-lg) !important;
    }
}

/* ==========================================================================
   設計系統識別膠囊 (參考 overview.html 的 style-stamp / V1 v1-style-stamp)
   一個低調的右下角浮動標籤, 標示目前主題 (本地測試 / 開發辨識用)
   生產環境若不需顯示, 可由 .design-stamp 的 display 控制
   ========================================================================== */
.design-stamp {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: var(--z-fab, 500);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    background: rgba(31, 77, 63, 0.92);
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
    user-select: none;
    opacity: 0.78;
    transition: opacity 0.2s;
}
.design-stamp:hover { opacity: 1; }
.design-stamp::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6BC79C;
    box-shadow: 0 0 8px #6BC79C;
}
@media (max-width: 640px) {
    .design-stamp {
        font-size: 0.65rem;
        padding: 0.3rem 0.65rem;
        bottom: 80px; /* 避開手機 FAB 與 home indicator */
    }
}


/* ==========================================================================
   v2.50.0 — 視覺化數據中心 (Dashboard) Polish 補丁
   修正: audit 篩選列、查詢按鈕、stat banner、紫粉殘色
   ========================================================================== */

/* --- Audit 篩選列: 邊線從 #cbd5e1 淡藍 改回 Pine 系 --- */
.audit-filter-select,
.audit-filter-input,
.audit-filter-date {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem !important;
    font-size: 0.875rem !important;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.audit-filter-select:focus,
.audit-filter-input:focus,
.audit-filter-date:focus {
    border-color: var(--primary-color) !important;
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-softer);
}
.audit-filter-input::placeholder { color: var(--text-muted); }

/* --- 查詢按鈕 (btnRefreshLogs): 之前完全沒樣式, 補上 Pine 主色 --- */
.btn-refresh-logs {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    height: 40px;
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 8px -2px rgba(31, 77, 63, 0.45);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
    flex: none;
}
.btn-refresh-logs:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.55);
}
.btn-refresh-logs:active {
    transform: translateY(1px);
}
.btn-refresh-logs svg { stroke: currentColor; }

/* --- 匯出系統日誌按鈕 (btnExportLogs): 次要動作, 白底綠字 --- */
.btn-export-logs {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    height: 38px;
    background: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-export-logs:hover {
    border-color: var(--primary-color);
    background: var(--accent-softer);
}

/* --- "📊 載入後顯示統計" banner: 從 #ede9fe → #fce7f3 紫粉漸層 改 Pine soft --- */
.audit-stats {
    background: linear-gradient(135deg, var(--accent-softer) 0%, var(--accent-soft) 100%) !important;
    border: 1px solid var(--accent-soft);
    border-radius: var(--radius-md) !important;
    padding: 0.6rem 0.85rem !important;
}
.audit-stat-chip {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary-darker) !important;
    border: 1px solid var(--accent-soft);
}
.audit-stat-chip.primary {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border: none;
}

/* --- 展開原始 JSON 按鈕: 紫色 #6366f1 → Pine --- */
.meta-expand-btn {
    color: var(--primary-color) !important;
    border-color: var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
}
.meta-expand-btn:hover {
    background: var(--primary-color) !important;
    color: #fff !important;
}

/* --- raw JSON 預覽: 配色用深綠系而非藍紫 --- */
.log-raw-json {
    background: #1A2C26 !important;
    color: #C9E5D6 !important;
    border-radius: var(--radius-md) !important;
}

/* --- audit-log 容器: 從 #f8fafc 淡藍灰 改 Pine 米色 --- */
.audit-log-container {
    background: linear-gradient(to bottom, var(--bg-alt), var(--bg-color)) !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- audit-log-item: 邊線色微調 --- */
.audit-log-item {
    border-color: var(--border-color) !important;
    border-radius: var(--radius-md) !important;
}

/* --- Dashboard footer 重新整理按鈕 (btn-refresh): 確保跟設計對齊 --- */
.btn-refresh {
    border-radius: var(--radius-md) !important;
}

/* --- Dashboard 頂部右側按鈕群: hover 動畫收斂 (8deg 旋轉太活潑) --- */
.dashboard-actions button:hover {
    transform: translateY(-1px) !important;
}
.dashboard-actions #btnDashboardClose:hover {
    transform: rotate(90deg) !important;
}


/* ==========================================================================
   v2.50.0 — Dashboard header 窄螢幕擠壓修正
   問題: 在 ~900-1100px 寬度時, 標題斷行 + 4 個 tab 中文擠成直排
   ========================================================================== */

/* --- 標題不能斷行 --- */
.dashboard-modal-header h3 {
    white-space: nowrap;
    flex: 0 0 auto;
    font-size: 1.25rem !important;  /* 1.5rem → 1.25rem 收一點 */
}

/* --- Tabs 容器允許水平捲動 (萬一真的擠不下) --- */
.dashboard-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.dashboard-tabs::-webkit-scrollbar { display: none; }

/* --- Tab 按鈕: 取消 uppercase + letter-spacing (對中文沒效, 反而吃寬度) --- */
.tab-btn {
    text-transform: none !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    flex-shrink: 0;
}

/* --- 中等螢幕 (≤1280px): 縮 tab padding + 字級, 別讓標題搶版面 --- */
@media (max-width: 1280px) {
    .dashboard-modal-header h3 {
        font-size: 1.1rem !important;
        gap: 0.5rem !important;
    }
    .tab-btn {
        padding: 0.5rem 0.95rem !important;
        font-size: 0.85rem !important;
    }
    .dashboard-actions button {
        width: 36px !important;
        height: 36px !important;
    }
}

/* --- 較窄 (≤1024px): 再壓一階, 標題僅顯示 icon (隱藏文字)? 暫不隱藏, 改為更小 --- */
@media (max-width: 1024px) {
    .dashboard-modal-header {
        padding: 1rem 1.25rem !important;
    }
    .dashboard-modal-header h3 {
        font-size: 1rem !important;
    }
    .tab-btn {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    .dashboard-tabs {
        padding: 4px !important;
    }
}


/* ==========================================================================
   v2.50.0 — Header RWD 多斷點 (字級大、清楚、不擠壓)
   - ≥1280px: 完整大標 (1.35rem) + sub (0.9rem)
   - 1024-1279px: 標準 (1.2rem / 0.85rem)
   - 768-1023px: 緊湊 (1.05rem / 0.78rem) — sub 仍顯示
   - 640-767px: 隱藏 sub, 標題 1rem, 收緊整行
   - ≤640px: header 全面 mobile (logo 縮小, LINE 隱藏文字)
   ========================================================================== */

/* --- 中型桌面 1024-1279px --- */
@media (max-width: 1280px) {
    .header-title {
        font-size: 1.2rem !important;
        gap: 0.75rem;
    }
    .header-title .title-main {
        font-size: 1.2rem !important;
    }
    .header-title .title-sub {
        font-size: 0.85rem !important;
    }
    .header-title svg {
        width: 44px;
        height: 44px;
        padding: 11px;
    }
    .header-content {
        gap: 0.875rem;
    }
}

/* --- 平板 768-1023px: title-sub 縮但仍可見 --- */
@media (max-width: 1024px) {
    .header {
        padding: 0.75rem 1.125rem !important;
    }
    .header-title {
        font-size: 1.1rem !important;
        gap: 0.625rem;
    }
    .header-title .title-main {
        font-size: 1.1rem !important;
    }
    .header-title .title-sub {
        font-size: 0.78rem !important;
        margin-bottom: 2px !important;
    }
    .header-title svg {
        width: 42px;
        height: 42px;
        padding: 10px;
    }
    /* 4 個 icon 圓鈕縮小 */
    .header .btn-setting,
    .header .btn-dashboard,
    .header .btn-announcement {
        width: 34px;
        height: 34px;
    }
    .header .btn-line-bind,
    .header .btn-admin {
        height: 34px !important;
        padding: 0.35rem 0.75rem !important;
        font-size: 0.78rem !important;
    }
}

/* --- 中型手機 640-767px: 隱藏 sub, 標題單行 --- */
@media (max-width: 768px) {
    .header {
        padding: 0.625rem 1rem !important;
    }
    .header-title {
        font-size: 1rem !important;
        gap: 0.5rem;
    }
    .header-title .title-main {
        font-size: 1rem !important;
    }
    .header-title .title-sub {
        display: none !important;       /* 副標收掉, 騰空間給按鈕 */
    }
    .header-title svg {
        width: 38px;
        height: 38px;
        padding: 9px;
        border-radius: 10px;
    }
    .header-content {
        gap: 0.5rem;
    }
}

/* --- 小型手機 ≤640px: 進一步緊縮, LINE 收成 logo only --- */
@media (max-width: 640px) {
    .header-title .title-main {
        font-size: 0.95rem !important;
        max-width: 11ch;                /* 太長就 ellipsis */
    }
    .header .btn-line-bind .line-bind-label {
        display: none !important;
    }
    .header .btn-line-bind {
        padding: 0.35rem 0.55rem !important;
    }
    .header-admin .admin-name {
        display: none;                  /* 用戶名不顯示, 點頭像才看到 */
    }
}

/* --- 超小手機 ≤420px: 標題只剩 logo + 「預約系統」 --- */
@media (max-width: 420px) {
    .header-title .title-main {
        max-width: 8ch;
    }
    .header .btn-admin span {
        display: none;                  /* 「管理員」字隱藏, 只剩 icon */
    }
    .header .btn-setting,
    .header .btn-dashboard,
    .header .btn-announcement {
        width: 32px;
        height: 32px;
    }
}


/* ==========================================================================
   v2.50.0 — 手機端 header 緊縮 + design stamp 收起 + 殘留紫色按鈕修正
   ========================================================================== */

/* --- 1. .btn-stats / .btn-history 殘留紫色漸層 → Pine 實心 --- */
.btn-stats {
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 2px 8px -2px rgba(31, 77, 63, 0.45) !important;
}
.btn-stats:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.55) !important;
    transform: translateY(-1px);
}
.btn-history {
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 2px 8px -2px rgba(31, 77, 63, 0.45) !important;
}
.btn-history:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.55) !important;
    transform: translateY(-1px);
}

/* --- 2. Header 在所有寬度都鎖定單列, 不允許 wrap --- */
.header-content {
    flex-wrap: nowrap !important;
}

/* --- 3. 手機 header 緊縮 (≤640px): 隱藏次要圖示按鈕 + 收緊 --- */
@media (max-width: 640px) {
    .header {
        padding: 0.5rem 0.75rem !important;
    }
    .header-content {
        gap: 0.4rem !important;
    }

    /* 標題 + logo 縮成一個小品牌組合 */
    .header-title {
        gap: 0.5rem !important;
        flex: 1 1 auto;
        min-width: 0;
    }
    .header-title svg {
        width: 34px !important;
        height: 34px !important;
        padding: 7px !important;
        border-radius: 8px !important;
    }
    .header-title .title-main {
        font-size: 0.92rem !important;
        max-width: 100%;
    }

    /* 隱藏 admin 三個次要圖示 (設定/儀表板/公告) — 進入儀表板後再操作 */
    .header .btn-setting,
    .header .btn-dashboard,
    .header .btn-announcement {
        display: none !important;
    }

    /* 隱藏 admin name (儀表板裡可看完整資訊) */
    .header-admin .admin-name {
        display: none !important;
    }

    /* LINE 按鈕只剩 logo, 不再有「綁定 LINE」字 */
    .header .btn-line-bind {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        justify-content: center;
    }
    .header .btn-line-bind .line-bind-label {
        display: none !important;
    }

    /* 管理員按鈕只剩 icon */
    .header .btn-admin {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        justify-content: center;
    }
    .header .btn-admin span {
        display: none !important;
    }

    .header-admin {
        gap: 0.35rem !important;
        flex: none;
    }
}

/* --- 4. 超小 (≤380px): 標題壓最小, 仍維持單列 --- */
@media (max-width: 380px) {
    .header-title svg {
        width: 30px !important;
        height: 30px !important;
        padding: 6px !important;
    }
    .header-title .title-main {
        font-size: 0.82rem !important;
    }
}

/* --- 5. design-stamp 在小螢幕直接隱藏 (避免擋功能) --- */
@media (max-width: 768px) {
    .design-stamp {
        display: none !important;
    }
}


/* ==========================================================================
   v2.50.0 — 預約詳情 Modal Polish
   修正: 標題在 Pine 底上不可見 + 卡片整體精緻度
   ========================================================================== */

/* --- 標題: 強制白字 (覆蓋早期規則 .delete-modal-header h3 → text-primary) --- */
.delete-modal-header {
    color: #fff !important;
    padding: 1.5rem 1.25rem 1.25rem !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.delete-modal-header h3 {
    color: #fff !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
    font-family: var(--font-display);
    margin: 0 !important;
}
/* Header icon 收柔 */
.delete-modal-header svg {
    width: 36px !important;
    height: 36px !important;
    stroke-width: 2 !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)) !important;
    margin-bottom: 0 !important;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    padding: 7px;
    border-radius: 50%;
    box-sizing: content-box;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
/* 收掉舊的 radial glow ::after - 太誇張 */
.delete-modal-header::after {
    opacity: 0.25 !important;
}

/* --- 預約詳情主體: 改用 grid 對齊欄位 --- */
.delete-booking-info {
    padding: 1.25rem 1.5rem !important;
    background: var(--bg-alt) !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    border-bottom: 1px solid var(--border-color);
}

.delete-booking-info .info-item {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}
.delete-booking-info .info-item:last-child {
    border-bottom: none;
}

.delete-booking-info .info-item strong {
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    width: auto !important;
    margin-right: 0 !important;
    letter-spacing: 0.02em;
}
.delete-booking-info .info-item span {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
}

/* --- 主預約者姓名特別強調 (節次 + 預約者 用 primary-dark) --- */
.delete-booking-info .info-item:nth-child(2) span,    /* 節次 */
.delete-booking-info .info-item:nth-child(3) span {   /* 預約者 */
    color: var(--primary-darker);
    font-weight: 700;
}

/* --- Footer 按鈕區: 收緊 + 統一圓角 --- */
.delete-modal-actions {
    padding: 0.875rem 1.25rem !important;
    background: var(--card-bg) !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    gap: 0.625rem !important;
}
.btn-delete-cancel,
.btn-delete-confirm {
    border-radius: var(--radius-md) !important;
    padding: 0.7rem 1rem !important;
    min-height: 42px !important;
    font-size: 0.95rem !important;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s !important;
}
.btn-delete-cancel {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
}
.btn-delete-cancel:hover {
    background: var(--surface-2) !important;
    border-color: var(--text-secondary) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* 「登入後取消 / 取消預約」按鈕保留 coral red (danger) 但收柔光暈 */
.btn-delete-confirm {
    background: linear-gradient(135deg, #E76A6A 0%, #B45049 100%) !important;
    box-shadow: 0 2px 8px -2px rgba(180, 80, 73, 0.45) !important;
}
.btn-delete-confirm:hover {
    box-shadow: 0 4px 12px -2px rgba(180, 80, 73, 0.55) !important;
    filter: brightness(1.05) !important;
    transform: translateY(-1px) !important;
}

/* --- Modal 容器: 圓角 + 影子柔化 --- */
.delete-modal {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
    max-width: 380px;
    width: calc(100vw - 2rem);
}

/* --- 手機: 字級略縮, footer 直排 --- */
@media (max-width: 480px) {
    .delete-modal-header {
        padding: 1.25rem 1rem 1rem !important;
    }
    .delete-modal-header h3 {
        font-size: 1.1rem !important;
    }
    .delete-booking-info {
        padding: 1rem 1.125rem !important;
        font-size: 0.9rem !important;
    }
    .delete-booking-info .info-item {
        grid-template-columns: 60px 1fr;
    }
}


/* ==========================================================================
   v2.50.3 — 二輪 modal 巡檢: 補殘留紫色 + 統計/歷史/PWA banner Pine 化
   ========================================================================== */

/* --- 1. 歷史記錄按鈕 .btn-history: 半綠半紫 → Pine 實心 --- */
/*    (前段已有 polish 但 specifity 不夠, 加 !important 確保覆蓋) */
.btn-history {
    background: var(--primary-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 2px 8px -2px rgba(31, 77, 63, 0.45) !important;
}
.btn-history:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 12px -2px rgba(31, 77, 63, 0.55) !important;
    transform: translateY(-1px) !important;
}

/* --- 2. 歷史記錄 modal header: 半 Pine 半紫 → 純 Pine 漸層 --- */
.history-modal-header {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1.5rem !important;
}
.history-modal-header h3 {
    color: #fff !important;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- 3. PWA 更新 banner: 紫→Pine→粉 三色漸層 → 純 Pine + 副色點綴 --- */
.pwa-update-banner {
    background: var(--primary-gradient) !important;
    box-shadow: 0 12px 40px rgba(20, 40, 30, 0.35),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
}

/* --- 4. 統計分析直方圖紫色 → Pine 漸層 --- */
.histogram-bar {
    background: linear-gradient(180deg, #4F9D6E 0%, #1F4D3F 100%) !important;
}

/* --- 5. 取消率 bar 保留紅色但收柔 --- */
.analytics-bar-fill.cancel-fill {
    background: linear-gradient(90deg, #E76A6A 0%, #B45049 100%) !important;
}

/* --- 6. 歷史批次切換按鈕 .btn-history-batch-toggle: 紫 → Pine --- */
.btn-history-batch-toggle:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-dark) !important;
}
.btn-history-batch-toggle.active {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border-color: transparent !important;
}
.btn-history-batch-toggle {
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-md) !important;
}

/* --- 7. 批次選中的歷史項目: lavender+pink 漸層 → Pine soft --- */
.history-item.batch-selected {
    background: linear-gradient(135deg, var(--accent-softer) 0%, var(--accent-soft) 100%) !important;
    border-left: 4px solid var(--primary-color) !important;
}
.history-batch-checkbox {
    accent-color: var(--primary-color) !important;
}

/* --- 8. 統計 modal header: gradient text → 純 Pine 深色 (與其他 modal 一致) --- */
.stats-modal-header {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1.5rem !important;
    border-bottom: none !important;
}
.stats-modal-header h3 {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: #fff !important;
    color: #fff !important;
    font-family: var(--font-display);
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    letter-spacing: -0.01em !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- 9. 統計 modal close 按鈕: 紅色 → 半透明白 (適配 Pine header) --- */
.btn-stats-close {
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
}
.btn-stats-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    transform: rotate(90deg) !important;
}

/* --- 10. 公告 modal header: 暖橘漸層保留 (語意: 注意/通知), 但收柔 --- */
.announcement-modal-header {
    background: linear-gradient(135deg, #C97B3F 0%, #A0612D 100%) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.announcement-modal-header h3 {
    color: #fff !important;
    font-family: var(--font-display);
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- 11. 設定 modal header: 已是 Pine, 補白字 + 圓角 --- */
.settings-modal-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.settings-modal-header h3 {
    color: #fff !important;
    font-family: var(--font-display);
    font-weight: 700;
}

/* --- 12. 搜尋 modal header: 已是 Pine, 補圓角 --- */
.search-modal-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.search-modal-header h3 {
    color: #fff !important;
    font-family: var(--font-display);
    font-weight: 700;
}

/* --- 13. 各 modal close 按鈕統一 (X 鈕在綠 header 上) --- */
.history-modal-close,
.search-modal-close,
.settings-modal-close,
.announcement-modal-close {
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    transition: all 0.2s !important;
}
.history-modal-close:hover,
.search-modal-close:hover,
.settings-modal-close:hover,
.announcement-modal-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    transform: rotate(90deg) !important;
}


/* ==========================================================================
   v2.50.4 — Admin 身分視覺化: badge + logout 按鈕
   讓使用者一眼看到目前是不是管理員身份, 並能明確登出
   ========================================================================== */

.admin-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    height: 36px;
    background: linear-gradient(135deg, #4F9D6E 0%, #1F4D3F 100%);
    color: #fff;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 2px 6px -1px rgba(31, 77, 63, 0.4);
    letter-spacing: 0.02em;
    user-select: none;
    flex: none;
    box-sizing: border-box;
}
.admin-status-badge .admin-badge-email {
    font-weight: 500;
    opacity: 0.95;
    font-family: 'Plus Jakarta Sans', 'Noto Sans TC', sans-serif;
    font-size: 0.74rem;
}

.btn-admin-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #FDF2F1;
    border: 1px solid #E8C7C5;
    color: #B45049;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    flex: none;
    box-sizing: border-box;
}
.btn-admin-logout:hover {
    background: #B45049;
    color: #fff;
    border-color: #B45049;
    transform: rotate(-8deg);
}
.btn-admin-logout svg {
    width: 16px;
    height: 16px;
}

/* 手機 (≤640px): admin badge 收成只剩 🔓 icon, email 字隱藏避免擠爆 header */
@media (max-width: 640px) {
    .admin-status-badge {
        padding: 0 0.5rem;
        height: 36px;
        width: auto;
    }
    .admin-status-badge .admin-badge-email {
        display: none;
    }
    .btn-admin-logout {
        width: 32px;
        height: 32px;
    }
}


/* ==========================================================================
   v2.50.5 — 統計 modal 標題改用 CSS class (取代壞掉的 inline gradient text)
   問題: 「預約統計」原本用 -webkit-text-fill-color: transparent + Pine
   gradient 當背景的 gradient text 技巧, 在白底 header 上很美, 但 v2.50.3
   把 header 改 Pine 後 → Pine 字在 Pine 底完全融合 = 隱形。
   ========================================================================== */

/* --- statsModalTitle h3 容器: 接管原本 inline 的 flex 設定 --- */
#statsModalTitle {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
}
#statsModalTitle svg {
    color: #fff;
    flex: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* --- 場地名稱 pill (例如「禮堂」): 純白實底 + Pine 深字 + 邊光環, 強對比凸顯於 Pine header ---
   注意 specificity: 用 #statsModalTitle .stats-room-pill (1,0,1,0) 才能贏過
   父層 #statsModalTitle { color: #fff } (1,0,0,0); 否則文字會被 inherit 成白色 → 白底白字隱形。
*/
#statsModalTitle .stats-room-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 16px;
    background: #FFFFFF;
    color: var(--primary-darker);
    -webkit-text-fill-color: var(--primary-darker);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.02em;
    /* 雙層光環: 細白外環 + 柔深陰影 */
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.35),
        0 3px 8px -2px rgba(0, 0, 0, 0.25);
    position: relative;
}
.stats-room-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-right: 6px;
    box-shadow: 0 0 0 2px rgba(31, 77, 63, 0.18);
}

/* --- 「預約統計」主標題: 純白, 不再用 gradient text 技巧 --- */
.stats-title-text {
    color: #fff;
    -webkit-text-fill-color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    font-family: var(--font-display);
}

/* --- 手機 ≤640px: 字級略縮 --- */
@media (max-width: 640px) {
    .stats-title-text {
        font-size: 1.1rem;
    }
    .stats-room-pill {
        font-size: 0.85rem;
        padding: 3px 10px;
    }
    #statsModalTitle svg {
        width: 20px;
        height: 20px;
    }
}


/* ===== v2.51.0 (L 系列): 匯出區間彈窗 + 學期感知 chips ===== */

.range-chip {
    padding: 5px 14px;
    border: 1.5px solid var(--border-color, #d8e0dc);
    border-radius: 999px;
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #4a5a54);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.range-chip:hover {
    border-color: var(--primary-color, #1F4D3F);
    color: var(--primary-dark, #163A2F);
}

.range-chip.active {
    background: var(--primary-color, #1F4D3F);
    border-color: var(--primary-color, #1F4D3F);
    color: #fff;
    font-weight: 700;
}

/* 匯出彈窗 */
.export-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: var(--z-modal-primary, 2000);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.export-modal-overlay.active {
    display: flex;
}

.export-modal {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.export-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--primary-gradient, linear-gradient(135deg, #1D5C48, #163A2F));
    border-radius: 16px 16px 0 0;
}

.export-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 1.1rem;
    margin: 0;
}

.btn-export-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 6px;
    cursor: pointer;
    display: flex;
}

.btn-export-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.export-modal-body {
    padding: 1.25rem;
}

.export-hint {
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5a54);
    margin: 0 0 0.75rem;
}

.export-range-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.export-custom-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.export-custom-range input[type="date"] {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color, #d8e0dc);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary, #21322c);
    background: var(--card-bg, #fff);
}

.export-range-tilde {
    color: var(--text-muted, #8a9a94);
}

.export-range-desc {
    font-size: 0.85rem;
    color: var(--primary-dark, #163A2F);
    background: var(--primary-soft, #eaf3ef);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 0 1rem;
    min-height: 1.2em;
}

.export-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-export-run,
.btn-export-archive {
    flex: 1;
    min-width: 150px;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-export-run {
    background: var(--primary-color, #1F4D3F);
    color: #fff;
}

.btn-export-run:hover {
    background: var(--primary-dark, #163A2F);
}

.btn-export-archive {
    background: var(--card-bg, #fff);
    color: var(--primary-dark, #163A2F);
    border: 2px solid var(--primary-color, #1F4D3F);
}

.btn-export-archive:hover {
    background: var(--primary-soft, #eaf3ef);
}

.export-archive-note {
    font-size: 0.8rem;
    color: var(--text-muted, #8a9a94);
    margin: 0.85rem 0 0;
    line-height: 1.55;
}

/* 歷史彈窗學期 chips */
.history-semester-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* 統計彈窗區間 chips */
.stats-range-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .export-actions {
        flex-direction: column;
    }
    .btn-export-run,
    .btn-export-archive {
        min-width: 0;
    }
}


/* ===== v2.52.0 (L.5): 資料庫健康卡 ===== */
.data-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.data-health-item {
    background: var(--card-bg, #fff);
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 12px;
    padding: 0.85rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.dh-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-dark, #163A2F);
    font-variant-numeric: tabular-nums;
}

.dh-label {
    font-size: 0.78rem;
    color: var(--text-muted, #94998F);
    text-align: center;
}

.data-health-note {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted, #94998F);
    line-height: 1.5;
}

.data-health-note a {
    color: var(--primary-color, #1F4D3F);
}


/* ===== v2.52.0 (M.3): 我的預約 個人化儀表板 ===== */
.btn-mybookings {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    color: var(--primary-dark, #163A2F);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-mybookings:hover {
    background: var(--primary-soft, #eaf3ef);
    border-color: var(--primary-color, #1F4D3F);
}

.mybookings-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: var(--z-modal-secondary, 1000);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.mybookings-modal-overlay.active {
    display: flex;
}

.mybookings-modal {
    background: var(--bg-color, #F7F5EC);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mybookings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--primary-gradient, linear-gradient(135deg, #1F4D3F, #103127));
    flex-shrink: 0;
}

.mybookings-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 1.15rem;
    margin: 0;
}

.btn-mybookings-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 6px;
    cursor: pointer;
    display: flex;
}

.btn-mybookings-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mybookings-modal-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
}

.mybookings-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.mb-stat {
    background: var(--card-bg, #fff);
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 12px;
    padding: 0.7rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.mb-stat-hl {
    border-color: var(--primary-color, #1F4D3F);
    background: var(--primary-soft, #eaf3ef);
}

.mb-stat-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark, #163A2F);
    font-variant-numeric: tabular-nums;
}

.mb-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted, #94998F);
}

.mybookings-section {
    margin-bottom: 1.1rem;
}

.mybookings-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.98rem;
    color: var(--primary-dark, #163A2F);
    margin: 0 0 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--border-color, #E1DECF);
}

.mybookings-section-count {
    margin-left: auto;
    background: var(--primary-color, #1F4D3F);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 9px;
}

.mybookings-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mybookings-section-empty {
    font-size: 0.85rem;
    color: var(--text-muted, #94998F);
    padding: 0.4rem 0.2rem;
    margin: 0;
}

.mybookings-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted, #94998F);
}

.mybookings-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.mybookings-empty-hint {
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.mybookings-note {
    font-size: 0.78rem;
    color: var(--text-muted, #94998F);
    margin: 0.5rem 0 0;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .mybookings-label { display: none; }
    .mybookings-summary { grid-template-columns: repeat(2, 1fr); }
}


/* ===== v2.53.0 (P1-5): 通知偏好 ===== */
.notifprefs-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    background: var(--card-bg, #fff);
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
}

.notifprefs-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-dark, #163A2F);
    width: 100%;
}

.notifprefs-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--text-primary, #162622);
    cursor: pointer;
}

.notifprefs-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color, #1F4D3F);
    cursor: pointer;
}

.notifprefs-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #94998F);
    margin-left: auto;
}


/* ===== v2.54.0 (P1-3): 預約異動履歷 Edit Trail ===== */
.edittrail-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.edittrail-hint {
    font-size: 0.82rem;
    color: var(--text-muted, #94998F);
    margin: 0;
}

.edittrail-filter {
    padding: 8px 12px;
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 10px;
    font-size: 0.9rem;
    max-width: 340px;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #162622);
}

.edittrail-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 55vh;
    overflow-y: auto;
}

.edittrail-item {
    background: var(--card-bg, #fff);
    border: 1.5px solid var(--border-color, #E1DECF);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
}

.edittrail-item.et-created { border-left-color: #4caf50; }
.edittrail-item.et-updated { border-left-color: #ff9800; }
.edittrail-item.et-deleted { border-left-color: #f44336; }

.et-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.et-type {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark, #163A2F);
    flex-shrink: 0;
}

.et-summary {
    font-size: 0.85rem;
    color: var(--text-primary, #162622);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.et-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted, #94998F);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.et-change {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    font-size: 0.82rem;
}

.et-field {
    background: var(--primary-soft, #eaf3ef);
    color: var(--primary-dark, #163A2F);
    font-weight: 700;
    border-radius: 6px;
    padding: 1px 8px;
    flex-shrink: 0;
}

.et-before {
    color: var(--text-muted, #94998F);
    text-decoration: line-through;
}

.et-arrow { color: var(--text-muted, #94998F); }

.et-after {
    color: var(--primary-dark, #163A2F);
    font-weight: 700;
}

.edittrail-empty {
    text-align: center;
    color: var(--text-muted, #94998F);
    padding: 1.5rem;
    font-size: 0.9rem;
}


/* ===== v2.54.0 (P1-7): 成就徽章 ===== */
.mybookings-achievements {
    margin-bottom: 1.1rem;
}

.achievements-title {
    font-size: 0.98rem;
    color: var(--primary-dark, #163A2F);
    margin: 0 0 0.5rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
}

.achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: var(--card-bg, #fff);
    border: 1.5px solid var(--border-color, #E1DECF);
    border-radius: 12px;
    padding: 0.6rem 0.3rem;
    text-align: center;
    transition: transform 0.15s ease;
}

.achievement.unlocked {
    border-color: var(--primary-color, #1F4D3F);
    background: var(--primary-soft, #eaf3ef);
}

.achievement.unlocked:hover { transform: translateY(-2px); }

.achievement.locked {
    opacity: 0.55;
    filter: grayscale(0.9);
}

.ach-icon { font-size: 1.5rem; line-height: 1; }

.ach-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-dark, #163A2F);
}

.ach-progress {
    font-size: 0.7rem;
    color: var(--text-muted, #94998F);
    font-variant-numeric: tabular-nums;
}

.achievement.unlocked .ach-progress {
    color: var(--primary-color, #1F4D3F);
    font-weight: 700;
}


/* ===== v2.54.1: 設定彈窗內場地下拉 (深色 header 上) ===== */
.settings-room-select {
    margin-left: 4px;
    padding: 5px 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    max-width: 240px;
}

.settings-room-select:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.7);
}

.settings-room-select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 1px;
}

/* 下拉展開的選項在系統白底上, 用深色字 */
.settings-room-select option {
    color: var(--text-primary, #162622);
    background: #fff;
    font-weight: 500;
}
