html,
        body {
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
            /* 防止整體頁面捲動，由內部容器處理 */
            position: fixed;
            /* 防止 iOS PWA 跳動 */
            width: 100%;
        }

        body {
            background-color: #f9f8f4;
            color: #1a1a1a;
            font-family: 'Noto Sans TC', sans-serif;
            display: flex;
            flex-direction: column;
        }

        .scrollable-y {
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-y: contain;
            touch-action: pan-y;
        }

        .hidden-section {
            display: none !important;
        }

        /* UI Components */
        .logo-display-area {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100px;
            width: 100%;
            margin-bottom: 20px;
        }

        .logo-img {
            max-height: 100%;
            max-width: 100%;
            object-fit: contain;
        }

        .admin-logo-uploader {
            border: 2px dashed #b89d5a;
            background-color: #f5f0e6;
            color: #b89d5a;
            height: 120px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
            border-radius: 8px;
        }

        .admin-logo-uploader:hover {
            background-color: #eaddc5;
        }

        /* Calendar */
        .calendar-grid {
            display: grid;
            grid-template-columns: repeat(7, minmax(0, 1fr));
            gap: 4px;
        }

        .day-cell {
            min-height: 85px;
            min-width: 0;
            /* 防止網格單元格被內容撐開 */
            border: 1px solid #e5e5e5;
            background: white;
            padding: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            overflow: hidden;
            /* 確保內容超出時能正確處理 */
        }

        .day-cell:hover {
            border-color: #b89d5a;
            box-shadow: 0 4px 10px rgba(184, 157, 90, 0.15);
        }

        .day-readonly {
            background-color: #f8fafc;
            cursor: default;
            opacity: 0.9;
            border-color: #eee;
        }

        .day-locked {
            background-color: #fffbeb;
            border: 1px solid #fbbf24;
            cursor: pointer;
        }

        .day-period {
            border: 2px dashed #b89d5a !important;
        }

        .warning-cell {
            background-color: #fef2f2 !important;
            border: 2px solid #ef4444 !important;
        }

        /* Mobile Calendar Optimization */
        @media (max-width: 1024px) {
            .calendar-grid {
                gap: 3px;
            }

            .day-cell {
                min-height: 70px;
                padding: 4px;
                font-size: 11px;
                border-radius: 4px;
            }

            .day-cell .tag {
                font-size: 9px;
                /* 手機版字體稍微調小 */
                padding: 1px 3px;
                margin-top: 2px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                display: block;
                /* 確保 ellipsis 生效 */
                width: 100%;
                /* 強制寬度受控於父容器 */
                max-width: 100%;
                border-radius: 3px;
            }

            .day-cell .font-bold.text-sm {
                font-size: 13px;
                margin-bottom: 2px;
            }

            /* Make date numbers more prominent */
            .day-cell>div:first-child {
                font-weight: bold;
                margin-bottom: 4px;
            }

            /* Hide punch time on mobile to keep layout clean */
            .day-cell div[title],
            .punch-time-display {
                display: none !important;
            }
        }

        /* Components */
        .dept-chip {
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            cursor: pointer;
            border: 1px solid #e5e5e5;
            background: white;
            color: #666;
            transition: all 0.2s;
            user-select: none;
        }

        .dept-chip.active {
            background-color: #b89d5a;
            color: white;
            border-color: #b89d5a;
            font-weight: bold;
        }

        .sidebar-item.active {
            background-color: #f5f0e6;
            color: #b89d5a;
            border-right: 4px solid #b89d5a;
            font-weight: bold;
        }

        .btn-gold {
            background-color: #b89d5a;
            color: white;
            transition: 0.2s;
        }

        .btn-gold:hover {
            background-color: #9e8545;
        }

        .btn-disabled {
            background-color: #d1d5db;
            color: #6b7280;
            cursor: not-allowed;
        }

        /* Toggle */
        .toggle-checkbox:checked {
            right: 0;
            border-color: #b89d5a;
        }

        .toggle-checkbox:checked+.toggle-label {
            background-color: #b89d5a;
        }

        /* Tabs */
        .staff-tabs-container {
            display: flex;
            background-color: #f3f4f6;
            padding: 4px;
            border-radius: 12px;
            margin-bottom: 20px;
        }

        .staff-tab {
            flex: 1;
            text-align: center;
            cursor: pointer;
            padding: 10px 8px;
            border-radius: 8px;
            color: #6b7280;
            transition: all 0.2s;
            font-size: 14px;
            font-weight: 500;
        }

        .staff-tab.active {
            background-color: white;
            color: #b89d5a;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            font-weight: bold;
        }

        /* Mobile Responsive Tables */
        @media (max-width: 768px) {
            .mobile-table thead {
                display: none;
            }

            .mobile-table tbody tr {
                display: block;
                background: white;
                margin-bottom: 12px;
                border-radius: 12px;
                border: 1px solid #e5e7eb;
                padding: 12px 14px;
                box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            }

            .mobile-table td {
                display: flex;
                justify-content: space-between;
                align-items: flex-start;
                padding: 6px 0;
                border-bottom: 1px solid #f3f4f6;
                text-align: right;
                font-size: 13px;
            }

            .mobile-table td.mobile-col {
                flex-direction: column;
                align-items: stretch;
                text-align: left;
            }

            .mobile-table td:last-child {
                border-bottom: none;
            }

            .mobile-table td::before {
                content: attr(data-label);
                font-weight: 600;
                color: #6b7280;
                text-align: left;
                margin-right: 8px;
                flex-shrink: 0;
                font-size: 12px;
            }

            .mobile-table td.mobile-col::before {
                margin-bottom: 4px;
            }
        }

        /* Notification */
        .notification-bell {
            position: relative;
            cursor: pointer;
        }

        .notification-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background-color: #ef4444;
            color: white;
            font-size: 10px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        .notification-dropdown {
            position: absolute;
            right: 0;
            top: 120%;
            width: 300px;
            max-width: 90vw;
            background: white;
            border: 1px solid #e5e5e5;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            z-index: 9999;
            display: none;
        }

        .notification-dropdown.show {
            display: block;
        }

        @media (max-width: 768px) {
            .notification-dropdown {
                position: fixed;
                right: 8px;
                top: calc(60px + env(safe-area-inset-top, 0px));
                left: auto;
                width: calc(100vw - 16px);
                max-width: 400px;
            }

            .notification-bell {
                z-index: 10000;
            }

            header {
                padding-top: env(safe-area-inset-top, 0px) !important;
                height: calc(4rem + env(safe-area-inset-top, 0px)) !important;
            }
        }

        .notification-dropdown.show {
            display: block;
        }

        /* Colors */
        .tag {
            font-size: 11px;
            padding: 2px 6px;
            border-radius: 2px;
            font-weight: 500;
            width: fit-content;
            margin-top: 2px;
        }

        .bg-work {
            background-color: #fff;
        }

        .bg-holiday {
            background-color: #fff1f0;
            border-left: 3px solid #ff4d4f;
        }

        .bg-weekend {
            background-color: #fafafa;
            color: #bfbfbf;
        }

        .bg-overtime {
            background-color: #fcfbf6;
            border-left: 3px solid #b89d5a;
        }

        .bg-comp {
            background-color: #f6ffed;
            border-left: 3px solid #52c41a;
        }

        .bg-annual {
            background-color: #e6f7ff;
            border-left: 3px solid #1890ff;
        }

        .bg-sick {
            background-color: #fffbe6;
            border-left: 3px solid #faad14;
        }

        .bg-personal {
            background-color: #f5f5f5;
            border: 1px dashed #d9d9d9;
        }

        .bg-official {
            background-color: #e6fffb;
            border-left: 3px solid #13c2c2;
        }

        .bg-funeral {
            background-color: #e5e5e5;
            border-left: 3px solid #525252;
        }

        .bg-custom-shift {
            background-color: #f0f5ff;
            border-left: 3px solid #3b82f6;
        }

        .preview-modal {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 60;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .preview-content {
            background: white;
            width: 90%;
            max-width: 800px;
            max-height: 90vh;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
            -webkit-overflow-scrolling: touch;
            overflow-y: auto;
        }
